{"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/lw-detr-a-transformer-replacement-to-yolo-for","title":"LW-DETR: A Transformer Replacement to YOLO for Real-Time Detection","arxiv_id":"2406.03459","date":"2024-06-05","proceeding":null,"authors":["Qiang Chen","Xiangbo Su","Xinyu Zhang","Jian Wang","Jiahui Chen","Yunpeng Shen","Chuchu Han","Ziliang Chen","Weixiang Xu","Fanrong Li","Shan Zhang","Kun Yao","Errui Ding","Gang Zhang","Jingdong Wang"],"abstract":"In this paper, we present a light-weight detection transformer, LW-DETR, which outperforms YOLOs for real-time object detection. The architecture is a simple stack of a ViT encoder, a projector, and a shallow DETR decoder. Our approach leverages recent advanced techniques, such as training-effective techniques, e.g., improved loss and pretraining, and interleaved window and global attentions for reducing the ViT encoder complexity. We improve the ViT encoder by aggregating multi-level feature maps, and the intermediate and final feature maps in the ViT encoder, forming richer feature maps, and introduce window-major feature map organization for improving the efficiency of interleaved attention computation. Experimental results demonstrate that the proposed approach is superior over existing real-time detectors, e.g., YOLO and its variants, on COCO and other benchmark datasets. Code and models are available at (https://github.com/Atten4Vis/LW-DETR).","url_abs":"https://arxiv.org/abs/2406.03459v1","url_pdf":"https://arxiv.org/pdf/2406.03459v1.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":"lw-detr-a-transformer-replacement-to-yolo-for","repo_url":"https://github.com/atten4vis/lw-detr","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"lw-detr-a-transformer-replacement-to-yolo-for","repo_url":"https://github.com/roboflow/rf-detr","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"object-detection","task_name":"Object Detection"},{"task_slug":"real-time-object-detection","task_name":"Real-Time Object Detection"},{"task_slug":"object-detection-1","task_name":"object-detection"}],"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":"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":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"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":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2406.03459","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2406.03459"}},"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/roboflow/rf-detr","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/atten4vis/lw-detr","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":10,"ran_honours":1,"ran_draft_wrong":2,"unverified":3},"by_repo_kind":{"official":{"samples":16,"ran":13,"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":"53a9978ad1f02a68","entry":"build_o365","repo":"atten4vis/lw-detr","repo_kind":"official","path":"datasets/o365.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/datasets/o365.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":"53a9978ad1f02a68"}},{"code_sha256_prefix":"f31a58bf6457ced5","entry":"convert_to_xywh","repo":"atten4vis/lw-detr","repo_kind":"official","path":"datasets/coco_eval.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/datasets/coco_eval.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f31a58bf6457ced5"}},{"code_sha256_prefix":"0cf40c7d0cb18b12","entry":"convert_to_xywh","repo":"atten4vis/lw-detr","repo_kind":"official","path":"deploy/benchmark.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/deploy/benchmark.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0cf40c7d0cb18b12"}},{"code_sha256_prefix":"74f3f5c1bab38c14","entry":"crop","repo":"atten4vis/lw-detr","repo_kind":"official","path":"datasets/transforms.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/datasets/transforms.py","link_basis":"plan_row","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":"74f3f5c1bab38c14"}},{"code_sha256_prefix":"fe0ddcc2d420c9a0","entry":"evaluate","repo":"atten4vis/lw-detr","repo_kind":"official","path":"datasets/coco_eval.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/datasets/coco_eval.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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"fe0ddcc2d420c9a0"}},{"code_sha256_prefix":"515cc5f258dc7853","entry":"gen_encoder_output_proposals","repo":"atten4vis/lw-detr","repo_kind":"official","path":"models/transformer.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/models/transformer.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":"515cc5f258dc7853"}},{"code_sha256_prefix":"dbaf5088c2722765","entry":"gen_sineembed_for_position","repo":"atten4vis/lw-detr","repo_kind":"official","path":"models/transformer.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/models/transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"dbaf5088c2722765"}},{"code_sha256_prefix":"dddb7619ec008b7f","entry":"get_coco_pretrain_from_obj365","repo":"atten4vis/lw-detr","repo_kind":"official","path":"util/obj365_to_coco_model.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/util/obj365_to_coco_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"dddb7619ec008b7f"}},{"code_sha256_prefix":"aaf8532df82e8e3f","entry":"get_image_list","repo":"atten4vis/lw-detr","repo_kind":"official","path":"deploy/benchmark.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/deploy/benchmark.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":"aaf8532df82e8e3f"}},{"code_sha256_prefix":"9be9e658b5bd688a","entry":"hflip","repo":"atten4vis/lw-detr","repo_kind":"official","path":"datasets/transforms.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/datasets/transforms.py","link_basis":"harvester_set","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":"9be9e658b5bd688a"}},{"code_sha256_prefix":"09ea33b5c4fc4241","entry":"position_supervised_loss","repo":"atten4vis/lw-detr","repo_kind":"official","path":"models/lwdetr.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/models/lwdetr.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"09ea33b5c4fc4241"}},{"code_sha256_prefix":"5c0711aada67957e","entry":"sigmoid_focal_loss","repo":"atten4vis/lw-detr","repo_kind":"official","path":"models/lwdetr.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/models/lwdetr.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":"e1af8817e1aa2d5e","entry":"sigmoid_varifocal_loss","repo":"atten4vis/lw-detr","repo_kind":"official","path":"models/lwdetr.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/models/lwdetr.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e1af8817e1aa2d5e"}},{"code_sha256_prefix":"bb1c621e43ea7529","entry":"build_o365_raw","repo":"atten4vis/lw-detr","repo_kind":"official","path":"datasets/o365.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/datasets/o365.py","link_basis":"first_harvest_node","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":"bb1c621e43ea7529"}},{"code_sha256_prefix":"ec7a90cc24d6630d","entry":"build_transformer","repo":"atten4vis/lw-detr","repo_kind":"official","path":"models/transformer.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/models/transformer.py","link_basis":"first_harvest_node","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":"ec7a90cc24d6630d"}},{"code_sha256_prefix":"57e6ba78fde593e0","entry":"multi_head_attention_forward","repo":"atten4vis/lw-detr","repo_kind":"official","path":"models/attention.py","file_url":"https://github.com/atten4vis/lw-detr/blob/HEAD/models/attention.py","link_basis":"first_harvest_node","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":"57e6ba78fde593e0"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}