{
  "id": 362669,
  "title": "8th Place Solution + Code",
  "url": "/competitions/rsna-2022-cervical-spine-fracture-detection/discussion/362669",
  "author_name": "Harshit Sheoran",
  "post_date": "2022-10-28T13:16:03.748000",
  "votes": 45,
  "comment_count": 11,
  "views": 0,
  "content": "<p>Thanks to the organizers for hosting RSNA 2022 with such a huge diversity of data, there are so many approaches to learn from.</p>\n<p>Many Many Congratulations to the winners and everyone who completed their goals. For me, my goal was to get my first gold to be a solo gold.</p>\n<h2>Summary</h2>\n<p>[NOTE]: I use \"vertebrae\" and \"bone\" interchangeably</p>\n<p>-Sagittal segmentation model to classify which image belongs to what vertebrae in a single go<br>\n-Bone segmentation model to crop the ROI<br>\n-Slice-level classification model<br>\n-RNN on extracted features</p>\n<h2>Sagittal Segmentation</h2>\n<p>I trained a Unet-B1 binary segmentation model on sagittal view, 0 for background and 1 for bone, used this model's pretrained weights to train another model on the same data with class 0 for background class 1 for C1… class 7 for C7 and class 8 for any bone other than C1-C7</p>\n<p>I predicted the whole dataset with it to assign bone to slice.</p>\n<h2>Bone Segmentation</h2>\n<p>I trained a Unet-B1 segmentation model (weights not taken from sagittal model) on the slices, this time in axial view with the same 8 classes.</p>\n<p>I predicted the whole dataset and got ROI bounding box for every slice.</p>\n<h2>Data Preparation</h2>\n<p>Before we get into how I did slice-level classification, we have take in mind the data trick which made this approach possible and was overlooked by most people, it is more of an assumption as the organizers have not confirmed this:</p>\n<p>Every slice which has a fractured bounding box annotation, is fractured, and for that particular patient, every other slice is non fractured…</p>\n<p>Now, to balance out the dataset and all, long story short, I took all the slices from train_bounding_boxes.csv as fractured=1, every other slice for that patient as fractured=0, 280 patients which do not have any fractures meaning that all their slices is also fractured=0</p>\n<p>Then I took the liberty to clear the data by removing all the non-fractured slices which have label either 0 or 8 (referenced earlier in the Sagittal Segmentation).  </p>\n<p>Now we have a dataset with 515 patients and a bit over 100,000 slices with just about 7% of them labeled as fractured.</p>\n<h2>Slice-Level Classification</h2>\n<p>I trained a binary-classification efficientnet b5 model, with image size of 456x456<br>\nI used 2.5D for the slice with [slice-1, slice, slice+1] as 3 channels, cropped bone ROI and perfectly tuned the augmentations, the interesting thing I did for augmentation is I did resize to preserve aspect ratio with this bit of code</p>\n<p><code>A.Compose([</code><br>\n<code>A.LongestMaxSize(CFG.SZ_H),</code><br>\n<code>A.PadIfNeeded(CFG.SZ_H, CFG.SZ_W, border_mode=0, p=1),</code></p>\n<p>And now the input looks like this, this image is labeled fractured</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1794509%2Fd15c9728ee434337e2021690caf4d021%2Fdownload.png?generation=1666959968765797&amp;alt=media\" alt=\"\"></p>\n<p>I achieved .916 slice-level AUC doing this, and then I did pseudo on rest of dataset to achieve over .94 AUC, there were many different approaches I did pseudo in just to end up a bit over .94 AUC with most of them so I won't go into which way I finalized upon as it needs not to be very specific, the point to keep in mind is that not all the remaining ~1500 patients are going to be good as pseudo label and don't waste resources pseudo-labeling the images which do not even have potential of being fractured, you can know this from competition's train.csv file.</p>\n<p>Now, predicting on all of the images of a patient in inference and then using <a href=\"https://www.kaggle.com/competitions/rsna-str-pulmonary-embolism-detection/discussion/193422\" target=\"_blank\">this</a> with modifications, I achieved a .26 public which scored .27 in private (most of my other .26 public scores were not this robust though)..</p>\n<h2>RNN</h2>\n<p>Input would be BSx64x2048, if it a vertebrae has less than 64 slices then pad zeros, else take first 64 slices.</p>\n<p>I used 2x GRU bidirectional layers, output fed both into an Attention and a Conv1D layer, concatenated the output of those 2 layers and then reshaped to (BS/7)x7x2048, flattening out to (BS/7)x2048*7 feeding into a linear to get (BS/7)x8 output.</p>\n<p>The input was sent in with consideration in mind that the output will be a proper study-level, if it does not make sense, either I am explaining it wrong or it is completely wrong, I don't any experience with 1D or RNN models but with a lot of tries, this is what worked for me, scoring me a .23 public and .26 private</p>\n<h2>What did not work:</h2>\n<p>Lots of ideas but the important ones are:</p>\n<p>Normally not something to put in here, but, ensemble, my ensembles did not work, probably because I do not know how to make RNN models, I think that was my major shortcoming in this competition.</p>\n<p>I did get a bit better CV using ensemble, but it did not reflect on Public and Private LB.</p>\n<p>Aux Loss with bounding box, like it was used in last year's RSNA</p>\n<p>Training study-level with hope to guide it with slice-level predictions, I did it exactly like many top solutions have done, but in my case it did not do better than slice-level.</p>\n<p>Competition was very much of a rollercoaster for me with lots false alarms of better CV just to not follow on LB (and private leaderboard consistently followed public leaderboard in my submissions below .26 public)</p>\n<p>I struggled with RNN models for quite a long time stuck on .26, got to know the importance of them for the task.</p>\n<h2>Code</h2>\n<p><a href=\"https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-1-sagittal\" target=\"_blank\">1. Sagittal</a><br>\n<a href=\"https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-2-axial\" target=\"_blank\">2. Axial</a><br>\n<a href=\"https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-3-fracture\" target=\"_blank\">3. Fracture</a><br>\n<a href=\"https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-4-study\" target=\"_blank\">4. Study</a><br>\n<a href=\"https://www.kaggle.com/code/harshitsheoran/8th-place-inference/\" target=\"_blank\">5. Inference</a></p>",
  "messages": [
    {
      "id": 2007762,
      "postDate": "2022-10-28T13:16:03.747Z",
      "content": "<p>Thanks to the organizers for hosting RSNA 2022 with such a huge diversity of data, there are so many approaches to learn from.</p>\n<p>Many Many Congratulations to the winners and everyone who completed their goals. For me, my goal was to get my first gold to be a solo gold.</p>\n<h2>Summary</h2>\n<p>[NOTE]: I use \"vertebrae\" and \"bone\" interchangeably</p>\n<p>-Sagittal segmentation model to classify which image belongs to what vertebrae in a single go<br>\n-Bone segmentation model to crop the ROI<br>\n-Slice-level classification model<br>\n-RNN on extracted features</p>\n<h2>Sagittal Segmentation</h2>\n<p>I trained a Unet-B1 binary segmentation model on sagittal view, 0 for background and 1 for bone, used this model's pretrained weights to train another model on the same data with class 0 for background class 1 for C1… class 7 for C7 and class 8 for any bone other than C1-C7</p>\n<p>I predicted the whole dataset with it to assign bone to slice.</p>\n<h2>Bone Segmentation</h2>\n<p>I trained a Unet-B1 segmentation model (weights not taken from sagittal model) on the slices, this time in axial view with the same 8 classes.</p>\n<p>I predicted the whole dataset and got ROI bounding box for every slice.</p>\n<h2>Data Preparation</h2>\n<p>Before we get into how I did slice-level classification, we have take in mind the data trick which made this approach possible and was overlooked by most people, it is more of an assumption as the organizers have not confirmed this:</p>\n<p>Every slice which has a fractured bounding box annotation, is fractured, and for that particular patient, every other slice is non fractured…</p>\n<p>Now, to balance out the dataset and all, long story short, I took all the slices from train_bounding_boxes.csv as fractured=1, every other slice for that patient as fractured=0, 280 patients which do not have any fractures meaning that all their slices is also fractured=0</p>\n<p>Then I took the liberty to clear the data by removing all the non-fractured slices which have label either 0 or 8 (referenced earlier in the Sagittal Segmentation).  </p>\n<p>Now we have a dataset with 515 patients and a bit over 100,000 slices with just about 7% of them labeled as fractured.</p>\n<h2>Slice-Level Classification</h2>\n<p>I trained a binary-classification efficientnet b5 model, with image size of 456x456<br>\nI used 2.5D for the slice with [slice-1, slice, slice+1] as 3 channels, cropped bone ROI and perfectly tuned the augmentations, the interesting thing I did for augmentation is I did resize to preserve aspect ratio with this bit of code</p>\n<p><code>A.Compose([</code><br>\n<code>A.LongestMaxSize(CFG.SZ_H),</code><br>\n<code>A.PadIfNeeded(CFG.SZ_H, CFG.SZ_W, border_mode=0, p=1),</code></p>\n<p>And now the input looks like this, this image is labeled fractured</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1794509%2Fd15c9728ee434337e2021690caf4d021%2Fdownload.png?generation=1666959968765797&amp;alt=media\" alt=\"\"></p>\n<p>I achieved .916 slice-level AUC doing this, and then I did pseudo on rest of dataset to achieve over .94 AUC, there were many different approaches I did pseudo in just to end up a bit over .94 AUC with most of them so I won't go into which way I finalized upon as it needs not to be very specific, the point to keep in mind is that not all the remaining ~1500 patients are going to be good as pseudo label and don't waste resources pseudo-labeling the images which do not even have potential of being fractured, you can know this from competition's train.csv file.</p>\n<p>Now, predicting on all of the images of a patient in inference and then using <a href=\"https://www.kaggle.com/competitions/rsna-str-pulmonary-embolism-detection/discussion/193422\" target=\"_blank\">this</a> with modifications, I achieved a .26 public which scored .27 in private (most of my other .26 public scores were not this robust though)..</p>\n<h2>RNN</h2>\n<p>Input would be BSx64x2048, if it a vertebrae has less than 64 slices then pad zeros, else take first 64 slices.</p>\n<p>I used 2x GRU bidirectional layers, output fed both into an Attention and a Conv1D layer, concatenated the output of those 2 layers and then reshaped to (BS/7)x7x2048, flattening out to (BS/7)x2048*7 feeding into a linear to get (BS/7)x8 output.</p>\n<p>The input was sent in with consideration in mind that the output will be a proper study-level, if it does not make sense, either I am explaining it wrong or it is completely wrong, I don't any experience with 1D or RNN models but with a lot of tries, this is what worked for me, scoring me a .23 public and .26 private</p>\n<h2>What did not work:</h2>\n<p>Lots of ideas but the important ones are:</p>\n<p>Normally not something to put in here, but, ensemble, my ensembles did not work, probably because I do not know how to make RNN models, I think that was my major shortcoming in this competition.</p>\n<p>I did get a bit better CV using ensemble, but it did not reflect on Public and Private LB.</p>\n<p>Aux Loss with bounding box, like it was used in last year's RSNA</p>\n<p>Training study-level with hope to guide it with slice-level predictions, I did it exactly like many top solutions have done, but in my case it did not do better than slice-level.</p>\n<p>Competition was very much of a rollercoaster for me with lots false alarms of better CV just to not follow on LB (and private leaderboard consistently followed public leaderboard in my submissions below .26 public)</p>\n<p>I struggled with RNN models for quite a long time stuck on .26, got to know the importance of them for the task.</p>\n<h2>Code</h2>\n<p><a href=\"https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-1-sagittal\" target=\"_blank\">1. Sagittal</a><br>\n<a href=\"https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-2-axial\" target=\"_blank\">2. Axial</a><br>\n<a href=\"https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-3-fracture\" target=\"_blank\">3. Fracture</a><br>\n<a href=\"https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-4-study\" target=\"_blank\">4. Study</a><br>\n<a href=\"https://www.kaggle.com/code/harshitsheoran/8th-place-inference/\" target=\"_blank\">5. Inference</a></p>",
      "rawMarkdown": "Thanks to the organizers for hosting RSNA 2022 with such a huge diversity of data, there are so many approaches to learn from.\n\nMany Many Congratulations to the winners and everyone who completed their goals. For me, my goal was to get my first gold to be a solo gold.\n\n##Summary\n\n[NOTE]: I use \"vertebrae\" and \"bone\" interchangeably\n\n-Sagittal segmentation model to classify which image belongs to what vertebrae in a single go\n-Bone segmentation model to crop the ROI\n-Slice-level classification model\n-RNN on extracted features\n\n##Sagittal Segmentation\n\nI trained a Unet-B1 binary segmentation model on sagittal view, 0 for background and 1 for bone, used this model's pretrained weights to train another model on the same data with class 0 for background class 1 for C1... class 7 for C7 and class 8 for any bone other than C1-C7\n\nI predicted the whole dataset with it to assign bone to slice.\n\n##Bone Segmentation\nI trained a Unet-B1 segmentation model (weights not taken from sagittal model) on the slices, this time in axial view with the same 8 classes.\n\nI predicted the whole dataset and got ROI bounding box for every slice.\n\n##Data Preparation\n\nBefore we get into how I did slice-level classification, we have take in mind the data trick which made this approach possible and was overlooked by most people, it is more of an assumption as the organizers have not confirmed this:\n\nEvery slice which has a fractured bounding box annotation, is fractured, and for that particular patient, every other slice is non fractured...\n\nNow, to balance out the dataset and all, long story short, I took all the slices from train_bounding_boxes.csv as fractured=1, every other slice for that patient as fractured=0, 280 patients which do not have any fractures meaning that all their slices is also fractured=0\n\nThen I took the liberty to clear the data by removing all the non-fractured slices which have label either 0 or 8 (referenced earlier in the Sagittal Segmentation).  \n\nNow we have a dataset with 515 patients and a bit over 100,000 slices with just about 7% of them labeled as fractured.\n\n##Slice-Level Classification\n\nI trained a binary-classification efficientnet b5 model, with image size of 456x456\nI used 2.5D for the slice with [slice-1, slice, slice+1] as 3 channels, cropped bone ROI and perfectly tuned the augmentations, the interesting thing I did for augmentation is I did resize to preserve aspect ratio with this bit of code\n\n`A.Compose([`\n`        A.LongestMaxSize(CFG.SZ_H),`\n`        A.PadIfNeeded(CFG.SZ_H, CFG.SZ_W, border_mode=0, p=1),`\n\nAnd now the input looks like this, this image is labeled fractured\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1794509%2Fd15c9728ee434337e2021690caf4d021%2Fdownload.png?generation=1666959968765797&alt=media)\n\nI achieved .916 slice-level AUC doing this, and then I did pseudo on rest of dataset to achieve over .94 AUC, there were many different approaches I did pseudo in just to end up a bit over .94 AUC with most of them so I won't go into which way I finalized upon as it needs not to be very specific, the point to keep in mind is that not all the remaining ~1500 patients are going to be good as pseudo label and don't waste resources pseudo-labeling the images which do not even have potential of being fractured, you can know this from competition's train.csv file.\n\nNow, predicting on all of the images of a patient in inference and then using [this](https://www.kaggle.com/competitions/rsna-str-pulmonary-embolism-detection/discussion/193422) with modifications, I achieved a .26 public which scored .27 in private (most of my other .26 public scores were not this robust though)..\n\n##RNN\nInput would be BSx64x2048, if it a vertebrae has less than 64 slices then pad zeros, else take first 64 slices.\n\nI used 2x GRU bidirectional layers, output fed both into an Attention and a Conv1D layer, concatenated the output of those 2 layers and then reshaped to (BS/7)x7x2048, flattening out to (BS/7)x2048*7 feeding into a linear to get (BS/7)x8 output.\n\nThe input was sent in with consideration in mind that the output will be a proper study-level, if it does not make sense, either I am explaining it wrong or it is completely wrong, I don't any experience with 1D or RNN models but with a lot of tries, this is what worked for me, scoring me a .23 public and .26 private\n\n##What did not work:\n\nLots of ideas but the important ones are:\n\nNormally not something to put in here, but, ensemble, my ensembles did not work, probably because I do not know how to make RNN models, I think that was my major shortcoming in this competition.\n\nI did get a bit better CV using ensemble, but it did not reflect on Public and Private LB.\n\nAux Loss with bounding box, like it was used in last year's RSNA\n\nTraining study-level with hope to guide it with slice-level predictions, I did it exactly like many top solutions have done, but in my case it did not do better than slice-level.\n\nCompetition was very much of a rollercoaster for me with lots false alarms of better CV just to not follow on LB (and private leaderboard consistently followed public leaderboard in my submissions below .26 public)\n\nI struggled with RNN models for quite a long time stuck on .26, got to know the importance of them for the task.\n\n##Code\n\n[1. Sagittal](https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-1-sagittal)\n[2. Axial](https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-2-axial)\n[3. Fracture](https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-3-fracture)\n[4. Study](https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-4-study)\n[5. Inference](https://www.kaggle.com/code/harshitsheoran/8th-place-inference/)",
      "votes": 45
    },
    {
      "id": 2010521,
      "postDate": "2022-10-30T20:17:38.470Z",
      "content": "<p>Congratulation for your work <a href=\"https://www.kaggle.com/harshitsheoran\" target=\"_blank\">@harshitsheoran</a> </p>",
      "rawMarkdown": "Congratulation for your work @harshitsheoran ",
      "votes": 1
    },
    {
      "id": 2008700,
      "postDate": "2022-10-29T08:58:47.390Z",
      "content": "<p>Congratulations <a href=\"https://www.kaggle.com/harshitsheoran\" target=\"_blank\">@harshitsheoran</a>! Your work taught me a lot about handling medical data during this competition..amazing result!</p>",
      "rawMarkdown": "Congratulations @harshitsheoran! Your work taught me a lot about handling medical data during this competition..amazing result!",
      "votes": 1
    },
    {
      "id": 2008424,
      "postDate": "2022-10-29T03:58:54.153Z",
      "content": "<p>Congrats on gold medal and becoming master <a href=\"https://www.kaggle.com/harshitsheoran\" target=\"_blank\">@harshitsheoran</a> </p>",
      "rawMarkdown": "Congrats on gold medal and becoming master @harshitsheoran ",
      "votes": 1
    },
    {
      "id": 2008151,
      "postDate": "2022-10-28T19:26:51.733Z",
      "content": "<p>Congrats to you for the superior result! Thanks for the good explanation too! All the best for the future too <a href=\"https://www.kaggle.com/harshitsheoran\" target=\"_blank\">@harshitsheoran</a> </p>",
      "rawMarkdown": "Congrats to you for the superior result! Thanks for the good explanation too! All the best for the future too @harshitsheoran ",
      "votes": 1
    },
    {
      "id": 2008122,
      "postDate": "2022-10-28T19:02:01.367Z",
      "content": "<p>Congrats on the solo gold! it is too precious.<br>\nOne question: How did you use sagittal segmentation? Isn't axial segmentation with labels 0+7+1  already sufficient, since you are continuing with axial images? In other words, what information is sagittal segmentation adding to the axial-slice level segmentations you do (on the slices of the segmented 87 studies). Or is it just an issue of blending segmentation results in both axis?</p>",
      "rawMarkdown": "Congrats on the solo gold! it is too precious.\nOne question: How did you use sagittal segmentation? Isn't axial segmentation with labels 0+7+1  already sufficient, since you are continuing with axial images? In other words, what information is sagittal segmentation adding to the axial-slice level segmentations you do (on the slices of the segmented 87 studies). Or is it just an issue of blending segmentation results in both axis?",
      "votes": 1,
      "replies": [
        {
          "id": 2008332,
          "postDate": "2022-10-29T00:12:58.307Z",
          "content": "<p>It does not particularly add anything, and it is not a blend, I was just experimenting that how I can know labels (labels here is vertebrae number) of axial view using sagittal view and then I kept it, as it was so efficient, just a single pass image to know it all</p>",
          "rawMarkdown": "It does not particularly add anything, and it is not a blend, I was just experimenting that how I can know labels (labels here is vertebrae number) of axial view using sagittal view and then I kept it, as it was so efficient, just a single pass image to know it all",
          "votes": 1
        },
        {
          "id": 2008449,
          "postDate": "2022-10-29T04:40:37.830Z",
          "content": "<p>Thank you 👍</p>",
          "rawMarkdown": "Thank you 👍"
        }
      ]
    },
    {
      "id": 2007950,
      "postDate": "2022-10-28T15:41:15.537Z",
      "content": "<p>Thank you, that clarifies my ideas about the use of bounding boxes. I had also asked myself the question of unbroken vertebrae.</p>",
      "rawMarkdown": "Thank you, that clarifies my ideas about the use of bounding boxes. I had also asked myself the question of unbroken vertebrae.",
      "votes": 1
    },
    {
      "id": 2007856,
      "postDate": "2022-10-28T14:48:11.980Z",
      "content": "<p>Very clever data trick and nice explanation.</p>",
      "rawMarkdown": "Very clever data trick and nice explanation.",
      "votes": 1
    },
    {
      "id": 2007851,
      "postDate": "2022-10-28T14:43:29.013Z",
      "content": "<p>Great work and nice find on the fracture boxes. </p>",
      "rawMarkdown": "Great work and nice find on the fracture boxes. ",
      "votes": 1
    },
    {
      "id": 2007975,
      "postDate": "2022-10-28T16:08:58.690Z",
      "content": "<p>Congrats! A new GM candidate!</p>",
      "rawMarkdown": "Congrats! A new GM candidate!",
      "votes": 2
    }
  ],
  "comments": [
    {
      "id": 2010521,
      "author_name": "Arnab_Dey",
      "author_url": "",
      "post_date": "2022-10-30T20:17:38.470000",
      "content": "<p>Congratulation for your work <a href=\"https://www.kaggle.com/harshitsheoran\" target=\"_blank\">@harshitsheoran</a> </p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2008700,
      "author_name": "Shreyas Daniel Gaddam",
      "author_url": "",
      "post_date": "2022-10-29T08:58:47.390000",
      "content": "<p>Congratulations <a href=\"https://www.kaggle.com/harshitsheoran\" target=\"_blank\">@harshitsheoran</a>! Your work taught me a lot about handling medical data during this competition..amazing result!</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2008424,
      "author_name": "KhanhVD",
      "author_url": "",
      "post_date": "2022-10-29T03:58:54.153000",
      "content": "<p>Congrats on gold medal and becoming master <a href=\"https://www.kaggle.com/harshitsheoran\" target=\"_blank\">@harshitsheoran</a> </p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2008151,
      "author_name": "Ravi Ramakrishnan",
      "author_url": "",
      "post_date": "2022-10-28T19:26:51.733000",
      "content": "<p>Congrats to you for the superior result! Thanks for the good explanation too! All the best for the future too <a href=\"https://www.kaggle.com/harshitsheoran\" target=\"_blank\">@harshitsheoran</a> </p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2008122,
      "author_name": "GUNER",
      "author_url": "",
      "post_date": "2022-10-28T19:02:01.367000",
      "content": "<p>Congrats on the solo gold! it is too precious.<br>\nOne question: How did you use sagittal segmentation? Isn't axial segmentation with labels 0+7+1  already sufficient, since you are continuing with axial images? In other words, what information is sagittal segmentation adding to the axial-slice level segmentations you do (on the slices of the segmented 87 studies). Or is it just an issue of blending segmentation results in both axis?</p>",
      "votes": 1,
      "replies": [
        {
          "id": 2008332,
          "author_name": "Harshit Sheoran",
          "author_url": "",
          "post_date": "2022-10-29T00:12:58.307000",
          "content": "<p>It does not particularly add anything, and it is not a blend, I was just experimenting that how I can know labels (labels here is vertebrae number) of axial view using sagittal view and then I kept it, as it was so efficient, just a single pass image to know it all</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 2008449,
          "author_name": "GUNER",
          "author_url": "",
          "post_date": "2022-10-29T04:40:37.830000",
          "content": "<p>Thank you 👍</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 2007950,
      "author_name": "Pierre Tisseur",
      "author_url": "",
      "post_date": "2022-10-28T15:41:15.537000",
      "content": "<p>Thank you, that clarifies my ideas about the use of bounding boxes. I had also asked myself the question of unbroken vertebrae.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2007856,
      "author_name": "SolverWorld",
      "author_url": "",
      "post_date": "2022-10-28T14:48:11.980000",
      "content": "<p>Very clever data trick and nice explanation.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2007851,
      "author_name": "Darragh",
      "author_url": "",
      "post_date": "2022-10-28T14:43:29.013000",
      "content": "<p>Great work and nice find on the fracture boxes. </p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2007975,
      "author_name": "Qishen Ha",
      "author_url": "",
      "post_date": "2022-10-28T16:08:58.690000",
      "content": "<p>Congrats! A new GM candidate!</p>",
      "votes": 2,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2007762": "Thanks to the organizers for hosting RSNA 2022 with such a huge diversity of data, there are so many approaches to learn from.\n\nMany Many Congratulations to the winners and everyone who completed their goals. For me, my goal was to get my first gold to be a solo gold.\n\n##Summary\n\n[NOTE]: I use \"vertebrae\" and \"bone\" interchangeably\n\n-Sagittal segmentation model to classify which image belongs to what vertebrae in a single go\n-Bone segmentation model to crop the ROI\n-Slice-level classification model\n-RNN on extracted features\n\n##Sagittal Segmentation\n\nI trained a Unet-B1 binary segmentation model on sagittal view, 0 for background and 1 for bone, used this model's pretrained weights to train another model on the same data with class 0 for background class 1 for C1... class 7 for C7 and class 8 for any bone other than C1-C7\n\nI predicted the whole dataset with it to assign bone to slice.\n\n##Bone Segmentation\nI trained a Unet-B1 segmentation model (weights not taken from sagittal model) on the slices, this time in axial view with the same 8 classes.\n\nI predicted the whole dataset and got ROI bounding box for every slice.\n\n##Data Preparation\n\nBefore we get into how I did slice-level classification, we have take in mind the data trick which made this approach possible and was overlooked by most people, it is more of an assumption as the organizers have not confirmed this:\n\nEvery slice which has a fractured bounding box annotation, is fractured, and for that particular patient, every other slice is non fractured...\n\nNow, to balance out the dataset and all, long story short, I took all the slices from train_bounding_boxes.csv as fractured=1, every other slice for that patient as fractured=0, 280 patients which do not have any fractures meaning that all their slices is also fractured=0\n\nThen I took the liberty to clear the data by removing all the non-fractured slices which have label either 0 or 8 (referenced earlier in the Sagittal Segmentation).  \n\nNow we have a dataset with 515 patients and a bit over 100,000 slices with just about 7% of them labeled as fractured.\n\n##Slice-Level Classification\n\nI trained a binary-classification efficientnet b5 model, with image size of 456x456\nI used 2.5D for the slice with [slice-1, slice, slice+1] as 3 channels, cropped bone ROI and perfectly tuned the augmentations, the interesting thing I did for augmentation is I did resize to preserve aspect ratio with this bit of code\n\n`A.Compose([`\n`        A.LongestMaxSize(CFG.SZ_H),`\n`        A.PadIfNeeded(CFG.SZ_H, CFG.SZ_W, border_mode=0, p=1),`\n\nAnd now the input looks like this, this image is labeled fractured\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1794509%2Fd15c9728ee434337e2021690caf4d021%2Fdownload.png?generation=1666959968765797&alt=media)\n\nI achieved .916 slice-level AUC doing this, and then I did pseudo on rest of dataset to achieve over .94 AUC, there were many different approaches I did pseudo in just to end up a bit over .94 AUC with most of them so I won't go into which way I finalized upon as it needs not to be very specific, the point to keep in mind is that not all the remaining ~1500 patients are going to be good as pseudo label and don't waste resources pseudo-labeling the images which do not even have potential of being fractured, you can know this from competition's train.csv file.\n\nNow, predicting on all of the images of a patient in inference and then using [this](https://www.kaggle.com/competitions/rsna-str-pulmonary-embolism-detection/discussion/193422) with modifications, I achieved a .26 public which scored .27 in private (most of my other .26 public scores were not this robust though)..\n\n##RNN\nInput would be BSx64x2048, if it a vertebrae has less than 64 slices then pad zeros, else take first 64 slices.\n\nI used 2x GRU bidirectional layers, output fed both into an Attention and a Conv1D layer, concatenated the output of those 2 layers and then reshaped to (BS/7)x7x2048, flattening out to (BS/7)x2048*7 feeding into a linear to get (BS/7)x8 output.\n\nThe input was sent in with consideration in mind that the output will be a proper study-level, if it does not make sense, either I am explaining it wrong or it is completely wrong, I don't any experience with 1D or RNN models but with a lot of tries, this is what worked for me, scoring me a .23 public and .26 private\n\n##What did not work:\n\nLots of ideas but the important ones are:\n\nNormally not something to put in here, but, ensemble, my ensembles did not work, probably because I do not know how to make RNN models, I think that was my major shortcoming in this competition.\n\nI did get a bit better CV using ensemble, but it did not reflect on Public and Private LB.\n\nAux Loss with bounding box, like it was used in last year's RSNA\n\nTraining study-level with hope to guide it with slice-level predictions, I did it exactly like many top solutions have done, but in my case it did not do better than slice-level.\n\nCompetition was very much of a rollercoaster for me with lots false alarms of better CV just to not follow on LB (and private leaderboard consistently followed public leaderboard in my submissions below .26 public)\n\nI struggled with RNN models for quite a long time stuck on .26, got to know the importance of them for the task.\n\n##Code\n\n[1. Sagittal](https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-1-sagittal)\n[2. Axial](https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-2-axial)\n[3. Fracture](https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-3-fracture)\n[4. Study](https://www.kaggle.com/code/harshitsheoran/rsna-2022-8th-place-4-study)\n[5. Inference](https://www.kaggle.com/code/harshitsheoran/8th-place-inference/)",
    "2010521": "Congratulation for your work @harshitsheoran ",
    "2008700": "Congratulations @harshitsheoran! Your work taught me a lot about handling medical data during this competition..amazing result!",
    "2008424": "Congrats on gold medal and becoming master @harshitsheoran ",
    "2008151": "Congrats to you for the superior result! Thanks for the good explanation too! All the best for the future too @harshitsheoran ",
    "2008122": "Congrats on the solo gold! it is too precious.\nOne question: How did you use sagittal segmentation? Isn't axial segmentation with labels 0+7+1  already sufficient, since you are continuing with axial images? In other words, what information is sagittal segmentation adding to the axial-slice level segmentations you do (on the slices of the segmented 87 studies). Or is it just an issue of blending segmentation results in both axis?",
    "2007950": "Thank you, that clarifies my ideas about the use of bounding boxes. I had also asked myself the question of unbroken vertebrae.",
    "2007856": "Very clever data trick and nice explanation.",
    "2007851": "Great work and nice find on the fracture boxes. ",
    "2007975": "Congrats! A new GM candidate!"
  }
}