{
  "id": 211515,
  "title": "Results of using lungs and catheter segmentation as input",
  "url": "/competitions/ranzcr-clip-catheter-line-classification/discussion/211515",
  "author_name": "Virilo Tejedor Aguilera",
  "post_date": "2021-01-15T13:56:46.730000",
  "votes": 35,
  "comment_count": 12,
  "views": 0,
  "content": "<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F223160%2F7b3dfec8bed76e219f8735f5ab783c99%2Fscheme_1280.png?generation=1610718781393321&amp;alt=media\" alt=\"\"></p>\n<p>I am using the annotations as a segmentation problem to inference the catheters. It is just a binary prediction, it does not classify the output into labels.</p>\n<p>And I'm using the <a href=\"https://www.kaggle.com/raddar/ranzcr-clip-lung-contours\" target=\"_blank\">lung masks</a> (thanks <a href=\"https://www.kaggle.com/raddar\" target=\"_blank\">@raddar</a> !!!) to have a segmentation position of the lungs.</p>\n<p>These segmentations are used in conjunction with xrays as input.</p>\n<p>At first, I tried to split this information using the three RGB channels (one channel per info layer)  as the input image and fine-tune a previously trained resnet200d in Imagenet.</p>\n<p>I also gave it a second try adding the segmentation information to the G (catheter) and B (lungs) channels. I thought it must be easily understandable by a Imagenet pre-trained  network</p>\n<p>But neither of these approaches is giving me better results:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F223160%2Fe162963b7bf731fd7ca93cff199219fb%2Fresults.png?generation=1610718825446302&amp;alt=media\" alt=\"\"></p>\n<p>I used the same kfold split for lungs sementation, catheter segmentation, and finally combined image classification.</p>\n<p>The segmentation approach seemed to overfitting a bit and didn't give me any improvement in public LB score.</p>\n<p>I thought the resolution of the input image was so important to this image classification task, to allow the network to find the position of the catheters.<br>\nSince I am giving you the catheter masks as input, I thought high resolution was no longer important, and I tried other CNN architectures with lower resolutions and very high batch sizes (32 and 64) with no success.</p>\n<p>Has anyone improved their results using image segmentation as input?</p>",
  "messages": [
    {
      "id": 1154226,
      "postDate": "2021-01-15T13:56:46.730Z",
      "content": "<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F223160%2F7b3dfec8bed76e219f8735f5ab783c99%2Fscheme_1280.png?generation=1610718781393321&amp;alt=media\" alt=\"\"></p>\n<p>I am using the annotations as a segmentation problem to inference the catheters. It is just a binary prediction, it does not classify the output into labels.</p>\n<p>And I'm using the <a href=\"https://www.kaggle.com/raddar/ranzcr-clip-lung-contours\" target=\"_blank\">lung masks</a> (thanks <a href=\"https://www.kaggle.com/raddar\" target=\"_blank\">@raddar</a> !!!) to have a segmentation position of the lungs.</p>\n<p>These segmentations are used in conjunction with xrays as input.</p>\n<p>At first, I tried to split this information using the three RGB channels (one channel per info layer)  as the input image and fine-tune a previously trained resnet200d in Imagenet.</p>\n<p>I also gave it a second try adding the segmentation information to the G (catheter) and B (lungs) channels. I thought it must be easily understandable by a Imagenet pre-trained  network</p>\n<p>But neither of these approaches is giving me better results:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F223160%2Fe162963b7bf731fd7ca93cff199219fb%2Fresults.png?generation=1610718825446302&amp;alt=media\" alt=\"\"></p>\n<p>I used the same kfold split for lungs sementation, catheter segmentation, and finally combined image classification.</p>\n<p>The segmentation approach seemed to overfitting a bit and didn't give me any improvement in public LB score.</p>\n<p>I thought the resolution of the input image was so important to this image classification task, to allow the network to find the position of the catheters.<br>\nSince I am giving you the catheter masks as input, I thought high resolution was no longer important, and I tried other CNN architectures with lower resolutions and very high batch sizes (32 and 64) with no success.</p>\n<p>Has anyone improved their results using image segmentation as input?</p>",
      "rawMarkdown": "![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F223160%2F7b3dfec8bed76e219f8735f5ab783c99%2Fscheme_1280.png?generation=1610718781393321&alt=media)\n\nI am using the annotations as a segmentation problem to inference the catheters. It is just a binary prediction, it does not classify the output into labels.\n\nAnd I'm using the [lung masks](https://www.kaggle.com/raddar/ranzcr-clip-lung-contours) (thanks @raddar !!!) to have a segmentation position of the lungs.\n\nThese segmentations are used in conjunction with xrays as input.\n\nAt first, I tried to split this information using the three RGB channels (one channel per info layer)  as the input image and fine-tune a previously trained resnet200d in Imagenet.\n\nI also gave it a second try adding the segmentation information to the G (catheter) and B (lungs) channels. I thought it must be easily understandable by a Imagenet pre-trained  network\n\nBut neither of these approaches is giving me better results:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F223160%2Fe162963b7bf731fd7ca93cff199219fb%2Fresults.png?generation=1610718825446302&alt=media)\n\nI used the same kfold split for lungs sementation, catheter segmentation, and finally combined image classification.\n\nThe segmentation approach seemed to overfitting a bit and didn't give me any improvement in public LB score.\n\nI thought the resolution of the input image was so important to this image classification task, to allow the network to find the position of the catheters.\nSince I am giving you the catheter masks as input, I thought high resolution was no longer important, and I tried other CNN architectures with lower resolutions and very high batch sizes (32 and 64) with no success.\n\nHas anyone improved their results using image segmentation as input?",
      "votes": 35
    },
    {
      "id": 1155918,
      "postDate": "2021-01-16T19:17:46.427Z",
      "content": "<p>I ve tried this too. It does not make so big diference as i thought at first. We must understand that the CNN models are Black Box models, meaning that we are totally unaware of knowing what actually the look into the image and what patterns too. For examble one letter drawn into the image maybe is a better pattern than actually the catheter. We think as what a human would look or a doctor, but the NN look at whatever it likes based on the dataset's instances. Here is where explainability matters in which we can vizualize on what areas of the images the models mainly look. I have tried some vizualizations using some post hoc explainability tools and saw that the models mainly look at the chest rather the catheter or the lungs.</p>",
      "rawMarkdown": "I ve tried this too. It does not make so big diference as i thought at first. We must understand that the CNN models are Black Box models, meaning that we are totally unaware of knowing what actually the look into the image and what patterns too. For examble one letter drawn into the image maybe is a better pattern than actually the catheter. We think as what a human would look or a doctor, but the NN look at whatever it likes based on the dataset's instances. Here is where explainability matters in which we can vizualize on what areas of the images the models mainly look. I have tried some vizualizations using some post hoc explainability tools and saw that the models mainly look at the chest rather the catheter or the lungs.",
      "votes": 8
    },
    {
      "id": 1154838,
      "postDate": "2021-01-16T01:36:00.293Z",
      "content": "<p>The authors of this paper used similar segmentation (of line/catheter and anatomy) and found that random forest was better than DNNs for classification. Would be interested to hear if anyone has tried this out</p>\n<p>Automated Detection and Type Classification of<br>\n Central Venous Catheters in Chest X-rays<br>\n<a href=\"https://arxiv.org/pdf/1907.01656.pdf\" target=\"_blank\">https://arxiv.org/pdf/1907.01656.pdf</a></p>",
      "rawMarkdown": "The authors of this paper used similar segmentation (of line/catheter and anatomy) and found that random forest was better than DNNs for classification. Would be interested to hear if anyone has tried this out\n\nAutomated Detection and Type Classification of\r Central Venous Catheters in Chest X-rays\nhttps://arxiv.org/pdf/1907.01656.pdf\n",
      "votes": 8
    },
    {
      "id": 1156267,
      "postDate": "2021-01-17T03:56:04.353Z",
      "content": "<p>Is there a reason you want to segment the lungs, particularly? Unfortunately, none of the lines or catheters terminate in the lungs, so I'm not sure how much valuable information it would add. ETTs are always between the clavicles, for instance, so I imagine segmenting them could help</p>",
      "rawMarkdown": "Is there a reason you want to segment the lungs, particularly? Unfortunately, none of the lines or catheters terminate in the lungs, so I'm not sure how much valuable information it would add. ETTs are always between the clavicles, for instance, so I imagine segmenting them could help",
      "votes": 1,
      "replies": [
        {
          "id": 1156445,
          "postDate": "2021-01-17T06:52:46.647Z",
          "content": "<p>I segmented the lung in an attempt to \"focus\" the CNN's attention to the catheters around/near the lungs. It doesn't quite work that way with NN as <a href=\"https://www.kaggle.com/manolispintelas\" target=\"_blank\">@manolispintelas</a> pointed out, \"the NN looks at whatever it likes based on the dataset's instances\".</p>\n<p>The lungs segmentation is a way to provide normalized coordinates for downstream modelling task. For example, if combined with tip detection, the tip's coordinates can be normalized with respect to the lungs segmentation and then be provided to a classifier. (You can swap lung segmentation with clavicles segmentation in the example.) There are probably other use than this, but my mere mortal mind cannot think of any &gt;.&lt;</p>",
          "rawMarkdown": "I segmented the lung in an attempt to \"focus\" the CNN's attention to the catheters around/near the lungs. It doesn't quite work that way with NN as @manolispintelas pointed out, \"the NN looks at whatever it likes based on the dataset's instances\".\n\nThe lungs segmentation is a way to provide normalized coordinates for downstream modelling task. For example, if combined with tip detection, the tip's coordinates can be normalized with respect to the lungs segmentation and then be provided to a classifier. (You can swap lung segmentation with clavicles segmentation in the example.) There are probably other use than this, but my mere mortal mind cannot think of any >.<",
          "votes": 4
        }
      ]
    },
    {
      "id": 1155559,
      "postDate": "2021-01-16T13:13:55.610Z",
      "content": "<p>Segmenting the image to concentrate on the focus areas is a good idea. <br>\nBut don't you think CNN based models themselves have quite the capability to filter out structural components(depending on the tasks on which they are trained) in an image. That's the whole reason why they are used in UNet.</p>",
      "rawMarkdown": "Segmenting the image to concentrate on the focus areas is a good idea. \nBut don't you think CNN based models themselves have quite the capability to filter out structural components(depending on the tasks on which they are trained) in an image. That's the whole reason why they are used in UNet.",
      "votes": 1
    },
    {
      "id": 1154541,
      "postDate": "2021-01-15T17:34:55.313Z",
      "content": "<p>I tried something similar using Efficientnet-b5 and Xception at 512x512. I also did not get much or any improvement to both my local CV and LB.</p>\n<p>However, I did find the model converge/overfit much faster to the training set, so I may try adding more augmentation/regularization.</p>",
      "rawMarkdown": "I tried something similar using Efficientnet-b5 and Xception at 512x512. I also did not get much or any improvement to both my local CV and LB.\n\nHowever, I did find the model converge/overfit much faster to the training set, so I may try adding more augmentation/regularization.",
      "votes": 1
    },
    {
      "id": 1156940,
      "postDate": "2021-01-17T14:38:22.540Z",
      "content": "<p>Even I was wondering to use the mask. Good you are attempting this approach. </p>",
      "rawMarkdown": "Even I was wondering to use the mask. Good you are attempting this approach. ",
      "votes": 2
    },
    {
      "id": 1154809,
      "postDate": "2021-01-15T23:32:50.107Z",
      "content": "<p>Did you use thresholded masks (lung/tubes) or raw output of your segmentation models?</p>",
      "rawMarkdown": "Did you use thresholded masks (lung/tubes) or raw output of your segmentation models?",
      "votes": 2,
      "replies": [
        {
          "id": 1154811,
          "postDate": "2021-01-15T23:48:22.167Z",
          "content": "<p>My attempt was with raw segmentation output. CV 0.935 (with segmentation), 0.945 (without segmentation). </p>\n<p>Model with thresholded mask is in the oven; seems to be progressing better. <br>\nInterested to see <a href=\"https://www.kaggle.com/virilo\" target=\"_blank\">@virilo</a>'s approach.</p>\n<p>UPDATE: model with thresholded mask turns out to be similar with local CV 0.937</p>",
          "rawMarkdown": "My attempt was with raw segmentation output. CV 0.935 (with segmentation), 0.945 (without segmentation). \n\nModel with thresholded mask is in the oven; seems to be progressing better. \nInterested to see @virilo's approach.\n\nUPDATE: model with thresholded mask turns out to be similar with local CV 0.937",
          "votes": 3
        },
        {
          "id": 1154833,
          "postDate": "2021-01-16T01:16:31.210Z",
          "content": "<p><a href=\"https://www.kaggle.com/raddar\" target=\"_blank\">@raddar</a> I used the raw output, without any threshold</p>",
          "rawMarkdown": "@raddar I used the raw output, without any threshold",
          "votes": 1
        }
      ]
    },
    {
      "id": 1224541,
      "postDate": "2021-03-02T20:39:51.803Z",
      "content": "<p><a href=\"https://www.kaggle.com/CBR\" target=\"_blank\">@CBR</a> and <a href=\"https://www.kaggle.com/all\" target=\"_blank\">@all</a></p>\n<p>I wouldn't like to discourage you from using this kind of schema.</p>\n<p>I stopped using it at the same time I asked in this forum</p>\n<p>But I'm waiting the moment to have time to test it again.  Because it should be possible to take advantage of these annotations.  Even better adding hand-labels to the trainset.</p>\n<p>My intuition is that there must be a room of improvement here.  Don't give up!</p>",
      "rawMarkdown": "@CBR and @all\n\nI wouldn't like to discourage you from using this kind of schema.\n\nI stopped using it at the same time I asked in this forum\n\nBut I'm waiting the moment to have time to test it again.  Because it should be possible to take advantage of these annotations.  Even better adding hand-labels to the trainset.\n\nMy intuition is that there must be a room of improvement here.  Don't give up!"
    },
    {
      "id": 1156268,
      "postDate": "2021-01-17T03:56:04.353Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 1155918,
      "author_name": "",
      "author_url": "",
      "post_date": "2021-01-16T19:17:46.427000",
      "content": "<p>I ve tried this too. It does not make so big diference as i thought at first. We must understand that the CNN models are Black Box models, meaning that we are totally unaware of knowing what actually the look into the image and what patterns too. For examble one letter drawn into the image maybe is a better pattern than actually the catheter. We think as what a human would look or a doctor, but the NN look at whatever it likes based on the dataset's instances. Here is where explainability matters in which we can vizualize on what areas of the images the models mainly look. I have tried some vizualizations using some post hoc explainability tools and saw that the models mainly look at the chest rather the catheter or the lungs.</p>",
      "votes": 8,
      "replies": []
    },
    {
      "id": 1154838,
      "author_name": "Reuben Schmidt",
      "author_url": "",
      "post_date": "2021-01-16T01:36:00.293000",
      "content": "<p>The authors of this paper used similar segmentation (of line/catheter and anatomy) and found that random forest was better than DNNs for classification. Would be interested to hear if anyone has tried this out</p>\n<p>Automated Detection and Type Classification of<br>\n Central Venous Catheters in Chest X-rays<br>\n<a href=\"https://arxiv.org/pdf/1907.01656.pdf\" target=\"_blank\">https://arxiv.org/pdf/1907.01656.pdf</a></p>",
      "votes": 8,
      "replies": []
    },
    {
      "id": 1156267,
      "author_name": "Reuben Schmidt",
      "author_url": "",
      "post_date": "2021-01-17T03:56:04.353000",
      "content": "<p>Is there a reason you want to segment the lungs, particularly? Unfortunately, none of the lines or catheters terminate in the lungs, so I'm not sure how much valuable information it would add. ETTs are always between the clavicles, for instance, so I imagine segmenting them could help</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1156445,
          "author_name": "JunYong Tong",
          "author_url": "",
          "post_date": "2021-01-17T06:52:46.647000",
          "content": "<p>I segmented the lung in an attempt to \"focus\" the CNN's attention to the catheters around/near the lungs. It doesn't quite work that way with NN as <a href=\"https://www.kaggle.com/manolispintelas\" target=\"_blank\">@manolispintelas</a> pointed out, \"the NN looks at whatever it likes based on the dataset's instances\".</p>\n<p>The lungs segmentation is a way to provide normalized coordinates for downstream modelling task. For example, if combined with tip detection, the tip's coordinates can be normalized with respect to the lungs segmentation and then be provided to a classifier. (You can swap lung segmentation with clavicles segmentation in the example.) There are probably other use than this, but my mere mortal mind cannot think of any &gt;.&lt;</p>",
          "votes": 4,
          "replies": []
        }
      ]
    },
    {
      "id": 1155559,
      "author_name": "Izzy Adesanya",
      "author_url": "",
      "post_date": "2021-01-16T13:13:55.610000",
      "content": "<p>Segmenting the image to concentrate on the focus areas is a good idea. <br>\nBut don't you think CNN based models themselves have quite the capability to filter out structural components(depending on the tasks on which they are trained) in an image. That's the whole reason why they are used in UNet.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1154541,
      "author_name": "JunYong Tong",
      "author_url": "",
      "post_date": "2021-01-15T17:34:55.313000",
      "content": "<p>I tried something similar using Efficientnet-b5 and Xception at 512x512. I also did not get much or any improvement to both my local CV and LB.</p>\n<p>However, I did find the model converge/overfit much faster to the training set, so I may try adding more augmentation/regularization.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1156940,
      "author_name": "CBR",
      "author_url": "",
      "post_date": "2021-01-17T14:38:22.540000",
      "content": "<p>Even I was wondering to use the mask. Good you are attempting this approach. </p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 1154809,
      "author_name": "raddar",
      "author_url": "",
      "post_date": "2021-01-15T23:32:50.107000",
      "content": "<p>Did you use thresholded masks (lung/tubes) or raw output of your segmentation models?</p>",
      "votes": 2,
      "replies": [
        {
          "id": 1154811,
          "author_name": "JunYong Tong",
          "author_url": "",
          "post_date": "2021-01-15T23:48:22.167000",
          "content": "<p>My attempt was with raw segmentation output. CV 0.935 (with segmentation), 0.945 (without segmentation). </p>\n<p>Model with thresholded mask is in the oven; seems to be progressing better. <br>\nInterested to see <a href=\"https://www.kaggle.com/virilo\" target=\"_blank\">@virilo</a>'s approach.</p>\n<p>UPDATE: model with thresholded mask turns out to be similar with local CV 0.937</p>",
          "votes": 3,
          "replies": []
        },
        {
          "id": 1154833,
          "author_name": "Virilo Tejedor Aguilera",
          "author_url": "",
          "post_date": "2021-01-16T01:16:31.210000",
          "content": "<p><a href=\"https://www.kaggle.com/raddar\" target=\"_blank\">@raddar</a> I used the raw output, without any threshold</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 1224541,
      "author_name": "Virilo Tejedor Aguilera",
      "author_url": "",
      "post_date": "2021-03-02T20:39:51.803000",
      "content": "<p><a href=\"https://www.kaggle.com/CBR\" target=\"_blank\">@CBR</a> and <a href=\"https://www.kaggle.com/all\" target=\"_blank\">@all</a></p>\n<p>I wouldn't like to discourage you from using this kind of schema.</p>\n<p>I stopped using it at the same time I asked in this forum</p>\n<p>But I'm waiting the moment to have time to test it again.  Because it should be possible to take advantage of these annotations.  Even better adding hand-labels to the trainset.</p>\n<p>My intuition is that there must be a room of improvement here.  Don't give up!</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 1156268,
      "author_name": "",
      "author_url": "",
      "post_date": "2021-01-17T03:56:04.353000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1154226": "![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F223160%2F7b3dfec8bed76e219f8735f5ab783c99%2Fscheme_1280.png?generation=1610718781393321&alt=media)\n\nI am using the annotations as a segmentation problem to inference the catheters. It is just a binary prediction, it does not classify the output into labels.\n\nAnd I'm using the [lung masks](https://www.kaggle.com/raddar/ranzcr-clip-lung-contours) (thanks @raddar !!!) to have a segmentation position of the lungs.\n\nThese segmentations are used in conjunction with xrays as input.\n\nAt first, I tried to split this information using the three RGB channels (one channel per info layer)  as the input image and fine-tune a previously trained resnet200d in Imagenet.\n\nI also gave it a second try adding the segmentation information to the G (catheter) and B (lungs) channels. I thought it must be easily understandable by a Imagenet pre-trained  network\n\nBut neither of these approaches is giving me better results:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F223160%2Fe162963b7bf731fd7ca93cff199219fb%2Fresults.png?generation=1610718825446302&alt=media)\n\nI used the same kfold split for lungs sementation, catheter segmentation, and finally combined image classification.\n\nThe segmentation approach seemed to overfitting a bit and didn't give me any improvement in public LB score.\n\nI thought the resolution of the input image was so important to this image classification task, to allow the network to find the position of the catheters.\nSince I am giving you the catheter masks as input, I thought high resolution was no longer important, and I tried other CNN architectures with lower resolutions and very high batch sizes (32 and 64) with no success.\n\nHas anyone improved their results using image segmentation as input?",
    "1155918": "I ve tried this too. It does not make so big diference as i thought at first. We must understand that the CNN models are Black Box models, meaning that we are totally unaware of knowing what actually the look into the image and what patterns too. For examble one letter drawn into the image maybe is a better pattern than actually the catheter. We think as what a human would look or a doctor, but the NN look at whatever it likes based on the dataset's instances. Here is where explainability matters in which we can vizualize on what areas of the images the models mainly look. I have tried some vizualizations using some post hoc explainability tools and saw that the models mainly look at the chest rather the catheter or the lungs.",
    "1154838": "The authors of this paper used similar segmentation (of line/catheter and anatomy) and found that random forest was better than DNNs for classification. Would be interested to hear if anyone has tried this out\n\nAutomated Detection and Type Classification of\r Central Venous Catheters in Chest X-rays\nhttps://arxiv.org/pdf/1907.01656.pdf\n",
    "1156267": "Is there a reason you want to segment the lungs, particularly? Unfortunately, none of the lines or catheters terminate in the lungs, so I'm not sure how much valuable information it would add. ETTs are always between the clavicles, for instance, so I imagine segmenting them could help",
    "1155559": "Segmenting the image to concentrate on the focus areas is a good idea. \nBut don't you think CNN based models themselves have quite the capability to filter out structural components(depending on the tasks on which they are trained) in an image. That's the whole reason why they are used in UNet.",
    "1154541": "I tried something similar using Efficientnet-b5 and Xception at 512x512. I also did not get much or any improvement to both my local CV and LB.\n\nHowever, I did find the model converge/overfit much faster to the training set, so I may try adding more augmentation/regularization.",
    "1156940": "Even I was wondering to use the mask. Good you are attempting this approach. ",
    "1154809": "Did you use thresholded masks (lung/tubes) or raw output of your segmentation models?",
    "1224541": "@CBR and @all\n\nI wouldn't like to discourage you from using this kind of schema.\n\nI stopped using it at the same time I asked in this forum\n\nBut I'm waiting the moment to have time to test it again.  Because it should be possible to take advantage of these annotations.  Even better adding hand-labels to the trainset.\n\nMy intuition is that there must be a room of improvement here.  Don't give up!",
    "1156268": ""
  }
}