SynthText
SynthText copied to clipboard
how can I make gt.mat file for my custom data?
I tried to make gt.mat file for my custom data. but it doesn't work . how can I make it?
def main(db_fname):
db = h5py.File(db_fname, 'r')
dsets = sorted(db['data'].keys())
print "total number of images : ", colorize(Color.RED, len(dsets), highlight=True)
gt_file={'imnames':[],'wordBB':[],'charBB': [],'txt':[]}
for k in dsets:
rgb = db['data'][k][...]
charBB = db['data'][k].attrs['charBB']
wordBB = db['data'][k].attrs['wordBB']
txt = db['data'][k].attrs['txt']
viz_textbb(rgb, [charBB], wordBB, index=k, txt=txt)
print "image name : ", colorize(Color.RED, k, bold=True)
print " ** no. of chars : ", colorize(Color.YELLOW, charBB.shape[-1])
print " ** no. of words : ", colorize(Color.YELLOW, wordBB.shape[-1])
print " ** text : ", colorize(Color.GREEN, txt)
# print " ** text : ", colorize(Color.GREEN, txt.encode('utf-8'))
gt_file['imnames'].append(k)
gt_file['wordBB'].append(wordBB)
gt_file['charBB'].append(charBB)
gt_file['txt'].append(txt)
# if 'q' in raw_input("next? ('q' to exit) : "):
# break
savemat("gt.mat",gt_file)
db.close()
if name=='main': main('gen/dset_kr.h5')
Hi, did you figure out how to generate .mat file with gt?
hi, I just initialized the contents of the original gt.mat as mine.
邮件已收到,谢谢。。。I have received your email. Thank you.