From 508094d52e3fc9e582d840be39c55877f6340bef Mon Sep 17 00:00:00 2001 From: "kirill.sizov" Date: Tue, 29 Jun 2021 18:57:48 +0300 Subject: [PATCH 1/2] add test --- .../annotations/panoptic_train.json | 2 +- .../annotations/panoptic_train/a.png | Bin 108 -> 87 bytes tests/test_coco_format.py | 6 ++---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/assets/coco_dataset/coco_panoptic/annotations/panoptic_train.json b/tests/assets/coco_dataset/coco_panoptic/annotations/panoptic_train.json index 4225c3453a..9aa1b35cba 100644 --- a/tests/assets/coco_dataset/coco_panoptic/annotations/panoptic_train.json +++ b/tests/assets/coco_dataset/coco_panoptic/annotations/panoptic_train.json @@ -46,7 +46,7 @@ "file_name":"a.png", "segments_info":[ { - "id":7, + "id":460551, "category_id":1, "area":20.0, "bbox":[ diff --git a/tests/assets/coco_dataset/coco_panoptic/annotations/panoptic_train/a.png b/tests/assets/coco_dataset/coco_panoptic/annotations/panoptic_train/a.png index 4de88c0991198aa5b7408de24e362f3643401176..1692eab8340dfa680b513f954dd38349b715c8bc 100644 GIT binary patch literal 87 zcmeAS@N?(olHy`uVBq!ia0vp^tRT$61SFYwH*Nw_a-J@ZAsn*42NfAXf(pKW>T^W9 h<|r*cp;^>5hfze1A)npl=uDs-gQu&X%Q~loCIF?&6Bz&i literal 108 zcmeAS@N?(olHy`uVBq!ia0vp^AT}!p6OjDO_R1be8GE`ohH%L09^A;wV8Fp_VEpud z@#fHw8;`p~ldej}uMt{(?nlzph|*)?tB Date: Tue, 29 Jun 2021 19:49:25 +0300 Subject: [PATCH 2/2] fix integer overflow --- datumaro/util/mask_tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datumaro/util/mask_tools.py b/datumaro/util/mask_tools.py index bd763dffea..cbe477054f 100644 --- a/datumaro/util/mask_tools.py +++ b/datumaro/util/mask_tools.py @@ -114,8 +114,8 @@ def make_binary_mask(mask): return mask.astype(bool) def bgr2index(img): - if img.dtype.kind not in {'b', 'i', 'u'}: - img = img.astype(np.uint8) + if img.dtype.kind not in {'b', 'i', 'u'} or img.dtype.itemsize < 4: + img = img.astype(np.uint32) return (img[..., 0] << 16) + (img[..., 1] << 8) + img[..., 2] def index2bgr(id_map):