yizhiwang96 / deepvecfont-v2

[CVPR 2023] DeepVecFont-v2: Exploiting Transformers to Synthesize Vector Fonts with Higher Quality
MIT License
68 stars 8 forks source link

训练与测试时,max_seq_len参数必须一致吗? #5

Closed XieJinYan1127 closed 1 year ago

XieJinYan1127 commented 1 year ago

背景:  我想使用训练完成的模型直接进行生成测试。

现象:  测试时使用了与训练不一样的参数,导致网络结构不一致,无法导入训练完成后的权重文件。  因为我测试input的字体是手写字体,所以在预处理时,max_seq_len必须进行修改为较大值,使用默认的51将会提示非有效字形的错误。  在测试时,也使用较大的max_seq_len,但是会提示权重导入失败,网络结构与权重文件的结构不一致。

问题:  1.如果想要使用新的max_seq_len参数,是否需要使用新参数从头开始训练。作者的模型将无法使用?  2.类似的代码在deepvecfont中也有,但不存在这个问题。这是为什么?

XieJinYan1127 commented 1 year ago

@yizhiwang96 Sorry, do I need to use English when submitting an issue?

yizhiwang96 commented 1 year ago

The reason is V1 uses RNN but V2 uses Transformer:

XieJinYan1127 commented 1 year ago

@yizhiwang96 Thanks for the answer.

I used some fonts from Windows 10 to test V2 and V1. If it's just English, V2 doesn't get better than V1. What is your conclusion on this? Is it better to use V1 if I only need English?

yizhiwang96 commented 1 year ago

V2 enables modeling long sequence (for example > 50, up to 1000), while V1 (RNN-based) cannot. So V2 is better for Chinese fonts. In terms of whose quality is better, I think you can try both and find the best one.