Category : keras

My model takes as input 4 arrays and is trained using the standard keras fit function in the following way: model.fit([train[0],train[1],train[2],train[3]], train_labels) These 4 arrays have the same dimension and they are in fact interchangeable. The dictionary ‘train’ is loaded into RAM. To overcome heavy overfitting and improve the performance of the model, I would ..

Read more

I have built a custom keras model and during its forward pass, it uses the output of a function from another library. However, the parameter to this function must be a numpy array. During model.compile() I can set the run_eagerly parameter to True, then I can convert the output from forward pass to numpy by ..

Read more

I am trying to import imdb using keras.dataset from keras.datasets import imdb Although Keras package is successfully installed I am getting the below module error ModuleNotFoundError Traceback (most recent call last) <ipython-input-2-6e3ce26e10f3> in <module>() 1 import numpy —-> 2 from keras.datastets import imdb 3 from matplotlib import pyplot ModuleNotFoundError: No module named ‘keras.datastets’ I am ..

Read more

Hello I am using a custom loss function in google TFT model. https://github.com/google-research/google-research/tree/master/tft def custom_loss(y_actual,y_pred): tupl = np.shape(y_actual) flag = tf.compat.v1.math.is_nan(y_actual) y_actual = y_actual[tf.compat.v1.math.logical_not(flag)] y_pred = y_pred[tf.compat.v1.math.logical_not(flag)] tensordiff = tf.compat.v1.math.reduce_sum(tf.compat.v1.math.square(y_actual-y_pred)) if len(tupl) >= 2: tensordiff /= tupl[0] if len(tupl) >= 3: tensordiff /= tupl[1] if len(tupl) >= 4: tensordiff /= tupl[2] return tensordiff I am ..

Read more

I have used to load images from a directory to python using image_dataset_from_directory. After loading the images I have done required preprocessing and then passed to the model, while I fit the model I am getting an error ‘InvalidArgumentError: Incompatible shapes: [20,1] vs. [20,256,256,3] [[node mean_squared_error/SquaredDifference (defined at <ipython-input-57-d43d80c563d5>:7) ]] [Op:__inference_train_function_13717]’ . why am I ..

Read more

I am making a facial recognition system utilising a live webcam and using a VGG16 model. When i run code below it come up with an error saying "NotImplementedError: When subclassing the Model class, you should implement a call method." I have tried googling to find a solution but i only found this one on ..

Read more