justusschock / shapenet

PyTorch implementation of "Super-Realtime Facial Landmark Detection and Shape Fitting by Deep Regression of Shape Model Parameters" predicting facial landmarks with up to 400 FPS

Home Page:https://shapenet.rtfd.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG]AttributeError: img_size not available for jitted models

AlmogDavid opened this issue · comments

What is the PyTorch version you used for training?
Im not able to restore the weights, i get this error:
AttributeError: 'ScriptModule' object has no attribute 'img_size'

What PyTorch version are you using?

You're right, I was able to reproduce this. The problem is, that class attributes aren't stored via torch.jit

To fix this, you need to replace

pred = process_sample(_data, img_size=net.img_size, net=net, device=device)

by

pred = process_sample(_data, img_size=config_dict["data"]["img_size"], net=net, device=device)

since we're just using the image size of the config file instead (or you can just pull the latest version, since I just pushed these changes).

I have tested this exact script with the non-jitted version only. Sorry for the inconvenience.

Thank's for your fast response, now it works!