conv-neural-network

Validation accuracy doesn't change at all while training a CNN network

Validation accuracy doesn't change at all while training a CNN network Question: So, I was trying to implement AlexNet on the Intel image dataset for classification. However, although during training I get high accuracy scores (0.84), validation accuracy does not change and it is very low (0.16). I have tried different optimizers and learning rates …

Total answers: 1

AttributeError: EagerTensor object has no attribute 'astype'

AttributeError: EagerTensor object has no attribute 'astype' Question: I am trying to do a GradCAM Heatmap in Google Colab like so: import tensorflow as tf from tensorflow.keras import backend as K from tf_keras_vis.activation_maximization import ActivationMaximization from tf_keras_vis.utils.callbacks import Print def model_modifier(m): m.layers[-1].activation = tf.keras.activations.linear activation_maximization = ActivationMaximization(model, model_modifier) loss = lambda x: K.mean(x[:, 1]) activation …

Total answers: 1

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

ValueError: Shapes (None, None) and (None, 296, 296, 6) are incompatible

ValueError: Shapes (None, None) and (None, 296, 296, 6) are incompatible Question: I am trying to build a model for image recognition (images have 6 different classes) using Cov2D but after many tests every time I get the error "ValueError: Shapes (None, None) and (None, 296, 296, 6) are incompatible". from sklearn.preprocessing import normalize im_shape …

Total answers: 2

How can i convert images into grayscale?

How can i convert images into grayscale? Question: I have 1000 of images. Now I like to convert those images into grayscale? import tensorflow as tf from tensorflow.keras.utils import img_to_array #df[‘image_name’] = df[‘image_name’].apply(str) df_image = [] for i in tqdm(range(df.shape[0])): img = image.load_img(‘/content/drive/MyDrive/Predict DF from Image of Chemical Structure/2D image/’+df[‘image_name’][i]+’.png’,target_size=(100,100,3)) img = image.img_to_array(img) img = …

Total answers: 1

How to solve `NameError: name 'compression' is not defined`?

How to solve `NameError: name 'compression' is not defined`? Question: I am trying to implement DenseNet model and I am using image dataset with 4 classes. Code snippets: For building model: def denseblock(input, num_filter = 12, dropout_rate = 0.2): global compression temp = input for _ in range(l): BatchNorm = BatchNormalization()(temp) relu = Activation(‘relu’)(BatchNorm) Conv2D_3_3 …

Total answers: 1

Why does train data performance deteriorate dramatically?

Why does train data performance deteriorate dramatically? Question: I am training a binary classifier model that classifies between disease and non-disease. When I run the model, training loss decreased and auc, acc, get increased. But, after certain epoch train loss increased and auc, acc were decreased. I don’t know why training performance got decreased after …

Total answers: 2