{
  "id": 338869,
  "title": "H&E normalization with torchstain",
  "url": "/competitions/hubmap-organ-segmentation/discussion/338869",
  "author_name": "Carlo Alberto",
  "post_date": "2022-07-22T11:05:07.506000",
  "votes": 11,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Hi all, </p>\n<p>Given this competition is using histological images, you might find useful the torchstain package for normalizing H&amp;E-stained images <a href=\"https://github.com/EIDOSLAB/torchstain\" target=\"_blank\">https://github.com/EIDOSLAB/torchstain</a>.</p>\n<p>It supports the Mackenko [1] normalization algorithm and it is implemented in pytorch, so you can use it directly as image transform with torchvision, e.g.:</p>\n<p><code>transforms.Lambda(lambda x: normalizer.normalize(I=x, stains=False)[0]</code> .</p>\n<p>Support for tensorflow is still in beta (you can test the library by installing it directly from github)</p>\n<p>Good luck to everyone!</p>\n<p>[1] Macenko, Marc, et al. \"A method for normalizing histology slides for quantitative analysis.\" <em>2009 IEEE International Symposium on Biomedical Imaging: From Nano to Macro</em>. IEEE, 2009.</p>",
  "messages": [
    {
      "id": 1866241,
      "postDate": "2022-07-22T11:05:07.507Z",
      "content": "<p>Hi all, </p>\n<p>Given this competition is using histological images, you might find useful the torchstain package for normalizing H&amp;E-stained images <a href=\"https://github.com/EIDOSLAB/torchstain\" target=\"_blank\">https://github.com/EIDOSLAB/torchstain</a>.</p>\n<p>It supports the Mackenko [1] normalization algorithm and it is implemented in pytorch, so you can use it directly as image transform with torchvision, e.g.:</p>\n<p><code>transforms.Lambda(lambda x: normalizer.normalize(I=x, stains=False)[0]</code> .</p>\n<p>Support for tensorflow is still in beta (you can test the library by installing it directly from github)</p>\n<p>Good luck to everyone!</p>\n<p>[1] Macenko, Marc, et al. \"A method for normalizing histology slides for quantitative analysis.\" <em>2009 IEEE International Symposium on Biomedical Imaging: From Nano to Macro</em>. IEEE, 2009.</p>",
      "rawMarkdown": "Hi all, \n\nGiven this competition is using histological images, you might find useful the torchstain package for normalizing H&E-stained images https://github.com/EIDOSLAB/torchstain.\n\nIt supports the Mackenko [1] normalization algorithm and it is implemented in pytorch, so you can use it directly as image transform with torchvision, e.g.:\n\n` transforms.Lambda(lambda x: normalizer.normalize(I=x, stains=False)[0]` .\n\nSupport for tensorflow is still in beta (you can test the library by installing it directly from github)\n\nGood luck to everyone!\n\n[1] Macenko, Marc, et al. \"A method for normalizing histology slides for quantitative analysis.\" *2009 IEEE International Symposium on Biomedical Imaging: From Nano to Macro*. IEEE, 2009.",
      "votes": 11
    },
    {
      "id": 1872806,
      "postDate": "2022-07-27T08:51:20.910Z",
      "content": "<p>I did add this normalization method to my data pipeline, but my CV did not improve.<br>\nDid you achieve a performance improvement when adding this normalization method?</p>",
      "rawMarkdown": "I did add this normalization method to my data pipeline, but my CV did not improve.\nDid you achieve a performance improvement when adding this normalization method?",
      "votes": 1,
      "replies": [
        {
          "id": 1872809,
          "postDate": "2022-07-27T08:54:23.793Z",
          "content": "<p>I still haven't tested it, but the results might depend also on the target image you choose. Did you try with different images? <br>\nA useful case is if you pretrain a model on another dataset, then it might be beetter to normalize the images to look similar to the pretrain data</p>",
          "rawMarkdown": "I still haven't tested it, but the results might depend also on the target image you choose. Did you try with different images? \nA useful case is if you pretrain a model on another dataset, then it might be beetter to normalize the images to look similar to the pretrain data"
        }
      ]
    },
    {
      "id": 1874765,
      "postDate": "2022-07-28T13:33:37.907Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 1872806,
      "author_name": "Mark Wijkhuizen",
      "author_url": "",
      "post_date": "2022-07-27T08:51:20.910000",
      "content": "<p>I did add this normalization method to my data pipeline, but my CV did not improve.<br>\nDid you achieve a performance improvement when adding this normalization method?</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1872809,
          "author_name": "Carlo Alberto",
          "author_url": "",
          "post_date": "2022-07-27T08:54:23.793000",
          "content": "<p>I still haven't tested it, but the results might depend also on the target image you choose. Did you try with different images? <br>\nA useful case is if you pretrain a model on another dataset, then it might be beetter to normalize the images to look similar to the pretrain data</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1874765,
      "author_name": "",
      "author_url": "",
      "post_date": "2022-07-28T13:33:37.907000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1866241": "Hi all, \n\nGiven this competition is using histological images, you might find useful the torchstain package for normalizing H&E-stained images https://github.com/EIDOSLAB/torchstain.\n\nIt supports the Mackenko [1] normalization algorithm and it is implemented in pytorch, so you can use it directly as image transform with torchvision, e.g.:\n\n` transforms.Lambda(lambda x: normalizer.normalize(I=x, stains=False)[0]` .\n\nSupport for tensorflow is still in beta (you can test the library by installing it directly from github)\n\nGood luck to everyone!\n\n[1] Macenko, Marc, et al. \"A method for normalizing histology slides for quantitative analysis.\" *2009 IEEE International Symposium on Biomedical Imaging: From Nano to Macro*. IEEE, 2009.",
    "1872806": "I did add this normalization method to my data pipeline, but my CV did not improve.\nDid you achieve a performance improvement when adding this normalization method?",
    "1874765": ""
  }
}