A comprehensive web platform for smart waste analysis using AI and machine learning. Users can upload images of waste in their surroundings, and administrators can analyze these images using YOLOv8 for instance segmentation and object detection.
- User Authentication: Secure registration and login system with demo accounts
- Image Upload: Upload photos with location data and GPS coordinates
- Upload History: View and manage all uploaded images with real-time status
- Dashboard: View recent activity and upload statistics
- Real-time Processing: Track processing status of uploaded images
- Analysis Results: View AI-generated waste analysis and insights
- Admin Dashboard: Comprehensive management interface with system health monitoring
- ML Model Integration: Run YOLOv8 and Roboflow models for waste detection
- ML Configuration: Configure models, thresholds, and processing settings
- System Monitoring: Real-time health checks for all services
- Analytics Dashboard: Comprehensive waste analytics and insights
- Enhanced ML Processor: Batch processing and job management
- Government-grade Reporting: Cluster uploads into geographic zones, compute a priority score, and export reports in human-friendly formats (JSON, CSV, Excel, Word, Text, GeoJSON) with live map links.
- React 18 with TypeScript
- Vite for fast development and building
- Tailwind CSS for styling
- shadcn/ui for UI components
- React Router for navigation
- React Hook Form for form handling
- Sonner for toast notifications
- Django 5.0 with Django REST Framework
- SQLite for development database (PostgreSQL for production)
- Cloudinary for image storage and processing
- Celery with Redis for background tasks (synchronous for development)
- YOLOv8 for ML model integration
- Roboflow API for cloud-based waste detection (default model
garbage-det-t1lur/1
) - Ultralytics YOLOv8 for local object detection
- OpenCV for image processing
- NumPy for numerical operations
- Cloudinary for image storage and optimization
- Roboflow for ML model hosting
- Firebase for authentication (configured, not fully integrated)
BinSavvy-BS/
βββ src/ # React frontend source
β βββ components/ # Reusable UI components
β β βββ ui/ # shadcn/ui components
β β βββ user/ # User-specific components
β β βββ admin/ # Admin components
β β βββ government/ # Government dashboard
β β βββ auth/ # Authentication components
β βββ pages/ # Page components
β βββ contexts/ # React contexts
β βββ hooks/ # Custom hooks
β βββ lib/ # Utility functions
β βββ types/ # TypeScript type definitions
βββ backend/ # Django backend
β βββ binsavvy/ # Django project settings
β βββ users/ # User management app
β βββ images/ # Image upload app
β βββ ml_service/ # ML processing app
β βββ cloudinary_config.py # Cloudinary configuration
β βββ roboflow_config.py # Roboflow configuration
β βββ requirements.txt # Python dependencies
βββ public/ # Static assets
βββ README.md # This file
- Node.js 18+ and npm
- Python 3.10+
- Cloudinary account
- Roboflow API key
git clone <repository-url>
cd BinSavvy-BS
cd backend
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate
pip install -r requirements.txt
Create a .env
file in the backend
directory:
DEBUG=True
SECRET_KEY=your-secret-key-here
CLOUDINARY_CLOUD_NAME=your-cloud-name
CLOUDINARY_API_KEY=your-api-key
CLOUDINARY_API_SECRET=your-api-secret
ROBOFLOW_API_KEY=your-roboflow-api-key
# Optional: override the default Roboflow model
ROBOFLOW_MODEL_ID=garbage-det-t1lur/1
- Create account at Cloudinary
- Get your Cloud Name, API Key, and API Secret
- Update the
.env
file with your credentials
- Create account at Roboflow
- Get your API key
- Update the
.env
file with your API key - (Optional) Set
ROBOFLOW_MODEL_ID
to switch models without code changes
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
The backend will be available at http://localhost:8000
npm install
If you pulled updates, make sure the following new libs are installed for Excel/Word export:
npm install xlsx docx
npm run dev
The frontend will be available at http://localhost:8080
The analytics page provides a zones-based report designed for municipal action:
- Zone clustering: Nearby uploads are grouped into zones by a selectable radius (250 m, 500 m, 1 km).
- Per-zone metrics:
- GPS center, radius, bounding box
- Total detections and average confidence (density proxy)
- Priority score: weighted by detections (0.6), confidence (0.3), and number of uploads (0.1)
- Representative address (optional)
- Quick map links (Google Maps & OpenStreetMap)
- Exports:
- JSON, CSV, Text (human-friendly)
- Excel (.xlsx) and Word (.docx) with formatted tables
- GeoJSON for GIS tools
To export: Open Admin β Analytics β choose Time Range, Format, Zone Size, Include Addresses β Export Report.
For testing purposes, the following demo accounts are available:
- Admin Account:
admin
/admin123
- User Account:
user
/user123
POST /api/users/login/
- User loginPOST /api/users/register/
- Register new userPOST /api/users/logout/
- User logoutPOST /api/users/refresh/
- Refresh JWT tokenGET /api/users/profile/
- Get user profilePUT /api/users/profile/update/
- Update user profile
POST /api/images/upload/
- Upload image with locationGET /api/images/list/
- Get user's imagesGET /api/images/{id}/
- Get specific image detailsDELETE /api/images/{id}/delete/
- Delete imagePOST /api/images/{id}/reprocess/
- Reprocess image with ML
GET /api/users/health/
- User service health checkGET /api/images/health/
- Image service health check
cd backend
python manage.py runserver
npm run dev
http://localhost:8080/debug
- API debug informationhttp://localhost:8080/backend-test
- Backend connection testhttp://localhost:8080/government
- Government dashboard
- User Authentication: Login/Register with demo accounts
- Image Upload: Upload images with location and GPS data
- Real Image Storage: Cloudinary integration for production-ready storage
- Upload History: View all uploaded images with status
- Dashboard: Real-time stats and recent activity
- Backend API: Full REST API with health checks
- Frontend-Backend Integration: Complete API integration
- Responsive UI: Mobile-friendly interface
- ML Integration: Roboflow API with 10% confidence threshold
- Enhanced Admin Dashboard: System health monitoring and management
- ML Configuration Panel: Model settings and thresholds
- Government Dashboard: Waste report viewing system
- Analytics Dashboard: Comprehensive waste analytics
- Zones Reporting: Priority scoring, GeoJSON/Excel/Word/CSV/TXT export, and map links
- Enhanced ML Processor: Batch processing and job management
- JWT Authentication: Token-based authentication (demo mode)
- Real-time Updates: Auto-refresh and focus-based updates
- Real-time Updates: WebSocket integration for live status updates
- Advanced Analytics: Charts and visualizations
- Batch Processing: Process multiple images simultaneously
- Firebase Authentication: Full Firebase integration
- Database Migration: PostgreSQL for production
- Celery Tasks: Background processing with Redis
- Real-time Notifications: Push notifications for processing status
- Drone Footage Analysis: Video processing capabilities
- Mobile App: React Native mobile application
- Set up PostgreSQL database
- Configure environment variables
- Set up Celery with Redis (when implemented)
- Deploy to your preferred platform (Heroku, AWS, etc.)
- Build the project:
npm run build
- Deploy the
dist
folder to your hosting service
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -am 'Add feature'
- Push to the branch:
git push origin feature-name
- Submit a pull request
This project is licensed under the Apache License - see the LICENSE file for details.
- YOLOv8 for object detection
- Cloudinary for image processing
- Roboflow for ML model hosting
- shadcn/ui for UI components
- Django for backend framework
For support, email sanidhyapatel99@gmail.com or create an issue in this repository.