Git Product home page Git Product logo

yolov7_openvino_cpp-python's Introduction

YOLOv7_OpenVINO

This repository will demostrate how to deploy a offical YOLOv7 pre-trained model with OpenVINO runtime api

1. Install requirements

Python

  $ pip install -r python/requirements.txt

C++ (Ubuntu)

Please follow the Guides to install OpenVINO and OpenCV

2. Prepare the model

Download YOLOv7 pre-trained weight from YOLOv7

3. Export the ONNX model

  $ git clone [email protected]:WongKinYiu/yolov7.git
  $ cd yolov7/models
  $ python export.py --weights yolov7.pt

4. Run inference

The input image can be found in YOLOv7's repository

Python

 $ python python/image.py -m yolov7.onnx -i data/horse.jpg -d "CPU" -p False

You can also try running the code with Preprocessing API for performance optimization.

 $ python python/image.py -m yolov7.onnx -i data/horse.jpg
  • -i = path to image or video source;
  • -m = Path to IR .xml or .onnx file;
  • -d = Device name, e.g "CPU";
  • -p = use preprocessing api, True or False
  • -bs = Batch size;
  • -n = number of infer requests;
  • -g = with/without grid in model, True or False;

C++ (Ubuntu)

Compile the source code

  $ cd cpp
  $ mkdir build && cd build
  $ source '~/intel/openvino_2022.1.0.643/bin/setupvars.sh'
  $ cmake ..
  $ make

You can also uncomment the code in CMakeLists.txt to trigger Preprocessing API for performance optimization.

Run inference

 $ yolov7 yolov7.onnx data/horses.jpg 'CPU'

5. Results

horse_res

6. Run with webcam

You can also run the sample with webcam for real-time detection

$ python python/webcam.py -m yolov7.onnx -i 0

Tips: you can switch the device name to "GPU" to improve the performance.

7. Further optimization

Try this notebook (yolov7-optimization) and quantize your YOLOv7 model to INT8.

yolov7_openvino_cpp-python's People

Contributors

openvino-dev-contest avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.