{
  "id": 523971,
  "title": "Anyone have luck with contrast-agnostic 3D segmentation?",
  "url": "/competitions/rsna-2024-lumbar-spine-degenerative-classification/discussion/523971",
  "author_name": "Victor S",
  "post_date": "2024-08-03T20:09:41.917000",
  "votes": 1,
  "comment_count": 0,
  "views": 0,
  "content": "<p>I have been trying to train a segmentation model on the <code>nnunet</code> dataset, and although I have really decent performance on it, performance completely falls apart for the competition dataset. </p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1734709%2Fc31ba3f8f6c9a6179cc10f3b70f47924%2F354378516-daef2e75-fed8-48b1-b81f-e23298966398-2.png?generation=1722715814064448&amp;alt=media\" alt=\"\"><br>\nI have tried to aggressively augment it like below with <code>p=0.9</code> but the result is the same.</p>\n<pre><code>class RandomFlipIntensity:\n    def __call__(self, input: tio.Subject, =0.5):\n         np.random.random() &lt;= p:\n            max_intensity = torch.max(input[].tensor)\n            min_intensity = torch.min(input[].tensor)\n            flipped_intensity = max_intensity - input[].tensor + min_intensity\n            input = tio.Subject(\n                =tio.ScalarImage(tensor=flipped_intensity),\n                =tio.LabelMap(tensor=input[].tensor),\n            )\n        return input\n.\ntransform_3d = tio.Compose([\n        tio.Resize(CONFIG[], =CONFIG[]),\n        tio.RandomAffine(=CONFIG[]),\n        tio.RandomNoise(=CONFIG[]),\n        tio.RandomBlur(=CONFIG[]),\n        tio.RandomAnisotropy(=CONFIG[]),\n        tio.RandomSpike(=CONFIG[]),\n        tio.RandomGamma(=CONFIG[]),\n        tio.RescaleIntensity(out_min_max=(0, 1)),\n        RandomFlipIntensity(),\n    ])\n</code></pre>",
  "messages": [
    {
      "id": 2945888,
      "postDate": "2024-08-03T20:09:41.917Z",
      "content": "<p>I have been trying to train a segmentation model on the <code>nnunet</code> dataset, and although I have really decent performance on it, performance completely falls apart for the competition dataset. </p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1734709%2Fc31ba3f8f6c9a6179cc10f3b70f47924%2F354378516-daef2e75-fed8-48b1-b81f-e23298966398-2.png?generation=1722715814064448&amp;alt=media\" alt=\"\"><br>\nI have tried to aggressively augment it like below with <code>p=0.9</code> but the result is the same.</p>\n<pre><code>class RandomFlipIntensity:\n    def __call__(self, input: tio.Subject, =0.5):\n         np.random.random() &lt;= p:\n            max_intensity = torch.max(input[].tensor)\n            min_intensity = torch.min(input[].tensor)\n            flipped_intensity = max_intensity - input[].tensor + min_intensity\n            input = tio.Subject(\n                =tio.ScalarImage(tensor=flipped_intensity),\n                =tio.LabelMap(tensor=input[].tensor),\n            )\n        return input\n.\ntransform_3d = tio.Compose([\n        tio.Resize(CONFIG[], =CONFIG[]),\n        tio.RandomAffine(=CONFIG[]),\n        tio.RandomNoise(=CONFIG[]),\n        tio.RandomBlur(=CONFIG[]),\n        tio.RandomAnisotropy(=CONFIG[]),\n        tio.RandomSpike(=CONFIG[]),\n        tio.RandomGamma(=CONFIG[]),\n        tio.RescaleIntensity(out_min_max=(0, 1)),\n        RandomFlipIntensity(),\n    ])\n</code></pre>",
      "rawMarkdown": "I have been trying to train a segmentation model on the `nnunet ` dataset, and although I have really decent performance on it, performance completely falls apart for the competition dataset. \n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1734709%2Fc31ba3f8f6c9a6179cc10f3b70f47924%2F354378516-daef2e75-fed8-48b1-b81f-e23298966398-2.png?generation=1722715814064448&alt=media)\nI have tried to aggressively augment it like below with `p=0.9` but the result is the same.\n\n```\nclass RandomFlipIntensity:\n    def __call__(self, input: tio.Subject, p=0.5):\n        if np.random.random() <= p:\n            max_intensity = torch.max(input[\"image\"].tensor)\n            min_intensity = torch.min(input[\"image\"].tensor)\n            flipped_intensity = max_intensity - input[\"image\"].tensor + min_intensity\n            input = tio.Subject(\n                image=tio.ScalarImage(tensor=flipped_intensity),\n                segmentation=tio.LabelMap(tensor=input[\"segmentation\"].tensor),\n            )\n        return input\n...\ntransform_3d = tio.Compose([\n        tio.Resize(CONFIG[\"vol_size\"], image_interpolation=CONFIG[\"interpolation\"]),\n        tio.RandomAffine(p=CONFIG[\"aug_prob\"]),\n        tio.RandomNoise(p=CONFIG[\"aug_prob\"]),\n        tio.RandomBlur(p=CONFIG[\"aug_prob\"]),\n        tio.RandomAnisotropy(p=CONFIG[\"aug_prob\"]),\n        tio.RandomSpike(p=CONFIG[\"aug_prob\"]),\n        tio.RandomGamma(p=CONFIG[\"aug_prob\"]),\n        tio.RescaleIntensity(out_min_max=(0, 1)),\n        RandomFlipIntensity(),\n    ])\n```",
      "votes": 1
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "2945888": "I have been trying to train a segmentation model on the `nnunet ` dataset, and although I have really decent performance on it, performance completely falls apart for the competition dataset. \n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1734709%2Fc31ba3f8f6c9a6179cc10f3b70f47924%2F354378516-daef2e75-fed8-48b1-b81f-e23298966398-2.png?generation=1722715814064448&alt=media)\nI have tried to aggressively augment it like below with `p=0.9` but the result is the same.\n\n```\nclass RandomFlipIntensity:\n    def __call__(self, input: tio.Subject, p=0.5):\n        if np.random.random() <= p:\n            max_intensity = torch.max(input[\"image\"].tensor)\n            min_intensity = torch.min(input[\"image\"].tensor)\n            flipped_intensity = max_intensity - input[\"image\"].tensor + min_intensity\n            input = tio.Subject(\n                image=tio.ScalarImage(tensor=flipped_intensity),\n                segmentation=tio.LabelMap(tensor=input[\"segmentation\"].tensor),\n            )\n        return input\n...\ntransform_3d = tio.Compose([\n        tio.Resize(CONFIG[\"vol_size\"], image_interpolation=CONFIG[\"interpolation\"]),\n        tio.RandomAffine(p=CONFIG[\"aug_prob\"]),\n        tio.RandomNoise(p=CONFIG[\"aug_prob\"]),\n        tio.RandomBlur(p=CONFIG[\"aug_prob\"]),\n        tio.RandomAnisotropy(p=CONFIG[\"aug_prob\"]),\n        tio.RandomSpike(p=CONFIG[\"aug_prob\"]),\n        tio.RandomGamma(p=CONFIG[\"aug_prob\"]),\n        tio.RescaleIntensity(out_min_max=(0, 1)),\n        RandomFlipIntensity(),\n    ])\n```"
  }
}