{"id":24287757,"url":"https://github.com/xia-chu/yolo_plugin","last_synced_at":"2025-08-21T12:07:18.587Z","repository":{"id":271405674,"uuid":"912261118","full_name":"xia-chu/yolo_plugin","owner":"xia-chu","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-07T13:43:55.000Z","size":10837,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-13T17:51:29.589Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xia-chu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-05T04:02:19.000Z","updated_at":"2025-03-12T08:24:16.000Z","dependencies_parsed_at":"2025-01-07T14:51:42.940Z","dependency_job_id":null,"html_url":"https://github.com/xia-chu/yolo_plugin","commit_stats":null,"previous_names":["xia-chu/yolo_plugin"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xia-chu/yolo_plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xia-chu%2Fyolo_plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xia-chu%2Fyolo_plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xia-chu%2Fyolo_plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xia-chu%2Fyolo_plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xia-chu","download_url":"https://codeload.github.com/xia-chu/yolo_plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xia-chu%2Fyolo_plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271477595,"owners_count":24766419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-16T08:32:26.799Z","updated_at":"2025-08-21T12:07:18.549Z","avatar_url":"https://github.com/xia-chu.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YOLOv8 OnnxRuntime C++\n\n\u003cimg alt=\"C++\" src=\"https://img.shields.io/badge/C++-17-blue.svg?style=flat\u0026logo=c%2B%2B\"\u003e \u003cimg alt=\"Onnx-runtime\" src=\"https://img.shields.io/badge/OnnxRuntime-717272.svg?logo=Onnx\u0026logoColor=white\"\u003e\n\nThis example demonstrates how to perform inference using YOLOv8 in C++ with ONNX Runtime and OpenCV's API.\n\n## Benefits ✨\n\n- Friendly for deployment in the industrial sector.\n- Faster than OpenCV's DNN inference on both CPU and GPU.\n- Supports FP32 and FP16 CUDA acceleration.\n\n## Note ☕\n\n1. Benefit for Ultralytics' latest release, a `Transpose` op is added to the YOLOv8 model, while make v8 and v5 has the same output shape. Therefore, you can run inference with YOLOv5/v7/v8 via this project.\n\n## Exporting YOLOv8 Models 📦\n\nTo export YOLOv8 models, use the following Python script:\n\n```python\nfrom ultralytics import YOLO\n\n# Load a YOLOv8 model\nmodel = YOLO(\"yolov8n.pt\")\n\n# Export the model\nmodel.export(format=\"onnx\", opset=12, simplify=True, dynamic=False, imgsz=640)\n```\n\nAlternatively, you can use the following command for exporting the model in the terminal\n\n```bash\nyolo export model=yolov8n.pt opset=12 simplify=True dynamic=False format=onnx imgsz=640,640\n```\n\n## Exporting YOLOv8 FP16 Models 📦\n\n```python\nimport onnx\nfrom onnxconverter_common import float16\n\nmodel = onnx.load(R\"YOUR_ONNX_PATH\")\nmodel_fp16 = float16.convert_float_to_float16(model)\nonnx.save(model_fp16, R\"YOUR_FP16_ONNX_PATH\")\n```\n\n## Download COCO.yaml file 📂\n\nIn order to run example, you also need to download coco.yaml. You can download the file manually from [here](https://raw.githubusercontent.com/ultralytics/ultralytics/main/ultralytics/cfg/datasets/coco.yaml)\n\n## Dependencies ⚙️\n\n| Dependency                       | Version       |\n| -------------------------------- | ------------- |\n| Onnxruntime(linux,windows,macos) | \u003e=1.14.1      |\n| OpenCV                           | \u003e=4.0.0       |\n| C++ Standard                     | \u003e=17          |\n| Cmake                            | \u003e=3.5         |\n| Cuda (Optional)                  | \u003e=11.4 \\\u003c12.0 |\n| cuDNN (Cuda required)            | =8            |\n\nNote: The dependency on C++17 is due to the usage of the C++17 filesystem feature.\n\nNote (2): Due to ONNX Runtime, we need to use CUDA 11 and cuDNN 8. Keep in mind that this requirement might change in the future.\n\n## Build 🛠️\n\n1. Clone the repository to your local machine.\n\n2. Navigate to the root directory of the repository.\n\n3. Create a build directory and navigate to it:\n\n   ```console\n   mkdir build \u0026\u0026 cd build\n   ```\n\n4. Run CMake to generate the build files:\n\n   ```console\n   cmake ..\n   ```\n\n   **Notice**:\n\n   If you encounter an error indicating that the `ONNXRUNTIME_ROOT` variable is not set correctly, you can resolve this by building the project using the appropriate command tailored to your system.\n\n   ```console\n   # compiled in a win32 system\n   cmake -D WIN32=TRUE ..\n   # compiled in a linux system\n   cmake -D LINUX=TRUE ..\n   # compiled in an apple system\n   cmake -D APPLE=TRUE ..\n   ```\n\n5. Build the project:\n\n   ```console\n   make\n   ```\n\n6. The built executable should now be located in the `build` directory.\n\n## Usage 🚀\n\n```c++\n//change your param as you like\n//Pay attention to your device and the onnx model type(fp32 or fp16)\nDL_INIT_PARAM params;\nparams.rectConfidenceThreshold = 0.1;\nparams.iouThreshold = 0.5;\nparams.modelPath = \"yolov8n.onnx\";\nparams.imgSize = { 640, 640 };\nparams.cudaEnable = true;\nparams.modelType = YOLO_DETECT_V8;\nyoloDetector-\u003eCreateSession(params);\nDetector(yoloDetector);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxia-chu%2Fyolo_plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxia-chu%2Fyolo_plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxia-chu%2Fyolo_plugin/lists"}