π₯¬ EcoShelf
Waste less. Eat smarter.
π‘ Inspiration
Food waste is one of those problems that's both massive and strangely personal. We've all opened the fridge, stared at that banana or bag of spinach, and wondered: "Is this still good?" That moment of uncertainty leads to two outcomesβeither we toss perfectly fine food "just to be safe," or we forget about it entirely until it's definitely not fine.
That hesitation adds up. In the US alone, 40% of food goes to waste, with fresh produce being the biggest culprit. But here's the thing: most of that waste isn't because food actually went badβit's because we couldn't tell when it was about to.
We built EcoShelf to remove that guesswork. Point a camera at your fridge, see exactly what you have, and know at a glance what needs to be used soon. No apps to update manually. No scanning barcodes. Just look and know.
π What It Does
EcoShelf is a real-time food freshness monitor that turns your camera into a smart fridge assistant.
Core Features
| Feature | Description |
|---|---|
| πΈ Instant Food Detection | Point the camera at your fridge and EcoShelf automatically identifies produce, bottles, snacks, sandwiches, and more |
| π¬ Freshness Analysis | Each detected item gets a freshness score (0-100%) based on visual cues like color, texture, and ripeness |
| π¦ Color-Coded Status | Items tagged as Fresh (green), Moderate (orange), or Spoiling (red) for at-a-glance prioritization |
| π Live Detection Panel | Clean sidebar showing everything visible, updating in real-time as items move in/out of frame |
| π₯οΈ Beautiful Fridge UI | Camera feed displayed inside a stylized fridge graphicβlike looking into your actual fridge |
What It Detects
| Category | Items |
|---|---|
| π Produce | Apples, bananas, oranges, broccoli, carrots |
| πΌ Bottles | Water bottles, plastic bottles |
| πͺ Snacks | Cakes, donuts, pastries |
| π₯ͺ Proteins | Sandwiches, hot dogs |
| π Prepared Foods | Pizza |
How Freshness Works
Each produce item receives a freshness score from our trained neural network:
| Score | Status | What It Means |
|---|---|---|
| 70-100% | π’ Fresh | Good to go, no rush |
| 40-69% | π Moderate | Use within a few days |
| 0-39% | π΄ Spoiling | Use today or consider composting |
The prioritization follows a simple urgency modelβitems closer to expiring get flagged first:
$$\text{Urgency}(i) \propto \max\left(0, \frac{1}{\text{days_to_expire}(i) + 1}\right)$$
π οΈ How We Built It
The Pipeline
βββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Camera ββββββΆβ YOLO Detection ββββββΆβ Freshness Model β
β (OpenCV) β β (YOLOv8 Nano) β β (ResNet-18) β
βββββββββββββββ ββββββββββββββββββββ ββββββββββ¬βββββββββ
β
ββββββββββββββββββββ βΌ
β Flask Server ββββββββββββββββββββββββββ
β (MJPEG Stream) β Freshness Scores
ββββββββββ¬ββββββββββ
β
ββββββββββΌββββββββββ
β Web Frontend β
β (Fridge UI + JS) β
ββββββββββββββββββββ
Tech Stack
π§ Computer Vision
- YOLOv8 Nano β Ultrafast object detection (~30+ FPS) optimized for real-time performance
- Custom ResNet-18 Freshness Model β Trained classifier that scores produce ripeness from visual features (color, texture, spotting, wilting)
- OpenCV β Camera capture, frame processing, and MJPEG video streaming
βοΈ Backend
- Flask β Lightweight Python web server
- Flask-CORS β Cross-origin support for web interface
- MJPEG Streaming β Real-time video feed to browser
- Threading β Non-blocking detection pipeline
π¨ Frontend
- Embedded HTML/CSS/JS β Single-file deployment, no build step required
- Modern CSS β Glassmorphism effects, smooth gradients, responsive animations
- Real-time Updates β Detection panel refreshes every 500ms via REST API
β‘ Performance Optimizations
- Frame skipping (process every 2nd frame)
- Reduced inference resolution (480px) while maintaining HD display (1280Γ720)
- Buffer size optimization to minimize camera latency
- Nano YOLO model for speed over marginal accuracy gains
π§ Challenges We Faced
Freshness Isn't Binary
Challenge: Different foods age differently, and storage conditions matter. A slightly spotted banana might be perfect for baking but not for eating fresh.
Solution: We designed outputs as confidence-based ranges rather than hard predictions. The scoring system communicates uncertainty honestlyβusers see a percentage, not a false "EXPIRED" stamp.
Messy Fridges Are Real
Challenge: Items overlap, labels face away, lighting varies wildly. A model trained on perfect stock photos struggles with real-world chaos.
Solution: Made the experience resilient. Partial recognition is still usefulβif we can only see half a banana, we still detect "banana." Users can quickly see what's visible and adjust accordingly.
Speed vs. Accuracy Tradeoff
Challenge: A hackathon demo needs to feel instant. Heavy models give better accuracy but kill responsiveness.
Solution: Chose YOLOv8 Nano over larger variants. Implemented aggressive frame skipping and resolution scaling. The result: smooth real-time video with detection overlays that don't lag behind reality.
Making It Actually Useful
Challenge: It's easy to detect things. It's hard to present that information in a way that changes behavior.
Solution: Focused on the UI. The fridge graphic isn't just decorationβit creates a mental model. The color-coded urgency system turns "83% fresh" into an instant gut reaction: green = don't worry, red = eat today.
π What We Learned
Combining vision with heuristics is as much about communicating uncertainty as prediction. Clear outputs build trust. A confident wrong answer is worse than an honest "probably fresh."
"Smart" features only matter if the flow is effortless. We treated friction like a bug. Every extra click, every loading spinner, every confusing labelβremoved.
The UI is the product. Our model accuracy matters less than whether someone glances at the screen and immediately knows what to do.
Real-time is harder than it looks. Threading, buffers, frame rates, latencyβgetting smooth video with overlays required way more optimization than expected.
π What's Next
| Feature | Description |
|---|---|
| π¦ More Food Types | Packaged items, leftovers, meal prep containers |
| π Personalized Estimates | Learn from user habits to calibrate shelf-life predictions |
| π± Mobile App | Take EcoShelf on-the-go with push notifications |
| π Recipe Suggestions | "You have bananas at 45% freshnessβhere are 5 banana bread recipes" |
| π On-Device Inference | Privacy-first option with no cloud dependency |
| π Inventory Tracking | Build a persistent list of fridge contents over time |
ποΈ Built With
Core Technology
- YOLOv8 β Real-time object detection
- PyTorch + ResNet-18 β Freshness classification model
- OpenCV β Camera capture and image processing
- Flask β Python web server
- HTML/CSS/JS β Clean, responsive web interface
π Auth0 β Secure Authentication
Secure user authentication with social sign-in, MFA, and passwordless login. Users can securely log in to save their preferences and track their personal food waste reduction journey.
βοΈ Cloudflare Workers AI β Serverless AI Inference
Deployed our freshness analysis model on Cloudflare's edge network for ultra-low latency inference. Uses LLaVA vision model for enhanced food analysis and Llama 3 for recipe generationβall serverless and globally distributed.
π₯οΈ DigitalOcean Gradientβ’ AI β GPU-Accelerated ML
Leverages DigitalOcean's GPU Droplets and serverless inference for high-performance YOLO + ResNet model execution. Enables real-time processing with NVIDIA GPU acceleration.
π ElevenLabs β Voice Alerts
Natural, human-sounding voice notifications alert users when food needs attention. Emotionally expressive alerts ("Your bananas are perfect for banana bread today!") make the experience delightful and actionable.
π€ Generative AI β Smart Recipe Suggestions
Multi-provider AI recipe engine using:
- OpenAI GPT-4 β Intelligent recipe generation
- Anthropic Claude β Contextual cooking suggestions
- Google Gemini β Alternative AI recommendations
Recipes are scored by a waste-reduction algorithm: $$\text{Score}(r) = \alpha \cdot \text{Overlap}(r) + \beta \cdot \sum \text{Urgency}(i) - \gamma \cdot \text{Missing}(r)$$
π MongoDB Atlas β Cloud Database
Stores detection history, user preferences, and analytics:
- Time-series freshness tracking
- Aggregated waste statistics
- User preference persistence
- Environmental impact metrics
βοΈ Solana β Blockchain Waste Tracking
Decentralized, immutable record of food waste prevention:
- On-chain waste prevention records
- EcoToken rewards for sustainable behavior
- Transparent community leaderboard
- Verified environmental impact claims
π₯οΈ Try It
cd backend
pip install flask flask-cors torch torchvision ultralytics opencv-python pillow numpy
python web_app.py
Then open http://localhost:5000 in your browser.
Environment Variables (Optional)
# Auth0
export AUTH0_DOMAIN="your-tenant.auth0.com"
export AUTH0_CLIENT_ID="your-client-id"
# Cloudflare
# Deploy: cd integrations && npx wrangler deploy
# DigitalOcean
export DIGITALOCEAN_API_TOKEN="your-do-token"
# ElevenLabs
export ELEVENLABS_API_KEY="your-elevenlabs-key"
# GenAI (any of these)
export OPENAI_API_KEY="your-openai-key"
export ANTHROPIC_API_KEY="your-anthropic-key"
export GOOGLE_API_KEY="your-google-key"
# MongoDB Atlas
export MONGODB_URI="mongodb+srv://..."
# Solana
export SOLANA_RPC_URL="https://api.devnet.solana.com"
π Project Structure
ecoshelf/
βββ backend/
β βββ web_app.py # Main Flask application
β βββ simple_app.py # Desktop camera app
β βββ model/
β β βββ ripe_detector.pth # Freshness classification model
β βββ integrations/
β βββ auth0_config.py # π Auth0 authentication
β βββ cloudflare_worker.js # βοΈ Cloudflare Workers AI
β βββ wrangler.toml # Cloudflare deployment config
β βββ digitalocean_gradient.py # π₯οΈ DO Gradient AI
β βββ elevenlabs_voice.py # π Voice alerts
β βββ genai_recipes.py # π€ AI recipe suggestions
β βββ mongodb_atlas.py # π MongoDB database
β βββ solana_tracker.py # βοΈ Blockchain tracking
βββ frontend/ # React frontend (optional)
π MLH Prizes Targeted
| Prize | Technology | Integration |
|---|---|---|
| π Best Use of Auth0 | Auth0 | Secure user authentication |
| βοΈ Best AI Application Built with Cloudflare | Workers AI | Serverless freshness inference |
| π₯οΈ Best Use of DigitalOcean Gradientβ’ AI | Gradient | GPU-accelerated ML |
| π Best Use of ElevenLabs | ElevenLabs | Voice freshness alerts |
| π€ Best Use of Gen AI | OpenAI/Claude/Gemini | Recipe suggestions |
| π Best Use of MongoDB Atlas | MongoDB | Detection history & analytics |
| βοΈ Best Use of Solana | Solana | Blockchain waste tracking |
Built with π for reducing food waste, one fridge at a time.
Log in or sign up for Devpost to join the conversation.