Skip to content

Code to detect objects by inferring images and videos using YOLOv7's onnx model

Notifications You must be signed in to change notification settings

tatsuya-fukuoka/yolov7-onnx-infer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yolov7-onnx-infer

Inference with yolov7's onnx model

onnx model

1. Dev Env

1.1 pip install

pip install -U pip && pip install -r requirements.txt

1.2 Docker

Dockerfile

Ubuntu 20.04

FROM ubuntu:20.04
USER root

RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

LABEL version="1.0"
LABEL description="Build operating environment for yolov7-onnx-infer"

RUN apt-get update && \
    apt-get -y install python3-pip && \
    apt-get -y install git && \
    apt-get -y install libgl1-mesa-dev && \
    apt-get -y install libglib2.0-0 && \
    pip install -U pip && \
    pip install opencv-python onnxruntime

Debian

FROM debian:stable-slim
USER root

LABEL version="1.0"
LABEL description="Build operating environment for yolov7-onnx-infer"

RUN apt-get update && \
    apt-get -y install python3-pip && \
    apt-get -y install git && \
    apt-get -y install libgl1-mesa-dev && \
    apt-get -y install libglib2.0-0 && \
    pip install -U pip && \
    pip install opencv-python onnxruntime

docker build

docker build -t tatsuya060504/yolov7-onnx-infer:v1.0.0 .

docker pull

Docker Hub

docker pull tatsuya060504/yolov7-onnx-infer:raspberrypi

docker run

docker run -it --name=yolov7-onnx-infer -v $(pwd):/home tatsuya060504/yolov7-onnx-infer:raspberrypi

2. Onnx Model Download

You can download the yolox-onnx model by executing the shell script in the model folder.

cd model
sh download_yolov7_tiny_onnx.sh #or download_yolov7_onnx.sh

3. Inference

Image

python onnx_inference.py -i <image_path> -m <onnx_model_path> -e <class_name> -s <score_threshold>

Video

python onnx_inference.py -mo video -i <video_path> -m <onnx_model_path> -e <class_name> -s <score_threshold>

4. References

5. About me

About

Code to detect objects by inferring images and videos using YOLOv7's onnx model

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published