Add YOLOv8 LibTorch C++ inference example (#7090)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
f955978dc4
commit
a5735724c5
4 changed files with 342 additions and 0 deletions
35
examples/YOLOv8-LibTorch-CPP-Inference/README.md
Normal file
35
examples/YOLOv8-LibTorch-CPP-Inference/README.md
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# YOLOv8 LibTorch Inference C++
|
||||
|
||||
This example demonstrates how to perform inference using YOLOv8 models in C++ with LibTorch API.
|
||||
|
||||
## Dependencies
|
||||
|
||||
| Dependency | Version |
|
||||
| ------------ | -------- |
|
||||
| OpenCV | >=4.0.0 |
|
||||
| C++ Standard | >=17 |
|
||||
| Cmake | >=3.18 |
|
||||
| Libtorch | >=1.12.1 |
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
git clone ultralytics
|
||||
cd ultralytics
|
||||
pip install .
|
||||
cd examples/YOLOv8-LibTorch-CPP-Inference
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
./yolov8_libtorch_inference
|
||||
```
|
||||
|
||||
## Exporting YOLOv8
|
||||
|
||||
To export YOLOv8 models:
|
||||
|
||||
```commandline
|
||||
yolo export model=yolov8s.pt imgsz=640 format=torchscript
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue