"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

April 26, 2020

VIA Annotation tool 2.0

I am checking on annotation using VIA annotation tool 2.0 version

#https://github.com/matterport/Mask_RCNN
#http://www.robots.ox.ac.uk/~vgg/software/via/
import json
f = open(r'via_project_train.json')
annotations = json.load(f)
annotations = list(annotations['_via_img_metadata'].values())
annotations = [a for a in annotations if a['regions']]
for a in annotations:
try:
print('Item')
filename = a['filename']
print(filename)
print(a['regions'])
polygons = [r['shape_attributes'] for r in a['regions']]
print(polygons)
except:
pass
view raw parse_via2.py hosted with ❤ by GitHub
The annotated data is generated as a JSON file. To parse through the file and list the files and annotations, Below is a short code snippet

Happy Learning!!!

No comments: