yolo_binding

Crates.ioyolo_binding
lib.rsyolo_binding
version0.2.6
created_at2025-02-05 09:30:02.705535+00
updated_at2025-02-21 12:09:43.755683+00
descriptionA yolo prediction frame with torch-rs
homepage
repositoryhttps://github.com/zhao-leo/yolo_binding
max_upload_size
id1543754
size206,108
April (zhao-leo)

documentation

https://yolo-rs.zhaocloud.work/yolo_binding/index.html

README

A rust binding for yolov8 or higher aimed at detection

Quick Start:

use yolo_binding::{core::*, utils::*};
use std::ops::Index;
fn main() {
    const IMAGE_PATH: &str = "test.jpg";
    const OUTPUT_PATH: &str = "output.jpg";
    const MODEL_PATH: &str = "yolov5s.torchscript.pt";

    let model = YOLO::new(MODEL_PATH, true);
    let image = load_one_image("test.jpg").unwrap();
    let output = model.predict(&image).unwrap();
    let results = get_results(&output, 0.5, 0.5).unwrap();
    let picture = picture::export_one_image(&model.types, results.index(0).to_vec(), IMAGE_PATH).unwrap();
    picture.save(OUTPUT_PATH).unwrap();
}

This create is a binding for yolov8 or higher.

Currently, it supports load module from a torchscript file.

it offers apis to load from a file, load from dir and load from bytes.

it offers apis to export to DynamicImage or a dir.

I try my best to make it easy, but obviously it can just deal with the basic function.

It uses the yolo-metadata information and detect 0x504b0708 as the end of metadata,

so it may not work correctly on your computer.

If possible I will add more useful functions but currently it is a tool for my competition.

Linux is now supported.

TODO:fix docs.rs build problem.

Commit count: 17

cargo fmt