Skip to content

masc-it/yolov5-api-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YoloV5-API [WIP]

API to run inferences with YoloV5 models. Written in Rust, based on OpenCV 4.5.5

If you need a C++ version, check my C++ Yolov5-API

Requirements

Model config

Data directory must contain your config.json

config.json defines:

  • ONNX absolute model path
  • input size (640 default)
  • array of class names

A dummy example is available in the data/ folder

Docker

docker run --name rust-yolov5-api -v <model data dir>:/app/data -p 5000:5000 mascit/rust-yolov5-api:latest

Build

Development:

cargo build

Release:

cargo build --release

Run

cargo run

For Windows users: Assure to have opencv_world455.dll in your exe directory.

Endpoints

/predict [POST]

Body

  • Image bytes (binary in Postman)

Headers

  • X-Confidence-Thresh
    • default 0.5
  • X-NMS-Thresh
    • default 0.45
  • X-Return
    • image_with_boxes
      • A JPEG image with drawn predictions
    • json (default)
      • A json array containing predictions. Each object defines: xmin, ymin, xmax, ymax, conf, class_name

About

Rust API to run predictions with YoloV5 models.

Topics

Resources

License

Stars

Watchers

Forks