Add README
Browse files
README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- image-classification
|
| 5 |
+
- dental
|
| 6 |
+
- pytorch
|
| 7 |
+
- efficientnet
|
| 8 |
+
datasets:
|
| 9 |
+
- custom
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Dental Impression Classifier
|
| 13 |
+
|
| 14 |
+
This model classifies dental impressions into three categories:
|
| 15 |
+
- Good
|
| 16 |
+
- Acceptable
|
| 17 |
+
- Unacceptable
|
| 18 |
+
|
| 19 |
+
## Model Details
|
| 20 |
+
- Architecture: EfficientNet-B0
|
| 21 |
+
- Framework: PyTorch
|
| 22 |
+
- Input: 224x224 RGB images
|
| 23 |
+
- Classes: 3 (Good, Acceptable, Unacceptable)
|
| 24 |
+
|
| 25 |
+
## Usage
|
| 26 |
+
```python
|
| 27 |
+
import torch
|
| 28 |
+
from PIL import Image
|
| 29 |
+
from torchvision import transforms
|
| 30 |
+
import json
|
| 31 |
+
|
| 32 |
+
# Load model config
|
| 33 |
+
with open('model_config.json', 'r') as f:
|
| 34 |
+
config = json.load(f)
|
| 35 |
+
|
| 36 |
+
# Load model
|
| 37 |
+
model = torch.jit.load('dental_classifier.pt')
|
| 38 |
+
model.eval()
|
| 39 |
+
|
| 40 |
+
# Prepare image
|
| 41 |
+
transform = transforms.Compose([
|
| 42 |
+
transforms.Resize((224, 224)),
|
| 43 |
+
transforms.ToTensor(),
|
| 44 |
+
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
| 45 |
+
])
|
| 46 |
+
|
| 47 |
+
# Make prediction
|
| 48 |
+
image = Image.open('your_image.jpg').convert('RGB')
|
| 49 |
+
image_tensor = transform(image).unsqueeze(0)
|
| 50 |
+
|
| 51 |
+
with torch.no_grad():
|
| 52 |
+
outputs = model(image_tensor)
|
| 53 |
+
probabilities = torch.softmax(outputs, dim=1)
|
| 54 |
+
confidence, predicted = torch.max(probabilities, 1)
|
| 55 |
+
|
| 56 |
+
predicted_class = config['class_names'][predicted.item()]
|
| 57 |
+
print(f"Prediction: {predicted_class}, Confidence: {confidence.item():.2%}")
|
| 58 |
+
```
|