fix: lower confidence threshold for small order images
Build and Deploy / build (push) Successful in 2m42s
Build and Deploy / deploy (push) Successful in 9s

This commit is contained in:
2026-07-17 14:18:48 +00:00
parent 5cb160432a
commit c096e364cd
+7 -2
View File
@@ -887,7 +887,12 @@ func (h *Handler) detectYOLO(modelName, imageBase64 string) (*DetectionResult, e
// YOLO11 输出: [1, 5, 8400] 或 [1, 84, 8400]
// 需要转置 + NMS 后处理,坐标从 640x640 缩放到原图尺寸
detections := postprocessYOLO(output, origW, origH, 0.25, 0.45)
// 对于小图片(order 提示图)使用更低的置信度阈值
confThresh := 0.25
if origW < 200 || origH < 100 {
confThresh = 0.1 // 小图使用更低阈值
}
detections := postprocessYOLO(output, origW, origH, confThresh, 0.45)
result := &DetectionResult{
Detections: make([]Detection, len(detections)),
@@ -900,7 +905,7 @@ func (h *Handler) detectYOLO(modelName, imageBase64 string) (*DetectionResult, e
}
}
fmt.Printf("DEBUG YOLO '%s': detected %d objects, origSize=%dx%d\n", modelName, len(detections), origW, origH)
fmt.Printf("DEBUG YOLO '%s': detected %d objects, origSize=%dx%d, confThresh=%.2f\n", modelName, len(detections), origW, origH, confThresh)
return result, nil
}