Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tensor not exist in the checkpoint pcgreat/zi2zi #66

Closed
Henry658 opened this issue Apr 12, 2019 · 9 comments
Closed

tensor not exist in the checkpoint pcgreat/zi2zi #66

Henry658 opened this issue Apr 12, 2019 · 9 comments

Comments

@Henry658
Copy link

Hey guy is me again
Sorry about I'm taking pcgreat/zi2zi at here
Because I can't found the place to let me discuss
As tittle and preamble #64
key generator/g_d1_bn/beta not found in checkpoint
So I use tensorflow.python.tools inspect_checkpoint.py to watch my checkpoint
And I compared the pcgreat/zi2zi model and kaonashi-tyc/zi2zi model with the checkpoint
Screen Shot 2019-04-13 at 2 41 13 AM
left is pcgreat/zi2zi right is kaonashi-tyc/zi2zi
And you can see some tensor is not exist in the pcgreat/zi2zi checkpoint
I was wondering if someone can tell me and fix it

the same as past I and still try to solve this problem
This is my contact information.
mail: henry19980520@gmail.com
I look forward to discussing with you.

@jerrycheese
Copy link

这是因为train.py和infer.py的inst_norm参数不一样导致的。

可以看到train.py的初始化参数inst_norm参数默认为1,而infer.py该参数默认为0,将其改为1即可,差别可见: model/unet.py#L114

除了这个问题以外,也许还会遇到:

InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [80,1,1,64] rhs shape= [185,1,1,128]

因为UNet的embedding数量、大小不一样,对应train.py的embedding_numembedding_dim参数,将其应用到infer.py就行,可见:/train.py#L24

以及这个问题:

ValueError: Cannot feed value of shape (16, 256, 256, 2) for Tensor 'real_A_and_B_images:0', which has shape '(?, 128, 128, 2)'

这是因为两个文件的image_size不一样,根据train.py的参数应用到infer.py就行了,可见:/train.py#L17

@Henry658
Copy link
Author

Henry658 commented Apr 25, 2019

thanks
很感謝你的回覆
接下來還可能有問題要請教您
方便留下信箱向您詢問嗎?
這是我的信箱:henry19980520@gmail.com
謝謝

@Henry658 Henry658 closed this as completed May 7, 2019
@Danee-wawawa
Copy link

这是因为train.py和infer.py的inst_norm参数不一样导致的。

可以看到train.py的初始化参数inst_norm参数默认为1,而infer.py该参数默认为0,将其改为1即可,差别可见: model/unet.py#L114

除了这个问题以外,也许还会遇到:

InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [80,1,1,64] rhs shape= [185,1,1,128]

因为UNet的embedding数量、大小不一样,对应train.py的embedding_numembedding_dim参数,将其应用到infer.py就行,可见:/train.py#L24

以及这个问题:

ValueError: Cannot feed value of shape (16, 256, 256, 2) for Tensor 'real_A_and_B_images:0', which has shape '(?, 128, 128, 2)'

这是因为两个文件的image_size不一样,根据train.py的参数应用到infer.py就行了,可见:/train.py#L17

谢谢你的回答,这些帮助了我很多。另外我在训练模型结束后,进行fine tune时,遇到了一个问题,当我运行:

Train/Finetune the model

PYTHONPATH=. python train.py --experiment_dir=experiments_finetune
--experiment_id=0
--batch_size=16
--lr=0.001
--epoch=10
--sample_steps=1
--schedule=20
--L1_penalty=100
--Lconst_penalty=15
--freeze_encoder_decoder=1
--optimizer=sgd
--fine_tune=67
--flip_labels=1
这个指令时,出现:
filter by label -> {67}
train examples -> 0, val examples ->0
这个信息,它好像把我所有样本都给筛选掉了,我用的是他这个里面的handwriting_preparation/images/test_image.img 和 .box,我不清楚问题在哪里,不知道你有没有遇到过这个问题呢~

@Henry658
Copy link
Author

你必須將你的訓練集放入finetune資料夾中的data
也就是說你原本將訓練集pair圖片打包成train.obj及val.obj並放至於experiment中的data folder中
而你現在要使用finetune也需要將你的train.obj及val.obj放入experiment_finetune中的data folder
看起來就是這樣

@Danee-wawawa
Copy link

你必須將你的訓練集放入finetune資料夾中的data
也就是說你原本將訓練集pair圖片打包成train.obj及val.obj並放至於experiment中的data folder中
而你現在要使用finetune也需要將你的train.obj及val.obj放入experiment_finetune中的data folder
看起來就是這樣

我的experiments_finetune/data/里面有对应的train.obj及val.obj,它完整的运行显示是:
unpickled total 142 examples
unpickled total 14 examples
filter by label -> {67}
train examples -> 0, val examples ->0
所以应该是已经读取到了train.obj和val.obj,但是我不清楚为什么又全部会被filter掉,请问下您没有遇到这个问题吗~

@Henry658
Copy link
Author

你的obj檔中是否有包含embeddiing_id 67
我假設67是你準備得手寫資料,假設你的obj是由experiment所複製過來的
這樣67在當初package時是沒有包含在embedding中的
你需另外package 你的字體及手寫資料

@Danee-wawawa
Copy link

你的obj檔中是否有包含embeddiing_id 67
我假設67是你準備得手寫資料,假設你的obj是由experiment所複製過來的
這樣67在當初package時是沒有包含在embedding中的
你需另外package 你的字體及手寫資料

对的,我明白问题在哪里了,刚刚解决啦,非常感谢^_^

@Henry658
Copy link
Author

好的!
以前我也是這樣受大家的幫忙才能夠理解、除錯。
這是我的信箱:henry19980520@gmail.com
如果有問題也歡迎詢問。

@Danee-wawawa
Copy link

好的!
以前我也是這樣受大家的幫忙才能夠理解、除錯。
這是我的信箱:henry19980520@gmail.com
如果有問題也歡迎詢問。

好的,之后遇到问题我再发邮箱问您,谢谢~^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants