ligoudaner377 / font_translator_gan

88 stars 9 forks source link

Running a simple forward pass #12

Open manhvela opened 2 years ago

manhvela commented 2 years ago

Hello again,

how can I run a simple forward pass for a font?

Thanks in advance

ligoudaner377 commented 2 years ago

Hi @manhvela Currently, the model can only take several png files as style images.

here is a rough script that I used to convert the font file (otf, ttf) to images. https://github.com/ligoudaner377/font_translator_gan/blob/9e1aaf03b3edbacee0023607f60cc4b2a155cc8b/datasets/utils.py#L14 "input_file" is the path of your font file (support most file formats like .otf .ttf) "output_paths": where you want to put your output images "characters": a string containing all characters to output "size": output image size This function hasn't been tested too many times.

The original code doesn't provide a simple forward pass for a single font, but I think test.sh can achieve this by a slight modification. when you have a trained model

  1. basically what you need to do is delete all files in ./datasets/font/test_unknown_style
  2. and replace them with your own font file (png images)
  3. then run bash test.sh
manhvela commented 2 years ago

Great, thanks!