Created
December 11, 2018 03:37
-
-
Save omar-faruk/deff49133c77d4f44e1a099e1e05a85a to your computer and use it in GitHub Desktop.
Indian Dataset downloader
This file contains hidden or 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
| import json | |
| import urllib.request | |
| import cv2 | |
| import os | |
| os.system('mkdir Images') | |
| f=open('Indian_Number_plates.json') | |
| i=0 | |
| data='' | |
| for line in f: | |
| line=json.loads(line) | |
| points=line['annotation'][0]['points'] | |
| H=line['annotation'][0]['imageHeight'] | |
| W=line['annotation'][0]['imageWidth'] | |
| xmin=points[0]['x'] | |
| ymin=points[0]['y'] | |
| xmax=points[1]['x'] | |
| ymax=points[1]['y'] | |
| data+=str("%f,%f,%f,%f,%f,%f"%(H,W,xmin,ymin,xmax,ymax))+'\n' | |
| link=line['content'] | |
| fname='Images/'+str(i)+'.jpg' | |
| urllib.request.urlretrieve(link,fname) | |
| i=i+1 | |
| f.close() | |
| f=open('label.csv','w') | |
| f.write(data) | |
| f.close() | |
| print(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment