{
  "id": 169121,
  "title": "Making use of CT scans: end-to-end model that uses CT scan latent features and tabular features",
  "url": "/competitions/osic-pulmonary-fibrosis-progression/discussion/169121",
  "author_name": "",
  "post_date": "2020-07-23T01:43:19.099468100Z",
  "votes": 42,
  "comment_count": 15,
  "views": 0,
  "content": "<p>I'm still not sure whether the approach below will work or not. But I'm very curious to see. Below there is a <a href=\"https://www.kaggle.com/carlossouza/end-to-end-model-ct-scans-tabular\">notebook</a> with the progress so far in implementing this approach. I couldn't finish as my GPU credits are over (need to tweak the code to run on TPU). \n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F915913%2F76cdaaece14e604a2479d83c383d1626%2Ffinal_5f18d00d86a6870013068112_270220.gif?generation=1595468509760198&amp;alt=media\" alt=\"\"></p>\n\n<p>I think the code in the notebook is very readable... would love to hear what you think:</p>\n\n<p><strong>Does this approach make sense?</strong></p>\n\n<p>Cheers!\nCarlos</p>",
  "messages": [
    {
      "id": "940498",
      "postDate": "07/23/2020 01:43:19",
      "content": "<p>I'm still not sure whether the approach below will work or not. But I'm very curious to see. Below there is a <a href=\"https://www.kaggle.com/carlossouza/end-to-end-model-ct-scans-tabular\">notebook</a> with the progress so far in implementing this approach. I couldn't finish as my GPU credits are over (need to tweak the code to run on TPU). \n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F915913%2F76cdaaece14e604a2479d83c383d1626%2Ffinal_5f18d00d86a6870013068112_270220.gif?generation=1595468509760198&amp;alt=media\" alt=\"\"></p>\n\n<p>I think the code in the notebook is very readable... would love to hear what you think:</p>\n\n<p><strong>Does this approach make sense?</strong></p>\n\n<p>Cheers!\nCarlos</p>",
      "rawMarkdown": "I'm still not sure whether the approach below will work or not. But I'm very curious to see. Below there is a [notebook](https://www.kaggle.com/carlossouza/end-to-end-model-ct-scans-tabular) with the progress so far in implementing this approach. I couldn't finish as my GPU credits are over (need to tweak the code to run on TPU). \n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F915913%2F76cdaaece14e604a2479d83c383d1626%2Ffinal_5f18d00d86a6870013068112_270220.gif?generation=1595468509760198&amp;alt=media)\n\nI think the code in the notebook is very readable... would love to hear what you think:\n\n**Does this approach make sense?**\n\nCheers!\nCarlos",
      "votes": null
    },
    {
      "id": "940535",
      "postDate": "07/23/2020 02:26:39",
      "content": "<p>sounds pretty good for me. </p>",
      "rawMarkdown": "sounds pretty good for me.",
      "votes": null
    },
    {
      "id": "941377",
      "postDate": "07/23/2020 07:36:27",
      "content": "<p>Hi <a href=\"/carlossouza\">@carlossouza</a>  of course the code is very readable. But I'd like another notebook that goes in detail through every step of image processing. Many Thks !!!</p>",
      "rawMarkdown": "Hi @carlossouza  of course the code is very readable. But I'd like another notebook that goes in detail through every step of image processing. Many Thks !!!",
      "votes": null
    },
    {
      "id": "941381",
      "postDate": "07/23/2020 07:41:09",
      "content": "<p>To me this approach makes sense, indeed at some extent we must combine CT scan features and tabular data. Now we have to wait for the fist results.</p>",
      "rawMarkdown": "To me this approach makes sense, indeed at some extent we must combine CT scan features and tabular data. Now we have to wait for the fist results.",
      "votes": null
    },
    {
      "id": "945950",
      "postDate": "07/26/2020 08:30:11",
      "content": "<p>Really nice notebook built on top of what <a href=\"/ulrich07\">@ulrich07</a>  had worked on.\nI was waiting for a notebook to understand how we can make this work in PyTorch as I am a beginner. But really excited about the results.</p>\n\n<p>I was even curious about how we could extract features from the images and use them with the metadata. Pretty interesting I'd say.</p>",
      "rawMarkdown": "Really nice notebook built on top of what @ulrich07  had worked on.\nI was waiting for a notebook to understand how we can make this work in PyTorch as I am a beginner. But really excited about the results.\n\nI was even curious about how we could extract features from the images and use them with the metadata. Pretty interesting I'd say.",
      "votes": null
    },
    {
      "id": "949519",
      "postDate": "07/28/2020 17:25:38",
      "content": "<p>Thanks! I actually just published a notebook showing how to extract the latent features: <a href=\"https://www.kaggle.com/carlossouza/osic-autoencoder-training\">https://www.kaggle.com/carlossouza/osic-autoencoder-training</a></p>",
      "rawMarkdown": "Thanks! I actually just published a notebook showing how to extract the latent features: https://www.kaggle.com/carlossouza/osic-autoencoder-training",
      "votes": null
    },
    {
      "id": "949524",
      "postDate": "07/28/2020 17:27:16",
      "content": "<p>Hi <a href=\"/ulrich07\">@ulrich07</a> , here's the notebook showing how to extract the latent features: <a href=\"https://www.kaggle.com/carlossouza/osic-autoencoder-training\">https://www.kaggle.com/carlossouza/osic-autoencoder-training</a></p>\n\n<p>It took me a while because I (unsuccessfully) tried to the training on TPUs. After a lot of frustration, I gave up, and did it on GPUs..</p>",
      "rawMarkdown": "Hi @ulrich07 , here's the notebook showing how to extract the latent features: https://www.kaggle.com/carlossouza/osic-autoencoder-training\n\nIt took me a while because I (unsuccessfully) tried to the training on TPUs. After a lot of frustration, I gave up, and did it on GPUs..",
      "votes": null
    },
    {
      "id": "949917",
      "postDate": "07/29/2020 04:28:32",
      "content": "<p>I am new to this challenge.\nInteresting approach, thanks for sharing <a href=\"/carlossouza\">@carlossouza</a>.</p>",
      "rawMarkdown": "I am new to this challenge.\nInteresting approach, thanks for sharing @carlossouza.",
      "votes": null
    },
    {
      "id": "951409",
      "postDate": "07/30/2020 06:08:56",
      "content": "<p>I was really looking forward to this one.</p>",
      "rawMarkdown": "I was really looking forward to this one.",
      "votes": null
    },
    {
      "id": "952640",
      "postDate": "07/31/2020 05:30:52",
      "content": "<p>Hey Carlos, great work so far this notebook, also the linked post from Srinjay was really helpful. Just a clarification, are you pre processing the CT scans into volumes like in Srinjay's post? I couldn't see if/where in your notebook you did that. If you are creating volumes, are you using channel padding to have a consistent batch when using Conv3d? I saw he was using an RNN at one point too. </p>\n\n<p>Thanks!</p>",
      "rawMarkdown": "Hey Carlos, great work so far this notebook, also the linked post from Srinjay was really helpful. Just a clarification, are you pre processing the CT scans into volumes like in Srinjay's post? I couldn't see if/where in your notebook you did that. If you are creating volumes, are you using channel padding to have a consistent batch when using Conv3d? I saw he was using an RNN at one point too. \n\nThanks!",
      "votes": null
    },
    {
      "id": "953389",
      "postDate": "07/31/2020 18:40:26",
      "content": "<p>Great work</p>",
      "rawMarkdown": "Great work",
      "votes": null
    },
    {
      "id": "953459",
      "postDate": "07/31/2020 19:54:01",
      "content": "<p>Yes, I'm feeding the model batches of 3D images, with an added dimension for a channel. Model is feed tensors sized:</p>\n\n<p>N (batch size) x 1 (channel) x 40 (slices) x 256 (height) x 256 (width)</p>\n\n<p>I'm not using RNNs, too advanced for me :)\nAll padding settings are the default PyTorch settings, as you can see in the AutoEncoder constructor.</p>\n\n<p>Hope it helps! Cheers!</p>",
      "rawMarkdown": "Yes, I'm feeding the model batches of 3D images, with an added dimension for a channel. Model is feed tensors sized:\n\nN (batch size) x 1 (channel) x 40 (slices) x 256 (height) x 256 (width)\n\nI'm not using RNNs, too advanced for me :)\nAll padding settings are the default PyTorch settings, as you can see in the AutoEncoder constructor.\n\nHope it helps! Cheers!",
      "votes": null
    },
    {
      "id": "954505",
      "postDate": "08/01/2020 19:30:27",
      "content": "<p>Awesome! Thanks so much for the reply. The padding I was wondering about was more about how you handle the variation in the amount of CT images per patient. For example one has ~400 slice images, and another only has 8 slice images. So I was thinking you might be padding with a tensor of ones for a folder that only has 8 images to feed the model with 40 slice images</p>",
      "rawMarkdown": "Awesome! Thanks so much for the reply. The padding I was wondering about was more about how you handle the variation in the amount of CT images per patient. For example one has ~400 slice images, and another only has 8 slice images. So I was thinking you might be padding with a tensor of ones for a folder that only has 8 images to feed the model with 40 slice images",
      "votes": null
    },
    {
      "id": "987656",
      "postDate": "08/27/2020 12:24:20",
      "content": "<p>Hey <a href=\"https://www.kaggle.com/carlossouza\" target=\"_blank\">@carlossouza</a>. Can you explain me the reason why you choose to use an Auto Encoder instead of a normal CNN-Architecture with decreasing layer size? I'm new to this field but in mind the cut off Auto Encoder outputs the most relevant features just like a normal CNN would do? </p>",
      "rawMarkdown": "Hey @carlossouza. Can you explain me the reason why you choose to use an Auto Encoder instead of a normal CNN-Architecture with decreasing layer size? I'm new to this field but in mind the cut off Auto Encoder outputs the most relevant features just like a normal CNN would do?",
      "votes": null
    },
    {
      "id": "988296",
      "postDate": "08/28/2020 00:39:57",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/foodaholic\" target=\"_blank\">@foodaholic</a> … how would you use a normal CNN to learn latent features, if they are by definition unobserved? IMHO using AutoEncoders (actually Variational AutoEncoders would be better, but that's another topic) is the only way to learn latent features. I don't see any other way to learn unobserved characteristics other than using unsupervised learning.. Cheers!</p>",
      "rawMarkdown": "Hi @foodaholic ... how would you use a normal CNN to learn latent features, if they are by definition unobserved? IMHO using AutoEncoders (actually Variational AutoEncoders would be better, but that's another topic) is the only way to learn latent features. I don't see any other way to learn unobserved characteristics other than using unsupervised learning.. Cheers!",
      "votes": null
    },
    {
      "id": "988824",
      "postDate": "08/28/2020 09:59:54",
      "content": "<p>Well this makes absolutely sense. I somehow didn't see the fact that those features are learned unsupervised..Thanks for the explanation! Learned a new thing today 😁</p>\n<p>Btw: Did you run some successful experiments with VAEs?</p>",
      "rawMarkdown": "Well this makes absolutely sense. I somehow didn't see the fact that those features are learned unsupervised..Thanks for the explanation! Learned a new thing today 😁\n\nBtw: Did you run some successful experiments with VAEs?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 987656,
      "author_name": "foodaholic",
      "author_url": "",
      "post_date": "08/27/2020 12:24:20",
      "content": "<p>Hey <a href=\"https://www.kaggle.com/carlossouza\" target=\"_blank\">@carlossouza</a>. Can you explain me the reason why you choose to use an Auto Encoder instead of a normal CNN-Architecture with decreasing layer size? I'm new to this field but in mind the cut off Auto Encoder outputs the most relevant features just like a normal CNN would do? </p>",
      "votes": null,
      "replies": [
        {
          "id": 988296,
          "author_name": "carlossouza",
          "author_url": "",
          "post_date": "08/28/2020 00:39:57",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/foodaholic\" target=\"_blank\">@foodaholic</a> … how would you use a normal CNN to learn latent features, if they are by definition unobserved? IMHO using AutoEncoders (actually Variational AutoEncoders would be better, but that's another topic) is the only way to learn latent features. I don't see any other way to learn unobserved characteristics other than using unsupervised learning.. Cheers!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 988824,
          "author_name": "foodaholic",
          "author_url": "",
          "post_date": "08/28/2020 09:59:54",
          "content": "<p>Well this makes absolutely sense. I somehow didn't see the fact that those features are learned unsupervised..Thanks for the explanation! Learned a new thing today 😁</p>\n<p>Btw: Did you run some successful experiments with VAEs?</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 940535,
      "author_name": "rpsantosakaggle",
      "author_url": "",
      "post_date": "07/23/2020 02:26:39",
      "content": "<p>sounds pretty good for me. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 941377,
      "author_name": "ulrich07",
      "author_url": "",
      "post_date": "07/23/2020 07:36:27",
      "content": "<p>Hi <a href=\"/carlossouza\">@carlossouza</a>  of course the code is very readable. But I'd like another notebook that goes in detail through every step of image processing. Many Thks !!!</p>",
      "votes": null,
      "replies": [
        {
          "id": 941381,
          "author_name": "ulrich07",
          "author_url": "",
          "post_date": "07/23/2020 07:41:09",
          "content": "<p>To me this approach makes sense, indeed at some extent we must combine CT scan features and tabular data. Now we have to wait for the fist results.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 949524,
          "author_name": "carlossouza",
          "author_url": "",
          "post_date": "07/28/2020 17:27:16",
          "content": "<p>Hi <a href=\"/ulrich07\">@ulrich07</a> , here's the notebook showing how to extract the latent features: <a href=\"https://www.kaggle.com/carlossouza/osic-autoencoder-training\">https://www.kaggle.com/carlossouza/osic-autoencoder-training</a></p>\n\n<p>It took me a while because I (unsuccessfully) tried to the training on TPUs. After a lot of frustration, I gave up, and did it on GPUs..</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 949917,
          "author_name": "samuelchen",
          "author_url": "",
          "post_date": "07/29/2020 04:28:32",
          "content": "<p>I am new to this challenge.\nInteresting approach, thanks for sharing <a href=\"/carlossouza\">@carlossouza</a>.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 945950,
      "author_name": "brownpanther",
      "author_url": "",
      "post_date": "07/26/2020 08:30:11",
      "content": "<p>Really nice notebook built on top of what <a href=\"/ulrich07\">@ulrich07</a>  had worked on.\nI was waiting for a notebook to understand how we can make this work in PyTorch as I am a beginner. But really excited about the results.</p>\n\n<p>I was even curious about how we could extract features from the images and use them with the metadata. Pretty interesting I'd say.</p>",
      "votes": null,
      "replies": [
        {
          "id": 949519,
          "author_name": "carlossouza",
          "author_url": "",
          "post_date": "07/28/2020 17:25:38",
          "content": "<p>Thanks! I actually just published a notebook showing how to extract the latent features: <a href=\"https://www.kaggle.com/carlossouza/osic-autoencoder-training\">https://www.kaggle.com/carlossouza/osic-autoencoder-training</a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 951409,
          "author_name": "brownpanther",
          "author_url": "",
          "post_date": "07/30/2020 06:08:56",
          "content": "<p>I was really looking forward to this one.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 952640,
      "author_name": "dannyk2018",
      "author_url": "",
      "post_date": "07/31/2020 05:30:52",
      "content": "<p>Hey Carlos, great work so far this notebook, also the linked post from Srinjay was really helpful. Just a clarification, are you pre processing the CT scans into volumes like in Srinjay's post? I couldn't see if/where in your notebook you did that. If you are creating volumes, are you using channel padding to have a consistent batch when using Conv3d? I saw he was using an RNN at one point too. </p>\n\n<p>Thanks!</p>",
      "votes": null,
      "replies": [
        {
          "id": 953459,
          "author_name": "carlossouza",
          "author_url": "",
          "post_date": "07/31/2020 19:54:01",
          "content": "<p>Yes, I'm feeding the model batches of 3D images, with an added dimension for a channel. Model is feed tensors sized:</p>\n\n<p>N (batch size) x 1 (channel) x 40 (slices) x 256 (height) x 256 (width)</p>\n\n<p>I'm not using RNNs, too advanced for me :)\nAll padding settings are the default PyTorch settings, as you can see in the AutoEncoder constructor.</p>\n\n<p>Hope it helps! Cheers!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 954505,
          "author_name": "dannyk2018",
          "author_url": "",
          "post_date": "08/01/2020 19:30:27",
          "content": "<p>Awesome! Thanks so much for the reply. The padding I was wondering about was more about how you handle the variation in the amount of CT images per patient. For example one has ~400 slice images, and another only has 8 slice images. So I was thinking you might be padding with a tensor of ones for a folder that only has 8 images to feed the model with 40 slice images</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 953389,
      "author_name": "madushan1996",
      "author_url": "",
      "post_date": "07/31/2020 18:40:26",
      "content": "<p>Great work</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "940498": "I'm still not sure whether the approach below will work or not. But I'm very curious to see. Below there is a [notebook](https://www.kaggle.com/carlossouza/end-to-end-model-ct-scans-tabular) with the progress so far in implementing this approach. I couldn't finish as my GPU credits are over (need to tweak the code to run on TPU). \n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F915913%2F76cdaaece14e604a2479d83c383d1626%2Ffinal_5f18d00d86a6870013068112_270220.gif?generation=1595468509760198&amp;alt=media)\n\nI think the code in the notebook is very readable... would love to hear what you think:\n\n**Does this approach make sense?**\n\nCheers!\nCarlos",
    "940535": "sounds pretty good for me.",
    "941377": "Hi @carlossouza  of course the code is very readable. But I'd like another notebook that goes in detail through every step of image processing. Many Thks !!!",
    "941381": "To me this approach makes sense, indeed at some extent we must combine CT scan features and tabular data. Now we have to wait for the fist results.",
    "945950": "Really nice notebook built on top of what @ulrich07  had worked on.\nI was waiting for a notebook to understand how we can make this work in PyTorch as I am a beginner. But really excited about the results.\n\nI was even curious about how we could extract features from the images and use them with the metadata. Pretty interesting I'd say.",
    "949519": "Thanks! I actually just published a notebook showing how to extract the latent features: https://www.kaggle.com/carlossouza/osic-autoencoder-training",
    "949524": "Hi @ulrich07 , here's the notebook showing how to extract the latent features: https://www.kaggle.com/carlossouza/osic-autoencoder-training\n\nIt took me a while because I (unsuccessfully) tried to the training on TPUs. After a lot of frustration, I gave up, and did it on GPUs..",
    "949917": "I am new to this challenge.\nInteresting approach, thanks for sharing @carlossouza.",
    "951409": "I was really looking forward to this one.",
    "952640": "Hey Carlos, great work so far this notebook, also the linked post from Srinjay was really helpful. Just a clarification, are you pre processing the CT scans into volumes like in Srinjay's post? I couldn't see if/where in your notebook you did that. If you are creating volumes, are you using channel padding to have a consistent batch when using Conv3d? I saw he was using an RNN at one point too. \n\nThanks!",
    "953389": "Great work",
    "953459": "Yes, I'm feeding the model batches of 3D images, with an added dimension for a channel. Model is feed tensors sized:\n\nN (batch size) x 1 (channel) x 40 (slices) x 256 (height) x 256 (width)\n\nI'm not using RNNs, too advanced for me :)\nAll padding settings are the default PyTorch settings, as you can see in the AutoEncoder constructor.\n\nHope it helps! Cheers!",
    "954505": "Awesome! Thanks so much for the reply. The padding I was wondering about was more about how you handle the variation in the amount of CT images per patient. For example one has ~400 slice images, and another only has 8 slice images. So I was thinking you might be padding with a tensor of ones for a folder that only has 8 images to feed the model with 40 slice images",
    "987656": "Hey @carlossouza. Can you explain me the reason why you choose to use an Auto Encoder instead of a normal CNN-Architecture with decreasing layer size? I'm new to this field but in mind the cut off Auto Encoder outputs the most relevant features just like a normal CNN would do?",
    "988296": "Hi @foodaholic ... how would you use a normal CNN to learn latent features, if they are by definition unobserved? IMHO using AutoEncoders (actually Variational AutoEncoders would be better, but that's another topic) is the only way to learn latent features. I don't see any other way to learn unobserved characteristics other than using unsupervised learning.. Cheers!",
    "988824": "Well this makes absolutely sense. I somehow didn't see the fact that those features are learned unsupervised..Thanks for the explanation! Learned a new thing today 😁\n\nBtw: Did you run some successful experiments with VAEs?"
  },
  "source": "meta"
}