{
  "id": 105993,
  "title": "What does it mean to use a pretrained resnet encoder with UNET? ",
  "url": "/competitions/understanding_cloud_organization/discussion/105993",
  "author_name": "",
  "post_date": "2019-08-27T16:04:06.143169500Z",
  "votes": 4,
  "comment_count": 4,
  "views": 0,
  "content": "<p>I'm a bit new to deep learning. Does this mean we use resnet as the first half of the segmentation model and UNET as the second half? If so, how would that be possible since UNET has layers from the first half that connect to latter half? </p>",
  "messages": [
    {
      "id": "609340",
      "postDate": "08/27/2019 16:04:06",
      "content": "<p>I'm a bit new to deep learning. Does this mean we use resnet as the first half of the segmentation model and UNET as the second half? If so, how would that be possible since UNET has layers from the first half that connect to latter half? </p>",
      "rawMarkdown": "I'm a bit new to deep learning. Does this mean we use resnet as the first half of the segmentation model and UNET as the second half? If so, how would that be possible since UNET has layers from the first half that connect to latter half?",
      "votes": null
    },
    {
      "id": "609558",
      "postDate": "08/27/2019 21:11:52",
      "content": "<p>The U-Net is an encoder-decoder style network. <strong>Using U-Net with pretrained resnet encoder</strong> means that the encoder part of the U-Net will be replaced by the resnet pretrained weights.  It's a concept of transfer learning, i.e we don't need to train the model from scratch. </p>\n\n<p>Just for illustration:\n<img src=\"https://divamgupta.com/assets/images/posts/imgseg/image4.png\" alt=\"\"></p>\n\nSource of the image: <a href=\"https://divamgupta.com/image-segmentation/2019/06/06/deep-learning-semantic-segmentation-keras.html\">https://divamgupta.com/image-segmentation/2019/06/06/deep-learning-semantic-segmentation-keras.html</a>",
      "rawMarkdown": "The U-Net is an encoder-decoder style network. **Using U-Net with pretrained resnet encoder** means that the encoder part of the U-Net will be replaced by the resnet pretrained weights.  It's a concept of transfer learning, i.e we don't need to train the model from scratch. \n\nJust for illustration:\n![](https://divamgupta.com/assets/images/posts/imgseg/image4.png)\n###### Source of the image: https://divamgupta.com/image-segmentation/2019/06/06/deep-learning-semantic-segmentation-keras.html",
      "votes": null
    },
    {
      "id": "617907",
      "postDate": "09/04/2019 15:46:59",
      "content": "<p>Nice explanation</p>",
      "rawMarkdown": "Nice explanation",
      "votes": null
    },
    {
      "id": "627372",
      "postDate": "09/15/2019 20:52:12",
      "content": "<p>Thank you for the response. But UNet has connections from encoder layers to decoder layers. Does this mean these connections still exist, but its connecting the ResNet layers to the decoder layers? If so, which layers are connected to what? </p>",
      "rawMarkdown": "Thank you for the response. But UNet has connections from encoder layers to decoder layers. Does this mean these connections still exist, but its connecting the ResNet layers to the decoder layers? If so, which layers are connected to what?",
      "votes": null
    },
    {
      "id": "632743",
      "postDate": "09/24/2019 02:17:40",
      "content": "<p>You can extract any intermediate layer from a NN (Very easy in Keras/tf). So, when you use Resnet as a backbone of Unet i.e. pre-trained encoder part, you have to get the output from the intermediate layers and connect them to the corresponding decoder part manually. For an in-depth understanding, you can have a look at line 123-124 <a href=\"https://github.com/qubvel/segmentation_models/blob/master/segmentation_models/models/unet.py\">here</a> \nHappy Kaggling!</p>",
      "rawMarkdown": "You can extract any intermediate layer from a NN (Very easy in Keras/tf). So, when you use Resnet as a backbone of Unet i.e. pre-trained encoder part, you have to get the output from the intermediate layers and connect them to the corresponding decoder part manually. For an in-depth understanding, you can have a look at line 123-124 [here](https://github.com/qubvel/segmentation_models/blob/master/segmentation_models/models/unet.py) \nHappy Kaggling!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 609558,
      "author_name": "willyfitrahendria",
      "author_url": "",
      "post_date": "08/27/2019 21:11:52",
      "content": "<p>The U-Net is an encoder-decoder style network. <strong>Using U-Net with pretrained resnet encoder</strong> means that the encoder part of the U-Net will be replaced by the resnet pretrained weights.  It's a concept of transfer learning, i.e we don't need to train the model from scratch. </p>\n\n<p>Just for illustration:\n<img src=\"https://divamgupta.com/assets/images/posts/imgseg/image4.png\" alt=\"\"></p>\n\nSource of the image: <a href=\"https://divamgupta.com/image-segmentation/2019/06/06/deep-learning-semantic-segmentation-keras.html\">https://divamgupta.com/image-segmentation/2019/06/06/deep-learning-semantic-segmentation-keras.html</a>",
      "votes": null,
      "replies": [
        {
          "id": 617907,
          "author_name": "cdeotte",
          "author_url": "",
          "post_date": "09/04/2019 15:46:59",
          "content": "<p>Nice explanation</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 627372,
          "author_name": "pocketmad",
          "author_url": "",
          "post_date": "09/15/2019 20:52:12",
          "content": "<p>Thank you for the response. But UNet has connections from encoder layers to decoder layers. Does this mean these connections still exist, but its connecting the ResNet layers to the decoder layers? If so, which layers are connected to what? </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 632743,
          "author_name": "adish333",
          "author_url": "",
          "post_date": "09/24/2019 02:17:40",
          "content": "<p>You can extract any intermediate layer from a NN (Very easy in Keras/tf). So, when you use Resnet as a backbone of Unet i.e. pre-trained encoder part, you have to get the output from the intermediate layers and connect them to the corresponding decoder part manually. For an in-depth understanding, you can have a look at line 123-124 <a href=\"https://github.com/qubvel/segmentation_models/blob/master/segmentation_models/models/unet.py\">here</a> \nHappy Kaggling!</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "609340": "I'm a bit new to deep learning. Does this mean we use resnet as the first half of the segmentation model and UNET as the second half? If so, how would that be possible since UNET has layers from the first half that connect to latter half?",
    "609558": "The U-Net is an encoder-decoder style network. **Using U-Net with pretrained resnet encoder** means that the encoder part of the U-Net will be replaced by the resnet pretrained weights.  It's a concept of transfer learning, i.e we don't need to train the model from scratch. \n\nJust for illustration:\n![](https://divamgupta.com/assets/images/posts/imgseg/image4.png)\n###### Source of the image: https://divamgupta.com/image-segmentation/2019/06/06/deep-learning-semantic-segmentation-keras.html",
    "617907": "Nice explanation",
    "627372": "Thank you for the response. But UNet has connections from encoder layers to decoder layers. Does this mean these connections still exist, but its connecting the ResNet layers to the decoder layers? If so, which layers are connected to what?",
    "632743": "You can extract any intermediate layer from a NN (Very easy in Keras/tf). So, when you use Resnet as a backbone of Unet i.e. pre-trained encoder part, you have to get the output from the intermediate layers and connect them to the corresponding decoder part manually. For an in-depth understanding, you can have a look at line 123-124 [here](https://github.com/qubvel/segmentation_models/blob/master/segmentation_models/models/unet.py) \nHappy Kaggling!"
  },
  "source": "meta"
}