Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- vision
|
| 5 |
+
- image-classification
|
| 6 |
+
- dinov2
|
| 7 |
+
- moire-detection
|
| 8 |
+
- screen-detection
|
| 9 |
+
- anti-spoofing
|
| 10 |
+
- digital-forensics
|
| 11 |
+
datasets:
|
| 12 |
+
- soumikrakshit/uhdm-dataset
|
| 13 |
+
pipeline_tag: image-classification
|
| 14 |
---
|
| 15 |
+
|
| 16 |
+
# Dual-Branch DINOv2 Moiré & Screen Recapture Detector
|
| 17 |
+
|
| 18 |
+
A robust digital forensics classifier built on **DINOv2 (with registers)** designed to detect screen recaptures and Moiré patterns.
|
| 19 |
+
|
| 20 |
+
By combining an un-resized native crop (capturing high-frequency pixel interference) with a global thumbnail (capturing screen-wide periodic banding), this model overcomes the traditional scale dilemma in Moiré detection.
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## 📁 Repository Files
|
| 25 |
+
|
| 26 |
+
* **`best_screen_detector_backbone.pt`**: Weights for the fine-tuned top transformer blocks of the DINOv2 backbone.
|
| 27 |
+
* **`best_screen_detector_mlp.pt`**: Weights for the 2-layer classification MLP head.
|
| 28 |
+
* **`classes.json`**: Class index mapping (`0: "gt"`, `1: "moire"`).
|
| 29 |
+
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
## 🧠 Architecture Highlights
|
| 33 |
+
|
| 34 |
+
1. **Dual-Branch Input**:
|
| 35 |
+
* **Local Branch (Native Resolution Crop):** Recropped directly at $224 \times 224$ from native image resolution without prior resizing, preventing antialiasing from washing out high-frequency Moiré lines.
|
| 36 |
+
* **Global Branch (Thumbnail View):** Resized to $256 \times 256$ and cropped to $224 \times 224$ to detect macroscopic periodic interference patterns.
|
| 37 |
+
2. **Feature Concatenation ($3072$-d)**:
|
| 38 |
+
* Combines `[CLS_local, PatchMean_local, CLS_global, PatchMean_global]`, ignoring internal register tokens.
|
| 39 |
+
3. **Partial Backbone Fine-Tuning**:
|
| 40 |
+
* Top 2 transformer layers adapted to Moiré patterns with differential learning rates, while earlier feature representations remain frozen.
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## 🚀 Quick Start & Inference
|
| 45 |
+
|
| 46 |
+
### 1. Requirements
|
| 47 |
+
|
| 48 |
+
```bash
|
| 49 |
+
pip install torch torchvision transformers pillow
|