|
|
--- |
|
|
license: mit |
|
|
tags: |
|
|
- image-classification |
|
|
- pytorch |
|
|
- resnet |
|
|
- medical |
|
|
- dental |
|
|
- orthodontics |
|
|
datasets: |
|
|
- custom |
|
|
metrics: |
|
|
- accuracy |
|
|
pipeline_tag: image-classification |
|
|
--- |
|
|
|
|
|
# Orthodontic Condition Classifier |
|
|
|
|
|
A ResNet18-based image classification model trained to detect orthodontic conditions from dental photos. |
|
|
|
|
|
## Model Details |
|
|
|
|
|
- **Architecture**: ResNet18 |
|
|
- **Input Size**: 512x512 RGB images |
|
|
- **Output**: 8 orthodontic condition classes |
|
|
- **Test Accuracy**: 72.73% |
|
|
|
|
|
## Classes |
|
|
|
|
|
1. Crossbite |
|
|
2. Crowding |
|
|
3. Deepbite |
|
|
4. No Treatment Needed |
|
|
5. Open Bite |
|
|
6. Overbite |
|
|
7. Spacing |
|
|
8. Underbite |
|
|
|
|
|
## Usage |
|
|
|
|
|
```python |
|
|
import torch |
|
|
from torchvision import transforms, models |
|
|
from PIL import Image |
|
|
|
|
|
# Load model |
|
|
model = models.resnet18(weights=None) |
|
|
model.fc = torch.nn.Linear(model.fc.in_features, 8) |
|
|
state_dict = torch.load("pytorch_model.pth", map_location="cpu") |
|
|
model.load_state_dict(state_dict) |
|
|
model.eval() |
|
|
|
|
|
# Preprocess image |
|
|
transform = transforms.Compose([ |
|
|
transforms.Resize((512, 512)), |
|
|
transforms.ToTensor(), |
|
|
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]) |
|
|
]) |
|
|
|
|
|
image = Image.open("dental_photo.jpg").convert("RGB") |
|
|
input_tensor = transform(image).unsqueeze(0) |
|
|
|
|
|
# Predict |
|
|
with torch.no_grad(): |
|
|
outputs = model(input_tensor) |
|
|
probabilities = torch.nn.functional.softmax(outputs, dim=1) |
|
|
predicted_class = torch.argmax(probabilities, dim=1).item() |
|
|
``` |
|
|
|
|
|
## Training Data |
|
|
|
|
|
Trained on a custom dataset of dental photographs labeled by orthodontic condition. |
|
|
|
|
|
## Limitations |
|
|
|
|
|
- This model is for screening purposes only and should not replace professional orthodontic evaluation |
|
|
- Accuracy may vary based on image quality and lighting conditions |
|
|
- Best results with clear, well-lit frontal photos of teeth |
|
|
|
|
|
## License |
|
|
|
|
|
MIT License |
|
|
|