Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
uni2237 opened this issue Mar 14, 2022 · 3 comments
Open

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

uni2237 opened this issue Mar 14, 2022 · 3 comments

Comments

@uni2237
Copy link

uni2237 commented Mar 14, 2022

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

@Lane689
Copy link

Lane689 commented May 11, 2022

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

@uni2237
Copy link
Author

uni2237 commented Sep 21, 2022

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

@92xianshen
Copy link

92xianshen commented Sep 21, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants