Spaces:
Sleeping
Sleeping
| title: Vehicle Detection Tracking Counting | |
| emoji: "\U0001F697" | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: streamlit | |
| sdk_version: "1.28.0" | |
| app_file: app.py | |
| pinned: false | |
| # Vehicle Detection, Tracking & Counting | |
| Proyek portofolio AI Engineer untuk deteksi, tracking, dan penghitungan kendaraan secara otomatis dari video menggunakan **RT-DETR** sebagai model deteksi dan **ByteTrack** sebagai multi-object tracker. | |
| ## Fitur | |
| - **Object Detection**: Deteksi kendaraan menggunakan RT-DETR yang sudah di-fine-tune pada dataset UA-DETRAC | |
| - **Object Tracking**: Multi-object tracking dengan ByteTrack, setiap kendaraan mendapat ID unik | |
| - **Vehicle Counting**: Dua metode counting tersedia: | |
| - Virtual Line Counting: hitung kendaraan yang melewati garis virtual | |
| - Polygon Region Counting: hitung kendaraan yang masuk area tertentu | |
| - **Dashboard**: Statistik real-time, FPS, progress bar | |
| - **Export**: Download video hasil dan CSV hasil counting | |
| ## Tech Stack | |
| | Komponen | Teknologi | | |
| |---|---| | |
| | Object Detection | RT-DETR (Ultralytics) | | |
| | Object Tracking | ByteTrack (custom implementation) | | |
| | Video Processing | OpenCV | | |
| | Web App | Streamlit | | |
| | Deep Learning | PyTorch | | |
| | Deployment | Hugging Face Spaces | | |
| ## Struktur Proyek | |
| ``` | |
| vehicle-counting-rtdetr/ | |
| βββ notebooks/ | |
| β βββ kaggle_training.ipynb # Notebook training di Kaggle | |
| βββ core/ | |
| β βββ detector.py # RT-DETR inference wrapper | |
| β βββ tracker.py # ByteTrack implementation | |
| β βββ counter.py # Virtual line & polygon counting | |
| β βββ exporter.py # CSV export utilities | |
| βββ ui/ | |
| β βββ sidebar.py # Streamlit sidebar components | |
| βββ models/ | |
| β βββ best.pt # Model hasil fine-tuning (dari Kaggle) | |
| βββ outputs/ # Folder output video & CSV | |
| βββ app.py # Main Streamlit application | |
| βββ utils.py # Drawing & helper functions | |
| βββ requirements.txt | |
| βββ packages.txt | |
| βββ README.md | |
| ``` | |
| ## Setup | |
| ### Training (Kaggle) | |
| 1. Upload notebook `notebooks/kaggle_training.ipynb` ke Kaggle | |
| 2. Aktifkan GPU (P100 atau T4) | |
| 3. Jalankan semua cell | |
| 4. Download file `best.pt` dari output Kaggle | |
| 5. Letakkan `best.pt` di folder `models/` | |
| ### Local Development | |
| ```bash | |
| # install dependencies | |
| pip install -r requirements.txt | |
| # jalankan app | |
| streamlit run app.py | |
| ``` | |
| ### Deploy ke Hugging Face Spaces | |
| 1. Buat repository baru di Hugging Face Spaces (pilih Streamlit SDK) | |
| 2. Upload semua file dari repository ini | |
| 3. Pastikan `best.pt` ada di folder `models/` | |
| 4. Spaces akan otomatis build dan deploy | |
| ## Cara Pakai | |
| 1. Buka aplikasi | |
| 2. Upload video (.mp4 / .avi) di sidebar | |
| 3. Atur confidence threshold | |
| 4. Pilih metode counting (Virtual Line atau Polygon Region) | |
| 5. Klik "Mulai Proses" | |
| 6. Tunggu sampai selesai | |
| 7. Download hasil video dan CSV | |
| ## Model Performance | |
| Hasil evaluasi model RT-DETR setelah fine-tuning pada dataset kendaraan: | |
| | Metric | Nilai | | |
| |---|---| | |
| | mAP50 | - | | |
| | mAP50-95 | - | | |
| | Precision | - | | |
| | Recall | - | | |
| | F1-Score | - | | |
| *Tabel ini akan diupdate setelah training selesai di Kaggle.* | |
| ## Dataset | |
| **UA-DETRAC Dataset 10K** dari Roboflow Universe: | |
| - Link: https://universe.roboflow.com/rjacaac1/ua-detrac-dataset-10k | |
| - Format: YOLOv8 (kompatibel dengan RT-DETR Ultralytics) | |
| - Nama kelas dibaca otomatis dari `data.yaml` dataset | |
| ## Referensi | |
| - [RT-DETR Paper](https://arxiv.org/abs/2304.08069) - DETRs Beat YOLOs on Real-time Object Detection | |
| - [ByteTrack Paper](https://arxiv.org/abs/2110.06864) - Multi-Object Tracking by Associating Every Detection Box | |
| - [Ultralytics](https://docs.ultralytics.com/) - YOLO & RT-DETR Framework | |
| - [Roboflow](https://roboflow.com/) - Dataset Management | |
| ## License | |
| MIT License | |