Skip to content

Commit 6c744b6

Browse files
committed
support yolov6
1 parent ddec5bb commit 6c744b6

5 files changed

Lines changed: 22 additions & 10 deletions

File tree

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This repo use TensorRT-8.x to deploy well-trained models, both image preprocessi
2525
+ 2023.05.12 🚀 Support cuda preprocess for speed up.
2626
+ 2023.05.16 🚀 Support cuda box postprocess.
2727
+ 2023.05.19 🚀 Support cuda mask postprocess and support rtdetr.
28+
+ 2023.05.21 🚀 Support yolov6.
2829
</details>
2930

3031
## 3.Support Models
@@ -37,7 +38,7 @@ This repo use TensorRT-8.x to deploy well-trained models, both image preprocessi
3738
- [x] [YOLOv8](https://github.com/ultralytics/ultralytics)<br>
3839
- [x] [YOLOv8-seg](https://github.com/ultralytics/ultralytics)<br>
3940
- [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+
- [ ] [YOLOv6](https://github.com/meituan/YOLOv6)<br>
4142
- [ ] [YOLO-NAS](https://github.com/Deci-AI/super-gradients) (to be continued)<br>
4243
</details>
4344

@@ -46,13 +47,13 @@ All speed tests were performed on RTX 3090 with COCO Val set.The time calculated
4647

4748
| Models | BatchSize | Mode | Resolution | FPS |
4849
|-|-|:-:|:-:|:-:|
49-
| YOLOv5-s v7.0 | 1 | FP32 | 640x640 | 468 |
50+
| YOLOv5-s v7.0 | 1 | FP32 | 640x640 | 200 |
5051
| YOLOv5-s v7.0 | 32 | FP32 | 640x640 | - |
51-
| YOLOv5-seg-s v7.0 | 1 | FP32 | 640x640 | - |
52-
| YOLOv7 | 1 | FP32 | 640x640 | 154 |
52+
| YOLOv5-seg-s v7.0 | 1 | FP32 | 640x640 | 155 |
53+
| YOLOv6-s v3 | 1 | FP32 | 640x640 | 163 |
54+
| YOLOv7 | 1 | FP32 | 640x640 | 107 |
5355
| YOLOv8-s | 1 | FP32 | 640x640 | 171 |
54-
| YOLOv8-s | 1 | FP32 | 640x640 | - |
55-
| RT-DETR | 1 | FP32 | 640x640 | - |
56+
| YOLOv8-seg-s | 1 | FP32 | 640x640 | 122 |
5657
| RT-DETR | 1 | FP32 | 640x640 | - |
5758
</div>
5859

@@ -96,7 +97,7 @@ cd bin
9697
```
9798

9899
> Notes:
99-
> 1. The output of the model is required for post-processing is num_bboxes (imageHeight x image Width) x num_pred(num_cls + coordinates + confidence),while the output of YOLOv8 is num_pred * num_bboxes,which means the predicted values of the same box are not contiguous in memory.For convenience, the corresponding dimensions of the original pytorch output need to be transposed when exporting to ONNX model.
100+
> 1. The output of the model is required for post-processing is num_bboxes (imageHeight x image Width) x num_pred(num_cls + coordinates + confidence),while the output of YOLOv8 is num_pred x num_bboxes,which means the predicted values of the same box are not contiguous in memory.For convenience, the corresponding dimensions of the original pytorch output need to be transposed when exporting to ONNX model.
100101
101102

102103

include/yolov6.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "yolov8.h"
55

6-
class YOLOv6 : public YOLOv8 {
6+
class YOLOv6 : public YOLO {
77
public:
88
explicit YOLOv6(const YAML::Node &config);
99
};

src/detection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ void Detection::Inference(const std::string &input_path, const std::string &save
8989
if (imgBatch.size() == batchSize or index == image_list.size()){
9090
auto infer_start = std::chrono::high_resolution_clock::now();
9191
auto det_results = InferenceImages(imgBatch);
92-
Visualize(det_results, imgBatch, imgInfo);
9392
auto infer_end = std::chrono::high_resolution_clock::now();
9493
total_time += std::chrono::duration<float, std::milli>(infer_end - infer_start).count();
94+
Visualize(det_results, imgBatch, imgInfo);
9595
imgBatch.clear();
9696
imgInfo.clear();
9797
}

src/instance_segmentation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ void InstanceSegmentation::Inference(const std::string &input_path, const std::s
8181
for (const std::string &image_name : image_list) {
8282
index++;
8383
// TODO: figure out why double free.
84+
auto load_start = std::chrono::high_resolution_clock::now();
8485
cv::Mat img = cv::imread(image_name);
86+
auto load_end = std::chrono::high_resolution_clock::now();
87+
total_time += std::chrono::duration<float, std::milli>(load_end - load_start).count();
8588
imgBatch.emplace_back(img.clone());
8689
auto save_name = replace(image_name, input_path, save_path);
8790
imgInfo.emplace_back(save_name);

src/yolov6.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
#include "yolov6.h"
22

3-
YOLOv6::YOLOv6(const YAML::Node &config) : YOLOv8(config) {}
3+
YOLOv6::YOLOv6(const YAML::Node &config) : YOLO(config) {
4+
int index = 0;
5+
num_bboxes = 0;
6+
for (const int &stride : strides)
7+
{
8+
num_bboxes += int(imageHeight / stride) * int(imageWidth / stride);
9+
index+=1;
10+
}
11+
}

0 commit comments

Comments
 (0)