diff --git a/samples/balloon/balloon.py b/samples/balloon/balloon.py index 7f4d34d421103643570727f36f3d01c9ee099acb..8b54e90a5fe98479ae594e8d1e526978a6746a2b 100644 --- a/samples/balloon/balloon.py +++ b/samples/balloon/balloon.py @@ -120,7 +120,10 @@ class BalloonDataset(utils.Dataset): # Get the x, y coordinaets of points of the polygons that make up # the outline of each object instance. There are stores in the # shape_attributes (see json format above) - polygons = [r['shape_attributes'] for r in a['regions'].values()] + if type(a['regions']) is dict: + polygons = [r['shape_attributes'] for r in a['regions'].values()] + else: + polygons = [r['shape_attributes'] for r in a['regions']] # load_mask() needs the image size to convert polygons to masks. # Unfortunately, VIA doesn't include it in JSON, so we must read