Coffee Data Science
A curious adventureCoffee ground distributions can be informative for coffee grinders and dialing-in espresso shots. The typical methods are expensive, namely sifting and laser diffraction. Jonathan Gagné made an image based method, and for awhile, one had to compile the code and have a Python environment handy. I typically don’t, so I built my own. Recently, someone made an exe file allowing one to run Jonathan’s method on their computer without setting up their enviroment, so I did that to compare his method to my method. We use different thresholds. Jonathan uses a simple threshold, and I use an adaptive threshold in an effort to catch more particles and finer particles. The result is that my method has a higher raw count, and his method was using a minimum area threshold (5) as a default. However, if you pull out particles with less than 5 pixels and normalize for volume size, we have similar distributions. You can adjust the thresholds of his method in the advanced settings. There is a balance because you start to lose particles as well as accurate sizes of particles. So if you want the smaller particles, you have to raise the thresholds, but then you can get large noise bits depending on how the images were captured. I was very excited to use Jonathan’s tool, and it had the main components for successfully understanding particle distribution. While I think it would be beneficial to use adaptive filtering, this app as is, allows for the user to understand their particle distribution. The app has a few issues, and if they were resolved, I believe this could be more widely used especially to help baristas dial-in a coffee:
- Turn this into a mobile app or web-based
- Give the user feedback on image quality
- Add a video showing how to get the best distributions.
- Change the threshold algorithm to use an adaptive filter.
- Add a function to suggest increasing or decreasing grind setting to match a given grind setting.
Measuring Coffee Grounds vs Jonathan Gagné’s Technique was originally published in Towards Data Science on Medium, where people are continuing the conversation by highlighting and responding to this story.