{"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/restoring-images-in-adverse-weather","title":"Restoring Images in Adverse Weather Conditions via Histogram Transformer","arxiv_id":"2407.10172","date":"2024-07-14","proceeding":null,"authors":["Shangquan Sun","Wenqi Ren","Xinwei Gao","Rui Wang","Xiaochun Cao"],"abstract":"Transformer-based image restoration methods in adverse weather have achieved significant progress. Most of them use self-attention along the channel dimension or within spatially fixed-range blocks to reduce computational load. However, such a compromise results in limitations in capturing long-range spatial features. Inspired by the observation that the weather-induced degradation factors mainly cause similar occlusion and brightness, in this work, we propose an efficient Histogram Transformer (Histoformer) for restoring images affected by adverse weather. It is powered by a mechanism dubbed histogram self-attention, which sorts and segments spatial features into intensity-based bins. Self-attention is then applied across bins or within each bin to selectively focus on spatial features of dynamic range and process similar degraded pixels of the long range together. To boost histogram self-attention, we present a dynamic-range convolution enabling conventional convolution to conduct operation over similar pixels rather than neighbor pixels. We also observe that the common pixel-wise losses neglect linear association and correlation between output and ground-truth. Thus, we propose to leverage the Pearson correlation coefficient as a loss function to enforce the recovered pixels following the identical order as ground-truth. Extensive experiments demonstrate the efficacy and superiority of our proposed method. We have released the codes in Github.","url_abs":"https://arxiv.org/abs/2407.10172v2","url_pdf":"https://arxiv.org/pdf/2407.10172v2.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":"restoring-images-in-adverse-weather","repo_url":"https://github.com/sunshangquan/Histoformer","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"image-restoration","task_name":"Image Restoration"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"convolution","method_name":"Convolution"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"focus","method_name":"Focus"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2407.10172","atlas_url":"https://app.syntology.ai/?focus=2407.10172","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2407.10172"}},"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/sunshangquan/Histoformer","reach":null}],"summary":{"ran":9,"unverified":2},"by_repo_kind":{"official":{"samples":11,"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":11,"samples":[{"code_sha256_prefix":"09be8a61d75c6b9b","entry":"Attention_histogram","repo":"sunshangquan/Histoformer","repo_kind":"official","path":"basicsr/models/archs/histoformer_arch.py","file_url":"https://github.com/sunshangquan/Histoformer/blob/HEAD/basicsr/models/archs/histoformer_arch.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":"09be8a61d75c6b9b"}},{"code_sha256_prefix":"8caa1bb2ca1217f1","entry":"BiasFree_LayerNorm","repo":"sunshangquan/Histoformer","repo_kind":"official","path":"basicsr/models/archs/histoformer_arch.py","file_url":"https://github.com/sunshangquan/Histoformer/blob/HEAD/basicsr/models/archs/histoformer_arch.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":"8caa1bb2ca1217f1"}},{"code_sha256_prefix":"8728564ca09fb5d2","entry":"Downsample","repo":"sunshangquan/Histoformer","repo_kind":"official","path":"basicsr/models/archs/histoformer_arch.py","file_url":"https://github.com/sunshangquan/Histoformer/blob/HEAD/basicsr/models/archs/histoformer_arch.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":"8728564ca09fb5d2"}},{"code_sha256_prefix":"9e868ab7476b4a76","entry":"FeedForward","repo":"sunshangquan/Histoformer","repo_kind":"official","path":"basicsr/models/archs/histoformer_arch.py","file_url":"https://github.com/sunshangquan/Histoformer/blob/HEAD/basicsr/models/archs/histoformer_arch.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":"9e868ab7476b4a76"}},{"code_sha256_prefix":"4f765879fd63002f","entry":"LayerNorm","repo":"sunshangquan/Histoformer","repo_kind":"official","path":"basicsr/models/archs/histoformer_arch.py","file_url":"https://github.com/sunshangquan/Histoformer/blob/HEAD/basicsr/models/archs/histoformer_arch.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":"4f765879fd63002f"}},{"code_sha256_prefix":"aacfb4408f6e8c7e","entry":"OverlapPatchEmbed","repo":"sunshangquan/Histoformer","repo_kind":"official","path":"basicsr/models/archs/histoformer_arch.py","file_url":"https://github.com/sunshangquan/Histoformer/blob/HEAD/basicsr/models/archs/histoformer_arch.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":"aacfb4408f6e8c7e"}},{"code_sha256_prefix":"25d209a3b8d475eb","entry":"SkipPatchEmbed","repo":"sunshangquan/Histoformer","repo_kind":"official","path":"basicsr/models/archs/histoformer_arch.py","file_url":"https://github.com/sunshangquan/Histoformer/blob/HEAD/basicsr/models/archs/histoformer_arch.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":"25d209a3b8d475eb"}},{"code_sha256_prefix":"0ef3a76e8f54fcd5","entry":"Upsample","repo":"sunshangquan/Histoformer","repo_kind":"official","path":"basicsr/models/archs/histoformer_arch.py","file_url":"https://github.com/sunshangquan/Histoformer/blob/HEAD/basicsr/models/archs/histoformer_arch.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":"0ef3a76e8f54fcd5"}},{"code_sha256_prefix":"bfbc59d0ccb176fa","entry":"WithBias_LayerNorm","repo":"sunshangquan/Histoformer","repo_kind":"official","path":"basicsr/models/archs/histoformer_arch.py","file_url":"https://github.com/sunshangquan/Histoformer/blob/HEAD/basicsr/models/archs/histoformer_arch.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":"bfbc59d0ccb176fa"}},{"code_sha256_prefix":"a3d97c893214ec56","entry":"Histoformer","repo":"sunshangquan/Histoformer","repo_kind":"official","path":"basicsr/models/archs/histoformer_arch.py","file_url":"https://github.com/sunshangquan/Histoformer/blob/HEAD/basicsr/models/archs/histoformer_arch.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":"a3d97c893214ec56"}},{"code_sha256_prefix":"b3103e147e16c1a5","entry":"TransformerBlock","repo":"sunshangquan/Histoformer","repo_kind":"official","path":"basicsr/models/archs/histoformer_arch.py","file_url":"https://github.com/sunshangquan/Histoformer/blob/HEAD/basicsr/models/archs/histoformer_arch.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":"b3103e147e16c1a5"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}