File size: 4,038 Bytes
df66507 | 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 | # <p align="center">π DoU</p>
## <p align="center">Diversity over Uniformity: Rethinking Representation in Generated Image Detection</p>
<p align="center">
Official PyTorch implementation for generated image detection.
</p>
---
## π§ Overview
DoU revisits representation learning for generated image detection. Instead of enforcing representation uniformity, DoU promotes **cue diversity** while preserving robustness and generalization ability.
---
## π Core Components
| Component | Full Name | Description |
| --- | --- | --- |
| π§© CIB | Cue Information Bottleneck | A VAE-style variational bottleneck applied to multi-stage visual cues. |
| π AFCL | Adaptive Feature Correlation Learning | An inter-cue decorrelation mechanism that encourages diverse visual cues. |
| πΌοΈ Multi-Stage CLIP | Multi-Stage CLIP Aggregation | Hierarchical CLIP visual features for robust generated image detection. |
---
## π’ Release Status
| Item | Status | Notes |
| --- | --- | --- |
| π§ͺ Testing / evaluation code | β
Released | Use `test.py` for benchmark evaluation. |
| π Pretrained weights | β
Released | Use released checkpoints for direct testing. |
| ποΈ Training code | π§ Coming next | The next update will provide the training pipeline. |
| βοΈ Training configs | π§ Coming next | Full training configuration will be released with training code. |
| π Reproducibility details | π§ Coming next | More instructions will be added in the next update. |
---
## π Evaluation Data Format
For the current release, only evaluation is required. Each test dataset folder should follow the common real/fake structure:
```text
test_root/
progan/
0_real/
1_fake/
stylegan/
0_real/
1_fake/
```
Label meaning:
| Folder | Class |
| --- | --- |
| `0_real` | Real |
| `1_fake` | Generated / Fake |
---
## π Pretrained Weights
Download the released pretrained weights before running evaluation.
| Source | Link | Access Code / Notes |
| --- | --- |---------------------|
| ηΎεΊ¦η½η | [Download](https://pan.baidu.com/s/1tXBYHT2C2ixOoTBd0taPWA?pwd=8pkh) | ζεη : `8pkh` |
| Google Drive | [Download](https://drive.google.com/file/d/1S8g99k-42NjulNGcGHxnm1xZuUWwvm9k/view?usp=drive_link) | \ |
After downloading, place the checkpoint under `runs/DoU/`:
```text
runs/
DoU/
best.pth
```
Then use `--ckpt runs/DoU/best.pth` when running evaluation.
---
## β‘ Usage
### β
Main Command
For the current release, run the evaluation command below with the released checkpoint:
```bash
python test.py \
--data-root xxx\
--ckpt runs/DoU/best.pth \
--output result.xlsx \
--batch-size 256
```
---
### π§ Optional Evaluation Commands
The commands below are alternative or advanced evaluation usages. You do **not** need to run all of them.
#### Evaluate selected datasets only
```bash
python test.py \
--data-root xxx \
--datasets progan stylegan biggan \
--ckpt runs/DoU/best.pth \
--output result.xlsx
```
#### Run evaluation on CPU
```bash
python test.py \
--data-root xxx \
--ckpt runs/DoU/best.pth \
--device cpu
```
#### Skip missing dataset folders
```bash
python test.py \
--data-root xxx \
--ckpt runs/DoU/best.pth \
--skip-missing
```
#### Show all command-line options
```bash
python test.py --help
```
---
## ποΈ Training
The training code is the next part to be released.
Planned next update:
| Item | Description |
| --- | --- |
| Training pipeline | End-to-end training entry point. |
| Dataset preparation | CSV generation for training and validation. |
| Configurations | Hyperparameters and training settings. |
| Reproducibility guide | Instructions for reproducing reported results. |
---
## π Notes
- Released testing code and pretrained weights can already be used for evaluation.
- Training code and training data preparation instructions will be added in the next update.
- Please check the command-line options before running on a new environment.
|