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

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

Closed
biubiaa opened this issue Aug 5, 2019 · 5 comments

Comments

@biubiaa
Copy link

biubiaa commented Aug 5, 2019

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
Copy link

TKassis commented Aug 5, 2019

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
Copy link

TKassis commented Aug 6, 2019

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
Copy link

skylarjhdownes commented Aug 6, 2019

@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
Copy link

TKassis commented Aug 6, 2019

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
Copy link
Owner

taki0112 commented Aug 7, 2019

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

@taki0112 taki0112 closed this as completed Aug 7, 2019
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

4 participants