1
This commit is contained in:
@@ -30,6 +30,25 @@ void main() {
|
||||
expect(result[0].score, greaterThan(0.5));
|
||||
});
|
||||
|
||||
test('bigBox_containsSmallBox_deduped', () {
|
||||
// 同目标一大一小两框:标准 IoU = 0.04/0.13 ≈ 0.31 < 0.45 会漏,
|
||||
// minIoU = inter/小框 = 1 必须去重(2026-09-01 用户实测:单模型也有重叠框)
|
||||
final a = box(0.3, 0.3, 0.5, 0.5, 0.8); // 小框 0.2x0.2
|
||||
final b = box(0.25, 0.25, 0.55, 0.55, 0.6); // 大框 0.3x0.3 套住小框
|
||||
final result = nms([a, b], 0.45);
|
||||
expect(result.length, 1);
|
||||
expect(result[0].score, 0.8);
|
||||
});
|
||||
|
||||
test('partiallyOverlapping_sameTarget_deduped', () {
|
||||
// 标准 IoU = 0.075/0.195 ≈ 0.385 < 0.45 会漏;minIoU = 0.075/0.09 ≈ 0.83
|
||||
final a = box(0.1, 0.1, 0.4, 0.4, 0.9); // 0.3x0.3
|
||||
final b = box(0.15, 0.1, 0.55, 0.4, 0.5); // 0.4x0.3,与 a 重叠 0.25x0.3
|
||||
final result = nms([a, b], 0.45);
|
||||
expect(result.length, 1);
|
||||
expect(result[0].score, 0.9);
|
||||
});
|
||||
|
||||
test('iou_nonOverlapping_isZero', () {
|
||||
final a = box(0.0, 0.0, 0.2, 0.2, 1);
|
||||
final b = box(0.8, 0.8, 1.0, 1.0, 1);
|
||||
|
||||
Reference in New Issue
Block a user