In this repository, I offer improved inference speed utilizing Yolov8 with CPU, utilizing the power of OpenVINO and NumPy, across both Object Detection and Segmentation tasks. This enhancement aims to minimize prediction time while upholding high-quality results. Additionally, I wrote a blog explaining how it works in the industry as well as the code.
Below, you'll find a quickstart guide for installation and usage. Following that, adapt the source code to align with your project requirements.
- Run the code in this repository with conda environment (or miniconda)
git clone https://github.com/Harly-1506/Faster-Inference-yolov8.git
cd Faster-Inference-yolov8
#conda environment
conda create -n openvino_dev python=3.8
# activate conda environment
conda activate openvino_dev
# install requirements for openvino_dev
pip install -r requirements.txt
- Inference yolov8
python main.py --image_path="image_test/IMG_0812.JPG" --model_path="best_openvino_model/openvino_model_yolov8.xml" --output_path="debug/result"
- Inference yolov8 faster
python main_faster.py --image_path="image_test/IMG_0812.JPG" --model_path="best_openvino_model/openvino_model_yolov8.xml" --output_path="debug/result_faster"
- Inference time
Method | Run 1 Time (s) | Run 2 Time (s) |
---|---|---|
openvino + torch | 10.393 | 4.290 |
openvino + numpy | 2.847 | 1.134 |
- Segmentation result
- Object detection result
Visit the Ultralytics Quickstart Guide to learn how to quickly set up and start using Ultralytics YOLO models. This comprehensive guide covers installation, basic commands, and key functionalities to help you get started with YOLOv8 for various applications. Or follow my step below
Datasets folder
- train
images
labels
- valid
images
labels
- data.yaml
conda activate openvino_dev
- /home/harly/.config/Ultralytics/settings.yaml
#segment
yolo task=segment mode=train epochs=200 data=./datasets/data.yaml model=yolov8x-seg.pt imgsz=640 batch=16 patience=0 device=0
#object
yolo task=detect mode=train epochs=200 data=./datasets/data.yaml model=yolov8x.pt imgsz=640 batch=16 patience=0 device=0
python export_model.py --model-path="best_openvino_model/best.pt"
- Then custom the code in this repo and using for your project
Author: Harly
If you have any problems, please leave a message in Issues
Give me a star ⭐ if you find it useful, thanks