2021-12-24 18:19:55.516 | INFO | main:main:91 - Args: Namespace(ckpt='weights/yolox_tiny.pth', conf=0.25, demo='image', device='cpu', exp_file='yolox/exp/yolox_tiny_fish.py', experiment_name='yolox_tiny_fish', fp16=False, fuse=False, legacy=False, model_dir='./weights/fish_genshin_net.pth', n_actions=2, n_states=3, name=None, nms=0.45, path='./assets/dog.jpg', step_tick=12, trt=False, tsize=640)
2021-12-24 18:19:55.675 | INFO | main:main:101 - Model Summary: Params: 5.03M, Gflops: 15.15
2021-12-24 18:19:55.677 | INFO | main:main:114 - loading checkpoint
Traceback (most recent call last):
File "fishing.py", line 195, in
main(exp, args)
File "fishing.py", line 117, in main
model.load_state_dict(ckpt["model"])
File "D:\Anaconda3\envs\ysfish\lib\site-packages\torch\nn\modules\module.py", line 1052, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for YOLOX:
size mismatch for head.cls_preds.0.weight: copying a param with shape torch.Size([80, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([6, 96, 1, 1]).
size mismatch for head.cls_preds.0.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([6]).
size mismatch for head.cls_preds.1.weight: copying a param with shape torch.Size([80, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([6, 96, 1, 1]).
size mismatch for head.cls_preds.1.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([6]).
size mismatch for head.cls_preds.2.weight: copying a param with shape torch.Size([80, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([6, 96, 1, 1]).
size mismatch for head.cls_preds.2.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([6]).
2021-12-24 18:19:55.516 | INFO | main:main:91 - Args: Namespace(ckpt='weights/yolox_tiny.pth', conf=0.25, demo='image', device='cpu', exp_file='yolox/exp/yolox_tiny_fish.py', experiment_name='yolox_tiny_fish', fp16=False, fuse=False, legacy=False, model_dir='./weights/fish_genshin_net.pth', n_actions=2, n_states=3, name=None, nms=0.45, path='./assets/dog.jpg', step_tick=12, trt=False, tsize=640) 2021-12-24 18:19:55.675 | INFO | main:main:101 - Model Summary: Params: 5.03M, Gflops: 15.15 2021-12-24 18:19:55.677 | INFO | main:main:114 - loading checkpoint Traceback (most recent call last): File "fishing.py", line 195, in
main(exp, args)
File "fishing.py", line 117, in main
model.load_state_dict(ckpt["model"])
File "D:\Anaconda3\envs\ysfish\lib\site-packages\torch\nn\modules\module.py", line 1052, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for YOLOX:
size mismatch for head.cls_preds.0.weight: copying a param with shape torch.Size([80, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([6, 96, 1, 1]).
size mismatch for head.cls_preds.0.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([6]).
size mismatch for head.cls_preds.1.weight: copying a param with shape torch.Size([80, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([6, 96, 1, 1]).
size mismatch for head.cls_preds.1.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([6]).
size mismatch for head.cls_preds.2.weight: copying a param with shape torch.Size([80, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([6, 96, 1, 1]).
size mismatch for head.cls_preds.2.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([6]).
这是报错代码
因为没找到best_tiny3.pth我改成了预训练权重yolox_tiny.pth