File size: 6,302 Bytes
4030219
84e1b47
b0594be
 
 
 
ee3ed52
b0594be
 
ee3ed52
 
b0594be
4030219
b0594be
ee3ed52
b0594be
ee3ed52
b0594be
ee3ed52
b0594be
ee3ed52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b0594be
 
 
 
 
 
 
ee3ed52
b0594be
ee3ed52
 
 
 
b0594be
ee3ed52
 
 
 
 
 
 
 
 
 
 
b0594be
 
 
 
 
 
 
 
 
ee3ed52
 
b0594be
ee3ed52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b0594be
ee3ed52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b0594be
 
 
 
 
 
 
 
 
ee3ed52
 
 
 
 
 
 
 
 
 
 
 
 
84e1b47
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
---
license: apache-2.0
library_name: pytorch
pipeline_tag: image-classification
tags:
  - aigc-detection
  - ai-generated-image-detection
  - image-forensics
  - pytorch
  - dinov3
  - clip
  - icml-2026
---

<div align="center">

# 🔍 ForensicConcept

### Transferable Forensic Concepts for AIGI Detection

Official detector checkpoints for the ICML 2026 paper
**ForensicConcept: Transferable Forensic Concepts for AIGI Detection**.

[[`Code`](https://github.com/EthanAdamm/FORENSICCONCEPT)]
[[`Paper`](https://arxiv.org/abs/2606.07034)]
[[`Models`](https://huggingface.co/ethan225/ForensicConcept/tree/main/weights)]
[[`BibTeX`](#citation)]

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![PyTorch](https://img.shields.io/badge/PyTorch-2.7%2B-ee4c2c.svg)](https://pytorch.org/)
[![ICML 2026](https://img.shields.io/badge/ICML-2026-8A2BE2.svg)](https://icml.cc/)

</div>

---

## Model Overview

ForensicConcept converts diffuse detector evidence into explicit, auditable
forensic concepts and transfers these concepts across detector backbones. The
framework combines:

- **Adapter-guided discriminative tuning (ADT)** for efficient detector
  adaptation with LoRA;
- **Unsupervised concept induction (UCI)** for discovering a compact forensic
  concept codebook from decision-critical image patches;
- **Concept-aligned projection (CAP)** for concept-space prediction;
- **Concept-guided codebook injection (CGCI)** for transferring
  diffusion-derived generation traces to target backbones.

<div align="center">
  <img src="https://raw.githubusercontent.com/EthanAdamm/FORENSICCONCEPT/main/assets/readme/method_overview.png" alt="ForensicConcept overview" width="95%" />
</div>

## Performance

Image-level accuracy (%) reported in the paper. Models are trained on Stable
Diffusion 1.4 images.

| Evaluation benchmark | DINOv3 without concepts | ForensicConcept |
|---|---:|---:|
| GenImage, mean over 8 generators | 90.7 | **92.0** |
| GAN-family, mean over 7 generators | 87.3 | **90.1** |
| Chameleon | 83.7 | **84.4** |
| Mean over the three benchmarks | 87.2 | **88.8** |

The transferred codebook also raises CLIP ViT-L/14 mean accuracy on GenImage
from **83.7** to **88.2** (+4.5 points).

## Available Files

| File | Purpose | Size |
|---|---|---:|
| `weights/detectors/dinov3_vitl16_lora_stage1.pth` | DINOv3 ADT / LoRA initialization | 24.3 MiB |
| `weights/detectors/dinov3_vitl16_concept_stage2.pth` | DINOv3 ForensicConcept inference | 26.6 MiB |
| `weights/detectors/clip_vitl14_lora_stage1.pth` | CLIP LoRA initialization | 4.6 MiB |
| `weights/detectors/clip_vitl14_codebook_stage2.pth` | CLIP CGCI inference | 20.5 MiB |
| `weights/concepts/dinov3_concept_matrix.npy` | DINOv3 concepts (`200 x 1024`, float32) | 0.8 MiB |

The four detector checkpoints total **76.0 MiB**. Stage-1 checkpoints are
provided for reproducing stage-2 training. For inference, use the
corresponding stage-2 checkpoint. DINOv3 inference also requires the released
concept matrix.

## Quick Start

### 1. Clone the code

```bash
git clone https://github.com/EthanAdamm/FORENSICCONCEPT.git
cd FORENSICCONCEPT
python -m pip install -r requirements.txt
```

### 2. Download the released weights

Run this command from the root of the cloned code repository:

```bash
hf download ethan225/ForensicConcept \
  --include "weights/**" \
  --local-dir .
```

### 3. Add the external backbones

The pretrained DINOv3 ViT-L/16 and CLIP ViT-L/14 backbones are not included.
Download them from their official upstream projects and use this layout:

```text
weights/
|-- backbones/
|   |-- ViT-L-14.pt
|   `-- dinov3-vitl16/
|       `-- model.safetensors
|-- concepts/
|   `-- dinov3_concept_matrix.npy
`-- detectors/
    |-- dinov3_vitl16_lora_stage1.pth
    |-- dinov3_vitl16_concept_stage2.pth
    |-- clip_vitl14_lora_stage1.pth
    `-- clip_vitl14_codebook_stage2.pth
```

### 4. Evaluate

```bash
# DINOv3 ForensicConcept
python test_with_config.py \
  --config configs/dinov3_concept.yaml \
  --checkpoint_path weights/detectors/dinov3_vitl16_concept_stage2.pth

# CLIP with concept-guided codebook injection
python test_with_config.py \
  --config configs/clip_codebook.yaml \
  --checkpoint_path weights/detectors/clip_vitl14_codebook_stage2.pth
```

Dataset paths are placeholders in the public configurations. Update
`data.*` and `testing.groups` before evaluation. See the
[`GitHub README`](https://github.com/EthanAdamm/FORENSICCONCEPT#dataset-preparation)
for complete installation, dataset, training, and evaluation instructions.

## Checkpoint Notes

- DINOv3 stage 2 contains the classifier, concept mapping/head, and all LoRA
  tensors. The external concept matrix initializes the model structure before
  loading the checkpoint.
- CLIP stage 2 contains visual LoRA, the main classifier, and the complete
  codebook head.
- External backbone weights remain subject to their respective upstream
  licenses and terms.

<details>
<summary><strong>SHA-256 checksums</strong></summary>

```text
3bc8e833d75c9ccbb214c28238c791681294ae8b0c50e48cc3e64b9e5ac5ca1f  weights/detectors/dinov3_vitl16_lora_stage1.pth
99162dbf6a56610be5a8bb9fa27e62311f723d0a4f34e384b084e76085491aad  weights/detectors/dinov3_vitl16_concept_stage2.pth
b0c0217b547391a70eed680ef0d8f92555d172241c46bea767346c8d65115184  weights/detectors/clip_vitl14_lora_stage1.pth
a81ebec9281aca3db4b0d88254d25424f37d5d498ae2c405eb6a5be4748dc498  weights/detectors/clip_vitl14_codebook_stage2.pth
9e6ce224d223dab804648bb46a9cc405bfef4cfcb13dc9cc21ad7fd94935959c  weights/concepts/dinov3_concept_matrix.npy
```

</details>

## Citation

```bibtex
@inproceedings{zhou2026forensicconcept,
  title     = {{ForensicConcept}: Transferable Forensic Concepts for {AIGI} Detection},
  author    = {Zhou, Menyanshu and Zhou, Ziyin and Sun, Ke and Luo, Yunpeng and Ji, Jiayi and Sun, Xiaoshuai and Ji, Rongrong},
  booktitle = {Proceedings of the 43rd International Conference on Machine Learning},
  year      = {2026}
}
```

## License

The ForensicConcept detector checkpoints are released under the
[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). External
backbone weights are not included and remain subject to their respective
upstream licenses and terms.