[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-83833":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":15,"stars7d":16,"stars30d":16,"stars90d":12,"forks30d":12,"starsTrendScore":17,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":24,"readmeContent":25,"aiSummary":9,"trendingCount":12,"starSnapshotCount":12,"syncStatus":13,"lastSyncTime":26,"discoverSource":27},83833,"GenShield","zhipeixu\u002FGenShield","zhipeixu","🔥 [ICML 2026] GenShield: Unified Detection and Artifact Correction for AI-Generated Images",null,"Python",61,0,2,3,1,7,8,46.2,"Apache License 2.0",false,"main",true,[],"2026-06-12 04:01:42","\u003Cdiv align=\"center\">\n\u003Cimg src=\".\u002Fassets\u002Flogo.png\" alt=\"GenShield Logo\" width=\"600\" height=\"150\">\n\u003Ch3> GenShield: Unified Detection and Artifact Correction for AI-Generated Images \u003C\u002Fh3>\n\u003Ch4> 🔥 ICML 2026 \u003C\u002Fh4>\n\nZhipei Xu\u003Csup>1,\\*\u003C\u002Fsup>,\nXuanyu Zhang\u003Csup>1,\\*\u003C\u002Fsup>,\nYoumin Xu\u003Csup>2,\\*\u003C\u002Fsup>,\nQing Huang\u003Csup>1\u003C\u002Fsup>,\nShen Chen\u003Csup>2\u003C\u002Fsup>,\nTaiping Yao\u003Csup>2\u003C\u002Fsup>,\nShouhong Ding\u003Csup>2\u003C\u002Fsup>,\nJian Zhang\u003Csup>1\u003C\u002Fsup>\n\n\u003Csup>1\u003C\u002Fsup> School of Electronic and Computer Engineering, Peking University &nbsp;&nbsp;\n\u003Csup>2\u003C\u002Fsup> Tencent Youtu Lab\n\n\n\u003C!-- TODO(user): fill in arXiv ID once available -->\n[![arXiv](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FArxiv-2605.16122-b31b1b.svg?logo=arXiv)](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2605.16122)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache%202.0-yellow)](.\u002FLICENSE)\n![Visitors](https:\u002F\u002Fvisitor-badge.laobi.icu\u002Fbadge?page_id=zhipeixu.GenShield)\n\n\n\u003C\u002Fdiv>\n\n\n---\n\n\n\u003Cdetails open>\u003Csummary>💡 We also have other related projects on AI-generated content forensics that may interest you ✨. \u003C\u002Fsummary>\u003Cp>\n\n> [**FakeShield: Explainable Image Forgery Detection and Localization via Multi-modal Large Language Models [ICLR 2025]**](https:\u002F\u002Farxiv.org\u002Fabs\u002F2410.02761) \u003Cbr>\n> Zhipei Xu, Xuanyu Zhang, Runyi Li, Zecheng Tang, Qing Huang, Jian Zhang \u003Cbr>\n[![github](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F-Github-black?logo=github)](https:\u002F\u002Fgithub.com\u002Fzhipeixu\u002FFakeShield)  [![github](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fzhipeixu\u002FFakeShield.svg?style=social)](https:\u002F\u002Fgithub.com\u002Fzhipeixu\u002FFakeShield) [![arXiv](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FArxiv-2410.02761-b31b1b.svg?logo=arXiv)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2410.02761) \u003Cbr>\n\n> [**AvatarShield: Visual Reinforcement Learning for Human-Centric Video Forgery Detection**](https:\u002F\u002Farxiv.org\u002Fabs\u002F2505.15173) \u003Cbr>\n> Zhipei Xu, Xuanyu Zhang, Xing Zhou, Jian Zhang \u003Cbr>\n[![github](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F-Github-black?logo=github)](https:\u002F\u002Fgithub.com\u002Fzhipeixu\u002FAvatarShield)  [![github](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fzhipeixu\u002FAvatarShield.svg?style=social)](https:\u002F\u002Fgithub.com\u002Fzhipeixu\u002FAvatarShield) [![arXiv](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FArxiv-2505.15173-b31b1b.svg?logo=arXiv)](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2505.15173) \u003Cbr>\n\n> [**EditGuard: Versatile Image Watermarking for Tamper Localization and Copyright Protection [CVPR 2024]**](https:\u002F\u002Farxiv.org\u002Fabs\u002F2312.08883) \u003Cbr>\n> Xuanyu Zhang, Runyi Li, Jiwen Yu, Youmin Xu, Weiqi Li, Jian Zhang \u003Cbr>\n[![github](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F-Github-black?logo=github)](https:\u002F\u002Fgithub.com\u002Fxuanyuzhang21\u002FEditGuard)  [![github](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fxuanyuzhang21\u002FEditGuard.svg?style=social)](https:\u002F\u002Fgithub.com\u002Fxuanyuzhang21\u002FEditGuard) [![arXiv](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FArxiv-2312.08883-b31b1b.svg?logo=arXiv)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2312.08883) \u003Cbr>\n\n> [**OmniGuard: Hybrid Manipulation Localization via Augmented Versatile Deep Image Watermarking [CVPR 2025]**](https:\u002F\u002Farxiv.org\u002Fabs\u002F2412.01615) \u003Cbr>\n> Xuanyu Zhang, Zecheng Tang, Zhipei Xu, Runyi Li, Youmin Xu, Bin Chen, Feng Gao, Jian Zhang \u003Cbr>\n[![github](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F-Github-black?logo=github)](https:\u002F\u002Fgithub.com\u002Fxuanyuzhang21\u002FOmniGuard)  [![github](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fxuanyuzhang21\u002FOmniGuard.svg?style=social)](https:\u002F\u002Fgithub.com\u002Fxuanyuzhang21\u002FOmniGuard) [![arXiv](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FArxiv-2412.01615-b31b1b.svg?logo=arXiv)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2412.01615) \u003Cbr>\n\n\u003C\u002Fp>\u003C\u002Fdetails>\n\n\n## 📰 News\n\n\u003C!-- TODO(user): fill in actual acceptance \u002F release dates -->\n* **[2026.05.01]** 🎉🎉🎉 GenShield has been accepted at **ICML 2026**!\n* **[2026.05.15]** 🔥 We released the **GenShield** paper on [arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2605.16122) and open-sourced the training & evaluation code. Welcome to **star** ⭐️ and **watch** 👀 this repository for the latest updates.\n\n\n## \u003Cimg id=\"painting_icon\" width=\"3%\" src=\"https:\u002F\u002Fcdn-icons-png.flaticon.com\u002F128\u002F1022\u002F1022330.png\"> GenShield Overview\n\nWhile AIGI detection has progressed substantially, **how to correct detected AI-generated images with visible artifacts and restore a realistic appearance remains largely underexplored**, and few prior works connect the two tasks. Existing pipelines mark artifacts with boxes or masks and rely on a frozen inpainting model, which suffers from unreliable localization, a frozen-generator bottleneck, and seam artifacts.\n\nWe propose **GenShield**, a unified autoregressive framework that *jointly* performs **explainable AIGI detection** and **mask-free, end-to-end artifact correction** in a closed loop from diagnosis to restoration. Built on a Mixture-of-Transformers (MoT) backbone, GenShield couples a **Detection Expert** and an **Artifact Correction Expert** through shared self-attention at every layer, so that the two tasks reinforce each other. We further introduce a **Visual Chain-of-Thought (VCoT) curriculum** that progresses from instruction-guided correction to multi-step \"diagnose-then-repair\" self-correction with an explicit stopping criterion, and construct **GenShield-Set**, comprising precisely aligned \"artifact–restored\" image pairs (built on SynthScars) and structured detection annotations (built on Holmes-Set).\n\n![GenShield Pipeline](.\u002Fassets\u002Fmethod.png)\n\n\n## 🏆 Contributions\n\n- **Unified Autoregressive Framework.** The first unified autoregressive framework that connects AIGI detection and artifact correction, forming an end-to-end \"diagnose → restore\" loop via a MoT architecture with shared self-attention.\n\n- **VCoT-based Curriculum Learning.** A Visual Chain-of-Thought curriculum that transitions from instruction-guided correction to multi-step self-correction with an explicit stopping criterion, while keeping detection active throughout training.\n\n- **GenShield-Set Dataset.** A high-quality dataset of precisely aligned \"artifact–restored\" image pairs and structured detection annotations, tailored for unified AIGI detection and correction.\n\n- **State-of-the-Art Performance.** 98.8% mean accuracy and 99.8% A.P. on the Holmes-Set detection benchmark across 10 generators, with correction quality surpassing advanced closed-source generators.\n\n\n## 🛠️ Requirements and Installation\n\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fzhipeixu\u002FGenShield.git\ncd GenShield\nconda create -n genshield python=3.10 -y\nconda activate genshield\npip install -r requirements.txt\npip install flash_attn==2.5.8 --no-build-isolation\n```\n\n\n## 🏋️‍♂️ Train\n\n### Base Model Preparation\n\nGenShield is initialized from `BAGEL-7B-MoT`. Download the base weights:\n\n```bash\npip install huggingface_hub\nhuggingface-cli download --resume-download ByteDance-Seed\u002FBAGEL-7B-MoT --local-dir weight\u002FBAGEL-7B-MoT\n```\n\n### Data Preparation\n\nOur training data consists of **GenShield-Set-Detect**, built on top of Holmes-Set, and **GenShield-Set-Correct**, built on top of SynthScars.\n\n1. **`GenShield-Set-Detect`** — download from [Holmes-Set](https:\u002F\u002Fgithub.com\u002Fwyczzy\u002FAIGI-Holmes).\n2. **`GenShield-Set-Correct`** — download from our HuggingFace repository (**coming soon**).\n\nAfter downloading, edit [`data\u002Fdataset_info.py`](.\u002Fdata\u002Fdataset_info.py) and update each entry's `jsonl_path`, `data_dir`, and `num_total_samples` to match your local dataset layout. The sampling weights and image-transform settings are declared separately in the YAML configs under [`data\u002Fconfigs\u002F`](.\u002Fdata\u002Fconfigs).\n\n> **Before launching training, also replace the placeholder absolute paths (`\u002Fpath\u002Fto\u002F...`) in `scripts\u002F*.sh` with paths on your own machine.**\n\n### Stage 1 — Instruction-Guided Correction + AIGI Detection\n\nStage 1 jointly trains the Correction Expert with strong supervision from explicit defect descriptions, and the Detection Expert with structured detection annotations. The data mixture and sampling ratios are declared in [`data\u002Fconfigs\u002Fstage1.yaml`](.\u002Fdata\u002Fconfigs\u002Fstage1.yaml).\n\n```bash\nbash scripts\u002Ftrain_stage1.sh\n```\n\n\n### Stage 2 — VCoT Self-Correction + AIGI Detection\n\nStage 2 keeps detection training unchanged and upgrades correction from external-instruction editing to **multi-step Visual Chain-of-Thought (VCoT) self-correction with an explicit stopping criterion**. The data mixture and ratios are declared in [`data\u002Fconfigs\u002Fstage2.yaml`](.\u002Fdata\u002Fconfigs\u002Fstage2.yaml).\n\n![GenShield Pipeline](.\u002Fassets\u002FVCoT.png)\n\nThe pipeline samples four interleaved sub-tasks during training:\n\n| Sub-task | Input | Output | Loss |\n|---|---|---|---|\n| `correction_stage2_initial`      | anomalous AIGI                       | defect-diagnosis text + repaired image   | CE + MSE |\n| `correction_stage2_terminate`    | already-clean image                  | \"no anomaly\" diagnosis + same image      | CE + MSE |\n| `correction_stage2_intermediate` | half-repaired image (Stage-1 output) | continuation text + fully-repaired image | MSE (image only) |\n| `aigi_detection`                 | image                                | structured `\u003Cdetect>\u003Ccaption>\u003Creason>`   | CE |\n\n```bash\nbash scripts\u002Ftrain_stage2.sh\n```\n\n\n## 🎯 Test\n\n### AIGI Detection\n\nDetect whether an image is AI-generated or real, together with a natural-language explanation.\n\nEdit the paths in `scripts\u002Finfer_aigi_detection.sh`, then run:\n\n```bash\nbash scripts\u002Finfer_aigi_detection.sh\n```\n\nThe script wraps `inference\u002Finfer_aigi_detection.py` and exposes the following knobs:\n\n- `MODEL_PATH`: path to the `BAGEL-7B-MoT` base directory (used for tokenizer \u002F VAE \u002F ViT).\n- `CHECKPOINT_PATH`: path to your trained GenShield checkpoint (`ema.safetensors`).\n- `IMAGE_FOLDER`: a folder that contains `real\u002F` and\u002For `fake\u002F` subfolders. The script walks both and writes per-image predictions into a JSONL file under the same folder, which can then be diffed against ground truth to compute accuracy.\n- `PROMPT`: the detection question fed to the model (default: *\"Please evaluate whether this image is an AI creation or something real, and provide an explanation.\"*).\n- `MAX_IMAGES`, `SEED`: optional caps and random seed.\n\nWe follow the evaluation protocol of [Holmes-Set](https:\u002F\u002Fgithub.com\u002Fwyczzy\u002FAIGI-Holmes), which spans 10 generators (Janus, Janus-Pro-1B, Janus-Pro-7B, Show-o, LlamaGen, Infinity, VAR, PixArt-XL, SD3.5-Large, FLUX). Run the script for each generator's subfolder, then aggregate the per-image JSONL outputs to compute per-generator accuracy \u002F A.P.\n\n\u003C!-- TODO(user): we currently produce per-image JSONL but do not ship a per-generator aggregation script. Please tell me whether you want one bundled in the release. -->\n\n### Artifact Correction\n\nWe evaluate correction on the **SynthScars** benchmark using both single-step (Stage-1) and iterative VCoT (Stage-2) variants:\n\n```bash\n# Stage-1: caption-guided single-step repair\nbash scripts\u002Finfer_stage1_repair.sh\n\n# Stage-2: \"diagnose-then-repair\" with auto-generated description\nbash scripts\u002Finfer_stage2_repair.sh\n```\n\nBoth scripts expose BAGEL-style sampling knobs (`CFG_TEXT_SCALE`, `CFG_IMG_SCALE`, `NUM_TIMESTEPS`, `TIMESTEP_SHIFT`, ...) and write the restored images plus a `results.json(l)` file to `OUTPUT_DIR` for downstream metric computation.\n\n\n## 📊 Main Results\n\n### Qualitative Results\n\n![Qualitative correction results](.\u002Fassets\u002Fresult.png)\n\n\u003C!-- TODO(user): paste the final numbers + Table 1 \u002F Table 2 from the camera-ready PDF that you want to surface in the README. I have intentionally not transcribed numbers beyond the headline figure (98.8% \u002F 99.8%) to avoid OCR errors. -->\n\n\n## 📜 Citation\n\nIf you find GenShield useful for your research, please consider citing:\n\n```bibtex\n@inproceedings{xu2026genshield,\n    title     = {GenShield: Unified Detection and Artifact Correction for AI-Generated Images},\n    author    = {Xu, Zhipei and Zhang, Xuanyu and Xu, Youmin and Huang, Qing and Chen, Shen and Yao, Taiping and Ding, Shouhong and Zhang, Jian},\n    booktitle = {Proceedings of the 43rd International Conference on Machine Learning (ICML)},\n    year      = {2026}\n}\n```\n\n\n## 🙏 Acknowledgement\n\nGenShield is built on top of the excellent open-source efforts of the community. We sincerely thank:\n\n- [**BAGEL**](https:\u002F\u002Fgithub.com\u002Fbytedance-seed\u002FBAGEL) — the Mixture-of-Transformers backbone we adopt and extend.\n- [**LEGION**](https:\u002F\u002Fgithub.com\u002Fopendatalab\u002FLEGION) — anomaly annotations used to construct `GenShield-Set-Correct`.\n- [**AIGI-Holmes**](https:\u002F\u002Fgithub.com\u002Fwyczzy\u002FAIGI-Holmes) — detection annotations used to construct `GenShield-Set-Detect`.\n","2026-06-11 04:11:36","CREATED_QUERY"]