|
1 | | -# 🚧 MLOps Pothole Detection - YOLOv8 |
| 1 | +# MLOps Pothole Detection System |
| 2 | +## Implementasi YOLOv8 dengan End-to-End MLOps Pipeline |
2 | 3 |
|
3 | | -End-to-end MLOps pipeline for pothole detection using YOLOv8n and YOLOv8s with complete CI/CD, experiment tracking, and monitoring. |
| 4 | +--- |
| 5 | + |
| 6 | +## 👥 Tim Pengembang |
4 | 7 |
|
5 | | -# Team |
6 | 8 | - Member 1: Feryadi Yulius (122450087) |
7 | 9 | - Member 2: Syadza Puspadari Azhar (122450072) |
8 | | -- Member 3: Dinda Nababan 1224500 |
| 10 | +- Member 3: Dinda Nababan (122450120) |
9 | 11 | - Member 4: Alyya 1224500 |
| 12 | +--- |
| 13 | + |
| 14 | +## 📋 Latar Belakang |
| 15 | + |
| 16 | +### Permasalahan |
| 17 | +- Kerusakan jalan (pothole) menimbulkan risiko kecelakaan |
| 18 | +- Deteksi manual tidak efisien dan memakan waktu |
| 19 | +- Perlu sistem otomatis untuk deteksi real-time |
| 20 | + |
| 21 | +### Solusi |
| 22 | +- Implementasi Deep Learning dengan YOLOv8 untuk deteksi pothole |
| 23 | +- Pipeline MLOps untuk automasi training hingga deployment |
| 24 | +- Monitoring dan tracking untuk menjaga kualitas model |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## 🎯 Tujuan Proyek |
| 29 | + |
| 30 | +### Objektif Utama |
| 31 | +1. **Data Pipeline** → Automasi pengolahan data |
| 32 | +2. **Model Training** → Training dengan experiment tracking |
| 33 | +3. **Model Evaluation** → Validasi performa model |
| 34 | +4. **Deployment** → REST API & Container Docker |
| 35 | +5. **Monitoring** → Tracking performa production |
| 36 | +6. **CI/CD** → Automasi testing dan deployment |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## 🏗️ Arsitektur Sistem |
| 41 | + |
| 42 | +### Komponen Utama |
| 43 | +``` |
| 44 | +┌─────────────┐ ┌──────────────┐ ┌─────────────┐ |
| 45 | +│ Dataset │ --> │ Training │ --> │ MLflow │ |
| 46 | +│ Validation │ │ Pipeline │ │ Tracking │ |
| 47 | +└─────────────┘ └──────────────┘ └─────────────┘ |
| 48 | + │ |
| 49 | + ▼ |
| 50 | +┌─────────────┐ ┌──────────────┐ ┌─────────────┐ |
| 51 | +│ User UI │ <-- │ FastAPI │ <-- │ Model │ |
| 52 | +│ (Streamlit)│ │ Server │ │ Registry │ |
| 53 | +└─────────────┘ └──────────────┘ └─────────────┘ |
| 54 | + │ |
| 55 | + ▼ |
| 56 | + ┌──────────────┐ |
| 57 | + │ Monitoring │ |
| 58 | + │ System │ |
| 59 | + └──────────────┘ |
| 60 | +``` |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## 🔧 Teknologi yang Digunakan |
| 65 | + |
| 66 | +### Machine Learning |
| 67 | +- **YOLOv8** → Model object detection |
| 68 | +- **Ultralytics** → Framework training |
| 69 | +- **PyTorch** → Deep learning engine |
| 70 | + |
| 71 | +### MLOps Tools |
| 72 | +- **MLflow** → Experiment tracking & model registry |
| 73 | +- **Optuna** → Hyperparameter tuning |
| 74 | +- **DVC** → Data version control |
| 75 | + |
| 76 | +### Backend & API |
| 77 | +- **FastAPI** → REST API server |
| 78 | +- **Streamlit** → User interface |
| 79 | +- **Docker** → Containerization |
| 80 | + |
| 81 | +### CI/CD & Testing |
| 82 | +- **GitHub Actions** → Automation pipeline |
| 83 | +- **Pytest** → Unit testing |
| 84 | +- **Pre-commit** → Code quality |
| 85 | + |
| 86 | +--- |
| 87 | + |
| 88 | +## 📊 Dataset |
| 89 | + |
| 90 | +### Informasi Dataset |
| 91 | +- **Sumber**: Roboflow Pothole Detection Dataset |
| 92 | +- **Total Images**: 665 gambar |
| 93 | +- **Train**: 477 gambar (72%) |
| 94 | +- **Validation**: 143 gambar (21%) |
| 95 | +- **Test**: 45 gambar (7%) |
| 96 | +- **Classes**: 1 (Pothole) |
| 97 | + |
| 98 | +### Preprocessing |
| 99 | +- Resize: 640x640 |
| 100 | +- Normalization |
| 101 | +- Augmentation: flip, rotation, brightness |
| 102 | + |
| 103 | +--- |
| 104 | + |
| 105 | +## 🚀 Pipeline MLOps |
| 106 | + |
| 107 | +### 1. Data Ingestion |
| 108 | +- Validasi struktur dataset |
| 109 | +- Exploratory Data Analysis (EDA) |
| 110 | +- Quality checks |
| 111 | + |
| 112 | +### 2. Training Pipeline |
| 113 | +- Multi-model training (YOLOv8n, YOLOv8s) |
| 114 | +- Hyperparameter tuning dengan Optuna |
| 115 | +- Experiment tracking dengan MLflow |
| 116 | +- Model versioning |
| 117 | + |
| 118 | +### 3. Evaluation |
| 119 | +- **Metrics**: Precision, Recall, F1-Score, mAP |
| 120 | +- Confusion matrix |
| 121 | +- Test set evaluation |
| 122 | +- Model comparison |
| 123 | + |
| 124 | +### 4. Deployment |
| 125 | +- Model serving via FastAPI |
| 126 | +- Docker containerization |
| 127 | +- Multi-model support |
| 128 | +- Load balancing |
| 129 | + |
| 130 | +### 5. Monitoring |
| 131 | +- Inference latency tracking |
| 132 | +- Error rate monitoring |
| 133 | +- Input drift detection |
| 134 | +- Performance metrics |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +## 💻 Implementasi Teknis |
| 139 | + |
| 140 | +### Model Training |
| 141 | +```python |
| 142 | +# CLI command |
| 143 | +python cli.py train --model yolov8n --epochs 100 |
| 144 | + |
| 145 | +# Hyperparameter tuning |
| 146 | +python cli.py tune --n-trials 50 |
| 147 | +``` |
| 148 | + |
| 149 | +### Model Serving |
| 150 | +```python |
| 151 | +# Start API server |
| 152 | +python cli.py serve |
| 153 | + |
| 154 | +# Access API: http://localhost:8000 |
| 155 | +``` |
| 156 | + |
| 157 | +### Docker Deployment |
| 158 | +```bash |
| 159 | +docker-compose up --build |
| 160 | + |
| 161 | +# Services: |
| 162 | +# - MLflow: http://localhost:5000 |
| 163 | +# - FastAPI: http://localhost:8000 |
| 164 | +# - User UI: http://localhost:8501 |
| 165 | +# - Admin UI: http://localhost:8502 |
| 166 | +``` |
| 167 | + |
| 168 | +--- |
| 169 | + |
| 170 | + |
| 171 | +## 🎨 User Interface |
| 172 | + |
| 173 | +### User App (Streamlit) |
| 174 | +- Upload gambar untuk deteksi |
| 175 | +- Real-time inference |
| 176 | +- Visualisasi hasil deteksi |
| 177 | +- Download hasil |
| 178 | + |
| 179 | +### Admin App |
| 180 | +- Model management |
| 181 | +- Performance monitoring |
| 182 | +- Experiment comparison |
| 183 | +- System health check |
| 184 | + |
| 185 | +--- |
| 186 | + |
| 187 | +## ✅ Testing & Quality Assurance |
| 188 | + |
| 189 | +### Test Coverage |
| 190 | +- Unit tests: 85% |
| 191 | +- Integration tests |
| 192 | +- API endpoint tests |
| 193 | +- Data validation tests |
| 194 | + |
| 195 | +### CI/CD Pipeline |
| 196 | +``` |
| 197 | +Push → Tests → Build → Deploy |
| 198 | + ↓ ↓ ↓ ↓ |
| 199 | +Code Pytest Docker Production |
| 200 | +``` |
| 201 | + |
| 202 | +--- |
| 203 | + |
| 204 | +## 🔍 Monitoring & Observability |
| 205 | + |
| 206 | +### Metrics Tracked |
| 207 | +1. **Model Performance** |
| 208 | + - Accuracy, Precision, Recall |
| 209 | + - Inference latency |
| 210 | + |
| 211 | +2. **System Metrics** |
| 212 | + - API response time |
| 213 | + - Error rates |
| 214 | + - Resource usage |
| 215 | + |
| 216 | +3. **Data Quality** |
| 217 | + - Input distribution |
| 218 | + - Drift detection |
| 219 | + |
| 220 | +--- |
| 221 | + |
| 222 | +--- |
| 223 | + |
| 224 | +## 🎓 Lessons Learned |
| 225 | + |
| 226 | +### Technical |
| 227 | +- Importance of experiment tracking |
| 228 | +- Docker containerization benefits |
| 229 | +- CI/CD automation value |
| 230 | + |
| 231 | +### MLOps Best Practices |
| 232 | +- Version everything (code, data, model) |
| 233 | +- Monitor continuously |
| 234 | +- Automate repetitive tasks |
| 235 | +- Test thoroughly |
| 236 | + |
| 237 | +--- |
| 238 | + |
| 239 | +## 🔮 Future Improvements |
| 240 | + |
| 241 | +### Short Term |
| 242 | +- [ ] Model quantization untuk inference lebih cepat |
| 243 | +- [ ] Add more augmentation techniques |
| 244 | +- [ ] Improve UI/UX |
| 245 | + |
| 246 | +### Long Term |
| 247 | +- [ ] Multi-class detection (berbagai jenis kerusakan) |
| 248 | +- [ ] Edge deployment (mobile/embedded) |
| 249 | +- [ ] Real-time video processing |
| 250 | +- [ ] Integration dengan GIS system |
| 251 | + |
| 252 | +--- |
| 253 | + |
| 254 | +## 📚 Referensi |
| 255 | + |
| 256 | +1. **YOLOv8 Documentation**: https://docs.ultralytics.com/ |
| 257 | +2. **MLflow**: https://mlflow.org/ |
| 258 | +3. **Base Project**: https://github.com/prsdm/mlops-project |
| 259 | +4. **FastAPI**: https://fastapi.tiangolo.com/ |
| 260 | + |
| 261 | +--- |
10 | 262 |
|
11 | | -## 📚 Documentation |
| 263 | +## 📞 Kontak |
12 | 264 |
|
13 | | -**→ [START HERE: Step-by-Step Guide](STEP_BY_STEP.md)** ⭐ |
| 265 | +**Repository**: https://github.com/sains-data/Mlops_RC_04 |
14 | 266 |
|
15 | | -## 🎯 Project Objectives |
16 | 267 |
|
17 | | -- ✅ Build end-to-end MLOps pipeline for pothole detection |
18 | | -- ✅ Implement CI/CD for Machine Learning |
19 | | -- ✅ Experiment tracking and model monitoring |
20 | | -- ✅ Provide User and Admin UI |
| 268 | +--- |
21 | 269 |
|
22 | 270 | ## 🏗️ Project Structure |
23 | 271 |
|
|
0 commit comments