Closed alexander-sony closed 5 months ago
Have trained 5 classes on a custom dataset starting from config https://github.com/RangiLyu/nanodet/blob/main/config/nanodet-plus-m-1.5x_416.yml (adjusted num_classes) and https://github.com/RangiLyu/nanodet/blob/main/tools/train.py. Training went just fine and reached mAP 0.8 after 300 epochs. Resulting model_best.ckpt is 125MB and nanodet_model_best.pth is 31MB.
Here is my question:
It seems that my pth file includes stuff only required for training. Anyone knows if this is the case and if it can be removed? Have tried torch.save(model.state_dict(), PATH) but the resulting file is still 30MB
model was created as in main() in https://github.com/RangiLyu/nanodet/blob/main/tools/export_onnx.py
Interestingly, the onnx model size is 10MB.
iterate over the state_dict and remove items starting with "aux" - those are only requires during traing as remarked in the config file
Have trained 5 classes on a custom dataset starting from config https://github.com/RangiLyu/nanodet/blob/main/config/nanodet-plus-m-1.5x_416.yml (adjusted num_classes) and https://github.com/RangiLyu/nanodet/blob/main/tools/train.py. Training went just fine and reached mAP 0.8 after 300 epochs. Resulting model_best.ckpt is 125MB and nanodet_model_best.pth is 31MB.
Here is my question:
It seems that my pth file includes stuff only required for training. Anyone knows if this is the case and if it can be removed? Have tried torch.save(model.state_dict(), PATH) but the resulting file is still 30MB
model was created as in main() in https://github.com/RangiLyu/nanodet/blob/main/tools/export_onnx.py
Interestingly, the onnx model size is 10MB.