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
Here's my code
Solution:Jump to solution
your code should look like
```python
import tensorflow as tf
from tensorflow.keras import layers, models
...
3 Replies
It looks like you're encountering a
ValueError: Input data not properly normalized
while working on your CNN for image recognition. This error implies that your input data needs to be preprocessed
before feeding it into your model.
- CNNs perform better when the input data is normalized. For images with pixel values ranging from 0
to 255
, scaling them to [0, 1]
is standard practice. Normalize your images like this:
- Check that the dimensions of your images match the expected input shape of your model. If your first convolutional layer expects grayscale images of shape (224, 224, 1)
, but your images are RGB, adjust the input_shape
accordingly:
- Ensure your data (train_images
and test_images
) is in a compatible format for TensorFlow, such as numpy arrays or TensorFlow tensors. Incompatible data types can cause issues.Solution
your code should look like
Thanks it did work out