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),
Tag: tensorflow-datasets
Input 0 is incompatible with layer model_2
i have a generator rev_generator that yields a tuple of two elements (numpyarray of shape (1279,300,1) , int value: 0 or 1) then i pass it to: and then a simple model but when i call fit it throws me an error: Answer If you are using the tf.data.Dataset API, you should set the batch size explicitly and not in
Set random labels for images in tf.data.Dataset
I have a tf data dataset of images with a signature as seen below : All the labels in this dataset are 0. What I would like to do is change each of these labels to a random number from 0 to 3. My code is : This however just assigns 1 to all images as a label. The strange
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
Tensorflow dataset, how to concatenate/repeat data within each batch?
If I have the following dataset: dataset = tf.data.Dataset.from_tensor_slices([1, 2, 3, 4, 5, 6]) When I use a batch_size=2, I would get [[1,2], [3,4], [5,6]]. However, I would like to get the following output: [[1,2,1,2], [3,4,3,4], [5,6,5,6]] Basically, I want to repeat the batch dimension by 2x and use this as a new batch. Obviously, this is a toy example.
TensorFlow: How do I generate a dataset from two arrays?
I’ve been trying to generate a custom dataset from two arrays. One with the shape (128,128,6) (satellite data with 6 channels), and the other with the shape (128,128,1) (binary mask). I have been using the function tf.data.Dataset.from_tensor_slices: What I get is this: However, when I try to run this through my model I get this error: (None, 2) since my
‘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
splitting the data into training and testing in federated learning
I am new in federated learning I am currently experimenting with a model by following the official TFF documentation. But I am stuck with an issue and hope I find some explanation here. I am using my own dataset, the data are distributed in multiple files, each file is a single client (as I am planning to structure the model).
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