I am new to the tf.data API and trying to use it to load images from disk in the Dogs vs. Cats Redux: Kernels Edition Kaggle competition. To do this, I first created a pandas DataFrame named train_df with two columns – file_path containing the relative path of images and target containing the target lab…
Tag: tensorflow
Drop a row in a tensor if the sum of the elements is lower than some threshold
How can I drop rows in a tensor if the sum of the elements in each row is lower than the threshold -1? For example: Since the sum of the last row is smaller than -1, I need to remove it and get the tensor (2, 3): I know how to use tf.reduce_sum, but I do not know how to
Select a column without “losing” a dimension
Suppose I execute the following code The shape of X[:,1] would be [100,]. That is, X[:,1].shape would yield [100,]. If I want to select the second column of X and want the resulting array to have shape [100,1], what should I do? I looked at tf.slice but I’m not sure if it’ helpful. Answer Maybe ju…
How do I install TensorFlow? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I have tried to install TensorFlow using pip install tensorflow but command prompt threw an e…
How to include future values in a time series prediction of a RNN in Keras
I currently have a RNN model for time series predictions. It uses 3 input features “value”, “temperature” and “hour of the day” of the last 96 time steps to predict the next 96 time steps of the feature “value”. Here you can see a schema of it: and here you have…
Why TensorFlow CPU 2.7.0 is not found by docker while creating an image?
I am building a docker image, using this Dockerfile: This is the command I used: And it is giving this error: Why it can’t find tensorflow-cpu==2.7.0, when this TensorFlow version is available. What’s wrong? Here is my requirements.txt: What is not working: Just writing tensorflow in requirements.…
TensorFlow TextVectorization producing Ragged Tensor with no padding after loading it from pickle
I have a TensorFlow TextVectorization layer named “eng_vectorization”: and I saved it in a pickle file, using this code: Then I load that pickle file properly as new_eng_vectorization: Now I am expecting, both previous vectorization eng_vectorization and newly loaded vectorization new_eng_vectoriz…
Tensorflow Lite, Image size is zero error
Actually, my question is very simple. I would like to use my own data in tensorflow lite model. So, i wrote these line of codes: Also, this is the error that I encountered: Answer This happens when the Dataloader cannot infer the labels of your images. The images should be divided into subfolders according to…
Tensorflow Datasets: Crop/Resize images per batch after dataset.batch()
Is it possible to Crop/Resize images per batch ? I’m using Tensorflow dataset API as below: I want, within the batch all the images should have the same size. However across the batches it can have different sizes. For example, 1st batch has all the images of shape (batch_size, 300, 300, 3). Next batch …
Cannot run Carlini and Wagner Attack using foolbox on a tensorflow Model
I am using the latest version of foolbox (3.3.1), and my code simply load a RESNET-50 CNN, adds some layers for a transferred learning application, and loads the weights as follows. Now I would like to attack it using the foolbox 3.3.1 Carlini and Wagner attack, here is the way I load the model for foolbox My…