mirror of
				https://github.com/PaddlePaddle/FastDeploy.git
				synced 2025-10-31 11:56:44 +08:00 
			
		
		
		
	 5c128c4b30
			
		
	
	5c128c4b30
	
	
	
		
			
			* first commit for yolov7 * pybind for yolov7 * CPP README.md * CPP README.md * modified yolov7.cc * README.md * python file modify * delete license in fastdeploy/ * repush the conflict part * README.md modified * README.md modified * file path modified * file path modified * file path modified * file path modified * file path modified * README modified * README modified * move some helpers to private * add examples for yolov7 * api.md modified * api.md modified * api.md modified * YOLOv7 * yolov7 release link * yolov7 release link * yolov7 release link * copyright * change some helpers to private * change variables to const and fix documents. * gitignore * Transfer some funtions to private member of class * Transfer some funtions to private member of class * Merge from develop (#9) * Fix compile problem in different python version (#26) * fix some usage problem in linux * Fix compile problem Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> * Add PaddleDetetion/PPYOLOE model support (#22) * add ppdet/ppyoloe * Add demo code and documents * add convert processor to vision (#27) * update .gitignore * Added checking for cmake include dir * fixed missing trt_backend option bug when init from trt * remove un-need data layout and add pre-check for dtype * changed RGB2BRG to BGR2RGB in ppcls model * add model_zoo yolov6 c++/python demo * fixed CMakeLists.txt typos * update yolov6 cpp/README.md * add yolox c++/pybind and model_zoo demo * move some helpers to private * fixed CMakeLists.txt typos * add normalize with alpha and beta * add version notes for yolov5/yolov6/yolox * add copyright to yolov5.cc * revert normalize * fixed some bugs in yolox * fixed examples/CMakeLists.txt to avoid conflicts * add convert processor to vision * format examples/CMakeLists summary * Fix bug while the inference result is empty with YOLOv5 (#29) * Add multi-label function for yolov5 * Update README.md Update doc * Update fastdeploy_runtime.cc fix variable option.trt_max_shape wrong name * Update runtime_option.md Update resnet model dynamic shape setting name from images to x * Fix bug when inference result boxes are empty * Delete detection.py Co-authored-by: Jason <jiangjiajun@baidu.com> Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com> Co-authored-by: huangjianhui <852142024@qq.com> * first commit for yolor * for merge * Develop (#11) * Fix compile problem in different python version (#26) * fix some usage problem in linux * Fix compile problem Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> * Add PaddleDetetion/PPYOLOE model support (#22) * add ppdet/ppyoloe * Add demo code and documents * add convert processor to vision (#27) * update .gitignore * Added checking for cmake include dir * fixed missing trt_backend option bug when init from trt * remove un-need data layout and add pre-check for dtype * changed RGB2BRG to BGR2RGB in ppcls model * add model_zoo yolov6 c++/python demo * fixed CMakeLists.txt typos * update yolov6 cpp/README.md * add yolox c++/pybind and model_zoo demo * move some helpers to private * fixed CMakeLists.txt typos * add normalize with alpha and beta * add version notes for yolov5/yolov6/yolox * add copyright to yolov5.cc * revert normalize * fixed some bugs in yolox * fixed examples/CMakeLists.txt to avoid conflicts * add convert processor to vision * format examples/CMakeLists summary * Fix bug while the inference result is empty with YOLOv5 (#29) * Add multi-label function for yolov5 * Update README.md Update doc * Update fastdeploy_runtime.cc fix variable option.trt_max_shape wrong name * Update runtime_option.md Update resnet model dynamic shape setting name from images to x * Fix bug when inference result boxes are empty * Delete detection.py Co-authored-by: Jason <jiangjiajun@baidu.com> Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com> Co-authored-by: huangjianhui <852142024@qq.com> * Yolor (#16) * Develop (#11) (#12) * Fix compile problem in different python version (#26) * fix some usage problem in linux * Fix compile problem Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> * Add PaddleDetetion/PPYOLOE model support (#22) * add ppdet/ppyoloe * Add demo code and documents * add convert processor to vision (#27) * update .gitignore * Added checking for cmake include dir * fixed missing trt_backend option bug when init from trt * remove un-need data layout and add pre-check for dtype * changed RGB2BRG to BGR2RGB in ppcls model * add model_zoo yolov6 c++/python demo * fixed CMakeLists.txt typos * update yolov6 cpp/README.md * add yolox c++/pybind and model_zoo demo * move some helpers to private * fixed CMakeLists.txt typos * add normalize with alpha and beta * add version notes for yolov5/yolov6/yolox * add copyright to yolov5.cc * revert normalize * fixed some bugs in yolox * fixed examples/CMakeLists.txt to avoid conflicts * add convert processor to vision * format examples/CMakeLists summary * Fix bug while the inference result is empty with YOLOv5 (#29) * Add multi-label function for yolov5 * Update README.md Update doc * Update fastdeploy_runtime.cc fix variable option.trt_max_shape wrong name * Update runtime_option.md Update resnet model dynamic shape setting name from images to x * Fix bug when inference result boxes are empty * Delete detection.py Co-authored-by: Jason <jiangjiajun@baidu.com> Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com> Co-authored-by: huangjianhui <852142024@qq.com> Co-authored-by: Jason <jiangjiajun@baidu.com> Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com> Co-authored-by: huangjianhui <852142024@qq.com> * Develop (#13) * Fix compile problem in different python version (#26) * fix some usage problem in linux * Fix compile problem Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> * Add PaddleDetetion/PPYOLOE model support (#22) * add ppdet/ppyoloe * Add demo code and documents * add convert processor to vision (#27) * update .gitignore * Added checking for cmake include dir * fixed missing trt_backend option bug when init from trt * remove un-need data layout and add pre-check for dtype * changed RGB2BRG to BGR2RGB in ppcls model * add model_zoo yolov6 c++/python demo * fixed CMakeLists.txt typos * update yolov6 cpp/README.md * add yolox c++/pybind and model_zoo demo * move some helpers to private * fixed CMakeLists.txt typos * add normalize with alpha and beta * add version notes for yolov5/yolov6/yolox * add copyright to yolov5.cc * revert normalize * fixed some bugs in yolox * fixed examples/CMakeLists.txt to avoid conflicts * add convert processor to vision * format examples/CMakeLists summary * Fix bug while the inference result is empty with YOLOv5 (#29) * Add multi-label function for yolov5 * Update README.md Update doc * Update fastdeploy_runtime.cc fix variable option.trt_max_shape wrong name * Update runtime_option.md Update resnet model dynamic shape setting name from images to x * Fix bug when inference result boxes are empty * Delete detection.py Co-authored-by: Jason <jiangjiajun@baidu.com> Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com> Co-authored-by: huangjianhui <852142024@qq.com> * documents * documents * documents * documents * documents * documents * documents * documents * documents * documents * documents * documents * Develop (#14) * Fix compile problem in different python version (#26) * fix some usage problem in linux * Fix compile problem Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> * Add PaddleDetetion/PPYOLOE model support (#22) * add ppdet/ppyoloe * Add demo code and documents * add convert processor to vision (#27) * update .gitignore * Added checking for cmake include dir * fixed missing trt_backend option bug when init from trt * remove un-need data layout and add pre-check for dtype * changed RGB2BRG to BGR2RGB in ppcls model * add model_zoo yolov6 c++/python demo * fixed CMakeLists.txt typos * update yolov6 cpp/README.md * add yolox c++/pybind and model_zoo demo * move some helpers to private * fixed CMakeLists.txt typos * add normalize with alpha and beta * add version notes for yolov5/yolov6/yolox * add copyright to yolov5.cc * revert normalize * fixed some bugs in yolox * fixed examples/CMakeLists.txt to avoid conflicts * add convert processor to vision * format examples/CMakeLists summary * Fix bug while the inference result is empty with YOLOv5 (#29) * Add multi-label function for yolov5 * Update README.md Update doc * Update fastdeploy_runtime.cc fix variable option.trt_max_shape wrong name * Update runtime_option.md Update resnet model dynamic shape setting name from images to x * Fix bug when inference result boxes are empty * Delete detection.py Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com> Co-authored-by: huangjianhui <852142024@qq.com> Co-authored-by: Jason <jiangjiajun@baidu.com> Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com> Co-authored-by: huangjianhui <852142024@qq.com> Co-authored-by: Jason <928090362@qq.com> * first commit for yolov5lite * Documents * fix the PR comments Co-authored-by: Jason <jiangjiajun@baidu.com> Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com> Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com> Co-authored-by: huangjianhui <852142024@qq.com> Co-authored-by: Jason <928090362@qq.com>
编译YOLOv5Lite示例
当前支持模型版本为:YOLOv5-Lite-v1.4
获取ONNX文件
- 
自动获取 访问YOLOv5Lite 官方github库,按照指引下载安装,下载 yolov5-lite-xx.onnx模型(Tips:官方提供的ONNX文件目前是没有decode模块的)#下载yolov5-lite模型文件(.onnx) Download from https://drive.google.com/file/d/1bJByk9eoS6pv8Z3N4bcLRCV3i7uk24aU/view 官方Repo也支持百度云下载
- 
手动获取 访问YOLOv5Lite 官方github库,按照指引下载安装,下载 yolov5-lite-xx.pt模型,利用export.py得到onnx格式文件。- 导出含有decode模块的ONNX文件
 首先需要参考YOLOv5-Lite#189的解决办法,修改代码。 #下载yolov5-lite模型文件(.pt) Download from https://drive.google.com/file/d/1oftzqOREGqDCerf7DtD5BZp9YWELlkMe/view 官方Repo也支持百度云下载 # 导出onnx格式文件 python export.py --grid --dynamic --concat --weights PATH/TO/yolov5-lite-xx.pt # 移动onnx文件到demo目录 cp PATH/TO/yolov5lite.onnx PATH/TO/model_zoo/vision/yolov5lite/- 导出无decode模块的ONNX文件(不需要修改代码)
 #下载yolov5-lite模型文件 Download from https://drive.google.com/file/d/1oftzqOREGqDCerf7DtD5BZp9YWELlkMe/view 官方Repo也支持百度云下载 # 导出onnx格式文件 python export.py --grid --dynamic --weights PATH/TO/yolov5-lite-xx.pt # 移动onnx文件到demo目录 cp PATH/TO/yolov5lite.onnx PATH/TO/model_zoo/vision/yolov5lite/
设置ONNX文件处理方式
如果ONNX文件是含有decode模块的,设置model.is_decode_exported = true(解除yolov5lite.cc第27行注释)
如果ONNX文件是无decode模块的,不用做任何处理,默认是model.is_decode_exported = false
运行demo
# 下载和解压预测库
wget https://bj.bcebos.com/paddle2onnx/fastdeploy/fastdeploy-linux-x64-0.0.3.tgz
tar xvf fastdeploy-linux-x64-0.0.3.tgz
# 编译示例代码
mkdir build & cd build
cmake ..
make -j
# 移动onnx文件到demo目录
cp PATH/TO/yolov5lite.onnx PATH/TO/model_zoo/vision/yolov5lite/cpp/build/
# 下载图片
wget https://raw.githubusercontent.com/ppogg/YOLOv5-Lite/master/cpp_demo/mnn/test.jpg
# 执行
./yolov5lite_demo
执行完后可视化的结果保存在本地vis_result.jpg,同时会将检测框输出在终端,如下所示
DetectionResult: [xmin, ymin, xmax, ymax, score, label_id]
1289.729126,698.414612, 1404.110229, 1023.949524, 0.893141, 0
300.958649,1027.166992, 449.921753, 1299.823608, 0.887509, 0
627.481201,823.830750, 718.942078, 1133.402344, 0.885308, 0
152.969437,1147.352905, 257.228424, 1301.652710, 0.877009, 0
512.867188,773.371094, 649.768494, 1123.529785, 0.870583, 0
906.801147,508.160278, 997.325867, 825.934509, 0.867381, 0
307.480988,87.785973, 408.681732, 387.337463, 0.860646, 0
783.116821,492.420319, 871.741028, 774.283691, 0.851574, 0
1347.626343,190.911758, 1452.582031, 459.044617, 0.837095, 0
3.035009,3.509769, 97.237442, 257.884094, 0.835671, 0
261.199738,303.971527, 371.036041, 569.222595, 0.834187, 0
1170.358032,722.587219, 1284.564087, 1036.034302, 0.833685, 0
660.728333,476.764618, 760.990723, 783.636414, 0.823469, 0
777.628906,815.975098, 886.895935, 1115.206421, 0.820669, 0
415.902740,983.790283, 543.582764, 1300.361206, 0.791539, 0
132.273209,40.751694, 210.614563, 285.128174, 0.790815, 0
1331.930664,370.903687, 1446.262573, 638.119202, 0.773755, 0
1254.425293,31.073910, 1352.297241, 312.583282, 0.743923, 0
915.965088,310.556458, 1031.921265, 624.672302, 0.696823, 0
499.573517,362.165588, 595.503296, 624.872070, 0.678821, 0
956.890747,76.389160, 1068.599609, 340.183533, 0.656648, 0
452.388977,320.288269, 532.330688, 593.987915, 0.652459, 0
488.305664,1028.187012, 565.136719, 1179.688477, 0.629574, 24
855.175781,868.482422, 916.516113, 988.196777, 0.555574, 26
1321.689453,1.638852, 1384.584961, 99.413322, 0.504122, 0
845.324707,531.824768, 875.939941, 614.515198, 0.472173, 26
1342.546387,2.096432, 1420.351929, 98.888016, 0.463313, 0
990.747070,635.389221, 1018.249512, 695.264709, 0.444000, 26
956.799316,120.643112, 1015.100098, 242.920944, 0.442043, 26
560.449219,401.270538, 607.763672, 522.486389, 0.434484, 26
1329.199219,372.522980, 1443.054199, 635.315979, 0.399014, 26
956.140137,88.526413, 1047.509766, 305.213409, 0.367863, 26
1379.296875,852.808594, 1406.909180, 916.456055, 0.366000, 26
1331.909180,468.433624, 1369.299316, 532.044495, 0.352329, 26
864.880371,915.723633, 916.223145, 990.979980, 0.325205, 26
260.778809,341.724640, 322.229004, 442.432648, 0.320724, 24
1271.154785,77.393600, 1336.230469, 186.194870, 0.307823, 26