From e03985cb040086e2ad88c8be4a660b901a2fb7f8 Mon Sep 17 00:00:00 2001 From: triple-Mu Date: Sun, 8 Jan 2023 16:54:22 +0800 Subject: [PATCH] Add cpp infer readme --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index aedaf72..4e13f72 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,8 @@ python build.py \ # Infer images by the engine which you export or build +## 1. Python infer + You can infer images with the engine by [`infer.py`](infer.py) . Usage: @@ -132,6 +134,35 @@ python3 infer.py --engine yolov8s_nms.engine --imgs data --show --out-dir output - `--device` : The CUDA deivce you use. - `--profile` : Profile the TensorRT engine. +## 2. C++ infer + +You can infer with c++ in [`csrc/end2end`](csrc/end2end) . + +Build: + +Please set you own librarys in [`CMakeLists.txt`](csrc/end2end/CMakeLists.txt) and modify you own config in [`yolov8.hpp`](csrc/end2end/yolov8.hpp) such as `classes names` and `colors` . + +``` shell +export root=${PWD} +cd src/end2end +mkdir build +cmake .. +make +mv yolov8 ${root} +cd ${root} +``` + +Usage: + +``` shell +# infer image +./yolov8 yolov8s_nms.engine data/bus.jpg +# infer images +./yolov8 yolov8s_nms.engine data +# infer video +./yolov8 yolov8s_nms.engine data/test.mp4 # the video path +``` + # Profile you engine If you want to profile the TensorRT engine: