Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
triple-Mu committed Apr 7, 2023
1 parent a0a7ada commit 64fc037
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
2 changes: 1 addition & 1 deletion csrc/pose/normal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12)
set(CMAKE_CUDA_ARCHITECTURES 60 61 62 70 72 75 86)
set(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc)

project(yolov8 LANGUAGES CXX CUDA)
project(yolov8-pose LANGUAGES CXX CUDA)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O3 -g")
set(CMAKE_CXX_STANDARD 14)
Expand Down
74 changes: 74 additions & 0 deletions docs/Pose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# YOLOv8-pose Model with TensorRT

The yolov8-pose model conversion route is :
YOLOv8 PyTorch model -> ONNX -> TensorRT Engine

***Notice !!!*** We don't support TensorRT API building !!!

# Export Orin ONNX model by ultralytics

You can leave this repo and use the original `ultralytics` repo for onnx export.

### 1. Python script

Usage:

```python
from ultralytics import YOLO

# Load a model
model = YOLO("yolov8s-pose.pt") # load a pretrained model (recommended for training)
success = model.export(format="engine", device=0) # export the model to engine format
assert success
```

After executing the above script, you will get an engine named `yolov8s-pose.engine` .

### 2. CLI tools

Usage:

```shell
yolo export model=yolov8s-pose.pt format=engine device=0
```

After executing the above command, you will get an engine named `yolov8s-pose.engine` too.

## Inference with c++

You can infer with c++ in [`csrc/pose/normal`](../csrc/pose/normal) .

### Build:

Please set you own librarys in [`CMakeLists.txt`](../csrc/pose/normal/CMakeLists.txt) and modify `KPS_COLORS` and `SKELETON` and `LIMB_COLORS` in [`main.cpp`](../csrc/pose/normal/main.cpp).

Besides, you can modify the postprocess parameters such as `score_thres` and `iou_thres` and `topk` in [`main.cpp`](../csrc/pose/normal/main.cpp).

```c++
int topk = 100;
float score_thres = 0.25f;
float iou_thres = 0.65f;
```

And build:

``` shell
export root=${PWD}
cd src/pose/normal
mkdir build
cmake ..
make
mv yolov8-pose ${root}
cd ${root}
```

Usage:

``` shell
# infer image
./yolov8-pose yolov8s-pose.engine data/bus.jpg
# infer images
./yolov8-pose yolov8s-pose.engine data
# infer video
./yolov8-pose yolov8s-pose.engine data/test.mp4 # the video path
```
2 changes: 1 addition & 1 deletion docs/Segment.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ After executing the above script, you will get an engine named `yolov8s-seg.engi
Usage:

```shell
yolo export model=yolov8s.pt format=engine device=0
yolo export model=yolov8s-seg.pt format=engine device=0
```

After executing the above command, you will get an engine named `yolov8s-seg.engine` too.
Expand Down

0 comments on commit 64fc037

Please sign in to comment.