I am checking on annotation using VIA annotation tool 2.0 version
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!!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
Happy Learning!!!
No comments:
Post a Comment