Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lona-cn/vision-simple

a lightweight C++ cross-platform vision inference library,support YOLOv10 YOLOv11 PaddleOCR EasyOCR ,using ONNXRuntime/TVM with multiple exectuion providers.
https://github.com/lona-cn/vision-simple

cuda directml easyocr ocr onnxruntime paddleocr tensorrt-inference tvm yolo

Last synced: 8 days ago
JSON representation

a lightweight C++ cross-platform vision inference library,support YOLOv10 YOLOv11 PaddleOCR EasyOCR ,using ONNXRuntime/TVM with multiple exectuion providers.

Awesome Lists containing this project

README

        

#

๐Ÿš€ vision-simple ๐Ÿš€

english | [็ฎ€ไฝ“ไธญๆ–‡](./README.md)


GitHub License
GitHub Release
Docker pulls
GitHub Downloads (all assets, all releases)







windows x64
linux x86_64
linux arm64
linux arm64


ort cpu
ort dml
ort cuda
ort rknpu

`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.

##

๐Ÿš€ Features

- **Cross-platform**: Supports `windows/x64`, `linux/x86_64`, `linux/arm64`,and `linux/riscv64`
- **Multi-device**: Supports CPU, GPU, and RKNPU
- **Small size**: The statically compiled version is under 20 MiB, with YOLO and OCR inference occupying 300 MiB of memory
- **Fast deployment**:
- **One-click compilation**: Provides verified build scripts for multiple platforms
- **[Container deployment](https://hub.docker.com/r/lonacn/vision_simple)**: One-click deployment with `docker`, `podman`, or `containerd`
- **[HTTP Service](doc/openapi/server.yaml)**: Offers a HTTP API for non-real-time applications

###

yolov11n 3440x1440@60fps+

![hd2-yolo-gif](doc/images/hd2-yolo.gif)

###

OCR (HTTP API)

![http-inferocr](doc/images/http-inferocr.png)
##

๐Ÿš€ Using vision-simple

### Deploy HTTP Service with docker
1. Start the server project:
```powershell
docker run -it --rm --name vs -p 11451:11451 lonacn/vision_simple:0.4.1-cpu-x86_64
```
2. Open the Swagger online editor and allow the siteโ€™s unsafe content.
3. Copy the content from doc/openapi/server.yaml into the Swagger editor.
4. On the right panel of the editor, select the APIs you want to test
![swagger-right](doc/images/swagger-right.png)

##

๐Ÿš€ Quick Start for Development

```
### Build Project
#### windows/x64
- xmake >= 2.9.7
- msvc with C++23
- Windows 11
```powershell
# pull project
git clone https://github.com/lona-cn/vision-simple.git
cd vision-simple
# setup sln
./scripts/dev-vs.bat
# run server
xmake build server
xmake run server
```
#### linux/x86_64
- xmake >= 2.9.7
- gcc-13
- Debian 12 / Ubuntu 2022
```sh
# pull project
git clone https://github.com/lona-cn/vision-simple.git
cd vision-simple
# build release
./scripts/build-release.sh
# run server
xmake build server
xmake run server
```
### Docker Image
All `Dockerfiles` are located in the `docker/` directory.
```sh
# pull project
git clone https://github.com/lona-cn/vision-simple.git
cd vision-simple
# Build the project
docker build -t vision-simple:latest -f docker/Dockerfile.debian-bookworm-x86_64-cpu .
# Run the container, the default configuration will use CPU inference and listen on port 11451
docker run -it --rm -p 11451:11451 --name vs vision-simple
```

### dev YOLOv11 Inference with `vision-simple`
```cpp
#include
#include
using namespace vision_simple;
template
struct DataBuffer
{
std::unique_ptr data;
size_t size;
std::span span(){return std::span{data.get(), size};}
};

extern std::expected, InferError> ReadAll(const std::string& path);

int main(int argc,char *argv[]){
auto data = ReadAll("assets/hd2-yolo11n-fp32.onnx");
auto image = cv::imread("assets/hd2.png");
auto ctx = InferContext::Create(InferFramework::kONNXRUNTIME, InferEP::kDML);
auto infer_yolo = InferYOLO::Create(**ctx, data->span(), YOLOVersion::kV11);
auto result = infer_yolo->get()->Run(image, 0.625);
// do what u want
return 0;
}

๐Ÿ“„ License

The copyrights for the YOLO models and PaddleOCR models in this project belong to the original authors.

This project is licensed under the Apache-2.0 license.