Changesets · Branches · Tags · Compare
| Changeset | 89282fcfd90e20a604a3b8aad17d25095e6103ea471ba4b28ff143fe601e4796 |
|---|---|
| Author | 張小凡 <2672931+whyb@users.noreply.github.com> · 2024-08-20 08:23 +08:00 |
| Committer | GitHub <noreply@github.com> · 2024-08-20 08:23 +08:00 |
| Parents | 2b70facdfa0c |
1 file changed
modified examples/yolov8.cpp +5 −5
| @@ -175,10 +175,10 @@ | ||
| 175 | 175 | |
| 176 | 176 | for (int i = 0; i < num_anchors; i++) |
| 177 | 177 | { |
| 178 | - auto row_ptr = output.row(i).ptr<float>(); | |
| 179 | - auto bboxes_ptr = row_ptr; | |
| 180 | - auto scores_ptr = row_ptr + 4; | |
| 181 | - auto max_s_ptr = std::max_element(scores_ptr, scores_ptr + num_labels); | |
| 178 | + const float* row_ptr = output.row(i).ptr<float>(); | |
| 179 | + const float* bboxes_ptr = row_ptr; | |
| 180 | + const float* scores_ptr = row_ptr + 4; | |
| 181 | + const float* max_s_ptr = std::max_element(scores_ptr, scores_ptr + num_labels); | |
| 182 | 182 | float score = *max_s_ptr; |
| 183 | 183 | if (score > confidence_threshold) |
| 184 | 184 | { |
| @@ -201,7 +201,7 @@ | ||
| 201 | 201 | object.label = max_s_ptr - scores_ptr; |
| 202 | 202 | object.prob = score; |
| 203 | 203 | object.rect = bbox; |
| 204 | - detections.emplace_back(object); | |
| 204 | + detections.push_back(object); | |
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | objects = detections; |