{"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/hierarchical-contrastive-learning-for-pattern","title":"Hierarchical Contrastive Learning for Pattern-Generalizable Image Corruption Detection","arxiv_id":"2308.14061","date":"2023-08-27","proceeding":"ICCV 2023 1","authors":["Xin Feng","Yifeng Xu","Guangming Lu","Wenjie Pei"],"abstract":"Effective image restoration with large-size corruptions, such as blind image inpainting, entails precise detection of corruption region masks which remains extremely challenging due to diverse shapes and patterns of corruptions. In this work, we present a novel method for automatic corruption detection, which allows for blind corruption restoration without known corruption masks. Specifically, we develop a hierarchical contrastive learning framework to detect corrupted regions by capturing the intrinsic semantic distinctions between corrupted and uncorrupted regions. In particular, our model detects the corrupted mask in a coarse-to-fine manner by first predicting a coarse mask by contrastive learning in low-resolution feature space and then refines the uncertain area of the mask by high-resolution contrastive learning. A specialized hierarchical interaction mechanism is designed to facilitate the knowledge propagation of contrastive learning in different scales, boosting the modeling performance substantially. The detected multi-scale corruption masks are then leveraged to guide the corruption restoration. Detecting corrupted regions by learning the contrastive distinctions rather than the semantic patterns of corruptions, our model has well generalization ability across different corruption patterns. Extensive experiments demonstrate following merits of our model: 1) the superior performance over other methods on both corruption detection and various image restoration tasks including blind inpainting and watermark removal, and 2) strong generalization across different corruption patterns such as graffiti, random noise or other image content. Codes and trained weights are available at https://github.com/xyfJASON/HCL .","url_abs":"https://arxiv.org/abs/2308.14061v1","url_pdf":"https://arxiv.org/pdf/2308.14061v1.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":"hierarchical-contrastive-learning-for-pattern","repo_url":"https://github.com/xyfjason/hcl","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"image-inpainting","task_name":"Image Inpainting"},{"task_slug":"image-restoration","task_name":"Image Restoration"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"},{"method_slug":"pixel-prediction","method_name":"Inpainting"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2308.14061","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2308.14061"}},"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":"deterministic:regex_extraction","url":"https://github.com/xyfJASON/HCL","reach":null}],"summary":{"ran":1,"ran_draft_wrong":2,"ran_fixture":2,"unverified":2},"by_repo_kind":{"official":{"samples":7,"ran":5,"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":"dcd8e72c547e1b3c","entry":"SimplifiedCircleLoss","repo":"xyfJASON/HCL","repo_kind":"official","path":"losses/contrast_loss.py","file_url":"https://github.com/xyfJASON/HCL/blob/HEAD/losses/contrast_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"dcd8e72c547e1b3c"}},{"code_sha256_prefix":"82879ddae683806c","entry":"extract_edge","repo":"xyfJASON/HCL","repo_kind":"official","path":"losses/contrast_loss.py","file_url":"https://github.com/xyfJASON/HCL/blob/HEAD/losses/contrast_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"82879ddae683806c"}},{"code_sha256_prefix":"89ac064542ac97c6","entry":"mask_indexing","repo":"xyfJASON/HCL","repo_kind":"official","path":"losses/contrast_loss.py","file_url":"https://github.com/xyfJASON/HCL/blob/HEAD/losses/contrast_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"89ac064542ac97c6"}},{"code_sha256_prefix":"107b48411f4eb749","entry":"mask_prop","repo":"xyfJASON/HCL","repo_kind":"official","path":"losses/contrast_loss.py","file_url":"https://github.com/xyfJASON/HCL/blob/HEAD/losses/contrast_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"107b48411f4eb749"}},{"code_sha256_prefix":"8daa018a7aa5dc7c","entry":"upsample2x","repo":"xyfJASON/HCL","repo_kind":"official","path":"losses/contrast_loss.py","file_url":"https://github.com/xyfJASON/HCL/blob/HEAD/losses/contrast_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8daa018a7aa5dc7c"}},{"code_sha256_prefix":"65e00f77bc64095e","entry":"ContrastLoss","repo":"xyfJASON/HCL","repo_kind":"official","path":"losses/contrast_loss.py","file_url":"https://github.com/xyfJASON/HCL/blob/HEAD/losses/contrast_loss.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":"65e00f77bc64095e"}},{"code_sha256_prefix":"1ddd55ad4fbf37d1","entry":"HierarchicalContrastiveLoss","repo":"xyfJASON/HCL","repo_kind":"official","path":"losses/contrast_loss.py","file_url":"https://github.com/xyfJASON/HCL/blob/HEAD/losses/contrast_loss.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":"1ddd55ad4fbf37d1"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}