pose-gan icon indicating copy to clipboard operation
pose-gan copied to clipboard

About test checkpoints files

Open Gavin-Evans opened this issue 5 years ago • 4 comments

Hi, You can take a dataset as an example to explain in detail how to use checkpoint files. I have encountered some inexplicable problems when using your checkpoints.

such as market run python test.py --generator_checkpoint ../checkpoints/market/generator-warp-maks-nn3-cl12.h5 --warp_skip mask Have encountered the previous error: Traceback (most recent call last): File "test.py", line 152, in <module> test() File "test.py", line 119, in test input_images, target_images, generated_images, names = generate_images(dataset, generator, args.use_input_pose) File "test.py", line 91, in generate_images out = generator.predict(batch) File "/home/hyw/zp/Anaconda2_pytorch_keras/lib/python2.7/site-packages/keras/engine/training.py", line 1169, in predict steps=steps) File "/home/hyw/zp/Anaconda2_pytorch_keras/lib/python2.7/site-packages/keras/engine/training_arrays.py", line 294, in predict_loop batch_outs = f(ins_batch) File "/home/hyw/zp/Anaconda2_pytorch_keras/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 2715, in __call__ return self._call(inputs) File "/home/hyw/zp/Anaconda2_pytorch_keras/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 2671, in _call session) File "/home/hyw/zp/Anaconda2_pytorch_keras/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 2623, in _make_callable callable_fn = session._make_callable_from_options(callable_opts) File "/home/hyw/zp/Anaconda2_pytorch_keras/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1471, in _make_callable_from_options return BaseSession._Callable(self, callable_options) File "/home/hyw/zp/Anaconda2_pytorch_keras/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1425, in __init__ session._session, options_ptr, status) File "/home/hyw/zp/Anaconda2_pytorch_keras/lib/python2.7/site-packages/tensorflow/python/framework/errors_impl.py", line 528, in __exit__ c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: input_1:0 is both fed and fetched. Exception tensorflow.python.framework.errors_impl.InvalidArgumentError: InvalidArgumentError() in <bound method _Callable.__del__ of <tensorflow.python.client.session._Callable object at 0x7f8f7c5fb5d0>> ignored How should I deal with this problem?

Gavin-Evans avatar Aug 12 '19 13:08 Gavin-Evans

See #15

AliaksandrSiarohin avatar Aug 13 '19 11:08 AliaksandrSiarohin

thank you ,it works! However, there is another new problem in the running process.

Computing inception score!!! 0%| | 0/120 [00:00<?, ?it/s] Traceback (most recent call last): File "test.py", line 152, in <module> test() File "test.py", line 125, in test inception_score = get_inception_score(generated_images) File "/home/hyw/zp/keras/pose-gan-master/gan/inception_score.py", line 45, in get_inception_score pred = sess.run(softmax, {'ExpandDims:0': inp}) File "/home/hyw/zp/Anaconda2_pytorch_keras/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/home/hyw/zp/Anaconda2_pytorch_keras/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1128, in _run str(subfeed_t.get_shape()))) ValueError: Cannot feed value of shape (100, 128, 64, 3) for Tensor u'ExpandDims:0', which has shape '(1, ?, ?, 3)' Is there an idea to solve this problem?

Gavin-Evans avatar Aug 15 '19 15:08 Gavin-Evans

Seems like a problem of new tensroflow version. Instead running on concatenated tensor (https://github.com/AliaksandrSiarohin/gan/blob/a4aa9a38792e89480ffbb15dc7e9beba8513e893/inception_score.py#L43) you can run them one by one in a for loop.

pred = [sess.run(softmax, {'ExpandDims:0': inp[i:(i+1)]}) for i in range(inp.shape[0])]
pred = np.array(pred)

AliaksandrSiarohin avatar Aug 15 '19 16:08 AliaksandrSiarohin

It works, thanks a lot

Gavin-Evans avatar Aug 16 '19 01:08 Gavin-Evans