File size: 659 Bytes
f6228f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# 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

```