{"id":24912424,"url":"https://github.com/lona-cn/vision-simple","last_synced_at":"2025-10-16T23:31:12.354Z","repository":{"id":269309555,"uuid":"906940939","full_name":"lona-cn/vision-simple","owner":"lona-cn","description":"a lightweight C++ cross-platform vision inference library,support  YOLOv10 YOLOv11 PaddleOCR EasyOCR ,using ONNXRuntime/TVM with multiple exectuion providers.","archived":false,"fork":false,"pushed_at":"2025-01-26T15:03:40.000Z","size":28484,"stargazers_count":14,"open_issues_count":13,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T16:19:52.170Z","etag":null,"topics":["cuda","directml","easyocr","ocr","onnxruntime","paddleocr","tensorrt-inference","tvm","yolo"],"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/lona-cn.png","metadata":{"files":{"readme":"README-en.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":"2024-12-22T11:22:13.000Z","updated_at":"2025-01-26T15:03:43.000Z","dependencies_parsed_at":"2025-01-26T16:29:47.082Z","dependency_job_id":null,"html_url":"https://github.com/lona-cn/vision-simple","commit_stats":null,"previous_names":["lona-cn/vision-simple"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lona-cn%2Fvision-simple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lona-cn%2Fvision-simple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lona-cn%2Fvision-simple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lona-cn%2Fvision-simple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lona-cn","download_url":"https://codeload.github.com/lona-cn/vision-simple/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236753160,"owners_count":19199393,"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":["cuda","directml","easyocr","ocr","onnxruntime","paddleocr","tensorrt-inference","tvm","yolo"],"created_at":"2025-02-02T05:19:52.057Z","updated_at":"2025-10-16T23:31:04.351Z","avatar_url":"https://github.com/lona-cn.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cdiv align=\"center\"\u003e🚀 vision-simple 🚀\u003c/div\u003e\nenglish | [简体中文](./README.md)\n\n\u003cp align=\"center\"\u003e\n\u003ca\u003e\u003cimg alt=\"GitHub License\" src=\"https://img.shields.io/github/license/lona-cn/vision-simple\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg alt=\"GitHub Release\" src=\"https://img.shields.io/github/v/release/lona-cn/vision-simple\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg alt=\"Docker pulls\" src=\"https://img.shields.io/docker/pulls/lonacn/vision_simple\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg alt=\"GitHub Downloads (all assets, all releases)\" src=\"https://img.shields.io/github/downloads/lona-cn/vision-simple/total\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003ca\u003e\u003cimg alt=\"\" src=\"https://img.shields.io/badge/yolo-v10-AD65F1.svg\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg alt=\"\" src=\"https://img.shields.io/badge/yolo-v11-AD65F1.svg\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg alt=\"\" src=\"https://img.shields.io/badge/paddle_ocr-v4-2932DF.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca\u003e\u003cimg alt=\"windows x64\" src=\"https://img.shields.io/badge/windows-x64-brightgreen.svg\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg alt=\"linux x86_64\" src=\"https://img.shields.io/badge/linux-x86_64-brightgreen.svg\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg alt=\"linux arm64\" src=\"https://img.shields.io/badge/linux-arm64-brightgreen.svg\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg alt=\"linux arm64\" src=\"https://img.shields.io/badge/linux-riscv64-brightgreen.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca\u003e\u003cimg alt=\"ort cpu\" src=\"https://img.shields.io/badge/ort-cpu-880088.svg\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg alt=\"ort dml\" src=\"https://img.shields.io/badge/ort-dml-blue.svg\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg alt=\"ort cuda\" src=\"https://img.shields.io/badge/ort-cuda-green.svg\"\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg alt=\"ort rknpu\" src=\"https://img.shields.io/badge/ort-rknpu-white.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n`vision-simple` is a cross-platform visual inference library based on C++23, designed to provide **out-of-the-box** inference capabilities. With Docker, users can quickly set up inference services. This library currently supports popular YOLO models (including YOLOv10 and YOLOv11) and some OCR models (such as `PaddleOCR`). It features a **built-in HTTP API**, making the service more accessible. Additionally, `vision-simple` uses the `ONNXRuntime` engine, which supports multiple Execution Providers such as `DirectML`, `CUDA`, `TensorRT`, and can be compatible with specific hardware devices (such as RockChip's RKNPU), offering more efficient inference performance.\n\n## \u003cdiv align=\"center\"\u003e🚀 Features \u003c/div\u003e\n- **Cross-platform**: Supports `windows/x64`, `linux/x86_64`, `linux/arm64`,and `linux/riscv64`\n- **Multi-device**: Supports CPU, GPU, and RKNPU\n- **Small size**: The statically compiled version is under 20 MiB, with YOLO and OCR inference occupying 300 MiB of memory\n- **Fast deployment**:\n  - **One-click compilation**: Provides verified build scripts for multiple platforms\n  - **[Container deployment](https://hub.docker.com/r/lonacn/vision_simple)**: One-click deployment with `docker`, `podman`, or `containerd`\n  - **[HTTP Service](doc/openapi/server.yaml)**: Offers a HTTP API for non-real-time applications\n\n### \u003cdiv align=\"center\"\u003e yolov11n 3440x1440@60fps+ \u003c/div\u003e\n![hd2-yolo-gif](doc/images/hd2-yolo.gif)\n\n### \u003cdiv align=\"center\"\u003e OCR (HTTP API) \u003c/div\u003e\n\n![http-inferocr](doc/images/http-inferocr.png)\n## \u003cdiv align=\"center\"\u003e🚀 Using vision-simple \u003c/div\u003e\n### Deploy HTTP Service with docker\n1. Start the server project:\n```powershell\ndocker run -it --rm --name vs -p 11451:11451 lonacn/vision_simple:0.4.1-cpu-x86_64\n```\n2. Open the Swagger online editor and allow the site’s unsafe content.\n3. Copy the content from doc/openapi/server.yaml into the Swagger editor.\n4. On the right panel of the editor, select the APIs you want to test\n![swagger-right](doc/images/swagger-right.png)\n\n## \u003cdiv align=\"center\"\u003e🚀 Quick Start for Development \u003c/div\u003e\n\n```\n### Build Project\n#### windows/x64\n- xmake \u003e= 2.9.7\n- msvc with C++23\n- Windows 11\n```powershell\n# pull project\ngit clone https://github.com/lona-cn/vision-simple.git\ncd vision-simple\n# setup sln\n./scripts/dev-vs.bat\n# run server\nxmake build server\nxmake run server\n```\n#### linux/x86_64\n- xmake \u003e= 2.9.7\n- gcc-13\n- Debian 12 / Ubuntu 2022\n```sh\n# pull project\ngit clone https://github.com/lona-cn/vision-simple.git\ncd vision-simple\n# build release\n./scripts/build-release.sh\n# run server\nxmake build server\nxmake run server\n```\n### Docker Image\nAll `Dockerfiles` are located in the `docker/` directory.\n```sh\n# pull project\ngit clone https://github.com/lona-cn/vision-simple.git\ncd vision-simple\n# Build the project\ndocker build -t vision-simple:latest -f  docker/Dockerfile.debian-bookworm-x86_64-cpu .\n# Run the container, the default configuration will use CPU inference and listen on port 11451\ndocker run -it --rm -p 11451:11451 --name vs vision-simple\n```\n\n### dev YOLOv11 Inference with `vision-simple`\n```cpp\n#include \u003cInfer.h\u003e\n#include \u003copencv2/opencv.hpp\u003e\nusing namespace vision_simple;\ntemplate \u003ctypename T\u003e\nstruct DataBuffer\n{\n    std::unique_ptr\u003cT[]\u003e data;\n    size_t size;\n    std::span\u003cT\u003e span(){return std::span{data.get(), size};}\n};\n\nextern std::expected\u003cDataBuffer\u003cuint8_t\u003e, InferError\u003e ReadAll(const std::string\u0026 path);\n\nint main(int argc,char *argv[]){\n    auto data = ReadAll(\"assets/hd2-yolo11n-fp32.onnx\");\n    auto image = cv::imread(\"assets/hd2.png\");\n    auto ctx = InferContext::Create(InferFramework::kONNXRUNTIME, InferEP::kDML);\n    auto infer_yolo = InferYOLO::Create(**ctx, data-\u003espan(), YOLOVersion::kV11);\n    auto result = infer_yolo-\u003eget()-\u003eRun(image, 0.625);\n    // do what u want\n    return 0;\n}\n\n\u003cdiv align=\"center\"\u003e📄 License\u003c/div\u003e\nThe copyrights for the YOLO models and PaddleOCR models in this project belong to the original authors.\n\nThis project is licensed under the Apache-2.0 license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flona-cn%2Fvision-simple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flona-cn%2Fvision-simple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flona-cn%2Fvision-simple/lists"}