Closed Snarendranath closed 5 years ago
I also encounter error in testing. The testing command is :
python test.py \ --experiment_name my_exp_name \ --test_int 1.0
The error message is as follows:
Traceback (most recent call last): File "test.py", line 69, in <module> te_data = data.Celeba('./data', atts, img_size, 1, part='test', shuffle=False, sess=sess, crop=not use_cropped_img) File "/home/qping/AttGAN-Tensorflow-master/data.py", line 280, in __init__ repeat=repeat) File "/home/qping/AttGAN-Tensorflow-master/data.py", line 70, in disk_image_batch_dataset map_func_, num_threads, shuffle, buffer_size, repeat) File "/home/qping/AttGAN-Tensorflow-master/data.py", line 24, in batch_dataset dataset = dataset.map(map_func, num_parallel_calls=num_threads) File "/home/qping/tensorflow/venv/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 853, in map return ParallelMapDataset(self, map_func, num_parallel_calls) File "/home/qping/tensorflow/venv/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1870, in __init__ super(ParallelMapDataset, self).__init__(input_dataset, map_func) File "/home/qping/tensorflow/venv/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1839, in __init__ self._map_func.add_to_graph(ops.get_default_graph()) File "/home/qping/tensorflow/venv/local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 484, in add_to_graph self._create_definition_if_needed() File "/home/qping/tensorflow/venv/local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 319, in _create_definition_if_needed self._create_definition_if_needed_impl() File "/home/qping/tensorflow/venv/local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 336, in _create_definition_if_needed_impl outputs = self._func(*inputs) File "/home/qping/tensorflow/venv/local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1802, in tf_map_func ret = map_func(*nested_args) File "/home/qping/AttGAN-Tensorflow-master/data.py", line 63, in map_func_ return map_func(*parse_func(*args)) File "/home/qping/AttGAN-Tensorflow-master/data.py", line 248, in _map_func img = tf.image.resize_images(img, [img_size, img_size]) / 127.5 - 1 TypeError: unsupported operand type(s) for /: 'Tensor' and 'float'
I also tried commenting out the from __future__ import division
at the head of test.py, but the error persists.
Thank you for your help!
Also, the training and eval worked perfectly fine for me. Only error in testing.
@ChanningPing Have you modified the code? Such error looks really strange.
@ChanningPing Is your data in './data'? Maybe you could check the type and content of 'img' by print it out in the _map_func.
@Snarendranath Is there any information about the error?