{
  "id": 465619,
  "title": "30th place solution",
  "url": "/competitions/UBC-OCEAN/discussion/465619",
  "author_name": "Adam Narai",
  "post_date": "2024-01-04T23:02:38.303000",
  "votes": 8,
  "comment_count": 0,
  "views": 0,
  "content": "<p>This was my first Kaggle competition and it was a fun ride. Many thanks for the organizers and everyone involved. Special thanks to <a href=\"https://www.kaggle.com/jirkaborovec\" target=\"_blank\">@jirkaborovec</a> whose public notebooks helped me a lot at the beginning of this competition to kickstart my approach. </p>\n<h1>Best model</h1>\n<p>I used a simple tile-based approach where I trained a ConvNeXt_Tiny model to classify each tile as one of the 5 categories:</p>\n<ul>\n<li>ConvNeXt_Tiny, pretrained</li>\n<li>512x512 px image size</li>\n<li>batch size: 32</li>\n<li>random horizontal/vertical flip augmentation</li>\n<li>color augmentation (brightness, contrast, saturation, hue)</li>\n<li>color normalization</li>\n<li>Cross-Entropy Loss</li>\n<li>AdamW optimizer, StepLR (step_size=2, gamma=0.1), LR=1e-4</li>\n<li>1 + 5 epochs (convolutional layers feezed for the initial epoch)</li>\n<li>CV5, Stratified Group KFold</li>\n</ul>\n<h1>WSI tiling</h1>\n<p>Using the supplemental masks, I trained an EfficientNet_B0 (pretrained) model with similar training parameters as the main model to detect tiles with tumor (0.97 CV5 balanced accuracy). As training data, I selected tiles with tumor label &gt; 95% for the tumor class and tiles with stroma+necrosis label &gt; 50% and tumor label &lt; 5% for the no-tumor class.</p>\n<p>I cut each WSI into 1024x1024 px tiles (dropping tiles with &gt; 60 % black background) and used 32 random tumor tiles (based on the EfficientNet_B0 model with 0.5 threshold) from each image for both training and inference. Predictions were averaged between tiles during inference.</p>\n<h1>TMA “tiling”</h1>\n<p>One 2048x2048 px (to compensate for the x2 magnification) tile was cut from the center of the image.</p>\n<h1>Other class</h1>\n<p>Using a sigmoid activation function, an image was marked as Other if the largest activation was smaller than 0.8.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F8375965%2F3753ea56085656582000e41a1a4666aa%2Fubc.png?generation=1704405042031267&amp;alt=media\" alt=\"\"></p>\n<p>(As an extra: some accidental augmented images with questionable artistic value.)</p>",
  "messages": [
    {
      "id": 2587647,
      "postDate": "2024-01-04T23:02:38.303Z",
      "content": "<p>This was my first Kaggle competition and it was a fun ride. Many thanks for the organizers and everyone involved. Special thanks to <a href=\"https://www.kaggle.com/jirkaborovec\" target=\"_blank\">@jirkaborovec</a> whose public notebooks helped me a lot at the beginning of this competition to kickstart my approach. </p>\n<h1>Best model</h1>\n<p>I used a simple tile-based approach where I trained a ConvNeXt_Tiny model to classify each tile as one of the 5 categories:</p>\n<ul>\n<li>ConvNeXt_Tiny, pretrained</li>\n<li>512x512 px image size</li>\n<li>batch size: 32</li>\n<li>random horizontal/vertical flip augmentation</li>\n<li>color augmentation (brightness, contrast, saturation, hue)</li>\n<li>color normalization</li>\n<li>Cross-Entropy Loss</li>\n<li>AdamW optimizer, StepLR (step_size=2, gamma=0.1), LR=1e-4</li>\n<li>1 + 5 epochs (convolutional layers feezed for the initial epoch)</li>\n<li>CV5, Stratified Group KFold</li>\n</ul>\n<h1>WSI tiling</h1>\n<p>Using the supplemental masks, I trained an EfficientNet_B0 (pretrained) model with similar training parameters as the main model to detect tiles with tumor (0.97 CV5 balanced accuracy). As training data, I selected tiles with tumor label &gt; 95% for the tumor class and tiles with stroma+necrosis label &gt; 50% and tumor label &lt; 5% for the no-tumor class.</p>\n<p>I cut each WSI into 1024x1024 px tiles (dropping tiles with &gt; 60 % black background) and used 32 random tumor tiles (based on the EfficientNet_B0 model with 0.5 threshold) from each image for both training and inference. Predictions were averaged between tiles during inference.</p>\n<h1>TMA “tiling”</h1>\n<p>One 2048x2048 px (to compensate for the x2 magnification) tile was cut from the center of the image.</p>\n<h1>Other class</h1>\n<p>Using a sigmoid activation function, an image was marked as Other if the largest activation was smaller than 0.8.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F8375965%2F3753ea56085656582000e41a1a4666aa%2Fubc.png?generation=1704405042031267&amp;alt=media\" alt=\"\"></p>\n<p>(As an extra: some accidental augmented images with questionable artistic value.)</p>",
      "rawMarkdown": "This was my first Kaggle competition and it was a fun ride. Many thanks for the organizers and everyone involved. Special thanks to @jirkaborovec whose public notebooks helped me a lot at the beginning of this competition to kickstart my approach. \n\n# Best model\nI used a simple tile-based approach where I trained a ConvNeXt_Tiny model to classify each tile as one of the 5 categories:\n- ConvNeXt_Tiny, pretrained\n- 512x512 px image size\n- batch size: 32\n- random horizontal/vertical flip augmentation\n- color augmentation (brightness, contrast, saturation, hue)\n- color normalization\n- Cross-Entropy Loss\n- AdamW optimizer, StepLR (step_size=2, gamma=0.1), LR=1e-4\n- 1 + 5 epochs (convolutional layers feezed for the initial epoch)\n- CV5, Stratified Group KFold\n\n# WSI tiling\nUsing the supplemental masks, I trained an EfficientNet_B0 (pretrained) model with similar training parameters as the main model to detect tiles with tumor (0.97 CV5 balanced accuracy). As training data, I selected tiles with tumor label > 95% for the tumor class and tiles with stroma+necrosis label > 50% and tumor label < 5% for the no-tumor class.\n\nI cut each WSI into 1024x1024 px tiles (dropping tiles with > 60 % black background) and used 32 random tumor tiles (based on the EfficientNet_B0 model with 0.5 threshold) from each image for both training and inference. Predictions were averaged between tiles during inference.\n\n# TMA “tiling”\nOne 2048x2048 px (to compensate for the x2 magnification) tile was cut from the center of the image.\n\n# Other class\nUsing a sigmoid activation function, an image was marked as Other if the largest activation was smaller than 0.8.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F8375965%2F3753ea56085656582000e41a1a4666aa%2Fubc.png?generation=1704405042031267&alt=media)\n\n(As an extra: some accidental augmented images with questionable artistic value.)\n",
      "votes": 8
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "2587647": "This was my first Kaggle competition and it was a fun ride. Many thanks for the organizers and everyone involved. Special thanks to @jirkaborovec whose public notebooks helped me a lot at the beginning of this competition to kickstart my approach. \n\n# Best model\nI used a simple tile-based approach where I trained a ConvNeXt_Tiny model to classify each tile as one of the 5 categories:\n- ConvNeXt_Tiny, pretrained\n- 512x512 px image size\n- batch size: 32\n- random horizontal/vertical flip augmentation\n- color augmentation (brightness, contrast, saturation, hue)\n- color normalization\n- Cross-Entropy Loss\n- AdamW optimizer, StepLR (step_size=2, gamma=0.1), LR=1e-4\n- 1 + 5 epochs (convolutional layers feezed for the initial epoch)\n- CV5, Stratified Group KFold\n\n# WSI tiling\nUsing the supplemental masks, I trained an EfficientNet_B0 (pretrained) model with similar training parameters as the main model to detect tiles with tumor (0.97 CV5 balanced accuracy). As training data, I selected tiles with tumor label > 95% for the tumor class and tiles with stroma+necrosis label > 50% and tumor label < 5% for the no-tumor class.\n\nI cut each WSI into 1024x1024 px tiles (dropping tiles with > 60 % black background) and used 32 random tumor tiles (based on the EfficientNet_B0 model with 0.5 threshold) from each image for both training and inference. Predictions were averaged between tiles during inference.\n\n# TMA “tiling”\nOne 2048x2048 px (to compensate for the x2 magnification) tile was cut from the center of the image.\n\n# Other class\nUsing a sigmoid activation function, an image was marked as Other if the largest activation was smaller than 0.8.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F8375965%2F3753ea56085656582000e41a1a4666aa%2Fubc.png?generation=1704405042031267&alt=media)\n\n(As an extra: some accidental augmented images with questionable artistic value.)\n"
  }
}