From 9de6e20f3fafae2595610c91805b09b891192e47 Mon Sep 17 00:00:00 2001 From: prithviraj-maurya Date: Sat, 17 Oct 2020 15:26:53 +0530 Subject: [PATCH] adding dtypes to COCO examples #44 --- examples/coco/upload_coco2017.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/coco/upload_coco2017.py b/examples/coco/upload_coco2017.py index c5aff4369c..686d6edd65 100644 --- a/examples/coco/upload_coco2017.py +++ b/examples/coco/upload_coco2017.py @@ -25,9 +25,9 @@ def meta(self): "iscrowd": {"shape": (1,), "dtype": "object", "chunksize": 1000}, "image_id": {"shape": (1,), "dtype": "int64"}, "bbox": {"shape": (1,), "dtype": "object", "chunksize": 1000}, - "category_id": {"shape": (1,), "dtype": "object", "chunksize": 1000}, - "id": {"shape": (1,), "dtype": "object", "chunksize": 1000}, - "image": {"shape": (1,), "dtype": "object", "chunksize": 100}, + "category_id": {"shape": (1,), "int64": "object", "chunksize": 1000}, + "id": {"shape": (1,), "dtype": "uint8", "chunksize": 1000}, + "image": {"shape": (1,), "dtype": "uint8", "chunksize": 100}, } def __call__(self, input): @@ -36,21 +36,21 @@ def __call__(self, input): # print(f"Image id: {input['image_id']}") ds["image_id"] = input["image_id"] info = input["info"] - ds["image"] = np.empty(1, object) + ds["image"] = np.empty(1, np.uint8) ds["image"][0] = np.array( Image.open( os.path.join( self._args.dataset_path, get_image_name(self._args, self._tag, input["image_id"]), ) - ) + ), dtype=np.uint8 ) ds["segmentation"] = np.empty(1, object) ds["area"] = np.empty(1, object) ds["iscrowd"] = np.empty(1, object) ds["bbox"] = np.empty(1, object) - ds["category_id"] = np.empty(1, object) - ds["id"] = np.empty(1, object) + ds["category_id"] = np.empty(1, np.uint8) + ds["id"] = np.empty(1, np.uint8) ds["segmentation"][0] = [anno["segmentation"] for anno in info] ds["area"][0] = [anno["area"] for anno in info]