{
  "id": 152866,
  "title": "Difference between pretrained model and backbone in RCNN",
  "url": "/competitions/global-wheat-detection/discussion/152866",
  "author_name": "",
  "post_date": "2020-05-21T20:57:03.375760Z",
  "votes": 2,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Is the pre-trained model a part of the backbone model, do they have any connection?\nIf we change the backbone  what happens to the pretrained</p>",
  "messages": [
    {
      "id": "856568",
      "postDate": "05/21/2020 20:57:03",
      "content": "<p>Is the pre-trained model a part of the backbone model, do they have any connection?\nIf we change the backbone  what happens to the pretrained</p>",
      "rawMarkdown": "Is the pre-trained model a part of the backbone model, do they have any connection?\nIf we change the backbone  what happens to the pretrained",
      "votes": null
    },
    {
      "id": "856584",
      "postDate": "05/21/2020 21:23:52",
      "content": "<p>Both the backbone and the RCNN have pretrained weights.</p>\n\n<p><code>\nmodel = torchvision.models.detection.fasterrcnn_resnet50_fpn(\n        pretrained=True,\n        pretrained_backbone=True,\n    )\n</code></p>\n\n<p>torchvision only have pretrained weights (for detection) for fasterrcnn with resnet50 backbone. You can change the backbone with its own pretrained weights (efficientnet trained on imagenet for example), but I am not sure that in this case the pretrained rcnn weights are good or bad. (Probably better than random)</p>",
      "rawMarkdown": "Both the backbone and the RCNN have pretrained weights.\n\n```\nmodel = torchvision.models.detection.fasterrcnn_resnet50_fpn(\n        pretrained=True,\n        pretrained_backbone=True,\n    )\n```\n\ntorchvision only have pretrained weights (for detection) for fasterrcnn with resnet50 backbone. You can change the backbone with its own pretrained weights (efficientnet trained on imagenet for example), but I am not sure that in this case the pretrained rcnn weights are good or bad. (Probably better than random)",
      "votes": null
    },
    {
      "id": "900392",
      "postDate": "06/24/2020 19:25:35",
      "content": "<p>Hi <a href=\"/pestipeti\">@pestipeti</a>, I'm still kinda confused with the word \"backbone\" in deep learning. I searched on google and it says \"backbone\" refers to the feature extraction. Does it mean \"backbone\" is the CNN part of the model?</p>",
      "rawMarkdown": "Hi @pestipeti, I'm still kinda confused with the word \"backbone\" in deep learning. I searched on google and it says \"backbone\" refers to the feature extraction. Does it mean \"backbone\" is the CNN part of the model?",
      "votes": null
    },
    {
      "id": "900432",
      "postDate": "06/24/2020 19:56:47",
      "content": "<p>Essentially yes. In the torchvision framework I believe you are using there is several components. The backbone, likely pretrained on an existing dataset, extracts features from the image using 2D covolutions. You're likely using the default backbone \"resnet50\" which is just a deep CNN with repeating \"residual\" blocks (<a href=\"https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.researchgate.net%2Ffigure%2FLeft-ResNet50-architecture-Blocks-with-dotted-line-represents-modules-that-might-be_fig3_331364877&amp;psig=AOvVaw0oB6oIxlqCEKylPKBMcDIJ&amp;ust=1593114720394000&amp;source=images&amp;cd=vfe&amp;ved=0CAIQjRxqFwoTCLiQgPqcm-oCFQAAAAAdAAAAABAD\">look here to see the architecture of resnet50</a>). Feature maps are then extracted from several layers of the backbone and can then be used for the region-proposal and classification components of Faster-RCNN.</p>\n\n<p>Hopefully this helps</p>",
      "rawMarkdown": "Essentially yes. In the torchvision framework I believe you are using there is several components. The backbone, likely pretrained on an existing dataset, extracts features from the image using 2D covolutions. You're likely using the default backbone \"resnet50\" which is just a deep CNN with repeating \"residual\" blocks ([look here to see the architecture of resnet50](https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.researchgate.net%2Ffigure%2FLeft-ResNet50-architecture-Blocks-with-dotted-line-represents-modules-that-might-be_fig3_331364877&amp;psig=AOvVaw0oB6oIxlqCEKylPKBMcDIJ&amp;ust=1593114720394000&amp;source=images&amp;cd=vfe&amp;ved=0CAIQjRxqFwoTCLiQgPqcm-oCFQAAAAAdAAAAABAD)). Feature maps are then extracted from several layers of the backbone and can then be used for the region-proposal and classification components of Faster-RCNN.\n\nHopefully this helps",
      "votes": null
    },
    {
      "id": "900489",
      "postDate": "06/24/2020 20:46:28",
      "content": "<p><a href=\"/xhe071\">@xhe071</a> In the case of Faster-RCNN yes, the \"backbone\" refers to a CNN (more precisely a deep-cnn: resnet50)</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F100b9c2a814df6760188039fa9f5463d%2FHigh-level-diagram-of-Faster-R-CNN-16-for-generic-object-detection-2-Inception-v2.png?generation=1593030911704291&amp;alt=media\" alt=\"\"></p>\n\n<p>As Matthew said, the \"backbone\" (Torchvision's default is a Resnet50 model) extracts features from the input image (the CONV Layers | Extract Features part of the image above). The other parts are responsible for generating boxes/classes. </p>\n\n<p>In a simple classification task, you have the feature extractor part and an additional \"classification head\". You can call the extractor as \"backbone\". Especially if you are using some general model like resnet, vgg, efficientnet, etc.</p>",
      "rawMarkdown": "xhe071 In the case of Faster-RCNN yes, the \"backbone\" refers to a CNN (more precisely a deep-cnn: resnet50)\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F100b9c2a814df6760188039fa9f5463d%2FHigh-level-diagram-of-Faster-R-CNN-16-for-generic-object-detection-2-Inception-v2.png?generation=1593030911704291&amp;alt=media)\n\nAs Matthew said, the \"backbone\" (Torchvision's default is a Resnet50 model) extracts features from the input image (the CONV Layers | Extract Features part of the image above). The other parts are responsible for generating boxes/classes. \n\nIn a simple classification task, you have the feature extractor part and an additional \"classification head\". You can call the extractor as \"backbone\". Especially if you are using some general model like resnet, vgg, efficientnet, etc.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 856584,
      "author_name": "pestipeti",
      "author_url": "",
      "post_date": "05/21/2020 21:23:52",
      "content": "<p>Both the backbone and the RCNN have pretrained weights.</p>\n\n<p><code>\nmodel = torchvision.models.detection.fasterrcnn_resnet50_fpn(\n        pretrained=True,\n        pretrained_backbone=True,\n    )\n</code></p>\n\n<p>torchvision only have pretrained weights (for detection) for fasterrcnn with resnet50 backbone. You can change the backbone with its own pretrained weights (efficientnet trained on imagenet for example), but I am not sure that in this case the pretrained rcnn weights are good or bad. (Probably better than random)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 900392,
      "author_name": "xhe071",
      "author_url": "",
      "post_date": "06/24/2020 19:25:35",
      "content": "<p>Hi <a href=\"/pestipeti\">@pestipeti</a>, I'm still kinda confused with the word \"backbone\" in deep learning. I searched on google and it says \"backbone\" refers to the feature extraction. Does it mean \"backbone\" is the CNN part of the model?</p>",
      "votes": null,
      "replies": [
        {
          "id": 900432,
          "author_name": "matthewmasters",
          "author_url": "",
          "post_date": "06/24/2020 19:56:47",
          "content": "<p>Essentially yes. In the torchvision framework I believe you are using there is several components. The backbone, likely pretrained on an existing dataset, extracts features from the image using 2D covolutions. You're likely using the default backbone \"resnet50\" which is just a deep CNN with repeating \"residual\" blocks (<a href=\"https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.researchgate.net%2Ffigure%2FLeft-ResNet50-architecture-Blocks-with-dotted-line-represents-modules-that-might-be_fig3_331364877&amp;psig=AOvVaw0oB6oIxlqCEKylPKBMcDIJ&amp;ust=1593114720394000&amp;source=images&amp;cd=vfe&amp;ved=0CAIQjRxqFwoTCLiQgPqcm-oCFQAAAAAdAAAAABAD\">look here to see the architecture of resnet50</a>). Feature maps are then extracted from several layers of the backbone and can then be used for the region-proposal and classification components of Faster-RCNN.</p>\n\n<p>Hopefully this helps</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 900489,
          "author_name": "pestipeti",
          "author_url": "",
          "post_date": "06/24/2020 20:46:28",
          "content": "<p><a href=\"/xhe071\">@xhe071</a> In the case of Faster-RCNN yes, the \"backbone\" refers to a CNN (more precisely a deep-cnn: resnet50)</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F100b9c2a814df6760188039fa9f5463d%2FHigh-level-diagram-of-Faster-R-CNN-16-for-generic-object-detection-2-Inception-v2.png?generation=1593030911704291&amp;alt=media\" alt=\"\"></p>\n\n<p>As Matthew said, the \"backbone\" (Torchvision's default is a Resnet50 model) extracts features from the input image (the CONV Layers | Extract Features part of the image above). The other parts are responsible for generating boxes/classes. </p>\n\n<p>In a simple classification task, you have the feature extractor part and an additional \"classification head\". You can call the extractor as \"backbone\". Especially if you are using some general model like resnet, vgg, efficientnet, etc.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "856568": "Is the pre-trained model a part of the backbone model, do they have any connection?\nIf we change the backbone  what happens to the pretrained",
    "856584": "Both the backbone and the RCNN have pretrained weights.\n\n```\nmodel = torchvision.models.detection.fasterrcnn_resnet50_fpn(\n        pretrained=True,\n        pretrained_backbone=True,\n    )\n```\n\ntorchvision only have pretrained weights (for detection) for fasterrcnn with resnet50 backbone. You can change the backbone with its own pretrained weights (efficientnet trained on imagenet for example), but I am not sure that in this case the pretrained rcnn weights are good or bad. (Probably better than random)",
    "900392": "Hi @pestipeti, I'm still kinda confused with the word \"backbone\" in deep learning. I searched on google and it says \"backbone\" refers to the feature extraction. Does it mean \"backbone\" is the CNN part of the model?",
    "900432": "Essentially yes. In the torchvision framework I believe you are using there is several components. The backbone, likely pretrained on an existing dataset, extracts features from the image using 2D covolutions. You're likely using the default backbone \"resnet50\" which is just a deep CNN with repeating \"residual\" blocks ([look here to see the architecture of resnet50](https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.researchgate.net%2Ffigure%2FLeft-ResNet50-architecture-Blocks-with-dotted-line-represents-modules-that-might-be_fig3_331364877&amp;psig=AOvVaw0oB6oIxlqCEKylPKBMcDIJ&amp;ust=1593114720394000&amp;source=images&amp;cd=vfe&amp;ved=0CAIQjRxqFwoTCLiQgPqcm-oCFQAAAAAdAAAAABAD)). Feature maps are then extracted from several layers of the backbone and can then be used for the region-proposal and classification components of Faster-RCNN.\n\nHopefully this helps",
    "900489": "xhe071 In the case of Faster-RCNN yes, the \"backbone\" refers to a CNN (more precisely a deep-cnn: resnet50)\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F864684%2F100b9c2a814df6760188039fa9f5463d%2FHigh-level-diagram-of-Faster-R-CNN-16-for-generic-object-detection-2-Inception-v2.png?generation=1593030911704291&amp;alt=media)\n\nAs Matthew said, the \"backbone\" (Torchvision's default is a Resnet50 model) extracts features from the input image (the CONV Layers | Extract Features part of the image above). The other parts are responsible for generating boxes/classes. \n\nIn a simple classification task, you have the feature extractor part and an additional \"classification head\". You can call the extractor as \"backbone\". Especially if you are using some general model like resnet, vgg, efficientnet, etc."
  },
  "source": "meta"
}