Closed star4s closed 2 years ago
@star4s 👋 Hello, thanks for asking about the differences between train.py, detect.py and val.py in YOLOv5 🚀.
These 3 files are designed for different purposes and utilize different dataloaders with different settings. train.py dataloaders are designed for a speed-accuracy compromise, val.py is designed to obtain the best mAP on a validation dataset, and detect.py is designed for best real-world inference results. A few important aspects of each:
640
False
0.001
0.6
True
None
640
True
0.001
0.6
True
0.5 * maximum stride
640
True
0.25
0.45
False
None
YOLOv5 PyTorch Hub models areAutoShape()
instances used for image loading, preprocessing, inference and NMS. For more info see YOLOv5 PyTorch Hub Tutorial
https://github.com/ultralytics/yolov5/blob/7ee5aed0b3fa6a805afb0a820c40bbcbf29960de/models/common.py#L276-L282
640
True
0.25
0.45
False
None
Good luck 🍀 and let us know if you have any other questions!
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Access additional YOLOv5 🚀 resources:
Access additional Ultralytics ⚡ resources:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!
Search before asking
Question
Why has different result between val.py and detec.py by using same weight?
Both results are almost same, but sometimes are not.
By using val.py, I can detect correct class and location. However, when I use detect.py, I cannot detect class and location by using same weight.
I think that both result should be same.
each command line:
python val.py --weights ./runs/train/exp3/weights/best.pt --data test.yaml --img 2352 --conf-thres 0.4 --half --task test --save-txt --save-hybrid --save-conf &
python detect.py --img 2352 --conf 0.4 --iou-thres 0.6 --source ../data/Yolo_Data_run//test --weights ./runs/train/exp3/weights/best.pt --save-txt --save-conf --save-crop &
Images(jpg) and annotation(txt) pointed out by test.yaml are in the folder which is ../data/Yolo_Data_run//test.
Thank you for your attention.
Additional
No response