{
  "id": 76880,
  "title": "Normalising strategy when using pytorch pre-trained models",
  "url": "/competitions/human-protein-atlas-image-classification/discussion/76880",
  "author_name": "",
  "post_date": "2019-01-07T14:17:45.202282800Z",
  "votes": null,
  "comment_count": 6,
  "views": 0,
  "content": "<p>when using pre-trained models,  do we need to normalize the image with the mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) as mentioned on torchvision <a href=\"https://pytorch.org/docs/stable/torchvision/models.html\">page</a>. Also how do we take care of yellow channel in this case?</p>",
  "messages": [
    {
      "id": "451703",
      "postDate": "01/07/2019 14:17:45",
      "content": "<p>when using pre-trained models,  do we need to normalize the image with the mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) as mentioned on torchvision <a href=\"https://pytorch.org/docs/stable/torchvision/models.html\">page</a>. Also how do we take care of yellow channel in this case?</p>",
      "rawMarkdown": "when using pre-trained models,  do we need to normalize the image with the mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) as mentioned on torchvision [page][1]. Also how do we take care of yellow channel in this case?\n\n\n  [1]: https://pytorch.org/docs/stable/torchvision/models.html",
      "votes": null
    },
    {
      "id": "451857",
      "postDate": "01/07/2019 19:25:10",
      "content": "<p>A common strategy to deal with non-RGB inputs is to replace the first convolutional layer with a new one and to initialize weights such the distribution (mean/std) of the first layer activations remains the same.</p>",
      "rawMarkdown": "A common strategy to deal with non-RGB inputs is to replace the first convolutional layer with a new one and to initialize weights such the distribution (mean/std) of the first layer activations remains the same.",
      "votes": null
    },
    {
      "id": "452074",
      "postDate": "01/08/2019 06:33:28",
      "content": "<p>Thanks.\nI wish to understand the preprocessing of the image before feeding it to the networks once we have modified the network as you have suggested. Should we normalize it with some mean and std? </p>",
      "rawMarkdown": "Thanks.\nI wish to understand the preprocessing of the image before feeding it to the networks once we have modified the network as you have suggested. Should we normalize it with some mean and std?",
      "votes": null
    },
    {
      "id": "452162",
      "postDate": "01/08/2019 09:50:25",
      "content": "<p>The only thing one should care about is the distribution of activations after the first convolution. One can either normalize input images by proper mean/std or just properly initialize the weights. </p>",
      "rawMarkdown": "The only thing one should care about is the distribution of activations after the first convolution. One can either normalize input images by proper mean/std or just properly initialize the weights.",
      "votes": null
    },
    {
      "id": "452252",
      "postDate": "01/08/2019 12:51:20",
      "content": "<p>Got it! Thank you very much!!</p>",
      "rawMarkdown": "Got it! Thank you very much!!",
      "votes": null
    },
    {
      "id": "452711",
      "postDate": "01/09/2019 04:20:41",
      "content": "<p>I've been using those stats and it seems to work well enough. I'm copying the weights of the first channel's convolutions to make a fourth input channel, so in that case I use mean=[0.485, 0.456, 0.406, 0.485], std=[0.229, 0.224, 0.225, 0.229], just copying the first value as the fourth.</p>",
      "rawMarkdown": "I've been using those stats and it seems to work well enough. I'm copying the weights of the first channel's convolutions to make a fourth input channel, so in that case I use mean=[0.485, 0.456, 0.406, 0.485], std=[0.229, 0.224, 0.225, 0.229], just copying the first value as the fourth.",
      "votes": null
    },
    {
      "id": "452743",
      "postDate": "01/09/2019 05:31:19",
      "content": "<p>Thanks, Although no time now, I will give this a shot :)</p>",
      "rawMarkdown": "Thanks, Although no time now, I will give this a shot :)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 451857,
      "author_name": "ddanevskyi",
      "author_url": "",
      "post_date": "01/07/2019 19:25:10",
      "content": "<p>A common strategy to deal with non-RGB inputs is to replace the first convolutional layer with a new one and to initialize weights such the distribution (mean/std) of the first layer activations remains the same.</p>",
      "votes": null,
      "replies": [
        {
          "id": 452074,
          "author_name": "sourajmishra",
          "author_url": "",
          "post_date": "01/08/2019 06:33:28",
          "content": "<p>Thanks.\nI wish to understand the preprocessing of the image before feeding it to the networks once we have modified the network as you have suggested. Should we normalize it with some mean and std? </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 452162,
          "author_name": "ddanevskyi",
          "author_url": "",
          "post_date": "01/08/2019 09:50:25",
          "content": "<p>The only thing one should care about is the distribution of activations after the first convolution. One can either normalize input images by proper mean/std or just properly initialize the weights. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 452252,
          "author_name": "sourajmishra",
          "author_url": "",
          "post_date": "01/08/2019 12:51:20",
          "content": "<p>Got it! Thank you very much!!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 452711,
      "author_name": "hortonhearsafoo",
      "author_url": "",
      "post_date": "01/09/2019 04:20:41",
      "content": "<p>I've been using those stats and it seems to work well enough. I'm copying the weights of the first channel's convolutions to make a fourth input channel, so in that case I use mean=[0.485, 0.456, 0.406, 0.485], std=[0.229, 0.224, 0.225, 0.229], just copying the first value as the fourth.</p>",
      "votes": null,
      "replies": [
        {
          "id": 452743,
          "author_name": "sourajmishra",
          "author_url": "",
          "post_date": "01/09/2019 05:31:19",
          "content": "<p>Thanks, Although no time now, I will give this a shot :)</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "451703": "when using pre-trained models,  do we need to normalize the image with the mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) as mentioned on torchvision [page][1]. Also how do we take care of yellow channel in this case?\n\n\n  [1]: https://pytorch.org/docs/stable/torchvision/models.html",
    "451857": "A common strategy to deal with non-RGB inputs is to replace the first convolutional layer with a new one and to initialize weights such the distribution (mean/std) of the first layer activations remains the same.",
    "452074": "Thanks.\nI wish to understand the preprocessing of the image before feeding it to the networks once we have modified the network as you have suggested. Should we normalize it with some mean and std?",
    "452162": "The only thing one should care about is the distribution of activations after the first convolution. One can either normalize input images by proper mean/std or just properly initialize the weights.",
    "452252": "Got it! Thank you very much!!",
    "452711": "I've been using those stats and it seems to work well enough. I'm copying the weights of the first channel's convolutions to make a fourth input channel, so in that case I use mean=[0.485, 0.456, 0.406, 0.485], std=[0.229, 0.224, 0.225, 0.229], just copying the first value as the fourth.",
    "452743": "Thanks, Although no time now, I will give this a shot :)"
  },
  "source": "meta"
}