Add a category to a pretrained model for classification in object detection

Hi all,

I ran the transfer learning on my datasets, achieved n classes on the top of the network, but my purpose is simply expanding the categories of a pretrained model (such as resnet18 which trained on ImageNet and can predict thousand categories) and add a new category. The advantage of this approach is avoiding a situation in which the input is X1 (categorized by the pretrained categories) and my network mistakenly predict one of my trained classes (of the n classes that I trained).

You just need to simply remove the the fc layer and replace it with a Linear(512,n+1) layer. Then the thing you need to do is to use your own dataset to finetune the new model.

This is exactly what I DON’T want to do because I want to leave the 1000 categories as they are and simply add another category and retrain the whole net. So the number of classes would be 1001 after this process.

Hello, I have the same problem, I want to add a new class to a pre-trained model from yolov7. Did you happen to find a solution? If yes, could you share?