πŸ₯¬ 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

  1. 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."

  2. "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.

  3. The UI is the product. Our model accuracy matters less than whether someone glances at the screen and immediately knows what to do.

  4. 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.

Built With

Share this project:

Updates