By DataKind San Francisco
DataKind San Francisco partnered with TechnoServe and students from Carnegie Mellon University – Africa on a groundbreaking solution – an AI-powered coffee cherry quality assessment. The app acts as a personal AI assistant for farmers, guiding them towards higher incomes and better quality coffee, building a more equitable and sustainable coffee industry where farmers are empowered to thrive.
Coffee, the lifeblood of countless mornings, fuels both our routines and economic opportunities around the world. But for many farmers, particularly in East Africa, the journey from bean to brew is fraught with challenges. Fixed prices for coffee cherries that don’t account for quality differences often leave farmers struggling to earn a living income and invest in their livelihoods. This is where DataKind San Francisco (DKSF) and TechnoServe, a leader in fostering economic opportunity in underserved communities, joined forces to develop a groundbreaking solution – an AI-powered coffee cherry quality assessment.
The collaboration started with two core objectives:
- Promote differential pricing for farmers based on coffee quality
- Educate farmers on best practices to optimize yield and quality at harvest
Understanding the Cup
Before we delve into the tech, let’s explore the intricacies of coffee quality. In making their purchasing and selling decisions, traders and roasters frequently rely on a cupping score, based on a coffee’s sensory qualities like its aroma, acidity, sweetness, body, and aftertaste. The quality of the coffee cherries at the time of harvest–including the ripeness level when they are picked–is one of the biggest determinants of a coffee’s quality and cupping score, but this is not reflected in the pay that individual farmers receive. Instead, farmers are paid a fixed amount per kilogram, with at best subjective measures of quality. This system overlooks the nuances of coffee grading and fails to incentivize farmers to produce higher-quality yields. This is where the AI magic comes in.
The App: A Pocket-Sized AI Assistant
Picture a small agrarian cooperative in Ethiopia, armed with a simple Android app developed by DataKind and TechnoServe. This app acts as their personal AI assistant, guiding them towards higher incomes and better quality coffee. Here’s how it works:
- Capture: Cooperative buyers or the farmers themselves take pictures of coffee cherries using the app.
- AI Analysis: Under the hood, Generative Adversarial Networks (GANs), a powerful form of machine learning, analyze the images. Trained on vast datasets of coffee cherries, these models can distinguish between ripe, overripe, and under ripe cherries with remarkable accuracy.
- Real-Time Feedback: The app instantly provides a cherry ripeness score, giving farmers selling coffee and cooperatives buying coffee an objective measure of cherry ripeness, which is a key indicator of coffee quality.
The Impact: A Ripple Effect of Change
- Higher Incomes: By implementing differential pricing based on ripeness, farmers can earn a premium for coffee that has been harvested at the peak of ripeness – when coffee quality and flavor is optimal.
- Cultivating Best Practices: The app provides feedback that can help farmers improve harvest timing with an objective measure of ripeness and quality.
- Transparency and Fairness: Automating quality assessment promotes greater transparency in the pricing process, empowering farmers to make informed decisions.
The Numbers Paint a Promising Picture
This project has the potential to empower millions of farmers across East Africa. AI image analysis already exists for large scale coffee cherry sorting – this Android-based field application puts this capability in the hands of cooperatives and millions of farmers in the field.
Million-Strong Impact: The Team Behind the Change
This impactful project is the result of a dedicated collaboration:
- DataKind: A team of data scientists and social impact experts led by Saksham Gakhar (currently Research Data Scientist at Meta)—Kelsey Meagher (currently lead UX Researcher at Mighty Networks), Claire Chen (currently SWE at Airtable), Eniola Ajiboye (currently SWE at Google) supported by DKSF under Abhishek Kapatkar (SWE at Netflix) and Seward Lee (currently Manager at Meta).
- TechnoServe Labs: Led by Dave Hale (Director), they played a crucial role in rallying support for this project, in supporting the development of the AI models, and enabling resourcing to get the models integrated into the app. Sildio Mbonyumuhire, TNS Labs Director of Engineering and Product Management, led development of the application.
- Carnegie Mellon University – Africa: Graduate computer science students from CMU-Africa developed the initial beta version of the application.
Technical Deep Dive
The GAN models are specifically designed for image recognition and classification. They analyze various features of the coffee cherries, such as color, size, and shape, to determine their ripeness. While the algorithms are complex, the underlying principle is simple: learning from vast amounts of data to make accurate predictions. In particular we made use of the model inspired by pix2pix GAN.
To optimize the operational efficiency of our AI model for mobile devices, we made architectural modifications to the original pix2pix GAN. This involved substituting the U-Net model, responsible for segmentation, with a more resource-efficient alternative, namely ResNet. We successfully reduced the average model size from 217MB to 8MB, allowing for lightweight mobile app deployment.
The Road Ahead
This project is just the beginning. DKSF and TechnoServe are committed to expanding the responsible use of AI to improve the lives of coffee smallholder farmers in Africa, Latin America, and Southeast Asia. This work includes:
- Refining the coffee ripeness application: Incorporating additional features and languages to enhance its accessibility and effectiveness.
- Using AI for predictive soil analysis for smallholder farmers: So that they can make informed choices about fertilization practices.
- Promoting sustainable practices: Encouraging environmentally conscious farming techniques for long-term success.
Every cup of coffee tells a story. Let’s make sure it’s a story of empowerment, fairness, and shared prosperity.
Join us in Brewing a Brighter Future
This project is more than just technology. It’s about building a more equitable and sustainable coffee industry where farmers are empowered to thrive. Support our efforts and learn more about how you can be a part of this transformative journey. See www.technoserve.org/tns-labs and www.datakind.org for more information.
Images courtesy of TechnoServe.
Join the DataKind movement.
- Interested in supporting our work? Donate here.
- Interested in sponsoring a project? Partner with us.
- Interested in volunteering with DataKind? Look no further.
- Interested in working at DataKind? We’re hiring!
- Interested in submitting a project? Go for it!
Quick Links
- Lessons from DataKind San Francisco’s Launch of DataAdvisory Projects
- Optimizing Data Pipeline Platforms: DataKind San Francisco Partners with Grameen America
- Predicting Well Groundwater Quality Using Cloud-Based Machine Learning: DataKind San Francisco Partners with Aquaya
- Predicting Poverty Using Satellite Imagery: DataKind San Francisco Shares Key Learnings
- Understanding Equity in Local Governments: DataKind San Francisco Partners with the City of San José