{
  "id": 51691,
  "title": "How to remove a fiber artifact in an image?",
  "url": "/competitions/data-science-bowl-2018/discussion/51691",
  "author_name": "",
  "post_date": "2018-03-12T06:08:05.569143Z",
  "votes": 2,
  "comment_count": 5,
  "views": 0,
  "content": "<p>I currently achieved a reasonable result (~0.44 LB) using mask-rcnn from matterport (<a href=\"https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline\">https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline</a>)</p>\n\n<p>When I check in the testing set, some image appears a fiber artifact (Thanks \nAnne Carpenter) that has intensity similar the nuclei. Hence, the network fails to segment them. Do we have any scheme to remove the line? \nMy current idea is that we can use template matching, but it takes <code>nx(n-1)</code> time testing, where n is number of masks [Ref: https://docs.opencv.org/3.1.0/d5/d45/tutorial_py_contours_more_functions.html]</p>\n\n<p>This is result of image id <code>336d3e4105766f8ad328a7ee9571e743f376f8cbcf6a969ca7e353fe3235c523</code></p>\n\n<p><img src=\"https://i.stack.imgur.com/ouuAF.png\" alt=\"enter image description here\"></p>",
  "messages": [
    {
      "id": "294552",
      "postDate": "03/12/2018 06:08:05",
      "content": "<p>I currently achieved a reasonable result (~0.44 LB) using mask-rcnn from matterport (<a href=\"https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline\">https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline</a>)</p>\n\n<p>When I check in the testing set, some image appears a fiber artifact (Thanks \nAnne Carpenter) that has intensity similar the nuclei. Hence, the network fails to segment them. Do we have any scheme to remove the line? \nMy current idea is that we can use template matching, but it takes <code>nx(n-1)</code> time testing, where n is number of masks [Ref: https://docs.opencv.org/3.1.0/d5/d45/tutorial_py_contours_more_functions.html]</p>\n\n<p>This is result of image id <code>336d3e4105766f8ad328a7ee9571e743f376f8cbcf6a969ca7e353fe3235c523</code></p>\n\n<p><img src=\"https://i.stack.imgur.com/ouuAF.png\" alt=\"enter image description here\"></p>",
      "rawMarkdown": "I currently achieved a reasonable result (~0.44 LB) using mask-rcnn from matterport (https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline)\n\n\nWhen I check in the testing set, some image appears a fiber artifact (Thanks \nAnne Carpenter) that has intensity similar the nuclei. Hence, the network fails to segment them. Do we have any scheme to remove the line? \nMy current idea is that we can use template matching, but it takes `nx(n-1)` time testing, where n is number of masks [Ref: https://docs.opencv.org/3.1.0/d5/d45/tutorial_py_contours_more_functions.html]\n\nThis is result of image id `336d3e4105766f8ad328a7ee9571e743f376f8cbcf6a969ca7e353fe3235c523`\n\n![enter image description here][1]\n\n  [1]: https://i.stack.imgur.com/ouuAF.png",
      "votes": null
    },
    {
      "id": "294571",
      "postDate": "03/12/2018 06:49:59",
      "content": "<p>there are a few ways:</p>\n\n<ol>\n<li><p>filter by size (if the area of a segmentation is too large then the surrounding objects, remove it).  </p></li>\n<li><p>there is a training image with line. Make more train augmentation images with that one.\n(I do not have this white line problem in my mask rcnn results)</p></li>\n<li><p>make a rejector: </p></li>\n</ol>\n\n<p>i.e. input_image --&gt; [mask-rcnn] --&gt; mask instances --&gt; [some refine module] --&gt; final results</p>\n\n<ol>\n<li>compute the : LB metric for this image with and without the white line error. maybe the improvement is not a lot and you can just ignore it temporarily first and handle other problems first</li>\n</ol>\n\n<p>in addition:</p>\n\n<ul>\n<li>i note that you have some black pixels in your overlay results. I am not sure are those from your mask prediction or drawing of results. If those are from your prediction, you should refine your prediction so that the mask \"fits better\".</li>\n</ul>",
      "rawMarkdown": "there are a few ways:\n\n1.  filter by size (if the area of a segmentation is too large then the surrounding objects, remove it).  \n\n2. there is a training image with line. Make more train augmentation images with that one.\n    (I do not have this white line problem in my mask rcnn results)\n\n3. make a rejector: \n\ni.e. input_image --&gt; [mask-rcnn] --&gt; mask instances --&gt; [some refine module] --&gt; final results\n\n4. compute the : LB metric for this image with and without the white line error. maybe the improvement is not a lot and you can just ignore it temporarily first and handle other problems first\n\nin addition:\n\n- i note that you have some black pixels in your overlay results. I am not sure are those from your mask prediction or drawing of results. If those are from your prediction, you should refine your prediction so that the mask \"fits better\".",
      "votes": null
    },
    {
      "id": "294582",
      "postDate": "03/12/2018 07:16:43",
      "content": "<p>Thank you so much Heng, \n1. Filter size  by threshold may not good because some image shows that nuclei appears in various sizes such as <code>472b1c5ff988dadc209faea92499bc07f305208dbda29d16262b3d543ac91c71</code>\n2. I will try to augment these image with white line and let you know the result\n3. ...\nFor the blacks pixels, It comes from converting masks to contours function in cv2. I guess the cv2 tried to find a smooth contour over an object, while my result may have some Zigzag pixel. I will find the way to fill hole inside the contour and measure LB</p>",
      "rawMarkdown": "Thank you so much Heng, \n1. Filter size  by threshold may not good because some image shows that nuclei appears in various sizes such as `472b1c5ff988dadc209faea92499bc07f305208dbda29d16262b3d543ac91c71`\n2. I will try to augment these image with white line and let you know the result\n3. ...\nFor the blacks pixels, It comes from converting masks to contours function in cv2. I guess the cv2 tried to find a smooth contour over an object, while my result may have some Zigzag pixel. I will find the way to fill hole inside the contour and measure LB",
      "votes": null
    },
    {
      "id": "294677",
      "postDate": "03/12/2018 12:04:40",
      "content": "<p>That thing is a fiber (possibly a hair but probably just from fabric in the lab falling into the dish). It's a super annoying artifact!</p>",
      "rawMarkdown": "That thing is a fiber (possibly a hair but probably just from fabric in the lab falling into the dish). It's a super annoying artifact!",
      "votes": null
    },
    {
      "id": "294680",
      "postDate": "03/12/2018 12:15:56",
      "content": "<p>Thanks Anne Carpenter, I have updated the title for make the question more clear. :)</p>",
      "rawMarkdown": "Thanks Anne Carpenter, I have updated the title for make the question more clear. :)",
      "votes": null
    },
    {
      "id": "294718",
      "postDate": "03/12/2018 14:04:37",
      "content": "<p>I already corrected this as a post-processing step (based on the area and the eccentricity: <a href=\"https://en.wikipedia.org/wiki/Image_moment\">https://en.wikipedia.org/wiki/Image_moment</a> of the instance). I think there are 3 images in the validation set that have these artifacts. Removing them gave only a minor improvement: 0.493 -&gt; 0.494 LB score.</p>",
      "rawMarkdown": "I already corrected this as a post-processing step (based on the area and the eccentricity: https://en.wikipedia.org/wiki/Image_moment of the instance). I think there are 3 images in the validation set that have these artifacts. Removing them gave only a minor improvement: 0.493 -&gt; 0.494 LB score.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 294571,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "03/12/2018 06:49:59",
      "content": "<p>there are a few ways:</p>\n\n<ol>\n<li><p>filter by size (if the area of a segmentation is too large then the surrounding objects, remove it).  </p></li>\n<li><p>there is a training image with line. Make more train augmentation images with that one.\n(I do not have this white line problem in my mask rcnn results)</p></li>\n<li><p>make a rejector: </p></li>\n</ol>\n\n<p>i.e. input_image --&gt; [mask-rcnn] --&gt; mask instances --&gt; [some refine module] --&gt; final results</p>\n\n<ol>\n<li>compute the : LB metric for this image with and without the white line error. maybe the improvement is not a lot and you can just ignore it temporarily first and handle other problems first</li>\n</ol>\n\n<p>in addition:</p>\n\n<ul>\n<li>i note that you have some black pixels in your overlay results. I am not sure are those from your mask prediction or drawing of results. If those are from your prediction, you should refine your prediction so that the mask \"fits better\".</li>\n</ul>",
      "votes": null,
      "replies": [
        {
          "id": 294582,
          "author_name": "john1231983",
          "author_url": "",
          "post_date": "03/12/2018 07:16:43",
          "content": "<p>Thank you so much Heng, \n1. Filter size  by threshold may not good because some image shows that nuclei appears in various sizes such as <code>472b1c5ff988dadc209faea92499bc07f305208dbda29d16262b3d543ac91c71</code>\n2. I will try to augment these image with white line and let you know the result\n3. ...\nFor the blacks pixels, It comes from converting masks to contours function in cv2. I guess the cv2 tried to find a smooth contour over an object, while my result may have some Zigzag pixel. I will find the way to fill hole inside the contour and measure LB</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 294677,
          "author_name": "drannecarpenter",
          "author_url": "",
          "post_date": "03/12/2018 12:04:40",
          "content": "<p>That thing is a fiber (possibly a hair but probably just from fabric in the lab falling into the dish). It's a super annoying artifact!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 294680,
          "author_name": "john1231983",
          "author_url": "",
          "post_date": "03/12/2018 12:15:56",
          "content": "<p>Thanks Anne Carpenter, I have updated the title for make the question more clear. :)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 294718,
      "author_name": "seesee",
      "author_url": "",
      "post_date": "03/12/2018 14:04:37",
      "content": "<p>I already corrected this as a post-processing step (based on the area and the eccentricity: <a href=\"https://en.wikipedia.org/wiki/Image_moment\">https://en.wikipedia.org/wiki/Image_moment</a> of the instance). I think there are 3 images in the validation set that have these artifacts. Removing them gave only a minor improvement: 0.493 -&gt; 0.494 LB score.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "294552": "I currently achieved a reasonable result (~0.44 LB) using mask-rcnn from matterport (https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline)\n\n\nWhen I check in the testing set, some image appears a fiber artifact (Thanks \nAnne Carpenter) that has intensity similar the nuclei. Hence, the network fails to segment them. Do we have any scheme to remove the line? \nMy current idea is that we can use template matching, but it takes `nx(n-1)` time testing, where n is number of masks [Ref: https://docs.opencv.org/3.1.0/d5/d45/tutorial_py_contours_more_functions.html]\n\nThis is result of image id `336d3e4105766f8ad328a7ee9571e743f376f8cbcf6a969ca7e353fe3235c523`\n\n![enter image description here][1]\n\n  [1]: https://i.stack.imgur.com/ouuAF.png",
    "294571": "there are a few ways:\n\n1.  filter by size (if the area of a segmentation is too large then the surrounding objects, remove it).  \n\n2. there is a training image with line. Make more train augmentation images with that one.\n    (I do not have this white line problem in my mask rcnn results)\n\n3. make a rejector: \n\ni.e. input_image --&gt; [mask-rcnn] --&gt; mask instances --&gt; [some refine module] --&gt; final results\n\n4. compute the : LB metric for this image with and without the white line error. maybe the improvement is not a lot and you can just ignore it temporarily first and handle other problems first\n\nin addition:\n\n- i note that you have some black pixels in your overlay results. I am not sure are those from your mask prediction or drawing of results. If those are from your prediction, you should refine your prediction so that the mask \"fits better\".",
    "294582": "Thank you so much Heng, \n1. Filter size  by threshold may not good because some image shows that nuclei appears in various sizes such as `472b1c5ff988dadc209faea92499bc07f305208dbda29d16262b3d543ac91c71`\n2. I will try to augment these image with white line and let you know the result\n3. ...\nFor the blacks pixels, It comes from converting masks to contours function in cv2. I guess the cv2 tried to find a smooth contour over an object, while my result may have some Zigzag pixel. I will find the way to fill hole inside the contour and measure LB",
    "294677": "That thing is a fiber (possibly a hair but probably just from fabric in the lab falling into the dish). It's a super annoying artifact!",
    "294680": "Thanks Anne Carpenter, I have updated the title for make the question more clear. :)",
    "294718": "I already corrected this as a post-processing step (based on the area and the eccentricity: https://en.wikipedia.org/wiki/Image_moment of the instance). I think there are 3 images in the validation set that have these artifacts. Removing them gave only a minor improvement: 0.493 -&gt; 0.494 LB score."
  },
  "source": "meta"
}