Skip to content

Commit

Permalink
Include bounding box name in warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-wer committed Nov 26, 2024
1 parent 10bc398 commit 177c890
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frontend/javascripts/oxalis/view/jobs/train_ai_model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ function checkAnnotationsForErrorsAndWarnings<T extends HybridTracing | APIAnnot
return {
hasAnnotationErrors: true,
errors: [
`All annotations must have at least one bounding box. Annotations without bounding boxes are: ${annotationIds.join(", ")}`,
`All annotations must have at least one bounding box. Annotations without bounding boxes are:\n${annotationIds.join(", ")}`,
],
};
}
Expand Down Expand Up @@ -483,27 +483,27 @@ function checkBoundingBoxesForErrorsAndWarnings(
);

// Validate minimum size and multiple requirements
type BoundingBoxWithAnnotationId = { boundingBox: Vector6; annotationId: string };
type BoundingBoxWithAnnotationId = { boundingBox: Vector6; name: string; annotationId: string };
const tooSmallBoxes: BoundingBoxWithAnnotationId[] = [];
const nonMultipleBoxes: BoundingBoxWithAnnotationId[] = [];
userBoundingBoxes.forEach(({ boundingBox: box, annotationId }) => {
userBoundingBoxes.forEach(({ boundingBox: box, name, annotationId }) => {
const arrayBox = computeArrayFromBoundingBox(box);
const [_x, _y, _z, width, height, depth] = arrayBox;
if (width < 10 || height < 10 || depth < 10) {
tooSmallBoxes.push({ boundingBox: arrayBox, annotationId });
tooSmallBoxes.push({ boundingBox: arrayBox, name, annotationId });
}

if (
width % minDimensions.x !== 0 ||
height % minDimensions.y !== 0 ||
depth % minDimensions.z !== 0
) {
nonMultipleBoxes.push({ boundingBox: arrayBox, annotationId });
nonMultipleBoxes.push({ boundingBox: arrayBox, name, annotationId });
}
});

const boxWithIdToString = ({ boundingBox, annotationId }: BoundingBoxWithAnnotationId) =>
boundingBox.join(", ") + ` (${annotationId})`;
const boxWithIdToString = ({ boundingBox, name, annotationId }: BoundingBoxWithAnnotationId) =>
`'${name}' of annotation ${annotationId}: ${boundingBox.join(", ")}`;

if (tooSmallBoxes.length > 0) {
hasBBoxWarnings = true;
Expand Down

0 comments on commit 177c890

Please sign in to comment.