{"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/deepemd-few-shot-image-classification-with","title":"DeepEMD: Differentiable Earth Mover's Distance for Few-Shot Learning","arxiv_id":"2003.06777","date":"2020-03-15","proceeding":null,"authors":["Chi Zhang","Yujun Cai","Guosheng Lin","Chunhua Shen"],"abstract":"In this work, we develop methods for few-shot image classification from a new perspective of optimal matching between image regions. We employ the Earth Mover's Distance (EMD) as a metric to compute a structural distance between dense image representations to determine image relevance. The EMD generates the optimal matching flows between structural elements that have the minimum matching cost, which is used to calculate the image distance for classification. To generate the important weights of elements in the EMD formulation, we design a cross-reference mechanism, which can effectively alleviate the adverse impact caused by the cluttered background and large intra-class appearance variations. To implement k-shot classification, we propose to learn a structured fully connected layer that can directly classify dense image representations with the EMD. Based on the implicit function theorem, the EMD can be inserted as a layer into the network for end-to-end training. Our extensive experiments validate the effectiveness of our algorithm which outperforms state-of-the-art methods by a significant margin on five widely used few-shot classification benchmarks, namely, miniImageNet, tieredImageNet, Fewshot-CIFAR100 (FC100), Caltech-UCSD Birds-200-2011 (CUB), and CIFAR-FewShot (CIFAR-FS). We also demonstrate the effectiveness of our method on the image retrieval task in our experiments.","url_abs":"https://arxiv.org/abs/2003.06777v5","url_pdf":"https://arxiv.org/pdf/2003.06777v5.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":"deepemd-few-shot-image-classification-with","repo_url":"https://github.com/Tsingularity/FRN","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}},{"paper_slug":"deepemd-few-shot-image-classification-with","repo_url":"https://github.com/anguyen8/deepface-emd","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"deepemd-few-shot-image-classification-with","repo_url":"https://github.com/anguyen8/face-vit","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"deepemd-few-shot-image-classification-with","repo_url":"https://github.com/icoz69/DeepEMD","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"deepemd-few-shot-image-classification-with","repo_url":"https://github.com/whut-yirong/espt","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"classification-1","task_name":"Classification"},{"task_slug":"few-shot-image-classification","task_name":"Few-Shot Image Classification"},{"task_slug":"few-shot-learning","task_name":"Few-Shot Learning"},{"task_slug":"classification","task_name":"General Classification"},{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"image-retrieval","task_name":"Image Retrieval"},{"task_slug":"retrieval","task_name":"Retrieval"},{"task_slug":"image-classification","task_name":"image-classification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2003.06777","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2003.06777"}},"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/icoz69/DeepEMD","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/anguyen8/deepface-emd","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Tsingularity/FRN","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/anguyen8/face-vit","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/whut-yirong/espt","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":1,"ran":1,"unverified":5},"by_repo_kind":{"listed":{"samples":7,"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":"fac5364e2f53c6db","entry":"conv3x3","repo":"icoz69/DeepEMD","repo_kind":"listed","path":"Models/models/resnet.py","file_url":"https://github.com/icoz69/DeepEMD/blob/HEAD/Models/models/resnet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fac5364e2f53c6db"}},{"code_sha256_prefix":"8327880f0b76f9db","entry":"set_gpu","repo":"icoz69/DeepEMD","repo_kind":"listed","path":"Models/utils.py","file_url":"https://github.com/icoz69/DeepEMD/blob/HEAD/Models/utils.py","link_basis":"harvester_set","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":"8327880f0b76f9db"}},{"code_sha256_prefix":"81ea193467a90dc6","entry":"compute_confidence_interval","repo":"icoz69/DeepEMD","repo_kind":"listed","path":"Models/utils.py","file_url":"https://github.com/icoz69/DeepEMD/blob/HEAD/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":"81ea193467a90dc6"}},{"code_sha256_prefix":"684d8ecbca8220ab","entry":"count_acc","repo":"icoz69/DeepEMD","repo_kind":"listed","path":"Models/utils.py","file_url":"https://github.com/icoz69/DeepEMD/blob/HEAD/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":"684d8ecbca8220ab"}},{"code_sha256_prefix":"829d4aa345489492","entry":"emd_inference_opencv","repo":"icoz69/DeepEMD","repo_kind":"listed","path":"Models/models/emd_utils.py","file_url":"https://github.com/icoz69/DeepEMD/blob/HEAD/Models/models/emd_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":"829d4aa345489492"}},{"code_sha256_prefix":"4d2e05bc40a813cc","entry":"emd_inference_opencv_test","repo":"icoz69/DeepEMD","repo_kind":"listed","path":"Models/models/emd_utils.py","file_url":"https://github.com/icoz69/DeepEMD/blob/HEAD/Models/models/emd_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":"4d2e05bc40a813cc"}},{"code_sha256_prefix":"3a753faa7bc9cb2b","entry":"set_up_datasets","repo":"icoz69/DeepEMD","repo_kind":"listed","path":"Models/dataloader/data_utils.py","file_url":"https://github.com/icoz69/DeepEMD/blob/HEAD/Models/dataloader/data_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":"3a753faa7bc9cb2b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}