dailenson / SDT

This repository is the official implementation of Disentangling Writer and Character Styles for Handwriting Generation (CVPR23).
MIT License
956 stars 81 forks source link

手写字的图片应该放在什么位置 #46

Open 13232308597 opened 7 months ago

13232308597 commented 7 months ago

G:\python38\python.exe C:\desktop\SDT-master(new)\SDT-master\user_generate.py --pretrained_model C:\desktop\CVPR2023_SDT\saved_weights\Chinese\checkpoint-iter199999.pth load pretrained model from C:\desktop\CVPR2023_SDT\saved_weights\Chinese\checkpoint-iter199999.pth 0%| | 0/106 [00:00<?, ?it/s] Traceback (most recent call last): File "C:\desktop\SDT-master(new)\SDT-master\user_generate.py", line 83, in main(opt) File "C:\desktop\SDT-master(new)\SDT-master\user_generate.py", line 55, in main preds = model.inference(img_list, char_img, 120) File "C:\desktop\SDT-master(new)\SDT-master\models\model.py", line 152, in inference batch_size, num_imgs, in_planes, h, w = style_imgs.shape ValueError: not enough values to unpack (expected 5, got 3) ChatGPT回答:根据错误信息,看起来问题出现在模型的 inference 方法中的 style_imgs.shape。错误信息表明期望的形状是 (batch_size, num_imgs, in_planes, h, w),但实际的形状是 (3,)。 这个问题可能是由于样式图片的数量不足导致的。请确保 style_samples 文件夹中至少有5张样式图片。如果没有足够的样式图片,你可以添加更多的样式图片到该文件夹中。 如果你已经确认样式图片的数量足够,并且问题仍然存在,那么可能需要检查模型的代码,确保在 inference 方法中对 style_imgs 进行正确的处理,以适应不同数量的样式图片。 我是直接在user_generate.py相同的根目录里新建的style_samples文件夹,里面放了86张png格式的图片,是哪里弄错了吗

dailenson commented 7 months ago

把你的运行指令贴出来?

13232308597 commented 7 months ago

把你的运行指令贴出来?

C:\desktop\SDT-master(new)\SDT-master>python user_generate.py --pretrained_model C:\desktop\CVPR2023_SDT\saved_weights\Chinese\checkpoint-iter199999.pth --style_path style_samples load pretrained model from C:\desktop\CVPR2023_SDT\saved_weights\Chinese\checkpoint-iter199999.pth 0%| | 0/106 [00:00<?, ?it/s] Traceback (most recent call last): File "user_generate.py", line 81, in main(opt) File "user_generate.py", line 53, in main preds = model.inference(img_list, char_img, 120) File "C:\desktop\SDT-master(new)\SDT-master\models\model.py", line 152, in inference batch_size, num_imgs, in_planes, h, w = style_imgs.shape ValueError: not enough values to unpack (expected 5, got 3)

dailenson commented 7 months ago

把你的运行指令贴出来?

C:\desktop\SDT-master(new)\SDT-master>python user_generate.py --pretrained_model C:\desktop\CVPR2023_SDT\saved_weights\Chinese\checkpoint-iter199999.pth --style_path style_samples load pretrained model from C:\desktop\CVPR2023_SDT\saved_weights\Chinese\checkpoint-iter199999.pth 0%| | 0/106 [00:00<?, ?it/s] Traceback (most recent call last): File "user_generate.py", line 81, in main(opt) File "user_generate.py", line 53, in main preds = model.inference(img_list, char_img, 120) File "C:\desktop\SDT-master(new)\SDT-master\models\model.py", line 152, in inference batch_size, num_imgs, in_planes, h, w = style_imgs.shape ValueError: not enough values to unpack (expected 5, got 3)

图片格式是png或者jpg嘛?

13232308597 commented 7 months ago

把你的运行指令贴出来?

C:\desktop\SDT-master(new)\SDT-master>python user_generate.py --pretrained_model C:\desktop\CVPR2023_SDT\saved_weights\Chinese\checkpoint-iter199999.pth --style_path style_samples load pretrained model from C:\desktop\CVPR2023_SDT\saved_weights\Chinese\checkpoint-iter199999.pth 0%| | 0/106 [00:00<?, ?it/s] Traceback (most recent call last): File "user_generate.py", line 81, in main(opt) File "user_generate.py", line 53, in main preds = model.inference(img_list, char_img, 120) File "C:\desktop\SDT-master(new)\SDT-master\models\model.py", line 152, in inference batch_size, num_imgs, in_planes, h, w = style_imgs.shape ValueError: not enough values to unpack (expected 5, got 3)

图片格式是png或者jpg嘛?

是png

13232308597 commented 7 months ago

把你的运行指令贴出来?

C:\desktop\SDT-master(new)\SDT-master>python user_generate.py --pretrained_model C:\desktop\CVPR2023_SDT\saved_weights\Chinese\checkpoint-iter199999.pth --style_path style_samples load pretrained model from C:\desktop\CVPR2023_SDT\saved_weights\Chinese\checkpoint-iter199999.pth 0%| | 0/106 [00:00<?, ?it/s] Traceback (most recent call last): File "user_generate.py", line 81, in main(opt) File "user_generate.py", line 53, in main preds = model.inference(img_list, char_img, 120) File "C:\desktop\SDT-master(new)\SDT-master\models\model.py", line 152, in inference batch_size, num_imgs, in_planes, h, w = style_imgs.shape ValueError: not enough values to unpack (expected 5, got 3)

图片格式是png或者jpg嘛?

嗨呀,我文件夹命名少一个“_”,刚加上去,现在开始跑了