I created a tensorflow dataset. It is a mixed dataset and is in the format: <PrefetchDataset shapes: (((None, 224, 224, 3), (None, 12)), (None,)), types: ((tf.float32, tf.int32), tf.int32)> where (None, 224, 224, 3) refers to the batch of images, (None, 12) refers to corresponding metadata of the images(extracted from a csv file) and (None,) refers ..
I’m working on a project on Image Classification. Here I’ve 30 images and when I try to plot those images it gives me this error – InvalidArgumentError: slice index 5 of dimension 0 out of bounds. [Op:StridedSlice] name: strided_slice/ Below is my code: BATCH_SIZE = 5 IMAGE_SIZE = 256 CHANNELS=3 EPOCHS=10 train_ds = tf.keras.utils.image_dataset_from_directory( path_to_data, ..
I am starting out in machine vision, and have tried to download CIFAR-10 direct via python code and keep being stopped by a certificate error. Not being a python expert, am not sure how to work aorund this : I excute the python code : import numpy as np import matplotlib.pyplot as plt from tensorflow.keras.layers ..
I am trying to use: [SparseCategoricalCrossEntropy][https://www.tensorflow.org/api_docs/python/tf/keras/losses/SparseCategoricalCrossentropy] for multiclass classification This will give me the last dimension as the number of classes (N_CLASSES). But I want to retrive the actual class labels from the predictions. Basically if I have 5 classes (N_CLASSES=5), then I have 5 columns, each containing the probability of the class. But I ..
I’m trying to update the weights of frozen graph but i’m unable to do. I am using import_graph_def and feed it a dictionary with updated weights but it is unable to update. I am getting an error node variables/conv1/bias_1′ in input_map does not exist in graph (input_map entry: variables/conv1/bias:0->variables/conv1/bias_1:0). So it seems it is trying ..
I have two arrays: inp_arr and indx_arr. The goal is to create sliding windows of the inp_arr from the indx_arr. In numpy, inp_arr[indx_arr] will create sliding windows of the inp_arr. Following is the MWE. import numpy as np inp_arr = np.random.rand(10, 3) # inp_arr array([[0.85257321, 0.07019212, 0.35636252], [0.32141462, 0.76053685, 0.88999183], [0.75308353, 0.79659116, 0.66134568], [0.32073745, 0.90427132, ..
AttributeError: module ‘keras.api._v1.keras.internal.legacy.layers’ has no attribute ‘l2_regularizer’enter image description here Source: Python-3x..
I would like to free and Reuse the GPU while using Tensorflow. I imagen a workflow like this: Make a TF calculation. Free the GPU Wait a while Step 1. again. This is the code i use right no. Steps 1 to 3 are working step 4 is not: import time import tensorflow as tf ..
I have two features: names and surnames. I zip them to use as multiple inputs for my model. Then I batch the datset. import tensorflow as tf names = tf.data.Dataset.from_tensor_slices(tf.ones(shape=(3,5,5))) surnames = tf.data.Dataset.from_tensor_slices(tf.zeros(shape=(3,5,5))) features = tf.data.Dataset.zip((names,surnames)).batch(3) So the shapes I am getting: <BatchDataset shapes: ((None, 5, 5), (None, 5, 5)), types: (tf.float32, tf.float32)> Then inside ..
**import tensorflow as tf import numpy as np xy = np.loadtxt(‘../data-01-test-score.csv’, delimiter=’,’, dtype=np.float32) x_data = xy[:, 0:-1] y_data = xy[:, [-1]] # Make sure the shape and data are OK print(x_data, "nx_data shape:", x_data.shape) print(y_data, "ny_data shape:", y_data.shape) # data output ”’ [[ 73. 80. 75.] [ 93. 88. 93.] … [ 76. 83. 71.] ..