fix: lower confidence threshold for small order images
This commit is contained in:
@@ -887,7 +887,12 @@ func (h *Handler) detectYOLO(modelName, imageBase64 string) (*DetectionResult, e
|
|||||||
|
|
||||||
// YOLO11 输出: [1, 5, 8400] 或 [1, 84, 8400]
|
// YOLO11 输出: [1, 5, 8400] 或 [1, 84, 8400]
|
||||||
// 需要转置 + NMS 后处理,坐标从 640x640 缩放到原图尺寸
|
// 需要转置 + 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{
|
result := &DetectionResult{
|
||||||
Detections: make([]Detection, len(detections)),
|
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
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user