{"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/hierarchical-average-precision-training-for","title":"Hierarchical Average Precision Training for Pertinent Image Retrieval","arxiv_id":"2207.04873","date":"2022-07-05","proceeding":null,"authors":["Elias Ramzi","Nicolas Audebert","Nicolas Thome","Clément Rambour","Xavier Bitot"],"abstract":"Image Retrieval is commonly evaluated with Average Precision (AP) or Recall@k. Yet, those metrics, are limited to binary labels and do not take into account errors' severity. This paper introduces a new hierarchical AP training method for pertinent image retrieval (HAP-PIER). HAPPIER is based on a new H-AP metric, which leverages a concept hierarchy to refine AP by integrating errors' importance and better evaluate rankings. To train deep models with H-AP, we carefully study the problem's structure and design a smooth lower bound surrogate combined with a clustering loss that ensures consistent ordering. Extensive experiments on 6 datasets show that HAPPIER significantly outperforms state-of-the-art methods for hierarchical retrieval, while being on par with the latest approaches when evaluating fine-grained ranking performances. Finally, we show that HAPPIER leads to better organization of the embedding space, and prevents most severe failure cases of non-hierarchical methods. Our code is publicly available at: https://github.com/elias-ramzi/HAPPIER.","url_abs":"https://arxiv.org/abs/2207.04873v2","url_pdf":"https://arxiv.org/pdf/2207.04873v2.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":"hierarchical-average-precision-training-for","repo_url":"https://github.com/elias-ramzi/happier","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"hierarchical-average-precision-training-for","repo_url":"https://github.com/elias-ramzi/suprank","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"image-retrieval","task_name":"Image Retrieval"},{"task_slug":"metric-learning","task_name":"Metric Learning"}],"methods":[{"method_slug":"happier","method_name":"HAPPIER"}],"datasets_introduced":[],"methods_introduced":[{"slug":"happier","name":"HAPPIER","full_name":"Hierarchical Average Precision training for Pertinent ImagE Retrieval"}],"results":[{"leaderboard":"/sota/image-retrieval-on-inaturalist","task":"Image Retrieval","dataset":"iNaturalist","model":"HAPPIER_F (ResNet-50)","rank_in_archive_order":6,"of":10,"metrics":{"R@1":"71.0"},"uses_additional_data":false},{"leaderboard":"/sota/image-retrieval-on-inaturalist","task":"Image Retrieval","dataset":"iNaturalist","model":"HAPPIER (ResNet-50)","rank_in_archive_order":7,"of":10,"metrics":{"R@1":"70.7"},"uses_additional_data":false},{"leaderboard":"/sota/metric-learning-on-dyml-animal","task":"Metric Learning","dataset":"DyML-Animal","model":"HAPPIER","rank_in_archive_order":1,"of":2,"metrics":{"Average-mAP":"43.8"},"uses_additional_data":false},{"leaderboard":"/sota/metric-learning-on-dyml-product","task":"Metric Learning","dataset":"DyML-Product","model":"HAPPIER","rank_in_archive_order":1,"of":2,"metrics":{"Average-mAP":"38.0"},"uses_additional_data":true},{"leaderboard":"/sota/metric-learning-on-dyml-vehicle","task":"Metric Learning","dataset":"DyML-Vehicle","model":"HAPPIER","rank_in_archive_order":1,"of":2,"metrics":{"Average-mAP":"37.0"},"uses_additional_data":false},{"leaderboard":"/sota/metric-learning-on-stanford-online-products-1","task":"Metric Learning","dataset":"Stanford Online Products","model":"HAPPIER_F","rank_in_archive_order":13,"of":33,"metrics":{"R@1":"81.8"},"uses_additional_data":true},{"leaderboard":"/sota/metric-learning-on-stanford-online-products-1","task":"Metric Learning","dataset":"Stanford Online Products","model":"HAPPIER","rank_in_archive_order":20,"of":33,"metrics":{"R@1":"81.0"},"uses_additional_data":true}],"syntology":{"syntology_url":"https://syntology.ai/paper/2207.04873","atlas_url":"https://app.syntology.ai/?focus=2207.04873","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2207.04873"}},"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":"deterministic:regex_extraction","url":"https://github.com/elias-ramzi/HAPPIER","reach":null}],"summary":{"ran":1,"ran_honours":4,"ran_draft_wrong":1,"unverified":3},"by_repo_kind":{"official":{"samples":9,"ran":6,"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":"df2ae1b21d4b22e7","entry":"SmoothRankHAP","repo":"elias-ramzi/HAPPIER","repo_kind":"official","path":"happier/losses/hap_loss.py","file_url":"https://github.com/elias-ramzi/HAPPIER/blob/HEAD/happier/losses/hap_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"df2ae1b21d4b22e7"}},{"code_sha256_prefix":"b61e3950faef80b0","entry":"avg_non_zero_reducer","repo":"elias-ramzi/HAPPIER","repo_kind":"official","path":"happier/losses/hap_loss.py","file_url":"https://github.com/elias-ramzi/HAPPIER/blob/HEAD/happier/losses/hap_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b61e3950faef80b0"}},{"code_sha256_prefix":"a2a835592cd98f2b","entry":"heaviside","repo":"elias-ramzi/HAPPIER","repo_kind":"official","path":"happier/losses/hap_loss.py","file_url":"https://github.com/elias-ramzi/HAPPIER/blob/HEAD/happier/losses/hap_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a2a835592cd98f2b"}},{"code_sha256_prefix":"85bac81fb967d1ed","entry":"rank","repo":"elias-ramzi/HAPPIER","repo_kind":"official","path":"happier/losses/hap_loss.py","file_url":"https://github.com/elias-ramzi/HAPPIER/blob/HEAD/happier/losses/hap_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"85bac81fb967d1ed"}},{"code_sha256_prefix":"f3c0efc31c507b36","entry":"reduce","repo":"elias-ramzi/HAPPIER","repo_kind":"official","path":"happier/losses/hap_loss.py","file_url":"https://github.com/elias-ramzi/HAPPIER/blob/HEAD/happier/losses/hap_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f3c0efc31c507b36"}},{"code_sha256_prefix":"4166f6849af69137","entry":"tau_sigmoid","repo":"elias-ramzi/HAPPIER","repo_kind":"official","path":"happier/losses/hap_loss.py","file_url":"https://github.com/elias-ramzi/HAPPIER/blob/HEAD/happier/losses/hap_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4166f6849af69137"}},{"code_sha256_prefix":"de52fe23104f1338","entry":"HAPLoss","repo":"elias-ramzi/HAPPIER","repo_kind":"official","path":"happier/losses/hap_loss.py","file_url":"https://github.com/elias-ramzi/HAPPIER/blob/HEAD/happier/losses/hap_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":"de52fe23104f1338"}},{"code_sha256_prefix":"6dfe8890c17d85e0","entry":"step_hrank","repo":"elias-ramzi/HAPPIER","repo_kind":"official","path":"happier/losses/hap_loss.py","file_url":"https://github.com/elias-ramzi/HAPPIER/blob/HEAD/happier/losses/hap_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":"6dfe8890c17d85e0"}},{"code_sha256_prefix":"3543d7a337574447","entry":"step_rank","repo":"elias-ramzi/HAPPIER","repo_kind":"official","path":"happier/losses/hap_loss.py","file_url":"https://github.com/elias-ramzi/HAPPIER/blob/HEAD/happier/losses/hap_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":"3543d7a337574447"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}