Learning Generalizable Visual Representations for AI-Generated Image Detection

Authors

  • Roaa Ghanim General Directorate of Education in Al- Qadisiyah Govemorate, Diwaniyah, Iraq
  • Nibras Hmaizah General Directorate of Education in Al- Qadisiyah Govemorate, Diwaniyah, Iraq

DOI:

https://doi.org/10.71229/4kj12980

Keywords:

AI-generated image detection, synthetic image forensics, domain generalisation, representation learning, frequency analysis, adversarial invariance, model calibration

Abstract

Detectors of AI generated images often perform extremely well when learning from generators they have never encountered information from, and fail when learning from generators they have not learned from. Detectors of AI generated images typically have an accuracy rate of almost 100% when they are trained on generators they have not seen information from, but perform poorly when they are trained on generators they have not seen information from, or when they are trained on a visual subject matter they have not seen information from. This paper poses the question of which visual representations actually convey transferable evidence of synthetic image formation. Using a controlled corpus of 217,100 images spanning twelve generators from five architectural families (style-based GANs, latent diffusion, pixel-space diffusion, autoregressive transformers and closed commercial systems) and five semantic domains, in which real and generated images are matched on prompt, resolution, aspect ratio, format and compression and de-duplicated by perceptual hashing and embedding similarity, we benchmark nine representation families under a common parameter budget. We then propose three-stream detector, GVR-Det, which incorporates a semantic-structural, a local-forensic, and a spectral encoder, all of which are connected by a gate, and which is trained by class-conditional generator and domain-invariance, cross-generator contrastive alignment and transformation consistency. In addition to accuracy we quantify generator leakage, domain leakage, class-conditional maximum mean discrepancy and centred kernel alignment, under leave-one-generator-out, leave-one-family-out, leave-one-domain-out and joint protocols. The best transferring representation is not the best distributing representation: there is significant domain information in the global semantic features, while the residual and spectral features are more stable across the generator families, but more vulnerable to compression. The gated, invariance-regularised model is the best joint out-of-distribution behaviour and its generator leakage only drops from 0.914 to 0.402; it degrades the least when JPEG re-encoded, rescaled and blurred.

References

[1] I. J. Goodfellow et al., “Generative adversarial nets,” in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS), 2014, pp. 2672–2680.

[2] T. Karras, S. Laine, and T. Aila, “A style-based generator architecture for generative adversarial networks,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR), 2019, pp. 4401–4410.

[3] T. Karras, S. Laine, M. Aittala, J. Hellsten, J. Lehtinen, and T. Aila, “Analyzing and improving the image quality of StyleGAN,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR), 2020, pp. 8110–8119.

[4] J. Ho, A. Jain, and P. Abbeel, “Denoising diffusion probabilistic models,” in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS), 2020, pp. 6840–6851.

[5] R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer, “High-resolution image synthesis with latent diffusion models,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR), 2022, pp. 10684–10695.

[6] P. Esser, R. Rombach, and B. Ommer, “Taming transformers for high-resolution image synthesis,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR), 2021, pp. 12873–12883.

[7] A. Ramesh, P. Dhariwal, A. Nichol, C. Chu, and M. Chen, “Hierarchical text-conditional image generation with CLIP latents,” arXiv:2204.06125, 2022.

[8] S.-Y. Wang, O. Wang, R. Zhang, A. Owens, and A. A. Efros, “CNN-generated images are surprisingly easy to spot… for now,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR), 2020, pp. 8695–8704.

[9] L. Verdoliva, “Media forensics and DeepFakes: An overview,” IEEE J. Sel. Topics Signal Process., vol. 14, no. 5, pp. 910–932, 2020.

[10] J. Frank, T. Eisenhofer, L. Schönherr, A. Fischer, D. Kolossa, and T. Holz, “Leveraging frequency analysis for deep fake image recognition,” in Proc. Int. Conf. Mach. Learn. (ICML), 2020, pp. 3247–3258.

[11] R. Durall, M. Keuper, and J. Keuper, “Watch your up-convolution: CNN based generative deep neural networks are failing to reproduce spectral distributions,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR), 2020, pp. 7890–7899.

[12] N. Yu, L. S. Davis, and M. Fritz, “Attributing fake images to GANs: Learning and analyzing GAN fingerprints,” in Proc. IEEE/CVF Int. Conf. Comput. Vis. (ICCV), 2019, pp. 7556–7566.

[13] U. Ojha, Y. Li, and Y. J. Lee, “Towards universal fake image detectors that generalize across generative models,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR), 2023, pp. 24480–24489.

[14] Z. Wang et al., “DIRE for diffusion-generated image detection,” in Proc. IEEE/CVF Int. Conf. Comput. Vis. (ICCV), 2023, pp. 22445–22455.

[15] R. Corvi, D. Cozzolino, G. Zingarini, G. Poggi, K. Nagano, and L. Verdoliva, “On the detection of synthetic images generated by diffusion models,” in Proc. IEEE Int. Conf. Acoust., Speech, Signal Process. (ICASSP), 2023, pp. 1–5.

[16] L. Chai, D. Bau, S.-N. Lim, and P. Isola, “What makes fake images detectable? Understanding properties that generalize,” in Proc. Eur. Conf. Comput. Vis. (ECCV), 2020, pp. 103–120.

[17] F. Marra, D. Gragnaniello, L. Verdoliva, and G. Poggi, “Do GANs leave artificial fingerprints?” in Proc. IEEE Conf. Multimedia Inf. Process. Retrieval (MIPR), 2019, pp. 506–511.

[18] D. Gragnaniello, D. Cozzolino, F. Marra, G. Poggi, and L. Verdoliva, “Are GAN generated images easy to detect? A critical analysis of the state-of-the-art,” in Proc. IEEE Int. Conf. Multimedia Expo (ICME), 2021, pp. 1–6.

[19] X. Zhang, S. Karaman, and S.-F. Chang, “Detecting and simulating artifacts in GAN fake images,” in Proc. IEEE Int. Workshop Inf. Forensics Security (WIFS), 2019, pp. 1–6.

[20] R. Corvi, D. Cozzolino, G. Poggi, K. Nagano, and L. Verdoliva, “Intriguing properties of synthetic images: From generative adversarial networks to diffusion models,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. Workshops (CVPRW), 2023, pp. 973–982.

[21] J. Fridrich and J. Kodovský, “Rich models for steganalysis of digital images,” IEEE Trans. Inf. Forensics Security, vol. 7, no. 3, pp. 868–882, 2012.

[22] M. Zhu et al., “GenImage: A million-scale benchmark for detecting AI-generated image,” in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS) Datasets and Benchmarks Track, 2023.

[23] C. Tan, Y. Zhao, S. Wei, G. Gu, and Y. Wei, “Learning on gradients: Generalized artifacts representation for GAN-generated images detection,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR), 2023, pp. 12105–12114.

[24] C. Tan, H. Liu, Y. Zhao, S. Wei, G. Gu, P. Liu, and Y. Wei, “Rethinking the up-sampling operations in CNN-based generative network for generalizable deepfake detection,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR), 2024, pp. 28130–28139.

[25] H. Liu, Z. Tan, C. Tan, Y. Wei, Y. Zhao, and J. Wang, “Forgery-aware adaptive transformer for generalizable synthetic image detection,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR), 2024, pp. 10770–10780.

[26] D. Cozzolino, G. Poggi, R. Corvi, M. Nießner, and L. Verdoliva, “Raising the bar of AI-generated image detection with CLIP,” in Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. Workshops (CVPRW), 2024, pp. 4356–4366.

[27] Z. Sha, Z. Li, N. Yu, and Y. Zhang, “DE-FAKE: Detection and attribution of fake images generated by text-to-image generation models,” in Proc. ACM SIGSAC Conf. Comput. Commun. Security (CCS), 2023, pp. 3418–3432.

[28] J. Ricker, S. Damm, T. Holz, and A. Fischer, “Towards the detection of diffusion model deepfakes,” in Proc. Int. Conf. Comput. Vis. Theory Appl. (VISAPP), 2024, pp. 446–457.

[29] P. Grommelt, L. Weiss, F.-J. Pfreundt, and J. Keuper, “Fake or JPEG? Revealing common biases in generated image detection datasets,” arXiv:2403.17608, 2024.

[30] A. Radford et al., “Learning transferable visual models from natural language supervision,” in Proc. Int. Conf. Mach. Learn. (ICML), 2021, pp. 8748–8763.

[31] M. Oquab et al., “DINOv2: Learning robust visual features without supervision,” Trans. Mach. Learn. Res. (TMLR), 2024.

[32] Y. Ganin and V. Lempitsky, “Unsupervised domain adaptation by backpropagation,” in Proc. Int. Conf. Mach. Learn. (ICML), 2015, pp. 1180–1189.

[33] P. Khosla et al., “Supervised contrastive learning,” in Proc. Adv. Neural Inf. Process. Syst. (NeurIPS), 2020, pp. 18661–18673.

[34] A. Gretton, K. M. Borgwardt, M. J. Rasch, B. Schölkopf, and A. Smola, “A kernel two-sample test,” J. Mach. Learn. Res., vol. 13, pp. 723–773, 2012.

[35] S. Kornblith, M. Norouzi, H. Lee, and G. Hinton, “Similarity of neural network representations revisited,” in Proc. Int. Conf. Mach. Learn. (ICML), 2019, pp. 3519–3529.

[36] C. Guo, G. Pleiss, Y. Sun, and K. Q. Weinberger, “On calibration of modern neural networks,” in Proc. Int. Conf. Mach. Learn. (ICML), 2017, pp. 1321–1330.

[37] A. Dosovitskiy et al., “An image is worth 16x16 words: Transformers for image recognition at scale,” in Proc. Int. Conf. Learn. Representations (ICLR), 2021.

[38] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár, “Focal loss for dense object detection,” in Proc. IEEE Int. Conf. Comput. Vis. (ICCV), 2017, pp. 2980–2988.

fig 2

Downloads

Published

2026-07-30

Issue

Section

Original Articles

How to Cite

Learning Generalizable Visual Representations for AI-Generated Image Detection. (2026). Al-Noor Journal of Engineering Management and Computer Science, 2(2), 432-451. https://doi.org/10.71229/4kj12980

Similar Articles

21-30 of 46

You may also start an advanced similarity search for this article.