added new tragets... fixed some issues.

This commit is contained in:
2025-12-24 11:25:56 +01:00
parent b727e65d14
commit f3dc1e7654
21 changed files with 2408 additions and 1732 deletions
+14 -4
View File
@@ -83,11 +83,21 @@ class YOLODetector {
if (score < confidenceThreshold) continue;
// The model outputs coordinates normalized to [0, 1] relative to the input tensor (inputWidth x inputHeight)
// We need to scale back to the original cropped image coordinates
// The cropped image (cropWidth x cropHeight) was resized to (inputWidth x inputHeight)
final scaledX1 = x1 * croppedResult.cropWidth;
final scaledY1 = y1 * croppedResult.cropHeight;
final scaledX2 = x2 * croppedResult.cropWidth;
final scaledY2 = y2 * croppedResult.cropHeight;
// Add offset to get coordinates in the original image space
results.add(DetectionResult(
x1 * croppedResult.cropWidth + croppedResult.offsetX,
y1 * croppedResult.cropHeight + croppedResult.offsetY,
x2 * croppedResult.cropWidth + croppedResult.offsetX,
y2 * croppedResult.cropHeight + croppedResult.offsetY,
scaledX1 + croppedResult.offsetX,
scaledY1 + croppedResult.offsetY,
scaledX2 + croppedResult.offsetX,
scaledY2 + croppedResult.offsetY,
score,
classId,
));