Mobilenet-YOLO-Pytorch icon indicating copy to clipboard operation
Mobilenet-YOLO-Pytorch copied to clipboard

encounter error when resuming from a trained .pth file

Open sddai opened this issue 3 years ago • 2 comments

i ran : python train.py --resume ./checkpoints/model_best_my_train.pth.tar

and i got : {'img_h': 352, 'img_w': 352, 'batch_size': 32, 'train_img_size': [[352, 352], [320, 320], [288, 288], [384, 384], [416, 416]], 'expand_scale': 2.1610954191879452, 'mosaic_num': [1, 4], 'iou_weighting': 0.021830872589525777, 'yolo': {'num_classes': 20, 'num_anchors': 3, 'ignore_thresh': [0.6076333316652263, 0.5623606200028424], 'iou_thresh': 0.5497280113447018, 'anchors': [[143, 265], [153, 121], [280, 279], [20, 37], [49, 94], [73, 201]], 'classes': 20, 'mask': [[0, 1, 2], [3, 4, 5]]}} ==> Resuming from checkpoint.. ./checkpoints/model_best_my_train.pth.tar Traceback (most recent call last): File "train2.py", line 433, in main(params) File "train2.py", line 122, in main best_acc = checkpoint['best_acc'] TypeError: 'yolo' object is not subscriptable

would you pls figure out that how to get the right result? thanks a lot 💯

sddai avatar Jun 23 '21 03:06 sddai

I removed the optimizer of 'model_best_my_train.pth.tar' , just only can be used in deploy or inference

Intermediate save code

model_best save code

eric612 avatar Jun 23 '21 10:06 eric612