{
  "id": 342321,
  "title": "New to detection problems, quick question regarding rle and mask shape/size",
  "url": "/competitions/hubmap-organ-segmentation/discussion/342321",
  "author_name": "",
  "post_date": "2022-08-06T18:48:13.106425700Z",
  "votes": 2,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Hi guys, This is my first time participating in a detection focused competition and I have a question concerning rle and mask size. Before encoding your mask to rle, is it common practice to resize the mask to the original size that it was before preprocessing?</p>",
  "messages": [
    {
      "id": "1887502",
      "postDate": "08/06/2022 18:48:13",
      "content": "<p>Hi guys, This is my first time participating in a detection focused competition and I have a question concerning rle and mask size. Before encoding your mask to rle, is it common practice to resize the mask to the original size that it was before preprocessing?</p>",
      "rawMarkdown": "Hi guys, This is my first time participating in a detection focused competition and I have a question concerning rle and mask size. Before encoding your mask to rle, is it common practice to resize the mask to the original size that it was before preprocessing?",
      "votes": null
    },
    {
      "id": "1887509",
      "postDate": "08/06/2022 19:01:21",
      "content": "<p>Yes! If you encode mask to RLE you have to ensure that the finished mask is the same size as the original image on which you made predictions.</p>\n<p>I usually slice training images into tiles, resize them on 1/2 of size and then train my model with them. When I'm doing submission I slice testing images on slices and resize them on 1/2 make a model prediction with them so that I get masks out of the tiles, and then stitch them together in the joined image… After that, I resize joined image to the original size to ensure the correct submission evaluation.</p>",
      "rawMarkdown": "Yes! If you encode mask to RLE you have to ensure that the finished mask is the same size as the original image on which you made predictions.\n\nI usually slice training images into tiles, resize them on 1/2 of size and then train my model with them. When I'm doing submission I slice testing images on slices and resize them on 1/2 make a model prediction with them so that I get masks out of the tiles, and then stitch them together in the joined image... After that, I resize joined image to the original size to ensure the correct submission evaluation.",
      "votes": null
    },
    {
      "id": "1887522",
      "postDate": "08/06/2022 19:10:33",
      "content": "<p>Interesting, thank you so much for your input!</p>",
      "rawMarkdown": "Interesting, thank you so much for your input!",
      "votes": null
    },
    {
      "id": "1887527",
      "postDate": "08/06/2022 19:19:16",
      "content": "<p>Oh and one more thing that I forgot to tell you! Be careful how you decode end encode the RLE! The RLE in train.csv is COLUMN wise not ROW wise. And you have to make a submission with column-wise encoding. If you will not respect this encoding style you will get a submission error.</p>\n<p>If you have used row-wise encoding you can simply <a href=\"https://numpy.org/doc/stable/reference/generated/numpy.transpose.html\" target=\"_blank\">transpose the mask</a> that you are encoding in submission to get column wise encoding. The same goes with decoding.</p>",
      "rawMarkdown": "Oh and one more thing that I forgot to tell you! Be careful how you decode end encode the RLE! The RLE in train.csv is COLUMN wise not ROW wise. And you have to make a submission with column-wise encoding. If you will not respect this encoding style you will get a submission error.\n\nIf you have used row-wise encoding you can simply [transpose the mask](https://numpy.org/doc/stable/reference/generated/numpy.transpose.html) that you are encoding in submission to get column wise encoding. The same goes with decoding.",
      "votes": null
    },
    {
      "id": "1891945",
      "postDate": "08/09/2022 18:51:12",
      "content": "<p>In general, you will want to resize your mask to the original size of the image before you encode it to RLE. This is because the RLE encoding is based on pixel values, and if your mask is resized then the encoding will be off.</p>\n<p>The Devastator.</p>",
      "rawMarkdown": "In general, you will want to resize your mask to the original size of the image before you encode it to RLE. This is because the RLE encoding is based on pixel values, and if your mask is resized then the encoding will be off.\n\nThe Devastator.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1887509,
      "author_name": "urosjarc",
      "author_url": "",
      "post_date": "08/06/2022 19:01:21",
      "content": "<p>Yes! If you encode mask to RLE you have to ensure that the finished mask is the same size as the original image on which you made predictions.</p>\n<p>I usually slice training images into tiles, resize them on 1/2 of size and then train my model with them. When I'm doing submission I slice testing images on slices and resize them on 1/2 make a model prediction with them so that I get masks out of the tiles, and then stitch them together in the joined image… After that, I resize joined image to the original size to ensure the correct submission evaluation.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1887522,
          "author_name": "atomicalexx",
          "author_url": "",
          "post_date": "08/06/2022 19:10:33",
          "content": "<p>Interesting, thank you so much for your input!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1887527,
          "author_name": "urosjarc",
          "author_url": "",
          "post_date": "08/06/2022 19:19:16",
          "content": "<p>Oh and one more thing that I forgot to tell you! Be careful how you decode end encode the RLE! The RLE in train.csv is COLUMN wise not ROW wise. And you have to make a submission with column-wise encoding. If you will not respect this encoding style you will get a submission error.</p>\n<p>If you have used row-wise encoding you can simply <a href=\"https://numpy.org/doc/stable/reference/generated/numpy.transpose.html\" target=\"_blank\">transpose the mask</a> that you are encoding in submission to get column wise encoding. The same goes with decoding.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1891945,
      "author_name": "thedevastator",
      "author_url": "",
      "post_date": "08/09/2022 18:51:12",
      "content": "<p>In general, you will want to resize your mask to the original size of the image before you encode it to RLE. This is because the RLE encoding is based on pixel values, and if your mask is resized then the encoding will be off.</p>\n<p>The Devastator.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1887502": "Hi guys, This is my first time participating in a detection focused competition and I have a question concerning rle and mask size. Before encoding your mask to rle, is it common practice to resize the mask to the original size that it was before preprocessing?",
    "1887509": "Yes! If you encode mask to RLE you have to ensure that the finished mask is the same size as the original image on which you made predictions.\n\nI usually slice training images into tiles, resize them on 1/2 of size and then train my model with them. When I'm doing submission I slice testing images on slices and resize them on 1/2 make a model prediction with them so that I get masks out of the tiles, and then stitch them together in the joined image... After that, I resize joined image to the original size to ensure the correct submission evaluation.",
    "1887522": "Interesting, thank you so much for your input!",
    "1887527": "Oh and one more thing that I forgot to tell you! Be careful how you decode end encode the RLE! The RLE in train.csv is COLUMN wise not ROW wise. And you have to make a submission with column-wise encoding. If you will not respect this encoding style you will get a submission error.\n\nIf you have used row-wise encoding you can simply [transpose the mask](https://numpy.org/doc/stable/reference/generated/numpy.transpose.html) that you are encoding in submission to get column wise encoding. The same goes with decoding.",
    "1891945": "In general, you will want to resize your mask to the original size of the image before you encode it to RLE. This is because the RLE encoding is based on pixel values, and if your mask is resized then the encoding will be off.\n\nThe Devastator."
  },
  "source": "meta"
}