{
  "id": 68229,
  "title": "submission error",
  "url": "/competitions/airbus-ship-detection/discussion/68229",
  "author_name": "",
  "post_date": "2018-10-10T15:32:05.636811600Z",
  "votes": null,
  "comment_count": 11,
  "views": 0,
  "content": "<p>7 Exceptions:\nThe same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>Anyone know why there is above errors? and may I know how do I locate the 7 RLE?</p>",
  "messages": [
    {
      "id": "401724",
      "postDate": "10/10/2018 15:32:05",
      "content": "<p>7 Exceptions:\nThe same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>The same pixel may not be assigned to two different objects.</p>\n\n<p>Anyone know why there is above errors? and may I know how do I locate the 7 RLE?</p>",
      "rawMarkdown": "7 Exceptions:\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nAnyone know why there is above errors? and may I know how do I locate the 7 RLE?",
      "votes": null
    },
    {
      "id": "401768",
      "postDate": "10/10/2018 17:22:13",
      "content": "<p>You just need to go through your masks, check if there is any overlap between masks in one image, and remove overlapping pixels. </p>",
      "rawMarkdown": "You just need to go through your masks, check if there is any overlap between masks in one image, and remove overlapping pixels.",
      "votes": null
    },
    {
      "id": "402010",
      "postDate": "10/11/2018 03:23:05",
      "content": "<p>Thanks, will do that. Saw your posts, learned a lot!!!</p>",
      "rawMarkdown": "Thanks, will do that. Saw your posts, learned a lot!!!",
      "votes": null
    },
    {
      "id": "402082",
      "postDate": "10/11/2018 06:55:47",
      "content": "<p>You are welcome</p>",
      "rawMarkdown": "You are welcome",
      "votes": null
    },
    {
      "id": "404128",
      "postDate": "10/15/2018 09:38:12",
      "content": "<p>Hi, did you solve your problem? how did you locate the overlapping pixels?</p>",
      "rawMarkdown": "Hi, did you solve your problem? how did you locate the overlapping pixels?",
      "votes": null
    },
    {
      "id": "404696",
      "postDate": "10/16/2018 08:23:00",
      "content": "<p>I am trying the manual way, plot all the detected bounding boxes for each detected image with opacity and overlap them to see if there are any overlapping. Hope to know a better way though.</p>",
      "rawMarkdown": "I am trying the manual way, plot all the detected bounding boxes for each detected image with opacity and overlap them to see if there are any overlapping. Hope to know a better way though.",
      "votes": null
    },
    {
      "id": "404912",
      "postDate": "10/16/2018 14:55:25",
      "content": "<p>If you are interested in, I can post a kernel that does this stuff. I also had an issue with overlapping pixels.</p>",
      "rawMarkdown": "If you are interested in, I can post a kernel that does this stuff. I also had an issue with overlapping pixels.",
      "votes": null
    },
    {
      "id": "405163",
      "postDate": "10/17/2018 01:46:04",
      "content": "<p>I created a corresponding kernel <a href=\"https://www.kaggle.com/iafoss/remove-overlap\">https://www.kaggle.com/iafoss/remove-overlap</a>. Let me know if it works for you, I ran it before only on my local computer.</p>",
      "rawMarkdown": "I created a corresponding kernel https://www.kaggle.com/iafoss/remove-overlap. Let me know if it works for you, I ran it before only on my local computer.",
      "votes": null
    },
    {
      "id": "405737",
      "postDate": "10/18/2018 03:21:31",
      "content": "<p>Thanks lafoss. I will give it a try. </p>\n\n<p>I am thinking since I have ground truth binary before encoding, should I flatten the numpy array to check intersect? Would it be faster?</p>\n\n<p>By the way,  when I use the following encoding, then mask seems like rotated. Any idea?</p>\n\n<pre><code># ref.: https://www.kaggle.com/stainsby/fast-tested-rle\ndef rle_encode(img):\n    '''\n    img: numpy array, 1 - mask, 0 - background\n    Returns run length as string formated\n    '''\n    pixels = img.flatten()\n    pixels = np.concatenate([[0], pixels, [0]])\n    runs = np.where(pixels[1:] != pixels[:-1])[0] + 1\n    runs[1::2] -= runs[::2]\n    return ' '.join(str(x) for x in runs)\n</code></pre>",
      "rawMarkdown": "Thanks lafoss. I will give it a try. \n\nI am thinking since I have ground truth binary before encoding, should I flatten the numpy array to check intersect? Would it be faster?\n\nBy the way,  when I use the following encoding, then mask seems like rotated. Any idea?\n\n    # ref.: https://www.kaggle.com/stainsby/fast-tested-rle\n    def rle_encode(img):\n        '''\n        img: numpy array, 1 - mask, 0 - background\n        Returns run length as string formated\n        '''\n        pixels = img.flatten()\n        pixels = np.concatenate([[0], pixels, [0]])\n        runs = np.where(pixels[1:] != pixels[:-1])[0] + 1\n        runs[1::2] -= runs[::2]\n        return ' '.join(str(x) for x in runs)",
      "votes": null
    },
    {
      "id": "405757",
      "postDate": "10/18/2018 04:10:49",
      "content": "<p>I think you should transpose your array before flattening it, in this case your mask will be not rotated. Check my kernel. </p>\n\n<p>Running the overlap check takes just ~1-2 min and you can apply it to the model output without any modification of the code you have. But you can do the check inside your code as well based on 2d mask before rle encoding.</p>",
      "rawMarkdown": "I think you should transpose your array before flattening it, in this case your mask will be not rotated. Check my kernel. \n\nRunning the overlap check takes just ~1-2 min and you can apply it to the model output without any modification of the code you have. But you can do the check inside your code as well based on 2d mask before rle encoding.",
      "votes": null
    },
    {
      "id": "405806",
      "postDate": "10/18/2018 06:16:21",
      "content": "<p>Do you meant like the following?</p>\n\n<pre><code>img = np.transpose(img)\npixels = img.flatten()\n</code></pre>",
      "rawMarkdown": "Do you meant like the following?\n\n    img = np.transpose(img)\n    pixels = img.flatten()",
      "votes": null
    },
    {
      "id": "406047",
      "postDate": "10/18/2018 15:00:15",
      "content": "<p>Yes: pixels = mask.T.flatten()</p>",
      "rawMarkdown": "Yes: pixels = mask.T.flatten()",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 401768,
      "author_name": "iafoss",
      "author_url": "",
      "post_date": "10/10/2018 17:22:13",
      "content": "<p>You just need to go through your masks, check if there is any overlap between masks in one image, and remove overlapping pixels. </p>",
      "votes": null,
      "replies": [
        {
          "id": 402010,
          "author_name": "kimhoe",
          "author_url": "",
          "post_date": "10/11/2018 03:23:05",
          "content": "<p>Thanks, will do that. Saw your posts, learned a lot!!!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 402082,
          "author_name": "iafoss",
          "author_url": "",
          "post_date": "10/11/2018 06:55:47",
          "content": "<p>You are welcome</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 404128,
          "author_name": "jenkins1tutu",
          "author_url": "",
          "post_date": "10/15/2018 09:38:12",
          "content": "<p>Hi, did you solve your problem? how did you locate the overlapping pixels?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 404696,
          "author_name": "kimhoe",
          "author_url": "",
          "post_date": "10/16/2018 08:23:00",
          "content": "<p>I am trying the manual way, plot all the detected bounding boxes for each detected image with opacity and overlap them to see if there are any overlapping. Hope to know a better way though.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 404912,
          "author_name": "iafoss",
          "author_url": "",
          "post_date": "10/16/2018 14:55:25",
          "content": "<p>If you are interested in, I can post a kernel that does this stuff. I also had an issue with overlapping pixels.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 405163,
          "author_name": "iafoss",
          "author_url": "",
          "post_date": "10/17/2018 01:46:04",
          "content": "<p>I created a corresponding kernel <a href=\"https://www.kaggle.com/iafoss/remove-overlap\">https://www.kaggle.com/iafoss/remove-overlap</a>. Let me know if it works for you, I ran it before only on my local computer.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 405737,
          "author_name": "kimhoe",
          "author_url": "",
          "post_date": "10/18/2018 03:21:31",
          "content": "<p>Thanks lafoss. I will give it a try. </p>\n\n<p>I am thinking since I have ground truth binary before encoding, should I flatten the numpy array to check intersect? Would it be faster?</p>\n\n<p>By the way,  when I use the following encoding, then mask seems like rotated. Any idea?</p>\n\n<pre><code># ref.: https://www.kaggle.com/stainsby/fast-tested-rle\ndef rle_encode(img):\n    '''\n    img: numpy array, 1 - mask, 0 - background\n    Returns run length as string formated\n    '''\n    pixels = img.flatten()\n    pixels = np.concatenate([[0], pixels, [0]])\n    runs = np.where(pixels[1:] != pixels[:-1])[0] + 1\n    runs[1::2] -= runs[::2]\n    return ' '.join(str(x) for x in runs)\n</code></pre>",
          "votes": null,
          "replies": []
        },
        {
          "id": 405757,
          "author_name": "iafoss",
          "author_url": "",
          "post_date": "10/18/2018 04:10:49",
          "content": "<p>I think you should transpose your array before flattening it, in this case your mask will be not rotated. Check my kernel. </p>\n\n<p>Running the overlap check takes just ~1-2 min and you can apply it to the model output without any modification of the code you have. But you can do the check inside your code as well based on 2d mask before rle encoding.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 405806,
          "author_name": "kimhoe",
          "author_url": "",
          "post_date": "10/18/2018 06:16:21",
          "content": "<p>Do you meant like the following?</p>\n\n<pre><code>img = np.transpose(img)\npixels = img.flatten()\n</code></pre>",
          "votes": null,
          "replies": []
        },
        {
          "id": 406047,
          "author_name": "iafoss",
          "author_url": "",
          "post_date": "10/18/2018 15:00:15",
          "content": "<p>Yes: pixels = mask.T.flatten()</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "401724": "7 Exceptions:\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nThe same pixel may not be assigned to two different objects.\n\nAnyone know why there is above errors? and may I know how do I locate the 7 RLE?",
    "401768": "You just need to go through your masks, check if there is any overlap between masks in one image, and remove overlapping pixels.",
    "402010": "Thanks, will do that. Saw your posts, learned a lot!!!",
    "402082": "You are welcome",
    "404128": "Hi, did you solve your problem? how did you locate the overlapping pixels?",
    "404696": "I am trying the manual way, plot all the detected bounding boxes for each detected image with opacity and overlap them to see if there are any overlapping. Hope to know a better way though.",
    "404912": "If you are interested in, I can post a kernel that does this stuff. I also had an issue with overlapping pixels.",
    "405163": "I created a corresponding kernel https://www.kaggle.com/iafoss/remove-overlap. Let me know if it works for you, I ran it before only on my local computer.",
    "405737": "Thanks lafoss. I will give it a try. \n\nI am thinking since I have ground truth binary before encoding, should I flatten the numpy array to check intersect? Would it be faster?\n\nBy the way,  when I use the following encoding, then mask seems like rotated. Any idea?\n\n    # ref.: https://www.kaggle.com/stainsby/fast-tested-rle\n    def rle_encode(img):\n        '''\n        img: numpy array, 1 - mask, 0 - background\n        Returns run length as string formated\n        '''\n        pixels = img.flatten()\n        pixels = np.concatenate([[0], pixels, [0]])\n        runs = np.where(pixels[1:] != pixels[:-1])[0] + 1\n        runs[1::2] -= runs[::2]\n        return ' '.join(str(x) for x in runs)",
    "405757": "I think you should transpose your array before flattening it, in this case your mask will be not rotated. Check my kernel. \n\nRunning the overlap check takes just ~1-2 min and you can apply it to the model output without any modification of the code you have. But you can do the check inside your code as well based on 2d mask before rle encoding.",
    "405806": "Do you meant like the following?\n\n    img = np.transpose(img)\n    pixels = img.flatten()",
    "406047": "Yes: pixels = mask.T.flatten()"
  },
  "source": "meta"
}