According to the International Coffee Organization, Finland has the highest coffee consumption per person (our neighbors Norway, Iceland, Denmark, and Sweden are also in the top 10) and our Helsinki office housing many engineers and data scientists is no exception.
It practically runs on coffee and we take it very seriously. We drink a lot, around seven cups per person per day to be precise and we are pretty fussy about our coffee being at its very best in terms of optimum brew time and temperature.
Do you like good gadgets?
Those sweet cool gadgets?
Our coffee supply had never been an issue until we moved to new premises just over a year ago. Although our new office is much nicer than the old one, the downside was that most teams lost their direct view of the kitchen area and our two coffee makers. In order to find out if there was coffee ready, you had to walk to the kitchen and see for yourself.
Besides this taking time and (a bit of) effort, it frequently led to disappointment and frustration as the coffee pot was often found to be empty.
As a company that spends its days focused on the potential for AI and machine learning, we immediately saw this as an opportunity to play around with AI. But, rather than just setting up a webcam and streaming a live feed of the coffee pots, we applied AI to turn our run of the mill coffee machine into a fully-fledged ‘coffee bot’.
How we made our ‘coffee bot’
Our solution, using a combination of AI and image recognition, was far from the simplest route to tackle this specific issue, but the complexities of what we came up with are what made the whole project so enjoyable.
- Just as we do with our clients, we started by setting a goal: to know when there is fresh coffee without the need to leave our desks. We used a Raspberry Pi computer with a webcam to capture images of the coffee maker at regular intervals.
The necessary equipment (= Raspberry Pi and a webcam) cost well under 100 euros. And we designed and 3D printed a rack to hold the camera.
- Next, we used a labeler to label the images. We needed thousands of labeled images to train our machine learning model, but we knew it was going to be well worth the effort. With this data, we were able to train a Support Vector Machine to predict how much coffee there was in the pot.
Altogether we estimate that we labeled around 10,000 images to match one of four categories; no coffee, little coffee, full of coffee, unknown (for example, if something blocks the camera view).
- The predictor was set up as a cloud service with easy integration capabilities and further integrated into Slack, which is used by our whole team for internal communication. Now, whenever one of us wants to know whether there is fresh coffee, all we need to do is to write ‘/coffee’ into the general company discussion in Slack and the coffee bot will respond. The system also uses this same group chat in Slack to automatically notify everyone whenever there is fresh coffee available.
The predictor works by comparing pictures taken every 10 seconds. If a team member sends an information request, the system replies with the latest picture of the coffee machine. An automated notification is only sent when there is a change in status. In other words, if the starting point was ‘no coffee’ and it has now changed to ‘full of coffee’, an automated notification will be sent through Slack to spread the good news.
The coffee bot is mainly a proof of concept; a simple project where we built an end-to-end solution using machine learning. However, the algorithm at the core of the coffee-bot is part of a larger class of base-learners. These are widely used in machine learning applications such as self-driving cars, medical diagnostics, and quality control. So by creating this coffee bot we did more than just automate the process of getting fresh coffee: it enabled more people in our team to understand what machine learning is all about.