{
  "id": 447506,
  "title": "9th place solution",
  "url": "/competitions/rsna-2023-abdominal-trauma-detection/discussion/447506",
  "author_name": "kapenon",
  "post_date": "2023-10-16T08:32:19.315000",
  "votes": 21,
  "comment_count": 0,
  "views": 0,
  "content": "<p>First of all, I would like to express my gratitude to the Kaggle staff for hosting this fantastic competition, as well as to the organizers at RSNA. I also want to extend my appreciation to all the hardworking participants who dedicated themselves to this competition. Special thanks go to my teammate <a href=\"https://www.kaggle.com/liushuzhi\" target=\"_blank\">@liushuzhi</a> for his tireless efforts and insightful discussions.</p>\n<h1><strong>Overview</strong></h1>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F81780865e35219e456c375ea284989bd%2FScreenshot%202023-10-16%20at%2017.23.32.png?generation=1697444632841544&amp;alt=media\"></p>\n<h1><strong>Details of Each Model</strong></h1>\n<h3><strong>3D Segmentation</strong></h3>\n<ul>\n<li>Used the implementation from <a href=\"https://www.kaggle.com/haqishen\" target=\"_blank\">@haqishen</a>'s top solution of the previous competition.  [<a href=\"https://www.kaggle.com/competitions/rsna-2022-cervical-spine-fracture-detection/discussion/362607\" target=\"_blank\">1</a>] (Thank you!)</li>\n<li>Input size: (128, 128, 128)</li>\n<li>Models used: ResNet18d, UNet</li>\n</ul>\n<h3>Classification - <strong>Liver/Kidney/Spleen</strong></h3>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F2a1524549d583462f54ab94a9804204d%2FScreenshot%202023-10-19%20at%2020.36.04.png?generation=1697715592043327&amp;alt=media\"></p>\n<ul>\n<li>Developed a single model to classify all three organs instead of individual models for each organ due to better performance.</li>\n<li>For patients with 2 series, only used the one with the lower aortic_hu for training. For patients with 1 series, used all of them. This decision was based on experimentation rather than a specific rationale.</li>\n<li>Performed cuboid crop using the 3D segmentation masks, slightly expanding the cuboid to preserve edges.</li>\n<li>Weighted the loss during training according to the competition metrics [1, 2, 4].</li>\n<li>Model architecture: SE-ResNeXt → LSTM → Concatenation of [1D CNN, Attention]</li>\n<li>Input size: (96, 4, 256, 256)<ul>\n<li>Channels are (i-1, i, i+1, mask), with 'i' representing the index of images along the z-axis.</li></ul></li>\n</ul>\n<h3>Classification - <strong>Bowel</strong></h3>\n<p>Two-stage training was employed to leverage image-level labels.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F55260f9b200a2d93f7a51ebcda070f59%2FScreenshot%202023-10-19%20at%2020.36.18.png?generation=1697715686083231&amp;alt=media\"></p>\n<p><strong>1st Stage</strong></p>\n<ul>\n<li>Binary classification with a 2D model using image_level_label.csv.</li>\n<li>Similar to liver/kidney/spleen model, cuboid crop was done using 3D segmentation masks to create 4-channel input data. Thus, input size was (4, 384, 384).</li>\n<li>Sampled data randomly to achieve a 1:10 ratio between positive and negative.</li>\n<li>The loss is weighted based on the competition's metrics.</li>\n<li>SE-ResNeXt was used for the model.</li>\n</ul>\n<p><strong>2nd Stage</strong></p>\n<ul>\n<li>Aggregated features obtained from the model trained in the 1st stage.</li>\n<li>Model architecture: SE-ResNeXt → LSTM</li>\n<li>Weights from the 1st stage were loaded and kept frozen, updating only the network beyond the LSTM during training.</li>\n</ul>\n<h3>Classification - <strong>Extravasation</strong></h3>\n<p>Similar to the approach for Bowel, a two-stage training strategy was used to leverage image-level labels. The model and aggregation methods were the same, but there were some differences.</p>\n<ul>\n<li>Cuboid crop was not performed.</li>\n<li>Since anomalies were small, its resolution was increased to (96, 3, 512, 512).</li>\n<li>Used data with higher aortic_hu for patients with 2 series to highlight features.</li>\n</ul>\n<h1><strong>Post-Processing</strong></h1>\n<p>A post-processing step was introduced to improve the optimization of any_injury. The only post-processing step we performed was simply multiplying the coefficients.</p>\n<p>Coefficients were searched and applied based on OOF prediction values. Although the original plan was to create a stacking model for this purpose, it was simplified due to time constraints.</p>\n<pre><code>low_coef = \nhigh_coef = \nev_coef = \nbowel_coef = \n\ndf_pred[] *= low_coef\ndf_pred[] *= high_coef\ndf_pred[] *= low_coef\ndf_pred[] *= high_coef\ndf_pred[] *= low_coef\ndf_pred[] *= high_coef\ndf_pred[] *= ev_coef\ndf_pred[] *= bowel_coef\n</code></pre>\n<h1><strong>CV</strong></h1>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>bowel</th>\n<th>ev</th>\n<th>kidney</th>\n<th>liver</th>\n<th>spleen</th>\n<th>any_injury</th>\n<th>mean</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>w/o Post-Processing</td>\n<td>0.1293</td>\n<td>0.5348</td>\n<td>0.3146</td>\n<td>0.4192</td>\n<td>0.4454</td>\n<td>0.5533</td>\n<td>0.3994</td>\n</tr>\n<tr>\n<td>w/ Post-Processing</td>\n<td>0.1293</td>\n<td>0.5303</td>\n<td>0.3141</td>\n<td>0.4190</td>\n<td>0.4485</td>\n<td>0.4925</td>\n<td>0.3889</td>\n</tr>\n</tbody>\n</table>\n<h1><strong>Source Code</strong></h1>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>URL</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Inference notebook</td>\n<td><a href=\"https://www.kaggle.com/code/kapenon/rsna2023atd-9th-place-inference\" target=\"_blank\">https://www.kaggle.com/code/kapenon/rsna2023atd-9th-place-inference</a></td>\n</tr>\n<tr>\n<td>Training code</td>\n<td><a href=\"https://github.com/kapenon/rsna2023atd_9th_solution\" target=\"_blank\">https://github.com/kapenon/rsna2023atd_9th_solution</a></td>\n</tr>\n</tbody>\n</table>\n<h1>Acknowledgments</h1>\n<p>We want to extend our thanks to the Kaggle staff and hosts who organized this fantastic competition, all the dedicated participants, and Rist Inc. for their support in providing computational resources.</p>",
  "messages": [
    {
      "id": 2484114,
      "postDate": "2023-10-16T08:32:19.317Z",
      "content": "<p>First of all, I would like to express my gratitude to the Kaggle staff for hosting this fantastic competition, as well as to the organizers at RSNA. I also want to extend my appreciation to all the hardworking participants who dedicated themselves to this competition. Special thanks go to my teammate <a href=\"https://www.kaggle.com/liushuzhi\" target=\"_blank\">@liushuzhi</a> for his tireless efforts and insightful discussions.</p>\n<h1><strong>Overview</strong></h1>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F81780865e35219e456c375ea284989bd%2FScreenshot%202023-10-16%20at%2017.23.32.png?generation=1697444632841544&amp;alt=media\"></p>\n<h1><strong>Details of Each Model</strong></h1>\n<h3><strong>3D Segmentation</strong></h3>\n<ul>\n<li>Used the implementation from <a href=\"https://www.kaggle.com/haqishen\" target=\"_blank\">@haqishen</a>'s top solution of the previous competition.  [<a href=\"https://www.kaggle.com/competitions/rsna-2022-cervical-spine-fracture-detection/discussion/362607\" target=\"_blank\">1</a>] (Thank you!)</li>\n<li>Input size: (128, 128, 128)</li>\n<li>Models used: ResNet18d, UNet</li>\n</ul>\n<h3>Classification - <strong>Liver/Kidney/Spleen</strong></h3>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F2a1524549d583462f54ab94a9804204d%2FScreenshot%202023-10-19%20at%2020.36.04.png?generation=1697715592043327&amp;alt=media\"></p>\n<ul>\n<li>Developed a single model to classify all three organs instead of individual models for each organ due to better performance.</li>\n<li>For patients with 2 series, only used the one with the lower aortic_hu for training. For patients with 1 series, used all of them. This decision was based on experimentation rather than a specific rationale.</li>\n<li>Performed cuboid crop using the 3D segmentation masks, slightly expanding the cuboid to preserve edges.</li>\n<li>Weighted the loss during training according to the competition metrics [1, 2, 4].</li>\n<li>Model architecture: SE-ResNeXt → LSTM → Concatenation of [1D CNN, Attention]</li>\n<li>Input size: (96, 4, 256, 256)<ul>\n<li>Channels are (i-1, i, i+1, mask), with 'i' representing the index of images along the z-axis.</li></ul></li>\n</ul>\n<h3>Classification - <strong>Bowel</strong></h3>\n<p>Two-stage training was employed to leverage image-level labels.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F55260f9b200a2d93f7a51ebcda070f59%2FScreenshot%202023-10-19%20at%2020.36.18.png?generation=1697715686083231&amp;alt=media\"></p>\n<p><strong>1st Stage</strong></p>\n<ul>\n<li>Binary classification with a 2D model using image_level_label.csv.</li>\n<li>Similar to liver/kidney/spleen model, cuboid crop was done using 3D segmentation masks to create 4-channel input data. Thus, input size was (4, 384, 384).</li>\n<li>Sampled data randomly to achieve a 1:10 ratio between positive and negative.</li>\n<li>The loss is weighted based on the competition's metrics.</li>\n<li>SE-ResNeXt was used for the model.</li>\n</ul>\n<p><strong>2nd Stage</strong></p>\n<ul>\n<li>Aggregated features obtained from the model trained in the 1st stage.</li>\n<li>Model architecture: SE-ResNeXt → LSTM</li>\n<li>Weights from the 1st stage were loaded and kept frozen, updating only the network beyond the LSTM during training.</li>\n</ul>\n<h3>Classification - <strong>Extravasation</strong></h3>\n<p>Similar to the approach for Bowel, a two-stage training strategy was used to leverage image-level labels. The model and aggregation methods were the same, but there were some differences.</p>\n<ul>\n<li>Cuboid crop was not performed.</li>\n<li>Since anomalies were small, its resolution was increased to (96, 3, 512, 512).</li>\n<li>Used data with higher aortic_hu for patients with 2 series to highlight features.</li>\n</ul>\n<h1><strong>Post-Processing</strong></h1>\n<p>A post-processing step was introduced to improve the optimization of any_injury. The only post-processing step we performed was simply multiplying the coefficients.</p>\n<p>Coefficients were searched and applied based on OOF prediction values. Although the original plan was to create a stacking model for this purpose, it was simplified due to time constraints.</p>\n<pre><code>low_coef = \nhigh_coef = \nev_coef = \nbowel_coef = \n\ndf_pred[] *= low_coef\ndf_pred[] *= high_coef\ndf_pred[] *= low_coef\ndf_pred[] *= high_coef\ndf_pred[] *= low_coef\ndf_pred[] *= high_coef\ndf_pred[] *= ev_coef\ndf_pred[] *= bowel_coef\n</code></pre>\n<h1><strong>CV</strong></h1>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>bowel</th>\n<th>ev</th>\n<th>kidney</th>\n<th>liver</th>\n<th>spleen</th>\n<th>any_injury</th>\n<th>mean</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>w/o Post-Processing</td>\n<td>0.1293</td>\n<td>0.5348</td>\n<td>0.3146</td>\n<td>0.4192</td>\n<td>0.4454</td>\n<td>0.5533</td>\n<td>0.3994</td>\n</tr>\n<tr>\n<td>w/ Post-Processing</td>\n<td>0.1293</td>\n<td>0.5303</td>\n<td>0.3141</td>\n<td>0.4190</td>\n<td>0.4485</td>\n<td>0.4925</td>\n<td>0.3889</td>\n</tr>\n</tbody>\n</table>\n<h1><strong>Source Code</strong></h1>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>URL</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Inference notebook</td>\n<td><a href=\"https://www.kaggle.com/code/kapenon/rsna2023atd-9th-place-inference\" target=\"_blank\">https://www.kaggle.com/code/kapenon/rsna2023atd-9th-place-inference</a></td>\n</tr>\n<tr>\n<td>Training code</td>\n<td><a href=\"https://github.com/kapenon/rsna2023atd_9th_solution\" target=\"_blank\">https://github.com/kapenon/rsna2023atd_9th_solution</a></td>\n</tr>\n</tbody>\n</table>\n<h1>Acknowledgments</h1>\n<p>We want to extend our thanks to the Kaggle staff and hosts who organized this fantastic competition, all the dedicated participants, and Rist Inc. for their support in providing computational resources.</p>",
      "rawMarkdown": "First of all, I would like to express my gratitude to the Kaggle staff for hosting this fantastic competition, as well as to the organizers at RSNA. I also want to extend my appreciation to all the hardworking participants who dedicated themselves to this competition. Special thanks go to my teammate @liushuzhi for his tireless efforts and insightful discussions.\n\n\n# **Overview**\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F81780865e35219e456c375ea284989bd%2FScreenshot%202023-10-16%20at%2017.23.32.png?generation=1697444632841544&alt=media\" width=\"750\">\n\n\n# **Details of Each Model**\n\n### **3D Segmentation**\n\n- Used the implementation from @haqishen's top solution of the previous competition.  [[1](https://www.kaggle.com/competitions/rsna-2022-cervical-spine-fracture-detection/discussion/362607)] (Thank you!)\n- Input size: (128, 128, 128)\n- Models used: ResNet18d, UNet\n\n### Classification - **Liver/Kidney/Spleen**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F2a1524549d583462f54ab94a9804204d%2FScreenshot%202023-10-19%20at%2020.36.04.png?generation=1697715592043327&alt=media\" width=\"600\">\n\n- Developed a single model to classify all three organs instead of individual models for each organ due to better performance.\n- For patients with 2 series, only used the one with the lower aortic_hu for training. For patients with 1 series, used all of them. This decision was based on experimentation rather than a specific rationale.\n- Performed cuboid crop using the 3D segmentation masks, slightly expanding the cuboid to preserve edges.\n- Weighted the loss during training according to the competition metrics [1, 2, 4].\n- Model architecture: SE-ResNeXt → LSTM → Concatenation of [1D CNN, Attention]\n- Input size: (96, 4, 256, 256)\n    - Channels are (i-1, i, i+1, mask), with 'i' representing the index of images along the z-axis.\n\n### Classification - **Bowel**\n\nTwo-stage training was employed to leverage image-level labels.\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F55260f9b200a2d93f7a51ebcda070f59%2FScreenshot%202023-10-19%20at%2020.36.18.png?generation=1697715686083231&alt=media\" width=\"900\">\n\n**1st Stage**\n\n- Binary classification with a 2D model using image_level_label.csv.\n- Similar to liver/kidney/spleen model, cuboid crop was done using 3D segmentation masks to create 4-channel input data. Thus, input size was (4, 384, 384).\n- Sampled data randomly to achieve a 1:10 ratio between positive and negative.\n- The loss is weighted based on the competition's metrics.\n- SE-ResNeXt was used for the model.\n\n**2nd Stage**\n\n- Aggregated features obtained from the model trained in the 1st stage.\n- Model architecture: SE-ResNeXt → LSTM\n- Weights from the 1st stage were loaded and kept frozen, updating only the network beyond the LSTM during training.\n\n### Classification - **Extravasation**\n\nSimilar to the approach for Bowel, a two-stage training strategy was used to leverage image-level labels. The model and aggregation methods were the same, but there were some differences.\n\n- Cuboid crop was not performed.\n- Since anomalies were small, its resolution was increased to (96, 3, 512, 512).\n- Used data with higher aortic_hu for patients with 2 series to highlight features.\n\n\n# **Post-Processing**\n\nA post-processing step was introduced to improve the optimization of any_injury. The only post-processing step we performed was simply multiplying the coefficients.\n\nCoefficients were searched and applied based on OOF prediction values. Although the original plan was to create a stacking model for this purpose, it was simplified due to time constraints.\n\n```python\nlow_coef = 1.5\nhigh_coef = 1.5\nev_coef = 1.5\nbowel_coef = 1.0\n\ndf_pred[\"liver_low\"] *= low_coef\ndf_pred[\"liver_high\"] *= high_coef\ndf_pred[\"kidney_low\"] *= low_coef\ndf_pred[\"kidney_high\"] *= high_coef\ndf_pred[\"spleen_low\"] *= low_coef\ndf_pred[\"spleen_high\"] *= high_coef\ndf_pred[\"extravasation_injury\"] *= ev_coef\ndf_pred[\"bowel_injury\"] *= bowel_coef\n```\n\n# **CV**\n\n| | bowel | ev | kidney | liver | spleen | any_injury | mean |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n| w/o Post-Processing | 0.1293 | 0.5348 | 0.3146 | 0.4192 | 0.4454 | 0.5533 | 0.3994 |\n| w/ Post-Processing | 0.1293 | 0.5303 | 0.3141 | 0.4190 | 0.4485 | 0.4925 | 0.3889 |\n\n# **Source Code**\n|  | URL |\n| --- | --- |\n| Inference notebook | https://www.kaggle.com/code/kapenon/rsna2023atd-9th-place-inference | \n| Training code | https://github.com/kapenon/rsna2023atd_9th_solution | \n\n# Acknowledgments\nWe want to extend our thanks to the Kaggle staff and hosts who organized this fantastic competition, all the dedicated participants, and Rist Inc. for their support in providing computational resources.",
      "votes": 21
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "2484114": "First of all, I would like to express my gratitude to the Kaggle staff for hosting this fantastic competition, as well as to the organizers at RSNA. I also want to extend my appreciation to all the hardworking participants who dedicated themselves to this competition. Special thanks go to my teammate @liushuzhi for his tireless efforts and insightful discussions.\n\n\n# **Overview**\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F81780865e35219e456c375ea284989bd%2FScreenshot%202023-10-16%20at%2017.23.32.png?generation=1697444632841544&alt=media\" width=\"750\">\n\n\n# **Details of Each Model**\n\n### **3D Segmentation**\n\n- Used the implementation from @haqishen's top solution of the previous competition.  [[1](https://www.kaggle.com/competitions/rsna-2022-cervical-spine-fracture-detection/discussion/362607)] (Thank you!)\n- Input size: (128, 128, 128)\n- Models used: ResNet18d, UNet\n\n### Classification - **Liver/Kidney/Spleen**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F2a1524549d583462f54ab94a9804204d%2FScreenshot%202023-10-19%20at%2020.36.04.png?generation=1697715592043327&alt=media\" width=\"600\">\n\n- Developed a single model to classify all three organs instead of individual models for each organ due to better performance.\n- For patients with 2 series, only used the one with the lower aortic_hu for training. For patients with 1 series, used all of them. This decision was based on experimentation rather than a specific rationale.\n- Performed cuboid crop using the 3D segmentation masks, slightly expanding the cuboid to preserve edges.\n- Weighted the loss during training according to the competition metrics [1, 2, 4].\n- Model architecture: SE-ResNeXt → LSTM → Concatenation of [1D CNN, Attention]\n- Input size: (96, 4, 256, 256)\n    - Channels are (i-1, i, i+1, mask), with 'i' representing the index of images along the z-axis.\n\n### Classification - **Bowel**\n\nTwo-stage training was employed to leverage image-level labels.\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3285259%2F55260f9b200a2d93f7a51ebcda070f59%2FScreenshot%202023-10-19%20at%2020.36.18.png?generation=1697715686083231&alt=media\" width=\"900\">\n\n**1st Stage**\n\n- Binary classification with a 2D model using image_level_label.csv.\n- Similar to liver/kidney/spleen model, cuboid crop was done using 3D segmentation masks to create 4-channel input data. Thus, input size was (4, 384, 384).\n- Sampled data randomly to achieve a 1:10 ratio between positive and negative.\n- The loss is weighted based on the competition's metrics.\n- SE-ResNeXt was used for the model.\n\n**2nd Stage**\n\n- Aggregated features obtained from the model trained in the 1st stage.\n- Model architecture: SE-ResNeXt → LSTM\n- Weights from the 1st stage were loaded and kept frozen, updating only the network beyond the LSTM during training.\n\n### Classification - **Extravasation**\n\nSimilar to the approach for Bowel, a two-stage training strategy was used to leverage image-level labels. The model and aggregation methods were the same, but there were some differences.\n\n- Cuboid crop was not performed.\n- Since anomalies were small, its resolution was increased to (96, 3, 512, 512).\n- Used data with higher aortic_hu for patients with 2 series to highlight features.\n\n\n# **Post-Processing**\n\nA post-processing step was introduced to improve the optimization of any_injury. The only post-processing step we performed was simply multiplying the coefficients.\n\nCoefficients were searched and applied based on OOF prediction values. Although the original plan was to create a stacking model for this purpose, it was simplified due to time constraints.\n\n```python\nlow_coef = 1.5\nhigh_coef = 1.5\nev_coef = 1.5\nbowel_coef = 1.0\n\ndf_pred[\"liver_low\"] *= low_coef\ndf_pred[\"liver_high\"] *= high_coef\ndf_pred[\"kidney_low\"] *= low_coef\ndf_pred[\"kidney_high\"] *= high_coef\ndf_pred[\"spleen_low\"] *= low_coef\ndf_pred[\"spleen_high\"] *= high_coef\ndf_pred[\"extravasation_injury\"] *= ev_coef\ndf_pred[\"bowel_injury\"] *= bowel_coef\n```\n\n# **CV**\n\n| | bowel | ev | kidney | liver | spleen | any_injury | mean |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n| w/o Post-Processing | 0.1293 | 0.5348 | 0.3146 | 0.4192 | 0.4454 | 0.5533 | 0.3994 |\n| w/ Post-Processing | 0.1293 | 0.5303 | 0.3141 | 0.4190 | 0.4485 | 0.4925 | 0.3889 |\n\n# **Source Code**\n|  | URL |\n| --- | --- |\n| Inference notebook | https://www.kaggle.com/code/kapenon/rsna2023atd-9th-place-inference | \n| Training code | https://github.com/kapenon/rsna2023atd_9th_solution | \n\n# Acknowledgments\nWe want to extend our thanks to the Kaggle staff and hosts who organized this fantastic competition, all the dedicated participants, and Rist Inc. for their support in providing computational resources."
  }
}