added new tragets... fixed some issues.
This commit is contained in:
@@ -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,
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user