{
  "id": 346307,
  "title": "how to ensemble multiple folds  RLE predictions?",
  "url": "/competitions/hubmap-organ-segmentation/discussion/346307",
  "author_name": "",
  "post_date": "2022-08-18T21:06:54.162338200Z",
  "votes": null,
  "comment_count": 5,
  "views": 0,
  "content": "<p>Can someone give some quick reference codes?<br>\nThanks</p>",
  "messages": [
    {
      "id": "1905237",
      "postDate": "08/18/2022 21:06:54",
      "content": "<p>Can someone give some quick reference codes?<br>\nThanks</p>",
      "rawMarkdown": "Can someone give some quick reference codes?\n\nThanks",
      "votes": null
    },
    {
      "id": "1906580",
      "postDate": "08/20/2022 02:39:10",
      "content": "<p>What I do is . . . I from every model I generate masks ---  I then average the masks then do the RLE convert.</p>\n<pre><code>mask = np.zeros((config.IMAGE_SIZE, config.IMAGE_SIZE))\n\nfor path in model_paths:\n\n    model.load_state_dict(torch.load(path))\n    masks_output = infer(model=model,valid_loader=valid_loader,device=config.DEVICE)\n\n    mask += masks_output[0][0].reshape(masks_output[0][0].shape[1],masks_output[0][0].shape[2])\n\nmask = mask/len(model_paths)\n</code></pre>",
      "rawMarkdown": "What I do is . . . I from every model I generate masks ---  I then average the masks then do the RLE convert.\n\n```\nmask = np.zeros((config.IMAGE_SIZE, config.IMAGE_SIZE))\n    \nfor path in model_paths:\n        \n    model.load_state_dict(torch.load(path))\n    masks_output = infer(model=model,valid_loader=valid_loader,device=config.DEVICE)\n\n    mask += masks_output[0][0].reshape(masks_output[0][0].shape[1],masks_output[0][0].shape[2])\n        \nmask = mask/len(model_paths)\n```",
      "votes": null
    },
    {
      "id": "1907190",
      "postDate": "08/20/2022 15:08:40",
      "content": "<p>Hi, did you use ensembling to get 129th place?</p>",
      "rawMarkdown": "Hi, did you use ensembling to get 129th place?",
      "votes": null
    },
    {
      "id": "1907246",
      "postDate": "08/20/2022 15:50:39",
      "content": "<p>you can vote pixel by pixel since we can know only mask from rle except for probabilities of output masks</p>",
      "rawMarkdown": "you can vote pixel by pixel since we can know only mask from rle except for probabilities of output masks",
      "votes": null
    },
    {
      "id": "1910396",
      "postDate": "08/23/2022 11:45:24",
      "content": "<p>thanks for your reply.</p>",
      "rawMarkdown": "thanks for your reply.",
      "votes": null
    },
    {
      "id": "1910721",
      "postDate": "08/23/2022 16:22:36",
      "content": "<p>that is previous one fold. Recent ensemble got a little bit improvement.</p>",
      "rawMarkdown": "that is previous one fold. Recent ensemble got a little bit improvement.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1906580,
      "author_name": "bibhabasumohapatra",
      "author_url": "",
      "post_date": "08/20/2022 02:39:10",
      "content": "<p>What I do is . . . I from every model I generate masks ---  I then average the masks then do the RLE convert.</p>\n<pre><code>mask = np.zeros((config.IMAGE_SIZE, config.IMAGE_SIZE))\n\nfor path in model_paths:\n\n    model.load_state_dict(torch.load(path))\n    masks_output = infer(model=model,valid_loader=valid_loader,device=config.DEVICE)\n\n    mask += masks_output[0][0].reshape(masks_output[0][0].shape[1],masks_output[0][0].shape[2])\n\nmask = mask/len(model_paths)\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 1910396,
          "author_name": "dragonzhang",
          "author_url": "",
          "post_date": "08/23/2022 11:45:24",
          "content": "<p>thanks for your reply.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1907190,
      "author_name": "nurkhanlaiyk",
      "author_url": "",
      "post_date": "08/20/2022 15:08:40",
      "content": "<p>Hi, did you use ensembling to get 129th place?</p>",
      "votes": null,
      "replies": [
        {
          "id": 1910721,
          "author_name": "dragonzhang",
          "author_url": "",
          "post_date": "08/23/2022 16:22:36",
          "content": "<p>that is previous one fold. Recent ensemble got a little bit improvement.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1907246,
      "author_name": "deepkim",
      "author_url": "",
      "post_date": "08/20/2022 15:50:39",
      "content": "<p>you can vote pixel by pixel since we can know only mask from rle except for probabilities of output masks</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1905237": "Can someone give some quick reference codes?\n\nThanks",
    "1906580": "What I do is . . . I from every model I generate masks ---  I then average the masks then do the RLE convert.\n\n```\nmask = np.zeros((config.IMAGE_SIZE, config.IMAGE_SIZE))\n    \nfor path in model_paths:\n        \n    model.load_state_dict(torch.load(path))\n    masks_output = infer(model=model,valid_loader=valid_loader,device=config.DEVICE)\n\n    mask += masks_output[0][0].reshape(masks_output[0][0].shape[1],masks_output[0][0].shape[2])\n        \nmask = mask/len(model_paths)\n```",
    "1907190": "Hi, did you use ensembling to get 129th place?",
    "1907246": "you can vote pixel by pixel since we can know only mask from rle except for probabilities of output masks",
    "1910396": "thanks for your reply.",
    "1910721": "that is previous one fold. Recent ensemble got a little bit improvement."
  },
  "source": "meta"
}