Skip to content

Commit

Permalink
improve error message for unaligned training bboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Büßemeyer authored and Michael Büßemeyer committed Jan 15, 2025
1 parent d526816 commit d53eb2a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions frontend/javascripts/oxalis/view/jobs/train_ai_model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ export function TrainAiModelTab<GenericAnnotation extends APIAnnotation | Hybrid
description={warning}
style={{
marginBottom: 12,
whiteSpace: "pre-line",
whiteSpace: "pre-wrap",
}}
type="warning"
showIcon
Expand Down Expand Up @@ -626,12 +626,17 @@ function checkBoundingBoxesForErrorsAndWarnings(

if (notMagAlignedBoundingBoxes.length > 0) {
hasBBoxWarnings = true;
const notMagAlignedBoundingBoxesStrings = notMagAlignedBoundingBoxes.map(
({ boundingBox, name, annotationId, alignedBoundingBox, trainingMag }) =>
`'${name}' of annotation ${annotationId}: ${boundingBox.join(", ")} will be ${alignedBoundingBox.join(", ")} in mag ${trainingMag.join(", ")}`,
);
const warningsPerAnnotation = _.toPairs(_.groupBy(notMagAlignedBoundingBoxes, "annotationId"))
.map(([annotationId, boxes]) => {
let warning = `- Annotation ${annotationId}\n`;
boxes.forEach(({ name, boundingBox, alignedBoundingBox, trainingMag }) => {
warning += ` - ${name}: ${boundingBox.join(", ")} will be ${alignedBoundingBox.join(", ")} in mag ${trainingMag.join(", ")}\n`;
});
return warning;
})
.join("\n");
warnings.push(
`The following bounding boxes are not aligned with the selected magnification. They will be automatically shrunk to be aligned with the magnification:\n${notMagAlignedBoundingBoxesStrings.join("\n")}`,
`The following bounding boxes are not aligned with the selected magnification. They will be automatically shrunk to be aligned with the magnification:\n${warningsPerAnnotation}`,
);
}

Expand Down

0 comments on commit d53eb2a

Please sign in to comment.