首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

yolov8 tensorrt python推理

人工智能 44.32MB 12 需要积分: 1
立即下载

资源介绍:

yolov8 tensorrt python推理
# YOLOv8-TensorRT `YOLOv8` using TensorRT accelerate ! --- [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fatrox%2Fsync-dotenv%2Fbadge&style=flat)](https://github.com/triple-Mu/YOLOv8-TensorRT) [![Python Version](https://img.shields.io/badge/Python-3.8--3.10-FFD43B?logo=python)](https://github.com/triple-Mu/YOLOv8-TensorRT) [![img](https://badgen.net/badge/icon/tensorrt?icon=azurepipelines&label)](https://developer.nvidia.com/tensorrt) [![C++](https://img.shields.io/badge/CPP-11%2F14-yellow)](https://github.com/triple-Mu/YOLOv8-TensorRT) [![img](https://badgen.net/github/license/triple-Mu/YOLOv8-TensorRT)](https://github.com/triple-Mu/YOLOv8-TensorRT/blob/main/LICENSE) [![img](https://badgen.net/github/prs/triple-Mu/YOLOv8-TensorRT)](https://github.com/triple-Mu/YOLOv8-TensorRT/pulls) [![img](https://img.shields.io/github/stars/triple-Mu/YOLOv8-TensorRT?color=ccf)](https://github.com/triple-Mu/YOLOv8-TensorRT) --- # Prepare the environment 1. Install `CUDA` follow [`CUDA official website`](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#download-the-nvidia-cuda-toolkit). 🚀 RECOMMENDED `CUDA` >= 11.4 2. Install `TensorRT` follow [`TensorRT official website`](https://developer.nvidia.com/nvidia-tensorrt-8x-download). 🚀 RECOMMENDED `TensorRT` >= 8.4 2. Install python requirements. ``` shell pip install -r requirements.txt ``` 3. Install [`ultralytics`](https://github.com/ultralytics/ultralytics) package for ONNX export or TensorRT API building. ``` shell pip install ultralytics ``` 5. Prepare your own PyTorch weight such as `yolov8s.pt` or `yolov8s-seg.pt`. ***NOTICE:*** Please use the latest `CUDA` and `TensorRT`, so that you can achieve the fastest speed ! If you have to use a lower version of `CUDA` and `TensorRT`, please read the relevant issues carefully ! # Normal Usage If you get ONNX from origin [`ultralytics`](https://github.com/ultralytics/ultralytics) repo, you should build engine by yourself. You can only use the `c++` inference code to deserialize the engine and do inference. You can get more information in [`Normal.md`](docs/Normal.md) ! Besides, other scripts won't work. # Export End2End ONNX with NMS You can export your onnx model by `ultralytics` API and add postprocess such as bbox decoder and `NMS` into ONNX model at the same time. ``` shell python3 export-det.py \ --weights yolov8s.pt \ --iou-thres 0.65 \ --conf-thres 0.25 \ --topk 100 \ --opset 11 \ --sim \ --input-shape 1 3 640 640 \ --device cuda:0 ``` #### Description of all arguments - `--weights` : The PyTorch model you trained. - `--iou-thres` : IOU threshold for NMS plugin. - `--conf-thres` : Confidence threshold for NMS plugin. - `--topk` : Max number of detection bboxes. - `--opset` : ONNX opset version, default is 11. - `--sim` : Whether to simplify your onnx model. - `--input-shape` : Input shape for you model, should be 4 dimensions. - `--device` : The CUDA deivce you export engine . You will get an onnx model whose prefix is the same as input weights. # Build End2End Engine from ONNX ### 1. Build Engine by TensorRT ONNX Python api You can export TensorRT engine from ONNX by [`build.py` ](build.py). Usage: ``` shell python3 build.py \ --weights yolov8s.onnx \ --iou-thres 0.65 \ --conf-thres 0.25 \ --topk 100 \ --fp16 \ --device cuda:0 ``` #### Description of all arguments - `--weights` : The ONNX model you download. - `--iou-thres` : IOU threshold for NMS plugin. - `--conf-thres` : Confidence threshold for NMS plugin. - `--topk` : Max number of detection bboxes. - `--fp16` : Whether to export half-precision engine. - `--device` : The CUDA deivce you export engine . You can modify `iou-thres` `conf-thres` `topk` by yourself. ### 2. Export Engine by Trtexec Tools You can export TensorRT engine by [`trtexec`](https://github.com/NVIDIA/TensorRT/tree/main/samples/trtexec) tools. Usage: ``` shell /usr/src/tensorrt/bin/trtexec \ --onnx=yolov8s.onnx \ --saveEngine=yolov8s.engine \ --fp16 ``` **If you installed TensorRT by a debian package, then the installation path of `trtexec` is `/usr/src/tensorrt/bin/trtexec`** **If you installed TensorRT by a tar package, then the installation path of `trtexec` is under the `bin` folder in the path you decompressed** # Build TensorRT Engine by TensorRT API Please see more information in [`API-Build.md`](docs/API-Build.md) ***Notice !!!*** We don't support YOLOv8-seg model now !!! # Inference ## 1. Infer with python script You can infer images with the engine by [`infer-det.py`](infer-det.py) . Usage: ``` shell python3 infer-det.py \ --engine yolov8s.engine \ --imgs data \ --show \ --out-dir outputs \ --device cuda:0 ``` #### Description of all arguments - `--engine` : The Engine you export. - `--imgs` : The images path you want to detect. - `--show` : Whether to show detection results. - `--out-dir` : Where to save detection results images. It will not work when use `--show` flag. - `--device` : The CUDA deivce you use. - `--profile` : Profile the TensorRT engine. ## 2. Infer with C++ You can infer with c++ in [`csrc/detect/end2end`](csrc/detect/end2end) . ### Build: Please set you own librarys in [`CMakeLists.txt`](csrc/detect/end2end/CMakeLists.txt) and modify `CLASS_NAMES` and `COLORS` in [`main.cpp`](csrc/detect/end2end/main.cpp). ``` shell export root=${PWD} cd csrc/detect/end2end mkdir -p build && cd build cmake .. make mv yolov8 ${root} cd ${root} ``` Usage: ``` shell # infer image ./yolov8 yolov8s.engine data/bus.jpg # infer images ./yolov8 yolov8s.engine data # infer video ./yolov8 yolov8s.engine data/test.mp4 # the video path ``` # TensorRT Segment Deploy Please see more information in [`Segment.md`](docs/Segment.md) # TensorRT Pose Deploy Please see more information in [`Pose.md`](docs/Pose.md) # TensorRT Cls Deploy Please see more information in [`Cls.md`](docs/Cls.md) # TensorRT Obb Deploy Please see more information in [`Obb.md`](docs/Obb.md) # DeepStream Detection Deploy See more in [`README.md`](csrc/deepstream/README.md) # Jetson Deploy Only test on `Jetson-NX 4GB`. See more in [`Jetson.md`](docs/Jetson.md) # Profile you engine If you want to profile the TensorRT engine: Usage: ``` shell python3 trt-profile.py --engine yolov8s.engine --device cuda:0 ``` # Refuse To Use PyTorch for Model Inference !!! If you need to break away from pytorch and use tensorrt inference, you can get more information in [`infer-det-without-torch.py`](infer-det-without-torch.py), the usage is the same as the pytorch version, but its performance is much worse. You can use `cuda-python` or `pycuda` for inference. Please install by such command: ```shell pip install cuda-python # or pip install pycuda ``` Usage: ``` shell python3 infer-det-without-torch.py \ --engine yolov8s.engine \ --imgs data \ --show \ --out-dir outputs \ --method cudart ``` #### Description of all arguments - `--engine` : The Engine you export. - `--imgs` : The images path you want to detect. - `--show` : Whether to show detection results. - `--out-dir` : Where to save detection results images. It will not work when use `--show` flag. - `--method` : Choose `cudart` or `pycuda`, default is `cudart`.

资源文件列表:

YOLOv8-TensorRT-main.zip 大约有145个文件
  1. YOLOv8-TensorRT-main/
  2. YOLOv8-TensorRT-main/build.py 1.87KB
  3. YOLOv8-TensorRT-main/cmd.txt 864B
  4. YOLOv8-TensorRT-main/config.py 17.9KB
  5. YOLOv8-TensorRT-main/csrc/
  6. YOLOv8-TensorRT-main/csrc/cls/
  7. YOLOv8-TensorRT-main/csrc/cls/normal/
  8. YOLOv8-TensorRT-main/csrc/cls/normal/cmake/
  9. YOLOv8-TensorRT-main/csrc/cls/normal/cmake/FindTensorRT.cmake 5.17KB
  10. YOLOv8-TensorRT-main/csrc/cls/normal/cmake/Function.cmake 408B
  11. YOLOv8-TensorRT-main/csrc/cls/normal/CMakeLists.txt 1.85KB
  12. YOLOv8-TensorRT-main/csrc/cls/normal/include/
  13. YOLOv8-TensorRT-main/csrc/cls/normal/include/common.hpp 3.52KB
  14. YOLOv8-TensorRT-main/csrc/cls/normal/include/filesystem.hpp 187.37KB
  15. YOLOv8-TensorRT-main/csrc/cls/normal/include/yolov8-cls.hpp 7.37KB
  16. YOLOv8-TensorRT-main/csrc/cls/normal/main.cpp 61.69KB
  17. YOLOv8-TensorRT-main/csrc/deepstream/
  18. YOLOv8-TensorRT-main/csrc/deepstream/CMakeLists.txt 1.52KB
  19. YOLOv8-TensorRT-main/csrc/deepstream/config_yoloV8.txt 3.06KB
  20. YOLOv8-TensorRT-main/csrc/deepstream/custom_bbox_parser/
  21. YOLOv8-TensorRT-main/csrc/deepstream/custom_bbox_parser/nvdsparsebbox_yoloV8.cpp 4.77KB
  22. YOLOv8-TensorRT-main/csrc/deepstream/deepstream_app_config.txt 2.56KB
  23. YOLOv8-TensorRT-main/csrc/deepstream/labels.txt 625B
  24. YOLOv8-TensorRT-main/csrc/deepstream/README.md 2.08KB
  25. YOLOv8-TensorRT-main/csrc/detect/
  26. YOLOv8-TensorRT-main/csrc/detect/end2end/
  27. YOLOv8-TensorRT-main/csrc/detect/end2end/cmake/
  28. YOLOv8-TensorRT-main/csrc/detect/end2end/cmake/FindTensorRT.cmake 5.17KB
  29. YOLOv8-TensorRT-main/csrc/detect/end2end/cmake/Function.cmake 408B
  30. YOLOv8-TensorRT-main/csrc/detect/end2end/CMakeLists.txt 1.85KB
  31. YOLOv8-TensorRT-main/csrc/detect/end2end/include/
  32. YOLOv8-TensorRT-main/csrc/detect/end2end/include/common.hpp 3.71KB
  33. YOLOv8-TensorRT-main/csrc/detect/end2end/include/filesystem.hpp 187.37KB
  34. YOLOv8-TensorRT-main/csrc/detect/end2end/include/yolov8.hpp 11.8KB
  35. YOLOv8-TensorRT-main/csrc/detect/end2end/main.cpp 5.6KB
  36. YOLOv8-TensorRT-main/csrc/detect/normal/
  37. YOLOv8-TensorRT-main/csrc/detect/normal/cmake/
  38. YOLOv8-TensorRT-main/csrc/detect/normal/cmake/FindTensorRT.cmake 5.17KB
  39. YOLOv8-TensorRT-main/csrc/detect/normal/cmake/Function.cmake 408B
  40. YOLOv8-TensorRT-main/csrc/detect/normal/CMakeLists.txt 1.99KB
  41. YOLOv8-TensorRT-main/csrc/detect/normal/include/
  42. YOLOv8-TensorRT-main/csrc/detect/normal/include/common.hpp 3.71KB
  43. YOLOv8-TensorRT-main/csrc/detect/normal/include/filesystem.hpp 187.37KB
  44. YOLOv8-TensorRT-main/csrc/detect/normal/include/yolov8.hpp 13.2KB
  45. YOLOv8-TensorRT-main/csrc/detect/normal/main.cpp 5.81KB
  46. YOLOv8-TensorRT-main/csrc/jetson/
  47. YOLOv8-TensorRT-main/csrc/jetson/detect/
  48. YOLOv8-TensorRT-main/csrc/jetson/detect/CMakeLists.txt 1.53KB
  49. YOLOv8-TensorRT-main/csrc/jetson/detect/include/
  50. YOLOv8-TensorRT-main/csrc/jetson/detect/include/common.hpp 4.34KB
  51. YOLOv8-TensorRT-main/csrc/jetson/detect/include/yolov8.hpp 9.75KB
  52. YOLOv8-TensorRT-main/csrc/jetson/detect/main.cpp 5.41KB
  53. YOLOv8-TensorRT-main/csrc/jetson/pose/
  54. YOLOv8-TensorRT-main/csrc/jetson/pose/CMakeLists.txt 1.68KB
  55. YOLOv8-TensorRT-main/csrc/jetson/pose/include/
  56. YOLOv8-TensorRT-main/csrc/jetson/pose/include/common.hpp 4.37KB
  57. YOLOv8-TensorRT-main/csrc/jetson/pose/include/yolov8-pose.hpp 12.65KB
  58. YOLOv8-TensorRT-main/csrc/jetson/pose/main.cpp 6.81KB
  59. YOLOv8-TensorRT-main/csrc/jetson/segment/
  60. YOLOv8-TensorRT-main/csrc/jetson/segment/CMakeLists.txt 1.68KB
  61. YOLOv8-TensorRT-main/csrc/jetson/segment/include/
  62. YOLOv8-TensorRT-main/csrc/jetson/segment/include/common.hpp 4.37KB
  63. YOLOv8-TensorRT-main/csrc/jetson/segment/include/yolov8-seg.hpp 12.7KB
  64. YOLOv8-TensorRT-main/csrc/jetson/segment/main.cpp 6.17KB
  65. YOLOv8-TensorRT-main/csrc/obb/
  66. YOLOv8-TensorRT-main/csrc/obb/normal/
  67. YOLOv8-TensorRT-main/csrc/obb/normal/cmake/
  68. YOLOv8-TensorRT-main/csrc/obb/normal/cmake/FindTensorRT.cmake 5.17KB
  69. YOLOv8-TensorRT-main/csrc/obb/normal/cmake/Function.cmake 408B
  70. YOLOv8-TensorRT-main/csrc/obb/normal/CMakeLists.txt 1.84KB
  71. YOLOv8-TensorRT-main/csrc/obb/normal/include/
  72. YOLOv8-TensorRT-main/csrc/obb/normal/include/common.hpp 3.7KB
  73. YOLOv8-TensorRT-main/csrc/obb/normal/include/filesystem.hpp 187.37KB
  74. YOLOv8-TensorRT-main/csrc/obb/normal/include/yolov8-obb.hpp 11.19KB
  75. YOLOv8-TensorRT-main/csrc/obb/normal/main.cpp 5.09KB
  76. YOLOv8-TensorRT-main/csrc/pose/
  77. YOLOv8-TensorRT-main/csrc/pose/normal/
  78. YOLOv8-TensorRT-main/csrc/pose/normal/cmake/
  79. YOLOv8-TensorRT-main/csrc/pose/normal/cmake/FindTensorRT.cmake 5.17KB
  80. YOLOv8-TensorRT-main/csrc/pose/normal/cmake/Function.cmake 408B
  81. YOLOv8-TensorRT-main/csrc/pose/normal/CMakeLists.txt 1.99KB
  82. YOLOv8-TensorRT-main/csrc/pose/normal/include/
  83. YOLOv8-TensorRT-main/csrc/pose/normal/include/common.hpp 3.74KB
  84. YOLOv8-TensorRT-main/csrc/pose/normal/include/filesystem.hpp 187.37KB
  85. YOLOv8-TensorRT-main/csrc/pose/normal/include/yolov8-pose.hpp 12.69KB
  86. YOLOv8-TensorRT-main/csrc/pose/normal/main.cpp 6.98KB
  87. YOLOv8-TensorRT-main/csrc/segment/
  88. YOLOv8-TensorRT-main/csrc/segment/normal/
  89. YOLOv8-TensorRT-main/csrc/segment/normal/CMakeLists.txt 1.7KB
  90. YOLOv8-TensorRT-main/csrc/segment/normal/include/
  91. YOLOv8-TensorRT-main/csrc/segment/normal/include/common.hpp 4.37KB
  92. YOLOv8-TensorRT-main/csrc/segment/normal/include/yolov8-seg.hpp 13.59KB
  93. YOLOv8-TensorRT-main/csrc/segment/normal/main.cpp 6.18KB
  94. YOLOv8-TensorRT-main/csrc/segment/simple/
  95. YOLOv8-TensorRT-main/csrc/segment/simple/CMakeLists.txt 1.7KB
  96. YOLOv8-TensorRT-main/csrc/segment/simple/include/
  97. YOLOv8-TensorRT-main/csrc/segment/simple/include/common.hpp 4.37KB
  98. YOLOv8-TensorRT-main/csrc/segment/simple/include/yolov8-seg.hpp 12.74KB
  99. YOLOv8-TensorRT-main/csrc/segment/simple/main.cpp 6.18KB
  100. YOLOv8-TensorRT-main/data/
  101. YOLOv8-TensorRT-main/data/bus.jpg 476.01KB
  102. YOLOv8-TensorRT-main/data/highway.mp4 3.74MB
  103. YOLOv8-TensorRT-main/data/zidane.jpg 164.99KB
  104. YOLOv8-TensorRT-main/docs/
  105. YOLOv8-TensorRT-main/docs/API-Build.md 719B
  106. YOLOv8-TensorRT-main/docs/Cls.md 2.61KB
  107. YOLOv8-TensorRT-main/docs/Jetson.md 4.66KB
  108. YOLOv8-TensorRT-main/docs/Normal.md 2.11KB
  109. YOLOv8-TensorRT-main/docs/Obb.md 2.73KB
  110. YOLOv8-TensorRT-main/docs/Pose.md 2.89KB
  111. YOLOv8-TensorRT-main/docs/Segment.md 6.22KB
  112. YOLOv8-TensorRT-main/docs/star.md 172B
  113. YOLOv8-TensorRT-main/export-det.py 3.06KB
  114. YOLOv8-TensorRT-main/infer-det-without-torch.py 2.97KB
  115. YOLOv8-TensorRT-main/infer-det.py 3.12KB
  116. YOLOv8-TensorRT-main/models/
  117. YOLOv8-TensorRT-main/models/api.py 13.45KB
  118. YOLOv8-TensorRT-main/models/common.py 6.26KB
  119. YOLOv8-TensorRT-main/models/cudart_api.py 6.02KB
  120. YOLOv8-TensorRT-main/models/engine.py 14.13KB
  121. YOLOv8-TensorRT-main/models/pycuda_api.py 5.21KB
  122. YOLOv8-TensorRT-main/models/torch_utils.py 3.96KB
  123. YOLOv8-TensorRT-main/models/utils.py 8.48KB
  124. YOLOv8-TensorRT-main/models/__init__.py 556B
  125. YOLOv8-TensorRT-main/models/__pycache__/
  126. YOLOv8-TensorRT-main/models/__pycache__/common.cpython-39.pyc 6.82KB
  127. YOLOv8-TensorRT-main/models/__pycache__/cudart_api.cpython-39.pyc 5.06KB
  128. YOLOv8-TensorRT-main/models/__pycache__/engine.cpython-39.pyc 12.13KB
  129. YOLOv8-TensorRT-main/models/__pycache__/torch_utils.cpython-39.pyc 3.31KB
  130. YOLOv8-TensorRT-main/models/__pycache__/utils.cpython-39.pyc 7.25KB
  131. YOLOv8-TensorRT-main/models/__pycache__/__init__.cpython-39.pyc 554B
  132. YOLOv8-TensorRT-main/onnx_inference.py 3.94KB
  133. YOLOv8-TensorRT-main/output/
  134. YOLOv8-TensorRT-main/output/output_video.mp4 16.92MB
  135. YOLOv8-TensorRT-main/README.md 7.12KB
  136. YOLOv8-TensorRT-main/requirements.txt 158B
  137. YOLOv8-TensorRT-main/trt-profile.py 767B
  138. YOLOv8-TensorRT-main/video_inference.py 4.32KB
  139. YOLOv8-TensorRT-main/video_inference_without_torch.py 3.78KB
  140. YOLOv8-TensorRT-main/weights/
  141. YOLOv8-TensorRT-main/weights/yolov8n.engine 9.58MB
  142. YOLOv8-TensorRT-main/weights/yolov8n.onnx 12.24MB
  143. YOLOv8-TensorRT-main/weights/yolov8n.pt 6.23MB
  144. YOLOv8-TensorRT-main/__pycache__/
  145. YOLOv8-TensorRT-main/__pycache__/config.cpython-39.pyc 14.56KB
0评论
提交 加载更多评论
其他资源 InstantTexture.zip
InstantTexture.zip
数据结构任务书.zip
数据结构任务书.zip
数据结构任务书.zip
ROS 2 密钥 ros.key
ROS 2 密钥 ros.key
linkage-mapper3.0
Linkage Mapper是用于支撑区域野生动物栖息地连通性分析的GIS工具。它由几个Python脚本组成,打包为ArcGIS工具箱,可以自动绘制野生动物栖息地连接走廊。开发者为了支持2010年华盛顿野生动物栖息地连接工作,并将其公开用于其他野生动物的连接性评估。 Linkage Mapper使用核心栖息地矢量图斑和阻力栅格来绘制核心区域之间的最低成本联系。阻力栅格中每一个像元都有一个反映能量消耗、移动难度或死亡风险的值。阻力值通常由像元特性决定,如土地覆盖或房屋密度,并结合特定的物种的景观阻力。当动物离开特定的核心栖息地时,成本加权分析会累积总运动阻力图。这些脚本使用ArcGIS和Python函数来识别相邻的核心区域,并在他们之间创建成本最低的走廊地图。这些脚本能够标准化和合并走廊地图,并形成一个综合走廊地图。结果显示,每个网格单元在提供核心区域之间的连接方面的相对价值,允许用户识别哪些走廊由遇到更多或更少的特性,这些特性有助于或阻碍核心区域之间的移动。 目前的版本新开发的工具,可用于绘制走廊内的夹点(使用Circuitscape),绘制具有高度网络中心性的核心区域和走廊。
linkage-mapper3.0 linkage-mapper3.0 linkage-mapper3.0
网上商城系统(JSP+MYSQL).zip
内容概要:本资源聚焦网页开发实战,包含示例项目、完整的 JSP 项目源码及文档分享。采用 MVC 模式进行架构设计,结合 JSP 技术与 SQL Server 2000 数据库管理系统,实现高效的网页应用开发。 适用人群:JSP 开发初学者、计算机专业学生进行毕业设计参考、希望提升网页开发技能的程序员。 实用场景及目标:适用于开发各类网页应用项目,帮助开发者快速构建稳定、功能丰富的网页程序,同时为毕业设计提供优质的模板和思路。 说明:资源提供了详细的代码注释和文档说明,方便学习者理解和上手,助力提升网页开发能力和项目实战经验。
网上商城系统(JSP+MYSQL).zip 网上商城系统(JSP+MYSQL).zip 网上商城系统(JSP+MYSQL).zip
数据结构与算法课程设计.zip
数据结构与算法课程设计.zip
数据结构与算法课程设计.zip 数据结构与算法课程设计.zip
某油期中+期末复习大礼包:期中和期末重点均已划出,纯经验分享,纯学长整理
期中测验+测绘测验+两年期末测验
某油期中+期末复习大礼包:期中和期末重点均已划出,纯经验分享,纯学长整理 某油期中+期末复习大礼包:期中和期末重点均已划出,纯经验分享,纯学长整理
数据集-爱尔兰杀菌剂数据分析
数据集_爱尔兰杀菌剂数据分析