Skip to content

Commit

Permalink
adding dtypes to COCO examples activeloopai#44
Browse files Browse the repository at this point in the history
  • Loading branch information
prithviraj-maurya committed Oct 17, 2020
1 parent 1bcc7d3 commit 9de6e20
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions examples/coco/upload_coco2017.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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]
Expand Down

0 comments on commit 9de6e20

Please sign in to comment.