{
  "id": 264465,
  "title": "The input shape of 3D CNN model ",
  "url": "/competitions/rsna-miccai-brain-tumor-radiogenomic-classification/discussion/264465",
  "author_name": "",
  "post_date": "2021-08-12T07:07:13.315366600Z",
  "votes": 5,
  "comment_count": 8,
  "views": 0,
  "content": "<p>I have trained a 2d CNN model, which treats every image independently, but the model failed to learn things from the data. Even the training accuracy increases, the validation accuracy never increases. I tried many methods to avoid overfitting, but I failed. Now I'm thinking to build a 3d CNN model.<br>\nTo simplify the problem, I am going to build a 3d CNN baseline model that only uses FLAIR images for training. The input is a series of patient's FLAIR images, and the output is the patient's MGMT value. So it is a sequence-to-point model.<br>\nBut the number of MRI frames is different with each patient and type, how to define the correct input shape for the 3D CNN model?</p>",
  "messages": [
    {
      "id": "1467890",
      "postDate": "08/12/2021 07:07:13",
      "content": "<p>I have trained a 2d CNN model, which treats every image independently, but the model failed to learn things from the data. Even the training accuracy increases, the validation accuracy never increases. I tried many methods to avoid overfitting, but I failed. Now I'm thinking to build a 3d CNN model.<br>\nTo simplify the problem, I am going to build a 3d CNN baseline model that only uses FLAIR images for training. The input is a series of patient's FLAIR images, and the output is the patient's MGMT value. So it is a sequence-to-point model.<br>\nBut the number of MRI frames is different with each patient and type, how to define the correct input shape for the 3D CNN model?</p>",
      "rawMarkdown": "I have trained a 2d CNN model, which treats every image independently, but the model failed to learn things from the data. Even the training accuracy increases, the validation accuracy never increases. I tried many methods to avoid overfitting, but I failed. Now I'm thinking to build a 3d CNN model.\nTo simplify the problem, I am going to build a 3d CNN baseline model that only uses FLAIR images for training. The input is a series of patient's FLAIR images, and the output is the patient's MGMT value. So it is a sequence-to-point model.\nBut the number of MRI frames is different with each patient and type, how to define the correct input shape for the 3D CNN model?",
      "votes": null
    },
    {
      "id": "1468076",
      "postDate": "08/12/2021 08:49:27",
      "content": "<p>If you look at this <a href=\"https://www.kaggle.com/rluethy/efficientnet3d-with-one-mri-type#Functions-to-load-images\" target=\"_blank\">https://www.kaggle.com/rluethy/efficientnet3d-with-one-mri-type#Functions-to-load-images</a> <br>\nyou will notice that getting the total number of images from one <code>scan_id</code> and setting center number of images and then concatenate images by <code>NUM_IMAGES</code>  args.<br>\nso if you set <code>image size</code> 256 and <code>NUM_IMAGES</code> 64 then it's going to be [1, 256, 256, 64]. where 64 is 32 up and down from the center number of images(z-axis). or you can modify this logic as well.</p>",
      "rawMarkdown": "If you look at this [https://www.kaggle.com/rluethy/efficientnet3d-with-one-mri-type#Functions-to-load-images](https://www.kaggle.com/rluethy/efficientnet3d-with-one-mri-type#Functions-to-load-images) \nyou will notice that getting the total number of images from one `scan_id` and setting center number of images and then concatenate images by `NUM_IMAGES`  args.\nso if you set `image size` 256 and `NUM_IMAGES` 64 then it's going to be [1, 256, 256, 64]. where 64 is 32 up and down from the center number of images(z-axis). or you can modify this logic as well.",
      "votes": null
    },
    {
      "id": "1468147",
      "postDate": "08/12/2021 09:21:52",
      "content": "<p>But we can’t assume that every patient in the private test set has that much images for input. For example, if a patient only has one image in FLAIR folder, the model can’t predict such case.</p>",
      "rawMarkdown": "But we can’t assume that every patient in the private test set has that much images for input. For example, if a patient only has one image in FLAIR folder, the model can’t predict such case.",
      "votes": null
    },
    {
      "id": "1469651",
      "postDate": "08/13/2021 04:11:36",
      "content": "<p><a href=\"https://www.kaggle.com/bcghost\" target=\"_blank\">@bcghost</a> we <em>do</em> have access to the private test data, it's the <strong>test folder</strong> and all the images in FLAIR have at least over 20 images. Because of fluid attenuation, it's necessary to take many images.</p>",
      "rawMarkdown": "bcghost we *do* have access to the private test data, it's the **test folder** and all the images in FLAIR have at least over 20 images. Because of fluid attenuation, it's necessary to take many images.",
      "votes": null
    },
    {
      "id": "1470770",
      "postDate": "08/13/2021 17:49:16",
      "content": "<p>Great. Thanks for your information. Where did you find the minimal number of images for each folder?  Did you just test it via submission? I only knew the test folder and submission CSV will be replaced when we submit the submission. Did you hard-cord test the number of images by this way?</p>",
      "rawMarkdown": "Great. Thanks for your information. Where did you find the minimal number of images for each folder?  Did you just test it via submission? I only knew the test folder and submission CSV will be replaced when we submit the submission. Did you hard-cord test the number of images by this way?",
      "votes": null
    },
    {
      "id": "1471549",
      "postDate": "08/14/2021 09:31:42",
      "content": "<p>As far as I know, we won’t know the minimum number of images for each folder. </p>",
      "rawMarkdown": "As far as I know, we won’t know the minimum number of images for each folder.",
      "votes": null
    },
    {
      "id": "1471613",
      "postDate": "08/14/2021 10:38:39",
      "content": "<p>We <strong>don't</strong> have access to private test, that's hidden from us.</p>",
      "rawMarkdown": "We **don't** have access to private test, that's hidden from us.",
      "votes": null
    },
    {
      "id": "1472172",
      "postDate": "08/14/2021 17:19:11",
      "content": "<p>So I am considering data argument for images that are less than the slicing number, or let the input shape be [1, height, width, channels]. But I'm not sure if I only put one image into the 3d CNN network, will my 3D network learn the relationship between images?</p>",
      "rawMarkdown": "So I am considering data argument for images that are less than the slicing number, or let the input shape be [1, height, width, channels]. But I'm not sure if I only put one image into the 3d CNN network, will my 3D network learn the relationship between images?",
      "votes": null
    },
    {
      "id": "1479284",
      "postDate": "08/18/2021 11:34:04",
      "content": "<p>364 is the best and max sequence length you can simply crop the center of each image and can let it be 50 x 50 </p>\n<p>and in an overall [None , 364 ,  50 , 50 , 3]</p>",
      "rawMarkdown": "364 is the best and max sequence length you can simply crop the center of each image and can let it be 50 x 50 \n\nand in an overall [None , 364 ,  50 , 50 , 3]",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1468076,
      "author_name": "jinssaa",
      "author_url": "",
      "post_date": "08/12/2021 08:49:27",
      "content": "<p>If you look at this <a href=\"https://www.kaggle.com/rluethy/efficientnet3d-with-one-mri-type#Functions-to-load-images\" target=\"_blank\">https://www.kaggle.com/rluethy/efficientnet3d-with-one-mri-type#Functions-to-load-images</a> <br>\nyou will notice that getting the total number of images from one <code>scan_id</code> and setting center number of images and then concatenate images by <code>NUM_IMAGES</code>  args.<br>\nso if you set <code>image size</code> 256 and <code>NUM_IMAGES</code> 64 then it's going to be [1, 256, 256, 64]. where 64 is 32 up and down from the center number of images(z-axis). or you can modify this logic as well.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1468147,
          "author_name": "bcghost",
          "author_url": "",
          "post_date": "08/12/2021 09:21:52",
          "content": "<p>But we can’t assume that every patient in the private test set has that much images for input. For example, if a patient only has one image in FLAIR folder, the model can’t predict such case.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1469651,
          "author_name": "aristotle609",
          "author_url": "",
          "post_date": "08/13/2021 04:11:36",
          "content": "<p><a href=\"https://www.kaggle.com/bcghost\" target=\"_blank\">@bcghost</a> we <em>do</em> have access to the private test data, it's the <strong>test folder</strong> and all the images in FLAIR have at least over 20 images. Because of fluid attenuation, it's necessary to take many images.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1470770,
          "author_name": "bcghost",
          "author_url": "",
          "post_date": "08/13/2021 17:49:16",
          "content": "<p>Great. Thanks for your information. Where did you find the minimal number of images for each folder?  Did you just test it via submission? I only knew the test folder and submission CSV will be replaced when we submit the submission. Did you hard-cord test the number of images by this way?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1471549,
          "author_name": "hawkeat",
          "author_url": "",
          "post_date": "08/14/2021 09:31:42",
          "content": "<p>As far as I know, we won’t know the minimum number of images for each folder. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1471613,
          "author_name": "mrinath",
          "author_url": "",
          "post_date": "08/14/2021 10:38:39",
          "content": "<p>We <strong>don't</strong> have access to private test, that's hidden from us.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1472172,
          "author_name": "bcghost",
          "author_url": "",
          "post_date": "08/14/2021 17:19:11",
          "content": "<p>So I am considering data argument for images that are less than the slicing number, or let the input shape be [1, height, width, channels]. But I'm not sure if I only put one image into the 3d CNN network, will my 3D network learn the relationship between images?</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1479284,
      "author_name": "swaralipibose",
      "author_url": "",
      "post_date": "08/18/2021 11:34:04",
      "content": "<p>364 is the best and max sequence length you can simply crop the center of each image and can let it be 50 x 50 </p>\n<p>and in an overall [None , 364 ,  50 , 50 , 3]</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1467890": "I have trained a 2d CNN model, which treats every image independently, but the model failed to learn things from the data. Even the training accuracy increases, the validation accuracy never increases. I tried many methods to avoid overfitting, but I failed. Now I'm thinking to build a 3d CNN model.\nTo simplify the problem, I am going to build a 3d CNN baseline model that only uses FLAIR images for training. The input is a series of patient's FLAIR images, and the output is the patient's MGMT value. So it is a sequence-to-point model.\nBut the number of MRI frames is different with each patient and type, how to define the correct input shape for the 3D CNN model?",
    "1468076": "If you look at this [https://www.kaggle.com/rluethy/efficientnet3d-with-one-mri-type#Functions-to-load-images](https://www.kaggle.com/rluethy/efficientnet3d-with-one-mri-type#Functions-to-load-images) \nyou will notice that getting the total number of images from one `scan_id` and setting center number of images and then concatenate images by `NUM_IMAGES`  args.\nso if you set `image size` 256 and `NUM_IMAGES` 64 then it's going to be [1, 256, 256, 64]. where 64 is 32 up and down from the center number of images(z-axis). or you can modify this logic as well.",
    "1468147": "But we can’t assume that every patient in the private test set has that much images for input. For example, if a patient only has one image in FLAIR folder, the model can’t predict such case.",
    "1469651": "bcghost we *do* have access to the private test data, it's the **test folder** and all the images in FLAIR have at least over 20 images. Because of fluid attenuation, it's necessary to take many images.",
    "1470770": "Great. Thanks for your information. Where did you find the minimal number of images for each folder?  Did you just test it via submission? I only knew the test folder and submission CSV will be replaced when we submit the submission. Did you hard-cord test the number of images by this way?",
    "1471549": "As far as I know, we won’t know the minimum number of images for each folder.",
    "1471613": "We **don't** have access to private test, that's hidden from us.",
    "1472172": "So I am considering data argument for images that are less than the slicing number, or let the input shape be [1, height, width, channels]. But I'm not sure if I only put one image into the 3d CNN network, will my 3D network learn the relationship between images?",
    "1479284": "364 is the best and max sequence length you can simply crop the center of each image and can let it be 50 x 50 \n\nand in an overall [None , 364 ,  50 , 50 , 3]"
  },
  "source": "meta"
}