amzn / convolutional-handwriting-gan

ScrabbleGAN: Semi-Supervised Varying Length Handwritten Text Generation (CVPR20)
https://www.amazon.science/publications/scrabblegan-semi-supervised-varying-length-handwritten-text-generation
MIT License
264 stars 55 forks source link

How to change resolution of generated image. #12

Closed vijay1131 closed 3 years ago

vijay1131 commented 3 years ago

Hi Thanks for amazing work it really helps our community. I have two question

  1. How to change output image resolution for generated image.
  2. How can i obtain bounding box information of each character generated.

Would be waiting for your kind reply. Thanks a lot !

rlit commented 3 years ago
  1. Not sure I follow - if you train on hi-res images you will generate hi-res images no? (please note we did not test this and some parameters might need to be tweaked)
  2. We intentionally designed this method to not need this annotation in the training data, but there is a simple formula for the generated images receptive field to get the (overlapping) character bbox. I will look for it, @sharonFogel do you remember it?
vijay1131 commented 3 years ago

Thanks a lot! for 1st question i was hoping if there was parser arg i could change to get desired output image resolution. i saw one argument named resolution in base_option.py line 153 parser.add_argument( '--resolution', type=int, default='16', help='size of images generated' '(default: %(default)s)')

for second question. yes character bbox details is what i am looking for. thanks a lot.!!!

vijay1131 commented 3 years ago

@rlit and @sharonFogel

If possible could you give some details on "simple formula for the generated images receptive field to get the (overlapping) character bbox".

rlit commented 3 years ago
  1. receptive field size - we start with 4x4 spatial size per filter/ character. each up sample layer doubles the size
  2. overlap - each 3x3 convolution "leaks" information by one pixel between two adjacent characters. note that this single pixel "leakage" also doubles with each up-sampling layer.

A small experiment: Try to see what is the result of generating, for example, a 7-character word with a single non zero input. (try either the 3rd, 4th, or 5 for example)

vijay1131 commented 3 years ago

Thanks!!