kadyb / geomorph_test

0 stars 0 forks source link

Error when loading data #1

Open kadyb opened 2 years ago

kadyb commented 2 years ago

Using these tutorials: https://www.tensorflow.org/tutorials/images/segmentation?hl=en https://www.tensorflow.org/tutorials/load_data/images?hl=en#using_tfdata_for_finer_control

images = ds.map(load_images, num_parallel_calls = tf.data.AUTOTUNE)
#> AttributeError: 'Tensor' object has no attribute 'numpy'

## possible solution
## https://github.com/tensorflow/tensorflow/issues/27519#issuecomment-582619198
## data = fnames.map(lambda x: tf.py_function(process_path, [x], [tf.string]))
kadyb commented 2 years ago

Next error:

images = ds.map(lambda x: tf.py_function(load_images, [x], [tf.string]),
                num_parallel_calls = tf.data.AUTOTUNE)
#> TypeError: Tensors in list passed to 'input' of 'EagerPyFunc' Op have types [<NOT
#> CONVERTIBLE TO TENSOR>] that are invalid. Tensors: [{'ref': <tf.Tensor 'args_0:0' shape=()
#> dtype=string>, 'var': <tf.Tensor 'args_1:0' shape=() dtype=string>}]

## https://github.com/tensorflow/tensorflow/issues/27679
kadyb commented 2 years ago

Sample code from Christian Knoth: https://github.com/DaChro/prepare_data_example/blob/main/prepare_data_example.py