{"id":13643431,"url":"https://github.com/ervgan/yolov5_tensorrt_inference","last_synced_at":"2025-04-21T01:32:34.766Z","repository":{"id":147985915,"uuid":"619245907","full_name":"ervgan/yolov5_tensorrt_inference","owner":"ervgan","description":"TensorRT cpp inference for Yolov5 model","archived":false,"fork":false,"pushed_at":"2023-04-05T12:17:19.000Z","size":76859,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-09T15:42:40.388Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ervgan.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}},"created_at":"2023-03-26T17:33:10.000Z","updated_at":"2024-06-25T06:44:26.000Z","dependencies_parsed_at":"2023-05-28T05:30:34.065Z","dependency_job_id":null,"html_url":"https://github.com/ervgan/yolov5_tensorrt_inference","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ervgan%2Fyolov5_tensorrt_inference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ervgan%2Fyolov5_tensorrt_inference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ervgan%2Fyolov5_tensorrt_inference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ervgan%2Fyolov5_tensorrt_inference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ervgan","download_url":"https://codeload.github.com/ervgan/yolov5_tensorrt_inference/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249982632,"owners_count":21355735,"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","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":"2024-08-02T01:01:47.493Z","updated_at":"2025-04-21T01:32:33.984Z","avatar_url":"https://github.com/ervgan.png","language":"C++","funding_links":[],"categories":["Lighter and Deployment Frameworks","Applications"],"sub_categories":[],"readme":"## Dependencies and versions\n\nSupports yolov5 v1.0, v2.0, v3.0, v3.1, v4.0, v5.0, v6.0, v6.2, v7.0\n\nDependencies:\n- wts_converter: yolov5 repo\n- yolov5_inference: tensorRT 8.5.2 (any version  \u003e= 7.x and \u003c 8.6.0 should work), CUDA 11.4.19, cudNN 8.6.0, openCV\n\n# Yolov5 TensorRT implementation\n\nImplementation of yolov5 deep learning networks with TensorRT network definition API.\n\nThe basic workflow to run inference from a pytorch is as follows:\n1. Get the trained model from pytorch.\n2. Export the weights to a plain text file -- [.wts file] using the wts_converter.py file (see below for an example).\n--- Skip the first two steps if you already converted the pytorch model in .wts format during Google Colab training using the wts_converter.py stored on Google Drive\n3. Load weights in TensorRT, define the network, build a TensorRT engine.\n4. Load the TensorRT engine and run inference.\n\n## Config\n\n- Choose the YOLOv5 sub-model n/s/m/l/x from command line arguments.\n- Other configs please check [include/config.h](include/config.h)\n\n## Build and Run\n\n### Detection\n\n1. generate .wts from pytorch with .pt\n\n```\n# For example using the yolov5s model\ngit clone -b v7.0 https://github.com/ultralytics/yolov5.git\ncd yolov5/\ncp wts_converter.py .\npython wts_converter.py -w yolov5s.pt -o yolov5s.wts\n# A file 'yolov5s.wts' will be generated.\n```\n\n2. build yolov5_inference and run\n\n```\ncd [PATH-TO-yolov5_inference]/\n# Update kNumClass in src/config.h if your model is trained on custom dataset\nmkdir build\ncd build\ncp [PATH-TO-wts_file]/yolov5s.wts .\ncmake ..\nmake\n\n./main -s [.wts] [.engine] [n/s/m/l/x or c gd gw]  // serialize model to plan file\n./main -d [.engine] [image folder]  // deserialize and run inference, the images in [image folder] will be processed.\n\n# For example using yolov5s weights\n./main -s yolov5s.wts yolov5s.engine s\n./main -d yolov5s.engine ../images\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fervgan%2Fyolov5_tensorrt_inference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fervgan%2Fyolov5_tensorrt_inference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fervgan%2Fyolov5_tensorrt_inference/lists"}