Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S SynthText
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 25
    • Issues 25
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Ankush Gupta
  • SynthText
  • Issues
  • #259
Closed
Open
Issue created Mar 14, 2022 by Choyunhui@uni2237

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

Assignee
Assign to
Time tracking