Crate usls

Crate usls 

Source
Expand description

§usls

usls is a cross-platform Rust library that provides efficient inference for SOTA vision and multi-modal models using ONNX Runtime (typically under 1B parameters).

§📚 Documentation

§🚀 Quick Start

# CPU
cargo run -r --example yolo  # YOLOv8 detect by default

# NVIDIA CUDA
cargo run -r -F cuda --example yolo -- --device cuda:0

# NVIDIA TensorRT
cargo run -r -F tensorrt --example yolo -- --device tensorrt:0

# Apple Silicon CoreML
cargo run -r -F coreml --example yolo -- --device coreml

# Intel OpenVINO
cargo run -r -F openvino -F ort-load-dynamic --example yolo -- --device openvino:CPU

§⚡ Cargo Features

  • ort-download-binaries (default): Automatically downloads prebuilt ONNXRuntime binaries for supported platforms
  • ort-load-dynamic: Dynamic linking to ONNXRuntime libraries (Guide)
  • video: Enable video stream reading and writing (via video-rs
  • viewer: Enable image and video stream visualization (via minifb)
  • cuda: NVIDIA CUDA GPU acceleration support
  • tensorrt: NVIDIA TensorRT optimization for inference acceleration
  • coreml: Apple CoreML acceleration for macOS/iOS devices
  • openvino: Intel OpenVINO toolkit for CPU/GPU/VPU acceleration
  • onednn: Intel oneDNN (formerly MKL-DNN) for CPU optimization
  • directml: Microsoft DirectML for Windows GPU acceleration
  • xnnpack: Google XNNPACK for mobile and edge device optimization
  • rocm: AMD ROCm platform for GPU acceleration
  • cann: Huawei CANN (Compute Architecture for Neural Networks) support
  • rknpu: Rockchip NPU acceleration
  • acl: Arm Compute Library for Arm processors
  • nnapi: Android Neural Networks API support
  • armnn: Arm NN inference engine
  • tvm: Apache TVM tensor compiler stack
  • qnn: Qualcomm Neural Network SDK
  • migraphx: AMD MIGraphX for GPU acceleration
  • vitis: Xilinx Vitis AI for FPGA acceleration
  • azure: Azure Machine Learning integration

Re-exports§

pub use core::*;
pub use models::*;
pub use mot::*;
pub use viz::*;

Modules§

core
models
mot
viz
Visualization utilities for rendering and displaying ML model results

Macros§

elapsed
A macro to measure the execution time of a given code block and optionally log the result.
elapsed_annotator
Annotator-specific timing macro
elapsed_dataloader
Dataloader-specific timing macro
elapsed_engine
Engine-specific timing macro
elapsed_global
High-performance global timing macro with zero overhead when disabled
elapsed_module
High-performance module timing macro with zero overhead when disabled
retry
A macro to retry an expression multiple times with configurable delays between attempts.

Structs§

Connection
Connection between two keypoints with optional color.
Hbb
Horizontal bounding box with position, size, and metadata.
InstanceMeta
Metadata for detection instances including ID, confidence, and name.
Keypoint
Represents a keypoint in a 2D space with optional metadata.
Mask
Mask: Gray Image.
Obb
Oriented bounding box with four vertices and metadata.
Polygon
Polygon with metadata.
Prob
Probability result with classification metadata.
Skeleton
Skeleton structure containing keypoint connections.
Text
Text detection result with content and metadata.
Y
Container for inference results for each image.

Enums§

Key
Key is used by the get key functions to check if some keys on the keyboard has been pressed

Constants§

SKELETON_COCO_19
Defines the keypoint connections for the COCO person skeleton with 19 connections. Each tuple (a, b) represents a connection between keypoint indices a and b. The connections define the following body parts:
SKELETON_COCO_65
Defines the keypoint connections for the COCO-133 person skeleton with 65 connections. Each tuple (a, b) represents a connection between keypoint indices a and b. The connections define the following parts:
SKELETON_COLOR_COCO_19
Defines colors for visualizing each connection in the COCO person skeleton. Colors are grouped by body parts:
SKELETON_COLOR_COCO_65
Defines colors for visualizing each connection in the COCO-133 person skeleton. Colors are grouped by body parts:
SKELETON_COLOR_HALPE_27
Defines colors for visualizing each connection in the HALPE person skeleton. Colors are grouped by body parts and sides:
SKELETON_COLOR_HAND_21
Defines colors for visualizing each connection in the hand skeleton. Colors are grouped by fingers:
SKELETON_HALPE_27
Defines the keypoint connections for the HALPE person skeleton with 27 connections. Each tuple (a, b) represents a connection between keypoint indices a and b. The connections define the following body parts:
SKELETON_HAND_21
Defines the keypoint connections for the hand skeleton with 20 connections. Each tuple (a, b) represents a connection between keypoint indices a and b. The connections define the following parts: