{"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/benchmarking-counterfactual-image-generation","title":"Benchmarking Counterfactual Image Generation","arxiv_id":"2403.20287","date":"2024-03-29","proceeding":null,"authors":["Thomas Melistas","Nikos Spyrou","Nefeli Gkouti","Pedro Sanchez","Athanasios Vlontzos","Yannis Panagakis","Giorgos Papanastasiou","Sotirios A. Tsaftaris"],"abstract":"Generative AI has revolutionised visual content editing, empowering users to effortlessly modify images and videos. However, not all edits are equal. To perform realistic edits in domains such as natural image or medical imaging, modifications must respect causal relationships inherent to the data generation process. Such image editing falls into the counterfactual image generation regime. Evaluating counterfactual image generation is substantially complex: not only it lacks observable ground truths, but also requires adherence to causal constraints. Although several counterfactual image generation methods and evaluation metrics exist, a comprehensive comparison within a unified setting is lacking. We present a comparison framework to thoroughly benchmark counterfactual image generation methods. We integrate all models that have been used for the task at hand and expand them to novel datasets and causal graphs, demonstrating the superiority of Hierarchical VAEs across most datasets and metrics. Our framework is implemented in a user-friendly Python package that can be extended to incorporate additional SCMs, causal methods, generative models, and datasets for the community to build on. Code: https://github.com/gulnazaki/counterfactual-benchmark.","url_abs":"https://arxiv.org/abs/2403.20287v5","url_pdf":"https://arxiv.org/pdf/2403.20287v5.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":"benchmarking-counterfactual-image-generation","repo_url":"https://github.com/gulnazaki/counterfactual-benchmark","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"benchmarking","task_name":"Benchmarking"},{"task_slug":"conditional-image-generation","task_name":"Conditional Image Generation"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":null,"task_name":"counterfactual"}],"methods":[{"method_slug":"focus","method_name":"Focus"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2403.20287","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.20287"}},"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/gulnazaki/counterfactual-benchmark","reach":null}],"summary":{"ran_violates":1,"ran":1,"unverified":2},"by_repo_kind":{"official":{"samples":4,"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":0,"samples":[{"code_sha256_prefix":"5e285bd2bfc073a5","entry":"different_value","repo":"gulnazaki/counterfactual-benchmark","repo_kind":"official","path":"counterfactual_benchmark/methods/deepscm/evaluate.py","file_url":"https://github.com/gulnazaki/counterfactual-benchmark/blob/HEAD/counterfactual_benchmark/methods/deepscm/evaluate.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5e285bd2bfc073a5"}},{"code_sha256_prefix":"7d4f61ceefcb153d","entry":"produce_counterfactuals","repo":"gulnazaki/counterfactual-benchmark","repo_kind":"official","path":"counterfactual_benchmark/methods/deepscm/evaluate.py","file_url":"https://github.com/gulnazaki/counterfactual-benchmark/blob/HEAD/counterfactual_benchmark/methods/deepscm/evaluate.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7d4f61ceefcb153d"}},{"code_sha256_prefix":"3b664a00760f9c2a","entry":"composition","repo":"gulnazaki/counterfactual-benchmark","repo_kind":"official","path":"counterfactual_benchmark/evaluation/metrics/composition.py","file_url":"https://github.com/gulnazaki/counterfactual-benchmark/blob/HEAD/counterfactual_benchmark/evaluation/metrics/composition.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3b664a00760f9c2a"}},{"code_sha256_prefix":"785be62d438020c7","entry":"l1_distance","repo":"gulnazaki/counterfactual-benchmark","repo_kind":"official","path":"counterfactual_benchmark/evaluation/metrics/composition.py","file_url":"https://github.com/gulnazaki/counterfactual-benchmark/blob/HEAD/counterfactual_benchmark/evaluation/metrics/composition.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"785be62d438020c7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}