{"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-with-average-precision-training","title":"Learning with Average Precision: Training Image Retrieval with a Listwise Loss","arxiv_id":"1906.07589","date":"2019-06-18","proceeding":"ICCV 2019 10","authors":["Jerome Revaud","Jon Almazan","Rafael Sampaio de Rezende","Cesar Roberto de Souza"],"abstract":"Image retrieval can be formulated as a ranking problem where the goal is to order database images by decreasing similarity to the query. Recent deep models for image retrieval have outperformed traditional methods by leveraging ranking-tailored loss functions, but important theoretical and practical problems remain. First, rather than directly optimizing the global ranking, they minimize an upper-bound on the essential loss, which does not necessarily result in an optimal mean average precision (mAP). Second, these methods require significant engineering efforts to work well, e.g. special pre-training and hard-negative mining. In this paper we propose instead to directly optimize the global mAP by leveraging recent advances in listwise loss formulations. Using a histogram binning approximation, the AP can be differentiated and thus employed to end-to-end learning. Compared to existing losses, the proposed method considers thousands of images simultaneously at each iteration and eliminates the need for ad hoc tricks. It also establishes a new state of the art on many standard retrieval benchmarks. Models and evaluation scripts have been made available at https://europe.naverlabs.com/Deep-Image-Retrieval/","url_abs":"https://arxiv.org/abs/1906.07589v1","url_pdf":"https://arxiv.org/pdf/1906.07589v1.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-with-average-precision-training","repo_url":"https://github.com/almazan/deep-image-retrieval","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"learning-with-average-precision-training","repo_url":"https://github.com/naver/deep-image-retrieval","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"tasks":[{"task_slug":"image-retrieval","task_name":"Image Retrieval"},{"task_slug":"retrieval","task_name":"Retrieval"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1906.07589","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1906.07589"}},"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/naver/deep-image-retrieval","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/almazan/deep-image-retrieval","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"summary":{"unverified":8},"by_repo_kind":{"listed":{"samples":8,"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":"2ad33ba942a940d1","entry":"deploy","repo":"almazan/deep-image-retrieval","repo_kind":"listed","path":"dirtorch/datasets/dataset.py","file_url":"https://github.com/almazan/deep-image-retrieval/blob/HEAD/dirtorch/datasets/dataset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"2ad33ba942a940d1"}},{"code_sha256_prefix":"52b59ca7fd9b5d7a","entry":"deploy_and_split","repo":"almazan/deep-image-retrieval","repo_kind":"listed","path":"dirtorch/datasets/dataset.py","file_url":"https://github.com/almazan/deep-image-retrieval/blob/HEAD/dirtorch/datasets/dataset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"52b59ca7fd9b5d7a"}},{"code_sha256_prefix":"99c00be09d915e3f","entry":"find_and_list_classes","repo":"almazan/deep-image-retrieval","repo_kind":"listed","path":"dirtorch/datasets/generic_func.py","file_url":"https://github.com/almazan/deep-image-retrieval/blob/HEAD/dirtorch/datasets/generic_func.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"99c00be09d915e3f"}},{"code_sha256_prefix":"05cccbbaf896e094","entry":"find_relevants","repo":"almazan/deep-image-retrieval","repo_kind":"listed","path":"dirtorch/datasets/generic_func.py","file_url":"https://github.com/almazan/deep-image-retrieval/blob/HEAD/dirtorch/datasets/generic_func.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"05cccbbaf896e094"}},{"code_sha256_prefix":"426de3b16db2fb92","entry":"l2_normalize","repo":"almazan/deep-image-retrieval","repo_kind":"listed","path":"dirtorch/nets/rmac_resnet.py","file_url":"https://github.com/almazan/deep-image-retrieval/blob/HEAD/dirtorch/nets/rmac_resnet.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"426de3b16db2fb92"}},{"code_sha256_prefix":"069961f5275162e3","entry":"not_none","repo":"almazan/deep-image-retrieval","repo_kind":"listed","path":"dirtorch/datasets/generic.py","file_url":"https://github.com/almazan/deep-image-retrieval/blob/HEAD/dirtorch/datasets/generic.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"069961f5275162e3"}},{"code_sha256_prefix":"aa71f3e917de3d1d","entry":"sim_to_dist","repo":"almazan/deep-image-retrieval","repo_kind":"listed","path":"dirtorch/loss.py","file_url":"https://github.com/almazan/deep-image-retrieval/blob/HEAD/dirtorch/loss.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"aa71f3e917de3d1d"}},{"code_sha256_prefix":"0d31580390476d85","entry":"split","repo":"almazan/deep-image-retrieval","repo_kind":"listed","path":"dirtorch/datasets/dataset.py","file_url":"https://github.com/almazan/deep-image-retrieval/blob/HEAD/dirtorch/datasets/dataset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"0d31580390476d85"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}