V2: Update model card with new metrics
Browse files
README.md
CHANGED
|
@@ -14,11 +14,24 @@ metrics:
|
|
| 14 |
- precision
|
| 15 |
- recall
|
| 16 |
pipeline_tag: image-classification
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
---
|
| 18 |
|
| 19 |
-
# Document Moiré Detection Model
|
| 20 |
|
| 21 |
-
A fine-tuned **DeiT-
|
| 22 |
|
| 23 |
## Model Description
|
| 24 |
|
|
@@ -34,26 +47,29 @@ visual artifacts that commonly occur when:
|
|
| 34 |
|
| 35 |
## Training
|
| 36 |
|
| 37 |
-
- **Base model:** `facebook/deit-
|
| 38 |
-
- **Training data:**
|
| 39 |
- **Source images:** [rvl-cdip document classification dataset](https://huggingface.co/datasets/hf-tuner/rvl-cdip-document-classification)
|
| 40 |
-
- **Moiré generation:**
|
| 41 |
1. Resize aliasing (screen-camera simulation)
|
| 42 |
2. Frequency-domain pattern overlay
|
| 43 |
3. Multi-frequency band interference with color fringing
|
| 44 |
4. Screen pixel grid + capture simulation
|
|
|
|
|
|
|
| 45 |
- **Epochs:** 5
|
| 46 |
-
- **Learning rate:**
|
| 47 |
- **Effective batch size:** 64
|
|
|
|
| 48 |
|
| 49 |
## Performance
|
| 50 |
|
| 51 |
| Metric | Validation | Test (held-out) |
|
| 52 |
|-----------|-----------|-----------------|
|
| 53 |
-
| Accuracy |
|
| 54 |
-
| F1 Score | 0.
|
| 55 |
-
| Precision |
|
| 56 |
-
| Recall |
|
| 57 |
|
| 58 |
## Usage
|
| 59 |
|
|
@@ -86,6 +102,13 @@ with torch.no_grad():
|
|
| 86 |
print(model.config.id2label[predicted_class]) # 'clean' or 'moire'
|
| 87 |
```
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
## Limitations
|
| 90 |
|
| 91 |
- Trained on synthetic moiré patterns — may not capture all real-world moiré variations
|
|
|
|
| 14 |
- precision
|
| 15 |
- recall
|
| 16 |
pipeline_tag: image-classification
|
| 17 |
+
model-index:
|
| 18 |
+
- name: document-moire-detector
|
| 19 |
+
results:
|
| 20 |
+
- task:
|
| 21 |
+
type: image-classification
|
| 22 |
+
name: Moiré Pattern Detection
|
| 23 |
+
metrics:
|
| 24 |
+
- type: accuracy
|
| 25 |
+
value: 0.9950
|
| 26 |
+
name: Test Accuracy
|
| 27 |
+
- type: f1
|
| 28 |
+
value: 0.9950
|
| 29 |
+
name: Test F1
|
| 30 |
---
|
| 31 |
|
| 32 |
+
# Document Moiré Detection Model (V2)
|
| 33 |
|
| 34 |
+
A fine-tuned **DeiT-small** (Vision Transformer, 22M params) model for detecting moiré patterns in document images.
|
| 35 |
|
| 36 |
## Model Description
|
| 37 |
|
|
|
|
| 47 |
|
| 48 |
## Training
|
| 49 |
|
| 50 |
+
- **Base model:** `facebook/deit-small-patch16-224` (22M parameters)
|
| 51 |
+
- **Training data:** 8,000 samples (4,000 clean + 4,000 synthetic moiré)
|
| 52 |
- **Source images:** [rvl-cdip document classification dataset](https://huggingface.co/datasets/hf-tuner/rvl-cdip-document-classification)
|
| 53 |
+
- **Moiré generation:** 6 synthetic methods:
|
| 54 |
1. Resize aliasing (screen-camera simulation)
|
| 55 |
2. Frequency-domain pattern overlay
|
| 56 |
3. Multi-frequency band interference with color fringing
|
| 57 |
4. Screen pixel grid + capture simulation
|
| 58 |
+
5. **Subtle moiré** — low-strength single-frequency patterns (hard examples)
|
| 59 |
+
6. **Localized moiré** — partial-image patterns with gaussian mask
|
| 60 |
- **Epochs:** 5
|
| 61 |
+
- **Learning rate:** 3e-5 (cosine schedule)
|
| 62 |
- **Effective batch size:** 64
|
| 63 |
+
- **Label smoothing:** 0.05
|
| 64 |
|
| 65 |
## Performance
|
| 66 |
|
| 67 |
| Metric | Validation | Test (held-out) |
|
| 68 |
|-----------|-----------|-----------------|
|
| 69 |
+
| Accuracy | 98.5% | 99.5% |
|
| 70 |
+
| F1 Score | 0.985 | 0.995 |
|
| 71 |
+
| Precision | 98.2% | 99.3% |
|
| 72 |
+
| Recall | 98.8% | 99.7% |
|
| 73 |
|
| 74 |
## Usage
|
| 75 |
|
|
|
|
| 102 |
print(model.config.id2label[predicted_class]) # 'clean' or 'moire'
|
| 103 |
```
|
| 104 |
|
| 105 |
+
## Version History
|
| 106 |
+
|
| 107 |
+
| Version | Model | Train Size | Methods | Val F1 | Test F1 |
|
| 108 |
+
|---------|-------|-----------|---------|--------|---------|
|
| 109 |
+
| V1 | DeiT-tiny (5.5M) | 6,000 | 4 | 0.998 | 0.995 |
|
| 110 |
+
| **V2** | **DeiT-small (22M)** | **8,000** | **6** | **0.985** | **0.995** |
|
| 111 |
+
|
| 112 |
## Limitations
|
| 113 |
|
| 114 |
- Trained on synthetic moiré patterns — may not capture all real-world moiré variations
|