{"notes":[{"id":"object-detection/h-detr","category":"object-detection","legacyPath":"object-detection/2207-h-detr","legacySlug":"2207-h-detr","legacyPaths":[],"title":"H-DETR","subtitle":"The Rebellion of Silent Queries","author":"Z. Yuan","paperDate":"2022-07-26","publishedOn":"2025-07-06","paperTitle":"DETRs with Hybrid Matching","paperUrl":"https://arxiv.org/abs/2207.13080","bibliography":{"title":"DETRs with Hybrid Matching","authors":["Ding Jia","Yuhui Yuan","Haodi He","Xiaopei Wu","Haojun Yu","Weihong Lin","Lei Sun","Chao Zhang","Han Hu"],"url":"https://arxiv.org/abs/2207.13080","pdfUrl":"https://openaccess.thecvf.com/content/CVPR2023/papers/Jia_DETRs_With_Hybrid_Matching_CVPR_2023_paper.pdf","codeUrl":"https://github.com/HDETR/H-Deformable-DETR","preprint":{"id":"2207.13080","submittedOn":"2022-07-26","url":"https://arxiv.org/abs/2207.13080"},"publication":{"venue":"CVPR","year":2023,"kind":"conference","url":"https://openaccess.thecvf.com/content/CVPR2023/html/Jia_DETRs_With_Hybrid_Matching_CVPR_2023_paper.html"},"citation":"@misc{objectdetectionhdetr2022,\n  title = {{DETRs with Hybrid Matching}},\n  author = {Ding Jia and Yuhui Yuan and Haodi He and Xiaopei Wu and Haojun Yu and Weihong Lin and Lei Sun and Chao Zhang and Han Hu},\n  year = {2022},\n  eprint = {2207.13080},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2207.13080}\n}\n","citationPath":"/content/papers/citations/object-detection/h-detr.822184101757.bib"},"thumbnail":{"src":"/content/papers/assets/63f1bc60b92f58d360457c0e3bbef0a3d4b3bd2a07377983b2dc5f5591ce28c2.jpg","width":1784,"height":350},"locale":"en","path":"/content/papers/en/object-detection/h-detr.005f94461932.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"solution","text":"Solution","depth":2},{"id":"main-branch-one-to-one-supervision","text":"Main Branch: One-to-One Supervision","depth":3},{"id":"auxiliary-branch-one-to-many-supervision","text":"Auxiliary Branch: One-to-Many Supervision","depth":3},{"id":"total-loss-and-implementation-details","text":"Total Loss and Implementation Details","depth":3},{"id":"more-forms-of-hybrid-supervision","text":"More Forms of Hybrid Supervision","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"coco-benchmark","text":"COCO Benchmark","depth":3},{"id":"lvis-benchmark","text":"LVIS Benchmark","depth":3},{"id":"sota-benchmark","text":"SOTA Benchmark","depth":3},{"id":"ablation-study","text":"Ablation Study","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{"auxiliary-branch-more-positive-slots":"auxiliary-branch-one-to-many-supervision","change-when-supervision-happens":"more-forms-of-hybrid-supervision","experimental-results-and-discussion":"discussion","coco-what-happens-when-more-queries-learn":"coco-benchmark","lvis-how-far-does-the-long-tail-evidence-go":"lvis-benchmark","system-comparison-the-conditions-behind-594-ap":"sota-benchmark","ap-training-time-and-inference-cost-across-the-three-schemes":"ablation-study"},"guide":null,"relatedReading":[{"id":"object-detection/deformable-detr","relation":"background","topic":"Set prediction and attention-based detection"}]},{"id":"object-detection/deformable-detr","category":"object-detection","legacyPath":"object-detection/2010-deformable-detr","legacySlug":"2010-deformable-detr","legacyPaths":[],"title":"Deformable DETR","subtitle":"Deformable Attention Mechanism","author":"Z. Yuan","paperDate":"2020-10-08","publishedOn":"2024-09-20","paperTitle":"Deformable DETR: Deformable Transformers for End-to-End Object Detection","paperUrl":"https://arxiv.org/abs/2010.04159","bibliography":{"title":"Deformable DETR: Deformable Transformers for End-to-End Object Detection","authors":["Xizhou Zhu","Weijie Su","Lewei Lu","Bin Li","Xiaogang Wang","Jifeng Dai"],"url":"https://arxiv.org/abs/2010.04159","pdfUrl":"https://arxiv.org/pdf/2010.04159","codeUrl":null,"preprint":{"id":"2010.04159","submittedOn":"2020-10-08","url":"https://arxiv.org/abs/2010.04159"},"publication":{"venue":"ICLR","year":2021,"kind":"conference","url":"https://arxiv.org/abs/2010.04159"},"citation":"@misc{objectdetectiondeformabledetr2020,\n  title = {{Deformable DETR: Deformable Transformers for End-to-End Object Detection}},\n  author = {Xizhou Zhu and Weijie Su and Lewei Lu and Bin Li and Xiaogang Wang and Jifeng Dai},\n  year = {2020},\n  eprint = {2010.04159},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2010.04159}\n}\n","citationPath":"/content/papers/citations/object-detection/deformable-detr.df721a30472e.bib"},"thumbnail":{"src":"/content/papers/assets/36edfc5595a85c73fcdc9a4bbb9e1ca512e1f100676eb7c37203d71c84905c05.jpg","width":1224,"height":752},"locale":"en","path":"/content/papers/en/object-detection/deformable-detr.68972544ff9b.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"problem-solution","text":"Problem Solution","depth":2},{"id":"deformable-attention","text":"Deformable Attention","depth":3},{"id":"multi-scale-computation","text":"Multi-Scale Computation","depth":3},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"code-breakdown","text":"Code Breakdown","depth":3},{"id":"training-strategy","text":"Training Strategy","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"comparison-with-detr","text":"Comparison with DETR","depth":3},{"id":"ablation-studies","text":"Ablation Studies","depth":3},{"id":"sota-comparison","text":"SOTA Comparison","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"object-detection/detr","relation":"background","topic":"Set prediction and attention-based detection"},{"id":"object-detection/h-detr","relation":"next","topic":"Set prediction and attention-based detection"},{"id":"object-detection/smca-detr","relation":"comparison","topic":"Faster convergence for Transformer detectors"}]}],"text":"In the world of DETR, most queries are assigned to classification and ordered to stay silent.\n\nEven if they get close to the truth... sorry, there is only one truth; the rest do not count.\n\n## Problem Definition\n\nSince DETR pioneered the introduction of Transformers into object detection, the DETR architecture quickly became a landmark standard in the vision field, as shown below:\n\n\n\n![detr](/content/papers/assets/e0f92541faf91c4657adebb2a728c65b14fefcd1bbabad3c18a45899751b5219.jpg)\n\n\n\nIts core contribution lies in abandoning handcrafted components such as anchors, proposals, and NMS, reformulating the object detection problem as a \"query-to-object\" matching task.\n\nThis design not only simplifies the pipeline but also enhances the overall architecture's transferability and generalization, spawning a whole ecosystem widely applied in 2D detection, 3D perception, pose estimation, visual tracking, segmentation, and other tasks.\n\nThis development path also encouraged researchers to continuously optimize various modules: some redesigned the Transformer structure, such as Deformable-DETR introducing deformable attention to address small object detection and convergence speed; others explored more efficient query representations, such as DAB-DETR, while DN-DETR and DINO introduced denoising queries to improve matching stability.\n\nHowever, regardless of architecture type, most learning mechanisms are still based on DETR’s foundational \"one-to-one matching\": each ground truth can only be assigned to a unique query, which is a key condition for removing NMS.\n\nYet, this one-to-one assignment strategy introduces significant bottlenecks during training.\n\nOn COCO, nearly 99% of images have fewer than 30 annotated boxes, while a Deformable-DETR configuration can generate 300 queries. Under one-to-one assignment, most unmatched queries receive background classification supervision but no positive box-regression supervision.\n\nThis means most queries receive very limited learning signals during training. Although they might still produce predictions during inference, their learning space during training is heavily constrained.\n\nMoreover, this assignment limitation suppresses the model’s ability to explore potential positive samples.\n\nEven if some queries align well spatially with an object, they are excluded from regression learning because that object is already \"occupied\" by other queries. This reduces training sample efficiency, limits queries’ spatial feature learning, and leads to slow training, poor positive sample fitting, and low resource utilization.\n\nWhile existing improvements like DN-DETR or DINO-DETR attempt to supplement positive sample supervision by \"adding noisy queries,\" their core aim is matching stability rather than training efficiency, often requiring extra noising schemes or query format adjustments and lacking generality for other tasks.\n\nSo, the question arises:\n\n> **Can we, while preserving DETR’s matching advantages, unleash the potential of idle queries and expand positive sample supervision?**\n\n---\n\n## Solution\n\n![model arch](/content/papers/assets/63f1bc60b92f58d360457c0e3bbef0a3d4b3bd2a07377983b2dc5f5591ce28c2.jpg)\n\nIn DETR’s original design, each image generates a set of query vectors, which after decoder processing produce predicted boxes and classification probabilities. These predictions are matched one-to-one with ground truth, selecting the \"best query describing each object,\" and the loss is computed accordingly.\n\nH-DETR’s modification does not break this one-to-one mechanism but adds an auxiliary branch allowing more queries to participate in learning.\n\nSpecifically, the model trains two groups of queries simultaneously: one maintains the original one-to-one supervision logic; the other adopts a \"one-to-many\" supervision, where each ground truth can correspond to multiple queries. This way, those previously \"wasted\" queries can learn to fit positive samples by approaching ground truth boxes during training.\n\n### Main Branch: One-to-One Supervision\n\nFor the first query group $Q = \\{q_1, q_2, ..., q_n\\}$, the standard DETR training is applied:\n\n1. Queries pass through $L$ decoder layers, producing $L$ sets of predictions $\\{P^1, P^2, ..., P^L\\}$.\n2. Each layer’s predictions are matched to ground truth via Hungarian Matching, selecting the best correspondences.\n3. The loss function is:\n\n$$\n\\mathcal{L}_{\\text{one2one}} = \\sum_{l=1}^{L} \\mathcal{L}_{\\text{Hungarian}}(P^l, G)\n$$\n\nwhere $\\mathcal{L}_{\\text{Hungarian}}$ is the standard DETR loss, including:\n\n- Classification loss\n- Bounding box $L_1$ regression loss\n- Generalized IoU loss\n\nThis branch preserves the core of DETR’s streamlined inference.\n\n---\n\n### Auxiliary Branch: One-to-Many Supervision\n\nThe other branch creates more \"opportunities to approach true objects\" through:\n\n1. Generating another query set $Q_b = \\{q_b^1, q_b^2, ..., q_b^T\\}$ for one-to-many learning.\n2. Repeating ground truth $G = \\{g_1, ..., g_m\\}$ $K$ times to obtain an augmented target set:\n\n$$\nG_b = \\{G, G, ..., G\\} \\quad (K \\text{ times})\n$$\n\n3. For each layer’s predictions $\\{P_b^1, ..., P_b^L\\}$, perform matching with $G_b$, calculating the loss:\n\n$$\n\\mathcal{L}_{\\text{one2many}} = \\sum_{l=1}^{L} \\mathcal{L}_{\\text{Hungarian}}(P_b^l, G_b)\n$$\n\nThis branch is used only during training. In the main COCO setting, there are 300 main queries and 1,500 auxiliary queries, and the target set is repeated $K=6$ times. Each object can therefore provide six additional positive matches beside its one main-branch match; this does not make all 1,800 queries positive.\n\n---\n\n### Total Loss and Implementation Details\n\nThe overall training loss is:\n\n$$\n\\mathcal{L} = \\mathcal{L}_{\\text{one2one}} + \\lambda \\cdot \\mathcal{L}_{\\text{one2many}}\n$$\n\nwhere $\\lambda$ balances the importance of the two branches.\n\nTo enable parallel processing of the two query groups within the computation graph, H-DETR employs masked multi-head self-attention to prevent cross-branch query interaction. The auxiliary queries and matching still add training cost: Table 6 reports 80 minutes for optimized Hybrid Branch training versus 75 minutes for a 1,800-query one-to-one baseline and 65 minutes for a 300-query baseline.\n\nFinally, during inference, H-DETR completely ignores the one-to-many branch and only retains the main branch’s outputs. Thus, H-DETR maintains DETR’s original simplicity: no NMS required, detection completed solely via query outputs.\n\n### More Forms of Hybrid Supervision\n\nBesides the \"dual-branch\" training structure, H-DETR proposes two further variants that implement dynamic switching of supervision strategies along the \"temporal\" and \"layer\" dimensions.\n\n- **Hybrid Epoch Scheme: Implicit Stage Switching**\n\n  This variant uses only one query set $Q_e = \\{q_1, ..., q_M\\}$ but changes matching strategy according to training \"stage.\"\n\n  - **Early phase (the first $\\rho$ fraction of epochs)**: use one-to-many matching by repeating each ground truth $\\widetilde K$ times to form an augmented annotation set $G_e$, matched against predictions $\\{P_e^1, ..., P_e^L\\}$. The loss is:\n\n  $$\n  \\mathcal{L}_{\\text{one2many}} = \\sum_{l=1}^{L} \\mathcal{L}_{\\text{Hungarian}}(P_e^l, G_e)\n  $$\n\n  - **Late phase (remaining $1 - \\rho$ epochs)**: switch back to one-to-one supervision with original ground truth $G$, loss:\n\n  $$\n  \\mathcal{L}_{\\text{one2one}} = \\sum_{l=1}^{L} \\mathcal{L}_{\\text{Hungarian}}(P_e^l, G)\n  $$\n\n  The idea is to use abundant supervision early to help queries approach ground truth quickly, then converge to the exclusivity required by one-to-one matching once the model learns basic localization.\n\n  During inference, only the one-to-one query outputs remain, preserving DETR’s simplicity.\n\n---\n\n- **Hybrid Layer Scheme: Supervision Splitting Within Layers**\n\n  This variant also uses a single query set $Q = \\{q_1, ..., q_N\\}$, but switches supervision based on the decoder layer number.\n\n  - **First $L_1$ decoder layers**: apply one-to-many supervision, matching predictions $\\{P^1, ..., P^{L_1}\\}$ to the repeated target set $\\overline G$:\n\n  $$\n  \\mathcal{L}_{\\text{one2many}} = \\sum_{l=1}^{L_1} \\mathcal{L}_{\\text{Hungarian}}(P^l, \\overline G)\n  $$\n\n  - **Last $L_2$ decoder layers**: revert to one-to-one supervision with loss:\n\n  $$\n  \\mathcal{L}_{\\text{one2one}} = \\sum_{l=L_1+1}^{L_1+L_2} \\mathcal{L}_{\\text{Hungarian}}(P^l, G)\n  $$\n\n  This design intuitively \"warms up\" queries with dense supervision early, then strengthens independent prediction and inference consistency later.\n\n  The total training loss is the sum:\n\n  $$\n  \\mathcal{L} = \\mathcal{L}_{\\text{one2many}} + \\mathcal{L}_{\\text{one2one}}\n  $$\n\n  Allowing the model to balance supervision density and inference consistency along the decoder depth.\n\n---\n\nCompared with the original dual-branch architecture, these two strategies need no separate auxiliary query branch, yet still provide additional positive sample supervision. In the reported setting each uses a single set of 1,800 queries: Hybrid Epoch uses $\\widetilde K=10$ and $\\rho=2/3$, while Hybrid Layer uses $\\overline K=10$, $L_1=4$, and $L_2=2$. Unlike Hybrid Branch, both keep 1,800 queries at inference in Table 6, so their deployment cost must be compared separately. H-DETR’s core idea remains to give queries more training information without losing the one-to-one objective at inference.\n\n## Discussion\n\nThe authors first focus on examining whether H-DETR can effectively improve the detection capability of the existing DETR architecture.\n\nUsing the COCO and LVIS datasets as benchmarks, they evaluate the performance of the improved H-Deformable-DETR model across different backbones and training durations.\n\n### COCO Benchmark\n\n\n\n![COCO](/content/papers/assets/4f375e4dbd9aa8e1f787b578db5716c791eafa1fe530153d78040f48f1698f5a.jpg)\n\n\n\nAccording to the experimental results, H-Deformable-DETR demonstrates consistent performance gains on the COCO validation set across different backbone scales—including ResNet-50, Swin-T, and Swin-L—and training schedules of 12 or 36 epochs.\n\nFor example, with Swin-T:\n\n- At 12 training epochs, the AP improves from 49.3% to 50.6%.\n- At 36 training epochs, AP increases from 51.8% to 53.2%.\n\nIn the three backbone and 12/36-epoch configurations shown in Table 1, hybrid matching improves COCO AP over each matching baseline while Hybrid Branch still uses the one-to-one branch at inference.\n\n### LVIS Benchmark\n\n\n\n![LVIS](/content/papers/assets/ea16e43803f017bb816c3e44721d1bc95fe3077ad00ea93d86f0eedbc13aaa6c.jpg)\n\n\n\nNext, the LVIS results are examined. LVIS is a dataset with thousands of categories exhibiting a highly long-tailed distribution, used to validate H-DETR’s generalization ability on large-scale and low-frequency classes.\n\nOn LVIS v1.0, R50 at 24 epochs rises from **32.2 to 33.5 AP (+1.3 percentage points)**; Swin-L at 48 epochs rises from **47.0 to 47.9 (+0.9 percentage points)**. The table breaks AP down by object size, not by rare/common/frequent categories.\n\n### SOTA Benchmark\n\n![sota benchmark](/content/papers/assets/9c558c6e561c19be9ddb16abf229e9b991ed6957b85b1ff4629ff3f7e79ec83e.jpg)\n\nThe authors also perform a system-level comparison of H-Deformable-DETR against recent representative state-of-the-art (SOTA) methods, shown in the table above.\n\nThe table reports single-scale inference, but backbones, input sizes, and schedules vary across systems. DINO-DETR and H-Deformable-DETR both use Swin-L, 1333×800 input, and 36 epochs in their compared rows.\n\nOverall, H-Deformable-DETR achieves 59.4% AP on the COCO validation set, surpassing several strong baselines including DINO-DETR.\n\nThe 59.4% AP system also includes other enhancement techniques from DINO, so its gap over DINO-DETR cannot all be credited to hybrid matching. The more isolated hybrid-matching gain is in the matched Deformable-DETR rows above; the one-to-one inference branch still needs no NMS.\n\n### Ablation Study\n\n\n\n![ablation](/content/papers/assets/47290ab6ad3dc4cea188daa6a395d4c6256c575b9e74c75f71cae0cf67e33e82.jpg)\n\n\n\nLet us review the performance of different hybrid architectures; readers can refer to the original paper for further experiments.\n\nIn designing this experiment, the authors made two key settings to ensure fairness:\n\n1. All three strategies provide **six times as many additional positive-assignment opportunities** as the one-to-one baseline, or seven times the total when the original positive match is counted.\n2. All three strategies use **1,800 queries during training**; Hybrid Branch keeps only 300 of them at inference.\n\nAdditionally, the table annotates different data sources as follows:\n\n- **† symbol**: The method uses **1800 queries in both training and inference**.\n- **♮ symbol**: The **80-minute** training time is measured after combining the two branches' matching-cost and loss computations. The paper did **not** implement GPU Hungarian matching.\n\nKey observations include:\n\n- The **Hybrid Branch** strategy achieves the most balanced overall performance:\n\n  - At 36 epochs it reaches **48.0 AP**, tied with Hybrid Layer; at 24 epochs Hybrid Layer reaches 47.9 versus Branch's 47.6.\n  - Optimized training averages **80 minutes**: about 7% more than the 1,800-query baseline's 75 minutes and about 23% more than the 300-query baseline's 65 minutes.\n  - Its inference uses **268 GFLOPs and runs at 6.7 FPS**. The two 1,800-query variants use **282 GFLOPs and run at 6.3 FPS** in the same V100 test. This table does not report memory.\n\n- The **Hybrid Epoch** strategy averages **95 minutes** of training and reaches **47.9 AP** at 36 epochs. The table does not isolate how much time the matching switch itself adds.\n\n- The **Hybrid Layer** strategy also reaches **48.0 AP** at 36 epochs, averages **100 minutes** of training, and runs at **6.3 FPS** at inference. It cannot be described as uniformly less accurate than Branch.\n\n## Conclusion\n\nDETR’s key innovation is reframing object detection as a query matching problem, simplifying inference but causing low training efficiency.\n\nH-DETR addresses this by introducing one-to-many supervision on the training side while retaining the one-to-one branch's inference behavior. For Hybrid Branch, the engineering appeal is no auxiliary inference branch, a measurable training cost, and a matching change that can be added to DETR variants. The reported results on several tasks support this direction; applying it to another query-based system still calls for matching its own training and inference costs.\n\n---\n\n\n> [!NOTE]\n> \n> For more information, refer to H-DETR’s GitHub homepage. Interested readers are encouraged to try it out:\n> \n> - [**DETRs with Hybrid Matching, CVPR 2023**](https://github.com/HDETR)\n","imageSizes":{"/content/papers/assets/e0f92541faf91c4657adebb2a728c65b14fefcd1bbabad3c18a45899751b5219.jpg":{"width":1224,"height":448},"/content/papers/assets/63f1bc60b92f58d360457c0e3bbef0a3d4b3bd2a07377983b2dc5f5591ce28c2.jpg":{"width":1784,"height":350},"/content/papers/assets/4f375e4dbd9aa8e1f787b578db5716c791eafa1fe530153d78040f48f1698f5a.jpg":{"width":912,"height":772},"/content/papers/assets/ea16e43803f017bb816c3e44721d1bc95fe3077ad00ea93d86f0eedbc13aaa6c.jpg":{"width":908,"height":300},"/content/papers/assets/9c558c6e561c19be9ddb16abf229e9b991ed6957b85b1ff4629ff3f7e79ec83e.jpg":{"width":1512,"height":394},"/content/papers/assets/47290ab6ad3dc4cea188daa6a395d4c6256c575b9e74c75f71cae0cf67e33e82.jpg":{"width":1132,"height":552}}}
