This repository will demostrate how to deploy a offical YOLOv7 pre-trained model with OpenVINO runtime api
$ pip install -r python/requirements.txt
Please follow the Guides to install OpenVINO and OpenCV
Download YOLOv7 pre-trained weight from YOLOv7
$ git clone git@github.com:WongKinYiu/yolov7.git
$ cd yolov7
$ pip install -r requirements
$ python export.py --weights yolov7.pt
$ ovc yolov7.onnx
The input image can be found in YOLOv7's repository
$ python python/image.py -m path_to/yolov7.xml -i data/horse.jpg -d "CPU"
You can also try running the code with Preprocessing API for performance optimization.
$ python python/image.py -m path_to/yolov7.xml -i data/horse.jpg -d "CPU" -p
- -i = path to image or video source;
- -m = Path to IR .xml or .onnx file;
- -d = Device name, e.g "CPU";
- -p = with/without preprocessing api
- -bs = Batch size;
- -n = number of infer requests;
Compile the source code
$ cd cpp
$ mkdir build && cd build
$ source '~/intel/openvino_2023.2/bin/setupvars.sh'
$ cmake ..
$ make
You can also uncomment the code in CMakeLists.txt
to trigger Preprocessing API for performance optimization.
Run inference
$ yolov7 path_to/yolov7.xml ../../data/horses.jpg 'CPU'
You can also run the sample with webcam for real-time detection
$ python python/webcam.py -m path_to/yolov7.xml -i 0
Tips: you can switch the device name to "GPU" to improve the performance.
Try this notebook (yolov7-optimization) and quantize your YOLOv7 model to INT8.