How to generate gt.mat file for new dataset?
See original GitHub issueHello! I am trying to create a new dataset using a different set of texts/words and was able to generate the image containing the new texts. However, I want to crop the individual texts using the code mentioned here: https://github.com/ankush-me/SynthText/issues/174 but it appears that it needs a “gt.mat” file. I tried to do this by adding a line of code within the visualize_results.py
viz_textbb(rgb, [charBB], wordBB)
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))
gt_file = {"imnames": k, "wordBB": wordBB, "charBB": charBB, "txt": txt} ## added this
then eventually saving gt_file as a gt.mat file using scipy.io. However whenever i use this gt.mat to the code mentioned above to crop word patches, i get an error:
Traceback (most recent call last):
File "crop.py", line 146, in <module>
do_work(opts,synth_dat)
File "crop.py", line 104, in do_work
np.random.shuffle(i_range)
File "mtrand.pyx", line 4529, in numpy.random.mtrand.RandomState.shuffle
File "mtrand.pyx", line 4532, in numpy.random.mtrand.RandomState.shuffle
TypeError: 'range' object does not support item assignment
I feel like the error is coming from my generated gt.mat because of its format. Would just like to ask how to properly create a gt.mat file that can be used as an input to the cropping code?
Thank you very much and thank you btw for this wonderful project. I’ve been learning it for weeks and love it so much!
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (3 by maintainers)
Top GitHub Comments
@ankush-me Thank you very much for these! Really appreciate all the help and esp. this opensource project!
Check the dataset readme file for a description of
gt.mat
.