Git Product home page Git Product logo

zi2zi-pytorch's Issues

Is it possilble to change image size?

Many thanks for your work! I think the font2img.py is better thank the original repo.

Try to use 512512 , can't train. is it possible to change the image size ? as my test , the only one which can be put into training is 256256 .

thanks!

inference请教

您好 我使用自己拼接的图片做的数据集,并没有从ttf中提取,请问infer的时候如何输入一张我的汉字图片,去测试效果呢,谢谢!

--src_font {your model\'s source font file}

推理阶段,希望生成自己手写的汉字,那以下命令中src_font 怎么赋值呢?
python infer.py --experiment_dir experiment
--gpu_ids cuda:0
--batch_size 32
--resume {the saved model you select}
--from_txt
--src_font {your model's source font file}
--src_txt 大威天龙大罗法咒世尊地藏波若诸佛
--label 3

RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR

/pytorch/aten/src/ATen/native/cuda/Indexing.cu:609: indexSelectSmallIndex: block: [0,0,0], thread: [122,0,0] Assertion srcIndex < srcSelectDimSize failed.
/pytorch/aten/src/ATen/native/cuda/Indexing.cu:609: indexSelectSmallIndex: block: [0,0,0], thread: [123,0,0] Assertion srcIndex < srcSelectDimSize failed.
/pytorch/aten/src/ATen/native/cuda/Indexing.cu:609: indexSelectSmallIndex: block: [0,0,0], thread: [124,0,0] Assertion srcIndex < srcSelectDimSize failed.
/pytorch/aten/src/ATen/native/cuda/Indexing.cu:609: indexSelectSmallIndex: block: [0,0,0], thread: [125,0,0] Assertion srcIndex < srcSelectDimSize failed.
/pytorch/aten/src/ATen/native/cuda/Indexing.cu:609: indexSelectSmallIndex: block: [0,0,0], thread: [126,0,0] Assertion srcIndex < srcSelectDimSize failed.
/pytorch/aten/src/ATen/native/cuda/Indexing.cu:609: indexSelectSmallIndex: block: [0,0,0], thread: [127,0,0] Assertion srcIndex < srcSelectDimSize failed.
......
Traceback (most recent call last):
File "infer.py", line 154, in
main()
File "infer.py", line 144, in main
model.sample(batch, infer_dir)
result = self.forward(*input, **kwargs)
File "/home/pytorch/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 399, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/home/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 396, in _conv_forward
self.padding, self.dilation, self.groups)
RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR

开发环境推荐使用导包,这样配置环境比较简单,笔芯

conda env export > environment.yaml // 导出当前环境的包信息

conda env create -f environment.yaml // 用配置文件创建新的虚拟环境

pip freeze > piplist.txt pip freeze > piplist.yaml // 导出pip安装的所有的包

pip install -r piplist.txt // 在新的环境中安装导出的包

RuntimeError

RuntimeError: output with shape [1, 256, 256] doesn't match the broadcast shape [3, 256, 256]

求教下,怎么调整?

AttributeError: 'NoneType' object has no attribute 'tobytes'

python font2img.py --src_font='source.ttf'
--dst_font='cao.ttf'
--charset=CN
--sample_count=1000
--sample_dir='images'
--label=0
--filter
--shuffle
--mode=font2font
在使用如上命令的时候,应该是font2img.py文件里的这句:
img = draw_single_char(c, font, canvas_size, x_offset, y_offset)
出错了,求解决方法

训练报错

unpickled total 0 examples
unpickled total 8517 examples
Traceback (most recent call last):
File "train.py", line 128, in
main()
File "train.py", line 102, in main
for bid, batch in enumerate(dataloader):
File "D:\PaddleGAN-venv\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next
data = self._next_data()
File "D:\PaddleGAN-venv\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "D:\PaddleGAN-venv\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\PaddleGAN-venv\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\code\zi2zi-pytorch-master\data\dataset.py", line 35, in getitem
img_A, img_B = self.process(item[1])
File "D:\code\zi2zi-pytorch-master\data\dataset.py", line 102, in process
img_A = self.transform(img_A)
File "D:\PaddleGAN-venv\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "D:\PaddleGAN-venv\lib\site-packages\torchvision\transforms\transforms.py", line 226, in forward

return F.normalize(tensor, self.mean, self.std, self.inplace)

File "D:\PaddleGAN-venv\lib\site-packages\torchvision\transforms\functional.py", line 351, in normali
ze
tensor.sub_(mean).div_(std)
RuntimeError: output with shape [1, 256, 256] doesn't match the broadcast shape [3, 256, 256]

求教下,怎么调整?

about package.py

package.py与raw_package.py有什么区别

package.py中的parser.add_argument('--dst_json', type=str, default=None) 的dst_json文件,指的是项目下哪个文件呢

Where to get the original handwriting caligraphy dataset

How can I get a copy of the handwriting dataset as shown in the pre-trained data?

Also, may I ask about the training details? How long does it take to get the performance similar to the pre-trained model? And what is the specs? Thanks a lot.

error with font2img.py

Hello, I follow your steps to resume the work. But I can not generate imgs. Can you help me?
image

对比实验

谢谢您出色的工作,我需要和zi2zi做对比实验,数据集为28种字体,大小为80*80,我在上采样加了一层转置卷积使得程序能够运行起来,卷积层组为6组(之前为8组),但是infer阶段加载模型时加载鉴别器出现了错误,只加载生成器没有错误,错误如下:
RuntimeError: Error(s) in loading state_dict for Discriminator:
size mismatch for binary.weight: copying a param with shape torch.Size([1, 100]) from checkpoint, the shape in current model is torch.Size([1, 1024]).
size mismatch for catagory.weight: copying a param with shape torch.Size([40, 100]) from checkpoint, the shape in current model is torch.Size([40, 1024]).

关于生成结果

您好,我尝试您给的模型生成,但是结果似乎都是毛笔风格,如果我给的是瘦体/或者是钢笔风格的话,生成很奇怪。 并且请问可以一次输入几个文字一起生成吗?

AttributeError: 'NoneType' object has no attribute 'tobytes'

按照视频教程一步一步来,软件版本都降级了,但还是出现错误,请大佬解惑!
Traceback (most recent call last):
File "font2img.py", line 340, in
args.sample_count, args.sample_dir, args.label, args.filter)
File "font2img.py", line 143, in font2font
filter_hashes = set(filter_recurring_hash(charset, dst_font, canvas_size, x_offset, y_offset))
File "font2img.py", line 131, in filter_recurring_hash
hash_count[hash(img.tobytes())] += 1
AttributeError: 'NoneType' object has no attribute 'tobytes'

文件无法下载

我尝试下载下来解压不了,显示文件出错了,其他的解压工具显示zip为空,不知道您能否给我发一份代码,我的邮箱是[email protected],万分感谢

infer.py的问题

更改infer.py中的parser.add_argument('--input_nc', type=int, default=3)后在generator.py中报如下错误:
RuntimeError: Given groups=1, weight of size [64, 3, 4, 4], expected input[13, 1, 256, 256] to have 3 channels, but got 1 channels instead

为得到字体图片,运行命令python font2img.py --src_font=src.ttf 时报错font2img.py: error: the following arguments are required: --mode 请问这个问题该如何解决呢?

(pytorch) miao@miao:~/data/file/bwt/zi2zi-pytorch-master$ python font2img.py --src_font=src.ttf
usage: font2img.py [-h] --mode {imgs2imgs,font2imgs,font2font,fonts2imgs}
[--src_font SRC_FONT] [--src_fonts_dir SRC_FONTS_DIR]
[--src_imgs SRC_IMGS] [--dst_font DST_FONT]
[--dst_imgs DST_IMGS] [--filter] [--charset CHARSET]
[--shuffle] [--char_size CHAR_SIZE]
[--canvas_size CANVAS_SIZE] [--x_offset X_OFFSET]
[--y_offset Y_OFFSET] [--sample_count SAMPLE_COUNT]
[--sample_dir SAMPLE_DIR] [--label LABEL]
font2img.py: error: the following arguments are required: --mode

font2imgs img2img

请问
font2imgs 的src_font dst_imgs sample_dir

Imgs2Imgs的 src_imgs sample_dir

分别都是什么样的数据
font2font都运行完成了 a-b a-c的

zi2zi的论文

zi2zi: Master Chinese Calligraphy with Conditional Adversarial Networks
请问这篇paper有人搜得到么。?或者源作者说的博客,怎么都进不去

Pre-trained model

请问预训练模型的源字体和目标字体分别是什么呢?

package的问题

不管split_ratio为多少,train.obj都是一个空文件。。。

about bug during training process

您好,非常感谢您分享这个伟大项目,我在执行train.py时,遇到下面bug了,可以告知怎么解决吗?
unpickled total 13553 examples
Traceback (most recent call last):
File "train.py", line 126, in
main()
File "train.py", line 100, in main
for bid, batch in enumerate(dataloader):
File "/usr/python3.8/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 363, in next
data = self._next_data()
File "/usr/python3.8/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 403, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/usr/python3.8/lib/python3.8/site-packages/torch/utils/data/utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/python3.8/lib/python3.8/site-packages/torch/utils/data/utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/source/code/panxy/src/FontGeneration/zi2zi/data/dataset.py", line 35, in getitem
img_A, img_B = self.process(item[1])
File "/source/code/panxy/src/FontGeneration/zi2zi/data/dataset.py", line 102, in process
img_A = self.transform(img_A)
File "/usr/python3.8/lib/python3.8/site-packages/torchvision/transforms/transforms.py", line 212, in call
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/usr/python3.8/lib/python3.8/site-packages/torchvision/transforms/functional.py", line 298, in normalize
tensor.sub
(mean).div
(std)
RuntimeError: output with shape [1, 256, 256] doesn't match the broadcast shape [3, 256, 256]

在第三部训练时出现AssertionError

Traceback (most recent call last):
File "train.py", line 128, in
main()
File "train.py", line 79, in main
model.setup()
File "F:\zi2zi-pytorch-master\model\model.py", line 59, in setup
init_net(self.netG, gpu_ids=self.gpu_ids)
File "F:\zi2zi-pytorch-master\utils\init_net.py", line 15, in init_net
assert(torch.cuda.is_available())
AssertionError

dst_json

Traceback (most recent call last):
File "package.py", line 76, in
with open(dst_json, 'r', encoding='utf-8') as fp:
TypeError: expected str, bytes or os.PathLike object, not NoneType

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.