av-savchenko / face-emotion-recognition

Efficient face emotion recognition in photos and videos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

question about training on my own data

dao027 opened this issue · comments

commented

thank u for your sharing of your models and codes.
in my work i want to train a 3-class face emotion recognition model(8 class is too much for me) on my own data using PYTORCH, and i hope can train my classifier base on enet_b0_8_best_afew.pt (just train classifier with backbone frozen)
i really don't want to train from scratch O_O
but i don't know how to train from it, can u give me some suggestions?

or Can u tell me which should i use of these traing codes below? because i can't tell the difference between them
image

Thanks for your interest! You can train your classifier similarly to conventional image recognition techniques with pre-trained neural nets. You have two options:

  1. Extract emotional features with on of my models, and then train a classifier from scikit-learn on top of this features. Example is available at train_emotions-pytorch-afew-vgaf.ipynb. Here the features are extracted from video frames, so I need to aggregate them into a single descriptor (see function create_dataset), but you could skip this step if you have a dataset with static photos.
  2. Fine-tune the model (head only or the whole model). Example is available at train_emotions-pytorch.ipynb. Just replace the cell starting from "model=timm.create_model('tf_efficientnet_b0_ns', pretrained=False)" to "model=torch.load('../../models/affectnet_emotions/enet_b0_8_best_afew.pt')", and use your own train_dir and test_dir
commented

Thanks for your interest! You can train your classifier similarly to conventional image recognition techniques with pre-trained neural nets. You have two options:

  1. Extract emotional features with on of my models, and then train a classifier from scikit-learn on top of this features. Example is available at train_emotions-pytorch-afew-vgaf.ipynb. Here the features are extracted from video frames, so I need to aggregate them into a single descriptor (see function create_dataset), but you could skip this step if you have a dataset with static photos.
  2. Fine-tune the model (head only or the whole model). Example is available at train_emotions-pytorch.ipynb. Just replace the cell starting from "model=timm.create_model('tf_efficientnet_b0_ns', pretrained=False)" to "model=torch.load('../../models/affectnet_emotions/enet_b0_8_best_afew.pt')", and use your own train_dir and test_dir

copy that~so many thanks!! OvO

Closing due to inactivity