{"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/hair-hypernetworks-based-all-in-one-image","title":"HAIR: Hypernetworks-based All-in-One Image Restoration","arxiv_id":"2408.08091","date":"2024-08-15","proceeding":null,"authors":["Jin Cao","Yi Cao","Li Pang","Deyu Meng","Xiangyong Cao"],"abstract":"Image restoration aims to recover a high-quality clean image from its degraded version. Recent progress in image restoration has demonstrated the effectiveness of All-in-One image restoration models in addressing various unknown degradations simultaneously. However, these existing methods typically utilize the same parameters to tackle images with different types of degradation, forcing the model to balance the performance between different tasks and limiting its performance on each task. To alleviate this issue, we propose HAIR, a Hypernetworks-based All-in-One Image Restoration plug-and-play method that generates parameters based on the input image and thus makes the model to adapt to specific degradation dynamically. Specifically, HAIR consists of two main components, i.e., Classifier and Hyper Selecting Net (HSN). The Classifier is a simple image classification network used to generate a Global Information Vector (GIV) that contains the degradation information of the input image, and the HSN is a simple fully-connected neural network that receives the GIV and outputs parameters for the corresponding modules. Extensive experiments demonstrate that HAIR can significantly improve the performance of existing image restoration models in a plug-and-play manner, both in single-task and All-in-One settings. Notably, our proposed model Res-HAIR, which integrates HAIR into the well-known Restormer, can obtain superior or comparable performance compared with current state-of-the-art methods. Moreover, we theoretically demonstrate that to achieve a given small enough error, our proposed HAIR requires fewer parameters in contrast to mainstream embedding-based All-in-One methods. The code is available at https://github.com/toummHus/HAIR.","url_abs":"https://arxiv.org/abs/2408.08091v4","url_pdf":"https://arxiv.org/pdf/2408.08091v4.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":"hair-hypernetworks-based-all-in-one-image","repo_url":"https://github.com/toummHus/HAIR","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"5-degradation-blind-all-in-one-image","task_name":"5-Degradation Blind All-in-One Image Restoration"},{"task_slug":"all","task_name":"All"},{"task_slug":"blind-all-in-one-image-restoration","task_name":"Blind All-in-One Image Restoration"},{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"image-restoration","task_name":"Image Restoration"},{"task_slug":"image-classification","task_name":"image-classification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/5-degradation-blind-all-in-one-image","task":"5-Degradation Blind All-in-One Image Restoration","dataset":"5-Degradation Blind All-in-One Image Restoration","model":"HAIR","rank_in_archive_order":3,"of":7,"metrics":{"Average PSNR":"30.37"},"uses_additional_data":false},{"leaderboard":"/sota/blind-all-in-one-image-restoration-on-3","task":"Blind All-in-One Image Restoration","dataset":"3-Degradations","model":"HAIR","rank_in_archive_order":3,"of":9,"metrics":{"Average PSNR":"32.70","SSIM":"0.919"},"uses_additional_data":false},{"leaderboard":"/sota/blind-all-in-one-image-restoration-on-5","task":"Blind All-in-One Image Restoration","dataset":"5-Degradations","model":"HAIR","rank_in_archive_order":4,"of":9,"metrics":{"Average PSNR":"30.37","SSIM":"0.914"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/2408.08091","atlas_url":"https://app.syntology.ai/?focus=2408.08091","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2408.08091"}},"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/toummHus/HAIR","reach":{"status":"ok"}}],"summary":{"ran":9,"ran_fixture":3,"ran_draft_wrong":1,"unverified":5},"by_repo_kind":{"official":{"samples":18,"ran":13,"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":18,"samples":[{"code_sha256_prefix":"b921438690ac017f","entry":"contributions","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/imresize.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/imresize.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b921438690ac017f"}},{"code_sha256_prefix":"8ade57fc1fb950bb","entry":"crop_a_image","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/image_io.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/image_io.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8ade57fc1fb950bb"}},{"code_sha256_prefix":"11c75b3b8bc61c21","entry":"crop_img","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/image_utils.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/image_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"11c75b3b8bc61c21"}},{"code_sha256_prefix":"86abcfa12b6612f0","entry":"crop_patch","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/image_utils.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/image_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"86abcfa12b6612f0"}},{"code_sha256_prefix":"ee75635bb6c497f1","entry":"fix_scale_and_size","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/imresize.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/imresize.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ee75635bb6c497f1"}},{"code_sha256_prefix":"cd569444547de84f","entry":"get_position_from_periods","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/schedulers.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/schedulers.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cd569444547de84f"}},{"code_sha256_prefix":"c38287d2acea0ce0","entry":"imresize","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/imresize.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/imresize.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c38287d2acea0ce0"}},{"code_sha256_prefix":"442cb54f21dcfe50","entry":"linear_warmup_decay","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/schedulers.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/schedulers.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"442cb54f21dcfe50"}},{"code_sha256_prefix":"3137073275f8c21a","entry":"nonlinearity","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/ResNet.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/ResNet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3137073275f8c21a"}},{"code_sha256_prefix":"e91553b51010dfd6","entry":"prepare_gt_img","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/image_io.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/image_io.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e91553b51010dfd6"}},{"code_sha256_prefix":"8564be766b7cda56","entry":"prepare_hazy_image","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/image_io.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/image_io.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8564be766b7cda56"}},{"code_sha256_prefix":"82a15cc1e46f7e4d","entry":"to_3d","repo":"toummHus/HAIR","repo_kind":"official","path":"net/HAIR.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/net/HAIR.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"82a15cc1e46f7e4d"}},{"code_sha256_prefix":"b20f2a5df739a59e","entry":"to_4d","repo":"toummHus/HAIR","repo_kind":"official","path":"net/HAIR.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/net/HAIR.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b20f2a5df739a59e"}},{"code_sha256_prefix":"6898a9a13d3e78e9","entry":"Normalize","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/ResNet.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/ResNet.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6898a9a13d3e78e9"}},{"code_sha256_prefix":"418284b6911ecae5","entry":"accuracy","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/val_utils.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/val_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"418284b6911ecae5"}},{"code_sha256_prefix":"ece599323dc49d4a","entry":"compute_psnr_ssim","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/val_utils.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/val_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ece599323dc49d4a"}},{"code_sha256_prefix":"e6bdfc1df5bf356d","entry":"make_attn","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/ResNet.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/ResNet.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e6bdfc1df5bf356d"}},{"code_sha256_prefix":"779d9bd47765629e","entry":"slice_image2patches","repo":"toummHus/HAIR","repo_kind":"official","path":"utils/image_utils.py","file_url":"https://github.com/toummHus/HAIR/blob/HEAD/utils/image_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"779d9bd47765629e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}