diff --git a/labelme2coco.py b/labelme2coco.py index ab60ecf..3fd3dd1 100644 --- a/labelme2coco.py +++ b/labelme2coco.py @@ -48,9 +48,14 @@ def data_transfer(self): def image(self, data, num): image = {} - img = utils.img_b64_to_arr(data["imageData"]) - height, width = img.shape[:2] - img = None + binhex = data.get("imageData") + if binhex: + img = utils.img_b64_to_arr(binhex) + height, width = img.shape[:2] + img = None + else: + height = data['imageHeight'] + width = data['imageWidth'] image["height"] = height image["width"] = width image["id"] = num