Instructions to use VilaVision/dentalmisalignmentdetection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use VilaVision/dentalmisalignmentdetection with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://VilaVision/dentalmisalignmentdetection") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,58 +1,144 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
| 4 |
-
Got it. Iβll prepare a README file for the `teeth_alignment_detection_modal` Keras model hosted on Hugging Face. This README will include details such as model architecture, purpose, usage instructions, input/output formats, and licensing if available.
|
| 5 |
|
| 6 |
-
|
| 7 |
|
| 8 |
-
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
**Model Architecture:** The exact layer details are not documented, but the model is implemented as a convolutional neural network (CNN) in Keras. Such dental image classifiers typically consist of multiple convolutional layers (often with large initial filters, e.g. 7Γ7, followed by smaller filters), pooling or subsampling layers, and residual connections ([
|
| 13 |
-
Artificial Intelligence for Classifying and Archiving Orthodontic Images - PMC
|
| 14 |
-
](https://pmc.ncbi.nlm.nih.gov/articles/PMC8813223/#:~:text=Our%20framework%20is%20composed%20of,features%20were%20obtained%20based%20on)). The network likely ends with one or more fully connected (dense) layers producing the alignment classification. (For example, CNN architectures for orthodontic image tasks use stacks of Conv2D + ReLU + pooling layers, sometimes with residual shortcuts, as seen in related work ([
|
| 15 |
-
Artificial Intelligence for Classifying and Archiving Orthodontic Images - PMC
|
| 16 |
-
](https://pmc.ncbi.nlm.nih.gov/articles/PMC8813223/#:~:text=Our%20framework%20is%20composed%20of,features%20were%20obtained%20based%20on)).) The expected input shape is an image tensor (e.g., height Γ width Γ 3 for RGB photos). Inference would take a preprocessed image of the patientβs teeth (resized to the modelβs input size, e.g. 224Γ224 or similar) and output a probability or class label indicating βalignedβ vs βmisalignedβ teeth.
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
```python
|
| 23 |
from tensorflow import keras
|
| 24 |
from huggingface_hub import hf_hub_download
|
| 25 |
|
| 26 |
-
# Download
|
| 27 |
model_path = hf_hub_download(repo_id="AP6621/teeth_alignment_detection_modal", filename="final_teeth_model.keras")
|
| 28 |
model = keras.models.load_model(model_path)
|
| 29 |
|
| 30 |
-
#
|
| 31 |
img = keras.preprocessing.image.load_img("path/to/teeth_image.jpg", target_size=(224, 224))
|
| 32 |
-
x = keras.preprocessing.image.img_to_array(img) / 255.0
|
| 33 |
-
x = x.reshape((1,) + x.shape)
|
| 34 |
|
| 35 |
-
#
|
| 36 |
preds = model.predict(x)
|
| 37 |
-
print("Raw
|
| 38 |
-
#
|
| 39 |
```
|
| 40 |
|
| 41 |
-
|
| 42 |
-
*Output:* A 1D array of probabilities or logits. For a two-class model, `preds[0]` might contain two values (e.g. `[p_aligned, p_misaligned]`). Interpret the higher probability as the predicted class (for example, `preds[0].argmax()` yields the predicted label).
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
](https://pmc.ncbi.nlm.nih.gov/articles/PMC8813223/#:~:text=Nevertheless%2C%20our%20study%20presents%20several,of%20the%20lack%20of%20dentists)), so if the training set has noisy or biased labels, predictions may be unreliable. In summary, only use this model on similar types of dental images to those it was trained on, and always review its output with expert judgment. This model is *not* a replacement for a professional dental evaluation and has not been clinically validated.
|
| 51 |
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
*
|
| 55 |
-
Artificial Intelligence for Classifying and Archiving Orthodontic Images - PMC
|
| 56 |
-
](https://pmc.ncbi.nlm.nih.gov/articles/PMC8813223/#:~:text=Our%20framework%20is%20composed%20of,features%20were%20obtained%20based%20on)) ([
|
| 57 |
-
Artificial Intelligence for Classifying and Archiving Orthodontic Images - PMC
|
| 58 |
-
](https://pmc.ncbi.nlm.nih.gov/articles/PMC8813223/#:~:text=Nevertheless%2C%20our%20study%20presents%20several,of%20the%20lack%20of%20dentists)).
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- keras
|
| 5 |
+
- teeth-alignment
|
| 6 |
+
- dental
|
| 7 |
+
- healthcare
|
| 8 |
+
- unsupervised-learning
|
| 9 |
+
- rlhf
|
| 10 |
+
- image-classification
|
| 11 |
+
datasets:
|
| 12 |
+
- custom
|
| 13 |
+
library_name: keras
|
| 14 |
+
language: en
|
| 15 |
+
pipeline_tag: image-classification
|
| 16 |
---
|
|
|
|
| 17 |
|
| 18 |
+
# π¦· Teeth Alignment Detection Model
|
| 19 |
|
| 20 |
+
<h1 align="center">π¦· Teeth Alignment Detection Model</h1>
|
| 21 |
|
| 22 |
+
<p align="center">
|
| 23 |
+
<img src="https://huggingface.co/VilaVision/dentalmisalignmentdetection/resolve/main/Overbite.jpeg" alt="VilaVision Logo" width="400"/>
|
| 24 |
+
</p>
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
## π§ Overview
|
| 28 |
|
| 29 |
+
This Keras model classifies dental images into **aligned** vs. **misaligned** categories. It is designed to aid dental practitioners and orthodontists by analyzing clinical photos or X-rays and detecting signs of malocclusion, crowding, or improper alignment.
|
| 30 |
+
|
| 31 |
+
π§ͺ **Training Highlights**:
|
| 32 |
+
- **Unsupervised Learning Phase**: Learns visual features from unlabeled dental image data.
|
| 33 |
+
- **RLHF (Reinforcement Learning with Human Feedback)**: Fine-tuned using expert-labeled feedback to make the predictions align with real-world diagnoses.
|
| 34 |
+
|
| 35 |
+
> π This model is a research tool and not a substitute for professional dental evaluation.
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## ποΈ Architecture
|
| 40 |
+
|
| 41 |
+
The model is a Convolutional Neural Network (CNN), built in Keras. It likely includes:
|
| 42 |
+
|
| 43 |
+
- Convolutional layers (Conv2D + ReLU)
|
| 44 |
+
- MaxPooling or AveragePooling layers
|
| 45 |
+
- Dense classification layers
|
| 46 |
+
- Possibly residual connections for stability
|
| 47 |
+
|
| 48 |
+
πΌοΈ **Input shape**: `(224, 224, 3)`
|
| 49 |
+
π€ **Output**: Class probabilities (e.g., `[0.8, 0.2]` β "aligned")
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## π§Ύ Training Data
|
| 54 |
+
|
| 55 |
+
Though the dataset is not publicly available, it likely contains:
|
| 56 |
+
|
| 57 |
+
- Intraoral or panoramic dental photographs
|
| 58 |
+
- Images annotated by human experts
|
| 59 |
+
- Unlabeled data used in the unsupervised phase
|
| 60 |
+
- Labeled samples used during RLHF fine-tuning
|
| 61 |
+
|
| 62 |
+
The model is inspired by techniques described in [BMC Oral Health, 2022](https://bmcoralhealth.biomedcentral.com/articles/10.1186/s12903-022-02466-x) and [PMC Orthodontic AI](https://pmc.ncbi.nlm.nih.gov/articles/PMC8813223/).
|
| 63 |
+
|
| 64 |
+
---
|
| 65 |
+
|
| 66 |
+
## π Usage
|
| 67 |
+
|
| 68 |
+
### π§ Install Dependencies
|
| 69 |
+
|
| 70 |
+
```bash
|
| 71 |
+
pip install tensorflow huggingface_hub
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
### π Load and Predict
|
| 75 |
|
| 76 |
```python
|
| 77 |
from tensorflow import keras
|
| 78 |
from huggingface_hub import hf_hub_download
|
| 79 |
|
| 80 |
+
# Download model
|
| 81 |
model_path = hf_hub_download(repo_id="AP6621/teeth_alignment_detection_modal", filename="final_teeth_model.keras")
|
| 82 |
model = keras.models.load_model(model_path)
|
| 83 |
|
| 84 |
+
# Preprocess image
|
| 85 |
img = keras.preprocessing.image.load_img("path/to/teeth_image.jpg", target_size=(224, 224))
|
| 86 |
+
x = keras.preprocessing.image.img_to_array(img) / 255.0
|
| 87 |
+
x = x.reshape((1,) + x.shape)
|
| 88 |
|
| 89 |
+
# Predict
|
| 90 |
preds = model.predict(x)
|
| 91 |
+
print("Raw output:", preds)
|
| 92 |
+
# Example: preds[0][0] > 0.5 β "misaligned"
|
| 93 |
```
|
| 94 |
|
| 95 |
+
---
|
|
|
|
| 96 |
|
| 97 |
+
## π₯ Input & π€ Output
|
| 98 |
|
| 99 |
+
| Type | Description |
|
| 100 |
+
| ------ | ------------------------------------------- |
|
| 101 |
+
| Input | JPG/PNG image of teeth (224Γ224), RGB |
|
| 102 |
+
| Output | Class probabilities for alignment detection |
|
|
|
|
| 103 |
|
| 104 |
+
---
|
| 105 |
+
|
| 106 |
+
## π Performance
|
| 107 |
+
|
| 108 |
+
While no official metrics are available, CNN models for orthodontic imaging tasks have reported:
|
| 109 |
+
|
| 110 |
+
* ~95β98% accuracy ([BMC Oral Health, 2022](https://bmcoralhealth.biomedcentral.com/articles/10.1186/s12903-022-02466-x))
|
| 111 |
+
* High F1-scores in clinical benchmarks
|
| 112 |
+
|
| 113 |
+
**Note:** Performance may vary on images that differ from the training distribution.
|
| 114 |
+
|
| 115 |
+
---
|
| 116 |
+
|
| 117 |
+
## β οΈ Limitations
|
| 118 |
+
|
| 119 |
+
* Not suitable for diagnostic use without expert supervision
|
| 120 |
+
* Trained on specific dental image styles β generalization may be limited
|
| 121 |
+
* May not perform well on low-quality or occluded images
|
| 122 |
+
* Biases in training data may affect outputs
|
| 123 |
+
|
| 124 |
+
Always consult a licensed orthodontist or dentist before taking action based on model predictions.
|
| 125 |
+
|
| 126 |
+
---
|
| 127 |
+
|
| 128 |
+
## π License
|
| 129 |
+
|
| 130 |
+
πͺͺ MIT License β free to use, modify, and distribute.
|
| 131 |
+
|
| 132 |
+
[View on Hugging Face β](https://huggingface.co/AP6621/teeth_alignment_detection_modal)
|
| 133 |
+
|
| 134 |
+
---
|
| 135 |
+
|
| 136 |
+
## π References
|
| 137 |
+
|
| 138 |
+
* [Deep Learning for Orthodontic Photo Classification β BMC Oral Health](https://bmcoralhealth.biomedcentral.com/articles/10.1186/s12903-022-02466-x)
|
| 139 |
+
* [AI for Classifying Orthodontic Images β PMC Study](https://pmc.ncbi.nlm.nih.gov/articles/PMC8813223/)
|
| 140 |
+
* [OpenAI β Learning from Human Feedback (RLHF)](https://openai.com/research/learning-from-human-feedback)
|
| 141 |
+
|
| 142 |
+
---
|
| 143 |
|
| 144 |
+
π§ *Model built and maintained by [VilaVision](https://github.com/VilaVision)*
|
|
|
|
|
|
|
|
|
|
|
|