chuchienshu/ultra-thin-PRM

How to fine-tune?

monjurulkarim opened this issue · 2 comments

Hi, thanks for this repository.
I want to fine-tune the model for a different number of object classes. How can I fine-tune only the head layers with my own small dataset?
Another question, how did you create the json files in the data folder?

hi,

self.basebone = fc_resnet50(20, True)
above snappet decides whether you finetune on a pre-trained classifier network or not. as for a different number of object classes, it seems like a basic PyTorch operation that can be solved at PyTorch forum.
BTW, these json files just directly used Zhou's sample, and more details can be obtained by his paper.

@chuchienshu thanks for your suggestions. I modified as per your suggestions. However, the class number for my case is 6. Therefore, when I try to load a pre-trained weight I am facing the following error.
"size mismatch for 0.classifier.0.bias: copying a param of torch.Size([6]) from checkpoint, where the shape is torch.Size([20]) in current model."
The reason for the mismatch is obvious as the model is trained for 20 classes. I want to use the power of pre-trained model as I have a very small dataset to train from the scratch. Do you have any idea how can I resolve this issue?