ZYM-PKU / UDiffText

UDiffText: A Unified Framework for High-quality Text Synthesis in Arbitrary Images via Character-aware Diffusion Models
MIT License
192 stars 16 forks source link

请教一下预训练权重文件 #5

Open yang-chenyu104 opened 8 months ago

yang-chenyu104 commented 8 months ago

在下载的预训练的pretrained文件夹为空,上面解析为stable diffusion模型,我需要去hugging face下载相应模型权重文件是吧,可以告诉一下是stable diffusion哪方面预训练文件,有相关链接吗

ZYM-PKU commented 8 months ago

你好,这里我们使用的是stable diffusion v2.0 的 inpainting 版本。如果需要训练,请把相应的512-inpainting-ema.ckpt放在pretrained文件夹内。如果需要推理,则不需要考虑pretrained文件夹。

yang-chenyu104 commented 8 months ago

谢谢,这个权重文件已经下载,在pretrain.yaml中encoders显示LabelEncoder这个是对标签进行编码,但下载没有看到这个文件

---原始邮件--- 发件人: @.> 发送时间: 2023年12月27日(周三) 上午10:07 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

你好,这里我们使用的是stable diffusion v2.0 的 inpainting 版本。如果需要训练,请把相应的512-inpainting-ema.ckpt放在pretrained文件夹内。如果需要推理,则不需要考虑pretrained文件夹。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

yang-chenyu104 commented 8 months ago

看见了可能是我下载出问题,不好意思,谢谢大佬解答,我想用扩散模型做一个可控文本区域编辑,可以用文本去生成任意的ocr真实数据,在这个基础上加入chinese clip,但不知道加入clip文本引导可以达到什么效果,因为中文需要的数据量更大

---原始邮件--- 发件人: @.> 发送时间: 2023年12月27日(周三) 上午10:07 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

你好,这里我们使用的是stable diffusion v2.0 的 inpainting 版本。如果需要训练,请把相应的512-inpainting-ema.ckpt放在pretrained文件夹内。如果需要推理,则不需要考虑pretrained文件夹。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ZYM-PKU commented 8 months ago

看见了可能是我下载出问题,不好意思,谢谢大佬解答,我想用扩散模型做一个可控文本区域编辑,可以用文本去生成任意的ocr真实数据,在这个基础上加入chinese clip,但不知道加入clip文本引导可以达到什么效果,因为中文需要的数据量更大 ---原始邮件--- 发件人: @.> 发送时间: 2023年12月27日(周三) 上午10:07 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5) 你好,这里我们使用的是stable diffusion v2.0 的 inpainting 版本。如果需要训练,请把相应的512-inpainting-ema.ckpt放在pretrained文件夹内。如果需要推理,则不需要考虑pretrained文件夹。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

是的,中文的文字结构更加复杂,所以理论上比英文难做。我认为这篇工作的核心是用一种字符级别编码的理念来给模型施加更精细的条件控制。对应到中文上,也需要考虑编码器的改良设计,当然这也是我现在正在探索的方向。

yang-chenyu104 commented 8 months ago

我有想法可能需要一个字符级分割器或者得到字符的canny边界再结合合成的字体去结合文本图像编码器,这方面我看到工作有oppo的GlyphDraw,Anytext以及DiffUTE但在他们论文上面生成的字体或多或少会有一点细粒度区别,场景文字生成不仅考虑背景也需要考虑字体,也可以用二个编码器一个学习背景一个学习字体生成再结合起来,但是有很多真实数据在发票上可能会出现形变,我之前采用扩散根据字体二值化图去生成真实数据文字,生成的图片已经很逼真,但没有文本去引导导致只能做图像迁移无法根据语料文本去生成,就形成的图像有限制,只能根据我训练集做一个数据扩充

---原始邮件--- 发件人: @.> 发送时间: 2023年12月27日(周三) 中午11:25 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

看见了可能是我下载出问题,不好意思,谢谢大佬解答,我想用扩散模型做一个可控文本区域编辑,可以用文本去生成任意的ocr真实数据,在这个基础上加入chinese clip,但不知道加入clip文本引导可以达到什么效果,因为中文需要的数据量更大 … ---原始邮件--- 发件人: @.> 发送时间: 2023年12月27日(周三) 上午10:07 收件人: @.>; 抄送: @.@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5) 你好,这里我们使用的是stable diffusion v2.0 的 inpainting 版本。如果需要训练,请把相应的512-inpainting-ema.ckpt放在pretrained文件夹内。如果需要推理,则不需要考虑pretrained文件夹。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

是的,中文的文字结构更加复杂,所以理论上比英文难做。我认为这篇工作的核心是用一种字符级别编码的理念来给模型施加更精细的条件控制。对应到中文上,也需要考虑编码器的改良设计,当然这也是我现在正在探索的方向。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

yang-chenyu104 commented 8 months ago

可以多多和大佬请教

---原始邮件--- 发件人: @.> 发送时间: 2023年12月27日(周三) 中午11:25 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

看见了可能是我下载出问题,不好意思,谢谢大佬解答,我想用扩散模型做一个可控文本区域编辑,可以用文本去生成任意的ocr真实数据,在这个基础上加入chinese clip,但不知道加入clip文本引导可以达到什么效果,因为中文需要的数据量更大 … ---原始邮件--- 发件人: @.> 发送时间: 2023年12月27日(周三) 上午10:07 收件人: @.>; 抄送: @.@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5) 你好,这里我们使用的是stable diffusion v2.0 的 inpainting 版本。如果需要训练,请把相应的512-inpainting-ema.ckpt放在pretrained文件夹内。如果需要推理,则不需要考虑pretrained文件夹。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

是的,中文的文字结构更加复杂,所以理论上比英文难做。我认为这篇工作的核心是用一种字符级别编码的理念来给模型施加更精细的条件控制。对应到中文上,也需要考虑编码器的改良设计,当然这也是我现在正在探索的方向。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

yang-chenyu104 commented 8 months ago

可以请问一下做测试的时候使用icdar13数据集,数据集如何存放在文件夹,显示get_loader一直是dataset没有数据

---原始邮件--- 发件人: @.> 发送时间: 2023年12月27日(周三) 中午11:25 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

看见了可能是我下载出问题,不好意思,谢谢大佬解答,我想用扩散模型做一个可控文本区域编辑,可以用文本去生成任意的ocr真实数据,在这个基础上加入chinese clip,但不知道加入clip文本引导可以达到什么效果,因为中文需要的数据量更大 … ---原始邮件--- 发件人: @.> 发送时间: 2023年12月27日(周三) 上午10:07 收件人: @.>; 抄送: @.@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5) 你好,这里我们使用的是stable diffusion v2.0 的 inpainting 版本。如果需要训练,请把相应的512-inpainting-ema.ckpt放在pretrained文件夹内。如果需要推理,则不需要考虑pretrained文件夹。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

是的,中文的文字结构更加复杂,所以理论上比英文难做。我认为这篇工作的核心是用一种字符级别编码的理念来给模型施加更精细的条件控制。对应到中文上,也需要考虑编码器的改良设计,当然这也是我现在正在探索的方向。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

yang-chenyu104 commented 8 months ago

看代码知道了路径,这样读取数据的方式太巧妙了,谢谢大佬

---原始邮件--- 发件人: @.> 发送时间: 2023年12月27日(周三) 中午11:25 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

看见了可能是我下载出问题,不好意思,谢谢大佬解答,我想用扩散模型做一个可控文本区域编辑,可以用文本去生成任意的ocr真实数据,在这个基础上加入chinese clip,但不知道加入clip文本引导可以达到什么效果,因为中文需要的数据量更大 … ---原始邮件--- 发件人: @.> 发送时间: 2023年12月27日(周三) 上午10:07 收件人: @.>; 抄送: @.@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5) 你好,这里我们使用的是stable diffusion v2.0 的 inpainting 版本。如果需要训练,请把相应的512-inpainting-ema.ckpt放在pretrained文件夹内。如果需要推理,则不需要考虑pretrained文件夹。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

是的,中文的文字结构更加复杂,所以理论上比英文难做。我认为这篇工作的核心是用一种字符级别编码的理念来给模型施加更精细的条件控制。对应到中文上,也需要考虑编码器的改良设计,当然这也是我现在正在探索的方向。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ZYM-PKU commented 8 months ago

readme已更新,加入了数据集文件结构

yang-chenyu104 commented 8 months ago

这样读取数据集就很巧妙,谢谢大佬,我运行demo的时候会出现那种参数对应不上的问题

---原始邮件--- 发件人: @.> 发送时间: 2023年12月28日(周四) 中午1:12 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

readme已更新,加入了数据集文件结构

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

yang-chenyu104 commented 8 months ago

请问训练过程,是要先等pretrain训练完还是pretrain和train同时训练,我测试pretrain训练二个批次但没有pretrain权重保存下来

---原始邮件--- 发件人: @.> 发送时间: 2023年12月28日(周四) 中午1:12 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

readme已更新,加入了数据集文件结构

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

yang-chenyu104 commented 8 months ago

可以加一下您qq或者vx吗?有问题可以请教一下

---原始邮件--- 发件人: @.> 发送时间: 2023年12月28日(周四) 中午1:12 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

readme已更新,加入了数据集文件结构

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

yang-chenyu104 commented 8 months ago

训练的时候由于没有字符集坐标,就讲字符集分割关闭了,将ocr_loss打印一直是1没有变化不知道训练正不正确

---原始邮件--- 发件人: @.> 发送时间: 2023年12月28日(周四) 中午1:12 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

readme已更新,加入了数据集文件结构

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ZYM-PKU commented 8 months ago
  1. 首先进行pretrain再进行正式train,根据./configs/pretrain.yaml 配置文件的设置,默认是5个epoch存储一次encoder模型权重。
  2. ocr_loss 为 1应该是出现了某种错误,但由于没有具体信息我没法判断原因。
yang-chenyu104 commented 8 months ago

那我可以关闭字符编码器那一部分将local loss注释掉就行是吧,不知道可不可以加一下qq

---原始邮件--- 发件人: @.> 发送时间: 2023年12月28日(周四) 晚上8:15 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

首先进行pretrain再进行正式train,根据./configs/pretrain.yaml 配置文件的设置,默认是5个epoch存储一次encoder模型权重。

ocr_loss 为 1应该是出现了某种错误,但由于没有具体信息我没法判断原因。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ZYM-PKU commented 8 months ago

我的邮箱是82540602@qq.com,可以直接通过邮件和我联系。

yang-chenyu104 commented 8 months ago

谢谢大佬

---原始邮件--- 发件人: @.> 发送时间: 2023年12月29日(周五) 中午11:28 收件人: @.>; 抄送: @.**@.>; 主题: Re: [ZYM-PKU/UDiffText] 请教一下预训练权重文件 (Issue #5)

@.***,可以直接通过邮件和我联系。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

lijain commented 3 months ago

能问下现在这个基准生成中文的字效果如何?我看你的在线demo关闭了

ZYM-PKU commented 3 months ago

这个方法没有做中文的实验,无法生成中文字