{
  "id": 279488,
  "title": "broken mask repro, should be an easy fix",
  "url": "/competitions/sartorius-cell-instance-segmentation/discussion/279488",
  "author_name": "",
  "post_date": "2021-10-18T12:49:02.681759100Z",
  "votes": 54,
  "comment_count": 21,
  "views": 0,
  "content": "<p>Here is code chunk to reproduce something that looks as same mask as in competition dataset.<br>\nCode has some errors, which leads to incorrect <em>broken</em> mask interpretation.<br>\n<a href=\"https://www.kaggle.com/bakeryproducts/broken-mask-repro\" target=\"_blank\">code</a><br>\n<img src=\"https://i.imgur.com/6pyWAGO.png\" alt=\"i\"><br>\n<img src=\"https://i.imgur.com/0pEsn9v.png\" alt=\"mask\"></p>\n<h2>Fixed</h2>\n<p><img src=\"https://i.imgur.com/t5WVsS7.png\" alt=\"f\"></p>\n<p>Discussion with original image source : <a href=\"https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/278801\" target=\"_blank\">https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/278801</a></p>",
  "messages": [
    {
      "id": "1548686",
      "postDate": "10/18/2021 12:49:02",
      "content": "<p>Here is code chunk to reproduce something that looks as same mask as in competition dataset.<br>\nCode has some errors, which leads to incorrect <em>broken</em> mask interpretation.<br>\n<a href=\"https://www.kaggle.com/bakeryproducts/broken-mask-repro\" target=\"_blank\">code</a><br>\n<img src=\"https://i.imgur.com/6pyWAGO.png\" alt=\"i\"><br>\n<img src=\"https://i.imgur.com/0pEsn9v.png\" alt=\"mask\"></p>\n<h2>Fixed</h2>\n<p><img src=\"https://i.imgur.com/t5WVsS7.png\" alt=\"f\"></p>\n<p>Discussion with original image source : <a href=\"https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/278801\" target=\"_blank\">https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/278801</a></p>",
      "rawMarkdown": "Here is code chunk to reproduce something that looks as same mask as in competition dataset.\nCode has some errors, which leads to incorrect *broken* mask interpretation.\n[code](https://www.kaggle.com/bakeryproducts/broken-mask-repro)\n![i](https://i.imgur.com/6pyWAGO.png)\n![mask](https://i.imgur.com/0pEsn9v.png)\n\n## Fixed\n![f](https://i.imgur.com/t5WVsS7.png)\n\nDiscussion with original image source : https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/278801",
      "votes": null
    },
    {
      "id": "1549118",
      "postDate": "10/18/2021 19:58:13",
      "content": "<p>Thanks for sharing!</p>",
      "rawMarkdown": "Thanks for sharing!",
      "votes": null
    },
    {
      "id": "1550160",
      "postDate": "10/19/2021 13:39:48",
      "content": "<p><a href=\"https://www.kaggle.com/bakeryproducts\" target=\"_blank\">@bakeryproducts</a> </p>\n<p>Do you think we'd be able to fix this ourselves?</p>\n<p>Or do the competition hosts need to take action?</p>",
      "rawMarkdown": "bakeryproducts \n\nDo you think we'd be able to fix this ourselves?\n\nOr do the competition hosts need to take action?",
      "votes": null
    },
    {
      "id": "1550251",
      "postDate": "10/19/2021 14:57:06",
      "content": "<p><a href=\"https://www.kaggle.com/dschettler8845\" target=\"_blank\">@dschettler8845</a> No, we cant fix this ourselves, as it requires original polygon annotation. With wrong mask from filled polygon we lose some information. I label this particular polygon (screenshot from another discussion) by hand.</p>\n<p>If my guess about annotation errors is correct, only host can fix this. And that fix is trivial.</p>\n<p>TLDR: In my opinion host should come and admit errors on their side or somehow approve correctness of partially filled masks. Summoning <a href=\"https://www.kaggle.com/christoffersartorius\" target=\"_blank\">@christoffersartorius</a> </p>",
      "rawMarkdown": "dschettler8845 No, we cant fix this ourselves, as it requires original polygon annotation. With wrong mask from filled polygon we lose some information. I label this particular polygon (screenshot from another discussion) by hand.\n\nIf my guess about annotation errors is correct, only host can fix this. And that fix is trivial.\n\nTLDR: In my opinion host should come and admit errors on their side or somehow approve correctness of partially filled masks. Summoning @christoffersartorius",
      "votes": null
    },
    {
      "id": "1550372",
      "postDate": "10/19/2021 16:45:31",
      "content": "<p>My result looks good to me.</p>\n<p>Not fixed</p>\n<p><img src=\"https://i.ibb.co/bmF17yx/not-filled.png\" alt=\"not fixed\"></p>\n<p>Fixed</p>\n<p><img src=\"https://i.ibb.co/dj7xyHs/correctly-filled.png\" alt=\"fixed\"></p>",
      "rawMarkdown": "My result looks good to me.\n\nNot fixed\n\n![not fixed](https://i.ibb.co/bmF17yx/not-filled.png)\n\nFixed\n\n![fixed](https://i.ibb.co/dj7xyHs/correctly-filled.png)",
      "votes": null
    },
    {
      "id": "1550445",
      "postDate": "10/19/2021 18:22:32",
      "content": "<p><a href=\"https://www.kaggle.com/gunesevitan\" target=\"_blank\">@gunesevitan</a> Surely one can fill \"holes\" in masks (looks like you did that). It does not help in any way, as 1) we have test data with the same problem, and 2) masks are broken not only on \"inside\" but on the \"outside\" too. You cannot reverse that convex polygon fill. Of course I can be all wrong about this, so i'll wait for host to response.</p>",
      "rawMarkdown": "gunesevitan Surely one can fill \"holes\" in masks (looks like you did that). It does not help in any way, as 1) we have test data with the same problem, and 2) masks are broken not only on \"inside\" but on the \"outside\" too. You cannot reverse that convex polygon fill. Of course I can be all wrong about this, so i'll wait for host to response.",
      "votes": null
    },
    {
      "id": "1557291",
      "postDate": "10/25/2021 15:07:00",
      "content": "<p>May I ask are there any updates from the host yet?</p>",
      "rawMarkdown": "May I ask are there any updates from the host yet?",
      "votes": null
    },
    {
      "id": "1559007",
      "postDate": "10/26/2021 16:25:00",
      "content": "<p>I have met the similar problems during another competition. The reason is that they tried to use cv2 to fill the convex through the original polygon, then convered the filled mask into RLE annotation. From my point of view, it can not be fixed unless there is a better function other than cv2.fillconvexpoly or just give us the mask annotation.</p>",
      "rawMarkdown": "I have met the similar problems during another competition. The reason is that they tried to use cv2 to fill the convex through the original polygon, then convered the filled mask into RLE annotation. From my point of view, it can not be fixed unless there is a better function other than cv2.fillconvexpoly or just give us the mask annotation.",
      "votes": null
    },
    {
      "id": "1577148",
      "postDate": "11/09/2021 20:04:37",
      "content": "<p>One more uncertainty… I'm so not sure about investing time to this competition because of the uncertainties.</p>",
      "rawMarkdown": "One more uncertainty... I'm so not sure about investing time to this competition because of the uncertainties.",
      "votes": null
    },
    {
      "id": "1577263",
      "postDate": "11/09/2021 23:38:38",
      "content": "<p>\" just give us the mask annotation….\"</p>\n<p>we need the original polygon!!!!</p>",
      "rawMarkdown": "\" just give us the mask annotation....\"\n\nwe need the original polygon!!!!",
      "votes": null
    },
    {
      "id": "1577265",
      "postDate": "11/09/2021 23:40:33",
      "content": "<p>639 teams  …. if one team fix the image by hand (using GIMP), we can finish in one day</p>",
      "rawMarkdown": "639 teams  .... if one team fix the image by hand (using GIMP), we can finish in one day",
      "votes": null
    },
    {
      "id": "1578450",
      "postDate": "11/11/2021 04:01:36",
      "content": "<p>a simple solution?<br>\nin e.g. mas rcnn training, we still use these wrong samples as ground truth in box detection. we exclude them in mask loss at backpropagation.</p>\n<p>if required, we use the pseudo label to relabel these wrong samples later using the trained model</p>",
      "rawMarkdown": "a simple solution?\nin e.g. mas rcnn training, we still use these wrong samples as ground truth in box detection. we exclude them in mask loss at backpropagation.\n\nif required, we use the pseudo label to relabel these wrong samples later using the trained model",
      "votes": null
    },
    {
      "id": "1578717",
      "postDate": "11/11/2021 09:34:51",
      "content": "<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> That's one approach, but in my opinion all samples are wrong. Samples that happened to be convex polygons are good samples, but we dont know which ones was convex. The ones with holes are definitely wrong, but there is no guarantee that all solid ones are all good.  </p>",
      "rawMarkdown": "hengck23 That's one approach, but in my opinion all samples are wrong. Samples that happened to be convex polygons are good samples, but we dont know which ones was convex. The ones with holes are definitely wrong, but there is no guarantee that all solid ones are all good.",
      "votes": null
    },
    {
      "id": "1582727",
      "postDate": "11/15/2021 07:55:10",
      "content": "<p><a href=\"https://www.kaggle.com/bakeryproducts\" target=\"_blank\">@bakeryproducts</a>  Can you open your fixed code?<br>\nI can fill holes,but fixed outside masks seems not good.</p>",
      "rawMarkdown": "bakeryproducts  Can you open your fixed code?\nI can fill holes,but fixed outside masks seems not good.",
      "votes": null
    },
    {
      "id": "1582878",
      "postDate": "11/15/2021 11:17:53",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/bakeryproducts\" target=\"_blank\">@bakeryproducts</a> I'm not able to access <a href=\"https://www.kaggle.com/bakeryproducts/broken-mask-repro\" target=\"_blank\">https://www.kaggle.com/bakeryproducts/broken-mask-repro</a> could you please reshare it?<br>\nThanks!</p>",
      "rawMarkdown": "Hi @bakeryproducts I'm not able to access https://www.kaggle.com/bakeryproducts/broken-mask-repro could you please reshare it?\nThanks!",
      "votes": null
    },
    {
      "id": "1584649",
      "postDate": "11/16/2021 16:51:43",
      "content": "<p>you can detect quite a number of them by the bottom horizontal line</p>",
      "rawMarkdown": "you can detect quite a number of them by the bottom horizontal line",
      "votes": null
    },
    {
      "id": "1585121",
      "postDate": "11/17/2021 05:21:46",
      "content": "<p>this is my attempt<br>\n<a href=\"https://ibb.co/W6mN2Mr\"><img src=\"https://i.ibb.co/L8VDZcT/Selection-999-427.png\" alt=\"Selection-999-427\"></a><br>\n<a href=\"https://ibb.co/Q8K04Rf\"><img src=\"https://i.ibb.co/7405DbT/Selection-999-440.png\" alt=\"Selection-999-428\"></a></p>",
      "rawMarkdown": "this is my attempt\n<a href=\"https://ibb.co/W6mN2Mr\"><img src=\"https://i.ibb.co/L8VDZcT/Selection-999-427.png\" alt=\"Selection-999-427\" border=\"0\"></a>\n<a href=\"https://ibb.co/Q8K04Rf\"><img src=\"https://i.ibb.co/7405DbT/Selection-999-440.png\" alt=\"Selection-999-428\" border=\"0\"></a>",
      "votes": null
    },
    {
      "id": "1585136",
      "postDate": "11/17/2021 05:41:06",
      "content": "<p>The problem is that these kinds of broken masks may happen in test dataset.</p>",
      "rawMarkdown": "The problem is that these kinds of broken masks may happen in test dataset.",
      "votes": null
    },
    {
      "id": "1585140",
      "postDate": "11/17/2021 05:48:00",
      "content": "<p>the broken mask is affecting my training (e.g. to determine the seeds for watershed).<br>\ni will still have to predict the \"wrong\" mask finally.</p>",
      "rawMarkdown": "the broken mask is affecting my training (e.g. to determine the seeds for watershed).\ni will still have to predict the \"wrong\" mask finally.",
      "votes": null
    },
    {
      "id": "1585479",
      "postDate": "11/17/2021 09:24:48",
      "content": "<p>As a simple improvement I can suggest subtract intersection(gray, white) from white mask</p>",
      "rawMarkdown": "As a simple improvement I can suggest subtract intersection(gray, white) from white mask",
      "votes": null
    },
    {
      "id": "1585482",
      "postDate": "11/17/2021 09:27:33",
      "content": "<p><a href=\"https://www.kaggle.com/slawekbiel\" target=\"_blank\">@slawekbiel</a> <a href=\"https://www.kaggle.com/chihantsai\" target=\"_blank\">@chihantsai</a>  I deleted it to avoid probable future misleading. It was one liner for cv fillPoly vs fillconvexpoly. It is not helpful without polygon annotation on hand</p>",
      "rawMarkdown": "slawekbiel @chihantsai  I deleted it to avoid probable future misleading. It was one liner for cv fillPoly vs fillconvexpoly. It is not helpful without polygon annotation on hand",
      "votes": null
    },
    {
      "id": "1585626",
      "postDate": "11/17/2021 11:47:51",
      "content": "<p>actually, the convex polygon is not the main problems.</p>\n<p><a href=\"https://ibb.co/Q8PDDk1\"><img src=\"https://i.ibb.co/cb6YYw7/Selection-999-436.pngg\" alt=\"Selection-999-436\"></a></p>\n<p>the astro images have poor performance due to the inconsistent annotation. in my experiments, you have good performance if you \"always annotate\" or \"always not annotate\". But inconsistency causes confusion.</p>\n<p>a good example is: 6f90a53cf326</p>\n<p>a simple way to normalise the image for visualisation</p>\n<pre><code>            image = image.astype(np.float32)/255\n            x = torch.from_numpy(image).unsqueeze(0).unsqueeze(0)\n            x = x.repeat(1,3,1,1)\n            x = (F.tanh((x-0.5)*16)+1)/2\n</code></pre>",
      "rawMarkdown": "actually, the convex polygon is not the main problems.\n\n<a href=\"https://ibb.co/Q8PDDk1\"><img src=\"https://i.ibb.co/cb6YYw7/Selection-999-436.pngg\" alt=\"Selection-999-436\" border=\"0\"></a>\n\nthe astro images have poor performance due to the inconsistent annotation. in my experiments, you have good performance if you \"always annotate\" or \"always not annotate\". But inconsistency causes confusion.\n\n\na good example is: 6f90a53cf326\n\na simple way to normalise the image for visualisation\n```\n            image = image.astype(np.float32)/255\n            x = torch.from_numpy(image).unsqueeze(0).unsqueeze(0)\n            x = x.repeat(1,3,1,1)\n            x = (F.tanh((x-0.5)*16)+1)/2\n\n```",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1549118,
      "author_name": "amritpal333",
      "author_url": "",
      "post_date": "10/18/2021 19:58:13",
      "content": "<p>Thanks for sharing!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1550160,
      "author_name": "dschettler8845",
      "author_url": "",
      "post_date": "10/19/2021 13:39:48",
      "content": "<p><a href=\"https://www.kaggle.com/bakeryproducts\" target=\"_blank\">@bakeryproducts</a> </p>\n<p>Do you think we'd be able to fix this ourselves?</p>\n<p>Or do the competition hosts need to take action?</p>",
      "votes": null,
      "replies": [
        {
          "id": 1550251,
          "author_name": "bakeryproducts",
          "author_url": "",
          "post_date": "10/19/2021 14:57:06",
          "content": "<p><a href=\"https://www.kaggle.com/dschettler8845\" target=\"_blank\">@dschettler8845</a> No, we cant fix this ourselves, as it requires original polygon annotation. With wrong mask from filled polygon we lose some information. I label this particular polygon (screenshot from another discussion) by hand.</p>\n<p>If my guess about annotation errors is correct, only host can fix this. And that fix is trivial.</p>\n<p>TLDR: In my opinion host should come and admit errors on their side or somehow approve correctness of partially filled masks. Summoning <a href=\"https://www.kaggle.com/christoffersartorius\" target=\"_blank\">@christoffersartorius</a> </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1550372,
          "author_name": "gunesevitan",
          "author_url": "",
          "post_date": "10/19/2021 16:45:31",
          "content": "<p>My result looks good to me.</p>\n<p>Not fixed</p>\n<p><img src=\"https://i.ibb.co/bmF17yx/not-filled.png\" alt=\"not fixed\"></p>\n<p>Fixed</p>\n<p><img src=\"https://i.ibb.co/dj7xyHs/correctly-filled.png\" alt=\"fixed\"></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1550445,
          "author_name": "bakeryproducts",
          "author_url": "",
          "post_date": "10/19/2021 18:22:32",
          "content": "<p><a href=\"https://www.kaggle.com/gunesevitan\" target=\"_blank\">@gunesevitan</a> Surely one can fill \"holes\" in masks (looks like you did that). It does not help in any way, as 1) we have test data with the same problem, and 2) masks are broken not only on \"inside\" but on the \"outside\" too. You cannot reverse that convex polygon fill. Of course I can be all wrong about this, so i'll wait for host to response.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1557291,
          "author_name": "solosquad1999",
          "author_url": "",
          "post_date": "10/25/2021 15:07:00",
          "content": "<p>May I ask are there any updates from the host yet?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1577148,
          "author_name": "tolgadincer",
          "author_url": "",
          "post_date": "11/09/2021 20:04:37",
          "content": "<p>One more uncertainty… I'm so not sure about investing time to this competition because of the uncertainties.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1559007,
      "author_name": "canzhang1997",
      "author_url": "",
      "post_date": "10/26/2021 16:25:00",
      "content": "<p>I have met the similar problems during another competition. The reason is that they tried to use cv2 to fill the convex through the original polygon, then convered the filled mask into RLE annotation. From my point of view, it can not be fixed unless there is a better function other than cv2.fillconvexpoly or just give us the mask annotation.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1577263,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "11/09/2021 23:38:38",
          "content": "<p>\" just give us the mask annotation….\"</p>\n<p>we need the original polygon!!!!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1577265,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "11/09/2021 23:40:33",
      "content": "<p>639 teams  …. if one team fix the image by hand (using GIMP), we can finish in one day</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1578450,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "11/11/2021 04:01:36",
      "content": "<p>a simple solution?<br>\nin e.g. mas rcnn training, we still use these wrong samples as ground truth in box detection. we exclude them in mask loss at backpropagation.</p>\n<p>if required, we use the pseudo label to relabel these wrong samples later using the trained model</p>",
      "votes": null,
      "replies": [
        {
          "id": 1578717,
          "author_name": "bakeryproducts",
          "author_url": "",
          "post_date": "11/11/2021 09:34:51",
          "content": "<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> That's one approach, but in my opinion all samples are wrong. Samples that happened to be convex polygons are good samples, but we dont know which ones was convex. The ones with holes are definitely wrong, but there is no guarantee that all solid ones are all good.  </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1582727,
      "author_name": "chihantsai",
      "author_url": "",
      "post_date": "11/15/2021 07:55:10",
      "content": "<p><a href=\"https://www.kaggle.com/bakeryproducts\" target=\"_blank\">@bakeryproducts</a>  Can you open your fixed code?<br>\nI can fill holes,but fixed outside masks seems not good.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1582878,
      "author_name": "slawekbiel",
      "author_url": "",
      "post_date": "11/15/2021 11:17:53",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/bakeryproducts\" target=\"_blank\">@bakeryproducts</a> I'm not able to access <a href=\"https://www.kaggle.com/bakeryproducts/broken-mask-repro\" target=\"_blank\">https://www.kaggle.com/bakeryproducts/broken-mask-repro</a> could you please reshare it?<br>\nThanks!</p>",
      "votes": null,
      "replies": [
        {
          "id": 1585482,
          "author_name": "bakeryproducts",
          "author_url": "",
          "post_date": "11/17/2021 09:27:33",
          "content": "<p><a href=\"https://www.kaggle.com/slawekbiel\" target=\"_blank\">@slawekbiel</a> <a href=\"https://www.kaggle.com/chihantsai\" target=\"_blank\">@chihantsai</a>  I deleted it to avoid probable future misleading. It was one liner for cv fillPoly vs fillconvexpoly. It is not helpful without polygon annotation on hand</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1584649,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "11/16/2021 16:51:43",
      "content": "<p>you can detect quite a number of them by the bottom horizontal line</p>",
      "votes": null,
      "replies": [
        {
          "id": 1585121,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "11/17/2021 05:21:46",
          "content": "<p>this is my attempt<br>\n<a href=\"https://ibb.co/W6mN2Mr\"><img src=\"https://i.ibb.co/L8VDZcT/Selection-999-427.png\" alt=\"Selection-999-427\"></a><br>\n<a href=\"https://ibb.co/Q8K04Rf\"><img src=\"https://i.ibb.co/7405DbT/Selection-999-440.png\" alt=\"Selection-999-428\"></a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1585479,
          "author_name": "bakeryproducts",
          "author_url": "",
          "post_date": "11/17/2021 09:24:48",
          "content": "<p>As a simple improvement I can suggest subtract intersection(gray, white) from white mask</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1585626,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "11/17/2021 11:47:51",
          "content": "<p>actually, the convex polygon is not the main problems.</p>\n<p><a href=\"https://ibb.co/Q8PDDk1\"><img src=\"https://i.ibb.co/cb6YYw7/Selection-999-436.pngg\" alt=\"Selection-999-436\"></a></p>\n<p>the astro images have poor performance due to the inconsistent annotation. in my experiments, you have good performance if you \"always annotate\" or \"always not annotate\". But inconsistency causes confusion.</p>\n<p>a good example is: 6f90a53cf326</p>\n<p>a simple way to normalise the image for visualisation</p>\n<pre><code>            image = image.astype(np.float32)/255\n            x = torch.from_numpy(image).unsqueeze(0).unsqueeze(0)\n            x = x.repeat(1,3,1,1)\n            x = (F.tanh((x-0.5)*16)+1)/2\n</code></pre>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1585136,
      "author_name": "drtausamaru",
      "author_url": "",
      "post_date": "11/17/2021 05:41:06",
      "content": "<p>The problem is that these kinds of broken masks may happen in test dataset.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1585140,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "11/17/2021 05:48:00",
          "content": "<p>the broken mask is affecting my training (e.g. to determine the seeds for watershed).<br>\ni will still have to predict the \"wrong\" mask finally.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1548686": "Here is code chunk to reproduce something that looks as same mask as in competition dataset.\nCode has some errors, which leads to incorrect *broken* mask interpretation.\n[code](https://www.kaggle.com/bakeryproducts/broken-mask-repro)\n![i](https://i.imgur.com/6pyWAGO.png)\n![mask](https://i.imgur.com/0pEsn9v.png)\n\n## Fixed\n![f](https://i.imgur.com/t5WVsS7.png)\n\nDiscussion with original image source : https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/278801",
    "1549118": "Thanks for sharing!",
    "1550160": "bakeryproducts \n\nDo you think we'd be able to fix this ourselves?\n\nOr do the competition hosts need to take action?",
    "1550251": "dschettler8845 No, we cant fix this ourselves, as it requires original polygon annotation. With wrong mask from filled polygon we lose some information. I label this particular polygon (screenshot from another discussion) by hand.\n\nIf my guess about annotation errors is correct, only host can fix this. And that fix is trivial.\n\nTLDR: In my opinion host should come and admit errors on their side or somehow approve correctness of partially filled masks. Summoning @christoffersartorius",
    "1550372": "My result looks good to me.\n\nNot fixed\n\n![not fixed](https://i.ibb.co/bmF17yx/not-filled.png)\n\nFixed\n\n![fixed](https://i.ibb.co/dj7xyHs/correctly-filled.png)",
    "1550445": "gunesevitan Surely one can fill \"holes\" in masks (looks like you did that). It does not help in any way, as 1) we have test data with the same problem, and 2) masks are broken not only on \"inside\" but on the \"outside\" too. You cannot reverse that convex polygon fill. Of course I can be all wrong about this, so i'll wait for host to response.",
    "1557291": "May I ask are there any updates from the host yet?",
    "1559007": "I have met the similar problems during another competition. The reason is that they tried to use cv2 to fill the convex through the original polygon, then convered the filled mask into RLE annotation. From my point of view, it can not be fixed unless there is a better function other than cv2.fillconvexpoly or just give us the mask annotation.",
    "1577148": "One more uncertainty... I'm so not sure about investing time to this competition because of the uncertainties.",
    "1577263": "\" just give us the mask annotation....\"\n\nwe need the original polygon!!!!",
    "1577265": "639 teams  .... if one team fix the image by hand (using GIMP), we can finish in one day",
    "1578450": "a simple solution?\nin e.g. mas rcnn training, we still use these wrong samples as ground truth in box detection. we exclude them in mask loss at backpropagation.\n\nif required, we use the pseudo label to relabel these wrong samples later using the trained model",
    "1578717": "hengck23 That's one approach, but in my opinion all samples are wrong. Samples that happened to be convex polygons are good samples, but we dont know which ones was convex. The ones with holes are definitely wrong, but there is no guarantee that all solid ones are all good.",
    "1582727": "bakeryproducts  Can you open your fixed code?\nI can fill holes,but fixed outside masks seems not good.",
    "1582878": "Hi @bakeryproducts I'm not able to access https://www.kaggle.com/bakeryproducts/broken-mask-repro could you please reshare it?\nThanks!",
    "1584649": "you can detect quite a number of them by the bottom horizontal line",
    "1585121": "this is my attempt\n<a href=\"https://ibb.co/W6mN2Mr\"><img src=\"https://i.ibb.co/L8VDZcT/Selection-999-427.png\" alt=\"Selection-999-427\" border=\"0\"></a>\n<a href=\"https://ibb.co/Q8K04Rf\"><img src=\"https://i.ibb.co/7405DbT/Selection-999-440.png\" alt=\"Selection-999-428\" border=\"0\"></a>",
    "1585136": "The problem is that these kinds of broken masks may happen in test dataset.",
    "1585140": "the broken mask is affecting my training (e.g. to determine the seeds for watershed).\ni will still have to predict the \"wrong\" mask finally.",
    "1585479": "As a simple improvement I can suggest subtract intersection(gray, white) from white mask",
    "1585482": "slawekbiel @chihantsai  I deleted it to avoid probable future misleading. It was one liner for cv fillPoly vs fillconvexpoly. It is not helpful without polygon annotation on hand",
    "1585626": "actually, the convex polygon is not the main problems.\n\n<a href=\"https://ibb.co/Q8PDDk1\"><img src=\"https://i.ibb.co/cb6YYw7/Selection-999-436.pngg\" alt=\"Selection-999-436\" border=\"0\"></a>\n\nthe astro images have poor performance due to the inconsistent annotation. in my experiments, you have good performance if you \"always annotate\" or \"always not annotate\". But inconsistency causes confusion.\n\n\na good example is: 6f90a53cf326\n\na simple way to normalise the image for visualisation\n```\n            image = image.astype(np.float32)/255\n            x = torch.from_numpy(image).unsqueeze(0).unsqueeze(0)\n            x = x.repeat(1,3,1,1)\n            x = (F.tanh((x-0.5)*16)+1)/2\n\n```"
  },
  "source": "meta"
}