Sistem deteksi dan analisis polusi suara menggunakan Machine Learning dengan arsitektur fullstack modern.
- Backend: Django REST API dengan MySQL database
- Frontend: React TypeScript dengan Material-UI components
- ML Models: CatBoost dengan optimasi algoritma bio-inspired
- Audio Processing: Librosa untuk ekstraksi fitur audio
- 🔊 Upload & Analisis Audio: Drag & drop file audio untuk analisis real-time
- 📊 Prediksi Noise Level: Prediksi tingkat kebisingan dalam decibel (dB)
- 🏭 Klasifikasi Sumber: Identifikasi sumber kebisingan (traffic, construction, industrial, dll)
- 🏥 Analisis Dampak Kesehatan: Evaluasi potensi dampak kesehatan dari tingkat kebisingan
- 📈 Dashboard Real-time: Visualisasi data dan analytics dengan charts interaktif
- 📝 History & Tracking: Riwayat analisis dan tracking perubahan dari waktu ke waktu
- 🎯 Model Optimization: Model ML yang dioptimasi menggunakan algoritma Firefly & Fruit Fly
- 🔄 REST API: API endpoints lengkap untuk integrasi dengan sistem lain
Pastikan Anda sudah menginstall:
git clone https://github.com/yourusername/noise-pollution-detection.git
cd noise-pollution-detection-- Buat database MySQL
CREATE DATABASE econoise_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Buat user (opsional)
CREATE USER 'econoise_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON econoise_db.* TO 'econoise_user'@'localhost';
FLUSH PRIVILEGES;# Masuk ke folder backend
cd backend
# Buat virtual environment
python -m venv venv
# Aktifkan virtual environment
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Setup environment variables
cp .env.example .env
# Edit .env file dengan konfigurasi database Anda
# Jalankan migrasi database
python manage.py migrate
# Buat superuser (opsional)
python manage.py createsuperuser
# Test server
python manage.py runserverBackend akan berjalan di: http://localhost:8000
# Buka terminal baru, masuk ke folder frontend
cd frontend
# Install dependencies
npm install
# Setup environment variables
cp .env.example .env
# Edit .env file jika diperlukan
# Start development server
npm startFrontend akan berjalan di: http://localhost:3000
-
Backend API Test:
curl http://localhost:8000/api/health/ # Should return: {"status":"healthy","timestamp":"...","service":"Noise Detection API"} -
Frontend Test:
- Buka browser ke http://localhost:3000
- Anda akan melihat halaman upload dengan interface Material-UI
-
ML Models Test:
curl http://localhost:8000/api/models/status/ # Should return model loading status
# Django Settings
SECRET_KEY=your-secret-key-here
DEBUG=True
# Database (MySQL)
DB_NAME=econoise_db
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_HOST=localhost
DB_PORT=3306
# CORS (untuk frontend)
CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000# API Configuration
REACT_APP_API_URL=http://localhost:8000/api
# App Info
REACT_APP_APP_NAME=Noise Pollution Detection System
REACT_APP_VERSION=1.0.0GET /api/health/Response: Service health status
GET /api/models/status/Response: ML models loading status
POST /api/noise-detection/upload/
Content-Type: multipart/form-data
Body: audio file (WAV, MP3, FLAC, M4A)Response:
{
"noise_level": 65.5,
"noise_source": "traffic",
"health_impact": "moderate",
"confidence": 0.85,
"timestamp": "2025-07-07T20:30:00Z"
}GET /api/noise-detection/history/Response: List of previous analyses
- WAV (recommended)
- MP3
- FLAC
- M4A
Max file size: 50MB
- Noise Level Prediction: Prediksi tingkat dB menggunakan CatBoost Regressor
- Noise Source Classification: Klasifikasi 10 kategori sumber kebisingan
- Health Impact Assessment: Evaluasi dampak kesehatan berdasarkan WHO guidelines
- Optimized Models: Model yang dioptimasi menggunakan Firefly & Fruit Fly algorithms
- MFCC (Mel-frequency cepstral coefficients)
- Spectral features (centroid, bandwidth, rolloff)
- Zero Crossing Rate
- RMS Energy
- Chroma features
- Noise Level: MAE < 3 dB, R² > 0.90
- Source Classification: Accuracy > 88%
- Health Impact: Precision > 85%
noise-pollution-detection/
├── backend/ # Django REST API
│ ├── noise_detection/ # Main Django app
│ │ ├── models.py # Database models
│ │ ├── views.py # API views
│ │ ├── urls.py # URL routing
│ │ └── ml_models.py # ML model loading
│ ├── ml_models/ # Trained ML models (.pkl files)
│ ├── requirements.txt # Python dependencies
│ ├── manage.py # Django management
│ └── .env # Environment variables
├── frontend/ # React TypeScript app
│ ├── src/
│ │ ├── components/ # React components
│ │ │ ├── HomePage.tsx # Main upload interface
│ │ │ ├── HistoryPage.tsx # Analysis history
│ │ │ └── StatusPage.tsx # System status
│ │ ├── services/ # API service layer
│ │ │ └── api.ts # API client
│ │ └── utils/ # Utility functions
│ ├── package.json # Node.js dependencies
│ └── .env # Environment variables
├── .github/ # GitHub templates & workflows
│ ├── workflows/ # CI/CD pipeline
│ └── ISSUE_TEMPLATE/ # Issue templates
├── .gitignore # Git ignore rules
├── .gitattributes # Git attributes
├── README.md # This file
└── CONTRIBUTORS.md # Contributors info
cd backend
# Run development server
python manage.py runserver
# Run database migrations
python manage.py migrate
# Create new migrations
python manage.py makemigrations
# Run tests
python manage.py test
# Django shell
python manage.py shell
# Collect static files (production)
python manage.py collectstaticcd frontend
# Start development server
npm start
# Build for production
npm run build
# Run tests
npm test
# Type checking
npx tsc --noEmit
# Linting
npm run lint --if-present# Code formatting
black backend/
# Import sorting
isort backend/
# Linting
flake8 backend/
# Security check
bandit -r backend/# Type checking
npx tsc --noEmit
# ESLint
npx eslint src/
# Prettier
npx prettier --write src/- Set
DEBUG=Falsein.env - Configure proper
SECRET_KEY - Setup MySQL database with proper credentials
- Run
python manage.py collectstatic - Use production WSGI server (gunicorn, uWSGI)
- Configure reverse proxy (nginx, Apache)
- Run
npm run build - Serve static files from
build/directory - Configure proper API URL in production
.env - Setup CDN for static assets (optional)
# Backend
DEBUG=False
SECRET_KEY=your-secure-production-key
DB_HOST=your-production-db-host
DB_PASSWORD=your-secure-db-password
ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com
# Frontend
REACT_APP_API_URL=https://api.yourdomain.com- Upload Volume: Total files processed
- Processing Time: Average analysis duration
- Model Performance: Prediction accuracy metrics
- Error Rates: API error tracking
- User Activity: Usage patterns and trends
Visit /status untuk melihat:
- ✅ ML model loading status
- 📊 System performance metrics
- 🔧 Health check results
- 📈 Real-time statistics
Kami menyambut kontribusi dari siapa pun! Lihat CONTRIBUTORS.md untuk panduan lengkap.
- Fork repository ini
- Buat feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push ke branch (
git push origin feature/amazing-feature) - Buat Pull Request
- Follow installation steps di atas
- Install pre-commit hooks:
pre-commit install - Run tests sebelum commit
- Follow coding standards (Black, ESLint)
- Port already in use: Ganti port dengan
python manage.py runserver 8001 - Database connection error: Periksa MySQL service dan kredensial di
.env - Missing dependencies: Run
pip install -r requirements.txt
- Node modules error: Hapus
node_modules/dan runnpm install - Port 3000 in use: React akan otomatis suggest port lain
- API connection error: Pastikan backend running di port 8000
- Model loading error: Periksa file
.pkldi folderml_models/ - Prediction error: Pastikan format audio file supported
- Memory error: Model membutuhkan minimal 4GB RAM
- 📝 Documentation: Baca README ini secara lengkap
- 🐛 Bug Reports: Buat issue di GitHub dengan template yang tersedia
- 💡 Feature Requests: Gunakan feature request template
- 💬 Discussions: Join GitHub Discussions untuk tanya jawab
- 📧 Contact: Reach out melalui email atau social media
- Demo: Live Demo (if available)
- API Docs: API Documentation (if available)
- Video Tutorial: YouTube Tutorial (if available)
- CatBoost Team untuk machine learning framework
- Django & React Communities untuk framework yang luar biasa
- Material-UI Team untuk komponen UI yang indah
- Librosa Contributors untuk audio processing library
- Open Source Community untuk tools dan libraries yang digunakan
Made with ❤️ for better environmental monitoring
Sistem ini dikembangkan untuk membantu monitoring dan analisis polusi suara demi lingkungan yang lebih baik.