{
  "id": 290409,
  "title": "Custom backbone for Detectron2?",
  "url": "/competitions/sartorius-cell-instance-segmentation/discussion/290409",
  "author_name": "",
  "post_date": "2021-11-24T13:54:20.276481800Z",
  "votes": 8,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Does someone know how to use a completely custom backbone for Detectron2? A completely new custom network - not an existing pretrained one.</p>\n<p>Maybe someone has tried that. Actual code examples or reference links would be great.</p>",
  "messages": [
    {
      "id": "1594044",
      "postDate": "11/24/2021 13:54:20",
      "content": "<p>Does someone know how to use a completely custom backbone for Detectron2? A completely new custom network - not an existing pretrained one.</p>\n<p>Maybe someone has tried that. Actual code examples or reference links would be great.</p>",
      "rawMarkdown": "Does someone know how to use a completely custom backbone for Detectron2? A completely new custom network - not an existing pretrained one.\n\nMaybe someone has tried that. Actual code examples or reference links would be great.",
      "votes": null
    },
    {
      "id": "1594211",
      "postDate": "11/24/2021 16:07:51",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/superant\" target=\"_blank\">@superant</a>, I believe the solution you seek is:</p>\n<p><code>from detectron2.modeling import BACKBONE_REGISTRY, Backbone</code></p>\n<pre><code>@BACKBONE_REGISTRY.register()\nclass MyBackbone(Backbone):\n\netc..\n\ndef forward(self, image):\n\netc..\n</code></pre>\n<p>and in the config file add<br>\n<code>cfg.MODEL.BACKBONE.NAME = 'MyBackbone'  ## 'Original'</code></p>\n<p>Let me know if that works </p>",
      "rawMarkdown": "Hi @superant, I believe the solution you seek is:\n\n`from detectron2.modeling import BACKBONE_REGISTRY, Backbone`\n```\n@BACKBONE_REGISTRY.register()\nclass MyBackbone(Backbone):\n\netc..\n\ndef forward(self, image):\n\netc..\n\n```\nand in the config file add\n`cfg.MODEL.BACKBONE.NAME = 'MyBackbone'  ## 'Original' `\n \nLet me know if that works",
      "votes": null
    },
    {
      "id": "1594330",
      "postDate": "11/24/2021 17:51:58",
      "content": "<p>Thanks! I'm only starting, so it will take a while before I get some running code. With your hint I've found the page <a href=\"https://detectron2.readthedocs.io/en/latest/tutorials/write-models.html\" target=\"_blank\">https://detectron2.readthedocs.io/en/latest/tutorials/write-models.html</a> I hope that helps once I get to it.</p>",
      "rawMarkdown": "Thanks! I'm only starting, so it will take a while before I get some running code. With your hint I've found the page https://detectron2.readthedocs.io/en/latest/tutorials/write-models.html I hope that helps once I get to it.",
      "votes": null
    },
    {
      "id": "1605183",
      "postDate": "12/04/2021 03:31:52",
      "content": "<p>I have come up with a customize detecton2</p>\n<p>take a look at my last version please </p>\n<p><a href=\"https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/292560\" target=\"_blank\">https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/292560</a></p>\n<p>I use efficientnet_rw_s with imagenet pretrian weight <br>\nand fpn with coco-seg pretrain</p>\n<p>It seems converge much slower than original</p>\n<p>with Map Iou 0.012 at beggining<br>\nand Map Iou is 0.251 at 60 eps</p>\n<p>may be there are some implement bug, my code is too scrach</p>\n<p>If you find something i implement wrong , please tell me </p>\n<p>I will be very happy</p>",
      "rawMarkdown": "I have come up with a customize detecton2\n\ntake a look at my last version please \n\nhttps://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/292560\n\nI use efficientnet_rw_s with imagenet pretrian weight \nand fpn with coco-seg pretrain\n\nIt seems converge much slower than original\n\nwith Map Iou 0.012 at beggining\nand Map Iou is 0.251 at 60 eps\n\nmay be there are some implement bug, my code is too scrach\n\nIf you find something i implement wrong , please tell me \n\nI will be very happy",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1594211,
      "author_name": "imeintanis",
      "author_url": "",
      "post_date": "11/24/2021 16:07:51",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/superant\" target=\"_blank\">@superant</a>, I believe the solution you seek is:</p>\n<p><code>from detectron2.modeling import BACKBONE_REGISTRY, Backbone</code></p>\n<pre><code>@BACKBONE_REGISTRY.register()\nclass MyBackbone(Backbone):\n\netc..\n\ndef forward(self, image):\n\netc..\n</code></pre>\n<p>and in the config file add<br>\n<code>cfg.MODEL.BACKBONE.NAME = 'MyBackbone'  ## 'Original'</code></p>\n<p>Let me know if that works </p>",
      "votes": null,
      "replies": [
        {
          "id": 1594330,
          "author_name": "superant",
          "author_url": "",
          "post_date": "11/24/2021 17:51:58",
          "content": "<p>Thanks! I'm only starting, so it will take a while before I get some running code. With your hint I've found the page <a href=\"https://detectron2.readthedocs.io/en/latest/tutorials/write-models.html\" target=\"_blank\">https://detectron2.readthedocs.io/en/latest/tutorials/write-models.html</a> I hope that helps once I get to it.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1605183,
      "author_name": "drzhuzhe",
      "author_url": "",
      "post_date": "12/04/2021 03:31:52",
      "content": "<p>I have come up with a customize detecton2</p>\n<p>take a look at my last version please </p>\n<p><a href=\"https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/292560\" target=\"_blank\">https://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/292560</a></p>\n<p>I use efficientnet_rw_s with imagenet pretrian weight <br>\nand fpn with coco-seg pretrain</p>\n<p>It seems converge much slower than original</p>\n<p>with Map Iou 0.012 at beggining<br>\nand Map Iou is 0.251 at 60 eps</p>\n<p>may be there are some implement bug, my code is too scrach</p>\n<p>If you find something i implement wrong , please tell me </p>\n<p>I will be very happy</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1594044": "Does someone know how to use a completely custom backbone for Detectron2? A completely new custom network - not an existing pretrained one.\n\nMaybe someone has tried that. Actual code examples or reference links would be great.",
    "1594211": "Hi @superant, I believe the solution you seek is:\n\n`from detectron2.modeling import BACKBONE_REGISTRY, Backbone`\n```\n@BACKBONE_REGISTRY.register()\nclass MyBackbone(Backbone):\n\netc..\n\ndef forward(self, image):\n\netc..\n\n```\nand in the config file add\n`cfg.MODEL.BACKBONE.NAME = 'MyBackbone'  ## 'Original' `\n \nLet me know if that works",
    "1594330": "Thanks! I'm only starting, so it will take a while before I get some running code. With your hint I've found the page https://detectron2.readthedocs.io/en/latest/tutorials/write-models.html I hope that helps once I get to it.",
    "1605183": "I have come up with a customize detecton2\n\ntake a look at my last version please \n\nhttps://www.kaggle.com/c/sartorius-cell-instance-segmentation/discussion/292560\n\nI use efficientnet_rw_s with imagenet pretrian weight \nand fpn with coco-seg pretrain\n\nIt seems converge much slower than original\n\nwith Map Iou 0.012 at beggining\nand Map Iou is 0.251 at 60 eps\n\nmay be there are some implement bug, my code is too scrach\n\nIf you find something i implement wrong , please tell me \n\nI will be very happy"
  },
  "source": "meta"
}