{"id":13437768,"url":"https://github.com/victorbadenas/SimpleOnnxInference","last_synced_at":"2025-03-19T18:30:48.020Z","repository":{"id":44738088,"uuid":"440482416","full_name":"victorbadenas/SimpleOnnxInference","owner":"victorbadenas","description":"A simple c++ onnx application for inferencing images","archived":false,"fork":false,"pushed_at":"2022-01-27T17:10:44.000Z","size":46950,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-27T23:23:34.401Z","etag":null,"topics":["convolutional-neural-networks","deep-learning","deep-neural-networks","onnxruntime"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/victorbadenas.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}},"created_at":"2021-12-21T10:46:34.000Z","updated_at":"2023-12-05T07:09:28.000Z","dependencies_parsed_at":"2022-08-26T04:42:54.181Z","dependency_job_id":null,"html_url":"https://github.com/victorbadenas/SimpleOnnxInference","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/victorbadenas%2FSimpleOnnxInference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorbadenas%2FSimpleOnnxInference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorbadenas%2FSimpleOnnxInference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorbadenas%2FSimpleOnnxInference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victorbadenas","download_url":"https://codeload.github.com/victorbadenas/SimpleOnnxInference/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244483126,"owners_count":20460060,"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":["convolutional-neural-networks","deep-learning","deep-neural-networks","onnxruntime"],"created_at":"2024-07-31T03:01:00.099Z","updated_at":"2025-03-19T18:30:48.008Z","avatar_url":"https://github.com/victorbadenas.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# SimpleOnnxInference\n\n![CI](https://github.com/vbadenas/SimpleOnnxInference/actions/workflows/cmake.yml/badge.svg?style=flat)\n![debian](\thttps://img.shields.io/badge/Debian-A81D33?style=flat\u0026logo=debian\u0026logoColor=white)\n![macos](https://img.shields.io/badge/mac%20os-000000?style=flat\u0026logo=apple\u0026logoColor=white)\n\n![c++](https://img.shields.io/static/v1?label=C%2B%2B\u0026message=20\u0026color=lightblue\u0026style=flat\u0026logo=c%2B%2B\u0026logoColor=blue\u0026labelColor=white)\n![onnxruntime](https://img.shields.io/static/v1?label=onnxruntime\u0026message=1.10\u0026color=lightblue\u0026style=flat\u0026logo=onnx\u0026logoColor=blue\u0026labelColor=white)\n![opencv](https://img.shields.io/static/v1?label=opencv\u0026message=3.4.1\u0026color=lightblue\u0026style=flat\u0026logo=opencv\u0026logoColor=blue\u0026labelColor=white)\n\n## install requirements\n\nFor this project we need opencv and onnx. OpenCV needs to be built from source. For this project we will be using the v3.4.1 tag in their [repository](https://github.com/opencv/opencv/tree/3.4.16).\n\n### Ubuntu\n\nFor ubuntu installation, follow or run the [installRequirements.sh](scripts/installRequirements.sh) bash script.\n\n```bash\n./scripts/installRequirements.sh\n```\n\n### MacOS\n\nFor macos installation, follow or run the [installRequirementsOsx.sh](scripts/installRequirementsOsx.sh) bash script.\n\n```bash\n./scripts/installRequirementsOsx.sh\n```\n\n## Loading a sample model from torchvision for imagenet classification\n\nThis repository provides a [getTorchvisionModel.py](scripts/getTorchvisionModel.py) python script to load and export a model present in the torchvision package to onnx format. For running the python script create an environment and install the requirements in [requirements.txt](requirements.txt). Then simply run the file as follows:\n\n```bash\npython3 scripts/getTorchvisionModel.py -m ${modelArch} -O 13 -o ${outFolder} -i 3 224 224\n```\n\nwhere `-i 3 224 224` corresponds to the size of the input to the network.\n\n## Build\n\nTo build, install the conan packages (`cxxopts`):\n\n```bash\nconan install -if build/ .\n```\n\nThen configure the cmake project:\n\n```bash\ncmake -DONNXRUNTIME_ROOTDIR=\"~/.local/include/onnxruntime\" -DOpenCV_DIR=\"/usr/local/share/OpenCV\" -S . -B build/\n```\n\nAnd build:\n\n```bash\ncmake --build build/\n```\n\n## Run\n\nThe binary is stored in the `./build/bin/` folder. It requires the modelPath (onnx format), the imagepath (jpeg format). the label file is optional but highly encouraged as it provides the output label in human-readable format. \n\n```bash\n./build/bin/main -m ${modelPath} -i ${imagePath} -l ${labelPath} -d\n```\n\nThe label file must be a plain text file where each line corresponds to the label of the line index where is located. for instance, for a 3 class classification, the label file would be as follows:\n\n```text\nclass1\nclass2\nclass3\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorbadenas%2FSimpleOnnxInference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictorbadenas%2FSimpleOnnxInference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorbadenas%2FSimpleOnnxInference/lists"}