Open AkashDataScience opened 10 months ago
This is a known problem. Sometimes, the model goes crazy after sampling certain number of points. Also, the model seems to struggle with producing rare letters and words. It is possible that it is somewhat undertrained or the dataset it was trained on contains some corrupted examples. Perhaps, there is also a bug in data preparation code. In either case, there is no way to flexibly control the output and prevent those failure cases.
You can try different checkpoints or experiment with the bias parameter. Surprisingly, I observed quite a bit more failures with bias=1 than with smaller ones.
As for the word count, there is a hardcoded attribute num_steps set to 1500 on this line: https://github.com/X-rayLaser/pytorch-handwriting-synthesis-toolkit/blob/899e9432dfe0998ba2ef31582d11c2d5f24a5185/handwriting_synthesis/sampling.py#L39
This attribute sets the maximum number of points to generate for a given handwriting. You can try bigger values if this value is not big enough.
I generated images for 50 different strings. 20% of them have half sentences or random strokes. I set bias to 1 and thickness to 10 (default). Is there any limit on word count or other variable effecting output image?