{
  "id": 292560,
  "title": "【Valid MAP IOU 0.26】Experiments of using EfficientnetV2 in FPN Mask RCNN ",
  "url": "/competitions/sartorius-cell-instance-segmentation/discussion/292560",
  "author_name": "Drzhuzhe",
  "post_date": "2021-12-02T14:42:54.285000",
  "votes": 11,
  "comment_count": 7,
  "views": 0,
  "content": "<h1>2021/12/07 update</h1>\n<h2>Ablation Experiments Result</h2>\n<table>\n<thead>\n<tr>\n<th>name</th>\n<th>change</th>\n<th>description</th>\n<th>score</th>\n<th>code</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>EfficitionnetV2 backbone ( Colab lastest version)</td>\n<td>add conv_head to every output feature</td>\n<td>converge much stable and faster , I use 60 epoch but maybe 35 - 40 epoch is enough</td>\n<td>CV: 0.260 heavy overfitting</td>\n<td><a href=\"https://github.com/mrzhuzhe/Patrick/blob/main/V2_of_Efficientnetv2_hacked_detectron2.ipynb\" target=\"_blank\">https://github.com/mrzhuzhe/Patrick/blob/main/V2_of_Efficientnetv2_hacked_detectron2.ipynb</a></td>\n</tr>\n<tr>\n<td>Resnet backbone</td>\n<td>replace detectron backbone with TIMM resnet50 imagenet pretrain</td>\n<td>------</td>\n<td>CV: 0.247 heavy overfitting</td>\n<td><a href=\"https://github.com/mrzhuzhe/Patrick/blob/main/V1_of_Resnet_hacked_detectron2.ipynb\" target=\"_blank\">https://github.com/mrzhuzhe/Patrick/blob/main/V1_of_Resnet_hacked_detectron2.ipynb</a></td>\n</tr>\n<tr>\n<td>EfficitionnetV2 backbone   (previous  version)</td>\n<td>replace detectron backbone with TIMM efficientnetv2s imagenet pretrain</td>\n<td>----</td>\n<td>60 epoch CV: 0.25 120 epoch CV: 0.26</td>\n<td><a href=\"https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training\" target=\"_blank\">https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training</a></td>\n</tr>\n<tr>\n<td>Orignal Detectron2 Resnet50-FPN-RCNN</td>\n<td>----</td>\n<td>------</td>\n<td>CV 0.269 LB: 0.296</td>\n<td>------</td>\n</tr>\n</tbody>\n</table>\n<h2>Changes in lastest version</h2>\n<ol>\n<li>change output layer from b0 b1 b2 b3 b5 to  b0 b1 b2 b4 b5 , fix an anchor config bug ( seems no influence in results)</li>\n<li>add conv_head to every EdgeConv and InverConv layer , this make network topological structure more consistency to efficientnet original implements , this result in 2 x faster converge than my previous implements</li>\n</ol>\n<h1>Pros and Cons with alternate Backbone</h1>\n<p>Cons:</p>\n<ol>\n<li>lack of pretraining </li>\n<li>Risk of implement bug cause evaluation score drawback</li>\n</ol>\n<p>Pros:</p>\n<ol>\n<li>more diversity in ensemble period</li>\n<li>fully customize , can make more improvement</li>\n</ol>\n<h2>Next Version in several days</h2>\n<ol>\n<li>I will make a fully customize  RPN and roi heads in detectron2 notebook </li>\n<li>add some data aug during training</li>\n</ol>\n<hr>\n<h1>2021/12/04 update</h1>\n<p>a dirty code new version with competition data<br>\nMax map iou 0.251<br>\nMaybe some bug in it </p>\n<blockquote>\n  <p><a href=\"https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training\" target=\"_blank\">https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training</a></p>\n</blockquote>\n<p>Please leave some comment if you find some config wrong or implement bugs</p>\n<hr>\n<h2>1. An easy way to hack detectron2 Backbone and Trainer in notebook</h2>\n<h3>How to modify Detectron2</h3>\n<p>Base on  this config : COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml</p>\n<p>Resnet50 + FPN + Mask RCNN ( StandardROIHeads +  FastRCNNConvFCHead + MaskRCNNConvUpsampleHead )</p>\n<p>Then I meet a problems : How to make customize to detectron in notebook,</p>\n<h3>A template to easily modify backbone FPN and Trainer</h3>\n<blockquote>\n  <p><a href=\"https://github.com/mrzhuzhe/Patrick/blob/main/v2_of_Detectron2_Modification.ipynb\" target=\"_blank\">https://github.com/mrzhuzhe/Patrick/blob/main/v2_of_Detectron2_Modification.ipynb</a></p>\n</blockquote>\n<ol>\n<li><p>With this template we can  easily modify backbone FPN and Trainer <br>\nlike: add log , inspect model instance</p></li>\n<li><p>regardless interface namespaces restriction from object oriented (from fvcore) <br>\nrun code once and once in notebook</p></li>\n</ol>\n<p>maybe find it usefull</p>\n<h2>2. A naive way to replace Resnet with EfficientNetV2</h2>\n<blockquote>\n  <p>Notebook : <a href=\"https://www.kaggle.com/drzhuzhe/wip-pytorch-efficienetv2-fpn\" target=\"_blank\">https://www.kaggle.com/drzhuzhe/wip-pytorch-efficienetv2-fpn</a></p>\n</blockquote>\n<h3>Resnet50</h3>\n<table>\n<thead>\n<tr>\n<th>name</th>\n<th>func</th>\n<th>stride</th>\n<th>out_channel</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>stem</td>\n<td>conv2d + maxpooling</td>\n<td>2 * 2</td>\n<td>64</td>\n</tr>\n<tr>\n<td>res2(layer1)</td>\n<td>bconv</td>\n<td>1</td>\n<td>256</td>\n</tr>\n<tr>\n<td>res3(layer2)</td>\n<td>bconv</td>\n<td>2</td>\n<td>512</td>\n</tr>\n<tr>\n<td>res4(layer3)</td>\n<td>bconv</td>\n<td>2</td>\n<td>1024</td>\n</tr>\n<tr>\n<td>res5(layer4)</td>\n<td>bconv</td>\n<td>2</td>\n<td>2048</td>\n</tr>\n</tbody>\n</table>\n<h3>Efficientnetv2s</h3>\n<table>\n<thead>\n<tr>\n<th>name</th>\n<th>func</th>\n<th>stride</th>\n<th>out_channel</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>stem</td>\n<td>conv2d</td>\n<td>2</td>\n<td>24</td>\n</tr>\n<tr>\n<td>b0</td>\n<td>ConvBnAct</td>\n<td>1</td>\n<td>24</td>\n</tr>\n<tr>\n<td>b1</td>\n<td>EdgeResidual</td>\n<td>2</td>\n<td>48</td>\n</tr>\n<tr>\n<td>b2</td>\n<td>EdgeResidual</td>\n<td>2</td>\n<td>64</td>\n</tr>\n<tr>\n<td>b3</td>\n<td>InvertedResidual</td>\n<td>2</td>\n<td>128</td>\n</tr>\n<tr>\n<td>b4</td>\n<td>InvertedResidual</td>\n<td>1</td>\n<td>160</td>\n</tr>\n<tr>\n<td>b5</td>\n<td>InvertedResidual</td>\n<td>2</td>\n<td>256(original: 272)</td>\n</tr>\n</tbody>\n</table>\n<p>After reviews architecture , manually set  _out_feature_strides and _out_feature_channel</p>\n<h3>observation</h3>\n<ol>\n<li>It seems take more time to converge , with worse result</li>\n<li>does this due to lack of pretraining because I combine pretrain efficientnetV2 with original pretrain FPN  ?</li>\n<li>this model may bu have some bug in FPN , RPN , and roi head , I will keep debugging to make it better </li>\n</ol>",
  "messages": [
    {
      "id": 1603475,
      "postDate": "2021-12-02T14:42:54.287Z",
      "content": "<h1>2021/12/07 update</h1>\n<h2>Ablation Experiments Result</h2>\n<table>\n<thead>\n<tr>\n<th>name</th>\n<th>change</th>\n<th>description</th>\n<th>score</th>\n<th>code</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>EfficitionnetV2 backbone ( Colab lastest version)</td>\n<td>add conv_head to every output feature</td>\n<td>converge much stable and faster , I use 60 epoch but maybe 35 - 40 epoch is enough</td>\n<td>CV: 0.260 heavy overfitting</td>\n<td><a href=\"https://github.com/mrzhuzhe/Patrick/blob/main/V2_of_Efficientnetv2_hacked_detectron2.ipynb\" target=\"_blank\">https://github.com/mrzhuzhe/Patrick/blob/main/V2_of_Efficientnetv2_hacked_detectron2.ipynb</a></td>\n</tr>\n<tr>\n<td>Resnet backbone</td>\n<td>replace detectron backbone with TIMM resnet50 imagenet pretrain</td>\n<td>------</td>\n<td>CV: 0.247 heavy overfitting</td>\n<td><a href=\"https://github.com/mrzhuzhe/Patrick/blob/main/V1_of_Resnet_hacked_detectron2.ipynb\" target=\"_blank\">https://github.com/mrzhuzhe/Patrick/blob/main/V1_of_Resnet_hacked_detectron2.ipynb</a></td>\n</tr>\n<tr>\n<td>EfficitionnetV2 backbone   (previous  version)</td>\n<td>replace detectron backbone with TIMM efficientnetv2s imagenet pretrain</td>\n<td>----</td>\n<td>60 epoch CV: 0.25 120 epoch CV: 0.26</td>\n<td><a href=\"https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training\" target=\"_blank\">https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training</a></td>\n</tr>\n<tr>\n<td>Orignal Detectron2 Resnet50-FPN-RCNN</td>\n<td>----</td>\n<td>------</td>\n<td>CV 0.269 LB: 0.296</td>\n<td>------</td>\n</tr>\n</tbody>\n</table>\n<h2>Changes in lastest version</h2>\n<ol>\n<li>change output layer from b0 b1 b2 b3 b5 to  b0 b1 b2 b4 b5 , fix an anchor config bug ( seems no influence in results)</li>\n<li>add conv_head to every EdgeConv and InverConv layer , this make network topological structure more consistency to efficientnet original implements , this result in 2 x faster converge than my previous implements</li>\n</ol>\n<h1>Pros and Cons with alternate Backbone</h1>\n<p>Cons:</p>\n<ol>\n<li>lack of pretraining </li>\n<li>Risk of implement bug cause evaluation score drawback</li>\n</ol>\n<p>Pros:</p>\n<ol>\n<li>more diversity in ensemble period</li>\n<li>fully customize , can make more improvement</li>\n</ol>\n<h2>Next Version in several days</h2>\n<ol>\n<li>I will make a fully customize  RPN and roi heads in detectron2 notebook </li>\n<li>add some data aug during training</li>\n</ol>\n<hr>\n<h1>2021/12/04 update</h1>\n<p>a dirty code new version with competition data<br>\nMax map iou 0.251<br>\nMaybe some bug in it </p>\n<blockquote>\n  <p><a href=\"https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training\" target=\"_blank\">https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training</a></p>\n</blockquote>\n<p>Please leave some comment if you find some config wrong or implement bugs</p>\n<hr>\n<h2>1. An easy way to hack detectron2 Backbone and Trainer in notebook</h2>\n<h3>How to modify Detectron2</h3>\n<p>Base on  this config : COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml</p>\n<p>Resnet50 + FPN + Mask RCNN ( StandardROIHeads +  FastRCNNConvFCHead + MaskRCNNConvUpsampleHead )</p>\n<p>Then I meet a problems : How to make customize to detectron in notebook,</p>\n<h3>A template to easily modify backbone FPN and Trainer</h3>\n<blockquote>\n  <p><a href=\"https://github.com/mrzhuzhe/Patrick/blob/main/v2_of_Detectron2_Modification.ipynb\" target=\"_blank\">https://github.com/mrzhuzhe/Patrick/blob/main/v2_of_Detectron2_Modification.ipynb</a></p>\n</blockquote>\n<ol>\n<li><p>With this template we can  easily modify backbone FPN and Trainer <br>\nlike: add log , inspect model instance</p></li>\n<li><p>regardless interface namespaces restriction from object oriented (from fvcore) <br>\nrun code once and once in notebook</p></li>\n</ol>\n<p>maybe find it usefull</p>\n<h2>2. A naive way to replace Resnet with EfficientNetV2</h2>\n<blockquote>\n  <p>Notebook : <a href=\"https://www.kaggle.com/drzhuzhe/wip-pytorch-efficienetv2-fpn\" target=\"_blank\">https://www.kaggle.com/drzhuzhe/wip-pytorch-efficienetv2-fpn</a></p>\n</blockquote>\n<h3>Resnet50</h3>\n<table>\n<thead>\n<tr>\n<th>name</th>\n<th>func</th>\n<th>stride</th>\n<th>out_channel</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>stem</td>\n<td>conv2d + maxpooling</td>\n<td>2 * 2</td>\n<td>64</td>\n</tr>\n<tr>\n<td>res2(layer1)</td>\n<td>bconv</td>\n<td>1</td>\n<td>256</td>\n</tr>\n<tr>\n<td>res3(layer2)</td>\n<td>bconv</td>\n<td>2</td>\n<td>512</td>\n</tr>\n<tr>\n<td>res4(layer3)</td>\n<td>bconv</td>\n<td>2</td>\n<td>1024</td>\n</tr>\n<tr>\n<td>res5(layer4)</td>\n<td>bconv</td>\n<td>2</td>\n<td>2048</td>\n</tr>\n</tbody>\n</table>\n<h3>Efficientnetv2s</h3>\n<table>\n<thead>\n<tr>\n<th>name</th>\n<th>func</th>\n<th>stride</th>\n<th>out_channel</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>stem</td>\n<td>conv2d</td>\n<td>2</td>\n<td>24</td>\n</tr>\n<tr>\n<td>b0</td>\n<td>ConvBnAct</td>\n<td>1</td>\n<td>24</td>\n</tr>\n<tr>\n<td>b1</td>\n<td>EdgeResidual</td>\n<td>2</td>\n<td>48</td>\n</tr>\n<tr>\n<td>b2</td>\n<td>EdgeResidual</td>\n<td>2</td>\n<td>64</td>\n</tr>\n<tr>\n<td>b3</td>\n<td>InvertedResidual</td>\n<td>2</td>\n<td>128</td>\n</tr>\n<tr>\n<td>b4</td>\n<td>InvertedResidual</td>\n<td>1</td>\n<td>160</td>\n</tr>\n<tr>\n<td>b5</td>\n<td>InvertedResidual</td>\n<td>2</td>\n<td>256(original: 272)</td>\n</tr>\n</tbody>\n</table>\n<p>After reviews architecture , manually set  _out_feature_strides and _out_feature_channel</p>\n<h3>observation</h3>\n<ol>\n<li>It seems take more time to converge , with worse result</li>\n<li>does this due to lack of pretraining because I combine pretrain efficientnetV2 with original pretrain FPN  ?</li>\n<li>this model may bu have some bug in FPN , RPN , and roi head , I will keep debugging to make it better </li>\n</ol>",
      "rawMarkdown": "#2021/12/07 update\n\n## Ablation Experiments Result\n\n| name | change |  description | score | code |\n| ---- | ---- | ------ | ------ | ------ |\n| EfficitionnetV2 backbone ( Colab lastest version) | add conv_head to every output feature  | converge much stable and faster , I use 60 epoch but maybe 35 - 40 epoch is enough  | CV: 0.260 heavy overfitting | https://github.com/mrzhuzhe/Patrick/blob/main/V2_of_Efficientnetv2_hacked_detectron2.ipynb |\n| Resnet backbone | replace detectron backbone with TIMM resnet50 imagenet pretrain | ------ | CV: 0.247 heavy overfitting | https://github.com/mrzhuzhe/Patrick/blob/main/V1_of_Resnet_hacked_detectron2.ipynb |\n| EfficitionnetV2 backbone   (previous  version) |  replace detectron backbone with TIMM efficientnetv2s imagenet pretrain | ---- | 60 epoch CV: 0.25 120 epoch CV: 0.26   |  https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training |\n| Orignal Detectron2 Resnet50-FPN-RCNN | ---- | ------ | CV 0.269 LB: 0.296 | ------ |\n\n\n##  Changes in lastest version  \n1.  change output layer from b0 b1 b2 b3 b5 to  b0 b1 b2 b4 b5 , fix an anchor config bug ( seems no influence in results)\n2. add conv_head to every EdgeConv and InverConv layer , this make network topological structure more consistency to efficientnet original implements , this result in 2 x faster converge than my previous implements\n\n# Pros and Cons with alternate Backbone\nCons:\n1.  lack of pretraining \n2. Risk of implement bug cause evaluation score drawback\n\nPros:\n1. more diversity in ensemble period\n2. fully customize , can make more improvement\n\n\n\n## Next Version in several days\n1. I will make a fully customize  RPN and roi heads in detectron2 notebook \n2. add some data aug during training\n\n\n\n------------------------------------------------------------------------------------------------------------\n\n\n\n\n# 2021/12/04 update \n\na dirty code new version with competition data\nMax map iou 0.251\nMaybe some bug in it \n\n> https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training\n\nPlease leave some comment if you find some config wrong or implement bugs\n\n\n------------------------------------------------------------------------\n\n## 1. An easy way to hack detectron2 Backbone and Trainer in notebook\n\n### How to modify Detectron2 \n\nBase on  this config : COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml\n\nResnet50 + FPN + Mask RCNN ( StandardROIHeads +  FastRCNNConvFCHead + MaskRCNNConvUpsampleHead )\n\nThen I meet a problems : How to make customize to detectron in notebook,\n\n### A template to easily modify backbone FPN and Trainer \n\n> https://github.com/mrzhuzhe/Patrick/blob/main/v2_of_Detectron2_Modification.ipynb\n\n1. With this template we can  easily modify backbone FPN and Trainer \nlike: add log , inspect model instance\n\n2. regardless interface namespaces restriction from object oriented (from fvcore) \nrun code once and once in notebook\n\nmaybe find it usefull\n\n## 2. A naive way to replace Resnet with EfficientNetV2 \n\n> Notebook : https://www.kaggle.com/drzhuzhe/wip-pytorch-efficienetv2-fpn\n\n\n### Resnet50\n\n| name | func | stride | out_channel |\n| ---- | ---- | ------ | ------ |\n| stem | conv2d + maxpooling | 2 * 2 | 64 |\n| res2(layer1) | bconv | 1 | 256 |\n| res3(layer2) | bconv | 2 | 512 |\n| res4(layer3) | bconv | 2 | 1024 |\n| res5(layer4) | bconv | 2 | 2048 |\n\n\n### Efficientnetv2s\n\n| name | func | stride | out_channel |\n| ---- | ---- | ------ | ------ |\n| stem | conv2d | 2 | 24 |\n| b0 | ConvBnAct | 1 | 24 |\n| b1 | EdgeResidual | 2 | 48 |\n| b2 | EdgeResidual | 2 | 64 |\n| b3 | InvertedResidual | 2 | 128 |\n| b4 | InvertedResidual | 1 | 160 |\n| b5 | InvertedResidual | 2 | 256(original: 272) |\n\nAfter reviews architecture , manually set  _out_feature_strides and _out_feature_channel\n\n\n### observation\n\n1. It seems take more time to converge , with worse result\n2. does this due to lack of pretraining because I combine pretrain efficientnetV2 with original pretrain FPN  ?\n3. this model may bu have some bug in FPN , RPN , and roi head , I will keep debugging to make it better \n\n\n",
      "votes": 11
    },
    {
      "id": 1607064,
      "postDate": "2021-12-05T14:18:04.903Z",
      "content": "<p>you can try to remove this line in the output:<br>\ncfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5   # set a custom testing threshold<br>\nand use this like detectron 0.294:<br>\nTHRESHOLDS = [.15, .35, .55]<br>\nMIN_PIXELS = [75, 150, 75]<br>\nbut in my experience of learning detectron, even basic mask_rcnn learns better.</p>",
      "rawMarkdown": "you can try to remove this line in the output:\ncfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5   # set a custom testing threshold\nand use this like detectron 0.294:\nTHRESHOLDS = [.15, .35, .55]\nMIN_PIXELS = [75, 150, 75]\nbut in my experience of learning detectron, even basic mask_rcnn learns better.",
      "votes": 1
    },
    {
      "id": 1606877,
      "postDate": "2021-12-05T10:57:08.547Z",
      "content": "<p>I find something , I will public some ablation experiments it when training end</p>",
      "rawMarkdown": "I find something , I will public some ablation experiments it when training end",
      "votes": 1
    },
    {
      "id": 1606773,
      "postDate": "2021-12-05T08:46:35.550Z",
      "content": "<p>the default backbone outperform customized one.</p>\n<p>the better model with worse LB is due to metric/labelling.</p>",
      "rawMarkdown": "the default backbone outperform customized one.\n\nthe better model with worse LB is due to metric/labelling.",
      "replies": [
        {
          "id": 1606813,
          "postDate": "2021-12-05T09:37:59.370Z",
          "content": "<p>Maybe it is due to some implement bug or lack of pretraining</p>\n<p>My efficientnetv2 model valid map iou is 0.26 </p>\n<p>default R50  valid map iou is 0.267  LB: 0.296</p>\n<p>It's so close , I'm keeping trying</p>",
          "rawMarkdown": "Maybe it is due to some implement bug or lack of pretraining\n\nMy efficientnetv2 model valid map iou is 0.26 \n\ndefault R50  valid map iou is 0.267  LB: 0.296\n\nIt's so close , I'm keeping trying"
        }
      ]
    },
    {
      "id": 1603811,
      "postDate": "2021-12-02T19:52:47.857Z",
      "content": "<p>The link seems to be broken</p>",
      "rawMarkdown": "The link seems to be broken",
      "replies": [
        {
          "id": 1604267,
          "postDate": "2021-12-03T07:54:06.713Z",
          "rawMarkdown": "",
          "isDeleted": true
        },
        {
          "id": 1605176,
          "postDate": "2021-12-04T03:11:17.017Z",
          "content": "<p>please take a look at this full version:</p>\n<p><a href=\"https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training\" target=\"_blank\">https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training</a><br>\nMAX MaP IoU 0.25</p>",
          "rawMarkdown": "please take a look at this full version:\n\nhttps://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training\nMAX MaP IoU 0.25",
          "votes": 1
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 1607064,
      "author_name": "Zaakcii Ru",
      "author_url": "",
      "post_date": "2021-12-05T14:18:04.903000",
      "content": "<p>you can try to remove this line in the output:<br>\ncfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5   # set a custom testing threshold<br>\nand use this like detectron 0.294:<br>\nTHRESHOLDS = [.15, .35, .55]<br>\nMIN_PIXELS = [75, 150, 75]<br>\nbut in my experience of learning detectron, even basic mask_rcnn learns better.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1606877,
      "author_name": "Drzhuzhe",
      "author_url": "",
      "post_date": "2021-12-05T10:57:08.547000",
      "content": "<p>I find something , I will public some ablation experiments it when training end</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1606773,
      "author_name": "dragon zhang",
      "author_url": "",
      "post_date": "2021-12-05T08:46:35.550000",
      "content": "<p>the default backbone outperform customized one.</p>\n<p>the better model with worse LB is due to metric/labelling.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 1606813,
          "author_name": "Drzhuzhe",
          "author_url": "",
          "post_date": "2021-12-05T09:37:59.370000",
          "content": "<p>Maybe it is due to some implement bug or lack of pretraining</p>\n<p>My efficientnetv2 model valid map iou is 0.26 </p>\n<p>default R50  valid map iou is 0.267  LB: 0.296</p>\n<p>It's so close , I'm keeping trying</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1603811,
      "author_name": "Debarshi Chanda",
      "author_url": "",
      "post_date": "2021-12-02T19:52:47.857000",
      "content": "<p>The link seems to be broken</p>",
      "votes": 0,
      "replies": [
        {
          "id": 1604267,
          "author_name": "",
          "author_url": "",
          "post_date": "2021-12-03T07:54:06.713000",
          "content": "",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1605176,
          "author_name": "Drzhuzhe",
          "author_url": "",
          "post_date": "2021-12-04T03:11:17.017000",
          "content": "<p>please take a look at this full version:</p>\n<p><a href=\"https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training\" target=\"_blank\">https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training</a><br>\nMAX MaP IoU 0.25</p>",
          "votes": 1,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1603475": "#2021/12/07 update\n\n## Ablation Experiments Result\n\n| name | change |  description | score | code |\n| ---- | ---- | ------ | ------ | ------ |\n| EfficitionnetV2 backbone ( Colab lastest version) | add conv_head to every output feature  | converge much stable and faster , I use 60 epoch but maybe 35 - 40 epoch is enough  | CV: 0.260 heavy overfitting | https://github.com/mrzhuzhe/Patrick/blob/main/V2_of_Efficientnetv2_hacked_detectron2.ipynb |\n| Resnet backbone | replace detectron backbone with TIMM resnet50 imagenet pretrain | ------ | CV: 0.247 heavy overfitting | https://github.com/mrzhuzhe/Patrick/blob/main/V1_of_Resnet_hacked_detectron2.ipynb |\n| EfficitionnetV2 backbone   (previous  version) |  replace detectron backbone with TIMM efficientnetv2s imagenet pretrain | ---- | 60 epoch CV: 0.25 120 epoch CV: 0.26   |  https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training |\n| Orignal Detectron2 Resnet50-FPN-RCNN | ---- | ------ | CV 0.269 LB: 0.296 | ------ |\n\n\n##  Changes in lastest version  \n1.  change output layer from b0 b1 b2 b3 b5 to  b0 b1 b2 b4 b5 , fix an anchor config bug ( seems no influence in results)\n2. add conv_head to every EdgeConv and InverConv layer , this make network topological structure more consistency to efficientnet original implements , this result in 2 x faster converge than my previous implements\n\n# Pros and Cons with alternate Backbone\nCons:\n1.  lack of pretraining \n2. Risk of implement bug cause evaluation score drawback\n\nPros:\n1. more diversity in ensemble period\n2. fully customize , can make more improvement\n\n\n\n## Next Version in several days\n1. I will make a fully customize  RPN and roi heads in detectron2 notebook \n2. add some data aug during training\n\n\n\n------------------------------------------------------------------------------------------------------------\n\n\n\n\n# 2021/12/04 update \n\na dirty code new version with competition data\nMax map iou 0.251\nMaybe some bug in it \n\n> https://www.kaggle.com/drzhuzhe/efficientnetv2-detectron-2-3-training\n\nPlease leave some comment if you find some config wrong or implement bugs\n\n\n------------------------------------------------------------------------\n\n## 1. An easy way to hack detectron2 Backbone and Trainer in notebook\n\n### How to modify Detectron2 \n\nBase on  this config : COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml\n\nResnet50 + FPN + Mask RCNN ( StandardROIHeads +  FastRCNNConvFCHead + MaskRCNNConvUpsampleHead )\n\nThen I meet a problems : How to make customize to detectron in notebook,\n\n### A template to easily modify backbone FPN and Trainer \n\n> https://github.com/mrzhuzhe/Patrick/blob/main/v2_of_Detectron2_Modification.ipynb\n\n1. With this template we can  easily modify backbone FPN and Trainer \nlike: add log , inspect model instance\n\n2. regardless interface namespaces restriction from object oriented (from fvcore) \nrun code once and once in notebook\n\nmaybe find it usefull\n\n## 2. A naive way to replace Resnet with EfficientNetV2 \n\n> Notebook : https://www.kaggle.com/drzhuzhe/wip-pytorch-efficienetv2-fpn\n\n\n### Resnet50\n\n| name | func | stride | out_channel |\n| ---- | ---- | ------ | ------ |\n| stem | conv2d + maxpooling | 2 * 2 | 64 |\n| res2(layer1) | bconv | 1 | 256 |\n| res3(layer2) | bconv | 2 | 512 |\n| res4(layer3) | bconv | 2 | 1024 |\n| res5(layer4) | bconv | 2 | 2048 |\n\n\n### Efficientnetv2s\n\n| name | func | stride | out_channel |\n| ---- | ---- | ------ | ------ |\n| stem | conv2d | 2 | 24 |\n| b0 | ConvBnAct | 1 | 24 |\n| b1 | EdgeResidual | 2 | 48 |\n| b2 | EdgeResidual | 2 | 64 |\n| b3 | InvertedResidual | 2 | 128 |\n| b4 | InvertedResidual | 1 | 160 |\n| b5 | InvertedResidual | 2 | 256(original: 272) |\n\nAfter reviews architecture , manually set  _out_feature_strides and _out_feature_channel\n\n\n### observation\n\n1. It seems take more time to converge , with worse result\n2. does this due to lack of pretraining because I combine pretrain efficientnetV2 with original pretrain FPN  ?\n3. this model may bu have some bug in FPN , RPN , and roi head , I will keep debugging to make it better \n\n\n",
    "1607064": "you can try to remove this line in the output:\ncfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5   # set a custom testing threshold\nand use this like detectron 0.294:\nTHRESHOLDS = [.15, .35, .55]\nMIN_PIXELS = [75, 150, 75]\nbut in my experience of learning detectron, even basic mask_rcnn learns better.",
    "1606877": "I find something , I will public some ablation experiments it when training end",
    "1606773": "the default backbone outperform customized one.\n\nthe better model with worse LB is due to metric/labelling.",
    "1603811": "The link seems to be broken"
  }
}