Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change number of classes in the model output layer #223

Open
ayanasser opened this issue Dec 1, 2020 · 3 comments
Open

Change number of classes in the model output layer #223

ayanasser opened this issue Dec 1, 2020 · 3 comments

Comments

@ayanasser
Copy link

ayanasser commented Dec 1, 2020

Hi,
Do you have the ability for finetuning slowfast model but with 2 classes only?
in another word (could I change the number of classes of the last layer of "pretrained slowfastNet model"
For a summary, I want to take the feature from that pretrained model then classify those features with a simple 2 dense layers,
but I need to end up with one model, not 2 models (one for feature extraction and the other for classifying)

@zhaoyue-zephyrus
Copy link
Collaborator

Hi, I think a simple modification on the classification head (https://github.com/open-mmlab/mmaction/blob/master/mmaction/models/tenons/cls_heads/cls_head.py) can do this.

@ayanasser
Copy link
Author

ayanasser commented Dec 3, 2020

Hi @zhaoyue-zephyrus , thank u, but Does this modification guarantee that all layers above the classifier layers are frozen?

@zhaoyue-zephyrus
Copy link
Collaborator

You may need to change the frozen_stages in the config (https://github.com/open-mmlab/mmaction/blob/master/configs/SlowOnly/slowonly_kinetics400_se_rgb_r50_seg1_8x8_scratch.py#L9) to be a non-negative value to ensure this. For example, frozen_stages=3 means that you are freezing weights in conv1 and res{2,3,4}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants