Last update - layout detection now works right out of the box with the docstructbench1024 onnx model, but I can't get OCR to work with SVTR/DB, or TROCR, with this repo, so I stopped updating it.
This repo is being used for document layout processing, because of its excellent Rust support for ONNX, to include Paddle and Yolo models. Do not use this repo if you want all the features of the main branch, because this does not have them, and will keep diverging from the main as more changes are made. If you are doing layout processing and/or OCR you might find the finished product useful.
usls is a Rust library integrated with ONNXRuntime, offering a suite of advanced models for Computer Vision and Vision-Language tasks, including:
-
YOLO Models: YOLOv5, YOLOv6, YOLOv7, YOLOv8, YOLOv9, YOLOv10, YOLO11, YOLOv12
-
OCR Models: FAST, DB(PaddleOCR-Det), SVTR(PaddleOCR-Rec), SLANet, TrOCR, DocLayout-YOLO
By default, none of the following features are enabled. You can enable them as needed:
-
auto: Automatically downloads prebuilt ONNXRuntime binaries from Pyke’s CDN for supported platforms.-
If disabled, you'll need to compile
ONNXRuntimefrom source or download a precompiled package, and then link it manually.👉 For Linux or macOS Users
- Download from the Releases page.
- Set up the library path by exporting the
ORT_DYLIB_PATHenvironment variable:export ORT_DYLIB_PATH=/path/to/onnxruntime/lib/libonnxruntime.so.1.20.1
-
-
ffmpeg: Adds support for video streams, real-time frame visualization, and video export. -
cuda: Enables the NVIDIA TensorRT provider. -
trt: Enables the NVIDIA TensorRT provider. -
mps: Enables the Apple CoreML provider.
-
Using
CUDAcargo run -r -F cuda --example yolo -- --device cuda:0 -
Using Apple
CoreMLcargo run -r -F mps --example yolo -- --device mps -
Using
TensorRTcargo run -r -F trt --example yolo -- --device trt -
Using
CPUcargo run -r --example yolo
Add usls as a dependency to your project's Cargo.toml
cargo add usls -F cudaOr use a specific commit:
[dependencies]
usls = { git = "https://github.com/nazeling/usls-doc", rev = "commit-sha" }This project is licensed under LICENSE.