This repository contains the Python implementation of the Insights into Predicting Tooth Extraction from Panoramic Dental Images: Artificial Intelligence vs. Dentists Paper.
The different models depicted in the image above that were obtained from training with different image % margins can be found under models. The 2% margin model performed best during testing and should be used to perform inference.
First, you will need to install CUDA on your machine. This code has been developed with Python 3.11 and CUDA 11.8.
python -m venv panaix
- Activate the virtual environment:
- On Windows:
panaix/Scripts/activate
- On Linux:
source panaix/bin/activate
- On Windows:
- Install an appropriate version of torch, torchvision, and CUDA.
pip install -r requirements.txt
# Example usage:
weights_path = '/.../model.pth'
image_path = '/.../image.png'
train_dataset_path = '/.../train_dir'
val_dataset_path = '/.../val_dir'
test_dataset_path = '/.../test_dir'
# Create an instance of the PAN_AI_X toothpredictor
tooth_predictor = PAN_AI_X(weights_path)
# Use predict method for inference
prediction = tooth_predictor.predict(image_path)
print(prediction)
# Use train method for training
tooth_predictor.train(train_dataset_path, val_dataset_path, test_dataset_path)
Datasets must follow the regular pytorch training guidelines for simple classification tasks. Images for each class therefore have to be stored in a seperate directory. The structure of the training datasets should look similar to this:
datasets/
├── train
│ ├── 00WP
│ │ ├── preserve0001.png
│ │ ├── ...
│ └── 01EX
│ ├── extract0001.png
│ ├── ...
├── val
│ ├── 00WP
│ │ ├── preserve0900.png
│ │ ├── ...
│ └── 01EX
│ ├── extract0100.png
│ ├── ...
└── test
├── 00WP
│ ├── preserve1000.png
│ ├── ...
└── 01EX
├── extract0110.png
├── ...
An example image for an extracted tooth would be this tooth that is also shown in the figures of our publication.
@article{pan-ai-x2024,
title={Insights into Predicting Tooth Extraction from Panoramic Dental Images: Artificial Intelligence vs. Dentists},
journal = {Clinical Oral Investigations},
pages = {381},
volume = {28},
number = {7},
issn = {1436-3771},
author={Ila Motmaen and Kunpeng Xie and Leon Schönbrunn and Jeff Berens and Kim Grunert and Anna Maria Plum and Johannes Raufeisen and Andre Ferreira and Alexander Hermans and Jan Egger and Frank Hölzle and Daniel Truhn and Behrus Puladi},
year={2024},
doi = {https://doi.org/10.1007/s00784-024-05781-5},
url = {https://link.springer.com/article/10.1007/s00784-024-05781-5}
}