Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions fastdeploy/vision/ultralytics/yolov5.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ bool YOLOv5::Postprocess(
result->scores.push_back(confidence);
}
}

if (result->boxes.size() == 0) {
return true;
}

utils::NMS(result, nms_iou_threshold);

// scale the boxes to the origin image shape
Expand Down
6 changes: 5 additions & 1 deletion fastdeploy/vision/utils/sort_det_res.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ void MergeSort(DetectionResult* result, size_t low, size_t high) {

void SortDetectionResult(DetectionResult* result) {
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);
}

Expand Down