We might not notice it, but we are constantly surrounded by machine learning algorithms. Post offices automatically read zip codes using OCR. Movie streaming services use recommender systems to suggest to us the next show to watch. Meteorological institutions utilize machine learning to make forecasts and foresee extreme weather events. But machine learning can also be used for both useful and fun things – like classifying dog breeds!
Just take a picture and find out!
You can take a picture of your dog using your phone camera or upload an existing photo from your photo library. Once it’s selected, the app analyzes it to determine the breed. After processing a photo, you’ll see the closest matching breeds and their short characteristics.
If you enjoy Breed Read, you can add it to your home screen and use it as a native app!
- Collection of a dataset of dog photos with breed labels
- Training of a classification model using Machine Learning
- Design and implementation of a Progressive Web App
Machine Learning model built with TensorFlow
Mobile-first PWA that you can install on your smartphone
Model training on GPUs on Google Cloud
REST API written in Python for exposing the image classifier
Breed Read is built as a Progressive Web App (PWA) with React and Next.js. The machine learning model responsible for classifying the images is implemented using the TensorFlow and Keras libraries for Python. The neural network is based on Google's EfficientNet model and fine-tuned on additional data to classify dog breeds.
All uploaded images are completely removed from our temporary storage soon after being processed by the machine learning model. We do not use the uploaded photos for training or in any other way apart from computing dog breed probabilities
Tensorflow and Keras
The core of the Breed Read app is the classification model. Nowadays, the research in machine learning moves so fast it is hard for the industry to keep up. That is why having appropriate tools that allow fast iteration cycles is such an essential element of machine learning. Tensorflow and Keras are Python tools made precisely for the job. Tensorflow's automatic differentiation allows us to abstract away the complicated calculations and focus on experimenting and improving the model instead. On the other hand, Keras gives us ready-to-use building blocks like EfficientNet and ResNet that we can then integrate within our own machine learning architectures.
React and Next.js
While having a good classification model is crucial, it is of no use if the users cannot access it. For that, we use Next.js, a production-ready web framework based on React. We made this choice due to the framework's support for Server Side Rendering and Static Site Generation, out-of-the-box optimization and code splitting, and localization support.
Docker is the underlying base for all of the project's components. We used it to create containers for data analysis, model training, backend API, and the frontend app. Docker allowed us to swiftly move code between local, staging, and production environments, as it is the key element of our continuous integration pipeline.
With the impressing results of deep learning models for image recognition comes the high computational cost of training them. That is why we use GPU-enabled instances on Google Cloud for model training. Using it, we are able to train deep neural models with tens of millions of parameters in just one or two hours.
The development of machine learning models is a highly iterative and exploratory process. There is no one method that works best for all tasks and datasets, so trying out many different approaches is necessary. We use Jupyter Notebooks for many tasks such as data collection and cleaning, data analysis, and model testing to address this need.
Come and try out Breed Read app yourself!