SynthText icon indicating copy to clipboard operation
SynthText copied to clipboard

how can I make gt.mat file for my custom data?

Open uni2237 opened this issue 2 years ago • 3 comments

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')

uni2237 avatar Mar 14 '22 08:03 uni2237

Hi, did you figure out how to generate .mat file with gt?

Lane689 avatar May 11 '22 12:05 Lane689

hi, I just initialized the contents of the original gt.mat as mine.

uni2237 avatar Sep 21 '22 03:09 uni2237

邮件已收到,谢谢。。。I have received your email. Thank you.

92xianshen avatar Sep 21 '22 03:09 92xianshen