mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-07 01:22:59 +08:00
Fix bug while the inference result is empty with YOLOv5 (#29)
* Add multi-label function for yolov5 * Update README.md Update doc * Update fastdeploy_runtime.cc fix variable option.trt_max_shape wrong name * Update runtime_option.md Update resnet model dynamic shape setting name from images to x * Fix bug when inference result boxes are empty * Delete detection.py
This commit is contained in:
@@ -202,6 +202,11 @@ bool YOLOv5::Postprocess(
|
|||||||
result->scores.push_back(confidence);
|
result->scores.push_back(confidence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result->boxes.size() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
utils::NMS(result, nms_iou_threshold);
|
utils::NMS(result, nms_iou_threshold);
|
||||||
|
|
||||||
// scale the boxes to the origin image shape
|
// scale the boxes to the origin image shape
|
||||||
|
@@ -68,7 +68,11 @@ void MergeSort(DetectionResult* result, size_t low, size_t high) {
|
|||||||
|
|
||||||
void SortDetectionResult(DetectionResult* result) {
|
void SortDetectionResult(DetectionResult* result) {
|
||||||
size_t low = 0;
|
size_t low = 0;
|
||||||
size_t high = result->scores.size() - 1;
|
size_t high = result->scores.size();
|
||||||
|
if (high == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
high = high - 1;
|
||||||
MergeSort(result, low, high);
|
MergeSort(result, low, high);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user