{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/on-the-use-of-benford-s-law-to-detect-gan","title":"On the use of Benford's law to detect GAN-generated images","arxiv_id":"2004.07682","date":"2020-04-16","proceeding":null,"authors":["Nicolò Bonettini","Paolo Bestagini","Simone Milani","Stefano Tubaro"],"abstract":"The advent of Generative Adversarial Network (GAN) architectures has given anyone the ability of generating incredibly realistic synthetic imagery. The malicious diffusion of GAN-generated images may lead to serious social and political consequences (e.g., fake news spreading, opinion formation, etc.). It is therefore important to regulate the widespread distribution of synthetic imagery by developing solutions able to detect them. In this paper, we study the possibility of using Benford's law to discriminate GAN-generated images from natural photographs. Benford's law describes the distribution of the most significant digit for quantized Discrete Cosine Transform (DCT) coefficients. Extending and generalizing this property, we show that it is possible to extract a compact feature vector from an image. This feature vector can be fed to an extremely simple classifier for GAN-generated image detection purpose.","url_abs":"https://arxiv.org/abs/2004.07682v1","url_pdf":"https://arxiv.org/pdf/2004.07682v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"on-the-use-of-benford-s-law-to-detect-gan","repo_url":"https://github.com/polimi-ispl/icpr-benford-gan","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":null}],"tasks":[{"task_slug":"gan-image-forensics","task_name":"GAN image forensics"},{"task_slug":null,"task_name":"Generative Adversarial Network"}],"methods":[{"method_slug":"discrete-cosine-transform","method_name":"Discrete Cosine Transform"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2004.07682","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2004.07682"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/polimi-ispl/icpr-benford-gan","reach":null}],"summary":{"ran_draft_wrong":1,"ran_violates":1},"by_repo_kind":{"official":{"samples":2,"ran":2,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":2,"samples":[{"code_sha256_prefix":"1c84bcda47f0f9e7","entry":"compute_histograms","repo":"polimi-ispl/icpr-benford-gan","repo_kind":"official","path":"extract_first_digit_hist.py","file_url":"https://github.com/polimi-ispl/icpr-benford-gan/blob/HEAD/extract_first_digit_hist.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"1c84bcda47f0f9e7"}},{"code_sha256_prefix":"309dbf28a731a1f6","entry":"first_digit_gen","repo":"polimi-ispl/icpr-benford-gan","repo_kind":"official","path":"extract_first_digit_hist.py","file_url":"https://github.com/polimi-ispl/icpr-benford-gan/blob/HEAD/extract_first_digit_hist.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"309dbf28a731a1f6"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}