{"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/contrastive-learning-for-unpaired-image-to","title":"Contrastive Learning for Unpaired Image-to-Image Translation","arxiv_id":"2007.15651","date":"2020-07-30","proceeding":null,"authors":["Taesung Park","Alexei A. Efros","Richard Zhang","Jun-Yan Zhu"],"abstract":"In image-to-image translation, each patch in the output should reflect the content of the corresponding patch in the input, independent of domain. We propose a straightforward method for doing so -- maximizing mutual information between the two, using a framework based on contrastive learning. The method encourages two elements (corresponding patches) to map to a similar point in a learned feature space, relative to other elements (other patches) in the dataset, referred to as negatives. We explore several critical design choices for making contrastive learning effective in the image synthesis setting. Notably, we use a multilayer, patch-based approach, rather than operate on entire images. Furthermore, we draw negatives from within the input image itself, rather than from the rest of the dataset. We demonstrate that our framework enables one-sided translation in the unpaired image-to-image translation setting, while improving quality and reducing training time. In addition, our method can even be extended to the training setting where each \"domain\" is only a single image.","url_abs":"https://arxiv.org/abs/2007.15651v3","url_pdf":"https://arxiv.org/pdf/2007.15651v3.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":"contrastive-learning-for-unpaired-image-to","repo_url":"https://github.com/taesungp/contrastive-unpaired-translation","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"contrastive-learning-for-unpaired-image-to","repo_url":"https://github.com/DeepMIALab/AI-FFPE","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"contrastive-learning-for-unpaired-image-to","repo_url":"https://github.com/JunlinHan/CWR","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"contrastive-learning-for-unpaired-image-to","repo_url":"https://github.com/JunlinHan/DCLGAN","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"contrastive-learning-for-unpaired-image-to","repo_url":"https://github.com/XiudingCai/EnCo-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"paper_slug":"contrastive-learning-for-unpaired-image-to","repo_url":"https://github.com/XiudingCai/PyTorch-EnCo","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"paper_slug":"contrastive-learning-for-unpaired-image-to","repo_url":"https://github.com/cryu854/CUT","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"contrastive-learning-for-unpaired-image-to","repo_url":"https://github.com/ganslate-team/ganslate","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"contrastive-learning-for-unpaired-image-to","repo_url":"https://github.com/hthoai/UI2IT","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"contrastive-learning-for-unpaired-image-to","repo_url":"https://github.com/msseibel/accut","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"image-to-image-translation","task_name":"Image-to-Image Translation"},{"task_slug":"translation","task_name":"Translation"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2007.15651","atlas_url":"https://app.syntology.ai/?focus=2007.15651","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2007.15651"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/JunlinHan/CWR","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/msseibel/accut","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ganslate-team/ganslate","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/taesungp/contrastive-unpaired-translation","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/XiudingCai/PyTorch-EnCo","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/hthoai/UI2IT","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/XiudingCai/EnCo-pytorch","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/JunlinHan/DCLGAN","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/cryu854/CUT","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/DeepMIALab/AI-FFPE","reach":{"status":"ok","spdx":"NOASSERTION"}}],"summary":{"ran_draft_wrong":3,"ran_honours":1,"ran":3,"ran_fixture":2},"by_repo_kind":{"listed":{"samples":9,"ran":9,"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":"44c69c91b5434020","entry":"fused_leaky_relu","repo":"XiudingCai/EnCo-pytorch","repo_kind":"listed","path":"models/stylegan_networks.py","file_url":"https://github.com/XiudingCai/EnCo-pytorch/blob/HEAD/models/stylegan_networks.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"44c69c91b5434020"}},{"code_sha256_prefix":"acc24402a2d089fa","entry":"get_filter","repo":"XiudingCai/EnCo-pytorch","repo_kind":"listed","path":"models/networks.py","file_url":"https://github.com/XiudingCai/EnCo-pytorch/blob/HEAD/models/networks.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"acc24402a2d089fa"}},{"code_sha256_prefix":"c8ceba12b6020549","entry":"get_gaussian_kernel","repo":"XiudingCai/EnCo-pytorch","repo_kind":"listed","path":"util/SWD/swd_pytorch.py","file_url":"https://github.com/XiudingCai/EnCo-pytorch/blob/HEAD/util/SWD/swd_pytorch.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"c8ceba12b6020549"}},{"code_sha256_prefix":"b27dffc0609fbec0","entry":"get_norm_layer","repo":"XiudingCai/EnCo-pytorch","repo_kind":"listed","path":"models/networks.py","file_url":"https://github.com/XiudingCai/EnCo-pytorch/blob/HEAD/models/networks.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"b27dffc0609fbec0"}},{"code_sha256_prefix":"50aa4a59fe718c61","entry":"get_pad_layer","repo":"XiudingCai/EnCo-pytorch","repo_kind":"listed","path":"models/networks.py","file_url":"https://github.com/XiudingCai/EnCo-pytorch/blob/HEAD/models/networks.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"50aa4a59fe718c61"}},{"code_sha256_prefix":"4a3a50d5b90d9dac","entry":"pyramid_down","repo":"XiudingCai/EnCo-pytorch","repo_kind":"listed","path":"util/SWD/swd_pytorch.py","file_url":"https://github.com/XiudingCai/EnCo-pytorch/blob/HEAD/util/SWD/swd_pytorch.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"4a3a50d5b90d9dac"}},{"code_sha256_prefix":"d6f847810616ed82","entry":"pyramid_up","repo":"XiudingCai/EnCo-pytorch","repo_kind":"listed","path":"util/SWD/swd_pytorch.py","file_url":"https://github.com/XiudingCai/EnCo-pytorch/blob/HEAD/util/SWD/swd_pytorch.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"d6f847810616ed82"}},{"code_sha256_prefix":"c5d084250637f1f8","entry":"upfirdn2d","repo":"XiudingCai/EnCo-pytorch","repo_kind":"listed","path":"models/stylegan_networks.py","file_url":"https://github.com/XiudingCai/EnCo-pytorch/blob/HEAD/models/stylegan_networks.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"c5d084250637f1f8"}},{"code_sha256_prefix":"200baf9e83c9a4de","entry":"upfirdn2d_native","repo":"XiudingCai/EnCo-pytorch","repo_kind":"listed","path":"models/stylegan_networks.py","file_url":"https://github.com/XiudingCai/EnCo-pytorch/blob/HEAD/models/stylegan_networks.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"200baf9e83c9a4de"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}