From da3f2cd9b24f6579621f889ee595e84e426e9596 Mon Sep 17 00:00:00 2001 From: dajiaohuang Date: Thu, 8 Oct 2026 01:45:40 +0800 Subject: [PATCH] Handle empty boxes in MMDet COCO converters --- python/deeplake/integrations/mmdet/mmdet_dataset_.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/deeplake/integrations/mmdet/mmdet_dataset_.py b/python/deeplake/integrations/mmdet/mmdet_dataset_.py index eaa4183976..282366c21c 100644 --- a/python/deeplake/integrations/mmdet/mmdet_dataset_.py +++ b/python/deeplake/integrations/mmdet/mmdet_dataset_.py @@ -239,6 +239,8 @@ def pascal_frac_2_coco_pixel(boxes, images): x_bottom = box[:, 2] * shape[1] y_bottom = box[:, 3] * shape[0] bbox = np.stack((x_top, y_top, x_bottom, y_bottom), axis=1) + else: + bbox = np.empty((0, 4), dtype=box.dtype) pascal_pixel_boxes.append(bbox) return pascal_pixel_2_coco_pixel(pascal_pixel_boxes, images) @@ -252,6 +254,8 @@ def yolo_pixel_2_coco_pixel(boxes, images): w = box[:, 2] h = box[:, 3] bbox = np.stack([x_top, y_top, w, h], axis=1) + else: + bbox = np.empty((0, 4), dtype=box.dtype) yolo_boxes.append(bbox) return yolo_boxes