Skip to content

Commit

Permalink
fixing to_tensorflow method to take any shape activeloopai#44 activel…
Browse files Browse the repository at this point in the history
  • Loading branch information
prithviraj-maurya committed Oct 24, 2020
1 parent 9de6e20 commit 8dd2222
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions examples/coco/upload_coco2017.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ def __init__(self, args, tag):

def meta(self):
return {
"segmentation": {"shape": (1,), "dtype": "object", "chunksize": 1000},
"area": {"shape": (1,), "dtype": "object", "chunksize": 1000},
"iscrowd": {"shape": (1,), "dtype": "object", "chunksize": 1000},
"segmentation": {"shape": (1,), "dtype": "uint32", "chunksize": 1000},
"area": {"shape": (1,), "dtype": "uint32", "chunksize": 1000},
"iscrowd": {"shape": (1,), "dtype": "uint8", "chunksize": 1000},
"image_id": {"shape": (1,), "dtype": "int64"},
"bbox": {"shape": (1,), "dtype": "object", "chunksize": 1000},
"category_id": {"shape": (1,), "int64": "object", "chunksize": 1000},
"id": {"shape": (1,), "dtype": "uint8", "chunksize": 1000},
"image": {"shape": (1,), "dtype": "uint8", "chunksize": 100},
"bbox": {"shape": (1,), "dtype": "uint16", "chunksize": 1000},
"category_id": {"shape": (1,), "dtype": "int64", "chunksize": 1000},
"id": {"shape": (1,), "dtype": "uint32", "chunksize": 1000},
"image": {"shape": (1,), "dtype": "uint32", "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, np.uint8)
ds["image"] = np.empty(1, np.uint32)
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
), dtype=np.uint32
)
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["segmentation"] = np.empty(1, np.uint32)
ds["area"] = np.empty(1, np.uint32)
ds["iscrowd"] = np.empty(1, np.uint8)
ds["bbox"] = np.empty(1, np.np.uint16)
ds["category_id"] = np.empty(1, np.uint8)
ds["id"] = np.empty(1, np.uint8)
ds["id"] = np.empty(1, np.uint32)

ds["segmentation"][0] = [anno["segmentation"] for anno in info]
ds["area"][0] = [anno["area"] for anno in info]
Expand Down

0 comments on commit 8dd2222

Please sign in to comment.