usls

jamjamjonMIT活跃维护

基于 Rust 和 ONNXRuntime 的计算机视觉与视觉语言模型库,集成 YOLO、FastVLM、OCR、SAM 等模型,方便在 Rust 项目中直接做目标检测、分割和图文理解。

A Rust library integrated with ONNXRuntime, providing a collection of Computer Vison and Vision-Language models such as YOLO, FastVLM, and more.

v0.2.0-alpha.3发布于 2026-02-05 13:34 UTC447star46fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
cargo run -r --example yolo -- --task detect --ver 26 --scale n --dtype fp16
硬件要求按 README 说明

CPU 可直接运行;GPU 侧支持 CUDA、TensorRT、TensorRT-RTX、CoreML、OpenVINO、DirectML 等执行提供器,README 未给出具体显存要求。

支持 Apple Silicon需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于 ONNXRuntime 的 Rust 视觉与视觉语言模型推理库,统一跑 YOLO、SAM、FastVLM 等 50+ 模型

基于 Rust 和 ONNXRuntime 的计算机视觉与视觉语言模型库,集成 YOLO、FastVLM、OCR、SAM 等模型,方便在 Rust 项目中直接做目标检测、分割和图文理解。

核心能力

  • 统一 Model trait,用 run()/forward() 做推理并返回统一 Y 输出
  • 内置自动下载 HuggingFace/GitHub 模型并缓存、解析路径
  • 支持图像、目录、视频、摄像头、流等多种输入组合
  • 提供 DataLoader、Annotator、Viewer 全流程组件
  • 支持 FP32/FP16/INT8/Q4/BNB4 等多种精度与动态 batch

容易踩的坑

需 ONNXRuntime >= 1.22.0,版本不匹配会编译或加载失败;CUDA/TensorRT/CoreML 等后端要额外开对应 cargo feature(如 -F cuda、-F tensorrt-full);模型默认从 HuggingFace/GitHub 自动下载,首次运行需联网。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.2.0-alpha.3
  1. v0.2.0-alpha.3最新正式版2026-02-05 · 2026-02-05 13:34 UTC

    What's Changed

    New Contributors

    Full Changelog: https://github.com/jamjamjon/usls/compare/v0.1.11...v0.2.0-alpha.3

  2. v0.1.11v0.1.11 - Sam3-Image & Sam3-tracker2026-01-10 · 2026-01-10 14:11 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/jamjamjon/usls/compare/v0.1.10...v0.1.11

  3. v0.1.10v0.1.10 – GroundingDINO multi-batch inference, mm-gdino/llmdet integration & new class-name post-processing2025-11-22 · 2025-11-22 12:30 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/jamjamjon/usls/compare/v0.1.9...v0.1.10

    New Supported ONNX Model

    • gdino-base
    • gdino-tiny
    • llmdet-base
    • llmdet-large
    • llmdet-tiny
    • mm-gdino-base-all
    • mm-gdino-base-o365v1-goldg-v3det
    • mm-gdino-large-all
    • mm-gdino-large-o365v2-oiv6-goldg
    • mm-gdino-tiny-o365v1-goldg-grit-v3det
    • mm-gdino-tiny-o365v1-goldg-grit
    • mm-gdino-tiny-o365v1-goldg-v3det
    • mm-gdino-tiny-o365v1-goldg
  4. v0.1.9v0.1.9 - Add RT-DETRv42025-11-17 · 2025-11-17 16:05 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/jamjamjon/usls/compare/v0.1.8...v0.1.9

  5. v0.1.8Add RAM & RAM++ models 2025-11-04 · 2025-11-04 16:15 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/jamjamjon/usls/compare/v0.1.7...v0.1.8

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    usls is a cross-platform Rust library powered by ONNX Runtime for efficient inference of SOTA vision and vision-language models (typically under 1B parameters).

    🌟 Highlights

    • ⚡ High Performance: Multi-threading, SIMD, and CUDA-accelerated processing
    • ✨ Cross-Platform: Linux, macOS, Windows with ONNX Runtime execution providers (CUDA, TensorRT, CoreML, OpenVINO, DirectML, etc.)
    • 🎯 Precision Support: FP32, FP16, INT8, UINT8, Q4, Q4F16, BNB4, and more
    • 🛠️ Full-Stack Suite: DataLoader, Annotator, and Viewer for complete workflows
    • 🏗️ Unified API: Single Model trait inference with run()/forward()/encode_images()/encode_texts() and unified Y output
    • 📥 Auto-Management: Automatic model download (HuggingFace/GitHub), caching and path resolution
    • 📦 Multiple Inputs: Image, directory, video, webcam, stream and combinations
    • 🌱 Model Ecosystem: 50+ SOTA vision and VLM models

    🚀 Quick Start

    Run the YOLO-Series demo to explore models with different tasks, precision and execution providers:

    • Tasks: detect, segment, pose, classify, obb
    • Versions: v5, v6, v7, v8, v9, v10, 11, 12, v13, 26
    • Scales: n, s, m, l, x
    • Precision: fp32, fp16, q8, int8, q4, q4f16, bnb4, and more
    • Execution Providers: CPU, CUDA, TensorRT, TensorRT-RTX, CoreML, OpenVINO, and more
    cargo run -r --example yolo -- --task detect --ver 26 --scale n --dtype fp16
    
    cargo run -r -F cuda --example yolo -- --task segment --ver 11 --scale m --device cuda:0 --processor-device cuda:0
    
    cargo run -r -F tensorrt-full --example yolo -- --device tensorrt:0 --processor-device cuda:0
    
    cargo run -r -F nvrtx-full --example yolo -- --device nvrtx:0 --processor-device cuda:0
    
    cargo run -r -F coreml --example yolo -- --device coreml
    
    cargo run -r -F openvino -F ort-load-dynamic --example yolo -- --device openvino:CPU
    

    Environment: NVIDIA RTX 3060Ti (TensorRT-10.11.0.33, CUDA 12.8, TensorRT-RTX-1.3.0.35) / Intel i5-12400F

    Setup: YOLO26 Detection, COCO2017-val (5,000 images), 640x640, Conf thresholds: [0.35, 0.3, ..]

    Results are for rough reference only.

    ScaleEPImageProcessorDTypeBatchPreprocessInferencePostprocessTotal
    nTensorRTCUDAFP161~233µs~1.3ms~14µs~1.55ms
    nTensorRT-RTXCUDAFP321~233µs~2.0ms~10µs~2.24ms
    nTensorRT-RTXCUDAFP161❓❓❓❓
    nCUDACUDAFP321~233µs~5.0ms~17µs~5.25ms
    nCUDACUDAFP161~233µs~3.6ms~17µs~3.85ms
    nCUDACPUFP321~800µs~6.5ms~14µs~7.31ms
    nCUDACPUFP161~800µs~5.0ms~14µs~5.81ms
    nCPUCPUFP321~970µs~20.5ms~14µs~21.48ms
    nCPUCPUFP161~970µs~25.0ms~14µs~25.98ms
    nTensorRTCUDAFP168~1.2ms~6.0ms~55µs~7.26ms
    nTensorRTCPUFP168~18.0ms~25.5ms~55µs~43.56ms
    mTensorRTCUDAFP161~233µs~3.6ms~14µs~3.85ms
    mTensorRTCUDAInt81~233µs~2.6ms~14µs~2.84ms
    mCUDACUDAFP321~233µs~16.1ms~17µs~16.35ms
    mCUDACUDAFP161~233µs~8.8ms~17µs~9.05ms

    🔍 What's Next?

    • 📖 Online Documentation
    • 📚 API Reference
    • 📦 Model Zoo
    • 🚀 Examples

    📦 Model Zoo

    [!NOTE]

    Status: ✅ Supported  |  ❓ Unknown  |  ❌ Not Supported For Now

    🔍 All ONNX models are available from the ONNX Models Repository

    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    YOLOv5Image ClassificationObject DetectionInstance Segmentationdemo✅✅✅✅✅❌❌
    YOLOv6Object Detectiondemo✅✅✅✅✅❌❌
    YOLOv7Object Detectiondemo✅✅✅✅✅❌❌
    YOLOv8Object DetectionInstance SegmentationImage ClassificationOriented Object DetectionKeypoint Detectiondemo✅✅✅✅✅❌❌
    YOLO11Object DetectionInstance SegmentationImage ClassificationOriented Object DetectionKeypoint Detectiondemo✅✅✅✅✅❌❌
    YOLOv9Object Detectiondemo✅✅✅✅✅❌❌
    YOLOv10Object Detectiondemo✅✅✅✅✅❌❌
    YOLOv12Image ClassificationObject DetectionInstance Segmentationdemo✅✅✅✅✅✅✅
    YOLOv13Object Detectiondemo✅✅✅✅✅✅✅
    YOLO26Object DetectionInstance SegmentationImage ClassificationOriented Object DetectionKeypoint Detectiondemo✅✅✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    BEiTImage Classificationdemo✅✅✅✅❌❌❌
    ConvNeXtImage Classificationdemo✅✅✅✅❌❌❌
    FastViTImage Classificationdemo✅✅✅✅❌❌❌
    MobileOneImage Classificationdemo✅✅✅✅❌❌❌
    DeiTImage Classificationdemo✅✅✅✅❌❌❌
    RAMImage Taggingdemo✅❓✅✅✅✅✅
    RAM++Image Taggingdemo✅❓✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    RT-DETRv1Object Detectiondemo✅✅✅✅✅✅✅
    RT-DETRv2Object Detectiondemo✅✅✅✅✅✅✅
    RT-DETRv4Object Detectiondemo✅✅✅✅✅✅✅
    RF-DETRObject Detectiondemo✅✅✅✅✅✅✅
    PP-PicoDetObject Detectiondemo❌❓✅❌❌❌❌
    D-FINEObject Detectiondemo✅❓✅❌❌❌❌
    DEIMObject Detectiondemo✅❓✅❌❌❌❌
    DEIMv2Object Detectiondemo✅❓✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    SAMSegment Anythingdemo✅❓✅❌❌❌❌
    SAM-HQSegment Anythingdemo✅❓✅❌❌❌❌
    MobileSAMSegment Anythingdemo✅❓✅❌❌❌❌
    EdgeSAMSegment Anythingdemo✅❓✅❌❌❌❌
    YOLOE-v8/11-Prompt-FreeOpen-Set Detection And Segmentationdemo✅✅✅✅✅✅✅
    YOLOE-26-Prompt-FreeOpen-Set Detection And Segmentationdemo✅✅✅✅✅✅✅
    FastSAMInstance Segmentationdemo✅✅✅✅✅✅✅
    EdgeCrafter (ECDetSeg)Instance Segmentationdemo❓✅✅✅❌❌❌
    SAM2Segment Anythingdemo✅❓✅❌❌❌❌
    SAM3-TrackerSegment Anythingdemo✅✅✅✅✅✅✅
    BiRefNet - CODCamouflaged Object Detectiondemo✅❓✅✅✅✅✅
    BiRefNet - DISDichotomous Image Segmentationdemo✅❓✅✅✅✅✅
    BiRefNet - HRSODHigh-Resolution Salient Object Detectiondemo✅❓✅✅✅✅✅
    BiRefNet - MassiveMulti-Dataset Robust Segmentationdemo✅❓✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    RMBGImage SegmentationBackground Removaldemo✅❓✅✅✅✅✅
    BEN2Image SegmentationBackground Removaldemo✅❓✅✅❌❌❌
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    MobileGazeEye Gaze Estimationdemo✅❓✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    MODNetImage Mattingdemo✅❓✅✅✅❌❌
    MediaPipe SelfieImage Segmentationdemo✅❓✅✅✅❌❌
    BiRefNet - PortraitPortrait Background Removaldemo✅❓✅✅✅✅✅
    BiRefNet - MattingPortrait Matting & Background Removaldemo✅❓✅✅✅✅✅
    BiRefNet - HR MattingHigh-Resolution Portrait Mattingdemo✅❓✅✅✅✅✅
    BiRefNet - GeneralGeneral Purpose Segmentationdemo✅❓✅✅✅✅✅
    BiRefNet - HR GeneralHigh-Resolution General Segmentationdemo✅❓✅✅✅✅✅
    BiRefNet - Lite GeneralLightweight General Segmentation (2K)demo✅❓✅✅✅✅✅
    BiRefNet - General TinyLightweight General Segmentation with Swin-V1-Tinydemo✅❓✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    GroundingDINOOpen-Set Detection With Languagedemo✅❓✅✅✅✅✅
    MM-GDINOOpen-Set Detection With Languagedemo✅❓✅✅✅✅✅
    LLMDetOpen-Set Detection With Languagedemo✅❓✅✅✅✅✅
    OWLv2Open-Set Object Detectiondemo✅❓✅✅❌❌❌
    YOLO-WorldOpen-Set Detection With Languagedemo✅✅✅✅✅✅✅
    YOLOE-Prompt-BasedOpen-Set Detection And Segmentationdemo✅✅✅✅✅✅✅
    YOLOE-26-Prompt-BasedOpen-Set Detection And Segmentationdemo✅✅✅✅✅✅✅
    SAM3-ImageOpen-Set Detection And Segmentationdemo✅✅✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    ByteTrackMulti-Object Trackingdemo❌❌❌❌❌❌❌
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    Swin2SRImage Restorationdemo✅❓✅✅✅✅✅
    APISRAnime Super-Resolutiondemo✅❓✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    RTMPoseKeypoint Detectiondemo✅❓✅✅✅✅✅
    DWPoseKeypoint Detectiondemo✅❓✅✅✅✅✅
    RTMWKeypoint Detectiondemo✅❓✅✅✅✅✅
    RTMOKeypoint Detectiondemo✅❓✅✅✅✅❌
    ECPoseKeypoint Detectiondemo✅❓✅✅❌❌❌
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    DB (PaddleOCR det v4 / v5)Text Detectiondemo✅❓✅✅❌❌❌
    FASTText Detectiondemo✅❓✅✅❌❌❌
    LinkNetText Detectiondemo✅❓✅✅❌❌❌
    SVTR (PaddleOCR rec v4 / v5)Text Recognitiondemo✅❓✅✅❌❌❌
    TrOCRText Recognitiondemo✅❓✅✅❌❌❌
    SLANet (PaddleOCR tab v4 / v5)Table Recognitiondemo✅❓✅✅❌❌❌
    DocLayout-YOLOObject Detectiondemo✅❓✅✅✅❌❌
    PP-DocLayout-v1-Plus-LObject Detectiondemo✅✅✅✅✅❌❌
    PP-DocLayout-v2Object Detectiondemo✅❓✅✅✅✅✅
    PP-DocLayout-v3Object Detectiondemo✅✅✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    BLIPImage Captioningdemo✅❓✅❓❌❌❌
    Florence2A Variety of Vision Tasksdemo✅❓✅✅❌❌❌
    Moondream2Open-Set Object DetectionOpen-Set Keypoints DetectionImage CaptioningVisual Question Answeringdemo✅❓❌❌✅✅❌
    SmolVLMVisual Question Answeringdemo✅❓✅❓❓❓❓
    SmolVLM2Visual Question Answeringdemo✅❓✅❓❓❓❓
    FastVLMVision Language Modelsdemo✅❓✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    CLIPVision-Language Embeddingdemo✅❓✅✅✅✅✅
    jina-clip-v1Vision-Language Embeddingdemo✅❓✅✅✅✅✅
    jina-clip-v2Vision-Language Embeddingdemo✅❓✅✅✅✅✅
    mobileclipVision-Language Embeddingdemo✅❓✅✅✅✅✅
    SigLIPVision-Language Embeddingdemo✅❓✅✅✅✅✅
    SigLIPv2Vision-Language Embeddingdemo✅❓✅✅✅✅✅
    DINOv2Vision Embeddingdemo✅❓✅❌❌❌❌
    DINOv3Vision Embeddingdemo✅❓✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    DepthAnything v1Monocular Depth Estimationdemo✅❓✅✅✅✅✅
    DepthAnything v2Monocular Depth Estimationdemo✅❓✅✅✅✅✅
    DepthProMonocular Depth Estimationdemo✅❓✅✅✅✅✅
    Depth-Anything-3MonocularMetricMulti-Viewdemo✅❓✅✅✅✅✅
    ModelTask / DescriptionDemoDynamic BatchTensorRTFP32FP16Q8Q4f16BNB4
    SapiensFoundation for Human Vision Modelsdemo✅❓✅✅✅✅✅
    YOLOPv2Panoptic Drivingdemo✅❓✅❌❌❌❌

    🤝 Contributing

    This is a personal project maintained in spare time, so progress on performance optimization and new model support may vary.

    We highly welcome PRs for model optimization! If you have expertise in specific models and can help optimize their interfaces or post-processing, your contributions would be invaluable. Feel free to open an issue or submit a pull request for suggestions, bug reports, or new features.

    🙏 Acknowledgments

    Thanks to all the open-source libraries and their maintainers that make this project possible. See Cargo.toml for a complete list of dependencies.

    📜 License

    This project is licensed under LICENSE.