Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- image-classification
|
| 5 |
+
- pytorch
|
| 6 |
+
- resnet
|
| 7 |
+
- medical
|
| 8 |
+
- dental
|
| 9 |
+
- orthodontics
|
| 10 |
+
datasets:
|
| 11 |
+
- custom
|
| 12 |
+
metrics:
|
| 13 |
+
- accuracy
|
| 14 |
+
pipeline_tag: image-classification
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Orthodontic Condition Classifier
|
| 18 |
+
|
| 19 |
+
A ResNet18-based image classification model trained to detect orthodontic conditions from dental photos.
|
| 20 |
+
|
| 21 |
+
## Model Details
|
| 22 |
+
|
| 23 |
+
- **Architecture**: ResNet18
|
| 24 |
+
- **Input Size**: 512x512 RGB images
|
| 25 |
+
- **Output**: 8 orthodontic condition classes
|
| 26 |
+
- **Test Accuracy**: 72.73%
|
| 27 |
+
|
| 28 |
+
## Classes
|
| 29 |
+
|
| 30 |
+
1. Crossbite
|
| 31 |
+
2. Crowding
|
| 32 |
+
3. Deepbite
|
| 33 |
+
4. No Treatment Needed
|
| 34 |
+
5. Open Bite
|
| 35 |
+
6. Overbite
|
| 36 |
+
7. Spacing
|
| 37 |
+
8. Underbite
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import torch
|
| 43 |
+
from torchvision import transforms, models
|
| 44 |
+
from PIL import Image
|
| 45 |
+
|
| 46 |
+
# Load model
|
| 47 |
+
model = models.resnet18(weights=None)
|
| 48 |
+
model.fc = torch.nn.Linear(model.fc.in_features, 8)
|
| 49 |
+
state_dict = torch.load("pytorch_model.pth", map_location="cpu")
|
| 50 |
+
model.load_state_dict(state_dict)
|
| 51 |
+
model.eval()
|
| 52 |
+
|
| 53 |
+
# Preprocess image
|
| 54 |
+
transform = transforms.Compose([
|
| 55 |
+
transforms.Resize((512, 512)),
|
| 56 |
+
transforms.ToTensor(),
|
| 57 |
+
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
|
| 58 |
+
])
|
| 59 |
+
|
| 60 |
+
image = Image.open("dental_photo.jpg").convert("RGB")
|
| 61 |
+
input_tensor = transform(image).unsqueeze(0)
|
| 62 |
+
|
| 63 |
+
# Predict
|
| 64 |
+
with torch.no_grad():
|
| 65 |
+
outputs = model(input_tensor)
|
| 66 |
+
probabilities = torch.nn.functional.softmax(outputs, dim=1)
|
| 67 |
+
predicted_class = torch.argmax(probabilities, dim=1).item()
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
## Training Data
|
| 71 |
+
|
| 72 |
+
Trained on a custom dataset of dental photographs labeled by orthodontic condition.
|
| 73 |
+
|
| 74 |
+
## Limitations
|
| 75 |
+
|
| 76 |
+
- This model is for screening purposes only and should not replace professional orthodontic evaluation
|
| 77 |
+
- Accuracy may vary based on image quality and lighting conditions
|
| 78 |
+
- Best results with clear, well-lit frontal photos of teeth
|
| 79 |
+
|
| 80 |
+
## License
|
| 81 |
+
|
| 82 |
+
MIT License
|