RangiLyu / nanodet

NanoDet-Plusāš”Super fast and lightweight anchor-free object detection model. šŸ”„Only 980 KB(int8) / 1.8MB (fp16) and run 97FPS on cellphonešŸ”„
Apache License 2.0
5.71k stars 1.04k forks source link

Save model with pre-trained backbone weights #558

Closed alexander-sony closed 5 months ago

alexander-sony commented 6 months ago

Have trained nanodet 1.5x model. Noticed that when I evaluate the model predictor = Predictor(cfg, args.model, logger, device="cuda:0"), then it downloads and adds shufflenet weights. So, this means that the trained model file, for example nanodet_model_best.pth, is missing the pre-trained weights for the backbone.

I would like to store the shufflenet backbone pre-trained weights directly in my model pth-file - is it possible?

Or, are the pre-trained backbone weights are stored already in the model pth file? It's just that init of Predictor is set to load pre-trained weights (pretrain=true in the init of class ShuffleNetV2()). Tested setting pretrain=False and predictions are still correct.

alexander-sony commented 5 months ago

"Or, are the pre-trained backbone weights are stored already in the model pth file? It's just that init of Predictor is set to load pre-trained weights (pretrain=true in the init of class ShuffleNetV2()). Tested setting pretrain=False and predictions are still correct." - Yes, pre-trained backbone weights are stored already in the model pth file