{"id":19024032,"url":"https://github.com/cvhub520/rtdetr-onnxruntime-deploy","last_synced_at":"2025-04-23T11:57:45.106Z","repository":{"id":161927054,"uuid":"636524695","full_name":"CVHub520/rtdetr-onnxruntime-deploy","owner":"CVHub520","description":"This project showcases the deployment of the RT-DETR model using ONNXRUNTIME in C++ and Python.","archived":false,"fork":false,"pushed_at":"2023-05-05T07:59:27.000Z","size":1859,"stargazers_count":52,"open_issues_count":4,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-23T11:57:40.009Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CVHub520.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-05-05T03:32:21.000Z","updated_at":"2025-02-16T03:41:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"b654d8db-d6df-43e9-b09f-b4174ac048d6","html_url":"https://github.com/CVHub520/rtdetr-onnxruntime-deploy","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CVHub520%2Frtdetr-onnxruntime-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CVHub520%2Frtdetr-onnxruntime-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CVHub520%2Frtdetr-onnxruntime-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CVHub520%2Frtdetr-onnxruntime-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CVHub520","download_url":"https://codeload.github.com/CVHub520/rtdetr-onnxruntime-deploy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250430589,"owners_count":21429323,"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-11-08T20:34:29.543Z","updated_at":"2025-04-23T11:57:45.084Z","avatar_url":"https://github.com/CVHub520.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RT-DETR-onnxruntime-project 💻\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./images/logo.jpg\"\u003e\n\u003c/div\u003e\n\nThis project showcases the deployment of the RT-DETR model using ONNXRUNTIME in C++ and Python.\n\n\n## Environment Dependencies 🛠️\n\n- OpenCV: 4.x\n- ONNXRuntime: Tested on 1.14\n- OS: Tested on Ubuntu 18.04\n- CUDA: 11+ [Optional]\n\n\n## Installation and Model Conversion 🚀\n\n```bash\n$ conda create -n rtdetr python=3.8 -y\n$ conda activate rtdetr\n\n$ python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html\n\n\n# Clone PaddleDetection repository\n$ git clone https://github.com/PaddlePaddle/PaddleDetection.git\n$ cd PaddleDetection\n$ git checkout develop\n\n# Compile and install paddledet\n$ pip install -r requirements.txt\n$ python setup.py install\n\n# Validation\n$ python tools/infer.py -c configs/rtdetr/rtdetr_r50vd_6x_coco.yml -o weights=https://bj.bcebos.com/v1/paddledet/models/rtdetr_r50vd_6x_coco.pdparams --infer_img=bus.jpg\n```\n\n- Modify the configuration file [PaddleDetection/configs/rtdetr/_base_/rtdetr_r50vd.yml]:\n\n![](./images/example_img-1.png)\n\n\n- Modify the processing code according to the illustration [PaddleDetection/ppdet/modeling/architectures/detr.py]:\n\n![](./images/example_img-2.png)\n\n\n```bash\n# Download the pretrained weight\n$ wget https://bj.bcebos.com/v1/paddledet/models/rtdetr_r50vd_6x_coco.pdparams \u0026\u0026 mkdir weights \u0026\u0026 mv rtdetr_r50vd_6x_coco.pdparams ./weights\n\n\n$ python tools/export_model.py -c configs/rtdetr/rtdetr_r50vd_6x_coco.yml \\\n              -o weights=https://bj.bcebos.com/v1/paddledet/models/rtdetr_r50vd_6x_coco.pdparams trt=True \\\n              --output_dir=output_inference\n\n$ pip install onnx==1.13.0\n$ pip install paddle2onnx==1.0.5\n\n$ paddle2onnx --model_dir=./output_inference/rtdetr_r50vd_6x_coco/ \\\n              --model_filename model.pdmodel  \\\n              --params_filename model.pdiparams \\\n              --opset_version 16 \\\n              --save_file ./output_inference/rtdetr_r50vd_6x_coco/rtdetr_r50vd_6x_coco.onnx\n\n$ pip3 install -U pip \u0026\u0026 pip3 install onnxsim\n$ onnxsim input_onnx_model output_onnx_model\n\n# Check the converted model [Option]\n$ pip install netron\n\n```\n\n## Python 🐍\n\n```bash\n$ git clone https://github.com/CVHub520/rtdetr-onnxruntime-deploy.git\n$ cd rtdetr-onnxruntime-deploy\n$ mkdir weights \u0026\u0026 cd weights\n$ wget https://github.com/CVHub520/rtdetr-onnxruntime-deploy/releases/download/v1.0.0/rtdetr_r50vd_6x_coco_cvhub.onnx\n$ cd ../python\n$ python3 main.py\n```\n\n## C++ 🤖\n\n```bash\n$ cd rtdetr-onnxruntime-deploy\n$ mkdir weights \u0026\u0026 cd weights\n$ wget https://github.com/CVHub520/rtdetr-onnxruntime-deploy/releases/download/v1.0.0/rtdetr_r50vd_6x_coco_cvhub.onnx\n$ cd ../cplusplus\n```\n\nNOTE: To build the project, ensure that onnxruntime and opencv are correctly installed. Then, run the commands as instructed. Don’t forget to update the ONNXRUNTIME_DIR and OpenCV_DIR cmake options in the CMakeLists.txt file to match your custom environment.\n\n```bash\n$ mkdir build \u0026\u0026 cd build\n$ cmake ..\n$ make\n$ ./main\n# ./main --use_cuda\n```\n\n\n## Demo 🎬\n\n| Python | C++ |\n|:---:|:---:|\n| ![](./images/bus_python_result.jpg) | ![](./images/bus_cpp_result.jpg) |\n\n\n\n## Contact 👋\n\nPlease feel free to use this project as a starting point for your own deployment needs, or as a reference for learning purposes. If you have any questions or suggestions, please don't hesitate to raise an issue or submit a pull request.\n\n\n| Platform | Account |\n| --- | --- |\n| Wechat 💬 | cv_huber |\n| Zhihu  🧠 | [CVHub](https://www.zhihu.com/people/cvhub-40) |\n| CSDN   📚 | [CVHub](https://blog.csdn.net/CVHub?spm=1010.2135.3001.5343) |\n| Github 🐱 | [CVHub](https://github.com/CVHub520) |\n\n![](./images/contact.png)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvhub520%2Frtdetr-onnxruntime-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcvhub520%2Frtdetr-onnxruntime-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvhub520%2Frtdetr-onnxruntime-deploy/lists"}