Train custom images for multiple classes

Good day…

I followed this guide on how to prepare images/annotation files for training a set of iamges to be used for the K210 chip

But sadly this only works for an image set with only one class…

Has anyone stumbled upon a description for several classes to be loaded onto the K210?

When I try to use for example two classes in the config.json file for Yolo I get this error during training, and no tflite file is produced:

ValueError: Invalid tensors ‘detection_layer_30/BiasAdd’ were found

Check the layers of your model. If you add more classes, the layer “detection_layer_X” will have a different number for X (not sure why). So, in under the ‘save_tflite’ method edit the line:

converter = tf.lite (…) (“model.h5”, output_arrays = [‘detection_layer_30/BiasAdd’])

so that ‘detection_layer_X/BiasAdd’ matches the layer name in your model. If you already have the h5 model, you can copy the save_tflite lines into a python script and skip retraining the model (don’t forget “from keras.models import load_model”).