{"notes":[{"id":"object-detection/gfl","category":"object-detection","legacyPath":"object-detection/2006-gfl","legacySlug":"2006-gfl","legacyPaths":[],"title":"GFL","subtitle":"Unified Focus","author":"Z. Yuan","paperDate":"2020-06-08","publishedOn":"2025-08-23","paperTitle":"Generalized Focal Loss: Learning Qualified and Distributed Bounding Boxes for Dense Object Detection","paperUrl":"https://arxiv.org/abs/2006.04388","bibliography":{"title":"Generalized Focal Loss: Learning Qualified and Distributed Bounding Boxes for Dense Object Detection","authors":["Xiang Li","Wenhai Wang","Lijun Wu","Shuo Chen","Xiaolin Hu","Jun Li","Jinhui Tang","Jian Yang"],"url":"https://arxiv.org/abs/2006.04388","pdfUrl":"https://proceedings.neurips.cc/paper_files/paper/2020/file/f0bda020d2470f2e74990a07a607ebd9-Paper.pdf","codeUrl":"https://github.com/implus/GFocal","preprint":{"id":"2006.04388","submittedOn":"2020-06-08","url":"https://arxiv.org/abs/2006.04388"},"publication":{"venue":"NeurIPS","year":2020,"kind":"conference","url":"https://papers.nips.cc/paper_files/paper/2020/hash/f0bda020d2470f2e74990a07a607ebd9-Abstract.html"},"citation":"@misc{objectdetectiongfl2020,\n  title = {{Generalized Focal Loss: Learning Qualified and Distributed Bounding Boxes for Dense Object Detection}},\n  author = {Xiang Li and Wenhai Wang and Lijun Wu and Shuo Chen and Xiaolin Hu and Jun Li and Jinhui Tang and Jian Yang},\n  year = {2020},\n  eprint = {2006.04388},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2006.04388}\n}\n","citationPath":"/content/papers/citations/object-detection/gfl.71fabce4b963.bib"},"thumbnail":{"src":"/content/papers/assets/b23270560323cea28f3b1fe736d861dd3365d20c4fb99278dcc3ce306df890dc.jpg","width":1224,"height":380},"locale":"en","path":"/content/papers/en/object-detection/gfl.b9fa7b27fd1a.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"solution","text":"Solution","depth":2},{"id":"focal-loss","text":"Focal Loss","depth":3},{"id":"quality-focal-loss","text":"Quality Focal Loss","depth":3},{"id":"distribution-focal-loss","text":"Distribution Focal Loss","depth":3},{"id":"generalized-focal-loss","text":"Generalized Focal Loss","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"is-qfl-effective","text":"Is QFL Effective?","depth":3},{"id":"is-dfl-effective","text":"Is DFL Effective?","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{"解決問題":"solution","qfl-put-quality-into-the-class-score":"quality-focal-loss","dfl-turn-one-distance-into-a-distribution":"distribution-focal-loss","one-general-form-two-uses":"generalized-focal-loss","experimental-results-and-discussion":"discussion","qfl-does-the-score-improve-ranking":"is-qfl-effective","dfl-what-does-the-box-distribution-add":"is-dfl-effective"},"guide":null,"tags":["object-detection","loss-functions","njust","momenta"],"relatedReading":[{"id":"object-detection/fcos","relation":"comparison","topic":"Aligning classification and localization quality"},{"id":"object-detection/tood","relation":"comparison","topic":"Aligning classification and localization quality"}]},{"id":"object-detection/fcos","category":"object-detection","legacyPath":"object-detection/1904-fcos","legacySlug":"1904-fcos","legacyPaths":[],"title":"FCOS","subtitle":"A World Without Anchors","author":"Z. Yuan","paperDate":"2019-04-02","publishedOn":"2025-08-31","paperTitle":"FCOS: Fully Convolutional One-Stage Object Detection","paperUrl":"https://arxiv.org/abs/1904.01355","bibliography":{"title":"FCOS: Fully Convolutional One-Stage Object Detection","authors":["Zhi Tian","Chunhua Shen","Hao Chen","Tong He"],"url":"https://arxiv.org/abs/1904.01355","pdfUrl":"https://openaccess.thecvf.com/content_ICCV_2019/papers/Tian_FCOS_Fully_Convolutional_One-Stage_Object_Detection_ICCV_2019_paper.pdf","codeUrl":null,"preprint":{"id":"1904.01355","submittedOn":"2019-04-02","url":"https://arxiv.org/abs/1904.01355"},"publication":{"venue":"ICCV","year":2019,"kind":"conference","url":"https://openaccess.thecvf.com/content_ICCV_2019/html/Tian_FCOS_Fully_Convolutional_One-Stage_Object_Detection_ICCV_2019_paper.html"},"citation":"@misc{objectdetectionfcos2019,\n  title = {{FCOS: Fully Convolutional One-Stage Object Detection}},\n  author = {Zhi Tian and Chunhua Shen and Hao Chen and Tong He},\n  year = {2019},\n  eprint = {1904.01355},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1904.01355}\n}\n","citationPath":"/content/papers/citations/object-detection/fcos.00e1b4c82339.bib"},"thumbnail":{"src":"/content/papers/assets/23edca5ceca50cfcadbf6fd9cb8e8720100daff3135c951a4554454e3b9c69e7.jpg","width":1508,"height":668},"locale":"en","path":"/content/papers/en/object-detection/fcos.098144f33a61.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"solution","text":"Solution","depth":2},{"id":"discussion","text":"Discussion","depth":2},{"id":"multi-level-fpn-and-recall-upper-bound","text":"Multi-Level FPN and Recall Upper Bound","depth":3},{"id":"ambiguous-samples-caused-by-overlaps","text":"Ambiguous Samples Caused by Overlaps","depth":3},{"id":"the-necessity-and-effectiveness-of-center-ness","text":"The Necessity and Effectiveness of Center-ness","depth":3},{"id":"fair-comparison-with-anchor-based-methods","text":"Fair Comparison With Anchor-based Methods","depth":3},{"id":"overall-comparison-with-contemporary-sota","text":"Overall Comparison With Contemporary SOTA","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{"one-location-four-distances":"solution","fpn-levels-reduce-overlap-ambiguity":"solution","center-ness-discounts-edge-predictions":"solution","experimental-results-and-discussion":"discussion","assignment-coverage-and-overlapping-positions":"multi-level-fpn-and-recall-upper-bound","center-ness-and-a-controlled-baseline":"the-necessity-and-effectiveness-of-center-ness","the-test-dev-leaderboard-uses-another-schedule":"overall-comparison-with-contemporary-sota"},"guide":null,"tags":["object-detection","feature-fusion","label-assignment","adelaide"],"relatedReading":[{"id":"object-detection/retinanet","relation":"background","topic":"Dense detection and sample assignment"},{"id":"object-detection/atss","relation":"next","topic":"Dense detection and sample assignment"},{"id":"object-detection/gfl","relation":"comparison","topic":"Aligning classification and localization quality"}]},{"id":"object-detection/tood","category":"object-detection","legacyPath":"object-detection/2108-tood","legacySlug":"2108-tood","legacyPaths":[],"title":"TOOD","subtitle":"The End of Misalignment","author":"Z. Yuan","paperDate":"2021-08-17","publishedOn":"2025-08-30","paperTitle":"TOOD: Task-aligned One-stage Object Detection","paperUrl":"https://arxiv.org/abs/2108.07755","bibliography":{"title":"TOOD: Task-aligned One-stage Object Detection","authors":["Chengjian Feng","Yujie Zhong","Yu Gao","Matthew R. Scott","Weilin Huang"],"url":"https://arxiv.org/abs/2108.07755","pdfUrl":"https://openaccess.thecvf.com/content/ICCV2021/papers/Feng_TOOD_Task-Aligned_One-Stage_Object_Detection_ICCV_2021_paper.pdf","codeUrl":"https://github.com/fcjian/TOOD","preprint":{"id":"2108.07755","submittedOn":"2021-08-17","url":"https://arxiv.org/abs/2108.07755"},"publication":{"venue":"ICCV","year":2021,"kind":"conference","url":"https://openaccess.thecvf.com/content/ICCV2021/html/Feng_TOOD_Task-Aligned_One-Stage_Object_Detection_ICCV_2021_paper.html"},"citation":"@misc{objectdetectiontood2021,\n  title = {{TOOD: Task-aligned One-stage Object Detection}},\n  author = {Chengjian Feng and Yujie Zhong and Yu Gao and Matthew R. Scott and Weilin Huang},\n  year = {2021},\n  eprint = {2108.07755},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2108.07755}\n}\n","citationPath":"/content/papers/citations/object-detection/tood.4de53d61811e.bib"},"thumbnail":{"src":"/content/papers/assets/d5560386911d14104af5e1609a50f0af6db4f571f764de0e5f60f48ff30f4584.jpg","width":904,"height":772},"locale":"en","path":"/content/papers/en/object-detection/tood.cf11810df802.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"problem-solving","text":"Problem Solving","depth":2},{"id":"task-interaction-features","text":"Task Interaction Features","depth":3},{"id":"tap-layer-wise-attention","text":"TAP: Layer-wise Attention","depth":3},{"id":"explicit-alignment-m-and-o","text":"Explicit Alignment: M and O","depth":3},{"id":"task-aligned-sample-assignment","text":"Task-aligned Sample Assignment","depth":3},{"id":"loss-design","text":"Loss Design","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"is-t-head-worth-replacing","text":"Is T-head Worth Replacing?","depth":3},{"id":"tal-effectiveness","text":"TAL Effectiveness","depth":3},{"id":"the-complete-tood","text":"The Complete TOOD","depth":3},{"id":"comparison-with-sota","text":"Comparison with SOTA","depth":3},{"id":"did-alignment-actually-happen","text":"Did “Alignment” Actually Happen?","depth":3},{"id":"how-was-misalignment-improved","text":"How Was Misalignment Improved?","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{"solution":"problem-solving","share-first-then-select-features-for-each-task":"task-interaction-features","align-the-outputs-too-m-and-o":"explicit-alignment-m-and-o","tal-measure-score-and-box-with-one-ruler":"task-aligned-sample-assignment","experimental-results-and-discussion":"discussion","swap-in-the-t-head-first":"is-t-head-worth-replacing","tal-assignment-soft-targets-and-schedule":"tal-effectiveness","complete-tood-and-test-dev":"the-complete-tood","did-alignment-actually-improve":"did-alignment-actually-happen"},"guide":null,"tags":["object-detection","loss-functions","label-assignment","intellifusion","alibaba"],"relatedReading":[{"id":"object-detection/fcos","relation":"comparison","topic":"Aligning classification and localization quality"},{"id":"object-detection/gfl","relation":"comparison","topic":"Aligning classification and localization quality"}]}],"text":"This method has repeatedly appeared in recent object detection systems. Let’s take a quick look at its core concepts.\n\n## Problem Definition\n\nIn object detection, we are always chasing two types of scores:\n\n- **Classification Score**: What is inside this box?\n- **Localization Quality**: How accurate is this box?\n\nMainstream one-stage detectors (dense/one-stage) typically learn these two tasks **separately**: one branch for classification, another branch for quality (such as IoU or centerness).\n\nWhen it comes to inference, all candidate boxes are sorted with NMS, and we **directly multiply the two scores** to get the final score, which determines which boxes survive as the final predictions.\n\n\n\n![problem](/content/papers/assets/3bb5c9b234fe4730f6dcad87d06fe3398f39a66de7a26b23a3b4dd42e260445f.jpg)\n\n\n\nWhy multiply?\n\nIntuitively, we want both the classification score and the localization score to be high.\n\nMultiplication in the 0–1 score range rapidly pulls down the overall score if either side is low. Sounds reasonable, right?\n\nBut this brings two structural problems:\n\n1. **Inconsistency Between Training and Inference**:\n\n   During training, the classification and quality branches are independent—**the model is never explicitly required to make “the product of both” good**. But in inference, we suddenly use their product for ranking.\n   If the model could talk, it would probably complain: “Hey, that’s not what we agreed on!”\n\n2. **Interference from Negative Samples**:\n\n   The quality branch is usually supervised **only for positive samples**; background or negative samples have no explicit constraints.\n\n   As a result, sometimes the quality score for background boxes **can become inexplicably high**:\n\n   - Even if the classification score is low, a sudden spike in the quality score may still make the final product rank high enough to **push out true positives**.\n   - In dense anchor/fully sampled scenarios, this kind of “mis-ranking” gets amplified, directly harming the final decision made by NMS.\n\n\n\n    ![problem2](/content/papers/assets/a2a79ab3b047af6f60a803f7d585c4161ab70d78940bfbe8ac4ed92c44374440.jpg)\n\n\n\n---\n\nThese aren’t the only issues—we also have doubts about **the representation of bounding boxes themselves**.\n\nFor years, boxes have been treated as “deterministic coordinates,” but the real world is full of uncertainty: blurry boundaries, occlusion, annotator differences, etc. Describing everything with a single point is too rigid.\n\nSome have introduced **Gaussian distributions**, letting the model learn a mean and variance to at least express “uncertainty.” But Gaussian distributions are inherently symmetric and unimodal; when faced with boundary predictions that may be **skewed, long-tailed, or even multimodal**, they can be too restrictive. A learned distribution here is a flexible box representation, not by itself a calibrated measure of annotator uncertainty.\n\nSo we’re stuck again:\n\n- **Score level**: Classification and localization quality **speak different languages**; the training objective and inference ranking **don’t match**, and negative samples occasionally mess things up.\n- **Box representation**: It’s either **overly deterministic** or **oversimplified**, making it hard to represent more flexible boundary predictions.\n\nCan we make “classification” and “quality” speak the same language, aligning training and inference from the start?\n\nCan we avoid presetting what the box distribution looks like, and instead let the model learn a “more general, more flexible” distributional representation directly?\n\n## Solution\n\nBefore diving into the methods proposed in this paper, let’s first review the Focal Loss we learned in the past.\n\n\n> [!TIP]\n> \n> For details on Focal Loss, you can refer to our previous notes:\n> \n> - [**[17.08] RetinaNet: Focal Loss is the Key**](/blog/papers/object-detection/retinanet)\n\n\n### Focal Loss\n\nIn one-stage object detection, the first challenge faced by the classifier is **extreme sample imbalance**.\n\nMost candidate boxes are background (negative), while real foregrounds (positive) are extremely rare. This causes traditional cross-entropy loss to be dominated by “a huge number of easy background samples.” The model quickly learns to classify the background correctly, but struggles to properly learn those truly difficult foreground samples.\n\nThe goal of Focal Loss is:\n\n> **Suppress the contribution of easy samples and highlight the impact of hard samples.**\n\nIt introduces a “dynamic scaling factor” $(1-p_t)^{\\gamma}$ in front of the loss function. This makes the contribution of “samples that the model predicts with high confidence” close to zero, while “uncertain/easy-to-misclassify” samples are emphasized.\n\nThe formula is:\n\n$$\n\\mathrm{FL}(p) \\;=\\; - (1 - p_t)^{\\gamma}\\,\\log p_t,\\qquad\np_t \\;=\\;\n\\begin{cases}\np, & y=1 \\\\\n1-p, & y=0\n\\end{cases}\n$$\n\nWhere:\n\n- $p \\in [0,1]$: The model’s predicted probability for the positive class.\n- $y \\in \\{0,1\\}$: The ground truth label.\n- $\\gamma \\ge 0$: Controls the suppression strength for “easy samples.”\n\nThe key to this mechanism is its focusing idea: Focal Loss itself uses binary $y \\in \\{0,1\\}$, and GFL extends that idea to **continuous labels** ($y \\in [0,1]$). When we go beyond the simple “right/wrong” division and consider more fine-grained localization quality, the “hard example mining” spirit remains intact.\n\n### Quality Focal Loss\n\n\n\n![qfl](/content/papers/assets/b23270560323cea28f3b1fe736d861dd3365d20c4fb99278dcc3ce306df890dc.jpg)\n\n\n\nHaving understood Focal Loss’s focusing mechanism, let’s take it a step further:\n\n> In object detection, outputting a box means not only answering “what class is this?” but also “how accurate is this box?”\n\nTraditionally, **classification scores and localization quality scores are learned separately and only multiplied at inference**.\n\nHowever, as we discussed, this “last-minute fusion” introduces inconsistency: the model is trained for classification, but inference relies on a combination of classification and quality, without real synergy.\n\nTo solve this, the authors propose **Quality Focal Loss (QFL)**.\n\nThe design concept is: **let the model learn the “classification × quality” composite score from the very beginning, rather than stitching them together afterward.**\n\n---\n\nIn practice, the authors first introduce continuous labels.\n\n- For an assigned positive sample's ground-truth class $c^*$, the **label is no longer simply $0$ or $1$**, but the **current IoU** between its predicted box and the assigned GT, i.e., $y \\in (0,1]$. All other class components have target zero.\n\n  - $y=0$: Not this class or quality is zero.\n  - $y=1$: Perfect and high-quality match.\n  - In between: The box is partially correct, with limited quality.\n\n- For negative samples, all class labels remain $0$ (quality = 0).\n\n- The model output for each class is a **sigmoid probability** $\\sigma \\in [0,1]$.\n\n---\n\nFor the loss function, QFL achieves its goal in two steps:\n\nIt extends the original binary cross-entropy (BCE) into the full BCE form, and replaces the Focal modulation factor with a “continuous version based on label distance”:\n\n$$\n\\mathrm{QFL}(\\sigma) \\;=\\; -\\,|y-\\sigma|^{\\beta}\\;\\big[(1-y)\\log(1-\\sigma) + y\\log\\sigma\\big], \\qquad \\beta \\ge 0\n$$\n\nKey points:\n\n- When $\\sigma = y$, $\\mathrm{QFL}$ reaches its **global minimum**.\n- $|y-\\sigma|^{\\beta}$ is the “continuous focusing factor”: the further the output deviates from the label, the heavier the penalty.\n- If $y \\in \\{0,1\\}$ and an appropriate $\\beta$ is chosen, this **degenerates to the original Focal Loss** form apart from the class-balancing factor omitted above.\n\nWith QFL, the model’s output $\\sigma$ **already encodes both classification and quality signals**, so during inference, sorting and NMS can **directly use $\\sigma$**, greatly reducing inconsistencies.\n\n\n> [!TIP]\n> \n> Let’s look at an example:\n> \n> Suppose we are training a detector for “dog,” with the corresponding class _dog_.\n> \n> Now, in a given image, assume A and B have both been **assigned as positive dog samples**, while C is background. Their candidate boxes have different IoUs to the ground truth (GT):\n> \n> 1. **Candidate Box A**: IoU = 0.9 (almost perfect, very high quality)\n> 2. **Candidate Box B**: IoU = 0.4 (roughly correct, but noticeably off in position)\n> 3. **Candidate Box C**: IoU = 0.0 (completely incorrect, background)\n> \n> ---\n> \n> - **Traditional Focal Loss (FL)**\n> \n>   In FL, the label $y$ can only be binary:\n> \n>   - A → $y=1$\n>   - B → $y=1$ (under this example's positive assignment, despite its IoU of 0.4)\n>   - C → $y=0$\n> \n>   The model only learns: **A and B are both positive, C is negative**.\n>   In other words, the model doesn’t know “A is much better than B,” because the training signal doesn’t contain that information.\n> \n>   ***\n> \n> - **Quality Focal Loss (QFL)**\n> \n>   In QFL, the target is no longer just $\\{0,1\\}$, but the assigned positive box’s **current IoU** for the true-class component:\n> \n>   - A → $y=0.9$\n>   - B → $y=0.4$\n>   - C → $y=0.0$\n> \n>   Now, the model output $\\sigma$ will be directly trained to “approach the IoU”:\n> \n>   - A should learn $\\sigma \\approx 0.9$\n>   - B should learn $\\sigma \\approx 0.4$\n>   - C should learn $\\sigma \\approx 0.0$\n> \n>   In other words, the “classification score” output by the model **simultaneously reflects both “is it a dog” and “how well is it drawn.”**\n> \n> ---\n> \n> Take candidate box B as an example for the loss function:\n> \n> - Ground truth label $y=0.4$\n> - Model’s first prediction $\\sigma=0.7$\n> \n> At this point:\n> \n> $$\n> \\mathrm{QFL}(0.7) = -\\,|0.4-0.7|^\\beta \\big[(1-0.4)\\log(1-0.7) + 0.4 \\log(0.7)\\big]\n> $$\n> \n> - The focusing factor $|0.4-0.7|^\\beta$ reminds the model:\n>   **“You’re still off by 0.3 from the ground truth; fix it.”**\n> - The term inside the parentheses is BCE, pulling $\\sigma$ toward $0.4$.\n> \n> At the QFL optimum, $\\sigma$ matches the **current IoU target** for that assigned dog sample, rather than only learning “dog/no dog.” An IoU of 0.4 alone does not make a candidate positive; that was an assumption of this example.\n\n\n### Distribution Focal Loss\n\nAt this point, we’ve unified classification and quality in QFL.\n\nNext, the remaining issue is **box localization regression**.\n\nTraditionally, the offset for each edge (left, right, top, bottom) is regressed directly to a single number.\n\nThis is essentially telling the model:\n\n> “There’s only one correct answer—you must hit it exactly.”\n\nThis sounds reasonable, but it’s actually **too strict**.\n\nBecause in the real world, boundaries can be blurry or occluded, and annotations can differ. If you regress to a single value, it’s like asking an archer to “hit only the bullseye.” The training data here still provides one target box; the distribution is a more flexible prediction representation.\n\nSome have thought of using a Gaussian distribution instead of a single point, allowing the model to express uncertainty. This is better than direct delta regression, but a Gaussian is **symmetric and of fixed shape**, and still cannot flexibly express things like “I lean more toward the left.”\n\nThe authors argue: Instead of forcing the model to “report an answer directly,” why not let the model “describe its own belief as a distribution”?\n\n- First, discretize the possible regression range into bins ($y_0, y_1, \\dots, y_n$).\n- Then, let the model output a **softmax probability distribution** over these bins.\n- Finally, take the expected value of the distribution as the regression result:\n\n$$\n\\hat{y} = \\sum_{i=0}^n S_i \\, y_i\n$$\n\nThis way, the model doesn’t have to represent its prediction with a single point, but can say “I think the answer is somewhere around here.”\n\nHowever, this approach allows infinitely many distribution shapes to produce the same expected value, making efficient learning difficult.\n\n\n\n![dfl](/content/papers/assets/d8e16af88c00c38f70adb1c33b07def3d4c45e139d40d874faabe9f762d13569.jpg)\n\n\n\nSo, the authors introduce a clever design: supervise **only the two bins closest to the ground truth**.\n\nSuppose the true value $y$ is between $y_i$ and $y_{i+1}$. Decompose it into weights:\n\n- The closer to $y_i$, the greater the weight for $y_i$.\n- The closer to $y_{i+1}$, the greater the weight for $y_{i+1}$.\n\nMathematically:\n\n$$\nw_{\\text{left}} = \\frac{y_{i+1}-y}{y_{i+1}-y_i}, \\qquad\nw_{\\text{right}} = \\frac{y-y_i}{y_{i+1}-y_i}\n$$\n\nThe loss function is simple—just use cross-entropy:\n\n$$\n\\mathrm{DFL} = - \\Big[ w_{\\text{left}} \\log S_i + w_{\\text{right}} \\log S_{i+1} \\Big]\n$$\n\nAt the DFL optimum, $S_i = w_{\\text{left}}$ and $S_{i+1} = w_{\\text{right}}$ while the other bins approach zero, so the expected value **reconstructs the target $y$**. An arbitrary prediction during training need not hit it exactly.\n\n\n> [!TIP]\n> \n> Let’s go back to the dog detection example: what about the box position?\n> \n> Earlier, in the QFL example, we cared about “whether there’s a dog in this box, and how well it’s drawn.”\n> Now, let’s look at it from another angle: **Suppose candidate box B has IoU=0.4 because the right boundary is drawn too far out.** How do we train the model to pull the right boundary back in?\n> \n> - **Traditional regression**: Directly tell the model, “the right boundary's relative offset is 7.3 coordinate units.”\n> \n>   - But in reality, there may be some annotation error—does it really have to be exactly 7.3?\n> \n> - **DFL approach**:\n>   Decompose the ground truth “7.3” into nodes 7 and 8, and tell the model:\n> \n>   > “The probability of the boundary being at 7 is 0.7, and at 8 is 0.3.”\n> \n> At the optimum, the predicted mass concentrates on 7 and 8, and the expected value $\\hat y = 0.7 \\times 7 + 0.3 \\times 8 = 7.3$ aligns with the label. Those weights are not measured frequencies of different annotators' opinions.\n\n\n### Generalized Focal Loss\n\nIf we plot the two lines (QFL and DFL) on the same coordinate system, we’ll see that we’ve been doing the same thing all along:\n\n> **Between two adjacent label values, use probability to perform linear interpolation, and use “how close to the true value” to determine whether to amplify the penalty.**\n\nFirst, define the minimal local coordinate system:\n\n1. Take two adjacent continuous label values $y_l < y_r$.\n2. The model only needs to predict their probabilities $p_l, p_r \\ge 0$ (with $p_l + p_r = 1$).\n3. The final continuous prediction is obtained by linear combination:\n\n   $$\n   \\hat y \\;=\\; y_l\\,p_l \\;+\\; y_r\\,p_r, \\qquad y \\in [y_l,\\,y_r].\n   $$\n\nNext, embed the spirit of **focusing on hard examples** into the loss function in a continuous manner:\n\nIf $\\hat y$ is far from the ground truth $y$:\n\n- The penalty increases.\n  If it’s close:\n- The penalty decreases.\n\nThis leads us to **Generalized Focal Loss (GFL)**:\n\n$$\n\\mathrm{GFL}(p_l,p_r)\n\\;=\\;\n-\\;\\big|\\,y - (y_l p_l + y_r p_r)\\,\\big|^{\\beta}\n\\;\\Big[\\,(y_r - y)\\,\\log p_l \\;+\\; (y - y_l)\\,\\log p_r\\,\\Big]\n$$\n\nThis formula encapsulates two key elements:\n\n- **Soft-label cross-entropy** (the term in brackets; weights determined by $y$’s relative position within $[y_l, y_r]$);\n- **Continuous focusing factor** $\\big|y-\\hat y\\big|^{\\beta}$ (the greater the absolute distance, the stronger the penalty; $\\beta$ controls the strength).\n\nIn this formula, the global minimum is reached when\n\n$$\np_l^* \\;=\\; \\frac{y_r - y}{\\,y_r - y_l\\,}, \\qquad\np_r^* \\;=\\; \\frac{y - y_l}{\\,y_r - y_l\\,},\n$$\n\nAt this point, $\\hat y = y_l p_l^* + y_r p_r^* = y$, meaning the prediction exactly matches the continuous ground truth.\n\nAs $\\beta$ increases, examples farther from the ground truth receive more weight relative to closer examples; with $\\beta=0$, it reduces to pure soft-label cross-entropy.\n\n---\n\nAt this point, GFL gives us a clean perspective:\n\n> Describe continuous labels by “interpolation between two points,” and determine the focusing strength by “distance to the true value.”\n\nClassification and quality finally **speak the same language**, and box localization evolves from a **single point** to a **distribution**;\n\nBoth can ultimately be understood through a single concise formula. In the detector, QFL and DFL are still applied separately, alongside the geometric box loss for assigned positives.\n\nThat’s the end of our look at this paper.\n\nCongratulations.\n\n## Discussion\n\nThis paper conducts a comprehensive evaluation on **COCO**, following common settings:\n\n- Training uses **trainval35k (about 115K images)**.\n- Validation uses **minival (5K)** for ablation studies.\n- Final main results are reported on **test-dev (20K)**.\n\nThe implementation is based on **mmdetection** default hyperparameters; unless otherwise stated, ablations use **ResNet-50**, **1× schedule (12 epochs)**, and **no multi-scale training**. The main test-dev comparison instead uses a **2× schedule (24 epochs)** and multi-scale training. Speed is measured on **RTX 2080Ti, batch=1** where available; different backbones and schedules cannot be treated as one controlled loss ablation.\n\n### Is QFL Effective?\n\n\n\n![Separate and joint quality-score designs, transfer to three detectors, and beta ablation (paper Table 1(a)–(c))](/content/papers/assets/a93ecbbb6856d67d72fb5126e36895611b245b69b0daab804549260345c8a60d.jpg)\n\n\n\nResults are shown in the table above:\n\n- **Table (a) Design Comparison: Unified Representation (QFL) Outperforms Separate or Implicit Schemes.**\n\n  Under the same training settings and backbone, switching classification and localization quality to a single unified score (directly supervised by QFL) consistently surpasses:\n\n  - “Separate quality estimation” methods using IoU or centerness branches, and implicit weighting in classification loss.\n\n  In the matched rows, FCOS rises from **38.5 to 39.0 AP** and ATSS from **39.2 to 39.9 AP** when the centerness branch is replaced by QFL. This shows that using a single score to represent both “what” and “how well” performs better on overall AP in these tests; the separate IoU branch also exceeds the centerness branch on overall AP. There is a small exception: FCOS $AP_{75}$ is **41.9** with QFL versus **42.0** with the separate IoU branch.\n\n- **Table (b) Cross-architecture Generalization: Plug-and-Play, Consistent Gains.**\n\n  Replacing the original classification objective in FoveaBox, RetinaNet and SSD512 with the joint representation and QFL raises overall AP **36.4→37.0, 35.6→36.4 and 29.4→30.2**, respectively. These three tested designs benefit.\n\n  In practice, you can simply remove the “multiplication at inference” and use QFL’s output as the NMS ranking score.\n\n- **Table (c) Parameter Sensitivity: $\\beta=2$ is a Robust Choice.**\n\n  QFL’s focusing factor uses $|y-\\sigma|^{\\beta}$; in the tested ATSS settings, $\\beta=2$ reaches the highest overall AP, **39.9** versus **37.6** at $\\beta=0$ (table (c)). The table does not separately measure each hard and easy sample's contribution.\n\n![Four head designs: no quality score, a separate branch, quality weighting and a joint score (paper Figure 6)](/content/papers/assets/653b917d38011ab6714b9214d667793a1860826a4c54c7976bf9a0b9b107ec4f.jpg)\n\n### Is DFL Effective?\n\n\n\n![Dirac, Gaussian, general distribution and DFL, plus bin-count and spacing ablations (paper Table 2(a)–(c))](/content/papers/assets/dca77bdfd5115eb309946739624377299f5b93330d06a6c07a114c4c450742c8.jpg)\n\n\n\nResults are shown in the table above:\n\n- **Table (a) Advantages of Distributional Regression: General Distribution Outperforms Gaussian and Dirac.**\n\n  Changing box regression from a single point (Dirac) to a general distribution **with DFL** raises FCOS overall AP **38.5→39.0** and ATSS **39.2→39.5**. Their $AP_{75}$ values rise **41.6→42.3** and **42.2→42.8**. The general distribution without DFL reaches only **39.3 AP** on ATSS, so representation and neighboring-bin supervision should be distinguished. ATSS $AP_{50}$ slightly falls **57.4→57.3**; not every column improves.\n\n  The paper's Figure 7 shows selected **blurry-boundary and occlusion** examples where the general distribution's predicted boxes are closer to the annotated boxes. The four directional distributions show where the model places probability mass.\n\n- **Table (b) and (c) Hyperparameter Robustness: $n$ Is Insensitive, Smaller $\\Delta$ Is Better.**\n\n  Figure 5(c) shows the regression-target histogram. In Table 2(b), **$n=14$ or $16$** both reach **40.2 AP** on ATSS with $\\Delta=1$, while $n=12$ or $18$ reach **40.1**. In Table 2(c), $\\Delta=0.5$ and $1$ both reach **40.2 AP** at $n=16$, with larger spacing slightly lower. The authors choose **$\\Delta=1$** in practice.\n\n- **Learning Efficiency: Pushing Probability Mass Toward the Ground Truth**\n\n  DFL, through soft-label cross-entropy on two neighboring nodes, **explicitly encourages probability to concentrate near $y$**, avoiding inefficient distributions with the same expectation but varying shapes. Table 2(a) reports higher overall AP and $AP_{75}$ in the tested rows; it does not separately measure learning speed.\n\nDFL upgrades box regression from “guessing a number” to “outputting a distribution whose expectation recovers the target at the optimum.” In these COCO experiments, overall box AP rises modestly. Table 3 reports the same **19.4 FPS** before and after QFL/DFL on one RTX 2080Ti with batch size one; other hardware was not measured here.\n\nPractical recommendations: **$n=14\\sim16$, $\\Delta=1$** as default, and use with QFL/geometric losses.\n\nFor a controlled check of both losses together, Table 3's ATSS/ResNet-50 rows move from **39.2 AP** at baseline to **39.9** with QFL, **39.5** with DFL, and **40.2** with both. All four rows report **19.4 FPS** on the paper's RTX 2080Ti setup. The larger test-dev comparison in Table 4 instead uses 24 epochs and multi-scale training: GFL with ResNet-101 reaches **45.0 AP/14.6 FPS**, while the ResNeXt-101-32×4d-DCN row reaches **48.2 AP/10.0 FPS**. Those are different systems, so the difference from the 39.2-AP ablation is not the isolated effect of QFL and DFL.\n\n## Conclusion\n\nGFL **combines classification and localization quality into a single supervised score (QFL)** and **upgrades box regression from a single point to a learnable distribution (DFL)**.\n\nThe former addresses the long-standing inconsistency between training and inference; the latter enables the model to recover continuous target positions via expectation at its optimum, while representing a range of plausible boundary locations. This is not a calibrated measure of annotation uncertainty. Together, these designs form the **Generalized Focal Loss** framework, which pushed the accuracy-speed boundary of one-stage detectors further on COCO at the time.\n\nGFL turns “score alignment” and “distributional regression” into **reusable design languages**:\n\n- You can **try QFL+DFL in a one-stage dense detector** and test whether joint quality ranking and distributional geometry help under its own assignment and training setup;\n- Or take them as conceptual sources for “quality as score” and “box as distribution,” to be compared alongside TAL, VFL, or even E2E alignment approaches.\n\nIt’s not the end, but it has changed the **default mindset** when designing detectors—a fact that remains clear in 2025.\n\n---\n\n\n> [!NOTE]\n> \n> **Subsequent Developments (2021–2023)**\n> \n> The community continued to advance along the same main line: how to make the “classification score” more reliably reflect “localization quality.”\n> \n> **GFLv2** directly utilizes statistics from the “learned box distribution” to estimate quality, making quality prediction more dependable. **VarifocalNet (VFL)** takes the “IoU-aware classification score” approach, directly incorporating IoU into the label design; both methods push “score alignment” even further.\n> \n> This period also saw the emergence of **TOOD / TAL**, which align the best samples for classification and regression from both the assignment and loss perspectives, making alignment a standard concept for one-stage detectors.\n> \n> **Where is it in 2025?**\n> \n> - **DFL has become common in later YOLO designs**: Starting with YOLOv8, DFL is widely adopted for box regression, and the Ultralytics training interface explicitly uses `dfl` as a weight. Later YOLOv11 descriptions also include DFL as part of the loss composition; individual variants still need checking.\n> - **QFL/IoU-aware classification has permeated more frameworks**: Even in Transformer-based DETR families, recent research on alignment often evaluates **QFL/VFL** and similar IoU-aware classification designs alongside alignment losses.\n> - **Box distribution/joint scores are now mainstream toolbox components**: For example, MMDetection has long maintained the GFL head, providing standardized QFL+DFL implementations for easy replacement in one-stage baselines like ATSS/FCOS.\n> \n> **YOLOv10 in 2024–2025** shifted focus to **NMS-free unified training** and consistent assignment, representing a new direction beyond score alignment; yet, for box regression, DFL or its variants remain common.\n> \n> **Limitations and Use Cases**\n> \n> - **QFL is not a cure-all**: It uses IoU as its quality target. For tiny objects, severe occlusion, or significant annotation bias, IoU may be a coarse indicator of useful ranking quality. Methods like GFLv2 later explored quality information from box distribution statistics.\n> - **DFL introduces discretization hyperparameters**: You have to choose the number and width of bins. Although literature suggests **$n\\approx14\\sim16$, $\\Delta=1$** is robust and low-cost, in ultra-high-resolution or long-tail scenarios, you might need to tune them further to avoid quantization errors.\n> - **Relationship with new E2E designs**: In DETR-style “one-to-one matching” systems, assignment and specialized losses also affect classification-quality alignment. GFL's experiments establish its value for the tested **one-stage dense detectors**; how to adapt it to another system requires a separate check.\n","imageSizes":{"/content/papers/assets/3bb5c9b234fe4730f6dcad87d06fe3398f39a66de7a26b23a3b4dd42e260445f.jpg":{"width":1224,"height":304},"/content/papers/assets/a2a79ab3b047af6f60a803f7d585c4161ab70d78940bfbe8ac4ed92c44374440.jpg":{"width":1172,"height":480},"/content/papers/assets/b23270560323cea28f3b1fe736d861dd3365d20c4fb99278dcc3ce306df890dc.jpg":{"width":1224,"height":380},"/content/papers/assets/d8e16af88c00c38f70adb1c33b07def3d4c45e139d40d874faabe9f762d13569.jpg":{"width":1612,"height":366},"/content/papers/assets/a93ecbbb6856d67d72fb5126e36895611b245b69b0daab804549260345c8a60d.jpg":{"width":1374,"height":730},"/content/papers/assets/653b917d38011ab6714b9214d667793a1860826a4c54c7976bf9a0b9b107ec4f.jpg":{"width":1224,"height":220},"/content/papers/assets/dca77bdfd5115eb309946739624377299f5b93330d06a6c07a114c4c450742c8.jpg":{"width":1690,"height":712}}}
