{"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/recall-k-surrogate-loss-with-large-batches","title":"Recall@k Surrogate Loss with Large Batches and Similarity Mixup","arxiv_id":"2108.11179","date":"2021-08-25","proceeding":"CVPR 2022 1","authors":["Yash Patel","Giorgos Tolias","Jiri Matas"],"abstract":"This work focuses on learning deep visual representation models for retrieval by exploring the interplay between a new loss function, the batch size, and a new regularization approach. Direct optimization, by gradient descent, of an evaluation metric, is not possible when it is non-differentiable, which is the case for recall in retrieval. A differentiable surrogate loss for the recall is proposed in this work. Using an implementation that sidesteps the hardware constraints of the GPU memory, the method trains with a very large batch size, which is essential for metrics computed on the entire retrieval database. It is assisted by an efficient mixup regularization approach that operates on pairwise scalar similarities and virtually increases the batch size further. The suggested method achieves state-of-the-art performance in several image retrieval benchmarks when used for deep metric learning. For instance-level recognition, the method outperforms similar approaches that train using an approximation of average precision.","url_abs":"https://arxiv.org/abs/2108.11179v2","url_pdf":"https://arxiv.org/pdf/2108.11179v2.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":"recall-k-surrogate-loss-with-large-batches","repo_url":"https://github.com/yash0307/RecallatK_surrogate","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"recall-k-surrogate-loss-with-large-batches","repo_url":"https://github.com/yash0307/recallatk","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":null,"task_name":"GPU"},{"task_slug":"image-retrieval","task_name":"Image Retrieval"},{"task_slug":"metric-learning","task_name":"Metric Learning"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"vehicle-re-identification","task_name":"Vehicle Re-Identification"}],"methods":[{"method_slug":"mixup","method_name":"Mixup"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/image-retrieval-on-inaturalist","task":"Image Retrieval","dataset":"iNaturalist","model":"Recall@k Surrogate loss (ViT-B/16)","rank_in_archive_order":3,"of":10,"metrics":{"R@1":"83.0","R@16":"95.9","R@32":"97.2","R@5":"92.1"},"uses_additional_data":false},{"leaderboard":"/sota/image-retrieval-on-inaturalist","task":"Image Retrieval","dataset":"iNaturalist","model":"Recall@k Surrogate loss (ResNet-50)","rank_in_archive_order":5,"of":10,"metrics":{"R@1":"71.8","R@16":"91.9","R@32":"94.3","R@5":"84.7"},"uses_additional_data":false},{"leaderboard":"/sota/metric-learning-on-cars196","task":"Metric Learning","dataset":"CARS196","model":"Recall@k Surrogate loss (ViT-B/16)","rank_in_archive_order":11,"of":36,"metrics":{"R@1":"89.5"},"uses_additional_data":false},{"leaderboard":"/sota/metric-learning-on-cars196","task":"Metric Learning","dataset":"CARS196","model":"Recall@k Surrogate loss (ResNet-50)","rank_in_archive_order":17,"of":36,"metrics":{"R@1":"88.3"},"uses_additional_data":false},{"leaderboard":"/sota/metric-learning-on-stanford-online-products-1","task":"Metric Learning","dataset":"Stanford Online Products","model":"Recall@k Surrogate Loss (ViT-B/16)","rank_in_archive_order":3,"of":33,"metrics":{"R@1":"88.0"},"uses_additional_data":false},{"leaderboard":"/sota/metric-learning-on-stanford-online-products-1","task":"Metric Learning","dataset":"Stanford Online Products","model":"Recall@k Surrogate Loss (ViT-B/32)","rank_in_archive_order":8,"of":33,"metrics":{"R@1":"85.1"},"uses_additional_data":false},{"leaderboard":"/sota/metric-learning-on-stanford-online-products-1","task":"Metric Learning","dataset":"Stanford Online Products","model":"Recall@k Surrogate Loss (ResNet-50)","rank_in_archive_order":11,"of":33,"metrics":{"R@1":"82.7"},"uses_additional_data":false},{"leaderboard":"/sota/vehicle-re-identification-on-vehicleid-large","task":"Vehicle Re-Identification","dataset":"VehicleID Large","model":"Recall@k Surrogate loss (ViT-B/16)","rank_in_archive_order":1,"of":10,"metrics":{"Rank-1":"94.7","Rank-5":"97.1"},"uses_additional_data":false},{"leaderboard":"/sota/vehicle-re-identification-on-vehicleid-large","task":"Vehicle Re-Identification","dataset":"VehicleID Large","model":"Recall@k Surrogate loss (ResNet-50)","rank_in_archive_order":2,"of":10,"metrics":{"Rank-1":"93.8","Rank-5":"96.6"},"uses_additional_data":false},{"leaderboard":"/sota/vehicle-re-identification-on-vehicleid-medium","task":"Vehicle Re-Identification","dataset":"VehicleID Medium","model":"Recall@k Surrogate loss (ViT-B/16)","rank_in_archive_order":1,"of":9,"metrics":{"Rank-1":"95.2","Rank-5":"97.2"},"uses_additional_data":false},{"leaderboard":"/sota/vehicle-re-identification-on-vehicleid-medium","task":"Vehicle Re-Identification","dataset":"VehicleID Medium","model":"Recall@k Surrogate loss (ResNet-50)","rank_in_archive_order":2,"of":9,"metrics":{"Rank-1":"94.6","Rank-5":"96.9"},"uses_additional_data":false},{"leaderboard":"/sota/vehicle-re-identification-on-vehicleid-small","task":"Vehicle Re-Identification","dataset":"VehicleID Small","model":"Recall@k Surrogate loss (ViT-B/16)","rank_in_archive_order":1,"of":13,"metrics":{"Rank-1":"96.2","Rank-5":"98.0"},"uses_additional_data":false},{"leaderboard":"/sota/vehicle-re-identification-on-vehicleid-small","task":"Vehicle Re-Identification","dataset":"VehicleID Small","model":"Recall@k Surrogate loss (ResNet-50)","rank_in_archive_order":2,"of":13,"metrics":{"Rank-1":"95.7","Rank-5":"97.9"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/2108.11179","atlas_url":"https://app.syntology.ai/?focus=2108.11179","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2108.11179"}},"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/yash0307/recallatk","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yash0307/RecallatK_surrogate","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":11},"by_repo_kind":{"official":{"samples":11,"ran":0,"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":"019b75de18e8ab7f","entry":"args2exp_name","repo":"yash0307/RecallatK_surrogate","repo_kind":"official","path":"src/auxiliaries.py","file_url":"https://github.com/yash0307/RecallatK_surrogate/blob/HEAD/src/auxiliaries.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":"019b75de18e8ab7f"}},{"code_sha256_prefix":"b0205d59d4a00b5a","entry":"f1_score","repo":"yash0307/RecallatK_surrogate","repo_kind":"official","path":"src/auxiliaries_nofaiss.py","file_url":"https://github.com/yash0307/RecallatK_surrogate/blob/HEAD/src/auxiliaries_nofaiss.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":"b0205d59d4a00b5a"}},{"code_sha256_prefix":"049ad9e860c15601","entry":"gimme_params","repo":"yash0307/RecallatK_surrogate","repo_kind":"official","path":"src/auxiliaries.py","file_url":"https://github.com/yash0307/RecallatK_surrogate/blob/HEAD/src/auxiliaries.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":"049ad9e860c15601"}},{"code_sha256_prefix":"02b6004c0868bbed","entry":"gimme_params","repo":"yash0307/RecallatK_surrogate","repo_kind":"official","path":"src/auxiliaries_nofaiss.py","file_url":"https://github.com/yash0307/RecallatK_surrogate/blob/HEAD/src/auxiliaries_nofaiss.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":"02b6004c0868bbed"}},{"code_sha256_prefix":"cae4f556b09f25d9","entry":"gimme_save_string","repo":"yash0307/RecallatK_surrogate","repo_kind":"official","path":"src/auxiliaries.py","file_url":"https://github.com/yash0307/RecallatK_surrogate/blob/HEAD/src/auxiliaries.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":"cae4f556b09f25d9"}},{"code_sha256_prefix":"7e84aa6527b513e2","entry":"give_cars196_datasets","repo":"yash0307/RecallatK_surrogate","repo_kind":"official","path":"src/datasets.py","file_url":"https://github.com/yash0307/RecallatK_surrogate/blob/HEAD/src/datasets.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":"7e84aa6527b513e2"}},{"code_sha256_prefix":"f8348d227363bb5b","entry":"give_dataloaders","repo":"yash0307/RecallatK_surrogate","repo_kind":"official","path":"src/datasets.py","file_url":"https://github.com/yash0307/RecallatK_surrogate/blob/HEAD/src/datasets.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":"f8348d227363bb5b"}},{"code_sha256_prefix":"96d316d0c04aa0ec","entry":"give_sop_datasets","repo":"yash0307/RecallatK_surrogate","repo_kind":"official","path":"src/datasets.py","file_url":"https://github.com/yash0307/RecallatK_surrogate/blob/HEAD/src/datasets.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":"96d316d0c04aa0ec"}},{"code_sha256_prefix":"ea5fce69ce75d25e","entry":"loss_select","repo":"yash0307/RecallatK_surrogate","repo_kind":"official","path":"src/losses.py","file_url":"https://github.com/yash0307/RecallatK_surrogate/blob/HEAD/src/losses.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":"ea5fce69ce75d25e"}},{"code_sha256_prefix":"a187cbe2495a9595","entry":"pos_mixup","repo":"yash0307/RecallatK_surrogate","repo_kind":"official","path":"src/mixup.py","file_url":"https://github.com/yash0307/RecallatK_surrogate/blob/HEAD/src/mixup.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":"a187cbe2495a9595"}},{"code_sha256_prefix":"b8a4ba5e22a6de79","entry":"sigmoid","repo":"yash0307/RecallatK_surrogate","repo_kind":"official","path":"src/losses.py","file_url":"https://github.com/yash0307/RecallatK_surrogate/blob/HEAD/src/losses.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":"b8a4ba5e22a6de79"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}