{"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/striking-the-right-balance-recall-loss-for","title":"Striking the Right Balance: Recall Loss for Semantic Segmentation","arxiv_id":"2106.14917","date":"2021-06-28","proceeding":null,"authors":["Junjiao Tian","Niluthpol Mithun","Zach Seymour","Han-Pang Chiu","Zsolt Kira"],"abstract":"Class imbalance is a fundamental problem in computer vision applications such as semantic segmentation. Specifically, uneven class distributions in a training dataset often result in unsatisfactory performance on under-represented classes. Many works have proposed to weight the standard cross entropy loss function with pre-computed weights based on class statistics, such as the number of samples and class margins. There are two major drawbacks to these methods: 1) constantly up-weighting minority classes can introduce excessive false positives in semantic segmentation; 2) a minority class is not necessarily a hard class. The consequence is low precision due to excessive false positives. In this regard, we propose a hard-class mining loss by reshaping the vanilla cross entropy loss such that it weights the loss for each class dynamically based on instantaneous recall performance. We show that the novel recall loss changes gradually between the standard cross entropy loss and the inverse frequency weighted loss. Recall loss also leads to improved mean accuracy while offering competitive mean Intersection over Union (IoU) performance. On Synthia dataset, recall loss achieves $9\\%$ relative improvement on mean accuracy with competitive mean IoU using DeepLab-ResNet18 compared to the cross entropy loss. Code available at https://github.com/PotatoTian/recall-semseg.","url_abs":"https://arxiv.org/abs/2106.14917v2","url_pdf":"https://arxiv.org/pdf/2106.14917v2.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":"striking-the-right-balance-recall-loss-for","repo_url":"https://github.com/PotatoTian/recall-semseg","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"semantic-segmentation","task_name":"Semantic Segmentation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2106.14917","atlas_url":"https://app.syntology.ai/?focus=2106.14917","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2106.14917"}},"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/PotatoTian/recall-semseg","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":2,"unverified":9},"by_repo_kind":{"official":{"samples":11,"ran":2,"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":"80a82d5149279cdf","entry":"get_interp_size","repo":"PotatoTian/recall-semseg","repo_kind":"official","path":"ptsemseg/models/utils.py","file_url":"https://github.com/PotatoTian/recall-semseg/blob/HEAD/ptsemseg/models/utils.py","link_basis":"plan_row","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":"80a82d5149279cdf"}},{"code_sha256_prefix":"f1e67bfcea91df50","entry":"recursive_glob","repo":"PotatoTian/recall-semseg","repo_kind":"official","path":"ptsemseg/utils.py","file_url":"https://github.com/PotatoTian/recall-semseg/blob/HEAD/ptsemseg/utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f1e67bfcea91df50"}},{"code_sha256_prefix":"7026f6e0f1e1099b","entry":"RecallCrossEntropy","repo":"PotatoTian/recall-semseg","repo_kind":"official","path":"ptsemseg/loss/loss.py","file_url":"https://github.com/PotatoTian/recall-semseg/blob/HEAD/ptsemseg/loss/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":"7026f6e0f1e1099b"}},{"code_sha256_prefix":"4cfe5787eb0e75e1","entry":"RecallPreCrossEntropy","repo":"PotatoTian/recall-semseg","repo_kind":"official","path":"ptsemseg/loss/loss.py","file_url":"https://github.com/PotatoTian/recall-semseg/blob/HEAD/ptsemseg/loss/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":"4cfe5787eb0e75e1"}},{"code_sha256_prefix":"3a8e7e1d2e1dc425","entry":"alpha_blend","repo":"PotatoTian/recall-semseg","repo_kind":"official","path":"ptsemseg/utils.py","file_url":"https://github.com/PotatoTian/recall-semseg/blob/HEAD/ptsemseg/utils.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":"3a8e7e1d2e1dc425"}},{"code_sha256_prefix":"ec475f26f39c14b0","entry":"convert_state_dict","repo":"PotatoTian/recall-semseg","repo_kind":"official","path":"ptsemseg/utils.py","file_url":"https://github.com/PotatoTian/recall-semseg/blob/HEAD/ptsemseg/utils.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":"ec475f26f39c14b0"}},{"code_sha256_prefix":"c76dc561618f7c2e","entry":"cross_entropy2d","repo":"PotatoTian/recall-semseg","repo_kind":"official","path":"ptsemseg/loss/loss.py","file_url":"https://github.com/PotatoTian/recall-semseg/blob/HEAD/ptsemseg/loss/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":"c76dc561618f7c2e"}},{"code_sha256_prefix":"68f02849ad3eb678","entry":"get_upsampling_weight","repo":"PotatoTian/recall-semseg","repo_kind":"official","path":"ptsemseg/models/utils.py","file_url":"https://github.com/PotatoTian/recall-semseg/blob/HEAD/ptsemseg/models/utils.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":"68f02849ad3eb678"}},{"code_sha256_prefix":"aed5a907c8821d6d","entry":"interp","repo":"PotatoTian/recall-semseg","repo_kind":"official","path":"ptsemseg/models/utils.py","file_url":"https://github.com/PotatoTian/recall-semseg/blob/HEAD/ptsemseg/models/utils.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":"aed5a907c8821d6d"}},{"code_sha256_prefix":"4f9d5382c285dae8","entry":"lovasz_grad","repo":"PotatoTian/recall-semseg","repo_kind":"official","path":"ptsemseg/loss/lovasz_loss.py","file_url":"https://github.com/PotatoTian/recall-semseg/blob/HEAD/ptsemseg/loss/lovasz_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":"4f9d5382c285dae8"}},{"code_sha256_prefix":"41a1c4fba0ea8662","entry":"lovasz_softmax_flat","repo":"PotatoTian/recall-semseg","repo_kind":"official","path":"ptsemseg/loss/lovasz_loss.py","file_url":"https://github.com/PotatoTian/recall-semseg/blob/HEAD/ptsemseg/loss/lovasz_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":"41a1c4fba0ea8662"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}