Enthernet Code
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
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.5 replies