sczhou / CodeFormer

[NeurIPS 2022] Towards Robust Blind Face Restoration with Codebook Lookup Transformer
Other
15.57k stars 3.29k forks source link

Issues while loading the stage2 model #286

Open DannyXYZa opened 1 year ago

DannyXYZa commented 1 year ago

First thank you for releasing all the codes and models! I have been attempting to load the stage2 model provided here. However, It seems that the keys do not correspond correctly. Could you kindly assist me on this? Thank you very much!

image

wizaaaard commented 1 year ago

Hi, I met this same issue, too. May I ask you if you have solved this issue? Glad to get your response!

wizaaaard commented 1 year ago

First thank you for releasing all the codes and models! I have been attempting to load the stage2 model provided here. However, It seems that the keys do not correspond correctly. Could you kindly assist me on this? Thank you very much!

image

Hi, I met this same issue, too. May I ask you if you have solved this issue? Glad to get your response!

JaywongWang commented 1 year ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

wizaaaard commented 1 year ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

JaywongWang commented 1 year ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

zhf12339 commented 1 year ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

你在stage2的配置文件中有将strict_load_g设置为false吗?

24wenjie-li commented 1 year ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

zhf12339 commented 1 year ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

作者release中有discriminator权重文件,你找到加载即可

JaywongWang commented 1 year ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

@24wenjie-li 第二阶段应该是没有discriminator的(从论文信息和代码信息来看),我觉得应该是笔误,实际上用的应该是第一阶段的discriminator。

zhf12339 commented 1 year ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

@24wenjie-li 第二阶段应该是没有discriminator的(从论文信息和代码信息来看),我觉得应该是笔误,实际上用的应该是第一阶段的discriminator。 是的,第二阶段只训练到了transformer输出只有字典loss,第三阶段它使用了对抗loss,所以使用的是第一阶段训练结果的鉴别器

24wenjie-li commented 1 year ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

@24wenjie-li 第二阶段应该是没有discriminator的(从论文信息和代码信息来看),我觉得应该是笔误,实际上用的应该是第一阶段的discriminator。

万分感谢!

24wenjie-li commented 1 year ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

@24wenjie-li 第二阶段应该是没有discriminator的(从论文信息和代码信息来看),我觉得应该是笔误,实际上用的应该是第一阶段的discriminator。 是的,第二阶段只训练到了transformer输出只有字典loss,第三阶段它使用了对抗loss,所以使用的是第一阶段训练结果的鉴别器

万分感谢!

24wenjie-li commented 12 months ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

作者release中有discriminator权重文件,你找到加载即可

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

@24wenjie-li 第二阶段应该是没有discriminator的(从论文信息和代码信息来看),我觉得应该是笔误,实际上用的应该是第一阶段的discriminator。 是的,第二阶段只训练到了transformer输出只有字典loss,第三阶段它使用了对抗loss,所以使用的是第一阶段训练结果的鉴别器

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

作者release中有discriminator权重文件,你找到加载即可

您好,请问您重新训练并推理了codeformer吗?如下图所示,您有出现推理得到的人脸嘴部颜色异常的情况吗? 000_Adele_00 如果可以的话,您能分享您的CodeFormer_stage2.yml和CodeFormer_stage3.yml的配置吗?

zhf12339 commented 12 months ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

作者release中有discriminator权重文件,你找到加载即可

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

@24wenjie-li 第二阶段应该是没有discriminator的(从论文信息和代码信息来看),我觉得应该是笔误,实际上用的应该是第一阶段的discriminator。 是的,第二阶段只训练到了transformer输出只有字典loss,第三阶段它使用了对抗loss,所以使用的是第一阶段训练结果的鉴别器

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

作者release中有discriminator权重文件,你找到加载即可

您好,请问您重新训练并推理了codeformer吗?如下图所示,您有出现推理得到的人脸嘴部颜色异常的情况吗? 000_Adele_00 如果可以的话,您能分享您的CodeFormer_stage2.yml和CodeFormer_stage3.yml的配置吗? 我目前只对在实验中对第二阶段的配置进行了复现,但是未达到release中提到的性能,请问你达到了吗?如果可以的话可以提供一下你的stage2的配置文件吗?如果后续还需要交流,欢迎通过我主页QQ加我交流

JaywongWang commented 12 months ago

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

作者release中有discriminator权重文件,你找到加载即可

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

@24wenjie-li 第二阶段应该是没有discriminator的(从论文信息和代码信息来看),我觉得应该是笔误,实际上用的应该是第一阶段的discriminator。 是的,第二阶段只训练到了transformer输出只有字典loss,第三阶段它使用了对抗loss,所以使用的是第一阶段训练结果的鉴别器

I think the provided codes for loading weights are designed for stage-3 model. And the stage-3 model has different structures from stage-2 model (stage-3 adds some convolutions to balance the encoder and the decoder).

所以也就是说作者提供的那个Codeformer_stage2.pth其实没法在训练第三阶段之前加载吗,如果想训练第三阶段要怎么办呢?

好像不是我说的问题,我回答得有误。我验证过,自己训练出来的stage-2模型,是可以用推理代码正常加载推理的。我估计可能作者提供的那个stage-2预训练模型,对应的模型定义可能与目前的代码不一致。

你好,请教你一个问题。根据作者的CodeFormer_stage3.yml,需要加载pretrain_network_g和pretrain_network_d,但我发现在stage2的训练过程中只保存了pretrain_network_g,并没有保存pretrain_network_d。请问你在训练stage3时加载了pretrain_network_d吗?是否将pretrain_network_d这行注释即可?盼望回复,万分感谢!

作者release中有discriminator权重文件,你找到加载即可

您好,请问您重新训练并推理了codeformer吗?如下图所示,您有出现推理得到的人脸嘴部颜色异常的情况吗? 000_Adele_00 如果可以的话,您能分享您的CodeFormer_stage2.yml和CodeFormer_stage3.yml的配置吗? 我目前只对在实验中对第二阶段的配置进行了复现,但是未达到release中提到的性能,请问你达到了吗?如果可以的话可以提供一下你的stage2的配置文件吗?如果后续还需要交流,欢迎通过我主页QQ加我交流

CodeFormer_stage2.txt @zhf12339 可以基本复现stage2效果。配置文件供参考,修改后缀为.yml。

lionelmessi6410 commented 8 months ago

@24wenjie-li 您好,想詢問這個嘴部異色的問題,後來有解決的辦法嗎?我在stage-3 training也有遇到這個問題,另外我還有碰到當w=1時,生成的圖像會比w=0還要模糊的問題,不知道作者的實驗結果有辦法完全復現嗎

24wenjie-li commented 7 months ago

我当时出现这个问题,是因为我在256x256图像上复现,batchsize不够大的问题,我加大batchsize后会改善嘴部着色问题。你可以检查下你的batchsize,你是不是用分布式训练,训练总的batchsize应该是32。因为算力原因,我没有复现512x512的。但在256上结果不佳。

Chia-Hung Yuan @.***> 于2024年2月16日周五 14:42写道:

@24wenjie-li https://github.com/24wenjie-li 您好,想詢問這個嘴部異色的問題,後來有解決的辦法嗎?我在stage-3 training也有遇到這個問題,另外我還有碰到當w=1時,生成的圖像會比 w=0還要模糊的問題,不知道作者的實驗結果有辦法完全復現嗎

— Reply to this email directly, view it on GitHub https://github.com/sczhou/CodeFormer/issues/286#issuecomment-1947839282, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATEXBSR7QKPRYMRKLHZK6PDYT35UFAVCNFSM6AAAAAA3HS75COVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBXHAZTSMRYGI . You are receiving this because you were mentioned.Message ID: @.***>

lionelmessi6410 commented 7 months ago

@24wenjie-li 了解,那我再嘗試看看,目前我也是用比較小的batch size,感謝建議!