Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
jerrywgz 94861c24b2 | 1 year ago | |
---|---|---|
.. | ||
_base_ | 1 year ago | |
README.md | 1 year ago | |
yolox_cdn_tiny_300e_coco.yml | 1 year ago | |
yolox_crn_s_300e_coco.yml | 1 year ago | |
yolox_l_300e_coco.yml | 2 years ago | |
yolox_m_300e_coco.yml | 2 years ago | |
yolox_nano_300e_coco.yml | 2 years ago | |
yolox_s_300e_coco.yml | 2 years ago | |
yolox_tiny_300e_coco.yml | 2 years ago | |
yolox_x_300e_coco.yml | 2 years ago |
网络网络 | 输入尺寸 | 图片数/GPU | 学习率策略 | 模型推理耗时(ms) | mAPval 0.5:0.95 |
mAPval 0.5 |
Params(M) | FLOPs(G) | 下载链接 | 配置文件 |
---|---|---|---|---|---|---|---|---|---|---|
YOLOX-nano | 416 | 8 | 300e | 2.3 | 26.1 | 42.0 | 0.91 | 1.08 | 下载链接 | 配置文件 |
YOLOX-tiny | 416 | 8 | 300e | 2.8 | 32.9 | 50.4 | 5.06 | 6.45 | 下载链接 | 配置文件 |
YOLOX-s | 640 | 8 | 300e | 3.0 | 40.4 | 59.6 | 9.0 | 26.8 | 下载链接 | 配置文件 |
YOLOX-m | 640 | 8 | 300e | 5.8 | 46.9 | 65.7 | 25.3 | 73.8 | 下载链接 | 配置文件 |
YOLOX-l | 640 | 8 | 300e | 9.3 | 50.1 | 68.8 | 54.2 | 155.6 | 下载链接 | 配置文件 |
YOLOX-x | 640 | 8 | 300e | 16.6 | 51.8 | 70.6 | 99.1 | 281.9 | 下载链接 | 配置文件 |
网络网络 | 输入尺寸 | 图片数/GPU | 学习率策略 | 模型推理耗时(ms) | mAPval 0.5:0.95 |
mAPval 0.5 |
Params(M) | FLOPs(G) | 下载链接 | 配置文件 |
---|---|---|---|---|---|---|---|---|---|---|
YOLOX-cdn-tiny | 416 | 8 | 300e | 1.9 | 32.4 | 50.2 | 5.03 | 6.33 | 下载链接 | 配置文件 |
YOLOX-crn-s | 640 | 8 | 300e | 3.0 | 40.4 | 59.6 | 7.7 | 24.69 | 下载链接 | 配置文件 |
YOLOX-ConvNeXt-s | 640 | 8 | 36e | - | 44.6 | 65.3 | 36.2 | 27.52 | 下载链接 | 配置文件 |
注意:
nms_top_k
修改为1000
,将keep_top_k
修改为100
,将score_threshold
修改为0.01
,mAP会下降约0.1~0.2%;score_threshold
修改为0.25
,将nms_threshold
修改为0.45
,但mAP会下降较多;--run_benchmark=True
, 你首先需要安装以下依赖pip install pynvml psutil GPUtil
。执行以下指令使用混合精度训练YOLOX
python -m paddle.distributed.launch --gpus 0,1,2,3,4,5,6,7 tools/train.py -c configs/yolox/yolox_s_300e_coco.yml --amp --eval
注意:
--amp
表示开启混合精度训练以避免显存溢出,--eval
表示边训边验证。执行以下命令在单个GPU上评估COCO val2017数据集
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/yolox/yolox_s_300e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolox_s_300e_coco.pdparams
使用以下命令在单张GPU上预测图片,使用--infer_img
推理单张图片以及使用--infer_dir
推理文件中的所有图片。
# 推理单张图片
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/yolox/yolox_s_300e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolox_s_300e_coco.pdparams --infer_img=demo/000000014439_640x640.jpg
# 推理文件中的所有图片
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/yolox/yolox_s_300e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolox_s_300e_coco.pdparams --infer_dir=demo
YOLOX在GPU上推理部署或benchmark测速等需要通过tools/export_model.py
导出模型。
当你使用Paddle Inference但不使用TensorRT时,运行以下的命令导出模型
python tools/export_model.py -c configs/yolox/yolox_s_300e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolox_s_300e_coco.pdparams
当你使用Paddle Inference且使用TensorRT时,需要指定-o trt=True
来导出模型。
python tools/export_model.py -c configs/yolox/yolox_s_300e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolox_s_300e_coco.pdparams trt=True
如果你想将YOLOX模型导出为ONNX格式,参考
PaddleDetection模型导出为ONNX格式教程,运行以下命令:
# 导出推理模型
python tools/export_model.py -c configs/yolox/yolox_s_300e_coco.yml --output_dir=output_inference -o weights=https://paddledet.bj.bcebos.com/models/yolox_s_300e_coco.pdparams
# 安装paddle2onnx
pip install paddle2onnx
# 转换成onnx格式
paddle2onnx --model_dir output_inference/yolox_s_300e_coco --model_filename model.pdmodel --params_filename model.pdiparams --opset_version 11 --save_file yolox_s_300e_coco.onnx
注意: ONNX模型目前只支持batch_size=1
YOLOX可以使用以下方式进行部署:
运行以下命令导出模型
python tools/export_model.py -c configs/yolox/yolox_s_300e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolox_s_300e_coco.pdparams trt=True
注意:
deploy/python/infer.py
使用上述导出后的Paddle Inference模型用于推理和benchnark测速,如果设置了--run_benchmark=True
, 首先需要安装以下依赖pip install pynvml psutil GPUtil
。
# Python部署推理单张图片
python deploy/python/infer.py --model_dir=output_inference/yolox_s_300e_coco --image_file=demo/000000014439_640x640.jpg --device=gpu
# 推理文件夹下的所有图片
python deploy/python/infer.py --model_dir=output_inference/yolox_s_300e_coco --image_dir=demo/ --device=gpu
deploy/cpp/build/main
使用上述导出后的Paddle Inference模型用于C++推理部署, 首先按照docs编译安装环境。
# C++部署推理单张图片
./deploy/cpp/build/main --model_dir=output_inference/yolox_s_300e_coco/ --image_file=demo/000000014439_640x640.jpg --run_mode=paddle --device=GPU --threshold=0.5 --output_dir=cpp_infer_output/yolox_s_300e_coco
为了公平起见,在模型库中的速度测试结果均为不包含数据预处理和模型输出后处理(NMS)的数据(与YOLOv4(AlexyAB)测试方法一致),需要在导出模型时指定-o exclude_nms=True
。测速需设置--run_benchmark=True
, 首先需要安装以下依赖pip install pynvml psutil GPUtil
。
使用Paddle Inference但不使用TensorRT进行测速,执行以下命令:
# 导出模型
python tools/export_model.py -c configs/yolox/yolox_s_300e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolox_s_300e_coco.pdparams exclude_nms=True
# 速度测试,使用run_benchmark=True
python deploy/python/infer.py --model_dir=output_inference/yolox_s_300e_coco --image_file=demo/000000014439_640x640.jpg --run_mode=paddle --device=gpu --run_benchmark=True
使用Paddle Inference且使用TensorRT进行测速,执行以下命令:
# 导出模型,使用trt=True
python tools/export_model.py -c configs/yolox/yolox_s_300e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolox_s_300e_coco.pdparams exclude_nms=True trt=True
# 速度测试,使用run_benchmark=True
python deploy/python/infer.py --model_dir=output_inference/yolox_s_300e_coco --image_file=demo/000000014439_640x640.jpg --device=gpu --run_benchmark=True
# tensorRT-FP32测速
python deploy/python/infer.py --model_dir=output_inference/yolox_s_300e_coco --image_file=demo/000000014439_640x640.jpg --device=gpu --run_benchmark=True --run_mode=trt_fp32
# tensorRT-FP16测速
python deploy/python/infer.py --model_dir=output_inference/yolox_s_300e_coco --image_file=demo/000000014439_640x640.jpg --device=gpu --run_benchmark=True --run_mode=trt_fp16
注意:
-o exclude_nms=True
仅作为测速时用,这样导出的模型其推理部署预测的结果不是最终检出框的结果。 @article{yolox2021,
title={YOLOX: Exceeding YOLO Series in 2021},
author={Ge, Zheng and Liu, Songtao and Wang, Feng and Li, Zeming and Sun, Jian},
journal={arXiv preprint arXiv:2107.08430},
year={2021}
}
PaddleDetection是一个基于PaddlePaddle的目标检测端到端开发套件,在提供丰富的模型组件和测试基准的同时,注重端到端的产业落地应用,通过打造产业级特色模型|工具、建设产业应用范例等手段,帮助开发者实现数据准备、模型选型、模型训练、模型部署的全流程打通,快速进行落地应用。
Python Markdown C++ Text Shell other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》