Beni4/rwanda-water-meter-reading-yolov8n
Rwanda Water Meter Reading YOLOv8n
This repository contains the selected model for the Rwanda Water Meter Reading System MVP. It detects the complete meter, the reading window, and digits 0-9. The application keeps digits inside the best window and orders them from left to right to construct a reading.
Live demonstration
Test the model without installing anything:
https://huggingface.co/spaces/Beni4/rwanda-water-meter-reading-demo
Validation performance
Validation was reproduced with Ultralytics 8.4.49 at an image size of 640 on 249 validation images containing 1,589 labeled objects. Class-by-class results are available in perclassmetrics.csv, and validation_metrics.png provides assessment evidence.
Classes
The class order is also stored in classes.yaml.
Unclear digit policy
u is not a trained object class. During post-processing, a detected digit with confidence below 0.40 is returned as u. The same result can be inserted when digit spacing indicates a likely missing position. This prevents uncertain digits from being presented as reliable readings.
Files
- best.pt: original evaluated Ultralytics YOLOv8n checkpoint.
- best.onnx: browser and cross-platform export of best.pt.
- reading_postprocess.py: window filtering and reading reconstruction.
- classes.yaml: authoritative class order and u policy.
- training_args.yaml: parameters from the selected training experiment.
- model_metadata.yaml: dataset, training, and validation provenance.
- metrics.json: overall validation metrics.
- perclassmetrics.csv: class-by-class validation metrics.
- validation_metrics.png: validation evidence.
- CHECKSUMS.sha256: SHA-256 identities for both model artifacts.
Python usage
Install the same Ultralytics release used for validation:
~~~bash pip install ultralytics==8.4.49 ~~~
Run object detection:
~~~python from ultralytics import YOLO
model = YOLO("best.pt") results = model.predict( source="water_meter.jpg", imgsz=640, conf=0.03, )
for result in results: print(result.boxes) ~~~
Candidate confidence 0.03 retains weak digit candidates for reading post-processing. It is intentionally different from the 0.40 threshold used to convert an uncertain selected digit to u.
Training data
The selected run used 1,248 images: 329 teacher-provided meter images and a limited 919-image Roboflow digit subset. The private training images are not redistributed in this model repository. Users must verify ownership and source licenses before reusing or publishing the original datasets.
Limitations
- Performance can decrease with blur, glare, severe perspective, occlusion, or very small digits.
- Inverted images can change the semantic meaning of digits such as 6 and 9.
- The ONNX export can move borderline confidence values across the u threshold; the submitted assessment checkpoint is best.pt.
- A predicted reading should be reviewed whenever it contains u.
