Skip to content
Advertisement

Tag: tensorflow-datasets

Model was constructed with shape (None, 65536) but it was called on an input with incompatible shape (None, 65536, None)

For reference the full error is here: I am using kymatio to classify audio signals. Before constructing the model I use tensorflow’s tf.keras.utils.audio_dataset_from_directory to create the training and testing sets. The audio samples are of shape (65536,) before the sets are created. To create the sets I use the following code: The element_spec of the train_dataset is (TensorSpec(shape=(None, 65536, None),

Behavior of Dataset.map in Tensorflow

I’m trying to take variable length tensors and split them up into tensors of length 4, discarding any extra elements (if the length is not divisible by four). I’ve therefore written the following function: This produces the output [<tf.Tensor: shape=(4,), dtype=int32, numpy=array([1, 2, 3, 4], dtype=int32)>], as expected. If I now run the same function using Dataset.map: I instead get

‘cannot compute Pack as input #1(zero-based) was expected to be a float tensor but is a int32 tensor [Op:Pack] name: packed’. Error with tf.squeeze

I’m trying to display images of a dataset on a plot with their predictions. But I have this error: cannot compute Pack as input #1(zero-based) was expected to be a float tensor but is a int32 tensor [Op:Pack] name: packed This is the code in which I plot: I have the error on second line, on the tf.squeeze function. I

Convert tfrecords to image

I found a training dataset which is a set of tfrecords files,im trying to convert them into images but with no results,is it possible to convert them to images ? Answer To find out what is inside a tf.record use tf.data.TFRecordDataset and tf.train.Example: To parse the records, use tf.data.TFRecordDataset with tf.io.parse_single_example and tf.io.parse_tensor: Also check the source code of Satellite

what does cardinality mean in relation to an image dataset?

After successfully creating a tensorflow image Dataset with: dataset = tf.keras.utils.image_dataset_from_directory(…) which returns Found 21397 files belonging to 5 classes. Using 17118 files for training. There is the cardinality method: dataset.cardinality() which returns a tensor containing the single value tf.Tensor(535, shape=(), dtype=int64) I’ve read the docs here but I don’t understand what 535 represents or why its different to the

Advertisement