Boss lady
Boss lady
DIIDevHeads IoT Integration Server
Created by Boss lady on 9/26/2024 in #firmware-and-baremetal
Normalizing Input Data for CNN Model in Image Recognition System on ESP32
still based on my project image recognition system that can analyze images of tissue samples, identify malignancies, and predict possible symptoms and causes. How do i train a CNN to accurately identify malignant tissues? My aim is to train a convolutional neural network (CNN) model for image recognition. But I keep encountering the error
ValueError: Input data not properly normalized

ValueError: Input data not properly normalized

Here's my code
import tensorflow as tf
from tensorflow.keras import layers, models

model = models.Sequential([
layers.Conv2D(32, (3, 3), activation='relu', input_shape=(224, 224, 1)),
layers.MaxPooling2D((2, 2)),
layers.Conv2D(64, (3, 3), activation='relu'),
layers.MaxPooling2D((2, 2)),
layers.Flatten(),
layers.Dense(64, activation='relu'),
layers.Dense(1, activation='sigmoid')
])

model.compile(optimizer='adam',
loss='binary_crossentropy',
metrics=['accuracy'])

history = model.fit(train_images, train_labels, epochs=10, validation_data=(test_images, test_labels))

import tensorflow as tf
from tensorflow.keras import layers, models

model = models.Sequential([
layers.Conv2D(32, (3, 3), activation='relu', input_shape=(224, 224, 1)),
layers.MaxPooling2D((2, 2)),
layers.Conv2D(64, (3, 3), activation='relu'),
layers.MaxPooling2D((2, 2)),
layers.Flatten(),
layers.Dense(64, activation='relu'),
layers.Dense(1, activation='sigmoid')
])

model.compile(optimizer='adam',
loss='binary_crossentropy',
metrics=['accuracy'])

history = model.fit(train_images, train_labels, epochs=10, validation_data=(test_images, test_labels))

5 replies