{
  "id": 264311,
  "title": "12th place solution",
  "url": "/competitions/siim-covid19-detection/writeups/inoichan-12th-place-solution",
  "author_name": "",
  "post_date": "2021-08-11T18:35:50.390Z",
  "votes": 21,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Fisrst of all, many thanks to Kaggle and the hosts for hosting such an interesting competition, and congratulations to all the winners. </p>\n<p>I'm happy to have won a solo gold medal in this wonderful competition. I am grateful to Kaggler for teaming up with me so far. I have learned so much from them that I was able to win this gold medal. I also appreciate the Kaggle community. There is always a lot of knowledge being shared in Discussion and Code, and the top teams share their great solutions after the competition. Without it, I wouldn't have been able to grow as much as I am now. Thank you.</p>\n<h1>Overview</h1>\n<p><img src=\"https://user-images.githubusercontent.com/37664066/129072710-1463016b-4ca6-410c-a38b-381caaf1838b.jpg\" alt=\"classification_detection_model (1)\"></p>\n<p>Details are as follows.</p>\n<h1>Study level and ‘none’</h1>\n<p>In the first month, I had a very hard time getting any good CV score. After nearly 100 experiments, I found that data augmentation was not suitable, and when I changed the augmentation to the one shown by <a href=\"https://www.kaggle.com/haqishen\" target=\"_blank\">@haqishen</a> in the RANZCR solution, the CV increased dramatically.<br>\n<a href=\"https://www.kaggle.com/haqishen/ranzcr-1st-place-soluiton-cls-model-small-ver\" target=\"_blank\">https://www.kaggle.com/haqishen/ranzcr-1st-place-soluiton-cls-model-small-ver</a></p>\n<p>CV was always better with 5-class classification including ‘none’ than with 4-class + ‘none’ separately. It was better to use sigmoid + bce than softmax + ce.</p>\n<h3>Model architecture</h3>\n<p><img src=\"https://user-images.githubusercontent.com/37664066/129072712-fd132e44-aa4c-4f96-a4c1-ffabdec82619.jpg\"> <img src=\"https://user-images.githubusercontent.com/37664066/129072715-21fe7031-6466-42b8-97b8-30cc0e6f08d2.jpg\"></p>\n<h3>Other tips;</h3>\n<ul>\n<li>Five fold cross validation split by Patient</li>\n<li>model: Efficientnet v2 m, l and swin transformer base(384)</li>\n<li>optimizer: AdamW</li>\n<li>scheduler: Cosine Annealing (lr 1e-4 -&gt; 1e-5)</li>\n<li>epoch: 20 ~ 30</li>\n<li>Additional segmentation task, bce + symmetric lovasz (1 : 1)</li>\n<li>Aux loss : Cls loss = 1 : 1 (Aux loss is about twice as large as Cls loss)</li>\n<li>Pseudo labeling (bimcv+, record)</li>\n<li>TTA: HFlip</li>\n</ul>\n<p>I use the aux loss that <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> shared in the discussion.<br>\n<a href=\"https://www.kaggle.com/c/siim-covid19-detection/discussion/240233\" target=\"_blank\">https://www.kaggle.com/c/siim-covid19-detection/discussion/240233</a></p>\n<p>Best single model of study level is EffnetV2L ATfL6, CV 0.4248 / LB 0.463 / PB 0.430 (LB/PB with ‘none 1 0 0 1 1’ in Image level).</p>\n<p>Swin transformer scored a little lower, but contributed to the ensemble.</p>\n<h1>Image level</h1>\n<p>In addition to Yolo, I used several mmdet models as shown in the overview picture.<br>\nBest model is Cascade RCNN Res2Net101, CV 0.0897 / LB 0.094 / PB 0.096.</p>\n<p>WBF (th=0.5) ensemble boosted score to LB 0.098 / PB 0.101.</p>\n<p>Detection confidence was calibrated as follow;</p>\n<pre><code>det_conf = det_conf * (1 - none)**0.5\n</code></pre>\n<h2>Inference code</h2>\n<p><a href=\"https://www.kaggle.com/inoueu1/siim-sub145-lp-c2-effv2m-l-p-swin-mmdet?scriptVersionId=70843218\" target=\"_blank\">https://www.kaggle.com/inoueu1/siim-sub145-lp-c2-effv2m-l-p-swin-mmdet?scriptVersionId=70843218</a></p>",
  "messages": [
    {
      "id": "1466926",
      "postDate": "08/11/2021 17:26:32",
      "content": "<p>Fisrst of all, many thanks to Kaggle and the hosts for hosting such an interesting competition, and congratulations to all the winners. </p>\n<p>I'm happy to have won a solo gold medal in this wonderful competition. I am grateful to Kaggler for teaming up with me so far. I have learned so much from them that I was able to win this gold medal. I also appreciate the Kaggle community. There is always a lot of knowledge being shared in Discussion and Code, and the top teams share their great solutions after the competition. Without it, I wouldn't have been able to grow as much as I am now. Thank you.</p>\n<h1>Overview</h1>\n<p><img src=\"https://user-images.githubusercontent.com/37664066/129072710-1463016b-4ca6-410c-a38b-381caaf1838b.jpg\" alt=\"classification_detection_model (1)\"></p>\n<p>Details are as follows.</p>\n<h1>Study level and ‘none’</h1>\n<p>In the first month, I had a very hard time getting any good CV score. After nearly 100 experiments, I found that data augmentation was not suitable, and when I changed the augmentation to the one shown by <a href=\"https://www.kaggle.com/haqishen\" target=\"_blank\">@haqishen</a> in the RANZCR solution, the CV increased dramatically.<br>\n<a href=\"https://www.kaggle.com/haqishen/ranzcr-1st-place-soluiton-cls-model-small-ver\" target=\"_blank\">https://www.kaggle.com/haqishen/ranzcr-1st-place-soluiton-cls-model-small-ver</a></p>\n<p>CV was always better with 5-class classification including ‘none’ than with 4-class + ‘none’ separately. It was better to use sigmoid + bce than softmax + ce.</p>\n<h3>Model architecture</h3>\n<p><img src=\"https://user-images.githubusercontent.com/37664066/129072712-fd132e44-aa4c-4f96-a4c1-ffabdec82619.jpg\"> <img src=\"https://user-images.githubusercontent.com/37664066/129072715-21fe7031-6466-42b8-97b8-30cc0e6f08d2.jpg\"></p>\n<h3>Other tips;</h3>\n<ul>\n<li>Five fold cross validation split by Patient</li>\n<li>model: Efficientnet v2 m, l and swin transformer base(384)</li>\n<li>optimizer: AdamW</li>\n<li>scheduler: Cosine Annealing (lr 1e-4 -&gt; 1e-5)</li>\n<li>epoch: 20 ~ 30</li>\n<li>Additional segmentation task, bce + symmetric lovasz (1 : 1)</li>\n<li>Aux loss : Cls loss = 1 : 1 (Aux loss is about twice as large as Cls loss)</li>\n<li>Pseudo labeling (bimcv+, record)</li>\n<li>TTA: HFlip</li>\n</ul>\n<p>I use the aux loss that <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> shared in the discussion.<br>\n<a href=\"https://www.kaggle.com/c/siim-covid19-detection/discussion/240233\" target=\"_blank\">https://www.kaggle.com/c/siim-covid19-detection/discussion/240233</a></p>\n<p>Best single model of study level is EffnetV2L ATfL6, CV 0.4248 / LB 0.463 / PB 0.430 (LB/PB with ‘none 1 0 0 1 1’ in Image level).</p>\n<p>Swin transformer scored a little lower, but contributed to the ensemble.</p>\n<h1>Image level</h1>\n<p>In addition to Yolo, I used several mmdet models as shown in the overview picture.<br>\nBest model is Cascade RCNN Res2Net101, CV 0.0897 / LB 0.094 / PB 0.096.</p>\n<p>WBF (th=0.5) ensemble boosted score to LB 0.098 / PB 0.101.</p>\n<p>Detection confidence was calibrated as follow;</p>\n<pre><code>det_conf = det_conf * (1 - none)**0.5\n</code></pre>\n<h2>Inference code</h2>\n<p><a href=\"https://www.kaggle.com/inoueu1/siim-sub145-lp-c2-effv2m-l-p-swin-mmdet?scriptVersionId=70843218\" target=\"_blank\">https://www.kaggle.com/inoueu1/siim-sub145-lp-c2-effv2m-l-p-swin-mmdet?scriptVersionId=70843218</a></p>",
      "rawMarkdown": "Fisrst of all, many thanks to Kaggle and the hosts for hosting such an interesting competition, and congratulations to all the winners. \n\nI'm happy to have won a solo gold medal in this wonderful competition. I am grateful to Kaggler for teaming up with me so far. I have learned so much from them that I was able to win this gold medal. I also appreciate the Kaggle community. There is always a lot of knowledge being shared in Discussion and Code, and the top teams share their great solutions after the competition. Without it, I wouldn't have been able to grow as much as I am now. Thank you.\n\n# Overview\n\n![classification_detection_model (1)](https://user-images.githubusercontent.com/37664066/129072710-1463016b-4ca6-410c-a38b-381caaf1838b.jpg)\n\nDetails are as follows.\n\n# Study level and ‘none’\n\n\nIn the first month, I had a very hard time getting any good CV score. After nearly 100 experiments, I found that data augmentation was not suitable, and when I changed the augmentation to the one shown by @haqishen in the RANZCR solution, the CV increased dramatically.\nhttps://www.kaggle.com/haqishen/ranzcr-1st-place-soluiton-cls-model-small-ver\n\nCV was always better with 5-class classification including ‘none’ than with 4-class + ‘none’ separately. It was better to use sigmoid + bce than softmax + ce.\n\n### Model architecture\n\n<img src=\"https://user-images.githubusercontent.com/37664066/129072712-fd132e44-aa4c-4f96-a4c1-ffabdec82619.jpg\" width=\"450\"> <img src=\"https://user-images.githubusercontent.com/37664066/129072715-21fe7031-6466-42b8-97b8-30cc0e6f08d2.jpg\" width=\"450\">\n\n### Other tips;\n\n- Five fold cross validation split by Patient\n- model: Efficientnet v2 m, l and swin transformer base(384)\n- optimizer: AdamW\n- scheduler: Cosine Annealing (lr 1e-4 -> 1e-5)\n- epoch: 20 ~ 30\n- Additional segmentation task, bce + symmetric lovasz (1 : 1)\n- Aux loss : Cls loss = 1 : 1 (Aux loss is about twice as large as Cls loss)\n- Pseudo labeling (bimcv+, record)\n- TTA: HFlip\n\nI use the aux loss that @hengck23 shared in the discussion.\nhttps://www.kaggle.com/c/siim-covid19-detection/discussion/240233\n\nBest single model of study level is EffnetV2L ATfL6, CV 0.4248 / LB 0.463 / PB 0.430 (LB/PB with ‘none 1 0 0 1 1’ in Image level).\n\nSwin transformer scored a little lower, but contributed to the ensemble.\n\n\n# Image level\n\nIn addition to Yolo, I used several mmdet models as shown in the overview picture.\nBest model is Cascade RCNN Res2Net101, CV 0.0897 / LB 0.094 / PB 0.096.\n\nWBF (th=0.5) ensemble boosted score to LB 0.098 / PB 0.101.\n\nDetection confidence was calibrated as follow;\n```\ndet_conf = det_conf * (1 - none)**0.5\n```\n \n \n## Inference code\n\nhttps://www.kaggle.com/inoueu1/siim-sub145-lp-c2-effv2m-l-p-swin-mmdet?scriptVersionId=70843218",
      "votes": null
    },
    {
      "id": "1471418",
      "postDate": "08/14/2021 07:36:11",
      "content": "<p>Thanks for the great writeup! Your aux loss implementation is interesting. Also, congrats to your gold. I have one question, did you get a CV boost from your confidence calibration? We tried to make this work, but it did not help unfortunately.</p>",
      "rawMarkdown": "Thanks for the great writeup! Your aux loss implementation is interesting. Also, congrats to your gold. I have one question, did you get a CV boost from your confidence calibration? We tried to make this work, but it did not help unfortunately.",
      "votes": null
    },
    {
      "id": "1471869",
      "postDate": "08/14/2021 14:23:08",
      "content": "<p>Thank you!!<br>\nI used only LB to see the effect of the confidence calibration. I used it for the final sub because it was said to boost scores in the previous VinBigData competition, and because LB had a slightly better each time. However, the effect is marginal, about at most 0.0005, I think.</p>",
      "rawMarkdown": "Thank you!!\nI used only LB to see the effect of the confidence calibration. I used it for the final sub because it was said to boost scores in the previous VinBigData competition, and because LB had a slightly better each time. However, the effect is marginal, about at most 0.0005, I think.",
      "votes": null
    },
    {
      "id": "1480134",
      "postDate": "08/18/2021 20:17:58",
      "content": "<p>Ok interesting, thank you! :)</p>",
      "rawMarkdown": "Ok interesting, thank you! :)",
      "votes": null
    },
    {
      "id": "1610363",
      "postDate": "12/07/2021 06:37:58",
      "content": "<p>Thank you for sharing! I think it is a great solution. I have one question.<br>\n1.How is this kind of model structure created?</p>",
      "rawMarkdown": "Thank you for sharing! I think it is a great solution. I have one question.\n1.How is this kind of model structure created?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1471418,
      "author_name": "nicohrubec",
      "author_url": "",
      "post_date": "08/14/2021 07:36:11",
      "content": "<p>Thanks for the great writeup! Your aux loss implementation is interesting. Also, congrats to your gold. I have one question, did you get a CV boost from your confidence calibration? We tried to make this work, but it did not help unfortunately.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1471869,
          "author_name": "inoueu1",
          "author_url": "",
          "post_date": "08/14/2021 14:23:08",
          "content": "<p>Thank you!!<br>\nI used only LB to see the effect of the confidence calibration. I used it for the final sub because it was said to boost scores in the previous VinBigData competition, and because LB had a slightly better each time. However, the effect is marginal, about at most 0.0005, I think.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1480134,
          "author_name": "nicohrubec",
          "author_url": "",
          "post_date": "08/18/2021 20:17:58",
          "content": "<p>Ok interesting, thank you! :)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1610363,
      "author_name": "kotashimomura",
      "author_url": "",
      "post_date": "12/07/2021 06:37:58",
      "content": "<p>Thank you for sharing! I think it is a great solution. I have one question.<br>\n1.How is this kind of model structure created?</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1466926": "Fisrst of all, many thanks to Kaggle and the hosts for hosting such an interesting competition, and congratulations to all the winners. \n\nI'm happy to have won a solo gold medal in this wonderful competition. I am grateful to Kaggler for teaming up with me so far. I have learned so much from them that I was able to win this gold medal. I also appreciate the Kaggle community. There is always a lot of knowledge being shared in Discussion and Code, and the top teams share their great solutions after the competition. Without it, I wouldn't have been able to grow as much as I am now. Thank you.\n\n# Overview\n\n![classification_detection_model (1)](https://user-images.githubusercontent.com/37664066/129072710-1463016b-4ca6-410c-a38b-381caaf1838b.jpg)\n\nDetails are as follows.\n\n# Study level and ‘none’\n\n\nIn the first month, I had a very hard time getting any good CV score. After nearly 100 experiments, I found that data augmentation was not suitable, and when I changed the augmentation to the one shown by @haqishen in the RANZCR solution, the CV increased dramatically.\nhttps://www.kaggle.com/haqishen/ranzcr-1st-place-soluiton-cls-model-small-ver\n\nCV was always better with 5-class classification including ‘none’ than with 4-class + ‘none’ separately. It was better to use sigmoid + bce than softmax + ce.\n\n### Model architecture\n\n<img src=\"https://user-images.githubusercontent.com/37664066/129072712-fd132e44-aa4c-4f96-a4c1-ffabdec82619.jpg\" width=\"450\"> <img src=\"https://user-images.githubusercontent.com/37664066/129072715-21fe7031-6466-42b8-97b8-30cc0e6f08d2.jpg\" width=\"450\">\n\n### Other tips;\n\n- Five fold cross validation split by Patient\n- model: Efficientnet v2 m, l and swin transformer base(384)\n- optimizer: AdamW\n- scheduler: Cosine Annealing (lr 1e-4 -> 1e-5)\n- epoch: 20 ~ 30\n- Additional segmentation task, bce + symmetric lovasz (1 : 1)\n- Aux loss : Cls loss = 1 : 1 (Aux loss is about twice as large as Cls loss)\n- Pseudo labeling (bimcv+, record)\n- TTA: HFlip\n\nI use the aux loss that @hengck23 shared in the discussion.\nhttps://www.kaggle.com/c/siim-covid19-detection/discussion/240233\n\nBest single model of study level is EffnetV2L ATfL6, CV 0.4248 / LB 0.463 / PB 0.430 (LB/PB with ‘none 1 0 0 1 1’ in Image level).\n\nSwin transformer scored a little lower, but contributed to the ensemble.\n\n\n# Image level\n\nIn addition to Yolo, I used several mmdet models as shown in the overview picture.\nBest model is Cascade RCNN Res2Net101, CV 0.0897 / LB 0.094 / PB 0.096.\n\nWBF (th=0.5) ensemble boosted score to LB 0.098 / PB 0.101.\n\nDetection confidence was calibrated as follow;\n```\ndet_conf = det_conf * (1 - none)**0.5\n```\n \n \n## Inference code\n\nhttps://www.kaggle.com/inoueu1/siim-sub145-lp-c2-effv2m-l-p-swin-mmdet?scriptVersionId=70843218",
    "1471418": "Thanks for the great writeup! Your aux loss implementation is interesting. Also, congrats to your gold. I have one question, did you get a CV boost from your confidence calibration? We tried to make this work, but it did not help unfortunately.",
    "1471869": "Thank you!!\nI used only LB to see the effect of the confidence calibration. I used it for the final sub because it was said to boost scores in the previous VinBigData competition, and because LB had a slightly better each time. However, the effect is marginal, about at most 0.0005, I think.",
    "1480134": "Ok interesting, thank you! :)",
    "1610363": "Thank you for sharing! I think it is a great solution. I have one question.\n1.How is this kind of model structure created?"
  },
  "source": "meta"
}