# Rwanda Water Meter Reading System
Automatic water meter reading using a **two-model YOLOv8 pipeline**. A digit-detection model reads the digits; an OBB (oriented bounding box) model corrects for meter tilt before the digit model runs.
```
Photo → OBB model → Deskew → Digit model → Reading
```
---
## Project structure
```
rwanda-water-meter-reading-system/
│
├── 01_label_images.py GUI labeler — draw bounding boxes for digits, meter, window
├── label_window.py OBB labeler — draw rotated window box + capture tilt angle
│
├── 02_prepare_dataset.py Build train/val/test dataset from raw labeled images
├── 03_train.py Train the digit-detection model (YOLOv8-detect)
├── 04_predict.py Batch inference on the test set
├── 05_retrain.py Continue training from the latest checkpoint
├── 06_prepare_obb_dataset.py Build OBB train/val dataset from rotated-window images
├── 07_train_obb.py Train the window-rotation model (YOLOv8-OBB)
├── predict_and_read.py Single-image or folder inference with annotated output
│
├── WaterMeter_Pipeline_v3.ipynb Colab notebook — calls the scripts above
├── requirements.txt
└── README.md
```
---
## Quickstart
### 1. Install dependencies
```bash
pip install -r requirements.txt
```
Or manually:
```bash
pip install ultralytics opencv-python PySide6
```
### 2. Label images
**Digit labels** (axis-aligned boxes):
```bash
python3 01_label_images.py
```
Classes: `meter`, `window`, `0`–`9`, `unknown`.
**OBB labels** (rotated window + tilt angle):
```bash
python3 label_window.py
```
| Key | Action |
|-----|--------|
| `W` | Draw window OBB |
| `M` | Draw meter box |
| `0`–`9` | Draw digit box |
| `U` | Mark unknown digit |
| `N` / `P` | Next / previous image |
| `S` / `Ctrl+S` | Save labels |
| `Delete` | Remove selected box |
| `Ctrl+Z` | Undo |
| `Shift+Scroll` | Fine rotation |
| `Ctrl+Left/Right` | Rotate ±15° |
| `Ctrl+R` | Enter custo …