After training the model, an error occurs when running the demo.py inference file in YOLOX, and the running code with the error is as follows:
Run Code
python tools/demo.py image -f exps/example/yolox_voc/yolox_voc_s.py -c YOLO_outputs/yolox_voc_s_1/best_ckpt.pth --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result --device [cpu/gpu]
Note:
-f exps/example/yolox_voc/yolox_voc_s.py
This command must match, not the yolox used for testing before training_s.py, which is configured by yourself. If you don’t correct it, you will always report the following errors.
Of course, if the above instructions are OK, this error still occurs, that is, the category corresponding error in the demo.
Take my own example, I use VOC format datasets, but the default in the demo file is COCO_CLASSES, so this will definitely report an error, so we have to change it in the demo.py file.
First, find the file yolox/data/datasets/_init_.py and add the following code to the file.
from .voc_classes import VOC_CLASSES
Then enter tools/demo.py file
About 15 lines, Modify
from yolox.data.datasets import COCO_CLASSES
to
from yolox.data.datasets import VOC_CLASSES
Modify about 100 lines of cls_names in Predictor:
to
Set the function of about 300 lines
Change to
No error will be reported during operation, successful! NICE!
Read More:
- Pytorch Loading model error: RuntimeError: Error(s) in loading state_dict for Model: Missing key(s) in state_dict
- [Solved] RuntimeError: Error(s) in loading state_dict for Net:
- [Solved] RuntimeError: Error(s) in loading state_dict for BertForTokenClassification
- [Solved] PyTorch Load Model Error: Missing key(s) RuntimeError: Error(s) in loading state_dict for
- [Solved] Pytorch Error: RuntimeError: Error(s) in loading state_dict for Network: size mismatch
- pytorch RuntimeError: Error(s) in loading state_ Dict for dataparall… Import model error solution
- [Solved] Error(s) in loading state_dict for GeneratorResNet
- pytorch model.load_state_dict Error [How to Solve]
- How to Solve Yolox Training C Disk Full Issue
- [Solved] Yolov5 Deep Learning Error: RuntimeError: DataLoader worker (pid(s) 2516, 1768) exited unexpectedly
- [Solved] ByteTrack Error: ModuleNotFoundError: No module named ‘yolox’
- [Solved] bushi RuntimeError: version_ <= kMaxSupportedFileFormatVersion INTERNAL ASSERT FAILED at /pytorch/caffe2/s
- YOLOX Model conversion error: [TensorRT] ERROR: runtime.cpp (25) – Cuda Error in allocate: 2 (out of memory)
- linux ubuntu pip search Fault: <Fault -32500: “RuntimeError: PyPI‘s XMLRPC API is currently disab
- RuntimeError: Address already in use [How to Solve]
- [Pytorch Error Solution] Pytorch distributed RuntimeError: Address already in use
- [Solved] mmdetection benchmark.py Error: RuntimeError: Distributed package doesn‘t have NCCL built in
- How to Solve Python AttributeError: ‘dict’ object has no attribute ‘item’
- [Solved] Python 3.6 Error: ‘dict’ object has no attribute ‘has_key’
- [Solved] TUM associate.py Scripte Error: AttributeError: ‘dict_keys‘ object has no attribute ‘remove‘