Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/masc-it/yolov5-api-rust

Rust API to run predictions with YoloV5 models.
https://github.com/masc-it/yolov5-api-rust

actix-web onnx rust yolov5

Last synced: 12 days ago
JSON representation

Rust API to run predictions with YoloV5 models.

Lists

README

        

# 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](https://github.com/masc-it/yolov5-api-cpp)

## Requirements

- [OpenCV 4.5.5](https://github.com/opencv/opencv/releases/tag/4.5.5) installed on your system
- Follow [Rust opencv README](https://github.com/twistedfall/opencv-rust)

## 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 :/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