Computer Vision with Universal Smartphone Microphotography for the Detection of Tooth Tissue Destruction
A deep-learning system that detects and classifies dental caries (tooth tissue destruction) from smartphone microphotography images using YOLOv5. The project demonstrates that low-cost, universally available smartphone microscope attachments — combined with a well-trained object detector — can support early caries diagnosis and tele-dentistry.
- Overview
- Motivation
- Features
- Dataset
- Methodology
- Installation
- Usage
- Project Structure
- Experimental Setup
- Results
- Conclusion
- Contributing
- Citation
- License
- Authors
- References
Dental caries is the most common chronic disease worldwide — more than 9 out of 10 people will experience tooth decay during their lifetime. Conventional detection relies on visual–tactile examination and radiographs, which can miss early lesions. This project applies deep learning to smartphone microphotography of tooth surfaces to automatically localize and classify three stages of tooth tissue destruction.
We train a YOLOv5 object detector on 233 manually labelled microphotographs and evaluate it both with and without data augmentation. After augmentation, the model achieves 78% mAP@0.5, a 14-point improvement over the non-augmented baseline (64% mAP@0.5).
- Prevalence: >50% of 12-year-olds in France and 57% of children aged 6–12 in Canada have at least one tooth decay.
- Accessibility: Smartphones with microscope attachments are lighter, more portable and cheaper than dedicated dental cameras, making them ideal for tele-dentistry and rural screening.
- Early detection: Catching caries at the visible change without cavitation stage prevents progression to cavitated lesions that require invasive treatment.
- Automated detection and classification of three caries stages from a single microphotograph
- YOLOv5-based deep neural network with Leaky ReLU hidden activations and Sigmoid detection head
- Configurable data-augmentation pipeline (blur, CLAHE, gray, brightness/contrast jitter, compression jitter)
- Reproducible training/validation split (90/10) with YOLO-format bounding-box labels
- Evaluation suite: confusion matrix, precision/recall/F1 curves, per-class and overall mAP
- Lightweight enough for inference on commodity GPUs
| Property | Value |
|---|---|
| Source | Teaching hospital, Malaysia (excised permanent human teeth) |
| Capture device | Samsung Galaxy S20 5G with attached microscope |
| Raw images | 300 |
| After interrater agreement (κ = 1.00 by 3 dentists) | 233 |
| Label format | YOLO bounding boxes (annotated in LabelImg) |
| Train / Val split | 90% / 10% |
- Visible change without cavitation
- Visible change with microcavitation
- Visible change with cavitation
Patient demographics and treatment histories were withheld to protect privacy.
We use a deep neural network with multiple hidden layers — ideal for complex visual data — so each layer can learn features at a different level of abstraction without hand-crafted feature extractors.
-
Backbone / detector: YOLOv5
-
Hidden-layer activation — Leaky ReLU:
$$f(x) = \mathbb{1}(x < 0)(\alpha x) + \mathbb{1}(x \ge 0)(x)$$ Allows a small non-zero gradient when the unit is saturated, avoiding dead neurons.
-
Detection-head activation — Sigmoid:
$$S(x) = \frac{1}{1 + e^{-x}}$$ Maps outputs into the (0, 1) range for objectness / class confidence.
Applied in the second training stage to improve generalization:
- Blurring
- Contrast Limited Adaptive Histogram Equalization (CLAHE)
- Gray coloring
- Brightness adjustment
- Contrast adjustment
- Reduced image compression
Requires Python 3.10+ and a CUDA-capable GPU (recommended).
git clone https://github.com/<YOUR-USERNAME>/<YOUR-REPO-NAME>.git
cd <YOUR-REPO-NAME>
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtpython train.py \
--data configs/tooth_decay.yaml \
--weights yolov5s.pt \
--img 640 --batch 16 --epochs 400python detect.py \
--weights checkpoints/best.pt \
--source path/to/image_or_folder \
--conf 0.25python evaluate.py \
--weights checkpoints/best.pt \
--data configs/tooth_decay.yaml.
├── configs/ # YOLO data + hyperparameter configs
├── data/ # Dataset (images + YOLO labels)
│ ├── images/{train,val}
│ └── labels/{train,val}
├── models/ # Model definitions
├── notebooks/ # Exploration & analysis notebooks
├── scripts/ # Helper scripts (augmentation, preprocessing)
├── src/ # Core source code
├── tests/ # Unit tests
├── checkpoints/ # Saved model weights
├── requirements.txt
├── train.py
├── detect.py
├── evaluate.py
├── LICENSE
├── CITATION.cff
└── README.md
- Model: YOLOv5
- Input resolution: 640 × 640
- Batch size: 16
- Epochs: 400 (best checkpoint at epoch 369)
- Optimizer / schedule: default YOLOv5 (SGD with warmup + cosine LR)
- Loss: YOLOv5 composite (box / objectness / class)
- Hardware: CUDA GPU
- Labelling tool: LabelImg (YOLOv4-compatible format)
- Train / Val split: 90% / 10%
| Metric | Value |
|---|---|
| Mean Average Precision (mAP@0.5) | 64% |
| Precision | 71% |
| Recall | 56% |
| Best epoch | 369 / 400 |
Per-class mAP@0.5
| Class | mAP@0.5 |
|---|---|
| Visible change without cavitation | 0.475 |
| Visible change with microcavitation | 0.850 |
| Visible change with cavitation | 0.606 |
| All classes | 0.644 |
Confusion matrix (normalized)
| True \ Predicted | No cavitation | Microcavitation | Cavitation | background FP |
|---|---|---|---|---|
| Visible change without cavitation | 0.50 | 0.22 | — | 0.50 |
| Visible change with microcavitation | — | 0.78 | 0.30 | 0.50 |
| Visible change with cavitation | — | — | 0.50 | — |
| background FN | 0.50 | — | — | — |
Applying the augmentation pipeline (blur, CLAHE, gray, brightness, contrast, compression jitter) lifted overall performance substantially:
| Metric | Without Aug. | With Aug. | Δ |
|---|---|---|---|
| mAP@0.5 (all classes) | 64% | 78% | +14 pp |
Per-class correct-classification rates after augmentation:
- Visible change without cavitation: 47%
- Visible change with microcavitation: 78%
- Visible change with cavitation: 50%
Precision, recall, and F1 curves were generated for both phases to characterize the precision–recall tradeoff.
This work shows that YOLOv5 trained on smartphone microphotographs can detect and classify three stages of tooth tissue destruction at clinically interesting accuracy levels, especially after data augmentation (78% mAP@0.5). The approach is innovative in pairing universally available smartphone microscopy with a deep object detector — a combination that lowers the cost of caries screening and is well-suited to tele-dentistry. Future work includes expanding the dataset beyond 233 images, exploring newer YOLO variants, and validating on multi-device captures.
Contributions are welcome.
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m "Add your feature" - Push the branch:
git push origin feature/your-feature - Open a Pull Request
Please run linting and tests before submitting.
If you use this work, please cite:
@misc{nafis_ayan_osman_2026_toothdecay,
title = {Computer vision with universal smartphone microphotography in the detection of tooth tissue destruction},
author = {Nafis, Muntasir Md and Ayan, Sadiqun Nur and Osman, Faisal},
year = {2026},
howpublished = {\url{https://github.com/<YOUR-USERNAME>/<YOUR-REPO-NAME>}}
}See CITATION.cff for the machine-readable version.
This project is licensed under the MIT License — see LICENSE for details.
- Muntasir Md Nafis
- Sadiqun Nur Ayan
- Faisal Osman
- The teaching hospital in Malaysia that provided the microphotography dataset
- The three dentists who labelled and verified the images
- The open-source community behind YOLOv5, PyTorch, and LabelImg
- M. B. Diniz, J. Rodrigues, and A. Lussi, "Traditional and novel caries detection methods," Contemporary approach to dental caries, pp. 105–128, 2012.
- S. Kositbowornchai et al., "An artificial neural network for detection of simulated dental caries," International Journal of Computer Assisted Radiology and Surgery, vol. 1, no. 2, pp. 91–96, 2006.
- R. Siva Kumar, "Identification of early caries in human tooth using histogram and power spectral analysis," International Journal of Biomedical Engineering and Technology, vol. 1, no. 4, pp. 465–472, 2008.
- E. D. Berdouses et al., "A computer-aided automated methodology for the detection and classification of occlusal caries from photographic color images," Computers in Biology and Medicine, vol. 62, pp. 119–135, 2015.
- N. Srivastava et al., "Dropout: a simple way to prevent neural networks from overfitting," Journal of Machine Learning Research, vol. 15, no. 1, pp. 1929–1958, 2014.
- D. Kumar, A. Wong, and D. A. Clausi, "Lung nodule classification using deep features in CT images," in 2015 12th Conference on Computer and Robot Vision, IEEE, pp. 133–138, 2015.