coco-viewer
coco-viewer copied to clipboard
Error when parsing json file
When trying to run the coco-viewer I get error
INFO: Starting...
INFO: Parsing ../SKU110K_fixed/annotations/val.json...
Traceback (most recent call last):
File "cocoviewer.py", line 745, in <module>
main()
File "cocoviewer.py", line 740, in main
Controller(data, root, image_panel, statusbar, menu, objects_panel, sliders)
File "cocoviewer.py", line 477, in __init__
self.update_img()
File "cocoviewer.py", line 511, in update_img
label_size=label_size,
File "cocoviewer.py", line 90, in compose_current_image
self.compose_image(self.current_image, **kwargs)
File "cocoviewer.py", line 78, in compose_image
draw_masks(draw, objects, names_colors, ignore, alpha)
File "cocoviewer.py", line 194, in draw_masks
draw.polygon(m[0], outline=fill, fill=fill)
IndexError: list index out of range
My json file contains only bounding boxes and no masks. Looks like the coco-viewer returns error because there are no polygons defined in json file.
@jabolcni Thank you for your interest in cocoviewer! Yes, the app still sometimes is too much COCO oriented, with lots of hard coded stuff (related to #46 ). I am planning a massive update to fix this, and make it more flexible.
For now, In your case simply comment out these lines:
https://github.com/trsvchn/coco-viewer/blob/82b470ece02b1440c2bc71e20fe7762b715e3629/cocoviewer.py#L76-L78
# Draw masks
# if masks_on:
# draw_masks(draw, objects, names_colors, ignore, alpha)