AI-Powered Ocean Waste Detection and Management Platform for NGOs
OceanCleanup Connect is a comprehensive platform that empowers NGOs to identify, track, and coordinate ocean waste cleanup operations using AI-powered image classification and real-time drift analysis.
- Image Classification: Upload waste images and get instant AI-powered classification
- Multiple Waste Types: Detects plastic, glass, metal, paper, cardboard, and general trash
- Confidence Scores: Get detailed confidence percentages for each classification
- Transfer Learning: Built on Inception v3 model with custom training capabilities
- Real-time Location Tracking: View all waste reports on an interactive map
- Proximity Detection: Automatically calculates distances from your location
- Drift Analysis: Predict waste movement using wind and ocean current data
- Marker Clustering: Efficient visualization of multiple waste locations
- Statistics Dashboard: View total reports, confidence metrics, and waste distribution
- Trend Analysis: Track waste collection trends over time
- Type Distribution: Visual breakdown of waste types detected
- Performance Metrics: Monitor cleanup operations effectiveness
- Dark/Light Theme: Seamless theme switching with system preference detection
- Responsive Design: Fully optimized for desktop, tablet, and mobile devices
- Gradient Cards: Beautiful UI components with gradient borders
- Smooth Animations: Framer Motion powered transitions and interactions
- Firebase Auth: Secure user authentication and session management
- NGO Accounts: Dedicated accounts for organizations
- Protected Routes: Authentication-required pages for data security
- Framework: Next.js 16.0 with App Router
- Language: TypeScript
- Styling: Tailwind CSS v4 with CSS Variables
- UI Components: Custom components with Radix UI primitives
- Animations: Framer Motion
- Maps: React Leaflet with Leaflet.js
- Icons: Lucide React
- Theme: next-themes for dark/light mode
- API Server: Flask (Python)
- ML Framework: TensorFlow 2.x
- Model: Inception v3 (Transfer Learning)
- Image Processing: PIL/Pillow
- Realtime Database: Firebase Realtime Database
- File Storage: Firebase Storage
- Authentication: Firebase Authentication
- Weather Data: Open-Meteo API
- Marine Data: Marine API for ocean currents
- Node.js 20.9+ (for frontend)
- Python 3.8+ (for backend)
- Firebase account and project
- TensorFlow compatible system
cd web-platform
npm installCreate a .env.local file:
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_auth_domain
NEXT_PUBLIC_FIREBASE_DATABASE_URL=your_database_url
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_storage_bucket
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
NEXT_PUBLIC_API_URL=http://localhost:5000Run the development server:
npm run devVisit http://localhost:3000
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtCreate a .env file:
FIREBASE_CREDENTIALS_PATH=path/to/serviceAccountKey.json
MODEL_PATH=tf_files/retrained_graph.pb
LABELS_PATH=tf_files/retrained_labels.txt
PORT=5000Run the Flask server:
python app.pyThe API will be available at http://localhost:5000
- Sign Up/Login: Create an account or login with existing credentials
- Report Waste: Upload images of ocean waste with location data
- View Dashboard: See all waste reports sorted by proximity
- Analyze Drift: Enable drift analysis to predict waste movement
- Track Progress: Monitor cleanup statistics and trends
POST /detect
Content-Type: application/octet-stream
[Base64 encoded image data]Response:
{
"success": true,
"predictions": {
"plastic": 0.85,
"glass": 0.10,
"metal": 0.05
},
"top_prediction": {
"label": "plastic",
"confidence": 0.85
}
}ocean-waste-detection-method/
βββ web-platform/ # Next.js frontend
β βββ app/ # App router pages
β β βββ dashboard/ # Main dashboard
β β βββ report/ # Waste reporting
β β βββ analytics/ # Analytics page
β β βββ help/ # Help & guide
β β βββ login/ # Authentication
β βββ components/ # React components
β β βββ ui/ # UI primitives
β β βββ WasteMap.tsx # Map component
β β βββ Sidebar.tsx # Navigation
β β βββ ...
β βββ lib/ # Utilities
β β βββ firebase.ts # Firebase config
β β βββ utils.ts # Helper functions
β β βββ weather.ts # Weather API
β βββ types/ # TypeScript types
βββ app.py # Flask API server
βββ service.py # ML service
βββ classify.py # Image classification
βββ firebase.py # Firebase backend
βββ retrain.py # Model retraining
βββ requirements.txt # Python dependencies
- Create a Firebase project at Firebase Console
- Enable Authentication (Email/Password)
- Create Realtime Database
- Set up Storage bucket
- Download service account key
- Update environment variables
To retrain the model with custom data:
python retrain.py \
--image_dir=training_dataset \
--output_graph=tf_files/retrained_graph.pb \
--output_labels=tf_files/retrained_labels.txt \
--bottleneck_dir=tf_files/bottlenecksThe platform supports full theme customization through CSS variables:
:root {
--primary: #FF9933;
--secondary: #D4AF37;
--tertiary: #800020;
/* ... more variables */
}Dark mode is automatically supported with .dark class variants.
cd web-platform
npm run lintpython testing.py- Image Classification: ~200-500ms per image
- Map Rendering: Optimized with marker clustering
- Database Queries: Real-time updates with Firebase
- Bundle Size: Optimized with Next.js code splitting
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- TensorFlow Team for the Inception v3 model
- Firebase for backend infrastructure
- Next.js Team for the amazing framework
- Leaflet for map functionality
- Open-Meteo for weather data
All project documentation is available in the doc/ folder:
- FIREBASE_AUTH_FIX.md - Firebase authentication setup and troubleshooting
- QUICKSTART.md - Quick start guide for developers
- PROJECT_REPORT_CONTEXT.md - Project context and architecture
- UI_FIXES_SUMMARY.md - UI improvements documentation
- CODE_CLEANUP_SUMMARY.md - Code cleanup documentation
- CREATE_DEMO_USER.md - Guide for creating demo users
- DEMO_CREDENTIALS.md - Demo account information
- DRIFT_ANALYSIS.md - Drift analysis feature documentation
For support, email support@oceancleanup.connect or open an issue in the repository.
- Mobile app (React Native)
- Advanced ML models (YOLO, Faster R-CNN)
- Multi-language support
- Real-time collaboration features
- Integration with cleanup scheduling
- Advanced analytics with ML insights
- API rate limiting and caching
- Webhook support for integrations
- Total Commits: 54+
- Languages: TypeScript, Python, CSS
- Frameworks: Next.js, Flask, TensorFlow
- Lines of Code: 10,000+
Made with β€οΈ for ocean conservation
OceanCleanup Connect - Empowering NGOs to clean our oceans, one detection at a time.