ultralytics 8.0.41 TF SavedModel and EdgeTPU export (#1034)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Noobtoss <96134731+Noobtoss@users.noreply.github.com> Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com>
This commit is contained in:
parent
4b866c9718
commit
f6e393c1d2
64 changed files with 604 additions and 351 deletions
57
examples/YOLOv8-CPP-Inference/README.md
Normal file
57
examples/YOLOv8-CPP-Inference/README.md
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# yolov8/yolov5 Inference C++
|
||||
|
||||
Usage:
|
||||
|
||||
```
|
||||
# git clone ultralytics
|
||||
pip install .
|
||||
cd examples/cpp_
|
||||
|
||||
Add a **yolov8\_.onnx** and/or **yolov5\_.onnx** model(s) to the ultralytics folder.
|
||||
Edit the **main.cpp** to change the **projectBasePath** to match your user.
|
||||
|
||||
Note that by default the CMake file will try and import the CUDA library to be used with the OpenCVs dnn (cuDNN) GPU Inference.
|
||||
If your OpenCV build does not use CUDA/cuDNN you can remove that import call and run the example on CPU.
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
./Yolov8CPPInference
|
||||
```
|
||||
|
||||
To export yolov8 models:
|
||||
|
||||
```
|
||||
yolo export \
|
||||
model=yolov8s.pt \
|
||||
imgsz=[480,640] \
|
||||
format=onnx \
|
||||
opset=12
|
||||
```
|
||||
|
||||
To export yolov5 models:
|
||||
|
||||
```
|
||||
python3 export.py \
|
||||
--weights yolov5s.pt \
|
||||
--img 480 640 \
|
||||
--include onnx \
|
||||
--opset 12
|
||||
```
|
||||
|
||||
yolov8s.onnx:
|
||||
|
||||

|
||||
|
||||
yolov5s.onnx:
|
||||
|
||||

|
||||
|
||||
This repository is based on OpenCVs dnn API to run an ONNX exported model of either yolov5/yolov8 (In theory should work
|
||||
for yolov6 and yolov7 but not tested). Note that for this example the networks are exported as rectangular (640x480)
|
||||
resolutions, but it would work for any resolution that you export as although you might want to use the letterBox
|
||||
approach for square images depending on your use-case.
|
||||
|
||||
The **main** branch version is based on using Qt as a GUI wrapper the main interest here is the **Inference** class file
|
||||
which shows how to transpose yolov8 models to work as yolov5 models.
|
||||
Loading…
Add table
Add a link
Reference in a new issue