{
  "id": 239035,
  "title": "15th Place Solution: CAM & Semantic Segmentation approach",
  "url": "/competitions/hpa-single-cell-image-classification/discussion/239035",
  "author_name": "Fumihiro Kaneko",
  "post_date": "2021-05-14T11:37:49.549000",
  "votes": 6,
  "comment_count": 0,
  "views": 0,
  "content": "<p>Thanks to kaggle and organizers hosting a nice competition. </p>\n<h2>Overview</h2>\n<p>I followed weakly semantic segmentation approach. So firstly I trained image level classifier and  prepared CAM, then trained segmentation model with pseudo labels from the CAM. </p>\n<h2>Pipeline</h2>\n<p>Image level classification &amp; semantic segmentation &amp; hpa cell segmentator.<br>\n<img src=\"https://raw.githubusercontent.com/Fkaneko/kaggle-hpa-single-cell-image-classification/main/images/hpa_inference.png\" alt=\"inference piple\"></p>\n<h2>Image Level Classification</h2>\n<ul>\n<li><p>model: resnest50, resnet50, resnet200d, effb3</p></li>\n<li><p>Input size: 512x512 ~ 1280x1280</p></li>\n<li><p>Loss: focal loss</p></li>\n<li><p>Class Mask: normal CAM and SC-CAM</p>\n<ul>\n<li><p><a href=\"https://arxiv.org/abs/2008.01183\" target=\"_blank\">SC-CAM,  arxiv: 2008.01183</a><br>\n Sub-category CAM,  to improve CAM localization this method introduces sub category which is generated by a clustering of CNN feature. This sub category is contributed to differentiate intra-class variation and the area of CAM will be extended as shown below.   This figure is taken from <a href=\"https://github.com/Juliachang/SC-CAM\" target=\"_blank\">https://github.com/Juliachang/SC-CAM</a><br>\n<img src=\"https://raw.githubusercontent.com/Juliachang/SC-CAM/master/teaser.png\" alt=\"SC-CAM\">   </p></li>\n<li><p>SC-CAM improved the score by 0.005~0.02 but it only worked for 512x512.<br>\n　+ SC-CAM x Puzzle CAM does not work.</p></li></ul></li>\n<li><p>Best single model: resnest50 768x768,  public 0.445  private 0.441 </p></li>\n</ul>\n<h2>Semantic Segmentation</h2>\n<ul>\n<li>model: Unet{resnest50, resnet50, resnext50}</li>\n<li>Input size: 512x512 ~ 768x768</li>\n<li>Label: pseudo label by class mask CAM&amp;SC CAM and instance mask from hpa cell segmentator</li>\n<li>Best single model: resnet50 512x512, public 0.491</li>\n</ul>\n<h2>Other Tips</h2>\n<ul>\n<li>Training speed : NGC container x Channel Last for pytorch memory format<br>\n following <a href=\"https://gist.github.com/rwightman/bb59f9e245162cee0e38bd66bd8cd77f\" target=\"_blank\">the benchmark result at timm</a>, my resnet training time reduced by 40% from my initial configuration.  Also effb training reduced by 20 or 30%.</li>\n<li>TTA<br>\nh/vflip, image scale { x1.2, x1.4} improve the CAM model score by 0.01~0.03</li>\n</ul>\n<p><a href=\"https://github.com/Fkaneko/kaggle-hpa-single-cell-image-classification\" target=\"_blank\">Code is available</a> </p>",
  "messages": [
    {
      "id": 1307341,
      "postDate": "2021-05-14T11:37:49.550Z",
      "content": "<p>Thanks to kaggle and organizers hosting a nice competition. </p>\n<h2>Overview</h2>\n<p>I followed weakly semantic segmentation approach. So firstly I trained image level classifier and  prepared CAM, then trained segmentation model with pseudo labels from the CAM. </p>\n<h2>Pipeline</h2>\n<p>Image level classification &amp; semantic segmentation &amp; hpa cell segmentator.<br>\n<img src=\"https://raw.githubusercontent.com/Fkaneko/kaggle-hpa-single-cell-image-classification/main/images/hpa_inference.png\" alt=\"inference piple\"></p>\n<h2>Image Level Classification</h2>\n<ul>\n<li><p>model: resnest50, resnet50, resnet200d, effb3</p></li>\n<li><p>Input size: 512x512 ~ 1280x1280</p></li>\n<li><p>Loss: focal loss</p></li>\n<li><p>Class Mask: normal CAM and SC-CAM</p>\n<ul>\n<li><p><a href=\"https://arxiv.org/abs/2008.01183\" target=\"_blank\">SC-CAM,  arxiv: 2008.01183</a><br>\n Sub-category CAM,  to improve CAM localization this method introduces sub category which is generated by a clustering of CNN feature. This sub category is contributed to differentiate intra-class variation and the area of CAM will be extended as shown below.   This figure is taken from <a href=\"https://github.com/Juliachang/SC-CAM\" target=\"_blank\">https://github.com/Juliachang/SC-CAM</a><br>\n<img src=\"https://raw.githubusercontent.com/Juliachang/SC-CAM/master/teaser.png\" alt=\"SC-CAM\">   </p></li>\n<li><p>SC-CAM improved the score by 0.005~0.02 but it only worked for 512x512.<br>\n　+ SC-CAM x Puzzle CAM does not work.</p></li></ul></li>\n<li><p>Best single model: resnest50 768x768,  public 0.445  private 0.441 </p></li>\n</ul>\n<h2>Semantic Segmentation</h2>\n<ul>\n<li>model: Unet{resnest50, resnet50, resnext50}</li>\n<li>Input size: 512x512 ~ 768x768</li>\n<li>Label: pseudo label by class mask CAM&amp;SC CAM and instance mask from hpa cell segmentator</li>\n<li>Best single model: resnet50 512x512, public 0.491</li>\n</ul>\n<h2>Other Tips</h2>\n<ul>\n<li>Training speed : NGC container x Channel Last for pytorch memory format<br>\n following <a href=\"https://gist.github.com/rwightman/bb59f9e245162cee0e38bd66bd8cd77f\" target=\"_blank\">the benchmark result at timm</a>, my resnet training time reduced by 40% from my initial configuration.  Also effb training reduced by 20 or 30%.</li>\n<li>TTA<br>\nh/vflip, image scale { x1.2, x1.4} improve the CAM model score by 0.01~0.03</li>\n</ul>\n<p><a href=\"https://github.com/Fkaneko/kaggle-hpa-single-cell-image-classification\" target=\"_blank\">Code is available</a> </p>",
      "rawMarkdown": "Thanks to kaggle and organizers hosting a nice competition. \n## Overview\nI followed weakly semantic segmentation approach. So firstly I trained image level classifier and  prepared CAM, then trained segmentation model with pseudo labels from the CAM. \n\n## Pipeline\n Image level classification & semantic segmentation & hpa cell segmentator.\n![inference piple](https://raw.githubusercontent.com/Fkaneko/kaggle-hpa-single-cell-image-classification/main/images/hpa_inference.png)\n\n## Image Level Classification\n- model: resnest50, resnet50, resnet200d, effb3\n- Input size: 512x512 ~ 1280x1280\n- Loss: focal loss\n- Class Mask: normal CAM and SC-CAM\n    + [SC-CAM,  arxiv: 2008.01183](https://arxiv.org/abs/2008.01183)\n         Sub-category CAM,  to improve CAM localization this method introduces sub category which is generated by a clustering of CNN feature. This sub category is contributed to differentiate intra-class variation and the area of CAM will be extended as shown below.   This figure is taken from https://github.com/Juliachang/SC-CAM\n ![SC-CAM](https://raw.githubusercontent.com/Juliachang/SC-CAM/master/teaser.png)   \n\n    + SC-CAM improved the score by 0.005~0.02 but it only worked for 512x512.\n　+ SC-CAM x Puzzle CAM does not work.\n- Best single model: resnest50 768x768,  public 0.445  private 0.441 \n\n## Semantic Segmentation\n- model: Unet{resnest50, resnet50, resnext50}\n- Input size: 512x512 ~ 768x768\n- Label: pseudo label by class mask CAM&SC CAM and instance mask from hpa cell segmentator\n- Best single model: resnet50 512x512, public 0.491\n\n## Other Tips\n - Training speed : NGC container x Channel Last for pytorch memory format\n     following [the benchmark result at timm](https://gist.github.com/rwightman/bb59f9e245162cee0e38bd66bd8cd77f), my resnet training time reduced by 40% from my initial configuration.  Also effb training reduced by 20 or 30%.\n - TTA\n    h/vflip, image scale { x1.2, x1.4} improve the CAM model score by 0.01~0.03\n\n\n[Code is available](https://github.com/Fkaneko/kaggle-hpa-single-cell-image-classification) \n",
      "votes": 6
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "1307341": "Thanks to kaggle and organizers hosting a nice competition. \n## Overview\nI followed weakly semantic segmentation approach. So firstly I trained image level classifier and  prepared CAM, then trained segmentation model with pseudo labels from the CAM. \n\n## Pipeline\n Image level classification & semantic segmentation & hpa cell segmentator.\n![inference piple](https://raw.githubusercontent.com/Fkaneko/kaggle-hpa-single-cell-image-classification/main/images/hpa_inference.png)\n\n## Image Level Classification\n- model: resnest50, resnet50, resnet200d, effb3\n- Input size: 512x512 ~ 1280x1280\n- Loss: focal loss\n- Class Mask: normal CAM and SC-CAM\n    + [SC-CAM,  arxiv: 2008.01183](https://arxiv.org/abs/2008.01183)\n         Sub-category CAM,  to improve CAM localization this method introduces sub category which is generated by a clustering of CNN feature. This sub category is contributed to differentiate intra-class variation and the area of CAM will be extended as shown below.   This figure is taken from https://github.com/Juliachang/SC-CAM\n ![SC-CAM](https://raw.githubusercontent.com/Juliachang/SC-CAM/master/teaser.png)   \n\n    + SC-CAM improved the score by 0.005~0.02 but it only worked for 512x512.\n　+ SC-CAM x Puzzle CAM does not work.\n- Best single model: resnest50 768x768,  public 0.445  private 0.441 \n\n## Semantic Segmentation\n- model: Unet{resnest50, resnet50, resnext50}\n- Input size: 512x512 ~ 768x768\n- Label: pseudo label by class mask CAM&SC CAM and instance mask from hpa cell segmentator\n- Best single model: resnet50 512x512, public 0.491\n\n## Other Tips\n - Training speed : NGC container x Channel Last for pytorch memory format\n     following [the benchmark result at timm](https://gist.github.com/rwightman/bb59f9e245162cee0e38bd66bd8cd77f), my resnet training time reduced by 40% from my initial configuration.  Also effb training reduced by 20 or 30%.\n - TTA\n    h/vflip, image scale { x1.2, x1.4} improve the CAM model score by 0.01~0.03\n\n\n[Code is available](https://github.com/Fkaneko/kaggle-hpa-single-cell-image-classification) \n"
  }
}