How can I switch object detector COCO model with my own?

Hi all

I want to grab the object detector app that uses a tflite model (provided by tensorflow) and switch it with my own tflite model that has been trained on only 3 classes (rock, paper and scissors)

Does anyone know what things I have to change using android studio to do this?

More details:
I am doing the Tensorflow Data and Deployment course on coursera

I am on the “C2 W2 Optional Exercise: Rock Paper Scissors for Android” Exercise

At the end of the assignment, once you’ve completed the colab notebook, it says:

Then, if you’re brave enough, you can edit the Image Detection app for Rock, Paper and Scissors only, instead of the 1,000 classes it could recognize!

But we are not taught anywhere how to do this

I have tried putting the files ‘converted_model.tflite’ and ‘labels.txt’ (which we create in the colab after training a model with rock/paper/scissor images) in the assets folder in the android app in android studio, then replacing calls to the previous files (‘detect.tflite’ and ‘labelmap.txt’) with those new ones.

This has not worked, nothing is detected on my webcam

What else should I change?

There are hundreds of lines of code and since we haven’t been taught how to do this I’m afraid it would be an infinite task to probe each line until results appeared

However, this feels like the most important assignment i have done so far so would really like to learn how to do it

Hello
There are six steps to training an object detection
Choose an object detection model archiecture.
Load the dataset.
Train the TensorFlow model with the training data.
Evaluate the model with the test data.
Export as a TensorFlow Lite model:
Evaluate the TensorFlow Lite model.

Hi to change the number of classes your model outputs you can just set the classes parameter equal to your number of classes. Like this

tf.keras.applications.resnet50.ResNet50(
include_top=True,
weights=‘imagenet’,
classes=3,
)

This is an example for the Resnet50 model, however you could only define classes like this if your include_top=True