{"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/content-aware-gan-compression","title":"Content-Aware GAN Compression","arxiv_id":"2104.02244","date":"2021-04-06","proceeding":"CVPR 2021 1","authors":["Yuchen Liu","Zhixin Shu","Yijun Li","Zhe Lin","Federico Perazzi","S. Y. Kung"],"abstract":"Generative adversarial networks (GANs), e.g., StyleGAN2, play a vital role in various image generation and synthesis tasks, yet their notoriously high computational cost hinders their efficient deployment on edge devices. Directly applying generic compression approaches yields poor results on GANs, which motivates a number of recent GAN compression works. While prior works mainly accelerate conditional GANs, e.g., pix2pix and CycleGAN, compressing state-of-the-art unconditional GANs has rarely been explored and is more challenging. In this paper, we propose novel approaches for unconditional GAN compression. We first introduce effective channel pruning and knowledge distillation schemes specialized for unconditional GANs. We then propose a novel content-aware method to guide the processes of both pruning and distillation. With content-awareness, we can effectively prune channels that are unimportant to the contents of interest, e.g., human faces, and focus our distillation on these regions, which significantly enhances the distillation quality. On StyleGAN2 and SN-GAN, we achieve a substantial improvement over the state-of-the-art compression method. Notably, we reduce the FLOPs of StyleGAN2 by 11x with visually negligible image quality loss compared to the full-size model. More interestingly, when applied to various image manipulation tasks, our compressed model forms a smoother and better disentangled latent manifold, making it more effective for image editing.","url_abs":"https://arxiv.org/abs/2104.02244v1","url_pdf":"https://arxiv.org/pdf/2104.02244v1.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":"content-aware-gan-compression","repo_url":"https://github.com/lychenyoko/content-aware-gan-compression","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"image-manipulation","task_name":"Image Manipulation"},{"task_slug":"knowledge-distillation","task_name":"Knowledge Distillation"}],"methods":[{"method_slug":"batch-normalization","method_name":"Batch Normalization"},{"method_slug":"concatenated-skip-connection","method_name":"Concatenated Skip Connection"},{"method_slug":"convolution","method_name":"Convolution"},{"method_slug":"cycle-consistency-loss","method_name":"Cycle Consistency Loss"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gan-least-squares-loss","method_name":"GAN Least Squares Loss"},{"method_slug":"instance-normalization","method_name":"Instance Normalization"},{"method_slug":"knowledge-distillation","method_name":"Knowledge Distillation"},{"method_slug":"patchgan","method_name":"PatchGAN"},{"method_slug":"path-length-regularization","method_name":"Path Length Regularization"},{"method_slug":"pix2pix","method_name":"Pix2Pix"},{"method_slug":"pruning","method_name":"Pruning"},{"method_slug":"r1-regularization","method_name":"R1 Regularization"},{"method_slug":"relu","method_name":"ReLU"},{"method_slug":"residual-block","method_name":"Residual Block"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"sigmoid-activation","method_name":"Sigmoid Activation"},{"method_slug":"stylegan2","method_name":"StyleGAN2"},{"method_slug":"tanh-activation","method_name":"Tanh Activation"},{"method_slug":"weight-demodulation","method_name":"Weight Demodulation"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2104.02244","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2104.02244"}},"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/lychenyoko/content-aware-gan-compression","reach":null}],"summary":{"ran":5,"ran_draft_wrong":3,"ran_violates":1,"unverified":7},"by_repo_kind":{"official":{"samples":16,"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":"1251cde09a254488","entry":"AttentionRefinementModule","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1251cde09a254488"}},{"code_sha256_prefix":"103e4a171a95689b","entry":"BasicBlock","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"103e4a171a95689b"}},{"code_sha256_prefix":"65ffe5a35cd297ca","entry":"BiSeNetOutput","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.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":"65ffe5a35cd297ca"}},{"code_sha256_prefix":"199ed6b9f3c73292","entry":"ConvBNReLU","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"199ed6b9f3c73292"}},{"code_sha256_prefix":"cc4b8cc6c40c39f8","entry":"Extract_Face_Mask","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cc4b8cc6c40c39f8"}},{"code_sha256_prefix":"1ef6184686bbc091","entry":"FeatureFusionModule","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1ef6184686bbc091"}},{"code_sha256_prefix":"c5f90f064c23fc80","entry":"Get_Salt_Pepper_Noisy_Image","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c5f90f064c23fc80"}},{"code_sha256_prefix":"dd1114865f06f0fd","entry":"conv3x3","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"dd1114865f06f0fd"}},{"code_sha256_prefix":"c7601557922b3f9c","entry":"create_layer_basic","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c7601557922b3f9c"}},{"code_sha256_prefix":"e4ce9b02d8344f92","entry":"BiSeNet","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.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":"e4ce9b02d8344f92"}},{"code_sha256_prefix":"85e291ec32606b2e","entry":"ContextPath","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.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":"85e291ec32606b2e"}},{"code_sha256_prefix":"5898b758c56bf090","entry":"Convert_Tensor_To_Image","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.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":"5898b758c56bf090"}},{"code_sha256_prefix":"aca93853a087107e","entry":"Get_Content_Aware_Pruning_Score","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.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":"aca93853a087107e"}},{"code_sha256_prefix":"059c2e41e6ee7e1d","entry":"Get_Parsing_Net","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.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":"059c2e41e6ee7e1d"}},{"code_sha256_prefix":"9269f9c755fff863","entry":"Get_Weight_Gradient","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.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":"9269f9c755fff863"}},{"code_sha256_prefix":"f728dc2f00391366","entry":"Resnet18","repo":"lychenyoko/content-aware-gan-compression","repo_kind":"official","path":"Util/content_aware_pruning.py","file_url":"https://github.com/lychenyoko/content-aware-gan-compression/blob/HEAD/Util/content_aware_pruning.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":"f728dc2f00391366"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}