{"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/mdetr-modulated-detection-for-end-to-end","title":"MDETR -- Modulated Detection for End-to-End Multi-Modal Understanding","arxiv_id":"2104.12763","date":"2021-04-26","proceeding":null,"authors":["Aishwarya Kamath","Mannat Singh","Yann Lecun","Gabriel Synnaeve","Ishan Misra","Nicolas Carion"],"abstract":"Multi-modal reasoning systems rely on a pre-trained object detector to extract regions of interest from the image. However, this crucial module is typically used as a black box, trained independently of the downstream task and on a fixed vocabulary of objects and attributes. This makes it challenging for such systems to capture the long tail of visual concepts expressed in free form text. In this paper we propose MDETR, an end-to-end modulated detector that detects objects in an image conditioned on a raw text query, like a caption or a question. We use a transformer-based architecture to reason jointly over text and image by fusing the two modalities at an early stage of the model. We pre-train the network on 1.3M text-image pairs, mined from pre-existing multi-modal datasets having explicit alignment between phrases in text and objects in the image. We then fine-tune on several downstream tasks such as phrase grounding, referring expression comprehension and segmentation, achieving state-of-the-art results on popular benchmarks. We also investigate the utility of our model as an object detector on a given label set when fine-tuned in a few-shot setting. We show that our pre-training approach provides a way to handle the long tail of object categories which have very few labelled instances. Our approach can be easily extended for visual question answering, achieving competitive performance on GQA and CLEVR. The code and models are available at https://github.com/ashkamath/mdetr.","url_abs":"https://arxiv.org/abs/2104.12763v2","url_pdf":"https://arxiv.org/pdf/2104.12763v2.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":"mdetr-modulated-detection-for-end-to-end","repo_url":"https://github.com/ashkamath/mdetr","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"mdetr-modulated-detection-for-end-to-end","repo_url":"https://github.com/AleDella/mdter_eval","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"mdetr-modulated-detection-for-end-to-end","repo_url":"https://github.com/b-faye/lightmdetr","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"mdetr-modulated-detection-for-end-to-end","repo_url":"https://github.com/facebookresearch/multimodal","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"mdetr-modulated-detection-for-end-to-end","repo_url":"https://github.com/thunlp/pevl","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"generalized-referring-expression","task_name":"Generalized Referring Expression Comprehension"},{"task_slug":"phrase-grounding","task_name":"Phrase Grounding"},{"task_slug":"question-answering","task_name":"Question Answering"},{"task_slug":"referring-expression","task_name":"Referring Expression"},{"task_slug":"referring-expression-comprehension","task_name":"Referring Expression Comprehension"},{"task_slug":"referring-expression-segmentation","task_name":"Referring Expression Segmentation"},{"task_slug":"referring-image-matting-expression-based","task_name":"Referring Image Matting (Expression-based)"},{"task_slug":"referring-image-matting-keyword-based","task_name":"Referring Image Matting (Keyword-based)"},{"task_slug":"referring-image-matting-refmatte-rw100","task_name":"Referring Image Matting (RefMatte-RW100)"},{"task_slug":"visual-grounding","task_name":"Visual Grounding"},{"task_slug":"visual-question-answering-1","task_name":"Visual Question Answering"},{"task_slug":"visual-question-answering","task_name":"Visual Question Answering (VQA)"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"convolution","method_name":"Convolution"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"detr","method_name":"Detr"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"feedforward-network","method_name":"Feedforward Network"},{"method_slug":"infonce","method_name":"InfoNCE"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"method_slug":"mdetr","method_name":"MDETR"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"roberta","method_name":"RoBERTa"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"}],"datasets_introduced":[],"methods_introduced":[{"slug":"mdetr","name":"MDETR","full_name":"MDETR"}],"results":[{"leaderboard":"/sota/generalized-referring-expression","task":"Generalized Referring Expression Comprehension","dataset":"gRefCOCO","model":"MDETR","rank_in_archive_order":3,"of":5,"metrics":{"N-acc.":"36.1","Precision@(F1=1, IoU≥0.5)":"41.5"},"uses_additional_data":false},{"leaderboard":"/sota/phrase-grounding-on-flickr30k-entities-test","task":"Phrase Grounding","dataset":"Flickr30k Entities Test","model":"MDETR-ENB5","rank_in_archive_order":5,"of":18,"metrics":{"R@1":"84.3","R@10":"95.8","R@5":"93.9"},"uses_additional_data":true},{"leaderboard":"/sota/referring-expression-segmentation-on","task":"Referring Expression Segmentation","dataset":"PhraseCut","model":"MDETR ENB3","rank_in_archive_order":3,"of":6,"metrics":{"Mean IoU":"53.7","Pr@0.5":"57.5","Pr@0.7":"39.9","Pr@0.9":"11.9"},"uses_additional_data":false},{"leaderboard":"/sota/referring-image-matting-expression-based-on","task":"Referring Image Matting (Expression-based)","dataset":"RefMatte","model":"MDETR (ResNet-101)","rank_in_archive_order":4,"of":4,"metrics":{"MAD":"0.0482","MAD(E)":"0.0515","MSE":"0.0434","MSE(E)":"0.0463","SAD":"84.70","SAD(E)":"90.45"},"uses_additional_data":false},{"leaderboard":"/sota/referring-image-matting-keyword-based-on","task":"Referring Image Matting (Keyword-based)","dataset":"RefMatte","model":"MDETR (ResNet-101)","rank_in_archive_order":4,"of":4,"metrics":{"MAD":"0.0183","MAD(E)":"0.0190","MSE":"0.0137","MSE(E)":"0.0141","SAD":"32.27","SAD(E)":"33.52"},"uses_additional_data":false},{"leaderboard":"/sota/referring-image-matting-refmatte-rw100-on","task":"Referring Image Matting (RefMatte-RW100)","dataset":"RefMatte","model":"MDETR (ResNet-101)","rank_in_archive_order":3,"of":4,"metrics":{"MAD":"0.0751","MAD(E)":"0.0779","MSE":"0.0675","MSE(E)":"0.0700","SAD":"131.58","SAD(E)":"136.59"},"uses_additional_data":false},{"leaderboard":"/sota/visual-question-answering-on-clevr","task":"Visual Question Answering (VQA)","dataset":"CLEVR","model":"MDETR","rank_in_archive_order":2,"of":15,"metrics":{"Accuracy":"99.7"},"uses_additional_data":false},{"leaderboard":"/sota/visual-question-answering-on-clevr-humans","task":"Visual Question Answering (VQA)","dataset":"CLEVR-Humans","model":"MDETR","rank_in_archive_order":1,"of":5,"metrics":{"Accuracy":"81.7"},"uses_additional_data":false},{"leaderboard":"/sota/visual-question-answering-on-gqa-test-std","task":"Visual Question Answering (VQA)","dataset":"GQA test-std","model":"MDETR-ENB5","rank_in_archive_order":3,"of":7,"metrics":{"Accuracy":"62.45"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2104.12763","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2104.12763"}},"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/b-faye/lightmdetr","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/ashkamath/mdetr","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/thunlp/pevl","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/AleDella/mdter_eval","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/multimodal","reach":null}],"summary":{"ran":4,"ran_violates":1,"ran_draft_wrong":1,"unverified":5},"by_repo_kind":{"listed":{"samples":11,"ran":6,"repositories":3}},"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":"609d6e843c9168d9","entry":"MDETR","repo":"facebookresearch/multimodal","repo_kind":"listed","path":"torchmultimodal/models/mdetr/model.py","file_url":"https://github.com/facebookresearch/multimodal/blob/HEAD/torchmultimodal/models/mdetr/model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"609d6e843c9168d9"}},{"code_sha256_prefix":"237c7b6df0869f30","entry":"MDETR","repo":"AleDella/mdter_eval","repo_kind":"listed","path":"models/mdetr.py","file_url":"https://github.com/AleDella/mdter_eval/blob/HEAD/models/mdetr.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"237c7b6df0869f30"}},{"code_sha256_prefix":"fb58fa6bb659e502","entry":"MDETRModelOutput","repo":"facebookresearch/multimodal","repo_kind":"listed","path":"torchmultimodal/models/mdetr/model.py","file_url":"https://github.com/facebookresearch/multimodal/blob/HEAD/torchmultimodal/models/mdetr/model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"fb58fa6bb659e502"}},{"code_sha256_prefix":"5da926b2f714f541","entry":"MDETRTransformerOutput","repo":"facebookresearch/multimodal","repo_kind":"listed","path":"torchmultimodal/models/mdetr/model.py","file_url":"https://github.com/facebookresearch/multimodal/blob/HEAD/torchmultimodal/models/mdetr/model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"5da926b2f714f541"}},{"code_sha256_prefix":"ac8fe530cdad4d8c","entry":"dice_loss","repo":"b-faye/lightmdetr","repo_kind":"listed","path":"models/segmentation.py","file_url":"https://github.com/b-faye/lightmdetr/blob/HEAD/models/segmentation.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ac8fe530cdad4d8c"}},{"code_sha256_prefix":"5c0711aada67957e","entry":"sigmoid_focal_loss","repo":"b-faye/lightmdetr","repo_kind":"listed","path":"models/segmentation.py","file_url":"https://github.com/b-faye/lightmdetr/blob/HEAD/models/segmentation.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5c0711aada67957e"}},{"code_sha256_prefix":"cea3f92defccfb9c","entry":"build_position_encoding","repo":"b-faye/lightmdetr","repo_kind":"listed","path":"models/position_encoding.py","file_url":"https://github.com/b-faye/lightmdetr/blob/HEAD/models/position_encoding.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cea3f92defccfb9c"}},{"code_sha256_prefix":"09e538653a528ac8","entry":"build_transformer","repo":"b-faye/lightmdetr","repo_kind":"listed","path":"models/transformer.py","file_url":"https://github.com/b-faye/lightmdetr/blob/HEAD/models/transformer.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"09e538653a528ac8"}},{"code_sha256_prefix":"751cd5726698116b","entry":"build_transformer","repo":"b-faye/lightmdetr","repo_kind":"listed","path":"models/transformer_plus.py","file_url":"https://github.com/b-faye/lightmdetr/blob/HEAD/models/transformer_plus.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"751cd5726698116b"}},{"code_sha256_prefix":"d71abefc7fbfd28f","entry":"get_init_file","repo":"b-faye/lightmdetr","repo_kind":"listed","path":"run_with_submitit.py","file_url":"https://github.com/b-faye/lightmdetr/blob/HEAD/run_with_submitit.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d71abefc7fbfd28f"}},{"code_sha256_prefix":"84691ff17ae1504d","entry":"get_shared_folder","repo":"b-faye/lightmdetr","repo_kind":"listed","path":"run_with_submitit.py","file_url":"https://github.com/b-faye/lightmdetr/blob/HEAD/run_with_submitit.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"84691ff17ae1504d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}