# 5th place solution

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 UBC. I also want to extend my appreciation to all the hardworking participants who dedicated themselves to this competition. Special thanks go to my teammates
[@kapenon](https://www.kaggle.com/kapenon)
and
[@tascj0](https://www.kaggle.com/tascj0)
for their tireless efforts and insightful discussions.
Solution Overview
Summary of submitted final solution:
Inference contains two stages:
Tile selection model -> Only WSI
Classification model -> WSI and TMA
Training details of segmentation model (mainly WSI, TMA is simply center-cropped):
Tile classification helper model (Not used for inference)
Random cropped tiles at 1536x1536, background excluded
Augmentations:  Random horizontal and vertical flips, RandomRotation, RandAugment, RandomGrayscale, RandomErasing
WSI label as tile label
ConvNeXt-base
6-class classification (Hubmap external data as “Other”)
Segmentation helper model (Not used for inference)
Use host provided mask
Tumor binary classification
2x magnification
SEResNeXt101 UNet
Tile selection segmentation model (Used for inference)
Label generation
Inference all tiles using 1st step models and save predicted probabilities of WSI class
Inference all WSIs using 2nd step models
Create a heatmap at 2x magnification
Heatmap GT is 0.5 classification confidence + 0.5 tumor confidence
Training
SEResNeXt101 UNet
Generated heatmap example:
![heatmaplabel](assets/c77fddd1d6d5070612d3276d.png)
Inference example of segmentation model:
![](assets/3e9aa1fde39fbcd0d284c6eb.jpeg)
Training details of tile classification model (Used for inference)
Random cropped tiles at 1536x1536, background excluded
Augmentations: Random horizontal and vertical flips, RandomRotation, RandAugment, RandomGrayscale, RandomErasing + StainNorm
WSI label as tile label
ConvNeXt-base, ConvNeXt-large, EVA (at 448x448)
6-class classification (Hubmap, Camelyon16, Camelyon17, etc. tiles as “Other”)
Data mining:
Train 1st round
Predict all foreground tiles
Confidence <0.3 tiles are pseudo labeled “Other” in 2nd round
Confidence 0.3-0.6 tiles are ignored
Confidence >0.6 tiles are pseudo labeled as WSI label
Train 2nd round
Inference details:
WSI
Tile selection
Predict heatmap at 2x magnification, top-5 confidence tiles are selected for classification
Classification
Prediction 5 tiles and average predictions as WSI prediction
StainNorm as TTA
There are some handling of large WSI images, refer to the submission notebook
TMA
Center crop 1 3072x3072 tile
Resize to 1536x1536
Predict using the classification model
StainNorm as TTA
Used External Datasets and their license:
Hubmap: HuBMAP + HPA - Hacking the Human Body (
[https://www.kaggle.com/competitions/hubmap-organ-segmentation/overview](https://www.kaggle.com/competitions/hubmap-organ-segmentation/overview)
)
Camelyon16, 17: CC0 (
[https://www.google.com/url?q=https://camelyon17.grand-challenge.org/Data/&sa=D&source=docs&ust=1704419788737632&usg=AOvVaw1BeJOZcucbo9R0wgu5NK3q](https://www.google.com/url?q=https://camelyon17.grand-challenge.org/Data/&sa=D&source=docs&ust=1704419788737632&usg=AOvVaw1BeJOZcucbo9R0wgu5NK3q)
)
ovarian-bevacizumab-response (only for WSI labeled as 'Other'): CC BY 4.0 (
[https://www.google.com/url?q=https://www.cancerimagingarchive.net/collection/ovarian-bevacizumab-response/&sa=D&source=docs&ust=1704419788739913&usg=AOvVaw0hQlYStI1_qpi7N_YIuHhY](https://www.google.com/url?q=https://www.cancerimagingarchive.net/collection/ovarian-bevacizumab-response/&sa=D&source=docs&ust=1704419788739913&usg=AOvVaw0hQlYStI1_qpi7N_YIuHhY)
)
What worked
Stain normalization.
Data mining (pseudo labeling).
Segmentation model for identifying valuable patches.
Using external datasets as ‘Other’.
ConvNext and EVA02 models.
Multiscale ensemble.
Codes
Train:
[https://github.com/ShuzhiLiu/UBC-OCEAN_5th_solution](https://github.com/ShuzhiLiu/UBC-OCEAN_5th_solution)
Submission Notebook:
[https://www.kaggle.com/code/liushuzhi/5thplacesolutionsubnotebook?scriptVersionId=158180788](https://www.kaggle.com/code/liushuzhi/5thplacesolutionsubnotebook?scriptVersionId=158180788)
Without EVA02: Public=0.61, Private=0.61 -> Selected for final sub
With EVA02: Public=0.60, Private=0.63 -> Not selected due to the lack of local CV
Acknowledgement
We would like to express our gratitude to the Kaggle support system and the emotional support of Rist inc.