keras

TypeError: 'numpy.float64' object is not iterable in calculation

TypeError: 'numpy.float64' object is not iterable in calculation Question: my code is start when I do my generators, as : train_data_dir= "/Users/awabe/Desktop/Project/PapilaDB/ExpertsSegmentations/ImagesWithContours train" train_datagen = ImageDataGenerator(rescale=1./255, shear_range=0.2, zoom_range=0.2, horizontal_flip=True, validation_split=0.2) # set validation split train_generator = train_datagen.flow_from_directory( train_data_dir, target_size=(2576, 2000), batch_size=24, class_mode=’binary’, subset=’training’) # set as training data validation_generator = train_datagen.flow_from_directory( train_data_dir, # same directory …

Total answers: 1

Add zero vector row per group in pandas

Add zero vector row per group in pandas Question: I want to create equal sized numpy (padded) array from pandas, ultimately to be given as input to keras model import pandas as pd df = pd.DataFrame([[1, 1.2, 2.2], [1, 3.2, 4.6], [2, 5.5, 6.6]], columns = [‘id’, ‘X1’, ‘X2’] ) df >> id X1 X2 …

Total answers: 1

What is the input dimension for a LSTM in Keras?

What is the input dimension for a LSTM in Keras? Question: I’m trying to use deeplearning with LSTM in keras . I use a number of signal as input (nb_sig) that may vary during the training with a fixed number of samples (nb_sample) I would like to make parameter identification, so my output layer is …

Total answers: 3

Tensorflow 2.11 error: AttributeError: module 'tensorflow._api.v2.compat.v2.__internal__' has no attribute 'register_load_context_function'

Tensorflow 2.11 error: AttributeError: module 'tensorflow._api.v2.compat.v2.__internal__' has no attribute 'register_load_context_function' Question: I had to update Tensorflow to the currently latest version 2.11. when importing i get "AttributeError: module ‘tensorflow._api.v2.compat.v2.internal‘ has no attribute ‘register_load_context_function’". I have also completely reinstalled a full anaconda environment and downgraded Python to the version compatible with the latest of Tensorflow and …

Total answers: 2

Image classification Using CNN

Image classification Using CNN Question: I am working on breast cancer classification. I found this online code to train my pre-processed outputs on it. The results was awful but I didn’t understand the code, I want to train my own model but I don’t how to replace my own code with this one. Any help …

Total answers: 2

FileNotFoundError: [Errno 2] No such file or directory for Image Dataset one-hot encoded

FileNotFoundError: [Errno 2] No such file or directory for Image Dataset one-hot encoded Question: I tried to one-hot encoded using to_categorical() in my image dataset but I failed because of FileNotFoundError: [Errno 2] No such file or directory error and the code is given below, import os import numpy as np from PIL import Image …

Total answers: 1

Keras SimpleRNNCell appears to fail to distribute learning among all its weights

Keras SimpleRNNCell appears to fail to distribute learning among all its weights Question: This question is about SimpleRNNCell, a class in Tensorflow to perform basic Recurrent Neural Network. Unless there’s something fundamentally wrong in my code, it appears that training is not spread over all the available weights but only a subset of them, making …

Total answers: 1

Multi Label Classification – Incorrect training hyperparameters?

Multi Label Classification – Incorrect training hyperparameters? Question: I am working on a multi-label image classification problem, using TensorFlow, Keras and Python 3.9. I have built a dataset containing one .csv file with image names and their respective one-hot encoded labels, like so: I also have an image folder with the associated image files. There …

Total answers: 1

y should be a 1d array, got an array of shape {} instead.".format(shape)

y should be a 1d array, got an array of shape {} instead.".format(shape) Question: I am currently working on a project to detect and recognise handwritten signatures. I am able to detect the signatures and store it in a "images" folder and I am storing the labels in a "labels.txt" file. Now, I am trying …

Total answers: 1

TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type int64 of argument 'x'. in computer vision

TypeError: Input 'y' of 'Mul' Op has type float32 that does not match type int64 of argument 'x'. in computer vision Question: I’m working in training my model. so, I do: # create the base pre-trained model base_model = DenseNet121(weights=’/Users/awabe/Desktop/Project/PapilaDB/ClinicalData/DenseNet-BC-121-32-no-top.h5′, include_top=False) x = base_model.output # add a global spatial average pooling layer x = GlobalAveragePooling2D()(x) …

Total answers: 1