1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| #ifndef CLASS_YOLOV5_H_
| #define CLASS_YOLOV5_H_
| #include "yolo.h"
| class YoloV5 :public Yolo
| {
| public:
| YoloV5(
| const NetworkInfo &network_info_,
| const InferParams &infer_params_);
|
| BBox convert_bbox_res(const float& bx, const float& by, const float& bw, const float& bh,
| const uint32_t& stride_h_, const uint32_t& stride_w_, const uint32_t& netW, const uint32_t& netH)
| {
| BBox b;
| // Restore coordinates to network input resolution
| float x = bx * stride_w_;
| float y = by * stride_h_;
|
| b.x1 = x - bw / 2;
| b.x2 = x + bw / 2;
|
| b.y1 = y - bh / 2;
| b.y2 = y + bh / 2;
|
| b.x1 = clamp(b.x1, 0, netW);
| b.x2 = clamp(b.x2, 0, netW);
| b.y1 = clamp(b.y1, 0, netH);
| b.y2 = clamp(b.y2, 0, netH);
|
| return b;
| }
|
|
| private:
| std::vector<BBoxInfo> decodeTensor(const int imageIdx,
| const int imageH,
| const int imageW,
| const TensorInfo& tensor) override;
| };
|
| #endif
|
|