{"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/direction-aware-spatial-context-features-for-1","title":"Direction-aware Spatial Context Features for Shadow Detection and Removal","arxiv_id":"1805.04635","date":"2018-05-12","proceeding":null,"authors":["Xiaowei Hu","Chi-Wing Fu","Lei Zhu","Jing Qin","Pheng-Ann Heng"],"abstract":"Shadow detection and shadow removal are fundamental and challenging tasks, requiring an understanding of the global image semantics. This paper presents a novel deep neural network design for shadow detection and removal by analyzing the spatial image context in a direction-aware manner. To achieve this, we first formulate the direction-aware attention mechanism in a spatial recurrent neural network (RNN) by introducing attention weights when aggregating spatial context features in the RNN. By learning these weights through training, we can recover direction-aware spatial context (DSC) for detecting and removing shadows. This design is developed into the DSC module and embedded in a convolutional neural network (CNN) to learn the DSC features at different levels. Moreover, we design a weighted cross entropy loss to make effective the training for shadow detection and further adopt the network for shadow removal by using a Euclidean loss function and formulating a color transfer function to address the color and luminosity inconsistencies in the training pairs. We employed two shadow detection benchmark datasets and two shadow removal benchmark datasets, and performed various experiments to evaluate our method. Experimental results show that our method performs favorably against the state-of-the-art methods for both shadow detection and shadow removal.","url_abs":"https://arxiv.org/abs/1805.04635v2","url_pdf":"https://arxiv.org/pdf/1805.04635v2.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":"direction-aware-spatial-context-features-for-1","repo_url":"https://github.com/stevewongv/dsc-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"direction-aware-spatial-context-features-for-1","repo_url":"https://github.com/xw-hu/DSC","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"shadow-detection","task_name":"Shadow Detection"},{"task_slug":"shadow-detection-and-removal","task_name":"Shadow Detection And Removal"},{"task_slug":"shadow-removal","task_name":"Shadow Removal"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/shadow-detection-on-cuhk-shadow","task":"Shadow Detection","dataset":"CUHK-Shadow","model":"DSC (CVPR 2018, TPAMI 2020) (512x512)","rank_in_archive_order":12,"of":16,"metrics":{"BER":"9.53"},"uses_additional_data":false},{"leaderboard":"/sota/shadow-detection-on-cuhk-shadow","task":"Shadow Detection","dataset":"CUHK-Shadow","model":"DSC (CVPR 2018, TPAMI 2020) (256x256)","rank_in_archive_order":15,"of":16,"metrics":{"BER":"10.97"},"uses_additional_data":false},{"leaderboard":"/sota/shadow-detection-on-sbu","task":"Shadow Detection","dataset":"SBU / SBU-Refine","model":"DSC (CVPR 2018, TPAMI 2020) (256x256)","rank_in_archive_order":12,"of":16,"metrics":{"BER":"6.79"},"uses_additional_data":false},{"leaderboard":"/sota/shadow-removal-on-istd","task":"Shadow Removal","dataset":"ISTD","model":"DSC","rank_in_archive_order":8,"of":10,"metrics":{"MAE":"6.67"},"uses_additional_data":false},{"leaderboard":"/sota/shadow-removal-on-istd-1","task":"Shadow Removal","dataset":"ISTD+","model":"DSC (TPAMI 2020) (256x256)","rank_in_archive_order":18,"of":26,"metrics":{"LPIPS":"0.347","PSNR":"26.53","RMSE":"3.44","SSIM":"0.738"},"uses_additional_data":false},{"leaderboard":"/sota/shadow-removal-on-srd","task":"Shadow Removal","dataset":"SRD","model":"DSC (TPAMI 2020) (256x256)","rank_in_archive_order":6,"of":25,"metrics":{"LPIPS":"0.412","PSNR":"25.46","RMSE":"3.97","SSIM":"0.678"},"uses_additional_data":false}],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=1805.04635","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1805.04635"}},"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/stevewongv/dsc-pytorch","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/xw-hu/DSC","reach":{"status":"ok"}}],"summary":{"ran":1,"unverified":1},"by_repo_kind":{"listed":{"samples":2,"ran":1,"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":"6978f1d410660f53","entry":"conv3x3","repo":"stevewongv/dsc-pytorch","repo_kind":"listed","path":"DSC.py","file_url":"https://github.com/stevewongv/dsc-pytorch/blob/HEAD/DSC.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6978f1d410660f53"}},{"code_sha256_prefix":"d92ce6cf29e0d5f7","entry":"conv1x1","repo":"stevewongv/dsc-pytorch","repo_kind":"listed","path":"DSC.py","file_url":"https://github.com/stevewongv/dsc-pytorch/blob/HEAD/DSC.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":"d92ce6cf29e0d5f7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}