{
  "id": 370656,
  "title": "Multiple Instance Learning : to solve the weakly supervised classification in whole slide image (WSI) ",
  "url": "/competitions/rsna-breast-cancer-detection/discussion/370656",
  "author_name": "Youness EL BRAG",
  "post_date": "2022-12-05T18:35:57.515000",
  "votes": 5,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I would like to dive deeper into this competition and think over all the possibilities that make this problem challenging to tackle.</p>\n<p><strong>1. problem Description:</strong> the competition is about predicting the probability of an image containing Cancer, therefore this seems to be an easy task to handle with a Pertrained model already built, but the real issue that comes over with challenge is the data itself I noticed a few notations after I processed that data the notebook.</p>\n<ul>\n<li><p>the data is not balanced between the labels which will lead to out-of-distribution and over-fitting which means the model will have more features of a class than other </p></li>\n\n<li><p>number of Slices: here we can say that every single image has huge Pixels values 20k-32k and this will make the model either focus on useful areas which not interested an localized cancer.</p></li>\n</ul>\n<p><strong>2. purposed solution:</strong>  i found a useful technic that tries to solve this problem Called <strong>(Multiple Instance Learning\n)</strong>.</p>\n<ul>\n<li><strong>Definition:</strong>: Multiple instance learning (MIL) is a powerful tool to solve the weakly supervised classification in whole slide image (WSI) based pathology diagnosis. However, the current MIL methods are usually based on independent and identical distribution hypothesis, thus neglect the correlation among different instances. To address this problem, we proposed a new framework, called correlated MIL.<br>\n<strong><a href=\"https://arxiv.org/pdf/2106.00908.pdf\" target=\"_blank\">Paper</a></strong><br>\n<strong><a href=\"https://github.com/szc19990412/TransMIL\" target=\"_blank\">code</a></strong></li>\n</ul>",
  "messages": [
    {
      "id": 2056114,
      "postDate": "2022-12-05T18:35:57.517Z",
      "content": "<p>I would like to dive deeper into this competition and think over all the possibilities that make this problem challenging to tackle.</p>\n<p><strong>1. problem Description:</strong> the competition is about predicting the probability of an image containing Cancer, therefore this seems to be an easy task to handle with a Pertrained model already built, but the real issue that comes over with challenge is the data itself I noticed a few notations after I processed that data the notebook.</p>\n<ul>\n<li><p>the data is not balanced between the labels which will lead to out-of-distribution and over-fitting which means the model will have more features of a class than other </p></li>\n\n<li><p>number of Slices: here we can say that every single image has huge Pixels values 20k-32k and this will make the model either focus on useful areas which not interested an localized cancer.</p></li>\n</ul>\n<p><strong>2. purposed solution:</strong>  i found a useful technic that tries to solve this problem Called <strong>(Multiple Instance Learning\n)</strong>.</p>\n<ul>\n<li><strong>Definition:</strong>: Multiple instance learning (MIL) is a powerful tool to solve the weakly supervised classification in whole slide image (WSI) based pathology diagnosis. However, the current MIL methods are usually based on independent and identical distribution hypothesis, thus neglect the correlation among different instances. To address this problem, we proposed a new framework, called correlated MIL.<br>\n<strong><a href=\"https://arxiv.org/pdf/2106.00908.pdf\" target=\"_blank\">Paper</a></strong><br>\n<strong><a href=\"https://github.com/szc19990412/TransMIL\" target=\"_blank\">code</a></strong></li>\n</ul>",
      "rawMarkdown": "I would like to dive deeper into this competition and think over all the possibilities that make this problem challenging to tackle.\n\n**1. problem Description:** the competition is about predicting the probability of an image containing Cancer, therefore this seems to be an easy task to handle with a Pertrained model already built, but the real issue that comes over with challenge is the data itself I noticed a few notations after I processed that data the notebook.\n\n- the data is not balanced between the labels which will lead to out-of-distribution and over-fitting which means the model will have more features of a class than other \n\n\n\n- number of Slices: here we can say that every single image has huge Pixels values 20k-32k and this will make the model either focus on useful areas which not interested an localized cancer.\n\n**2. purposed solution:**  i found a useful technic that tries to solve this problem Called **(Multiple Instance Learning\n)**.\n- **Definition:**: Multiple instance learning (MIL) is a powerful tool to solve the weakly supervised classification in whole slide image (WSI) based pathology diagnosis. However, the current MIL methods are usually based on independent and identical distribution hypothesis, thus neglect the correlation among different instances. To address this problem, we proposed a new framework, called correlated MIL.\n**[Paper](https://arxiv.org/pdf/2106.00908.pdf)**\n**[code](https://github.com/szc19990412/TransMIL)**\n",
      "votes": 5
    },
    {
      "id": 2056230,
      "postDate": "2022-12-05T21:54:55.073Z",
      "content": "<p>Yeah, <code>MIL</code> is something I would love to try if I continue working on the competition 🙂 Just wanted to add there are also other formulations of <code>MIL</code> in the context of DL models with a variable number of images per class, there are many ways to try to approach this 🙂</p>\n<p>Not sure if this can be useful, but I have some examples of <code>MIL</code> in this <a href=\"https://github.com/earthspecies/cornell-birdcall-competition-starter-pack/blob/master/02c_train_on_melspectrograms_pytorch_avg_pool.ipynb\" target=\"_blank\">repo</a></p>\n<p>Here is a model which is essentially taking a mean of the predictions on images for a given example, which is probably the simples <code>MIL</code> there is 😄 </p>\n<pre><code>class Model(nn.Module):\n    def __init__(self):\n        super().__init__()\n        self.cnn = nn.Sequential(*list(torchvision.models.resnet34(True).children())[:-2])\n        self.classifier = nn.Sequential(*[\n            nn.Linear(512, 512), nn.ReLU(), nn.Dropout(p=0.5), nn.BatchNorm1d(512),\n            nn.Linear(512, 512), nn.ReLU(), nn.Dropout(p=0.5), nn.BatchNorm1d(512),\n            nn.Linear(512, len(classes))\n        ])\n\n    def forward(self, x):\n        bs, im_num, ch, y_dim, x_dim = x.shape\n        x = self.cnn(x.view(-1, ch, y_dim, x_dim))\n        x = x.mean((2,3))\n        x = self.classifier(x)\n        x = x.view(bs, im_num, -1)\n        x = x.mean(-2)\n        return x\n</code></pre>",
      "rawMarkdown": "Yeah, `MIL` is something I would love to try if I continue working on the competition 🙂 Just wanted to add there are also other formulations of `MIL` in the context of DL models with a variable number of images per class, there are many ways to try to approach this 🙂\n\nNot sure if this can be useful, but I have some examples of `MIL` in this [repo](https://github.com/earthspecies/cornell-birdcall-competition-starter-pack/blob/master/02c_train_on_melspectrograms_pytorch_avg_pool.ipynb)\n\nHere is a model which is essentially taking a mean of the predictions on images for a given example, which is probably the simples `MIL` there is 😄 \n\n```\nclass Model(nn.Module):\n    def __init__(self):\n        super().__init__()\n        self.cnn = nn.Sequential(*list(torchvision.models.resnet34(True).children())[:-2])\n        self.classifier = nn.Sequential(*[\n            nn.Linear(512, 512), nn.ReLU(), nn.Dropout(p=0.5), nn.BatchNorm1d(512),\n            nn.Linear(512, 512), nn.ReLU(), nn.Dropout(p=0.5), nn.BatchNorm1d(512),\n            nn.Linear(512, len(classes))\n        ])\n    \n    def forward(self, x):\n        bs, im_num, ch, y_dim, x_dim = x.shape\n        x = self.cnn(x.view(-1, ch, y_dim, x_dim))\n        x = x.mean((2,3))\n        x = self.classifier(x)\n        x = x.view(bs, im_num, -1)\n        x = x.mean(-2)\n        return x\n```",
      "votes": 1
    },
    {
      "id": 2056315,
      "postDate": "2022-12-06T01:47:41.090Z",
      "content": "<p>I wonder if getting the assistance of a radiologist to annotate salient areas on cancer diagnosis would help improve learning.  Our models have plenty of healthy tissue to learn from, but it's probably hard from them to figure out what we mean when we say a particular image is diagnosed with cancer.</p>\n<p>The DDSM dataset has such a thing </p>\n<p><a href=\"https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=22516629#22516629e30c416b9d7e4e2aa42b617c35433a6b\" target=\"_blank\">https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=22516629#22516629e30c416b9d7e4e2aa42b617c35433a6b</a></p>",
      "rawMarkdown": "I wonder if getting the assistance of a radiologist to annotate salient areas on cancer diagnosis would help improve learning.  Our models have plenty of healthy tissue to learn from, but it's probably hard from them to figure out what we mean when we say a particular image is diagnosed with cancer.\n\nThe DDSM dataset has such a thing \n\nhttps://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=22516629#22516629e30c416b9d7e4e2aa42b617c35433a6b",
      "replies": [
        {
          "id": 2056324,
          "postDate": "2022-12-06T02:21:30.667Z",
          "content": "<p>that's the main probelm with this competition, is the data has a lot of missing features, i proposed two solutions here are :</p>\n<ol>\n<li>Multiple Instance Learning </li>\n<li>for instead of using Convolution Based models which will not perform well with low-feature representation i prefer to combine MIL with the Capsule Network because it showed promising results and it can learn from different point-views of data ( Equivariant Neural Networks )</li>\n</ol>",
          "rawMarkdown": "that's the main probelm with this competition, is the data has a lot of missing features, i proposed two solutions here are :\n1. Multiple Instance Learning \n2. for instead of using Convolution Based models which will not perform well with low-feature representation i prefer to combine MIL with the Capsule Network because it showed promising results and it can learn from different point-views of data ( Equivariant Neural Networks )"
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 2056230,
      "author_name": "Radek Osmulski",
      "author_url": "",
      "post_date": "2022-12-05T21:54:55.073000",
      "content": "<p>Yeah, <code>MIL</code> is something I would love to try if I continue working on the competition 🙂 Just wanted to add there are also other formulations of <code>MIL</code> in the context of DL models with a variable number of images per class, there are many ways to try to approach this 🙂</p>\n<p>Not sure if this can be useful, but I have some examples of <code>MIL</code> in this <a href=\"https://github.com/earthspecies/cornell-birdcall-competition-starter-pack/blob/master/02c_train_on_melspectrograms_pytorch_avg_pool.ipynb\" target=\"_blank\">repo</a></p>\n<p>Here is a model which is essentially taking a mean of the predictions on images for a given example, which is probably the simples <code>MIL</code> there is 😄 </p>\n<pre><code>class Model(nn.Module):\n    def __init__(self):\n        super().__init__()\n        self.cnn = nn.Sequential(*list(torchvision.models.resnet34(True).children())[:-2])\n        self.classifier = nn.Sequential(*[\n            nn.Linear(512, 512), nn.ReLU(), nn.Dropout(p=0.5), nn.BatchNorm1d(512),\n            nn.Linear(512, 512), nn.ReLU(), nn.Dropout(p=0.5), nn.BatchNorm1d(512),\n            nn.Linear(512, len(classes))\n        ])\n\n    def forward(self, x):\n        bs, im_num, ch, y_dim, x_dim = x.shape\n        x = self.cnn(x.view(-1, ch, y_dim, x_dim))\n        x = x.mean((2,3))\n        x = self.classifier(x)\n        x = x.view(bs, im_num, -1)\n        x = x.mean(-2)\n        return x\n</code></pre>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2056315,
      "author_name": "@kaggleqrdl",
      "author_url": "",
      "post_date": "2022-12-06T01:47:41.090000",
      "content": "<p>I wonder if getting the assistance of a radiologist to annotate salient areas on cancer diagnosis would help improve learning.  Our models have plenty of healthy tissue to learn from, but it's probably hard from them to figure out what we mean when we say a particular image is diagnosed with cancer.</p>\n<p>The DDSM dataset has such a thing </p>\n<p><a href=\"https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=22516629#22516629e30c416b9d7e4e2aa42b617c35433a6b\" target=\"_blank\">https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=22516629#22516629e30c416b9d7e4e2aa42b617c35433a6b</a></p>",
      "votes": 0,
      "replies": [
        {
          "id": 2056324,
          "author_name": "Youness EL BRAG",
          "author_url": "",
          "post_date": "2022-12-06T02:21:30.667000",
          "content": "<p>that's the main probelm with this competition, is the data has a lot of missing features, i proposed two solutions here are :</p>\n<ol>\n<li>Multiple Instance Learning </li>\n<li>for instead of using Convolution Based models which will not perform well with low-feature representation i prefer to combine MIL with the Capsule Network because it showed promising results and it can learn from different point-views of data ( Equivariant Neural Networks )</li>\n</ol>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2056114": "I would like to dive deeper into this competition and think over all the possibilities that make this problem challenging to tackle.\n\n**1. problem Description:** the competition is about predicting the probability of an image containing Cancer, therefore this seems to be an easy task to handle with a Pertrained model already built, but the real issue that comes over with challenge is the data itself I noticed a few notations after I processed that data the notebook.\n\n- the data is not balanced between the labels which will lead to out-of-distribution and over-fitting which means the model will have more features of a class than other \n\n\n\n- number of Slices: here we can say that every single image has huge Pixels values 20k-32k and this will make the model either focus on useful areas which not interested an localized cancer.\n\n**2. purposed solution:**  i found a useful technic that tries to solve this problem Called **(Multiple Instance Learning\n)**.\n- **Definition:**: Multiple instance learning (MIL) is a powerful tool to solve the weakly supervised classification in whole slide image (WSI) based pathology diagnosis. However, the current MIL methods are usually based on independent and identical distribution hypothesis, thus neglect the correlation among different instances. To address this problem, we proposed a new framework, called correlated MIL.\n**[Paper](https://arxiv.org/pdf/2106.00908.pdf)**\n**[code](https://github.com/szc19990412/TransMIL)**\n",
    "2056230": "Yeah, `MIL` is something I would love to try if I continue working on the competition 🙂 Just wanted to add there are also other formulations of `MIL` in the context of DL models with a variable number of images per class, there are many ways to try to approach this 🙂\n\nNot sure if this can be useful, but I have some examples of `MIL` in this [repo](https://github.com/earthspecies/cornell-birdcall-competition-starter-pack/blob/master/02c_train_on_melspectrograms_pytorch_avg_pool.ipynb)\n\nHere is a model which is essentially taking a mean of the predictions on images for a given example, which is probably the simples `MIL` there is 😄 \n\n```\nclass Model(nn.Module):\n    def __init__(self):\n        super().__init__()\n        self.cnn = nn.Sequential(*list(torchvision.models.resnet34(True).children())[:-2])\n        self.classifier = nn.Sequential(*[\n            nn.Linear(512, 512), nn.ReLU(), nn.Dropout(p=0.5), nn.BatchNorm1d(512),\n            nn.Linear(512, 512), nn.ReLU(), nn.Dropout(p=0.5), nn.BatchNorm1d(512),\n            nn.Linear(512, len(classes))\n        ])\n    \n    def forward(self, x):\n        bs, im_num, ch, y_dim, x_dim = x.shape\n        x = self.cnn(x.view(-1, ch, y_dim, x_dim))\n        x = x.mean((2,3))\n        x = self.classifier(x)\n        x = x.view(bs, im_num, -1)\n        x = x.mean(-2)\n        return x\n```",
    "2056315": "I wonder if getting the assistance of a radiologist to annotate salient areas on cancer diagnosis would help improve learning.  Our models have plenty of healthy tissue to learn from, but it's probably hard from them to figure out what we mean when we say a particular image is diagnosed with cancer.\n\nThe DDSM dataset has such a thing \n\nhttps://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=22516629#22516629e30c416b9d7e4e2aa42b617c35433a6b"
  }
}