Update model card for the single merged checkpoint
Browse files
README.md
CHANGED
|
@@ -5,11 +5,10 @@ tags:
|
|
| 5 |
- ai-generated-image-detection
|
| 6 |
- lorc
|
| 7 |
- dinov3
|
| 8 |
-
- lora
|
| 9 |
pipeline_tag: image-classification
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# Modulated-LoRC
|
| 13 |
|
| 14 |
An [LoRC](https://arxiv.org/abs/2608.20882) (Low-Rank Collapse) AI-generated-image
|
| 15 |
detector: a frozen **DINOv3 ViT-H+/16** backbone + LoRA adapters, an orthogonal
|
|
@@ -21,7 +20,8 @@ randomly rescales each pair's residual-subspace magnitude (simulating
|
|
| 21 |
different image compositions/energy bands) while mathematically guaranteeing
|
| 22 |
the real>fake energy ordering *within* every pair is preserved exactly.
|
| 23 |
|
| 24 |
-
|
|
|
|
| 25 |
|
| 26 |
## Why pair-aware, not per-sample
|
| 27 |
|
|
@@ -39,13 +39,13 @@ since scaling both sides of a ratio by the same factor can't flip its sign.
|
|
| 39 |
| | Clean BAcc | Clean AUC | Full (transformed) BAcc | Full AUC |
|
| 40 |
|---|---|---|---|---|
|
| 41 |
| v2 baseline (no aug) | 95.01% | 0.9911 | 91.92% | 0.9739 |
|
| 42 |
-
| **
|
| 43 |
|
| 44 |
Biggest gains: real-photo groups that were previously the model's weakest
|
| 45 |
point β celebahq (85.4%β94.7% under transforms), ffhq (84.3%β94.4%). Full
|
| 46 |
per-generator breakdown, throughput benchmarks, and training details: see
|
| 47 |
-
|
| 48 |
-
|
| 49 |
|
| 50 |
Known regression: Imagen (Google) under transforms, 91.9%β90.9% β the one
|
| 51 |
generator where this trick's real-photo gains don't fully offset a drop in
|
|
@@ -53,22 +53,21 @@ raw recall on that specific generator (93.7%β86.1%).
|
|
| 53 |
|
| 54 |
## Usage
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
```
|
| 59 |
|
| 60 |
```python
|
| 61 |
-
from
|
| 62 |
|
| 63 |
-
model = ModulatedLoRC.from_pretrained() # pulls
|
| 64 |
result = model.predict_image("photo.jpg")
|
| 65 |
print(result) # {"label": "fake", "p_fake": 0.93, "p_real": 0.07}
|
| 66 |
```
|
| 67 |
|
| 68 |
-
or
|
| 69 |
|
| 70 |
```bash
|
| 71 |
-
python
|
| 72 |
```
|
| 73 |
|
| 74 |
This repo is **private** β pass a token (`from_pretrained(hf_token="hf_...")`
|
|
@@ -76,8 +75,11 @@ or set `HF_TOKEN`/run `huggingface-cli login`) to access it.
|
|
| 76 |
|
| 77 |
## Files
|
| 78 |
|
| 79 |
-
- `
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
- ai-generated-image-detection
|
| 6 |
- lorc
|
| 7 |
- dinov3
|
|
|
|
| 8 |
pipeline_tag: image-classification
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# mLoRC (Modulated-LoRC)
|
| 12 |
|
| 13 |
An [LoRC](https://arxiv.org/abs/2608.20882) (Low-Rank Collapse) AI-generated-image
|
| 14 |
detector: a frozen **DINOv3 ViT-H+/16** backbone + LoRA adapters, an orthogonal
|
|
|
|
| 20 |
different image compositions/energy bands) while mathematically guaranteeing
|
| 21 |
the real>fake energy ordering *within* every pair is preserved exactly.
|
| 22 |
|
| 23 |
+
`attn_rank=64`, LoRA `rank=32/Ξ±=32` (folded into the backbone weights below,
|
| 24 |
+
not shipped as a separate adapter).
|
| 25 |
|
| 26 |
## Why pair-aware, not per-sample
|
| 27 |
|
|
|
|
| 39 |
| | Clean BAcc | Clean AUC | Full (transformed) BAcc | Full AUC |
|
| 40 |
|---|---|---|---|---|
|
| 41 |
| v2 baseline (no aug) | 95.01% | 0.9911 | 91.92% | 0.9739 |
|
| 42 |
+
| **mLoRC** | **96.57%** | **0.9929** | **92.65%** | 0.9723 |
|
| 43 |
|
| 44 |
Biggest gains: real-photo groups that were previously the model's weakest
|
| 45 |
point β celebahq (85.4%β94.7% under transforms), ffhq (84.3%β94.4%). Full
|
| 46 |
per-generator breakdown, throughput benchmarks, and training details: see
|
| 47 |
+
[Buxt-Codes/AIGI-mLoRC](https://github.com/Buxt-Codes/AIGI-mLoRC) β the code
|
| 48 |
+
that loads this checkpoint lives there, not in this HF repo.
|
| 49 |
|
| 50 |
Known regression: Imagen (Google) under transforms, 91.9%β90.9% β the one
|
| 51 |
generator where this trick's real-photo gains don't fully offset a drop in
|
|
|
|
| 53 |
|
| 54 |
## Usage
|
| 55 |
|
| 56 |
+
Clone [Buxt-Codes/AIGI-mLoRC](https://github.com/Buxt-Codes/AIGI-mLoRC), set
|
| 57 |
+
up its `requirements.txt`, then:
|
|
|
|
| 58 |
|
| 59 |
```python
|
| 60 |
+
from modulated_lorc import ModulatedLoRC
|
| 61 |
|
| 62 |
+
model = ModulatedLoRC.from_pretrained() # pulls mlorc-full.pt from this repo
|
| 63 |
result = model.predict_image("photo.jpg")
|
| 64 |
print(result) # {"label": "fake", "p_fake": 0.93, "p_real": 0.07}
|
| 65 |
```
|
| 66 |
|
| 67 |
+
or, for a whole directory of images:
|
| 68 |
|
| 69 |
```bash
|
| 70 |
+
python predict.py --input_dir <path/to/images> --output results.json
|
| 71 |
```
|
| 72 |
|
| 73 |
This repo is **private** β pass a token (`from_pretrained(hf_token="hf_...")`
|
|
|
|
| 75 |
|
| 76 |
## Files
|
| 77 |
|
| 78 |
+
- `mlorc-full.pt` (~1.6GB, bf16) β **one self-contained checkpoint**: the
|
| 79 |
+
DINOv3 ViT-H+/16 backbone with the trained LoRA adapters already folded
|
| 80 |
+
into its weights (`peft`'s `merge_and_unload()`, verified numerically
|
| 81 |
+
exact before shipping β max output difference vs. the pre-merge model was
|
| 82 |
+
1e-12, pure floating-point noise), plus the Low-Rank Attention Block and
|
| 83 |
+
classifier head. Nothing else needs downloading from anywhere else to run
|
| 84 |
+
this model β no separate adapter file, no separate backbone-weights
|
| 85 |
+
download from another HF repo.
|