av-savchenko / face-emotion-recognition

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

affectnet march2021 version training script update #22

Closed sunggukcha closed 1 year ago

sunggukcha commented 1 year ago

As mentioned in #14 , we have different version of affectnet versions. I updated pytorch training script for AffectNet march2021. Two notes are

sunggukcha commented 1 year ago

AffectNet (March2021 ver.) Validation score

Model AffectNet 8 AffectNet 7
EfficientNet_b0_best_afew 59.5649 63.9429
EfficientNet_b0_best_vgaf 60.7152 64.2286
EfficientNet_b0 (ours, horizontal flip augmented) 62.3406 65.5714
av-savchenko commented 1 year ago

Hello! Thanks for your nice contribution! I will be really glad to merge it. however, there are very small comments:

  1. Could you replace PATH variable in the end? It is the same as one of my models now
  2. Do you know why does the validation set contain only 3999 images? It is a small difference with 4000 photos, but comparison with previous results may be difficult... If you do not know where is the missed image, may be you could recompute scores of my previous models for new validation set with correct mapping of previous class indices to new class order? It will be good to see such code in your notebook.
sunggukcha commented 1 year ago

Hello Andrey!

  1. I will.
  2. I think it is due to the difference in version. Very lately I got AffectNet from the author (phd. Mohammad). The Affectnet (March2021 released) has 3999 (500 per emotions, 499 for contempt) images. Running your script in my AffectNet results slightly different scores even with your pretrained models. I am ignorant of the specific change of the dataset. The result above is newly done in with myown script. I will provide it altogether.
av-savchenko commented 1 year ago

Ok, I returned back to my PC and can better read all your code.

  1. I've recently got several comments that my src/ folder is too difficult to follow. Could you create affectnet folder in the src/ directory and move your code and my files train_emotions-pytorch.ipynb and train_emotions.ipynb into it? It is necessary to slightly change the paths in your and my files, e.g., replace model.load_state_dict(torch.load('../models/pretrained_faces/state_vggface2_enet0_new.pt')) #_new to model.load_state_dict(torch.load('../../models/pretrained_faces/state_vggface2_enet0_new.pt')) #_new, replace PATH='../models/affectnet_emotions/enet_b2_7.pt' to PATH='../../models/affectnet_emotions/enet_b2_7.pt', etc.. It is also possible to add new variable with path to the models directory and use it when filling the PATH and pre-trained face ID model
  2. Please, rename pytorch affectnet evaluation.ipynb to something related to affectnet_march2021.
  3. There is a name error in the cell with PATH = f'../models/affectnet_emotions/affectnetmarch2021{backbone}.pt' in train_affectnet_march2021_pytorch.ipynb. Could you fix it?
  4. Please, update the README.md to describe the changes. It is also possible to create additional README in the new affectnet folder (see item 1).

Sorry for requesting an additional work, but I would like to make the repository more suitable for community. Let's do it together ) Again, great thanks for your contribution!

sunggukcha commented 1 year ago

I resolved '1', '2' and '3' comments. But for the README.md update, I worry if I harm your preferred shape of README. As I have not changed any of your codes, but only added additional experiments, updating README does not seem to be necessary for me.

Also, great thanks for sharing your brilliant works.

av-savchenko commented 1 year ago

Thanks for your efforts! I merged your code into main repository. I will update readme and probably move my own code into affectnet folder when I became free