At Codegram whenever we hear about a new technology or framework, we like to give it a try and build something simple to test it and learn about it. Everyone agrees Machine Learning is a hot topic, but I couldn't find any use case to apply it at work, so I decided to build a small project called Dogtector™.
The idea behind Dogtector is simple: Given a photo of my dog I want the application to tell me her breed name. Simple, right?
What about that "Magic" cloud? I knew that I needed Machine Learning for that, but I didn't know how to start, so I decided to look for some examples about image classification and found this cool tutorial that used Tensorflow to classify images of flowers.
In the tutorial, I didn't create a neural network from scratch but retrained an existing MobileNet. These networks are already trained to do some classifications so they must be retrained with a new set of images to your needs. I thought it was a good starting point for my small project. I used this utility to download a lot of pictures of different dog breeds: Beagle, Chihuahua, Dachshund, Husky, Labrador and Shiba.
After building the new classification model, I created a simple API with Hapi to upload an image and classify it using a python script and the model trained using Tensorflow.
Finally, I created a simple web application using Vue.js. I added a simple camera button to take photos with my mobile phone. Then the picture was uploaded to the API and classified returning the result to the client.
The whole project is in this repository, and you can try it yourself in no time! I used Docker and
docker-compose to set up the development environment using a simple command:
$ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
The previous command will create some containers for you and start Traefik as a reverse proxy. It binds ports
8080 by default, but you feel free to change the
docker-compose.yml to your needs. To open the application navigate to
Our office is Pet-friendly ❤️, so I decided to use my dog Boira and Georgina's dog Black as test subjects (both received a significant amount of treats as a reward).
The experiment was a success, and I could create a small application to classify dog breeds using Machine Learning. I just scratched the surface of Machine Learning, but the topic is vast and fun to explore.