Using publicly available pre-trained Machine Learning models with Vector
Use pre-trained models available at Roboflow
In the world of Machine Learning (ML), one of the hardest tasks is to bootstrap your application with a trained model. The process of generating a model involves some complex steps of (i) Creating a valid labelled dataset and then (ii) Selecting the right kind of Machine Learning model to train on this dataset. If you are looking to understand this process better, there is material on Machine Learning Operations that we have created at ‘Learn With A Robot’ here and here.
Do you always need to train a model?
No. The great news is that you can bootstrap your application on an existing machine learning models and then use the art of transfer learning to adapt that model to your specifc setting. But where do you find an existing ready to use model?
Roboflow Universe
Roboflow Universe contains a large collection of pre-trained machine learning models. They mention that at this moment, they have a collection of more than 7000 pre-trained machine learning models. One of these models is created by us, and allows Vector to recognize another Vector.
But, let’s say, we now want our beloved Vector to do something else, such as, detect humans. Luckily, Roboflow provides a model to do exactly that, identify humans in a picture. Note that the Roboflow model is trained of pictures from the web, and Vector’s camera is different and of a much smaller resolution. This blog post will examine if you could have your Vector detect humans using the pre-trained ML model available at Roboflow Universe.
Let us work with Vector and get it to recognize humans
We have provided the code in our git repository. After cloning the code you would need to follow the following steps.
%git clone https://github.com/hiamitabha/course.git
%cd mlops
Please edit the following lines in the file utils.py to choose the correct model from Roboflow Universe. You can find the name of the model and the version of the model from the this url. In this case, you would need to edit utils.py to reflect:
l.23 _DATASET_NAME = "human-dataset-v2"
l.24 _MODEL_UUID = "6"
And just with these lines, our program is ready for consumption. Now if we run the following program:
python3 ./examinePicture.py --serial <Serial number>
Vector will begin to take pictures with his camera, and send it to the Roboflow public API endpoint requesting inference from the above model. After receiving the results, you will see a annotated display on your screen, just like the one at the top of this post. Voila!, you can see that Vector has successfully identified me in the picture as a human.
Happy coding! Try and let us know if your Vector can detect humans using the above technique. Post the results in the comments. Better, find a different model on Roboflow Universe, and examine if that model works with Vector. Thank you for reading this free post! We are building a lot of educational content here… if you found the material useful, please consider sponsoring us with a paid subscription using the link below.
There has been some discussion on this in my reddit subpost: https://www.reddit.com/r/AnkiVector/comments/vou0u5/how_to_make_vector_recognize_humans/ There was some confusion over an ability which Vector already has, identifying known recognizable faces. This ability will not allow him to function like a security camera, i.e., find if there is an intruder in the room. Using the method in the above post, you can have your Vector identify if there is a human in its view. You could extend the analogy to use alternate models to identify pets/other items in your household.