Unable to train object detection model - ESP32-CAM - FOMO MobileNet v2 0.35

Hello. I am trying to generate an object detection model for classifying flowers to be used on the ESP-32 CAM. I have used the edge impulse CLI to upload the Kaggle dataset from Google Colab.
I am resizing the image to 48x48 and using grayscale for my images to save as much space and processing power as possible.
While training the impulse, I am using the board setting for the ESP-EYE (ESP32 240 MHz) as there is no option for an ESP32-CAM out of the box. I am using the FOMO MobileNet v2 0.35 model that comes out of the box with edge impulse with a training cycle of 15, learning rate of 0.01 and batch validation size of 20 %. On training I am getting the following error:

Training model…
Training on 3449 inputs, validating on 863 inputs
/app/./resources/libraries/ei_tensorflow/constrained_object_detection/util.py:9: RuntimeWarning: divide by zero encountered in true_divide
return np.log(x/(1-x))
Trained 51 batches.
Attached to job 7930969…
/app/keras/.venv/lib/python3.8/site-packages/scipy/special/_logsumexp.py:214: RuntimeWarning: invalid value encountered in subtract
return np.exp(x - logsumexp(x, axis=axis, keepdims=True))
Traceback (most recent call last):
File “/home/train.py”, line 430, in
main_function()
File “/home/train.py”, line 358, in main_function
model, override_mode, disable_per_channel_quantization, akida_model, akida_edge_model = train_model(train_dataset, validation_dataset,
File “/home/train.py”, line 293, in train_model
model = train(num_classes=classes,
File “/home/train.py”, line 276, in train
model.fit(train_segmentation_dataset,
File “/app/keras/.venv/lib/python3.8/site-packages/keras/utils/traceback_utils.py”, line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File “/app/./resources/libraries/ei_tensorflow/constrained_object_detection/metrics.py”, line 116, in on_epoch_end
y_pred = batch_convert_segmentation_map_to_object_detection_prediction(
File “/app/./resources/libraries/ei_tensorflow/constrained_object_detection/util.py”, line 171, in batch_convert_segmentation_map_to_object_detection_prediction
convert_segmentation_map_to_object_detection_prediction(
File “/app/./resources/libraries/ei_tensorflow/constrained_object_detection/util.py”, line 129, in convert_segmentation_map_to_object_detection_prediction
raise Exception(“Expected at least one non background class but”
Exception: Expected at least one non background class but had 1 (shape (6, 6, 1))
Application exited with code 1

I am not able to resolve this error. Any help is appreciated. :slight_smile:

@louis Hey, could you please look into this? TIA :slight_smile:

Hello @sohamc1909,

Could you share your project ID please so I can check that your project is properly configured?
Best,

Louis

Hello @louis
The project ID is 210635

Hello @sohamc1909,

It seems that you don’t have any labels in your dataset.
Have a look at the labelling queue in your data acquisition tab to manually add the labels to your images.

Best,

Louis

Oh okay. Thanks. I will look into that. I thought the labels might be automatically uploaded from Google Colab.

Is there a way to do the labels automatically? There are ~4000 images and it would take me years to label them manually

Hello @sohamc1909,

Sure if you already have the labels available somewhere here is how you can import them:

You might need to write a script to adapt the format to EI format.

We are working on simplifying the import formats though.

Best,

Louis