Skip to content

Commit 9f0c165

Browse files
committed
update mask postprocess
1 parent 9ea6918 commit 9f0c165

20 files changed

Lines changed: 271 additions & 502 deletions

configs/rtdetr.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
rtdetr:
2-
onnx_file: "../weights/rtdetr/rtdetr_r50vd_6x_coco.onnx"
3-
engine_file: "../weights/rtdetr/rtdetr_r50vd.trt"
2+
onnx_file: "../weights/rtdetr/rtdetr_hgnetv2_l_6x_coco.onnx"
3+
engine_file: "../weights/rtdetr/rtdetr_hgnetl.trt"
44
type: "coco80"
55
mode: "fp32"
66
batchSize: 1
7-
inputChannel: 3
87
imageWidth: 640
98
imageHeight: 640
10-
conf_thr: 0.25
11-
nms_thr: 0.45
12-
strides: [8, 16, 32]
9+
conf_thr: 0.5
10+
num_queries: 300
1311
imgMean: [ 0, 0, 0 ]
1412
imgStd: [ 1, 1, 1 ]

configs/yolov5-seg.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ yolov5-seg:
44
type: "coco80"
55
mode: "fp32"
66
batchSize: 1
7-
inputChannel: 3
87
imageWidth: 640
98
imageHeight: 640
109
conf_thr: 0.25

configs/yolov5.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ yolov5:
44
type: "coco80"
55
mode: "fp32"
66
batchSize: 1
7-
inputChannel: 3
87
imageWidth: 640
98
imageHeight: 640
109
conf_thr: 0.25

configs/yolov7-p6.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ yolov7:
44
type: "coco80"
55
mode: "fp32"
66
batchSize: 1
7-
inputChannel: 3
87
imageWidth: 1280
98
imageHeight: 1280
109
conf_thr: 0.4

configs/yolov7.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ yolov7:
44
type: "coco80"
55
mode: "fp32"
66
batchSize: 1
7-
inputChannel: 3
87
imageWidth: 640
98
imageHeight: 640
109
conf_thr: 0.25

configs/yolov8-seg.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ yolov8-seg:
44
type: "coco80"
55
mode: "fp32"
66
batchSize: 1
7-
inputChannel: 3
87
imageWidth: 640
98
imageHeight: 640
109
conf_thr: 0.25

configs/yolov8.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
yolov8:
2-
onnx_file: "../weights/yolov8/yolov8m.onnx"
3-
engine_file: "../weights/yolov8/yolov8m.trt"
2+
onnx_file: "../weights/yolov8/yolov8s.onnx"
3+
engine_file: "../weights/yolov8/yolov8s.trt"
44
type: "coco80"
55
mode: "fp32"
66
batchSize: 1
7-
inputChannel: 3
87
imageWidth: 640
98
imageHeight: 640
109
conf_thr: 0.25

include/basemodel.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class Model
2222
std::string mode;
2323
AffineMatrix dst2src;
2424
int batchSize;
25-
int inputChannel;
2625
int imageWidth;
2726
int imageHeight;
2827
std::string names[10];

include/cuda_function.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ void preprocess(uint8_t* src, AffineMatrix d2s, int src_width, int src_height,
2020
cudaStream_t stream);
2121

2222

23-
void postprocess_box(float* predict, int num_bboxes, int num_out, int num_classes, float conf_thr,
23+
void postprocess_box(float* predict, int num_bboxes, int num_classes, int num_out, float conf_thr,
2424
float nms_thr, cudaStream_t stream, float* dst);
2525

26-
void yolov8_postprocess_box(float* predict, int num_bboxes, int num_out, int num_classes, float conf_thr,
26+
void yolov8_postprocess_box(float* predict, int num_bboxes, int num_classes, int num_out, float conf_thr,
2727
float nms_thr, cudaStream_t stream, float* dst);
2828

29+
void rtdetr_postprocess_box(float* predict_box, float* predict_cls, int num_bboxes, int num_classes, int num_out,
30+
float conf_thr, int imageWidth, int imageHeight, cudaStream_t stream, float* dst);
31+
2932
void postprocess_box_mask(float* predict, int num_bboxes, int num_classes, int num_out,
3033
float conf_thr, float nms_thr, cudaStream_t stream, float* dst);
3134

include/detection.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,22 @@ class Detection : public Model
8181
public:
8282

8383
explicit Detection(const YAML::Node &config);
84-
std::vector<Detections> InferenceImages(std::vector<cv::Mat> &imgBatch) noexcept;
84+
virtual std::vector<Detections> InferenceImages(std::vector<cv::Mat> &imgBatch) = 0;
8585
void Inference(const std::string &input_path, const std::string &save_path, const bool video) override;
86-
virtual void Inference(const std::string &input_path, const std::string &save_path) override;
86+
void Inference(const std::string &input_path, const std::string &save_path) override;
8787
void Visualize(const std::vector<Detections> &detections, std::vector<cv::Mat> &imgBatch,
8888
std::vector<std::string> image_names);
8989
void Visualize(const std::vector<Detections> &detections, std::vector<cv::Mat> &imgBatch,
9090
cv::String save_name, int fps, cv::Size size);
91-
cv::Rect get_rect(cv::Mat& img, float bbox[4]);
92-
static float DIoU(const Box &det_a, const Box &det_b);
9391

9492
protected:
95-
virtual std::vector<Detections> PostProcess(const std::vector<cv::Mat> &vec_Mat, float* output)=0;
96-
void NMS(std::vector<Box> &detections);
93+
virtual std::vector<Detections> PostProcess(const std::vector<cv::Mat> &vec_Mat, float* output);
9794
int num_classes;
9895
float conf_thr;
99-
float nms_thr;
10096
std::string type;
10197
std::vector<std::string> class_labels;
10298
std::vector<cv::Scalar> class_colors;
103-
std::vector<int> strides;
104-
int num_rows = 0;
99+
int num_bboxes = 0;
105100
};
106101

107102
#endif

0 commit comments

Comments
 (0)