keras

Which metrics are printed (train or validation) when validation_split and validation_data is not specified in the keras model.fit function?

Which metrics are printed (train or validation) when validation_split and validation_data is not specified in the keras model.fit function? Question: I have a TF neural network and I am using the tf.data API to create the dataset using a generator. I am not passing validation_split and validation_data into the model.fit() function of keras. The default …

Total answers: 1

module 'keras.utils.generic_utils' has no attribute 'get_custom_objects' when importing segmentation_models

module 'keras.utils.generic_utils' has no attribute 'get_custom_objects' when importing segmentation_models Question: I am working on google colab with the segmentation_models library. It worked perfectly the first week using it, but now it seems that I can’t import the library anymore. Here is the error message, when I execute import segmentation_models as sm : ————————————————————————— AttributeError Traceback …

Total answers: 2

Remove last layer from a custom pre-trained model built with Functional API

How to set class weights in keras model for multiclass classification problem? Question: I am building an emotion recogniton model that receives both text and audio features. The dataset that I am using has 3 classes (Neutral, negative and positive). Due to the dataset being higly imbalanced I want to use class weight argument in …

Total answers: 1

Training VGG16 from scratch doesn't improve accuracy in Keras

Training VGG16 from scratch doesn't improve accuracy in Keras Question: I’m trying to train VGG16 models using both transfer learning and training from scratch. I have a dataset with 7k images per category, and 4 different categories. I managed to come up with the transfer learning code no problem, however, the same program but for …

Total answers: 1

Keras LSTM None value output shape

Keras LSTM None value output shape Question: this is my data X_train prepared for LSTM of shape (7000, 2, 200) [[[0.500858 0. 0.5074856 … 1. 0.4911533 0. ] [0.4897923 0. 0.48860878 … 0. 0.49446714 1. ]] [[0.52411383 0. 0.52482396 … 0. 0.48860878 1. ] [0.4899698 0. 0.48819458 … 1. 0.4968341 1. ]] … [[0.6124623 1. …

Total answers: 1

Exchange a pooling layer using conv2d layer in keras

Exchange a pooling layer using conv2d layer in keras Question: I have a neural network in keras with two conv2d layers, an average pooling layer and a dense output layer. I want to put the trained model on an FPGA later on and the architecture does not support MaxPooling or AveragePooling layers. However, I read …

Total answers: 1

Can't add other metrics than accuracy on ViT model

Can't add other metrics than accuracy on ViT model Question: I am a begginer in machine learning and i am trying to train a ViT model to categorical classes with my own dataset. I am following this code: https://keras.io/examples/vision/image_classification_with_vision_transformer/ It’s working fine when I use the accuracy metric, but I want to use recall and …

Total answers: 1

Split tf.data.Dataset into images and labels, but preserving the order

Split tf.data.Dataset into images and labels, but preserving the order Question: I am working on a classical Cats-vs-Dogs machine learning project and have the following problem: I have a tf.data.Dataset containing images and respective labels (0 and 1). I now want to predict the labels with a pretrained model and compare the predicted labels to …

Total answers: 1

Surrogate model for [parameter vector] to [time series]

Surrogate model for [parameter vector] to [time series] Question: Say I have a function F that takes in a parameter vector P (say, a 5-element vector), and produces a (numerical) time series Y[t] of length T (eg T=100, so t=1,…,100). The function could be complicated (eg enzyme reaction models) I want to make a neural …

Total answers: 1

Increased amount of memory usage using Kera's fit() method

Increased amount of memory usage using Kera's fit() method Question: Using TF 2.11.0 with a GPU on Colab. I am getting an increased amount of system memory used per batch when let the fit() method run (This code only checks per epoch). This is a very basic CycleGAN class: import psutil import gc from keras.callbacks …

Total answers: 1