av-savchenko / face-emotion-recognition

Efficient face emotion recognition in photos and videos
Apache License 2.0
654 stars 124 forks source link

Can not load pretrained models #2

Closed DefTruth closed 3 years ago

DefTruth commented 3 years ago
 File "/Users/xxx/Library/Python/3.8/lib/python/site-packages/timm/models/efficientnet_blocks.py", line 47, in forward
    return x * self.gate(x_se)
  File "/Users/xxx/Library/Python/3.8/lib/python/site-packages/torch/nn/modules/module.py", line 947, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'SqueezeExcite' object has no attribute 'gate'
av-savchenko commented 3 years ago

It seems that the versions of timm (pytorch-image-models) on my server and yours are different… Could you clarify what is exact cell in train_emotions-pytorch.ipynb that does not work? If it is “model = torch.load(PATH)”, please, let me know the version of timm. I used latest repository cloned several months ago, so that it is possible that there are some changes there. In addition, could you verify that the following code works fine for you model=timm.create_model('tf_efficientnet_b0_ns', pretrained=False) model=timm.create_model('tf_efficientnet_b0_ns', pretrained=True) ?

24 июля 2021 г., в 12:10, Def++ @.***> написал(а):

File "/Users/xxx/Library/Python/3.8/lib/python/site-packages/timm/models/efficientnet_blocks.py", line 47, in forward return x * self.gate(x_se) File "/Users/xxx/Library/Python/3.8/lib/python/site-packages/torch/nn/modules/module.py", line 947, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'SqueezeExcite' object has no attribute 'gate' — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/HSE-asavchenko/face-emotion-recognition/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFZQMVAUTCBBGUZLP46QZYDTZJ7P3ANCNFSM5A5JFY3A.

DefTruth commented 3 years ago

Many thanks ~ I have solved this problem when i use timm==0.4.5 and successful reimplement the inference with c++.

Class Size From Awesome File Type State Usage
EfficientEmotion7 15M face-emo... 🔥↑ face::attr ✅️ demo & cpp
EfficientEmotion8 15M face-emo... 🔥↑ face::attr demo & cpp
MobileEmotion7 13M face-emo... 🔥↑ face::attr demo & cpp
ReXNetEmotion7 30M face-emo... 🔥↑ face::attr demo & cpp
av-savchenko commented 3 years ago

Ok, thanks for letting me know and sharing your code! Closing the issue now