{"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/learning-flow-fields-in-attention-for","title":"Learning Flow Fields in Attention for Controllable Person Image Generation","arxiv_id":"2412.08486","date":"2024-12-11","proceeding":"CVPR 2025 1","authors":["Zijian Zhou","Shikun Liu","Xiao Han","Haozhe Liu","Kam Woh Ng","Tian Xie","Yuren Cong","Hang Li","Mengmeng Xu","Juan-Manuel Pérez-Rúa","Aditya Patel","Tao Xiang","Miaojing Shi","Sen He"],"abstract":"Controllable person image generation aims to generate a person image conditioned on reference images, allowing precise control over the person's appearance or pose. However, prior methods often distort fine-grained textural details from the reference image, despite achieving high overall image quality. We attribute these distortions to inadequate attention to corresponding regions in the reference image. To address this, we thereby propose learning flow fields in attention (Leffa), which explicitly guides the target query to attend to the correct reference key in the attention layer during training. Specifically, it is realized via a regularization loss on top of the attention map within a diffusion-based baseline. Our extensive experiments show that Leffa achieves state-of-the-art performance in controlling appearance (virtual try-on) and pose (pose transfer), significantly reducing fine-grained detail distortion while maintaining high image quality. Additionally, we show that our loss is model-agnostic and can be used to improve the performance of other diffusion models.","url_abs":"https://arxiv.org/abs/2412.08486v2","url_pdf":"https://arxiv.org/pdf/2412.08486v2.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":"learning-flow-fields-in-attention-for","repo_url":"https://github.com/franciszzj/leffa","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"attribute","task_name":"Attribute"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"pose-transfer","task_name":"Pose Transfer"},{"task_slug":"virtual-try-on","task_name":"Virtual Try-on"}],"methods":[{"method_slug":"attention","method_name":"Attention"},{"method_slug":"diffusion","method_name":"Diffusion"},{"method_slug":"softmax","method_name":"Softmax"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/pose-transfer-on-deep-fashion","task":"Pose Transfer","dataset":"Deep-Fashion","model":"Leffa","rank_in_archive_order":11,"of":12,"metrics":{"FID":"4.23"},"uses_additional_data":false},{"leaderboard":"/sota/virtual-try-on-on-dress-code","task":"Virtual Try-on","dataset":"Dress Code","model":"Leffa","rank_in_archive_order":1,"of":1,"metrics":{"FID":"2.06"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2412.08486","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2412.08486"}},"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/franciszzj/leffa","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":6},"by_repo_kind":{"official":{"samples":6,"ran":0,"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":"cbb87fb554fc2eaf","entry":"do_repaint","repo":"franciszzj/leffa","repo_kind":"official","path":"leffa/pipeline.py","file_url":"https://github.com/franciszzj/leffa/blob/HEAD/leffa/pipeline.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":"cbb87fb554fc2eaf"}},{"code_sha256_prefix":"bdd78e110a9ba9e2","entry":"latent_to_image","repo":"franciszzj/leffa","repo_kind":"official","path":"leffa/pipeline.py","file_url":"https://github.com/franciszzj/leffa/blob/HEAD/leffa/pipeline.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":"bdd78e110a9ba9e2"}},{"code_sha256_prefix":"de0de27c855054c4","entry":"numpy_to_pil","repo":"franciszzj/leffa","repo_kind":"official","path":"leffa/pipeline.py","file_url":"https://github.com/franciszzj/leffa/blob/HEAD/leffa/pipeline.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":"de0de27c855054c4"}},{"code_sha256_prefix":"13618485a328150e","entry":"pil_to_tensor","repo":"franciszzj/leffa","repo_kind":"official","path":"leffa/inference.py","file_url":"https://github.com/franciszzj/leffa/blob/HEAD/leffa/inference.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":"13618485a328150e"}},{"code_sha256_prefix":"ee6c62a5a094de2d","entry":"remove_cross_attention","repo":"franciszzj/leffa","repo_kind":"official","path":"leffa/model.py","file_url":"https://github.com/franciszzj/leffa/blob/HEAD/leffa/model.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":"ee6c62a5a094de2d"}},{"code_sha256_prefix":"d81381b327c76edd","entry":"zero_module","repo":"franciszzj/leffa","repo_kind":"official","path":"leffa/diffusion_model/unet_gen.py","file_url":"https://github.com/franciszzj/leffa/blob/HEAD/leffa/diffusion_model/unet_gen.py","link_basis":"harvester_set","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":"d81381b327c76edd"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}