guoguoguo98 / YOLOv8.OpenVino.CPP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YOLOv8.OpenVino.cpp

YOLOv8 is a state-of-the-art object detector by ultralytics. This project implements the YOLOv8 object detector in C++ with an OpenVINO backend to speed up inference performance.

Features

  • Supports both image and video inference.
  • Provides faster inference speeds.

Prerequisites

Tested on Macbook Pro M1.

  • CMake v3.8+ - Download from https://cmake.org/.
  • OpenVINO Toolkit 2022.1+ - Tested on version 2023.1.0. Download from here.
  • OpenCV v4.6+ - Tested on version v4.8.0_7. Download from here.

Getting Started

  1. Set the OpenCV_DIR environment variable to point to your ../../opencv/build directory.

  2. Set the OpenVINO_DIR environment variable to point to your ../../openvino/runtime/cmake directory.

  3. Run the following build commands:

    For Mac with VS Developer Command Prompt:

    cd <git-directory>
    
    # Install dependencies
    brew install openvino
    brew install opencv
    
    # Build
    cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
    cd build
    make

Inference

  1. Export the ONNX file:

    pip install ultralytics
    yolo export model=yolov8s.pt format=onnx  # Export official model
  2. To run the inference, execute the following command:

    yolo --model <MODEL_PATH> [-i <IMAGE_PATH> | -v <VIDEO_PATH>] [--imgsz IMAGE_SIZE] [--gpu] [--iou-thresh IOU_THRESHOLD] [--score-thresh CONFIDENCE_THRESHOLD]
    
    # Example:
    yolo --model yolov8x.onnx -i images/zidane.jpg

License

This project is licensed under the MIT License. See the LICENSE file for details.

References

About

License:MIT License


Languages

Language:C++ 98.7%Language:CMake 1.3%