{
  "id": 424900,
  "title": "Strategies to ensemble multiple masks?",
  "url": "/competitions/hubmap-hacking-the-human-vasculature/discussion/424900",
  "author_name": "Yassine Alouini",
  "post_date": "2023-07-16T08:41:11.356000",
  "votes": 1,
  "comment_count": 8,
  "views": 0,
  "content": "<p>So far, the strategy I thought about is the following:</p>\n<ul>\n<li>use mask 1 if score 1 is better</li>\n<li>otherwise use mask 2</li>\n</ul>\n<p>Another strategy is to take the average pixels of the masks of course.</p>\n<p>What other strategies are you using?</p>\n<p>As suggested by <a href=\"https://www.kaggle.com/atamazian\" target=\"_blank\">@atamazian</a>, <strong>weighted masks fusion</strong> (WMF) can be used. It is an adaptation to masks of the <strong>weighted boxes fusion</strong> method (WBF in short) that you can read more about <a href=\"https://arxiv.org/pdf/1910.13302.pdf\" target=\"_blank\">here</a>.</p>\n<p>An implementation can be found <a href=\"https://www.kaggle.com/code/mistag/sartorius-tta-with-weighted-segments-fusion\" target=\"_blank\">here</a>.</p>",
  "messages": [
    {
      "id": 2351464,
      "postDate": "2023-07-20T06:52:57.373Z",
      "content": "<p>You either match multiple masks of multiple models by IoU or you can stack them, create semantic segmentation mask, blend them and separate them once again.</p>",
      "rawMarkdown": "You either match multiple masks of multiple models by IoU or you can stack them, create semantic segmentation mask, blend them and separate them once again.",
      "votes": 1,
      "replies": [
        {
          "id": 2351828,
          "postDate": "2023-07-20T12:06:16.290Z",
          "content": "<p>Blending and separating is a great idea, thanks for the suggestion. What types of algorithm you use for the separation step ? </p>",
          "rawMarkdown": "Blending and separating is a great idea, thanks for the suggestion. What types of algorithm you use for the separation step ? "
        }
      ]
    },
    {
      "id": 2346928,
      "postDate": "2023-07-16T16:23:51.700Z",
      "content": "<p>This notebook has a good package for an ensembling: <a href=\"https://www.kaggle.com/code/markunys/8th-place-solution-inference\" target=\"_blank\">https://www.kaggle.com/code/markunys/8th-place-solution-inference</a></p>",
      "rawMarkdown": "This notebook has a good package for an ensembling: https://www.kaggle.com/code/markunys/8th-place-solution-inference",
      "votes": 1,
      "replies": [
        {
          "id": 2347975,
          "postDate": "2023-07-17T10:19:23.740Z",
          "content": "<p>Will have a look, thanks <a href=\"https://www.kaggle.com/atamazian\" target=\"_blank\">@atamazian</a>!</p>",
          "rawMarkdown": "Will have a look, thanks @atamazian!",
          "replies": [
            {
              "id": 2348025,
              "postDate": "2023-07-17T10:51:50.583Z",
              "content": "<p>Indeed, the following dataset contains WMF (weighted masks fusion) <a href=\"https://www.kaggle.com/datasets/markunys/ensemble-boxes\" target=\"_blank\">https://www.kaggle.com/datasets/markunys/ensemble-boxes</a></p>",
              "rawMarkdown": "Indeed, the following dataset contains WMF (weighted masks fusion) https://www.kaggle.com/datasets/markunys/ensemble-boxes"
            }
          ]
        }
      ]
    },
    {
      "id": 2346435,
      "postDate": "2023-07-16T08:41:11.357Z",
      "content": "<p>So far, the strategy I thought about is the following:</p>\n<ul>\n<li>use mask 1 if score 1 is better</li>\n<li>otherwise use mask 2</li>\n</ul>\n<p>Another strategy is to take the average pixels of the masks of course.</p>\n<p>What other strategies are you using?</p>\n<p>As suggested by <a href=\"https://www.kaggle.com/atamazian\" target=\"_blank\">@atamazian</a>, <strong>weighted masks fusion</strong> (WMF) can be used. It is an adaptation to masks of the <strong>weighted boxes fusion</strong> method (WBF in short) that you can read more about <a href=\"https://arxiv.org/pdf/1910.13302.pdf\" target=\"_blank\">here</a>.</p>\n<p>An implementation can be found <a href=\"https://www.kaggle.com/code/mistag/sartorius-tta-with-weighted-segments-fusion\" target=\"_blank\">here</a>.</p>",
      "rawMarkdown": "So far, the strategy I thought about is the following:\n\n- use mask 1 if score 1 is better\n- otherwise use mask 2\n\nAnother strategy is to take the average pixels of the masks of course.\n\nWhat other strategies are you using?\n\n\nAs suggested by @atamazian, **weighted masks fusion** (WMF) can be used. It is an adaptation to masks of the **weighted boxes fusion** method (WBF in short) that you can read more about [here](https://arxiv.org/pdf/1910.13302.pdf).\n\nAn implementation can be found [here](https://www.kaggle.com/code/mistag/sartorius-tta-with-weighted-segments-fusion).",
      "votes": 1
    },
    {
      "id": 2346478,
      "postDate": "2023-07-16T09:27:42.233Z",
      "content": "<p>Not directly related but this notebook explains how TTA works for segmentation (should be applied twice so that the predicted mask is in the correct position before averaging) =&gt; <a href=\"https://www.kaggle.com/code/joshi98kishan/let-s-understand-tta-in-segmentation\" target=\"_blank\">https://www.kaggle.com/code/joshi98kishan/let-s-understand-tta-in-segmentation</a></p>",
      "rawMarkdown": "Not directly related but this notebook explains how TTA works for segmentation (should be applied twice so that the predicted mask is in the correct position before averaging) => https://www.kaggle.com/code/joshi98kishan/let-s-understand-tta-in-segmentation"
    },
    {
      "id": 2355208,
      "postDate": "2023-07-23T07:12:31.503Z",
      "rawMarkdown": "",
      "isDeleted": true,
      "replies": [
        {
          "id": 2355210,
          "postDate": "2023-07-23T07:17:37.093Z",
          "content": "<p>My code based on the notebook mentioned above <a href=\"url\" target=\"_blank\">https://www.kaggle.com/datasets/markunys/ensemble-boxes</a> and I changed some parts to solve the \"out of memory\" problem. The original code save all the mask during the process costing too much memory.</p>",
          "rawMarkdown": "My code based on the notebook mentioned above [https://www.kaggle.com/datasets/markunys/ensemble-boxes](url) and I changed some parts to solve the \"out of memory\" problem. The original code save all the mask during the process costing too much memory."
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2351464,
      "author_name": "Gunes Evitan",
      "author_url": "",
      "post_date": "2023-07-20T06:52:57.373000",
      "content": "<p>You either match multiple masks of multiple models by IoU or you can stack them, create semantic segmentation mask, blend them and separate them once again.</p>",
      "votes": 1,
      "replies": [
        {
          "id": 2351828,
          "author_name": "Yassine Alouini",
          "author_url": "",
          "post_date": "2023-07-20T12:06:16.290000",
          "content": "<p>Blending and separating is a great idea, thanks for the suggestion. What types of algorithm you use for the separation step ? </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 2346928,
      "author_name": "Araik Tamazian",
      "author_url": "",
      "post_date": "2023-07-16T16:23:51.700000",
      "content": "<p>This notebook has a good package for an ensembling: <a href=\"https://www.kaggle.com/code/markunys/8th-place-solution-inference\" target=\"_blank\">https://www.kaggle.com/code/markunys/8th-place-solution-inference</a></p>",
      "votes": 1,
      "replies": [
        {
          "id": 2347975,
          "author_name": "Yassine Alouini",
          "author_url": "",
          "post_date": "2023-07-17T10:19:23.740000",
          "content": "<p>Will have a look, thanks <a href=\"https://www.kaggle.com/atamazian\" target=\"_blank\">@atamazian</a>!</p>",
          "votes": 0,
          "replies": [
            {
              "id": 2348025,
              "author_name": "Yassine Alouini",
              "author_url": "",
              "post_date": "2023-07-17T10:51:50.583000",
              "content": "<p>Indeed, the following dataset contains WMF (weighted masks fusion) <a href=\"https://www.kaggle.com/datasets/markunys/ensemble-boxes\" target=\"_blank\">https://www.kaggle.com/datasets/markunys/ensemble-boxes</a></p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2346478,
      "author_name": "Yassine Alouini",
      "author_url": "",
      "post_date": "2023-07-16T09:27:42.233000",
      "content": "<p>Not directly related but this notebook explains how TTA works for segmentation (should be applied twice so that the predicted mask is in the correct position before averaging) =&gt; <a href=\"https://www.kaggle.com/code/joshi98kishan/let-s-understand-tta-in-segmentation\" target=\"_blank\">https://www.kaggle.com/code/joshi98kishan/let-s-understand-tta-in-segmentation</a></p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 2355208,
      "author_name": "",
      "author_url": "",
      "post_date": "2023-07-23T07:12:31.503000",
      "content": "",
      "votes": 0,
      "replies": [
        {
          "id": 2355210,
          "author_name": "Blue He",
          "author_url": "",
          "post_date": "2023-07-23T07:17:37.093000",
          "content": "<p>My code based on the notebook mentioned above <a href=\"url\" target=\"_blank\">https://www.kaggle.com/datasets/markunys/ensemble-boxes</a> and I changed some parts to solve the \"out of memory\" problem. The original code save all the mask during the process costing too much memory.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2351464": "You either match multiple masks of multiple models by IoU or you can stack them, create semantic segmentation mask, blend them and separate them once again.",
    "2346928": "This notebook has a good package for an ensembling: https://www.kaggle.com/code/markunys/8th-place-solution-inference",
    "2346435": "So far, the strategy I thought about is the following:\n\n- use mask 1 if score 1 is better\n- otherwise use mask 2\n\nAnother strategy is to take the average pixels of the masks of course.\n\nWhat other strategies are you using?\n\n\nAs suggested by @atamazian, **weighted masks fusion** (WMF) can be used. It is an adaptation to masks of the **weighted boxes fusion** method (WBF in short) that you can read more about [here](https://arxiv.org/pdf/1910.13302.pdf).\n\nAn implementation can be found [here](https://www.kaggle.com/code/mistag/sartorius-tta-with-weighted-segments-fusion).",
    "2346478": "Not directly related but this notebook explains how TTA works for segmentation (should be applied twice so that the predicted mask is in the correct position before averaging) => https://www.kaggle.com/code/joshi98kishan/let-s-understand-tta-in-segmentation",
    "2355208": ""
  }
}