{
  "id": 263654,
  "title": "3rd place solution",
  "url": "/competitions/siim-covid19-detection/writeups/aillis-yuji-ian-3rd-place-solution",
  "author_name": "",
  "post_date": "2021-08-18T00:15:20.290Z",
  "votes": 67,
  "comment_count": 37,
  "views": 0,
  "content": "<p>First of all, I would like to thank you for organizing this very interesting competition.<br>\nAlso, I can't thank IanPan enough. After we teamed up, our score improved very quickly, as if by magic. I have learned a lot from him through this competition.</p>\n<p>The following is my part.</p>\n<hr>\n<h3>study level:</h3>\n<p>・Swin Transformer <br>\nIn my environment, Swin Transformer was the best. cait was not bad, but aux loss did not work well with cait, so I chose Swin Transformer.<br>\nI left the resolution at 384. I tried 768, but it was slightly worse. I also did some cropping, so 384 seemed to be sufficient.</p>\n<h5>1st stage:</h5>\n<p>・Pre training was done with chexpert data.<br>\nThis is Ian's idea. The data is quite different from ImageNet. we can get a good initial set of weights by pre training.<br>\nIn addition, further pre-training with the RSNA 2018 competition data before training with chexpert resulted in a slight improvement in CV over using chexpert only.<br>\nI used crop, which I will write about later, and did not use aux loss.</p>\n<h5>2nd stage:</h5>\n<p>・5classes<br>\nI included 'none' in the class.<br>\n・Cropping with detection and segmentation<br>\nBy using the predictions of the detection for cropping, I was able to apply the wisdom of the detection model to the classification model, and I also used the lung Segmentator trained by VinBigData datasets. I crop the image only in the area where the detection box (conf &gt; 0.3) or segmentation mask exists.<br>\nIf the box is used as-is, for example, a pleural effusion may result in an image that is difficult to distinguish, The box has been padded with 100 pixels.<br>\n・mixup<br>\nMixup brought about a small improvement. In the end, for my part, I used two different models, one with Mixup and one without.<br>\nAt the stage of not using aux loss, resize mix was the best, but in the end, mixup was better.<br>\n・aux loss<br>\nI used binary_cross_entropy_with_logits.<br>\nIn one of the two models, I set the negative image loss to zero.<br>\n・No pseudo label<br>\nI tried everything, but the results were slightly worse.<br>\n・The average of the 5fold model for the four classes of mAP was 0.397.</p>\n<h3>image level</h3>\n<p>・YOLOV5<br>\nI used l6&amp;l.</p>\n<h5>opacity:</h5>\n<p>・Pre training was done with RSNA 2018 data.<br>\nThe same reason as for study level.<br>\n・mixup: 0.5<br>\nThere was a slight improvement.<br>\n・Use none predictions<br>\nFor each image, I found the following improved the score the most<br>\ndection_conf = dection_conf * (1-image none prediction)**0.4</p>\n<h5>none:</h5>\n<p>I used predictions of classification models and detection models like this.<br>\nnone_pred = cl_none_pred<em>0.7 + (1 - image_conf_max)</em>0.3</p>\n<hr>\n<p>The following is a message from Ian.</p>\n<hr>\n<p>I would like to thank Yuji for agreeing to team with me. I reached out later in the competition when he was already doing really well without me. I learned a lot from him, and this competition reminded me how fun and enlightening it is to team up on Kaggle. </p>\n<h3>Classification</h3>\n<p>For classification, I trained a 5-class classifier: 4 study labels + none at image-level (vs. opacity). We only trained on 1 image/study. Since the vast majority of studies only had a single unique image, this was not really an issue. </p>\n<p>First, I pretrained the classifier on the 3 classes from the RSNA 2018 Pneumonia Detection Challenge. Then, I fine-tuned from these weights on this competition's data. This significantly increased performance. </p>\n<p>I trained a hybrid classification-segmentation model. One architecture used EfficientNet-B6 and DeepLabV3+ while the other used Swin Transformer and FPN. These were trained using the awesome Segmentation Models PyTorch library (<a href=\"https://github.com/qubvel/segmentation_models.pytorch)\" target=\"_blank\">https://github.com/qubvel/segmentation_models.pytorch)</a>. </p>\n<p>The models were trained using AdamW optimizer, 512x512 images, and data augmentation with contrast/brightness adjustment, random noise, and scale/shift/rotate using albumentations. </p>\n<p>I used BCE loss for both classification (even though you could use cross-entropy, I found BCE worked better for the metric) and segmentation, weighted 1:1. The segmentation part of the model only had 1 class for opacity. The segmentation label was generated using the bounding box labels. I turned the bounding box into an ellipse and used that as the training label. </p>\n<p>I also used mixup, which showed significant improvements. 5-fold ensemble of the EfficientNet-B6/DeepLabV3+ and Swin/FPN models (10 models total) gave 0.408 LB for study-label classification. </p>\n<h3>Detection</h3>\n<p>I trained detection models using the awesome EfficientDet library (<a href=\"https://github.com/rwightman/efficientdet-pytorch\" target=\"_blank\">https://github.com/rwightman/efficientdet-pytorch</a>) and MMDetection (<a href=\"https://github.com/open-mmlab/mmdetection)\" target=\"_blank\">https://github.com/open-mmlab/mmdetection)</a>. </p>\n<p>I also pretrained these models on the RSNA 2018 dataset (images with opacity only) using the bounding box labels. This significantly increased performance for detection as well. I trained 5-fold EfficientDet-D7X on 512x512 images (positives only). I also trained 5-fold EfficientDet-D6 on 640x640 images (positives only). </p>\n<p>To add diversity to the ensemble, I trained models in MMDetection as well. I used Swin Transformer with RepPoints, borrowing the code from <a href=\"https://github.com/SwinTransformer/Swin-Transformer-Object-Detection\" target=\"_blank\">https://github.com/SwinTransformer/Swin-Transformer-Object-Detection</a> to use Swin Transformer as a backbone for object detection. These models were trained using multi-scale training (512x512 to 768x768) and during inference 3x multi-scale TTA was used. </p>\n<p>I contributed 15 detection models (EffDet-D7X, EffDet-D6, Swin-RepPoints) for the ensemble. </p>\n<h3>What Didn't Work For Me</h3>\n<ul>\n<li>Training classifier with detection as auxiliary loss instead of augmentation</li>\n<li>Mixup during detection</li>\n<li>Training a multiclass detector (using study labels, instead of just training on single-class opacity)</li>\n<li>In my experiments, pseudolabeling did not improve CV</li>\n<li>Training a multiclass segmentation model and using that to help refine study-label predictions</li>\n<li>Incorporating bounding box predictions into input for classification models</li>\n</ul>\n<hr>\n<p>The following is the part of the ensemble.</p>\n<h3>study level</h3>\n<p>In the end, we used a simple averaging.<br>\nI tried Nelder-Mead, ridge regression using predictions from detection models, etc., but all of them did not work because they had overfiit.<br>\nBy averaging the predictions of my two models with those of Ian's two models, we made significant improvements in both CV/LB. Since we both developed our models using each other's pipelines, there was a lot of diversity in the models, and by mixing our predictions at the end, the final predictions were more robust.<br>\nOur final study level LB was about 0.413.</p>\n<h3>image level</h3>\n<p>I mixed my yolov5 with Ian's effdet and mmdet Swin Transformer models in wbf. I saw a big improvement. I used the same weights for all the models as I did not see any improvement with different weights. Also, iou threshold 0.6 was the best.</p>\n<h3>code</h3>\n<p>train: <a href=\"https://github.com/yujiariyasu/siim_covid19_detection\" target=\"_blank\">https://github.com/yujiariyasu/siim_covid19_detection</a><br>\ninference: <a href=\"https://www.kaggle.com/yujiariyasu/fork-of-siim-covid-19-full-pipeline-v2\" target=\"_blank\">https://www.kaggle.com/yujiariyasu/fork-of-siim-covid-19-full-pipeline-v2</a></p>\n<p>I would like to thank all the participants for their hard work in this competition!</p>",
  "messages": [
    {
      "id": "1462646",
      "postDate": "08/10/2021 00:29:21",
      "content": "<p>First of all, I would like to thank you for organizing this very interesting competition.<br>\nAlso, I can't thank IanPan enough. After we teamed up, our score improved very quickly, as if by magic. I have learned a lot from him through this competition.</p>\n<p>The following is my part.</p>\n<hr>\n<h3>study level:</h3>\n<p>・Swin Transformer <br>\nIn my environment, Swin Transformer was the best. cait was not bad, but aux loss did not work well with cait, so I chose Swin Transformer.<br>\nI left the resolution at 384. I tried 768, but it was slightly worse. I also did some cropping, so 384 seemed to be sufficient.</p>\n<h5>1st stage:</h5>\n<p>・Pre training was done with chexpert data.<br>\nThis is Ian's idea. The data is quite different from ImageNet. we can get a good initial set of weights by pre training.<br>\nIn addition, further pre-training with the RSNA 2018 competition data before training with chexpert resulted in a slight improvement in CV over using chexpert only.<br>\nI used crop, which I will write about later, and did not use aux loss.</p>\n<h5>2nd stage:</h5>\n<p>・5classes<br>\nI included 'none' in the class.<br>\n・Cropping with detection and segmentation<br>\nBy using the predictions of the detection for cropping, I was able to apply the wisdom of the detection model to the classification model, and I also used the lung Segmentator trained by VinBigData datasets. I crop the image only in the area where the detection box (conf &gt; 0.3) or segmentation mask exists.<br>\nIf the box is used as-is, for example, a pleural effusion may result in an image that is difficult to distinguish, The box has been padded with 100 pixels.<br>\n・mixup<br>\nMixup brought about a small improvement. In the end, for my part, I used two different models, one with Mixup and one without.<br>\nAt the stage of not using aux loss, resize mix was the best, but in the end, mixup was better.<br>\n・aux loss<br>\nI used binary_cross_entropy_with_logits.<br>\nIn one of the two models, I set the negative image loss to zero.<br>\n・No pseudo label<br>\nI tried everything, but the results were slightly worse.<br>\n・The average of the 5fold model for the four classes of mAP was 0.397.</p>\n<h3>image level</h3>\n<p>・YOLOV5<br>\nI used l6&amp;l.</p>\n<h5>opacity:</h5>\n<p>・Pre training was done with RSNA 2018 data.<br>\nThe same reason as for study level.<br>\n・mixup: 0.5<br>\nThere was a slight improvement.<br>\n・Use none predictions<br>\nFor each image, I found the following improved the score the most<br>\ndection_conf = dection_conf * (1-image none prediction)**0.4</p>\n<h5>none:</h5>\n<p>I used predictions of classification models and detection models like this.<br>\nnone_pred = cl_none_pred<em>0.7 + (1 - image_conf_max)</em>0.3</p>\n<hr>\n<p>The following is a message from Ian.</p>\n<hr>\n<p>I would like to thank Yuji for agreeing to team with me. I reached out later in the competition when he was already doing really well without me. I learned a lot from him, and this competition reminded me how fun and enlightening it is to team up on Kaggle. </p>\n<h3>Classification</h3>\n<p>For classification, I trained a 5-class classifier: 4 study labels + none at image-level (vs. opacity). We only trained on 1 image/study. Since the vast majority of studies only had a single unique image, this was not really an issue. </p>\n<p>First, I pretrained the classifier on the 3 classes from the RSNA 2018 Pneumonia Detection Challenge. Then, I fine-tuned from these weights on this competition's data. This significantly increased performance. </p>\n<p>I trained a hybrid classification-segmentation model. One architecture used EfficientNet-B6 and DeepLabV3+ while the other used Swin Transformer and FPN. These were trained using the awesome Segmentation Models PyTorch library (<a href=\"https://github.com/qubvel/segmentation_models.pytorch)\" target=\"_blank\">https://github.com/qubvel/segmentation_models.pytorch)</a>. </p>\n<p>The models were trained using AdamW optimizer, 512x512 images, and data augmentation with contrast/brightness adjustment, random noise, and scale/shift/rotate using albumentations. </p>\n<p>I used BCE loss for both classification (even though you could use cross-entropy, I found BCE worked better for the metric) and segmentation, weighted 1:1. The segmentation part of the model only had 1 class for opacity. The segmentation label was generated using the bounding box labels. I turned the bounding box into an ellipse and used that as the training label. </p>\n<p>I also used mixup, which showed significant improvements. 5-fold ensemble of the EfficientNet-B6/DeepLabV3+ and Swin/FPN models (10 models total) gave 0.408 LB for study-label classification. </p>\n<h3>Detection</h3>\n<p>I trained detection models using the awesome EfficientDet library (<a href=\"https://github.com/rwightman/efficientdet-pytorch\" target=\"_blank\">https://github.com/rwightman/efficientdet-pytorch</a>) and MMDetection (<a href=\"https://github.com/open-mmlab/mmdetection)\" target=\"_blank\">https://github.com/open-mmlab/mmdetection)</a>. </p>\n<p>I also pretrained these models on the RSNA 2018 dataset (images with opacity only) using the bounding box labels. This significantly increased performance for detection as well. I trained 5-fold EfficientDet-D7X on 512x512 images (positives only). I also trained 5-fold EfficientDet-D6 on 640x640 images (positives only). </p>\n<p>To add diversity to the ensemble, I trained models in MMDetection as well. I used Swin Transformer with RepPoints, borrowing the code from <a href=\"https://github.com/SwinTransformer/Swin-Transformer-Object-Detection\" target=\"_blank\">https://github.com/SwinTransformer/Swin-Transformer-Object-Detection</a> to use Swin Transformer as a backbone for object detection. These models were trained using multi-scale training (512x512 to 768x768) and during inference 3x multi-scale TTA was used. </p>\n<p>I contributed 15 detection models (EffDet-D7X, EffDet-D6, Swin-RepPoints) for the ensemble. </p>\n<h3>What Didn't Work For Me</h3>\n<ul>\n<li>Training classifier with detection as auxiliary loss instead of augmentation</li>\n<li>Mixup during detection</li>\n<li>Training a multiclass detector (using study labels, instead of just training on single-class opacity)</li>\n<li>In my experiments, pseudolabeling did not improve CV</li>\n<li>Training a multiclass segmentation model and using that to help refine study-label predictions</li>\n<li>Incorporating bounding box predictions into input for classification models</li>\n</ul>\n<hr>\n<p>The following is the part of the ensemble.</p>\n<h3>study level</h3>\n<p>In the end, we used a simple averaging.<br>\nI tried Nelder-Mead, ridge regression using predictions from detection models, etc., but all of them did not work because they had overfiit.<br>\nBy averaging the predictions of my two models with those of Ian's two models, we made significant improvements in both CV/LB. Since we both developed our models using each other's pipelines, there was a lot of diversity in the models, and by mixing our predictions at the end, the final predictions were more robust.<br>\nOur final study level LB was about 0.413.</p>\n<h3>image level</h3>\n<p>I mixed my yolov5 with Ian's effdet and mmdet Swin Transformer models in wbf. I saw a big improvement. I used the same weights for all the models as I did not see any improvement with different weights. Also, iou threshold 0.6 was the best.</p>\n<h3>code</h3>\n<p>train: <a href=\"https://github.com/yujiariyasu/siim_covid19_detection\" target=\"_blank\">https://github.com/yujiariyasu/siim_covid19_detection</a><br>\ninference: <a href=\"https://www.kaggle.com/yujiariyasu/fork-of-siim-covid-19-full-pipeline-v2\" target=\"_blank\">https://www.kaggle.com/yujiariyasu/fork-of-siim-covid-19-full-pipeline-v2</a></p>\n<p>I would like to thank all the participants for their hard work in this competition!</p>",
      "rawMarkdown": "First of all, I would like to thank you for organizing this very interesting competition.\nAlso, I can't thank IanPan enough. After we teamed up, our score improved very quickly, as if by magic. I have learned a lot from him through this competition.\n\nThe following is my part.\n\n---\n\n### study level:\n・Swin Transformer \nIn my environment, Swin Transformer was the best. cait was not bad, but aux loss did not work well with cait, so I chose Swin Transformer.\nI left the resolution at 384. I tried 768, but it was slightly worse. I also did some cropping, so 384 seemed to be sufficient.\n\n##### 1st stage:\n・Pre training was done with chexpert data.\nThis is Ian's idea. The data is quite different from ImageNet. we can get a good initial set of weights by pre training.\nIn addition, further pre-training with the RSNA 2018 competition data before training with chexpert resulted in a slight improvement in CV over using chexpert only.\nI used crop, which I will write about later, and did not use aux loss.\n\n##### 2nd stage:\n・5classes\nI included 'none' in the class.\n・Cropping with detection and segmentation\nBy using the predictions of the detection for cropping, I was able to apply the wisdom of the detection model to the classification model, and I also used the lung Segmentator trained by VinBigData datasets. I crop the image only in the area where the detection box (conf > 0.3) or segmentation mask exists.\nIf the box is used as-is, for example, a pleural effusion may result in an image that is difficult to distinguish, The box has been padded with 100 pixels.\n・mixup\nMixup brought about a small improvement. In the end, for my part, I used two different models, one with Mixup and one without.\nAt the stage of not using aux loss, resize mix was the best, but in the end, mixup was better.\n・aux loss\nI used binary_cross_entropy_with_logits.\nIn one of the two models, I set the negative image loss to zero.\n・No pseudo label\nI tried everything, but the results were slightly worse.\n・The average of the 5fold model for the four classes of mAP was 0.397.\n\n### image level\n・YOLOV5\nI used l6&l.\n##### opacity:\n・Pre training was done with RSNA 2018 data.\nThe same reason as for study level.\n・mixup: 0.5\nThere was a slight improvement.\n・Use none predictions\nFor each image, I found the following improved the score the most\ndection_conf = dection_conf * (1-image none prediction)**0.4\n\n##### none:\nI used predictions of classification models and detection models like this.\nnone_pred = cl_none_pred*0.7 + (1 - image_conf_max)*0.3\n\n---\n\nThe following is a message from Ian.\n\n---\nI would like to thank Yuji for agreeing to team with me. I reached out later in the competition when he was already doing really well without me. I learned a lot from him, and this competition reminded me how fun and enlightening it is to team up on Kaggle. \n\n### Classification\n\nFor classification, I trained a 5-class classifier: 4 study labels + none at image-level (vs. opacity). We only trained on 1 image/study. Since the vast majority of studies only had a single unique image, this was not really an issue. \n\nFirst, I pretrained the classifier on the 3 classes from the RSNA 2018 Pneumonia Detection Challenge. Then, I fine-tuned from these weights on this competition's data. This significantly increased performance. \n\nI trained a hybrid classification-segmentation model. One architecture used EfficientNet-B6 and DeepLabV3+ while the other used Swin Transformer and FPN. These were trained using the awesome Segmentation Models PyTorch library (https://github.com/qubvel/segmentation_models.pytorch). \n\nThe models were trained using AdamW optimizer, 512x512 images, and data augmentation with contrast/brightness adjustment, random noise, and scale/shift/rotate using albumentations. \n\nI used BCE loss for both classification (even though you could use cross-entropy, I found BCE worked better for the metric) and segmentation, weighted 1:1. The segmentation part of the model only had 1 class for opacity. The segmentation label was generated using the bounding box labels. I turned the bounding box into an ellipse and used that as the training label. \n\nI also used mixup, which showed significant improvements. 5-fold ensemble of the EfficientNet-B6/DeepLabV3+ and Swin/FPN models (10 models total) gave 0.408 LB for study-label classification. \n\n### Detection \n\nI trained detection models using the awesome EfficientDet library (https://github.com/rwightman/efficientdet-pytorch) and MMDetection (https://github.com/open-mmlab/mmdetection). \n\nI also pretrained these models on the RSNA 2018 dataset (images with opacity only) using the bounding box labels. This significantly increased performance for detection as well. I trained 5-fold EfficientDet-D7X on 512x512 images (positives only). I also trained 5-fold EfficientDet-D6 on 640x640 images (positives only). \n\nTo add diversity to the ensemble, I trained models in MMDetection as well. I used Swin Transformer with RepPoints, borrowing the code from https://github.com/SwinTransformer/Swin-Transformer-Object-Detection to use Swin Transformer as a backbone for object detection. These models were trained using multi-scale training (512x512 to 768x768) and during inference 3x multi-scale TTA was used. \n\nI contributed 15 detection models (EffDet-D7X, EffDet-D6, Swin-RepPoints) for the ensemble. \n\n### What Didn't Work For Me\n- Training classifier with detection as auxiliary loss instead of augmentation\n- Mixup during detection\n- Training a multiclass detector (using study labels, instead of just training on single-class opacity)\n- In my experiments, pseudolabeling did not improve CV\n- Training a multiclass segmentation model and using that to help refine study-label predictions\n- Incorporating bounding box predictions into input for classification models\n\n---\n\nThe following is the part of the ensemble.\n\n### study level \nIn the end, we used a simple averaging.\nI tried Nelder-Mead, ridge regression using predictions from detection models, etc., but all of them did not work because they had overfiit.\nBy averaging the predictions of my two models with those of Ian's two models, we made significant improvements in both CV/LB. Since we both developed our models using each other's pipelines, there was a lot of diversity in the models, and by mixing our predictions at the end, the final predictions were more robust.\nOur final study level LB was about 0.413.\n\n### image level\nI mixed my yolov5 with Ian's effdet and mmdet Swin Transformer models in wbf. I saw a big improvement. I used the same weights for all the models as I did not see any improvement with different weights. Also, iou threshold 0.6 was the best.\n\n###code\ntrain: https://github.com/yujiariyasu/siim_covid19_detection\ninference: https://www.kaggle.com/yujiariyasu/fork-of-siim-covid-19-full-pipeline-v2\n \nI would like to thank all the participants for their hard work in this competition!",
      "votes": null
    },
    {
      "id": "1462649",
      "postDate": "08/10/2021 00:36:33",
      "content": "<p>Congratulations！🎉</p>",
      "rawMarkdown": "Congratulations！🎉",
      "votes": null
    },
    {
      "id": "1462654",
      "postDate": "08/10/2021 00:40:31",
      "content": "<p>Congrats on getting gold 👍🏻</p>",
      "rawMarkdown": "Congrats on getting gold 👍🏻",
      "votes": null
    },
    {
      "id": "1462655",
      "postDate": "08/10/2021 00:40:58",
      "content": "<p>Congrats! May I ask your detection score separately without study results and how much it improved by ensemble. Thanks!👀</p>",
      "rawMarkdown": "Congrats! May I ask your detection score separately without study results and how much it improved by ensemble. Thanks!👀",
      "votes": null
    },
    {
      "id": "1462658",
      "postDate": "08/10/2021 00:44:25",
      "content": "<p>Amazing solution, congratz on the results guys!</p>",
      "rawMarkdown": "Amazing solution, congratz on the results guys!",
      "votes": null
    },
    {
      "id": "1462659",
      "postDate": "08/10/2021 00:44:58",
      "content": "<p>congrats and thanks for the nice write-up!</p>\n<p>can I confirm the following?</p>\n<p>final public submission 0.650, which break down to<br>\nstudy: 0.413.<br>\nimage: 0.237</p>\n<p>do you have break down of:</p>\n<ul>\n<li>individual public submission map of each study class (negative, typical, indterminate, atypical)</li>\n<li>map of none and map of box opacity (I guess is about 0.82 and 0.60 respectively?)</li>\n</ul>",
      "rawMarkdown": "congrats and thanks for the nice write-up!\n\ncan I confirm the following?\n\nfinal public submission 0.650, which break down to\nstudy: 0.413.\nimage: 0.237\n\ndo you have break down of:\n - individual public submission map of each study class (negative, typical, indterminate, atypical)\n - map of none and map of box opacity (I guess is about 0.82 and 0.60 respectively?)",
      "votes": null
    },
    {
      "id": "1462661",
      "postDate": "08/10/2021 00:46:20",
      "content": "<p>Congratulations！</p>",
      "rawMarkdown": "Congratulations！",
      "votes": null
    },
    {
      "id": "1462673",
      "postDate": "08/10/2021 00:56:46",
      "content": "<p>Thanks! In fact, at the end of the competition, we didn't submit study level only. But I think it's probably 0.413. Maybe it's 0.414. We don't know much about LB since we hardly paid attention to it after working with Ian in the first place.</p>",
      "rawMarkdown": "Thanks! In fact, at the end of the competition, we didn't submit study level only. But I think it's probably 0.413. Maybe it's 0.414. We don't know much about LB since we hardly paid attention to it after working with Ian in the first place.",
      "votes": null
    },
    {
      "id": "1462675",
      "postDate": "08/10/2021 00:57:47",
      "content": "<p>Thank you!</p>",
      "rawMarkdown": "Thank you!",
      "votes": null
    },
    {
      "id": "1462676",
      "postDate": "08/10/2021 00:58:14",
      "content": "<p>So do you! Congratulations!</p>",
      "rawMarkdown": "So do you! Congratulations!",
      "votes": null
    },
    {
      "id": "1462681",
      "postDate": "08/10/2021 01:00:29",
      "content": "<p>Thanks <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> for the awesome write-up- I had a great time working with you!</p>",
      "rawMarkdown": "Thanks @yujiariyasu for the awesome write-up- I had a great time working with you!",
      "votes": null
    },
    {
      "id": "1462689",
      "postDate": "08/10/2021 01:05:23",
      "content": "<p>CV opacity ap was 0.5623. single best was 0.52~0.53.  I'm not sure how much lb. </p>",
      "rawMarkdown": "CV opacity ap was 0.5623. single best was 0.52~0.53.  I'm not sure how much lb.",
      "votes": null
    },
    {
      "id": "1462690",
      "postDate": "08/10/2021 01:05:50",
      "content": "<p>Thanks! Ian was amazing!</p>",
      "rawMarkdown": "Thanks! Ian was amazing!",
      "votes": null
    },
    {
      "id": "1462691",
      "postDate": "08/10/2021 01:06:00",
      "content": "<p>Thank you!</p>",
      "rawMarkdown": "Thank you!",
      "votes": null
    },
    {
      "id": "1462692",
      "postDate": "08/10/2021 01:06:52",
      "content": "<p>Thanks to you too! I'll try my best to be like you one day:)</p>",
      "rawMarkdown": "Thanks to you too! I'll try my best to be like you one day:)",
      "votes": null
    },
    {
      "id": "1463622",
      "postDate": "08/10/2021 09:03:38",
      "content": "<p>Nice work for both of you. There are some things that I am curious about:<br>\nWhat is the goal of \"I crop the image only in the area where the detection box (conf &gt; 0.3) or segmentation mask exists.\" Do you use cropping to preprocess image before study level prediction or to create additional training data? (Yuji part)</p>",
      "rawMarkdown": "Nice work for both of you. There are some things that I am curious about:\nWhat is the goal of \"I crop the image only in the area where the detection box (conf > 0.3) or segmentation mask exists.\" Do you use cropping to preprocess image before study level prediction or to create additional training data? (Yuji part)",
      "votes": null
    },
    {
      "id": "1463660",
      "postDate": "08/10/2021 09:19:12",
      "content": "<p>congratulations <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> </p>",
      "rawMarkdown": "congratulations @yujiariyasu",
      "votes": null
    },
    {
      "id": "1464010",
      "postDate": "08/10/2021 12:20:29",
      "content": "<p>Congrats 🎉 <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> &amp; <a href=\"https://www.kaggle.com/vaillant\" target=\"_blank\">@vaillant</a>. You guys did great.<br>\nBtw will you guys be nominating yourselves for the <strong>Student Prize</strong> ?</p>",
      "rawMarkdown": "Congrats 🎉 @yujiariyasu & @vaillant. You guys did great.\nBtw will you guys be nominating yourselves for the **Student Prize** ?",
      "votes": null
    },
    {
      "id": "1464159",
      "postDate": "08/10/2021 13:18:09",
      "content": "<p>I used cropping to preprocess the images before making study level predictions.<br>\nthe prediction results of detection will change the crop, so the wisdom of the detection model can be conveyed to the classification model.</p>",
      "rawMarkdown": "I used cropping to preprocess the images before making study level predictions.\nthe prediction results of detection will change the crop, so the wisdom of the detection model can be conveyed to the classification model.",
      "votes": null
    },
    {
      "id": "1464160",
      "postDate": "08/10/2021 13:18:28",
      "content": "<p>thank you!</p>",
      "rawMarkdown": "thank you!",
      "votes": null
    },
    {
      "id": "1464341",
      "postDate": "08/10/2021 14:38:42",
      "content": "<p><a href=\"https://www.kaggle.com/vaillant\" target=\"_blank\">@vaillant</a> is a doctor already as far as I remember, so I think your team won the prize ^^</p>",
      "rawMarkdown": "vaillant is a doctor already as far as I remember, so I think your team won the prize ^^",
      "votes": null
    },
    {
      "id": "1464364",
      "postDate": "08/10/2021 14:45:28",
      "content": "<p>congrats <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> 🎉🎉</p>",
      "rawMarkdown": "congrats @yujiariyasu 🎉🎉",
      "votes": null
    },
    {
      "id": "1464401",
      "postDate": "08/10/2021 14:58:56",
      "content": "<p>haha, I wish we do. One of the things that inspired us throughout this competition 😅</p>",
      "rawMarkdown": "haha, I wish we do. One of the things that inspired us throughout this competition 😅",
      "votes": null
    },
    {
      "id": "1464691",
      "postDate": "08/10/2021 17:03:21",
      "content": "<p><a href=\"https://www.kaggle.com/theoviel\" target=\"_blank\">@theoviel</a> perhaps <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> will claim it.. Maybe.. Let's see 😁😁</p>",
      "rawMarkdown": "theoviel perhaps @yujiariyasu will claim it.. Maybe.. Let's see 😁😁",
      "votes": null
    },
    {
      "id": "1465083",
      "postDate": "08/10/2021 21:14:09",
      "content": "<p>Congrats <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> :) <br>\nWhere did you connect the aux loss to the swin transformer? I tried to do it the same way as with efficienNet but I kept running into shape mismatch errors. Would you mind sharing your segmentation head code for the swin transformer? </p>",
      "rawMarkdown": "Congrats @yujiariyasu :) \nWhere did you connect the aux loss to the swin transformer? I tried to do it the same way as with efficienNet but I kept running into shape mismatch errors. Would you mind sharing your segmentation head code for the swin transformer?",
      "votes": null
    },
    {
      "id": "1465109",
      "postDate": "08/10/2021 21:36:24",
      "content": "<p>I graduated med school last year so we aren't eligible. </p>\n<p>Congrats on your finish!</p>",
      "rawMarkdown": "I graduated med school last year so we aren't eligible. \n\nCongrats on your finish!",
      "votes": null
    },
    {
      "id": "1465360",
      "postDate": "08/11/2021 03:09:23",
      "content": "<p>like this</p>\n<pre><code>def forward(self, x):\n    mask = self.forward_features(x)\n\n    x = self.head(mask)\n    return x, mask\n</code></pre>\n<p>And you need to resize the true mask.</p>",
      "rawMarkdown": "like this\n```\ndef forward(self, x):\n    mask = self.forward_features(x)\n\n    x = self.head(mask)\n    return x, mask\n```\nAnd you need to resize the true mask.",
      "votes": null
    },
    {
      "id": "1465519",
      "postDate": "08/11/2021 04:42:39",
      "content": "<p>Congrats <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> and thanks for sharing.<br>\nDo you plan to publish the source code?<br>\nI want to learn how to optimize params for Swin Transformer in your source code</p>",
      "rawMarkdown": "Congrats @yujiariyasu and thanks for sharing.\nDo you plan to publish the source code?\nI want to learn how to optimize params for Swin Transformer in your source code",
      "votes": null
    },
    {
      "id": "1465577",
      "postDate": "08/11/2021 05:18:57",
      "content": "<p>Congrats on your second solo win! You deserve even better than GM.<br>\nI don't plan to publish it, but I can answer any questions you have here.</p>",
      "rawMarkdown": "Congrats on your second solo win! You deserve even better than GM.\nI don't plan to publish it, but I can answer any questions you have here.",
      "votes": null
    },
    {
      "id": "1465664",
      "postDate": "08/11/2021 06:12:04",
      "content": "<p>Thank you for your reply! I mean to which block/layer of the swin did you attach the aux loss?</p>",
      "rawMarkdown": "Thank you for your reply! I mean to which block/layer of the swin did you attach the aux loss?",
      "votes": null
    },
    {
      "id": "1465703",
      "postDate": "08/11/2021 06:30:55",
      "content": "<p>The features just before I put it in the head is the input mask for the aux criterion. And head is just nn.Linear().</p>",
      "rawMarkdown": "The features just before I put it in the head is the input mask for the aux criterion. And head is just nn.Linear().",
      "votes": null
    },
    {
      "id": "1465704",
      "postDate": "08/11/2021 06:31:12",
      "content": "<p>Thank you!</p>",
      "rawMarkdown": "Thank you!",
      "votes": null
    },
    {
      "id": "1466145",
      "postDate": "08/11/2021 10:32:52",
      "content": "<p>Congrats <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> , what optimizer and learning rate strategy did you use when training swin??? </p>",
      "rawMarkdown": "Congrats @yujiariyasu , what optimizer and learning rate strategy did you use when training swin???",
      "votes": null
    },
    {
      "id": "1466177",
      "postDate": "08/11/2021 10:50:56",
      "content": "<p>adam &amp; CosineAnnealingWarmRestarts.<br>\nThe schedulers were all pretty much the same.</p>",
      "rawMarkdown": "adam & CosineAnnealingWarmRestarts.\nThe schedulers were all pretty much the same.",
      "votes": null
    },
    {
      "id": "1467311",
      "postDate": "08/11/2021 23:32:09",
      "content": "<p>Congrats bro, <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a>, hope that you will get the first place on other competitions</p>",
      "rawMarkdown": "Congrats bro, @yujiariyasu, hope that you will get the first place on other competitions",
      "votes": null
    },
    {
      "id": "1467700",
      "postDate": "08/12/2021 05:38:09",
      "content": "<p>Congrats, you are on the way to get Grandmaster rank. </p>",
      "rawMarkdown": "Congrats, you are on the way to get Grandmaster rank.",
      "votes": null
    },
    {
      "id": "1468064",
      "postDate": "08/12/2021 08:41:58",
      "content": "<p>Thanks! I hope so too.</p>",
      "rawMarkdown": "Thanks! I hope so too.",
      "votes": null
    },
    {
      "id": "1468065",
      "postDate": "08/12/2021 08:42:33",
      "content": "<p>Thanks! I'm going to proceed little by little.</p>",
      "rawMarkdown": "Thanks! I'm going to proceed little by little.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1462649,
      "author_name": "blueboy97",
      "author_url": "",
      "post_date": "08/10/2021 00:36:33",
      "content": "<p>Congratulations！🎉</p>",
      "votes": null,
      "replies": [
        {
          "id": 1462675,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/10/2021 00:57:47",
          "content": "<p>Thank you!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1462654,
      "author_name": "benihime91",
      "author_url": "",
      "post_date": "08/10/2021 00:40:31",
      "content": "<p>Congrats on getting gold 👍🏻</p>",
      "votes": null,
      "replies": [
        {
          "id": 1462676,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/10/2021 00:58:14",
          "content": "<p>So do you! Congratulations!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1462655,
      "author_name": "southsakura",
      "author_url": "",
      "post_date": "08/10/2021 00:40:58",
      "content": "<p>Congrats! May I ask your detection score separately without study results and how much it improved by ensemble. Thanks!👀</p>",
      "votes": null,
      "replies": [
        {
          "id": 1462689,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/10/2021 01:05:23",
          "content": "<p>CV opacity ap was 0.5623. single best was 0.52~0.53.  I'm not sure how much lb. </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1462658,
      "author_name": "arc144",
      "author_url": "",
      "post_date": "08/10/2021 00:44:25",
      "content": "<p>Amazing solution, congratz on the results guys!</p>",
      "votes": null,
      "replies": [
        {
          "id": 1462690,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/10/2021 01:05:50",
          "content": "<p>Thanks! Ian was amazing!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1462659,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "08/10/2021 00:44:58",
      "content": "<p>congrats and thanks for the nice write-up!</p>\n<p>can I confirm the following?</p>\n<p>final public submission 0.650, which break down to<br>\nstudy: 0.413.<br>\nimage: 0.237</p>\n<p>do you have break down of:</p>\n<ul>\n<li>individual public submission map of each study class (negative, typical, indterminate, atypical)</li>\n<li>map of none and map of box opacity (I guess is about 0.82 and 0.60 respectively?)</li>\n</ul>",
      "votes": null,
      "replies": [
        {
          "id": 1462673,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/10/2021 00:56:46",
          "content": "<p>Thanks! In fact, at the end of the competition, we didn't submit study level only. But I think it's probably 0.413. Maybe it's 0.414. We don't know much about LB since we hardly paid attention to it after working with Ian in the first place.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1462661,
      "author_name": "seongwook93",
      "author_url": "",
      "post_date": "08/10/2021 00:46:20",
      "content": "<p>Congratulations！</p>",
      "votes": null,
      "replies": [
        {
          "id": 1462691,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/10/2021 01:06:00",
          "content": "<p>Thank you!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1462681,
      "author_name": "vaillant",
      "author_url": "",
      "post_date": "08/10/2021 01:00:29",
      "content": "<p>Thanks <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> for the awesome write-up- I had a great time working with you!</p>",
      "votes": null,
      "replies": [
        {
          "id": 1462692,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/10/2021 01:06:52",
          "content": "<p>Thanks to you too! I'll try my best to be like you one day:)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1463622,
      "author_name": "namgalielei",
      "author_url": "",
      "post_date": "08/10/2021 09:03:38",
      "content": "<p>Nice work for both of you. There are some things that I am curious about:<br>\nWhat is the goal of \"I crop the image only in the area where the detection box (conf &gt; 0.3) or segmentation mask exists.\" Do you use cropping to preprocess image before study level prediction or to create additional training data? (Yuji part)</p>",
      "votes": null,
      "replies": [
        {
          "id": 1464159,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/10/2021 13:18:09",
          "content": "<p>I used cropping to preprocess the images before making study level predictions.<br>\nthe prediction results of detection will change the crop, so the wisdom of the detection model can be conveyed to the classification model.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1463660,
      "author_name": "givkashi",
      "author_url": "",
      "post_date": "08/10/2021 09:19:12",
      "content": "<p>congratulations <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> </p>",
      "votes": null,
      "replies": [
        {
          "id": 1464160,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/10/2021 13:18:28",
          "content": "<p>thank you!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1464010,
      "author_name": "awsaf49",
      "author_url": "",
      "post_date": "08/10/2021 12:20:29",
      "content": "<p>Congrats 🎉 <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> &amp; <a href=\"https://www.kaggle.com/vaillant\" target=\"_blank\">@vaillant</a>. You guys did great.<br>\nBtw will you guys be nominating yourselves for the <strong>Student Prize</strong> ?</p>",
      "votes": null,
      "replies": [
        {
          "id": 1464341,
          "author_name": "theoviel",
          "author_url": "",
          "post_date": "08/10/2021 14:38:42",
          "content": "<p><a href=\"https://www.kaggle.com/vaillant\" target=\"_blank\">@vaillant</a> is a doctor already as far as I remember, so I think your team won the prize ^^</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1464401,
          "author_name": "awsaf49",
          "author_url": "",
          "post_date": "08/10/2021 14:58:56",
          "content": "<p>haha, I wish we do. One of the things that inspired us throughout this competition 😅</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1464691,
          "author_name": "zaber666",
          "author_url": "",
          "post_date": "08/10/2021 17:03:21",
          "content": "<p><a href=\"https://www.kaggle.com/theoviel\" target=\"_blank\">@theoviel</a> perhaps <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> will claim it.. Maybe.. Let's see 😁😁</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1465109,
          "author_name": "vaillant",
          "author_url": "",
          "post_date": "08/10/2021 21:36:24",
          "content": "<p>I graduated med school last year so we aren't eligible. </p>\n<p>Congrats on your finish!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1464364,
      "author_name": "jarupula",
      "author_url": "",
      "post_date": "08/10/2021 14:45:28",
      "content": "<p>congrats <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> 🎉🎉</p>",
      "votes": null,
      "replies": [
        {
          "id": 1465704,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/11/2021 06:31:12",
          "content": "<p>Thank you!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1465083,
      "author_name": "amiiiney",
      "author_url": "",
      "post_date": "08/10/2021 21:14:09",
      "content": "<p>Congrats <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> :) <br>\nWhere did you connect the aux loss to the swin transformer? I tried to do it the same way as with efficienNet but I kept running into shape mismatch errors. Would you mind sharing your segmentation head code for the swin transformer? </p>",
      "votes": null,
      "replies": [
        {
          "id": 1465360,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/11/2021 03:09:23",
          "content": "<p>like this</p>\n<pre><code>def forward(self, x):\n    mask = self.forward_features(x)\n\n    x = self.head(mask)\n    return x, mask\n</code></pre>\n<p>And you need to resize the true mask.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1465664,
          "author_name": "amiiiney",
          "author_url": "",
          "post_date": "08/11/2021 06:12:04",
          "content": "<p>Thank you for your reply! I mean to which block/layer of the swin did you attach the aux loss?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1465703,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/11/2021 06:30:55",
          "content": "<p>The features just before I put it in the head is the input mask for the aux criterion. And head is just nn.Linear().</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1465519,
      "author_name": "nguyenbadung",
      "author_url": "",
      "post_date": "08/11/2021 04:42:39",
      "content": "<p>Congrats <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> and thanks for sharing.<br>\nDo you plan to publish the source code?<br>\nI want to learn how to optimize params for Swin Transformer in your source code</p>",
      "votes": null,
      "replies": [
        {
          "id": 1465577,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/11/2021 05:18:57",
          "content": "<p>Congrats on your second solo win! You deserve even better than GM.<br>\nI don't plan to publish it, but I can answer any questions you have here.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1466145,
      "author_name": "biglafe",
      "author_url": "",
      "post_date": "08/11/2021 10:32:52",
      "content": "<p>Congrats <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a> , what optimizer and learning rate strategy did you use when training swin??? </p>",
      "votes": null,
      "replies": [
        {
          "id": 1466177,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/11/2021 10:50:56",
          "content": "<p>adam &amp; CosineAnnealingWarmRestarts.<br>\nThe schedulers were all pretty much the same.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1467311,
      "author_name": "iniestamoh",
      "author_url": "",
      "post_date": "08/11/2021 23:32:09",
      "content": "<p>Congrats bro, <a href=\"https://www.kaggle.com/yujiariyasu\" target=\"_blank\">@yujiariyasu</a>, hope that you will get the first place on other competitions</p>",
      "votes": null,
      "replies": [
        {
          "id": 1468064,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/12/2021 08:41:58",
          "content": "<p>Thanks! I hope so too.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1467700,
      "author_name": "kingabzpro",
      "author_url": "",
      "post_date": "08/12/2021 05:38:09",
      "content": "<p>Congrats, you are on the way to get Grandmaster rank. </p>",
      "votes": null,
      "replies": [
        {
          "id": 1468065,
          "author_name": "yujiariyasu",
          "author_url": "",
          "post_date": "08/12/2021 08:42:33",
          "content": "<p>Thanks! I'm going to proceed little by little.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1462646": "First of all, I would like to thank you for organizing this very interesting competition.\nAlso, I can't thank IanPan enough. After we teamed up, our score improved very quickly, as if by magic. I have learned a lot from him through this competition.\n\nThe following is my part.\n\n---\n\n### study level:\n・Swin Transformer \nIn my environment, Swin Transformer was the best. cait was not bad, but aux loss did not work well with cait, so I chose Swin Transformer.\nI left the resolution at 384. I tried 768, but it was slightly worse. I also did some cropping, so 384 seemed to be sufficient.\n\n##### 1st stage:\n・Pre training was done with chexpert data.\nThis is Ian's idea. The data is quite different from ImageNet. we can get a good initial set of weights by pre training.\nIn addition, further pre-training with the RSNA 2018 competition data before training with chexpert resulted in a slight improvement in CV over using chexpert only.\nI used crop, which I will write about later, and did not use aux loss.\n\n##### 2nd stage:\n・5classes\nI included 'none' in the class.\n・Cropping with detection and segmentation\nBy using the predictions of the detection for cropping, I was able to apply the wisdom of the detection model to the classification model, and I also used the lung Segmentator trained by VinBigData datasets. I crop the image only in the area where the detection box (conf > 0.3) or segmentation mask exists.\nIf the box is used as-is, for example, a pleural effusion may result in an image that is difficult to distinguish, The box has been padded with 100 pixels.\n・mixup\nMixup brought about a small improvement. In the end, for my part, I used two different models, one with Mixup and one without.\nAt the stage of not using aux loss, resize mix was the best, but in the end, mixup was better.\n・aux loss\nI used binary_cross_entropy_with_logits.\nIn one of the two models, I set the negative image loss to zero.\n・No pseudo label\nI tried everything, but the results were slightly worse.\n・The average of the 5fold model for the four classes of mAP was 0.397.\n\n### image level\n・YOLOV5\nI used l6&l.\n##### opacity:\n・Pre training was done with RSNA 2018 data.\nThe same reason as for study level.\n・mixup: 0.5\nThere was a slight improvement.\n・Use none predictions\nFor each image, I found the following improved the score the most\ndection_conf = dection_conf * (1-image none prediction)**0.4\n\n##### none:\nI used predictions of classification models and detection models like this.\nnone_pred = cl_none_pred*0.7 + (1 - image_conf_max)*0.3\n\n---\n\nThe following is a message from Ian.\n\n---\nI would like to thank Yuji for agreeing to team with me. I reached out later in the competition when he was already doing really well without me. I learned a lot from him, and this competition reminded me how fun and enlightening it is to team up on Kaggle. \n\n### Classification\n\nFor classification, I trained a 5-class classifier: 4 study labels + none at image-level (vs. opacity). We only trained on 1 image/study. Since the vast majority of studies only had a single unique image, this was not really an issue. \n\nFirst, I pretrained the classifier on the 3 classes from the RSNA 2018 Pneumonia Detection Challenge. Then, I fine-tuned from these weights on this competition's data. This significantly increased performance. \n\nI trained a hybrid classification-segmentation model. One architecture used EfficientNet-B6 and DeepLabV3+ while the other used Swin Transformer and FPN. These were trained using the awesome Segmentation Models PyTorch library (https://github.com/qubvel/segmentation_models.pytorch). \n\nThe models were trained using AdamW optimizer, 512x512 images, and data augmentation with contrast/brightness adjustment, random noise, and scale/shift/rotate using albumentations. \n\nI used BCE loss for both classification (even though you could use cross-entropy, I found BCE worked better for the metric) and segmentation, weighted 1:1. The segmentation part of the model only had 1 class for opacity. The segmentation label was generated using the bounding box labels. I turned the bounding box into an ellipse and used that as the training label. \n\nI also used mixup, which showed significant improvements. 5-fold ensemble of the EfficientNet-B6/DeepLabV3+ and Swin/FPN models (10 models total) gave 0.408 LB for study-label classification. \n\n### Detection \n\nI trained detection models using the awesome EfficientDet library (https://github.com/rwightman/efficientdet-pytorch) and MMDetection (https://github.com/open-mmlab/mmdetection). \n\nI also pretrained these models on the RSNA 2018 dataset (images with opacity only) using the bounding box labels. This significantly increased performance for detection as well. I trained 5-fold EfficientDet-D7X on 512x512 images (positives only). I also trained 5-fold EfficientDet-D6 on 640x640 images (positives only). \n\nTo add diversity to the ensemble, I trained models in MMDetection as well. I used Swin Transformer with RepPoints, borrowing the code from https://github.com/SwinTransformer/Swin-Transformer-Object-Detection to use Swin Transformer as a backbone for object detection. These models were trained using multi-scale training (512x512 to 768x768) and during inference 3x multi-scale TTA was used. \n\nI contributed 15 detection models (EffDet-D7X, EffDet-D6, Swin-RepPoints) for the ensemble. \n\n### What Didn't Work For Me\n- Training classifier with detection as auxiliary loss instead of augmentation\n- Mixup during detection\n- Training a multiclass detector (using study labels, instead of just training on single-class opacity)\n- In my experiments, pseudolabeling did not improve CV\n- Training a multiclass segmentation model and using that to help refine study-label predictions\n- Incorporating bounding box predictions into input for classification models\n\n---\n\nThe following is the part of the ensemble.\n\n### study level \nIn the end, we used a simple averaging.\nI tried Nelder-Mead, ridge regression using predictions from detection models, etc., but all of them did not work because they had overfiit.\nBy averaging the predictions of my two models with those of Ian's two models, we made significant improvements in both CV/LB. Since we both developed our models using each other's pipelines, there was a lot of diversity in the models, and by mixing our predictions at the end, the final predictions were more robust.\nOur final study level LB was about 0.413.\n\n### image level\nI mixed my yolov5 with Ian's effdet and mmdet Swin Transformer models in wbf. I saw a big improvement. I used the same weights for all the models as I did not see any improvement with different weights. Also, iou threshold 0.6 was the best.\n\n###code\ntrain: https://github.com/yujiariyasu/siim_covid19_detection\ninference: https://www.kaggle.com/yujiariyasu/fork-of-siim-covid-19-full-pipeline-v2\n \nI would like to thank all the participants for their hard work in this competition!",
    "1462649": "Congratulations！🎉",
    "1462654": "Congrats on getting gold 👍🏻",
    "1462655": "Congrats! May I ask your detection score separately without study results and how much it improved by ensemble. Thanks!👀",
    "1462658": "Amazing solution, congratz on the results guys!",
    "1462659": "congrats and thanks for the nice write-up!\n\ncan I confirm the following?\n\nfinal public submission 0.650, which break down to\nstudy: 0.413.\nimage: 0.237\n\ndo you have break down of:\n - individual public submission map of each study class (negative, typical, indterminate, atypical)\n - map of none and map of box opacity (I guess is about 0.82 and 0.60 respectively?)",
    "1462661": "Congratulations！",
    "1462673": "Thanks! In fact, at the end of the competition, we didn't submit study level only. But I think it's probably 0.413. Maybe it's 0.414. We don't know much about LB since we hardly paid attention to it after working with Ian in the first place.",
    "1462675": "Thank you!",
    "1462676": "So do you! Congratulations!",
    "1462681": "Thanks @yujiariyasu for the awesome write-up- I had a great time working with you!",
    "1462689": "CV opacity ap was 0.5623. single best was 0.52~0.53.  I'm not sure how much lb.",
    "1462690": "Thanks! Ian was amazing!",
    "1462691": "Thank you!",
    "1462692": "Thanks to you too! I'll try my best to be like you one day:)",
    "1463622": "Nice work for both of you. There are some things that I am curious about:\nWhat is the goal of \"I crop the image only in the area where the detection box (conf > 0.3) or segmentation mask exists.\" Do you use cropping to preprocess image before study level prediction or to create additional training data? (Yuji part)",
    "1463660": "congratulations @yujiariyasu",
    "1464010": "Congrats 🎉 @yujiariyasu & @vaillant. You guys did great.\nBtw will you guys be nominating yourselves for the **Student Prize** ?",
    "1464159": "I used cropping to preprocess the images before making study level predictions.\nthe prediction results of detection will change the crop, so the wisdom of the detection model can be conveyed to the classification model.",
    "1464160": "thank you!",
    "1464341": "vaillant is a doctor already as far as I remember, so I think your team won the prize ^^",
    "1464364": "congrats @yujiariyasu 🎉🎉",
    "1464401": "haha, I wish we do. One of the things that inspired us throughout this competition 😅",
    "1464691": "theoviel perhaps @yujiariyasu will claim it.. Maybe.. Let's see 😁😁",
    "1465083": "Congrats @yujiariyasu :) \nWhere did you connect the aux loss to the swin transformer? I tried to do it the same way as with efficienNet but I kept running into shape mismatch errors. Would you mind sharing your segmentation head code for the swin transformer?",
    "1465109": "I graduated med school last year so we aren't eligible. \n\nCongrats on your finish!",
    "1465360": "like this\n```\ndef forward(self, x):\n    mask = self.forward_features(x)\n\n    x = self.head(mask)\n    return x, mask\n```\nAnd you need to resize the true mask.",
    "1465519": "Congrats @yujiariyasu and thanks for sharing.\nDo you plan to publish the source code?\nI want to learn how to optimize params for Swin Transformer in your source code",
    "1465577": "Congrats on your second solo win! You deserve even better than GM.\nI don't plan to publish it, but I can answer any questions you have here.",
    "1465664": "Thank you for your reply! I mean to which block/layer of the swin did you attach the aux loss?",
    "1465703": "The features just before I put it in the head is the input mask for the aux criterion. And head is just nn.Linear().",
    "1465704": "Thank you!",
    "1466145": "Congrats @yujiariyasu , what optimizer and learning rate strategy did you use when training swin???",
    "1466177": "adam & CosineAnnealingWarmRestarts.\nThe schedulers were all pretty much the same.",
    "1467311": "Congrats bro, @yujiariyasu, hope that you will get the first place on other competitions",
    "1467700": "Congrats, you are on the way to get Grandmaster rank.",
    "1468064": "Thanks! I hope so too.",
    "1468065": "Thanks! I'm going to proceed little by little."
  },
  "source": "meta"
}