Unverified Commit 11304cb7 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

only allow 1 image or bounding box instead of 1 or 2 (#6531)

parent d5bd8b72
......@@ -14,7 +14,7 @@ def query_bounding_box(sample: Any) -> features.BoundingBox:
bounding_boxes = {item for item in flat_sample if isinstance(item, features.BoundingBox)}
if not bounding_boxes:
raise TypeError("No bounding box was found in the sample")
elif len(bounding_boxes) > 2:
elif len(bounding_boxes) > 1:
raise ValueError("Found multiple bounding boxes in the sample")
return bounding_boxes.pop()
......@@ -28,7 +28,7 @@ def query_chw(sample: Any) -> Tuple[int, int, int]:
}
if not chws:
raise TypeError("No image was found in the sample")
elif len(chws) > 2:
elif len(chws) > 1:
raise ValueError(f"Found multiple CxHxW dimensions in the sample: {sequence_to_str(sorted(chws))}")
return chws.pop()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment