Megvii-BaseDetection / Megvii-BaseDetection/YOLOX
利用自己的数据集训练出来的模型跑,结果有问题:
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
我用自己的数据集训练出来的模型跑,出现下面的问题,请大佬们看下:
python3 tools/demo.py image -n yolox-tiny -c pth/best_ckpt.pth --path assets/2021_07_16_14_36_41_C1.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result --device [cpu]
Matplotlib created a temporary config/cache directory at /tmp/matplotlib-j_8jv8kd because the default path (/home/ewb/.config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
2021-08-09 17:32:33.085 | INFO | main:main:239 - Args: Namespace(camid=0, ckpt='pth/best_ckpt.pth', conf=0.25, demo='image', device='[cpu]', exp_file=None, experiment_name='yolox_tiny', fp16=False, fuse=False, name='yolox-tiny', nms=0.45, path='assets/2021_07_16_14_36_41_C1.jpg', save_result=True, trt=False, tsize=640)
/home/ewb/anaconda3/envs/YOLOX/lib/python3.8/site-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at /pytorch/c10/core/TensorImpl.h:1156.)
return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
2021-08-09 17:32:34.280 | INFO | main:main:249 - Model Summary: Params: 5.06M, Gflops: 15.27
2021-08-09 17:32:34.287 | INFO | main:main:260 - loading checkpoint
Traceback (most recent call last):
File "tools/demo.py", line 295, in
main(exp, args)
File "tools/demo.py", line 263, in main
model.load_state_dict(ckpt["model"])
File "/home/ewb/anaconda3/envs/YOLOX/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1406, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for YOLOX:
size mismatch for head.cls_preds.0.weight: copying a param with shape torch.Size([15, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([80, 96, 1, 1]).
size mismatch for head.cls_preds.0.bias: copying a param with shape torch.Size([15]) from checkpoint, the shape in current model is torch.Size([80]).
size mismatch for head.cls_preds.1.weight: copying a param with shape torch.Size([15, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([80, 96, 1, 1]).
size mismatch for head.cls_preds.1.bias: copying a param with shape torch.Size([15]) from checkpoint, the shape in current model is torch.Size([80]).
size mismatch for head.cls_preds.2.weight: copying a param with shape torch.Size([15, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([80, 96, 1, 1]).
size mismatch for head.cls_preds.2.bias: copying a param with shape torch.Size([15]) from checkpoint, the shape in current model is torch.Size([80]).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tools/demo.py, especially the model.load_state_dict call at line 263, and compare the checkpoint head shapes shown in the traceback with the model configuration used by the demo. The issue is done when the custom checkpoint loads without the reported class-prediction size mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100