taki0112 / UGATIT

Official Tensorflow implementation of U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization for Image-to-Image Translation (ICLR 2020)
MIT License
6.17k stars 1.04k forks source link

TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string. #10

Closed biubiaa closed 5 years ago

biubiaa commented 5 years ago

i see the error when i trained trainA = trainA.apply(shuffle_and_repeat(self.dataset_num)).apply(map_and_batch(Image_Data_Class.image_processing, self.batch_size, num_parallel_batches=16, drop_remainder=True)).apply(prefetch_to_device(gpu_device, None)) File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1109, in apply dataset = transformation_func(self) File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/contrib/data/python/ops/batching.py", line 828, in _apply_fn num_parallel_calls, drop_remainder) File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/contrib/data/python/ops/batching.py", line 740, in __init__ super(_MapAndBatchDataset, self).__init__(input_dataset, map_func) File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 2198, in __init__ map_func, "Dataset.map()", input_dataset) File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1454, in __init__ self._function.add_to_graph(ops.get_default_graph()) File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 481, in add_to_graph self._create_definition_if_needed() File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 337, in _create_definition_if_needed self._create_definition_if_needed_impl() File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 346, in _create_definition_if_needed_impl self._capture_by_value, self._caller_device) File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 863, in func_graph_from_py_func outputs = func(*func_graph.inputs) File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1392, in tf_data_structured_function_wrapper ret = func(*nested_args) File "/opt/python/UGATIT/utils.py", line 15, in image_processing x = tf.read_file(filename) File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/python/ops/gen_io_ops.py", line 528, in read_file "ReadFile", filename=filename, name=name) File "/home/terry/.local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 533, in _apply_op_helper (prefix, dtypes.as_dtype(input_arg.type).name)) TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string.

the usage was the following:python main.py --dataset mydataset --light true

TKassis commented 5 years ago

Not sure, but why are you using Python 2.7 and not 3? Also is your folder structure correct? i.e. trainA, trainB...etc.

TKassis commented 5 years ago

I started having the same error message now. I'm using Python 3.7. I think it might be related to the number of training samples. I only get it if training samples are more than a certain number (not sure what that is)

skylarjhdownes commented 5 years ago

@Cenyuuuer if you haven't tried it already, make a new directory named dataset alongside the code in the top level of the repo. Then put the folder mydataset inside of that directory.

I was having the same issue (on Python 3.7). The readme doesn't make it super clear that you have to have a directory labeled dataset. Would be nice to be able to provide each filepath manually, don't know yet if that's an option with this code.

TKassis commented 5 years ago

I started having the same error message now. I'm using Python 3.7. I think it might be related to the number of training samples. I only get it if training samples are more than a certain number (not sure what that is)

My bad. I had a spelling mistake in the dataset name.

taki0112 commented 5 years ago

we used a Python 3.6. But this error occurs when the dataset is not loaded properly.