{
  "id": 197542,
  "title": "RLE to mask converter",
  "url": "/competitions/hubmap-kidney-segmentation/discussion/197542",
  "author_name": "",
  "post_date": "2020-11-17T00:34:55.100870300Z",
  "votes": 23,
  "comment_count": 7,
  "views": 0,
  "content": "<p>Hello Kagglers,</p>\n<p>lets start with converting the images from RLE string.</p>\n<p><strong>Run-length encoding (RLE)</strong> is a form of lossless data compression in which runs of data (sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the original run.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F232304%2F34b5170604cdfcfc6cf5b22c45cd157c%2Frle.jpg?generation=1605573268174582&amp;alt=media\" alt=\"\"></p>\n<p>A sample method of converting the RLE to mask <br>\n<a href=\"https://www.kaggle.com/robertkag/rle-to-mask-converter\" target=\"_blank\">https://www.kaggle.com/robertkag/rle-to-mask-converter</a></p>",
  "messages": [
    {
      "id": "1081280",
      "postDate": "11/17/2020 00:34:55",
      "content": "<p>Hello Kagglers,</p>\n<p>lets start with converting the images from RLE string.</p>\n<p><strong>Run-length encoding (RLE)</strong> is a form of lossless data compression in which runs of data (sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the original run.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F232304%2F34b5170604cdfcfc6cf5b22c45cd157c%2Frle.jpg?generation=1605573268174582&amp;alt=media\" alt=\"\"></p>\n<p>A sample method of converting the RLE to mask <br>\n<a href=\"https://www.kaggle.com/robertkag/rle-to-mask-converter\" target=\"_blank\">https://www.kaggle.com/robertkag/rle-to-mask-converter</a></p>",
      "rawMarkdown": "Hello Kagglers,\n\nlets start with converting the images from RLE string.\n\n**Run-length encoding (RLE)** is a form of lossless data compression in which runs of data (sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the original run.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F232304%2F34b5170604cdfcfc6cf5b22c45cd157c%2Frle.jpg?generation=1605573268174582&alt=media)\n\nA sample method of converting the RLE to mask \nhttps://www.kaggle.com/robertkag/rle-to-mask-converter",
      "votes": null
    },
    {
      "id": "1083386",
      "postDate": "11/18/2020 23:16:50",
      "content": "<p>Thanks for posting. I just tried to encode a huge mask image (35000+, 40000+) with methods used in previous competitions but have a OOM exception! We may need to create a new procedure that is more memory efficient.</p>",
      "rawMarkdown": "Thanks for posting. I just tried to encode a huge mask image (35000+, 40000+) with methods used in previous competitions but have a OOM exception! We may need to create a new procedure that is more memory efficient.",
      "votes": null
    },
    {
      "id": "1083854",
      "postDate": "11/19/2020 13:17:53",
      "content": "<p>I'll reply myself because I was able to fix the OOM by skipping one step on RLE function. It's shared here: <a href=\"https://www.kaggle.com/bguberfain/memory-aware-rle-encoding\" target=\"_blank\">https://www.kaggle.com/bguberfain/memory-aware-rle-encoding</a></p>",
      "rawMarkdown": "I'll reply myself because I was able to fix the OOM by skipping one step on RLE function. It's shared here: https://www.kaggle.com/bguberfain/memory-aware-rle-encoding",
      "votes": null
    },
    {
      "id": "1086758",
      "postDate": "11/22/2020 03:05:29",
      "content": "<p>I've applied the function, and had this target.<br>\nit seems fine, thank you for correct code!</p>",
      "rawMarkdown": "I've applied the function, and had this target.\nit seems fine, thank you for correct code!",
      "votes": null
    },
    {
      "id": "1087000",
      "postDate": "11/22/2020 09:04:43",
      "content": "<p><a href=\"https://www.kaggle.com/subbuvolvosekar\" target=\"_blank\">@subbuvolvosekar</a> Have you made inverse function of this?<br>\n(I mean mask to RLE)</p>",
      "rawMarkdown": "subbuvolvosekar Have you made inverse function of this?\n(I mean mask to RLE)",
      "votes": null
    },
    {
      "id": "1089372",
      "postDate": "11/24/2020 12:56:22",
      "content": "<p>No.. But going to try.. you made a curious question to start :)</p>",
      "rawMarkdown": "No.. But going to try.. you made a curious question to start :)",
      "votes": null
    },
    {
      "id": "1155733",
      "postDate": "01/16/2021 16:14:49",
      "content": "<p>I'm trying the code in <a href=\"https://www.kaggle.com/robertkag/rle-to-mask-converter\" target=\"_blank\">https://www.kaggle.com/robertkag/rle-to-mask-converter</a>, and have a question about the results:</p>\n<p>I start with a very simple 3 x 3 \"mask\"</p>\n<pre><code>[ [ 0, 1, 0 ],\n  [ 1, 0, 1 ],\n  [ 0, 1, 0 ]  ]\n</code></pre>\n<p>I manually encode this into the string <code>1 1 3 1 5 1 8 1</code>.   However, when I pass this to the code, I get </p>\n<pre><code>[[255   0   0]\n [  0 255 255]\n [255   0   0]]\n</code></pre>\n<p>Doesn't seem to agree with the original mask.   Is my manual encoding incorrect, or is the decoder?<br>\nThanks,<br>\n-- Mark</p>",
      "rawMarkdown": "I'm trying the code in https://www.kaggle.com/robertkag/rle-to-mask-converter, and have a question about the results:\n\nI start with a very simple 3 x 3 \"mask\"\n```\n[ [ 0, 1, 0 ],\n  [ 1, 0, 1 ],\n  [ 0, 1, 0 ]  ]\n```\nI manually encode this into the string ```1 1 3 1 5 1 8 1```.   However, when I pass this to the code, I get \n```\n[[255   0   0]\n [  0 255 255]\n [255   0   0]]\n```\nDoesn't seem to agree with the original mask.   Is my manual encoding incorrect, or is the decoder?\nThanks,\n-- Mark",
      "votes": null
    },
    {
      "id": "1288698",
      "postDate": "04/30/2021 09:04:46",
      "content": "<p>Try string '2 1 4 1 6 1 8 1'</p>",
      "rawMarkdown": "Try string '2 1 4 1 6 1 8 1'",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1083386,
      "author_name": "bguberfain",
      "author_url": "",
      "post_date": "11/18/2020 23:16:50",
      "content": "<p>Thanks for posting. I just tried to encode a huge mask image (35000+, 40000+) with methods used in previous competitions but have a OOM exception! We may need to create a new procedure that is more memory efficient.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1083854,
          "author_name": "bguberfain",
          "author_url": "",
          "post_date": "11/19/2020 13:17:53",
          "content": "<p>I'll reply myself because I was able to fix the OOM by skipping one step on RLE function. It's shared here: <a href=\"https://www.kaggle.com/bguberfain/memory-aware-rle-encoding\" target=\"_blank\">https://www.kaggle.com/bguberfain/memory-aware-rle-encoding</a></p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1086758,
      "author_name": "ryunosukeishizaki",
      "author_url": "",
      "post_date": "11/22/2020 03:05:29",
      "content": "<p>I've applied the function, and had this target.<br>\nit seems fine, thank you for correct code!</p>",
      "votes": null,
      "replies": [
        {
          "id": 1087000,
          "author_name": "ryunosukeishizaki",
          "author_url": "",
          "post_date": "11/22/2020 09:04:43",
          "content": "<p><a href=\"https://www.kaggle.com/subbuvolvosekar\" target=\"_blank\">@subbuvolvosekar</a> Have you made inverse function of this?<br>\n(I mean mask to RLE)</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1089372,
          "author_name": "subbuvolvosekar",
          "author_url": "",
          "post_date": "11/24/2020 12:56:22",
          "content": "<p>No.. But going to try.. you made a curious question to start :)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1155733,
      "author_name": "markalavin",
      "author_url": "",
      "post_date": "01/16/2021 16:14:49",
      "content": "<p>I'm trying the code in <a href=\"https://www.kaggle.com/robertkag/rle-to-mask-converter\" target=\"_blank\">https://www.kaggle.com/robertkag/rle-to-mask-converter</a>, and have a question about the results:</p>\n<p>I start with a very simple 3 x 3 \"mask\"</p>\n<pre><code>[ [ 0, 1, 0 ],\n  [ 1, 0, 1 ],\n  [ 0, 1, 0 ]  ]\n</code></pre>\n<p>I manually encode this into the string <code>1 1 3 1 5 1 8 1</code>.   However, when I pass this to the code, I get </p>\n<pre><code>[[255   0   0]\n [  0 255 255]\n [255   0   0]]\n</code></pre>\n<p>Doesn't seem to agree with the original mask.   Is my manual encoding incorrect, or is the decoder?<br>\nThanks,<br>\n-- Mark</p>",
      "votes": null,
      "replies": [
        {
          "id": 1288698,
          "author_name": "mgcyung",
          "author_url": "",
          "post_date": "04/30/2021 09:04:46",
          "content": "<p>Try string '2 1 4 1 6 1 8 1'</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1081280": "Hello Kagglers,\n\nlets start with converting the images from RLE string.\n\n**Run-length encoding (RLE)** is a form of lossless data compression in which runs of data (sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the original run.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F232304%2F34b5170604cdfcfc6cf5b22c45cd157c%2Frle.jpg?generation=1605573268174582&alt=media)\n\nA sample method of converting the RLE to mask \nhttps://www.kaggle.com/robertkag/rle-to-mask-converter",
    "1083386": "Thanks for posting. I just tried to encode a huge mask image (35000+, 40000+) with methods used in previous competitions but have a OOM exception! We may need to create a new procedure that is more memory efficient.",
    "1083854": "I'll reply myself because I was able to fix the OOM by skipping one step on RLE function. It's shared here: https://www.kaggle.com/bguberfain/memory-aware-rle-encoding",
    "1086758": "I've applied the function, and had this target.\nit seems fine, thank you for correct code!",
    "1087000": "subbuvolvosekar Have you made inverse function of this?\n(I mean mask to RLE)",
    "1089372": "No.. But going to try.. you made a curious question to start :)",
    "1155733": "I'm trying the code in https://www.kaggle.com/robertkag/rle-to-mask-converter, and have a question about the results:\n\nI start with a very simple 3 x 3 \"mask\"\n```\n[ [ 0, 1, 0 ],\n  [ 1, 0, 1 ],\n  [ 0, 1, 0 ]  ]\n```\nI manually encode this into the string ```1 1 3 1 5 1 8 1```.   However, when I pass this to the code, I get \n```\n[[255   0   0]\n [  0 255 255]\n [255   0   0]]\n```\nDoesn't seem to agree with the original mask.   Is my manual encoding incorrect, or is the decoder?\nThanks,\n-- Mark",
    "1288698": "Try string '2 1 4 1 6 1 8 1'"
  },
  "source": "meta"
}