{
  "id": 162218,
  "title": "Understanding weighted boxes fusion",
  "url": "/competitions/global-wheat-detection/discussion/162218",
  "author_name": "",
  "post_date": "2020-06-27T21:34:28.067214500Z",
  "votes": 10,
  "comment_count": 6,
  "views": 0,
  "content": "<p>Hello, Can someone explain to me how wbf works with single models?\nI have seen quite a few notebooks with wbf on single models which confuses me because I thought it was a method specific to an ensemble of models, I could be totally wrong ofcourse.\nI had never seen this technique before(not a regular on kaggle) and I am a bit puzzled.\nIf anyone can take the time to explain(in detail if possible) what i am missing/wbf in general, I would be really grateful\nThank you.</p>",
  "messages": [
    {
      "id": "904742",
      "postDate": "06/27/2020 21:34:28",
      "content": "<p>Hello, Can someone explain to me how wbf works with single models?\nI have seen quite a few notebooks with wbf on single models which confuses me because I thought it was a method specific to an ensemble of models, I could be totally wrong ofcourse.\nI had never seen this technique before(not a regular on kaggle) and I am a bit puzzled.\nIf anyone can take the time to explain(in detail if possible) what i am missing/wbf in general, I would be really grateful\nThank you.</p>",
      "rawMarkdown": "Hello, Can someone explain to me how wbf works with single models?\nI have seen quite a few notebooks with wbf on single models which confuses me because I thought it was a method specific to an ensemble of models, I could be totally wrong ofcourse.\nI had never seen this technique before(not a regular on kaggle) and I am a bit puzzled.\nIf anyone can take the time to explain(in detail if possible) what i am missing/wbf in general, I would be really grateful\nThank you.",
      "votes": null
    },
    {
      "id": "905611",
      "postDate": "06/28/2020 17:15:06",
      "content": "<p>Hey <a href=\"https://www.kaggle.com/arunavameister\" target=\"_blank\">@arunavameister</a>, I will try to discuss this matter with you as it is of the highest interest for me too ! <br>\nI have seen WBF method used in models tested using TTA such as in this notebook: <a href=\"https://www.kaggle.com/shonenkov/wbf-over-tta-single-model-efficientdet\" target=\"_blank\">https://www.kaggle.com/shonenkov/wbf-over-tta-single-model-efficientdet</a></p>\n<p>WBF Method, as explained in <a href=\"https://arxiv.org/pdf/1910.13302.pdf\" target=\"_blank\">this paper</a>, is a method originally introduced to merge predictions of ensemble models (so not single models). This is a common situation where WBF is applied:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2231509%2F7091affff14f63d32ffdc58a1041af9b%2Ftta_wbf_1.png?generation=1593364448855769&amp;alt=media\" alt=\"\"></p>\n<p>However, WBF method could be rephrased as a <em>merging process of <strong>multiple</strong> predictions</em>. These multiple predictions can come from different models or a single model using TTA. <br>\nIndeed, the whole of TTA (Test-Time Augmentation) is to make our single model make multiple predictions for a single image that have been augmented (usually simple rotations do the trick). All these predictions are then merged using WBF even if they come from a single model.<br>\nThis is how it would be used:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2231509%2Fda151c5553c2f903d653c43b7c1fb036%2Ftta_wbf_2.png?generation=1593364468512399&amp;alt=media\" alt=\"\"></p>\n<p>I hope it helped ! Best of luck for the rest of the competition 😃 </p>",
      "rawMarkdown": "Hey @arunavameister, I will try to discuss this matter with you as it is of the highest interest for me too ! \nI have seen WBF method used in models tested using TTA such as in this notebook: https://www.kaggle.com/shonenkov/wbf-over-tta-single-model-efficientdet\n\nWBF Method, as explained in [this paper](https://arxiv.org/pdf/1910.13302.pdf), is a method originally introduced to merge predictions of ensemble models (so not single models). This is a common situation where WBF is applied:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2231509%2F7091affff14f63d32ffdc58a1041af9b%2Ftta_wbf_1.png?generation=1593364448855769&amp;alt=media)\n\n\nHowever, WBF method could be rephrased as a *merging process of **multiple** predictions*. These multiple predictions can come from different models or a single model using TTA. \nIndeed, the whole of TTA (Test-Time Augmentation) is to make our single model make multiple predictions for a single image that have been augmented (usually simple rotations do the trick). All these predictions are then merged using WBF even if they come from a single model.\nThis is how it would be used:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2231509%2Fda151c5553c2f903d653c43b7c1fb036%2Ftta_wbf_2.png?generation=1593364468512399&amp;alt=media)\n\nI hope it helped ! Best of luck for the rest of the competition 😃",
      "votes": null
    },
    {
      "id": "907216",
      "postDate": "06/29/2020 19:14:40",
      "content": "<p>Similar to NMS (Non-maximum suppression), WBF is used to <strong><em>post-process multi-boxes prediction</em></strong>.</p>\n\n<p>Remember that a single object detection model always produces hundreds of boxes for each picture, therefore, it's perfectly sensible for applying WBF on a single model with a single picture.</p>\n\n<p>Considering a set of highly overlapped boxes, NMS simply choose the best (most confident) box, and eliminate the rest. (see the best introduction here : <a href=\"https://www.youtube.com/watch?v=VAo84c1hQX8\">https://www.youtube.com/watch?v=VAo84c1hQX8</a> ). In contrast, WBF will just 'average' all the boxes of this set (e.g. weighted average each corner of <code>ymin, ymax, xmin, xmax</code> , using confident scores as weights)</p>\n\n<p>In the author (ZFTurbo) implementation, he also extends to multi-models setting post-processing (note that each model predict multi-boxes) </p>\n\n<p>i.e. if you have more than one model, WBF allows you to also specify weights for each model too. Nevertheless, unline boxes' weights, models' weights have to be manually specify (default is equal weights for all models). </p>\n\n<hr>\n\n<p>It's interesting though to see the combination of NMS and WBF are doing very good in the best public kernel here.</p>",
      "rawMarkdown": "Similar to NMS (Non-maximum suppression), WBF is used to ***post-process multi-boxes prediction***.\n\nRemember that a single object detection model always produces hundreds of boxes for each picture, therefore, it's perfectly sensible for applying WBF on a single model with a single picture.\n\nConsidering a set of highly overlapped boxes, NMS simply choose the best (most confident) box, and eliminate the rest. (see the best introduction here : https://www.youtube.com/watch?v=VAo84c1hQX8 ). In contrast, WBF will just 'average' all the boxes of this set (e.g. weighted average each corner of `ymin, ymax, xmin, xmax` , using confident scores as weights)\n\nIn the author (ZFTurbo) implementation, he also extends to multi-models setting post-processing (note that each model predict multi-boxes) \n\ni.e. if you have more than one model, WBF allows you to also specify weights for each model too. Nevertheless, unline boxes' weights, models' weights have to be manually specify (default is equal weights for all models). \n\n---\nIt's interesting though to see the combination of NMS and WBF are doing very good in the best public kernel here.",
      "votes": null
    },
    {
      "id": "930208",
      "postDate": "07/15/2020 09:17:50",
      "content": "<p>Thank you both for your comments!</p>",
      "rawMarkdown": "Thank you both for your comments!",
      "votes": null
    },
    {
      "id": "936854",
      "postDate": "07/20/2020 14:59:02",
      "content": "<p>👍 </p>",
      "rawMarkdown": "👍",
      "votes": null
    },
    {
      "id": "1218625",
      "postDate": "02/26/2021 04:01:52",
      "content": "<p><a href=\"https://medium.com/analytics-vidhya/weighted-boxes-fusion-86fad2c6be16\" target=\"_blank\">https://medium.com/analytics-vidhya/weighted-boxes-fusion-86fad2c6be16</a></p>",
      "rawMarkdown": "https://medium.com/analytics-vidhya/weighted-boxes-fusion-86fad2c6be16",
      "votes": null
    },
    {
      "id": "1446882",
      "postDate": "08/04/2021 13:24:04",
      "content": "<p>Thank you for the answers!, was looking for this since 2 days.</p>",
      "rawMarkdown": "Thank you for the answers!, was looking for this since 2 days.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1218625,
      "author_name": "shivacvml",
      "author_url": "",
      "post_date": "02/26/2021 04:01:52",
      "content": "<p><a href=\"https://medium.com/analytics-vidhya/weighted-boxes-fusion-86fad2c6be16\" target=\"_blank\">https://medium.com/analytics-vidhya/weighted-boxes-fusion-86fad2c6be16</a></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1446882,
      "author_name": "yagnathakkar",
      "author_url": "",
      "post_date": "08/04/2021 13:24:04",
      "content": "<p>Thank you for the answers!, was looking for this since 2 days.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 905611,
      "author_name": "dimartinot",
      "author_url": "",
      "post_date": "06/28/2020 17:15:06",
      "content": "<p>Hey <a href=\"https://www.kaggle.com/arunavameister\" target=\"_blank\">@arunavameister</a>, I will try to discuss this matter with you as it is of the highest interest for me too ! <br>\nI have seen WBF method used in models tested using TTA such as in this notebook: <a href=\"https://www.kaggle.com/shonenkov/wbf-over-tta-single-model-efficientdet\" target=\"_blank\">https://www.kaggle.com/shonenkov/wbf-over-tta-single-model-efficientdet</a></p>\n<p>WBF Method, as explained in <a href=\"https://arxiv.org/pdf/1910.13302.pdf\" target=\"_blank\">this paper</a>, is a method originally introduced to merge predictions of ensemble models (so not single models). This is a common situation where WBF is applied:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2231509%2F7091affff14f63d32ffdc58a1041af9b%2Ftta_wbf_1.png?generation=1593364448855769&amp;alt=media\" alt=\"\"></p>\n<p>However, WBF method could be rephrased as a <em>merging process of <strong>multiple</strong> predictions</em>. These multiple predictions can come from different models or a single model using TTA. <br>\nIndeed, the whole of TTA (Test-Time Augmentation) is to make our single model make multiple predictions for a single image that have been augmented (usually simple rotations do the trick). All these predictions are then merged using WBF even if they come from a single model.<br>\nThis is how it would be used:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2231509%2Fda151c5553c2f903d653c43b7c1fb036%2Ftta_wbf_2.png?generation=1593364468512399&amp;alt=media\" alt=\"\"></p>\n<p>I hope it helped ! Best of luck for the rest of the competition 😃 </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 907216,
      "author_name": "ratthachat",
      "author_url": "",
      "post_date": "06/29/2020 19:14:40",
      "content": "<p>Similar to NMS (Non-maximum suppression), WBF is used to <strong><em>post-process multi-boxes prediction</em></strong>.</p>\n\n<p>Remember that a single object detection model always produces hundreds of boxes for each picture, therefore, it's perfectly sensible for applying WBF on a single model with a single picture.</p>\n\n<p>Considering a set of highly overlapped boxes, NMS simply choose the best (most confident) box, and eliminate the rest. (see the best introduction here : <a href=\"https://www.youtube.com/watch?v=VAo84c1hQX8\">https://www.youtube.com/watch?v=VAo84c1hQX8</a> ). In contrast, WBF will just 'average' all the boxes of this set (e.g. weighted average each corner of <code>ymin, ymax, xmin, xmax</code> , using confident scores as weights)</p>\n\n<p>In the author (ZFTurbo) implementation, he also extends to multi-models setting post-processing (note that each model predict multi-boxes) </p>\n\n<p>i.e. if you have more than one model, WBF allows you to also specify weights for each model too. Nevertheless, unline boxes' weights, models' weights have to be manually specify (default is equal weights for all models). </p>\n\n<hr>\n\n<p>It's interesting though to see the combination of NMS and WBF are doing very good in the best public kernel here.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 930208,
      "author_name": "arunavameister",
      "author_url": "",
      "post_date": "07/15/2020 09:17:50",
      "content": "<p>Thank you both for your comments!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 936854,
      "author_name": "vchauhanusf",
      "author_url": "",
      "post_date": "07/20/2020 14:59:02",
      "content": "<p>👍 </p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "904742": "Hello, Can someone explain to me how wbf works with single models?\nI have seen quite a few notebooks with wbf on single models which confuses me because I thought it was a method specific to an ensemble of models, I could be totally wrong ofcourse.\nI had never seen this technique before(not a regular on kaggle) and I am a bit puzzled.\nIf anyone can take the time to explain(in detail if possible) what i am missing/wbf in general, I would be really grateful\nThank you.",
    "905611": "Hey @arunavameister, I will try to discuss this matter with you as it is of the highest interest for me too ! \nI have seen WBF method used in models tested using TTA such as in this notebook: https://www.kaggle.com/shonenkov/wbf-over-tta-single-model-efficientdet\n\nWBF Method, as explained in [this paper](https://arxiv.org/pdf/1910.13302.pdf), is a method originally introduced to merge predictions of ensemble models (so not single models). This is a common situation where WBF is applied:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2231509%2F7091affff14f63d32ffdc58a1041af9b%2Ftta_wbf_1.png?generation=1593364448855769&amp;alt=media)\n\n\nHowever, WBF method could be rephrased as a *merging process of **multiple** predictions*. These multiple predictions can come from different models or a single model using TTA. \nIndeed, the whole of TTA (Test-Time Augmentation) is to make our single model make multiple predictions for a single image that have been augmented (usually simple rotations do the trick). All these predictions are then merged using WBF even if they come from a single model.\nThis is how it would be used:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2231509%2Fda151c5553c2f903d653c43b7c1fb036%2Ftta_wbf_2.png?generation=1593364468512399&amp;alt=media)\n\nI hope it helped ! Best of luck for the rest of the competition 😃",
    "907216": "Similar to NMS (Non-maximum suppression), WBF is used to ***post-process multi-boxes prediction***.\n\nRemember that a single object detection model always produces hundreds of boxes for each picture, therefore, it's perfectly sensible for applying WBF on a single model with a single picture.\n\nConsidering a set of highly overlapped boxes, NMS simply choose the best (most confident) box, and eliminate the rest. (see the best introduction here : https://www.youtube.com/watch?v=VAo84c1hQX8 ). In contrast, WBF will just 'average' all the boxes of this set (e.g. weighted average each corner of `ymin, ymax, xmin, xmax` , using confident scores as weights)\n\nIn the author (ZFTurbo) implementation, he also extends to multi-models setting post-processing (note that each model predict multi-boxes) \n\ni.e. if you have more than one model, WBF allows you to also specify weights for each model too. Nevertheless, unline boxes' weights, models' weights have to be manually specify (default is equal weights for all models). \n\n---\nIt's interesting though to see the combination of NMS and WBF are doing very good in the best public kernel here.",
    "930208": "Thank you both for your comments!",
    "936854": "👍",
    "1218625": "https://medium.com/analytics-vidhya/weighted-boxes-fusion-86fad2c6be16",
    "1446882": "Thank you for the answers!, was looking for this since 2 days."
  },
  "source": "meta"
}