Category : keras

I’m trying to optimize this function for a tetrahedral color space transform with a ANN. There are 21 parameters that represent the 3 RGB coordinates of the 7 corners of the RGB color space. The tetrahedral transform can align the corners to match one camera color space to another in a piece-wise linear fashion. I’d ..

Read more

I am using keras generator to pass data into the model where the input consists of text embeddings, attention mask and labels. Data Generator class DataGenerator(keras.utils.Sequence): ‘Generates data for Keras’ def __init__(self, list_of_dicts, batch_size=16, sequence=128,dimension = 768, n_classes=40, shuffle=False): ‘Initialization’ self.sequence = sequence self.dimension = dimension self.batch_size = batch_size self.list_IDs = list_of_dicts self.n_classes = n_classes ..

Read more

#!pip install tensorflow-addons import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import tensorflow_addons as tfa My dataset is just a Parent folder with the name ‘dataset’ which has the ‘Test’ folder containing the test set images and ‘training’ folder which has the training images. In addition to ..

Read more

Im trying to train the dataset using keras and tensorflow, the code runs fine till the model summary, after that im getting value error here my code for training the params……. ….. … opt = Adam(lr=INIT_LR, decay=INIT_LR / EPOCHS) model.compile(loss="binary_crossentropy", optimizer=opt,metrics=["accuracy"]) print("[INFO] training network…") history = model.fit_generator( aug.flow(x_train, y_train, batch_size=BS), validation_data=(x_test, y_test), steps_per_epoch=len(x_train) // BS, ..

Read more

I have a Unet model with 4 classes. I calculate some matrices for accuracy as shown below: mae = tf.keras.losses.MeanAbsoluteError() dice_loss_se2 = sm.losses.DiceLoss() metrics = [mae, weighted_hausdorff_distance(image_size, image_size, 0), dice_loss_se2 ] model.compile(optimizer=optim,loss= dice_loss_se2,metrics= metrics) This will obviously give me the accuracy for the average of the 4 classes. But what if I would like to ..

Read more

I am using Keras’s functional API to implement a model with multiple inputs and outputs. I am adapting the code from https://keras.io/examples/generative/text_generation_with_miniature_gpt/ and my training data is in the form of a tf.data.Dataset object. How can I adapt my data to work with a fit function as follows? model.fit( {"pitch_input": x_pitch, "duration_input": x_duration}, {"pitch_output": y_pitch, ..

Read more

I’m trying to use EfficientNetB0 on Keras, and as a result have had to install keras-nightly to pull in the keras-efficientnets module. The Keras model instantiates correctly, finds the training images and sets up the first epoch, but then breaks with this error: File "C:UserspriorAppDataLocalContinuumanaconda3envstensorflow_gpulibsite-packageskerasoptimizer_v2utils.py", line 33, in all_reduce_sum_gradients if tf.__internal__.distribute.strategy_supports_no_merge_call(): AttributeError: module ‘tensorflow.compat.v2.__internal__.distribute’ has ..

Read more