{"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/learning-imbalanced-datasets-with-label","title":"Learning Imbalanced Datasets with Label-Distribution-Aware Margin Loss","arxiv_id":"1906.07413","date":"2019-06-18","proceeding":"NeurIPS 2019 12","authors":["Kaidi Cao","Colin Wei","Adrien Gaidon","Nikos Arechiga","Tengyu Ma"],"abstract":"Deep learning algorithms can fare poorly when the training dataset suffers from heavy class-imbalance but the testing criterion requires good generalization on less frequent classes. We design two novel methods to improve performance in such scenarios. First, we propose a theoretically-principled label-distribution-aware margin (LDAM) loss motivated by minimizing a margin-based generalization bound. This loss replaces the standard cross-entropy objective during training and can be applied with prior strategies for training with class-imbalance such as re-weighting or re-sampling. Second, we propose a simple, yet effective, training schedule that defers re-weighting until after the initial stage, allowing the model to learn an initial representation while avoiding some of the complications associated with re-weighting or re-sampling. We test our methods on several benchmark vision tasks including the real-world imbalanced dataset iNaturalist 2018. Our experiments show that either of these methods alone can already improve over existing techniques and their combination achieves even better performance gains.","url_abs":"https://arxiv.org/abs/1906.07413v2","url_pdf":"https://arxiv.org/pdf/1906.07413v2.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":"learning-imbalanced-datasets-with-label","repo_url":"https://github.com/kaidic/LDAM-DRW","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"learning-imbalanced-datasets-with-label","repo_url":"https://github.com/feidfoe/AdjustBnd4Imbalance","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"learning-imbalanced-datasets-with-label","repo_url":"https://github.com/ihaeyong/maximum-margin-ldam","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"learning-imbalanced-datasets-with-label","repo_url":"https://github.com/j3soon/arxiv-utils","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"learning-imbalanced-datasets-with-label","repo_url":"https://github.com/jackhck/subclass-balancing-contrastive-learning","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"learning-imbalanced-datasets-with-label","repo_url":"https://github.com/karurb92/ldam_str_bn","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":null},{"paper_slug":"learning-imbalanced-datasets-with-label","repo_url":"https://github.com/orparask/VS-Loss","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"long-tail-learning","task_name":"Long-tail Learning"},{"task_slug":"long-tail-learning-with-class-descriptors","task_name":"Long-tail learning with class descriptors"}],"methods":[],"datasets_introduced":[{"slug":"cifar100-lt","name":"CIFAR100-LT","full_name":""}],"methods_introduced":[],"results":[{"leaderboard":"/sota/long-tail-learning-on-cifar-10-lt-r-10","task":"Long-tail Learning","dataset":"CIFAR-10-LT (ρ=10)","model":"LDAM-DRW","rank_in_archive_order":39,"of":50,"metrics":{"Error Rate":"11.84"},"uses_additional_data":false},{"leaderboard":"/sota/long-tail-learning-on-cifar-10-lt-r-10","task":"Long-tail Learning","dataset":"CIFAR-10-LT (ρ=10)","model":"Class-balanced Resampling","rank_in_archive_order":47,"of":50,"metrics":{"Error Rate":"13.21"},"uses_additional_data":false},{"leaderboard":"/sota/long-tail-learning-on-cifar-10-lt-r-10","task":"Long-tail Learning","dataset":"CIFAR-10-LT (ρ=10)","model":"Empirical Risk Minimization (ERM, CE)","rank_in_archive_order":49,"of":50,"metrics":{"Error Rate":"13.61"},"uses_additional_data":false},{"leaderboard":"/sota/long-tail-learning-on-cifar-10-lt-r-100","task":"Long-tail Learning","dataset":"CIFAR-10-LT (ρ=100)","model":"LDAM-DRW","rank_in_archive_order":27,"of":28,"metrics":{"Error Rate":"22.97"},"uses_additional_data":false},{"leaderboard":"/sota/long-tail-learning-on-cifar-100-lt-r-10","task":"Long-tail Learning","dataset":"CIFAR-100-LT (ρ=10)","model":"LDAM-DRW","rank_in_archive_order":30,"of":31,"metrics":{"Error Rate":"41.29"},"uses_additional_data":false},{"leaderboard":"/sota/long-tail-learning-on-cifar-100-lt-r-100","task":"Long-tail Learning","dataset":"CIFAR-100-LT (ρ=100)","model":"LDAM-DRW","rank_in_archive_order":61,"of":66,"metrics":{"Error Rate":"57.96"},"uses_additional_data":false},{"leaderboard":"/sota/long-tail-learning-on-coco-mlt","task":"Long-tail Learning","dataset":"COCO-MLT","model":"LDAM(ResNet-50)","rank_in_archive_order":13,"of":13,"metrics":{"Average mAP":"40.53"},"uses_additional_data":false},{"leaderboard":"/sota/long-tail-learning-on-voc-mlt","task":"Long-tail Learning","dataset":"VOC-MLT","model":"LDAM(ResNet-50)","rank_in_archive_order":12,"of":13,"metrics":{"Average mAP":"70.73"},"uses_additional_data":false},{"leaderboard":"/sota/long-tail-learning-with-class-descriptors-on-2","task":"Long-tail learning with class descriptors","dataset":"AWA-LT","model":"LDAM","rank_in_archive_order":5,"of":5,"metrics":{"Long-Tailed Accuracy":"93.5","Per-Class Accuracy":"69.1"},"uses_additional_data":false},{"leaderboard":"/sota/long-tail-learning-with-class-descriptors-on","task":"Long-tail learning with class descriptors","dataset":"CUB-LT","model":"LDAM","rank_in_archive_order":4,"of":5,"metrics":{"Long-Tailed Accuracy":"64.1","Per-Class Accuracy":"50.1"},"uses_additional_data":false},{"leaderboard":"/sota/long-tail-learning-with-class-descriptors-on-1","task":"Long-tail learning with class descriptors","dataset":"SUN-LT","model":"LDAM","rank_in_archive_order":5,"of":5,"metrics":{"Long-Tailed Accuracy":"36.4","Per-Class Accuracy":"29.8"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1906.07413","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1906.07413"}},"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/kaidic/LDAM-DRW","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/feidfoe/AdjustBnd4Imbalance","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/j3soon/arxiv-utils","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/karurb92/ldam_str_bn","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/orparask/VS-Loss","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ihaeyong/maximum-margin-ldam","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/jackhck/subclass-balancing-contrastive-learning","reach":null}],"summary":{"ran":1,"ran_draft_wrong":1,"unverified":9},"by_repo_kind":{"listed":{"samples":11,"ran":2,"repositories":4}},"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":3,"samples":[{"code_sha256_prefix":"62c8aa90e3fb2973","entry":"LDAMLoss","repo":"karurb92/ldam_str_bn","repo_kind":"listed","path":"losses.py","file_url":"https://github.com/karurb92/ldam_str_bn/blob/HEAD/losses.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":"62c8aa90e3fb2973"}},{"code_sha256_prefix":"4dcf06ba28983266","entry":"focal_loss","repo":"ihaeyong/maximum-margin-ldam","repo_kind":"listed","path":"losses.py","file_url":"https://github.com/ihaeyong/maximum-margin-ldam/blob/HEAD/losses.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4dcf06ba28983266"}},{"code_sha256_prefix":"6683ac6a76084b68","entry":"LDAMLoss","repo":"orparask/VS-Loss","repo_kind":"listed","path":"class_imbalance/losses.py","file_url":"https://github.com/orparask/VS-Loss/blob/HEAD/class_imbalance/losses.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":"6683ac6a76084b68"}},{"code_sha256_prefix":"a3ce423c36d71133","entry":"LDAMLoss","repo":"jackhck/subclass-balancing-contrastive-learning","repo_kind":"listed","path":"SimCLR/loss.py","file_url":"https://github.com/jackhck/subclass-balancing-contrastive-learning/blob/HEAD/SimCLR/loss.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":"a3ce423c36d71133"}},{"code_sha256_prefix":"688c38ac8517471a","entry":"accuracy","repo":"ihaeyong/maximum-margin-ldam","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/ihaeyong/maximum-margin-ldam/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"688c38ac8517471a"}},{"code_sha256_prefix":"6feb1ddb1872cd29","entry":"ldam_loss","repo":"ihaeyong/maximum-margin-ldam","repo_kind":"listed","path":"cifar_train.py","file_url":"https://github.com/ihaeyong/maximum-margin-ldam/blob/HEAD/cifar_train.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":"6feb1ddb1872cd29"}},{"code_sha256_prefix":"26d27ecdc945d123","entry":"obj_margins","repo":"ihaeyong/maximum-margin-ldam","repo_kind":"listed","path":"cifar_train.py","file_url":"https://github.com/ihaeyong/maximum-margin-ldam/blob/HEAD/cifar_train.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":"26d27ecdc945d123"}},{"code_sha256_prefix":"e5ce72a1e8d9bc22","entry":"plot_confusion_matrix","repo":"ihaeyong/maximum-margin-ldam","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/ihaeyong/maximum-margin-ldam/blob/HEAD/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":"e5ce72a1e8d9bc22"}},{"code_sha256_prefix":"11d038f53d77a8d2","entry":"resnet32","repo":"ihaeyong/maximum-margin-ldam","repo_kind":"listed","path":"models/resnet_cifar.py","file_url":"https://github.com/ihaeyong/maximum-margin-ldam/blob/HEAD/models/resnet_cifar.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":"11d038f53d77a8d2"}},{"code_sha256_prefix":"83b8128b16e83cfc","entry":"to_onehot","repo":"ihaeyong/maximum-margin-ldam","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/ihaeyong/maximum-margin-ldam/blob/HEAD/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":"83b8128b16e83cfc"}},{"code_sha256_prefix":"75d3d8bc39a6d61b","entry":"weight","repo":"ihaeyong/maximum-margin-ldam","repo_kind":"listed","path":"cifar_train.py","file_url":"https://github.com/ihaeyong/maximum-margin-ldam/blob/HEAD/cifar_train.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":"75d3d8bc39a6d61b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}