Skip to content

Commit bd399ae

Browse files
committed
update readme
1 parent a89923c commit bd399ae

11 files changed

Lines changed: 66 additions & 26 deletions

File tree

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
bin
3535
.vscode
3636
weights
37-
yaml-cpp-yaml-cpp-0.6.3
37+
yaml-cpp
3838
build
39-
demo
40-
results
39+
demo

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ This repo use TensorRT-8.x to deploy well-trained models, both image preprocessi
3737
- [x] [YOLOv8](https://github.com/ultralytics/ultralytics)<br>
3838
- [x] [YOLOv8-seg](https://github.com/ultralytics/ultralytics)<br>
3939
- [x] [RT-DETR](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/rtdetr)<br>
40-
- [] [YOLOv6](https://github.com/meituan/YOLOv6) (to be continued)<br>
41-
- [] [YOLO-NAS](https://github.com/Deci-AI/super-gradients) (to be continued)<br>
40+
- [ ] [YOLOv6](https://github.com/meituan/YOLOv6) (to be continued)<br>
41+
- [ ] [YOLO-NAS](https://github.com/Deci-AI/super-gradients) (to be continued)<br>
4242
</details>
4343

4444
All speed tests were performed on RTX 3090 with COCO Val set.The time calculated here is the sum of the time of image loading, preprocess, inference and postprocess, so it's going to be slower than what's reported in the paper.
4545
<div align='center'>
4646

47-
| Models | BatchSize | Mode | Input Shape(HxW) | FPS |
47+
| Models | BatchSize | Mode | Resolution | FPS |
4848
|-|-|:-:|:-:|:-:|
4949
| YOLOv5-s v7.0 | 1 | FP32 | 640x640 | 468 |
5050
| YOLOv5-s v7.0 | 32 | FP32 | 640x640 | - |
@@ -58,18 +58,36 @@ All speed tests were performed on RTX 3090 with COCO Val set.The time calculated
5858

5959

6060
## 4.Usage
61+
62+
6163
1. Clone the repo.
6264
```
6365
git clone https://github.com/Li-Hongda/TensorRT_Inference_Demo.git
64-
cd TensorRT_Inference_Demo/object_detection
6566
```
66-
2. Change the path [here](https://github.com/Li-Hongda/TensorRT_Inference_Demo/blob/main/object_detection/CMakeLists.txt#L19) to your TensorRT path, and [here](https://github.com/Li-Hongda/TensorRT_Inference_Demo/blob/main/object_detection/CMakeLists.txt#L11) to your CUDA path. Then,
67+
2. Install the dependencies.
68+
### TensorRT
69+
Following [NVIDIA offical docs](https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing) to install TensorRT.
70+
71+
### yaml-cpp
6772
```
73+
git clone https://github.com/jbeder/yaml-cpp
74+
mkdir build && cd build
75+
cmake ..
76+
make -j20
77+
cmake -DYAML_BUILD_SHARED_LIBS=on ..
78+
make -j20
79+
cd ..
80+
```
81+
82+
83+
3. Change the path [here](https://github.com/Li-Hongda/TensorRT_Inference_Demo/blob/main/object_detection/CMakeLists.txt#L19) to your TensorRT path, and [here](https://github.com/Li-Hongda/TensorRT_Inference_Demo/blob/main/object_detection/CMakeLists.txt#L11) to your CUDA path. Then,
84+
```
85+
cd TensorRT_Inference_Demo/object_detection
6886
mkdir build && cd build
6987
cmake ..
7088
make -j$(nproc)
7189
```
72-
3. The executable file will be generated in `bin` in the repo directory if compile successfully.Then enjoy yourself with command like this:
90+
4. The executable file will be generated in `bin` in the repo directory if compile successfully.Then enjoy yourself with command like this:
7391
```
7492
cd bin
7593
./object_detection yolov5 /path/to/input/dir

configs/yolov6.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
yolov7:
2+
onnx_file: "../weights/yolov6/yolov6.onnx"
3+
engine_file: "../weights/yolov6/yolov6.trt"
4+
type: "coco"
5+
mode: "fp32"
6+
batchSize: 1
7+
imageWidth: 640
8+
imageHeight: 640
9+
conf_thr: 0.25
10+
nms_thr: 0.45
11+
strides: [8, 16, 32]
12+
imgMean: [ 0, 0, 0 ]
13+
imgStd: [ 1, 1, 1 ]

include/yolov6.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef YOLOV6_H
2+
#define YOLOV6_H
3+
4+
#include "yolo.h"
5+
6+
class YOLOv6 : public YOLO {
7+
public:
8+
explicit YOLOv6(const YAML::Node &config);
9+
};
10+
11+
#endif

object_detection/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ list(APPEND ALL_LIBS ${OpenCV_LIBRARIES})
4747
list(APPEND ALL_INCLUDE ${OpenCV_INCLUDE_DIRS})
4848

4949
# YAML
50-
set(YAML_LIBRARY ../yaml-cpp-yaml-cpp-0.6.3/build)
51-
set(YAML_INCLUDE ../yaml-cpp-yaml-cpp-0.6.3/include)
50+
set(YAML_LIBRARY ../yaml-cpp/build)
51+
set(YAML_INCLUDE ../yaml-cpp/include)
5252
link_directories(${YAML_LIBRARY})
5353
list(APPEND ALL_INCLUDE ${YAML_INCLUDE})
5454

object_detection/rtdetr/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ project(rtdetr)
88
set(CMAKE_CXX_STANDARD 14)
99

1010
# YAML
11-
set(YAML_LIBRARY ../../yaml-cpp-yaml-cpp-0.6.3/build)
12-
set(YAML_INCLUDE ../../yaml-cpp-yaml-cpp-0.6.3/include)
11+
set(YAML_LIBRARY ../../yaml-cpp/build)
12+
set(YAML_INCLUDE ../../yaml-cpp/include)
1313
link_directories(${YAML_LIBRARY})
1414
list(APPEND ALL_INCLUDE ${YAML_INCLUDE})
1515

object_detection/yolov5/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ project(yolov5)
88
set(CMAKE_CXX_STANDARD 14)
99

1010
# YAML
11-
set(YAML_LIBRARY ../../yaml-cpp-yaml-cpp-0.6.3/build)
12-
set(YAML_INCLUDE ../../yaml-cpp-yaml-cpp-0.6.3/include)
11+
set(YAML_LIBRARY ../../yaml-cpp/build)
12+
set(YAML_INCLUDE ../../yaml-cpp/include)
1313
link_directories(${YAML_LIBRARY})
1414
list(APPEND ALL_INCLUDE ${YAML_INCLUDE})
1515

object_detection/yolov7/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ project(yolov7)
88
set(CMAKE_CXX_STANDARD 14)
99

1010
# YAML
11-
set(YAML_LIBRARY ../../yaml-cpp-yaml-cpp-0.6.3/build)
12-
set(YAML_INCLUDE ../../yaml-cpp-yaml-cpp-0.6.3/include)
11+
set(YAML_LIBRARY ../../yaml-cpp/build)
12+
set(YAML_INCLUDE ../../yaml-cpp/include)
1313
link_directories(${YAML_LIBRARY})
1414
list(APPEND ALL_INCLUDE ${YAML_INCLUDE})
1515

object_detection/yolov8/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ project(yolov8)
88
set(CMAKE_CXX_STANDARD 14)
99

1010
# YAML
11-
set(YAML_LIBRARY ../../yaml-cpp-yaml-cpp-0.6.3/build)
12-
set(YAML_INCLUDE ../../yaml-cpp-yaml-cpp-0.6.3/include)
11+
set(YAML_LIBRARY ../../yaml-cpp/build)
12+
set(YAML_INCLUDE ../../yaml-cpp/include)
1313
link_directories(${YAML_LIBRARY})
1414
list(APPEND ALL_INCLUDE ${YAML_INCLUDE})
1515

src/rtdetr.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ std::vector<Detections> RTDETR::InferenceImages(std::vector<cv::Mat> &imgBatch)
2121
auto boxes = PostProcess(imgBatch, gpu_buffers[1], gpu_buffers[2]);
2222
auto t_end_post = std::chrono::high_resolution_clock::now();
2323
float total_post = std::chrono::duration<float, std::milli>(t_end_post - t_start_post).count();
24-
// std::cout << "preprocess time: "<< total_pre << "ms " <<
25-
// "detection inference time: " << total_inf << "ms "
26-
// "postprocess time: " << total_post << "ms " << std::endl;
24+
std::cout << "preprocess time: "<< total_pre << "ms " <<
25+
"detection inference time: " << total_inf << "ms "
26+
"postprocess time: " << total_post << "ms " << std::endl;
2727
return boxes;
2828
}
2929

@@ -38,12 +38,8 @@ std::vector<Detections> RTDETR::PostProcess(const std::vector<cv::Mat> &imgBatch
3838
float* box_per_img = output1 + index * predboxSize;
3939
float* score_per_img = output2 + index * predscoreSize;
4040
cuda_postprocess_init(6, imageWidth, imageHeight);
41-
auto t_start_post = std::chrono::high_resolution_clock::now();
4241
rtdetr_postprocess_box(box_per_img, score_per_img, num_bboxes, num_classes, 6,
4342
conf_thr, imageWidth, imageHeight, dst2src, stream, cpu_buffers[2]);
44-
auto t_end_post = std::chrono::high_resolution_clock::now();
45-
float total_post = std::chrono::duration<float, std::milli>(t_end_post - t_start_post).count();
46-
std::cout << "postprocess time: " << total_post << "ms " << std::endl;
4743
int num_boxes = std::min((int)cpu_buffers[2][0], 300);
4844
for (int i = 0; i < num_boxes; i++) {
4945
Box box;

0 commit comments

Comments
 (0)