源码:yolox · main · mirrors / Megvii-BaseDetection / YOLOX · GitCode
yolox-s
验证yolox_s eval.py
We support batch testing for fast evaluation:(验证精度)
命令行:
python -m yolox.tools.eval -n yolox-s -c yolox_s.pth -b 64 -d 8 --conf 0.001 [--fp16] [--fuse]
yolox-m
yolox-l
yolox-x
- --fuse: fuse conv and bn
- -d: number of GPUs used for evaluation. DEFAULT: All GPUs available will be used.
- -b: total batch size across on all GPUs
To reproduce speed test, we use the following command:(验证速度)
python -m yolox.tools.eval -n yolox-s -c yolox_s.pth -b 1 -d 1 --conf 0.001 --fp16 --fuse
结果:
yolox-x
Model Summary: Params: 99.07M, Gflops: 282.46G
demo.py
yolox-s
python tools/demo.py video -n yolox-s -c yolox_s.pth --path ./video/test_traffic.mp4 --conf 0.25 --nms 0.45 --tsize 640 --save_result --device gpu
inference:166 - Infer time: 0.0154s
yolox-x
python tools/demo.py video -n yolox-x -c yolox_x.pth --path video/test_traffic.mp4 --conf 0.25 --nms 0.45 --tsize 640 --save_result --device gpu
帧率检测
# 函数开头插入
tt = time.time()
....
# 添加帧率检测
cv2.putText(im0, "FPS:{:.1f}".format(1. / (time.time() - tt)), (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 2, (0, 0, 235), 4)
tt = time.time()
# 插入在这个位置
if save_img:
...
参考:
【目标检测】YOLOv5针对小目标检测的改进模型/添加帧率检测 - 腾讯云开发者社区-腾讯云 (tencent.com)