ankush-me / SynthText

Code for generating synthetic text images as described in "Synthetic Data for Text Localisation in Natural Images", Ankush Gupta, Andrea Vedaldi, Andrew Zisserman, CVPR 2016.
http://www.robots.ox.ac.uk/~vgg/data/scenetext/
Apache License 2.0
2.03k stars 622 forks source link

How to generate small size image with synthtext background? #261

Closed ziyeZzz closed 2 years ago

ziyeZzz commented 2 years ago

Hi, I am trying to generate small size synthtext images, e.g. 64*64 output size.

I do not have any available segmentation images by myself, so I am trying to resize/crop the background data which downloaded from this repo. The org image size is around (500, 500). So I resized the img, seg and depth to (64, 64). But I do not know how to make fake values for labels and area.

If I do not change them, no text is generated. If I fake them to zeros or ones, it does not work either.

I just need to generate 1~5 line words in (64,64) images. I do not need these texts to be generated on a safe area. Rrandom places is ok for my case. Do you have any suggestions?

Thanks a lot.

ankush-me commented 2 years ago

You can try using a constant valued image/matrix for seg and depth images, and set the area and label correspondingly (to scalar values).

You could also extract text regions using the bounding boxes after they have been generated on the original images as provided in this code repo.