mmaction
mmaction copied to clipboard
Change number of classes in the model output layer
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)
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.
Hi @zhaoyue-zephyrus , thank u, but Does this modification guarantee that all layers above the classifier layers are frozen?
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}
.