{
  "id": 186482,
  "title": "Variable input shape for 3d volume in CNN network",
  "url": "/competitions/osic-pulmonary-fibrosis-progression/discussion/186482",
  "author_name": "",
  "post_date": "2020-09-24T15:57:46.025987700Z",
  "votes": null,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I have converted the slices into NumPy arrays and for each slice, I have stacked the arrays to form a 3d volume for each ct scan. Since the size of each ct scan array depends on the number of slices / ct scan my 3d volume is of variable shape (number of slices<em>64</em>64).<br>\nNow I want to feed it in the CNN architecture but I am not able to due to <br>\n1) I am not able to convert it into tensor <br>\n2) In the first layer the input shape is to be fed but since it is variable I am not able to understand what to feed in input shape.</p>",
  "messages": [
    {
      "id": "1025518",
      "postDate": "09/24/2020 15:57:46",
      "content": "<p>I have converted the slices into NumPy arrays and for each slice, I have stacked the arrays to form a 3d volume for each ct scan. Since the size of each ct scan array depends on the number of slices / ct scan my 3d volume is of variable shape (number of slices<em>64</em>64).<br>\nNow I want to feed it in the CNN architecture but I am not able to due to <br>\n1) I am not able to convert it into tensor <br>\n2) In the first layer the input shape is to be fed but since it is variable I am not able to understand what to feed in input shape.</p>",
      "rawMarkdown": "I have converted the slices into NumPy arrays and for each slice, I have stacked the arrays to form a 3d volume for each ct scan. Since the size of each ct scan array depends on the number of slices / ct scan my 3d volume is of variable shape (number of slices*64*64).\nNow I want to feed it in the CNN architecture but I am not able to due to \n1) I am not able to convert it into tensor \n2) In the first layer the input shape is to be fed but since it is variable I am not able to understand what to feed in input shape.",
      "votes": null
    },
    {
      "id": "1025844",
      "postDate": "09/24/2020 19:52:04",
      "content": "<p>Standardize the shape/size.</p>",
      "rawMarkdown": "Standardize the shape/size.",
      "votes": null
    },
    {
      "id": "1026969",
      "postDate": "09/25/2020 17:41:21",
      "content": "<p>You can use the function <a href=\"https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.zoom.html\" target=\"_blank\">zoom </a> from scipy to reshape your array to a standard input. You can look at my <a href=\"https://www.kaggle.com/yohannwattiez/3d-cnn-mlp\" target=\"_blank\">notebook</a>. I also created a 3D array and reshape it into a constant shape.<br>\nI can't say why you can't convert it to a tensor. I don't have enough information to give you an answer.</p>",
      "rawMarkdown": "You can use the function [zoom ](https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.zoom.html) from scipy to reshape your array to a standard input. You can look at my [notebook](https://www.kaggle.com/yohannwattiez/3d-cnn-mlp). I also created a 3D array and reshape it into a constant shape.\nI can't say why you can't convert it to a tensor. I don't have enough information to give you an answer.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1026969,
      "author_name": "yohannwattiez",
      "author_url": "",
      "post_date": "09/25/2020 17:41:21",
      "content": "<p>You can use the function <a href=\"https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.zoom.html\" target=\"_blank\">zoom </a> from scipy to reshape your array to a standard input. You can look at my <a href=\"https://www.kaggle.com/yohannwattiez/3d-cnn-mlp\" target=\"_blank\">notebook</a>. I also created a 3D array and reshape it into a constant shape.<br>\nI can't say why you can't convert it to a tensor. I don't have enough information to give you an answer.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1025844,
      "author_name": "eladwar",
      "author_url": "",
      "post_date": "09/24/2020 19:52:04",
      "content": "<p>Standardize the shape/size.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1025518": "I have converted the slices into NumPy arrays and for each slice, I have stacked the arrays to form a 3d volume for each ct scan. Since the size of each ct scan array depends on the number of slices / ct scan my 3d volume is of variable shape (number of slices*64*64).\nNow I want to feed it in the CNN architecture but I am not able to due to \n1) I am not able to convert it into tensor \n2) In the first layer the input shape is to be fed but since it is variable I am not able to understand what to feed in input shape.",
    "1025844": "Standardize the shape/size.",
    "1026969": "You can use the function [zoom ](https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.zoom.html) from scipy to reshape your array to a standard input. You can look at my [notebook](https://www.kaggle.com/yohannwattiez/3d-cnn-mlp). I also created a 3D array and reshape it into a constant shape.\nI can't say why you can't convert it to a tensor. I don't have enough information to give you an answer."
  },
  "source": "meta"
}