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

cc:184 Key generator/g_d1_bn/beta not found in checkpoint #64

Closed
Henry658 opened this issue Mar 30, 2019 · 4 comments
Closed

cc:184 Key generator/g_d1_bn/beta not found in checkpoint #64

Henry658 opened this issue Mar 30, 2019 · 4 comments

Comments

@Henry658
Copy link

when I run pcgreat/zi2zi
do the instruction
have the error
I am not sure that i am get the train model in my Issues problem #59
I suppose that I am success get the model in the correct model_dir
but have the error info that
cc:184 Key generator/g_d1_bn/beta not found in checkpoint
How should I fixed this problem ?

the following text is my input instruction and the terminal log

Infer

PYTHONPATH=. python infer.py --model_dir=experiments/checkpoint/experiment_0
--batch_size=32
--source_obj=experiments/data/val.obj
--embedding_ids=0
--save_dir=save_dir/

(py36) sjshyu@sjshyu-titan:~/Desktop/360315$ sh test.sh
2019-03-29 14:10:03.478788: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2019-03-29 14:10:03.660390: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties:
name: GeForce GTX TITAN X major: 5 minor: 2 memoryClockRate(GHz): 1.076
pciBusID: 0000:02:00.0
totalMemory: 11.92GiB freeMemory: 11.17GiB
2019-03-29 14:10:03.792179: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 1 with properties:
name: GeForce GTX TITAN X major: 5 minor: 2 memoryClockRate(GHz): 1.076
pciBusID: 0000:81:00.0
totalMemory: 11.92GiB freeMemory: 11.80GiB
2019-03-29 14:10:03.792283: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0, 1
2019-03-29 14:10:04.332448: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-03-29 14:10:04.332508: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929] 0 1
2019-03-29 14:10:04.332519: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0: N N
2019-03-29 14:10:04.332524: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 1: N N
2019-03-29 14:10:04.333112: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10816 MB memory) -> physical GPU (device: 0, name: GeForce GTX TITAN X, pci bus id: 0000:02:00.0, compute capability: 5.2)
2019-03-29 14:10:04.333703: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 11430 MB memory) -> physical GPU (device: 1, name: GeForce GTX TITAN X, pci bus id: 0000:81:00.0, compute capability: 5.2)
unpickled total 946 examples
examples -> 946
2019-03-29 14:10:07.096577: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Not found: Key generator/g_d1_bn/beta not found in checkpoint
Traceback (most recent call last):
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call
return fn(*args)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.NotFoundError: Key generator/g_d1_bn/beta not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
[[Node: save/RestoreV2/_149 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_154_save/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "infer.py", line 67, in
tf.app.run()
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "infer.py", line 47, in main
save_dir=args.save_dir)
File "/home/sjshyu/Desktop/360315/model/unet.py", line 446, in infer
self.load_model(model_dir)
File "/home/sjshyu/Desktop/360315/model/unet.py", line 469, in load_model
self.restore_model(saver, model_dir)
File "/home/sjshyu/Desktop/360315/model/unet.py", line 357, in restore_model
saver.restore(self.sess, ckpt.model_checkpoint_path)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1802, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
run_metadata)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Key generator/g_d1_bn/beta not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
[[Node: save/RestoreV2/_149 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_154_save/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

Caused by op 'save/RestoreV2', defined at:
File "infer.py", line 67, in
tf.app.run()
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "infer.py", line 47, in main
save_dir=args.save_dir)
File "/home/sjshyu/Desktop/360315/model/unet.py", line 446, in infer
self.load_model(model_dir)
File "/home/sjshyu/Desktop/360315/model/unet.py", line 468, in load_model
saver = tf.train.Saver(var_list=self.retrieve_generator_vars())
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1338, in init
self.build()
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1347, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1384, in _build
build_save=build_save, build_restore=build_restore)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 835, in _build_internal
restore_sequentially, reshape)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 472, in _AddRestoreOps
restore_sequentially)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 886, in bulk_restore
return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/gen_io_ops.py", line 1463, in restore_v2
shape_and_slices=shape_and_slices, dtypes=dtypes, name=name)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1718, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

NotFoundError (see above for traceback): Key generator/g_d1_bn/beta not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
[[Node: save/RestoreV2/_149 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_154_save/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

This is my contact information.
mail: henry19980520@gmail.com
I look forward to discussing with you.

@Henry658
Copy link
Author

Henry658 commented Apr 11, 2019

Hey guy I have some update for this issues
I used the tensorflow.python.tools inspect_chpoint to print the tensor in the checkpoint file
as following link

tensor.txt

Really have't the key g_d1_bn/beta
in fact its only esist the g_d3~d_d8
but why the infer.py or unet reload the checkpoint file still need this key
or have some error in my training or save model that leads to I without the key g_d1_bn

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.

@Henry658
Copy link
Author

when I run pcgreat/zi2zi
do the instruction
have the error
I am not sure that i am get the train model in my Issues problem #59
I suppose that I am success get the model in the correct model_dir
but have the error info that
cc:184 Key generator/g_d1_bn/beta not found in checkpoint
How should I fixed this problem ?

the following text is my input instruction and the terminal log

Infer

PYTHONPATH=. python infer.py --model_dir=experiments/checkpoint/experiment_0
--batch_size=32
--source_obj=experiments/data/val.obj
--embedding_ids=0
--save_dir=save_dir/

(py36) sjshyu@sjshyu-titan:~/Desktop/360315$ sh test.sh
2019-03-29 14:10:03.478788: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2019-03-29 14:10:03.660390: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 0 with properties:
name: GeForce GTX TITAN X major: 5 minor: 2 memoryClockRate(GHz): 1.076
pciBusID: 0000:02:00.0
totalMemory: 11.92GiB freeMemory: 11.17GiB
2019-03-29 14:10:03.792179: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1356] Found device 1 with properties:
name: GeForce GTX TITAN X major: 5 minor: 2 memoryClockRate(GHz): 1.076
pciBusID: 0000:81:00.0
totalMemory: 11.92GiB freeMemory: 11.80GiB
2019-03-29 14:10:03.792283: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1435] Adding visible gpu devices: 0, 1
2019-03-29 14:10:04.332448: I tensorflow/core/common_runtime/gpu/gpu_device.cc:923] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-03-29 14:10:04.332508: I tensorflow/core/common_runtime/gpu/gpu_device.cc:929] 0 1
2019-03-29 14:10:04.332519: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 0: N N
2019-03-29 14:10:04.332524: I tensorflow/core/common_runtime/gpu/gpu_device.cc:942] 1: N N
2019-03-29 14:10:04.333112: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10816 MB memory) -> physical GPU (device: 0, name: GeForce GTX TITAN X, pci bus id: 0000:02:00.0, compute capability: 5.2)
2019-03-29 14:10:04.333703: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1053] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 11430 MB memory) -> physical GPU (device: 1, name: GeForce GTX TITAN X, pci bus id: 0000:81:00.0, compute capability: 5.2)
unpickled total 946 examples
examples -> 946
2019-03-29 14:10:07.096577: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Not found: Key generator/g_d1_bn/beta not found in checkpoint
Traceback (most recent call last):
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call
return fn(*args)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.NotFoundError: Key generator/g_d1_bn/beta not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
[[Node: save/RestoreV2/_149 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_154_save/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "infer.py", line 67, in
tf.app.run()
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "infer.py", line 47, in main
save_dir=args.save_dir)
File "/home/sjshyu/Desktop/360315/model/unet.py", line 446, in infer
self.load_model(model_dir)
File "/home/sjshyu/Desktop/360315/model/unet.py", line 469, in load_model
self.restore_model(saver, model_dir)
File "/home/sjshyu/Desktop/360315/model/unet.py", line 357, in restore_model
saver.restore(self.sess, ckpt.model_checkpoint_path)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1802, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
run_metadata)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Key generator/g_d1_bn/beta not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
[[Node: save/RestoreV2/_149 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_154_save/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

Caused by op 'save/RestoreV2', defined at:
File "infer.py", line 67, in
tf.app.run()
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "infer.py", line 47, in main
save_dir=args.save_dir)
File "/home/sjshyu/Desktop/360315/model/unet.py", line 446, in infer
self.load_model(model_dir)
File "/home/sjshyu/Desktop/360315/model/unet.py", line 468, in load_model
saver = tf.train.Saver(var_list=self.retrieve_generator_vars())
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1338, in init
self.build()
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1347, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1384, in _build
build_save=build_save, build_restore=build_restore)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 835, in _build_internal
restore_sequentially, reshape)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 472, in _AddRestoreOps
restore_sequentially)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 886, in bulk_restore
return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/gen_io_ops.py", line 1463, in restore_v2
shape_and_slices=shape_and_slices, dtypes=dtypes, name=name)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/sjshyu/.conda/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1718, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

NotFoundError (see above for traceback): Key generator/g_d1_bn/beta not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
[[Node: save/RestoreV2/_149 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_154_save/RestoreV2", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

This is my contact information.
mail: henry19980520@gmail.com
I look forward to discussing with you.

@jessiimay
Copy link

Hey guy I have some update for this issues
I used the tensorflow.python.tools inspect_chpoint to print the tensor in the checkpoint file
as following link

tensor.txt

Really have't the key g_d1_bn/beta
in fact its only esist the g_d3~d_d8
but why the infer.py or unet reload the checkpoint file still need this key
or have some error in my training or save model that leads to I without the key g_d1_bn

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.

Hi, have you found any way to solve it?
I've ran into this error too, and I wonder if the "Key generator/g_d1/bn/beta" was not trained, or it was just not saved into checkpoint.

If you have any solution, please reply. I really need to get it work.
Thanks!

@Henry658
Copy link
Author

Hi, have you found any way to solve it?
I've ran into this error too, and I wonder if the "Key generator/g_d1/bn/beta" was not trained, or it was just not saved into checkpoint.

If you have any solution, please reply. I really need to get it work.
Thanks!
This is because Unet insert with norm layer when the training but didn't insert when infer.
you can see that train.py parameter inst_norm default is 1.
but infer.py default is 0. and we should replace to 1.

maybe you will encounter others problems:

problem:
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]

because Unet's embedding number ,size aren't match. you should ensure that the parameter of infer.py embedding_num and embedding_dim same with train.py

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

because two document image_size are different should make sure that the tarin.py and infer.py are same

or you can see the original message someone answer me before

这是因为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

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

2 participants