# Rwanda Water Meter Reading System
An AI-based computer vision project for automatic water meter detection and reading using YOLO object detection.
This project includes:
- dataset collection
- image labeling
- dataset preparation
- YOLO training
- retraining
- prediction
- reading reconstruction
- a Flask REST API for serving predictions
- a SQLite database recording every reading
- a lightweight web UI for field agents (upload + history)
The system is trained to detect:
- water meter
- reading window
- digits `0–9`
- unclear digits (`unknown`)
---
# Features
The project provides tools for:
- collecting water meter datasets
- labeling water meter images
- rotating and cleaning images
- validating YOLO datasets
- preparing train/val/test datasets
- training YOLO models
- retraining from latest best model
- predicting on test images
- reconstructing final meter readings
---
# Project Structure
```text
rwanda-water-meter-reading-system/
├── raw_dataset/
│ ├── images/
│ └── labels/
│
├── dataset/
│ ├── images/
│ │ ├── train/
│ │ ├── val/
│ │ └── test/
│ │
│ ├── labels/
│ │ ├── train/
│ │ ├── val/
│ │ └── test/
│ │
│ ├── reports/
│ └── data.yaml
│
├── 01_label_images.py # labeling GUI (PySide6)
├── 02_prepare_dataset.py # build train/val/test splits + data.yaml
├── 03_train.py # train a YOLO model
├── 04_predict.py # inference + reading reconstruction (single source of truth)
├── 05_retrain.py # continue training from latest best.pt
│
├── app.py # Flask API + web UI
├── database.py # SQLite persistence for readings
├── templates/ # index.html, history.html
├── static/ # style.css, script.js, history.js
│
├── runs/detect/training_runs/ # YOLO training output (best.pt lives here)
├── prediction_outputs/
├── logs/ # app.log (created at runtime)
├── wmrs.db # SQLite database (c …