Skip to content

offhock/rust_image_processing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Processing using rust

https://github.com/jamjamjon/usls?tab=readme-ov-file https://github.com/jamjamjon/assets/releases/tag/yolo https://github.com/jamjamjon/assets/releases/download/yolo/v11-n-pose.onnx

sudo apt-get install libavfilter-dev libavutil-dev libavformat-dev libavdevice-dev libclang-dev
cargo build
cargo run 
cargo run -r -- --task pose --ver v11 --scale n --model ./models/v11-m-pose.onnx  --source ./assets/bus.jpg
# Usage: rust_image_processing <--model <MODEL>|--source <SOURCE>|--task <TASK>|--ver <VER>|--scale <SCALE>|--batch-size <BATCH_SIZE>|--width-min <WIDTH_MIN>|--width <WIDTH>|--width-max <WIDTH_MAX>|--height-min <HEIGHT_MIN>|--height <HEIGHT>|--height-max <HEIGHT_MAX>|--nc <NC>|--confs <CONFS>|--trt|--cuda|--coreml|--half|--device-id <DEVICE_ID>|--profile|--no-contours|--view|--nosave>

YOLO-Series

Detection Instance Segmentation Pose
Classification Obb
Head Detection Fall Detection Trash Detection
YOLO-World Face Parsing FastSAM

Quick Start

# customized
cargo run -r --example yolo -- --task detect --ver v8 --nc 6 --model xxx.onnx  # YOLOv8

# Classify
cargo run -r --example yolo -- --task classify --ver v5 --scale s --width 224 --height 224 --nc 1000  # YOLOv5
cargo run -r --example yolo -- --task classify --ver v8 --scale n --width 224 --height 224 --nc 1000  # YOLOv8 
cargo run -r --example yolo -- --task classify --ver v11 --scale n --width 224 --height 224 --nc 1000  # YOLOv11 

# Detect
cargo run -r --example yolo -- --task detect --ver v5 --scale n  # YOLOv5 
cargo run -r --example yolo -- --task detect --ver v6 --scale n  # YOLOv6
cargo run -r --example yolo -- --task detect --ver v7 --scale t  # YOLOv7
cargo run -r --example yolo -- --task detect --ver v8 --scale n  # YOLOv8
cargo run -r --example yolo -- --task detect --ver v9 --scale t  # YOLOv9
cargo run -r --example yolo -- --task detect --ver v10 --scale n  # YOLOv10
cargo run -r --example yolo -- --task detect --ver v11 --scale n  # YOLOv11
cargo run -r --example yolo -- --task detect --ver rtdetr --scale l  # RTDETR
cargo run -r --example yolo -- --task detect --ver v8 --model yolo/v8-s-world-v2-shoes.onnx  # YOLOv8-world

cargo run -r --example yolo -- --task detect --ver v8 --scale n --model ../models/v8-m-det.onnx  --source assets/bus.jpg
cargo run -r --example yolo -- --task detect --ver v11 --scale n --model ../models/v11-m-det.onnx  --source assets/bus.jpg


# Pose
cargo run -r --example yolo -- --task pose --ver v8 --scale n   # YOLOv8-Pose
cargo run -r --example yolo -- --task pose --ver v11 --scale n  # YOLOv11-Pose

cargo run -r --example yolo -- --task pose --ver v8 --scale n --model ../models/v8-m-pose.onnx  --source assets/bus.jpg
cargo run -r --example yolo -- --task pose --ver v11 --scale n --model ../models/v11-m-pose.onnx  --source assets/bus.jpg
# Segment
cargo run -r --example yolo -- --task segment --ver v5 --scale n  # YOLOv5-Segment
cargo run -r --example yolo -- --task segment --ver v8 --scale n  # YOLOv8-Segment
cargo run -r --example yolo -- --task segment --ver v11 --scale n  # YOLOv8-Segment
cargo run -r --example yolo -- --task segment --ver v8 --model yolo/FastSAM-s-dyn-f16.onnx  # FastSAM

# Obb
cargo run -r --example yolo -- --ver v8 --task obb --scale n --width 1024 --height 1024 --source images/dota.png  # YOLOv8-Obb
cargo run -r --example yolo -- --ver v11 --task obb --scale n --width 1024 --height 1024 --source images/dota.png  # YOLOv11-Obb

cargo run -r --example yolo -- --help for more options

YOLOs configs with Options

Use official YOLO Models
let options = Options::default()
    .with_yolo_version(YOLOVersion::V5)  // YOLOVersion: V5, V6, V7, V8, V9, V10, RTDETR
    .with_yolo_task(YOLOTask::Classify)  // YOLOTask: Classify, Detect, Pose, Segment, Obb
    .with_model("xxxx.onnx")?;
Cutomized your own YOLO model
// This config is for YOLOv8-Segment 
use usls::{AnchorsPosition, BoxType, ClssType, YOLOPreds};

let options = Options::default()
    .with_yolo_preds(
        YOLOPreds {
            bbox: Some(BoxType::Cxcywh),
            clss: ClssType::Clss,
            coefs: Some(true),
            anchors: Some(AnchorsPosition::After),
            ..Default::default()
        }
    )
    // .with_nc(80)
    // .with_names(&COCO_CLASS_NAMES_80)
    .with_model("xxxx.onnx")?;

Other YOLOv8 Solution Models

Model Weights Datasets
Face-Landmark Detection yolov8-face-dyn-f16
Head Detection yolov8-head-f16
Fall Detection yolov8-falldown-f16
Trash Detection yolov8-plastic-bag-f16
FaceParsing yolov8-face-parsing-dyn CelebAMask-HQ
[Processed YOLO labels][Python Script]

Export ONNX Models

YOLOv5

Here

YOLOv6

Here

YOLOv7

Here

YOLOv8, YOLOv11
pip install -U ultralytics

# export onnx model with dynamic shapes
yolo export model=yolov8m.pt format=onnx simplify dynamic
yolo export model=yolov8m-cls.pt format=onnx simplify dynamic
yolo export model=yolov8m-pose.pt format=onnx simplify dynamic
yolo export model=yolov8m-seg.pt format=onnx simplify dynamic
yolo export model=yolov8m-obb.pt format=onnx simplify dynamic

# export onnx model with fixed shapes
yolo export model=yolov8m.pt format=onnx simplify
yolo export model=yolov8m-cls.pt format=onnx simplify
yolo export model=yolov8m-pose.pt format=onnx simplify
yolo export model=yolov8m-seg.pt format=onnx simplify
yolo export model=yolov8m-obb.pt format=onnx simplify
YOLOv9

Here

YOLOv10

Here

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published