{
  "id": 419133,
  "title": "Some Insights",
  "url": "/competitions/hubmap-hacking-the-human-vasculature/discussion/419133",
  "author_name": "Yassine Alouini",
  "post_date": "2023-06-24T09:37:02.349000",
  "votes": 14,
  "comment_count": 9,
  "views": 0,
  "content": "<p>A new competition, a new insights post!</p>\n<p><strong>Work In Progress</strong>, I am adding insights as I go!</p>\n<h1>Task</h1>\n<p>This is a medical <strong><a href=\"https://en.wikipedia.org/wiki/Image_segmentation\" target=\"_blank\">segmentation</a></strong>  competition of  <strong>microvasculature structures</strong> (a type of small blood vessels).</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F987b808ae0a60acf751f1d79d26b0878%2Fkidney.jpg?generation=1687598808006204&amp;alt=media\" alt=\"Kidney Anatomy\"></p>\n<p>(source: <a href=\"https://www.ncbi.nlm.nih.gov/books/NBK459158/figure/article-28333.image.f1/?report=objectonly\" target=\"_blank\">https://www.ncbi.nlm.nih.gov/books/NBK459158/figure/article-28333.image.f1/?report=objectonly</a>)</p>\n<h1>&nbsp;Keywords and Concepts</h1>\n<p>[<strong>IMPORTANT NOTE</strong>] As pointed up by Katherine Gustilo (@katherinegustilo), the image below in the zoomed-in WSI depicts tumorous tissue whereas the WSI in the competition comes from healthy patients. An example can be found in the <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/overview/biological-overview\" target=\"_blank\">biological overview page</a>.</p>\n<ul>\n<li>WSI: short for whole slides images. Whole slides imaging is an imaging technique for getting medical. To learn more, check this wikipedia <a href=\"https://en.wikipedia.org/wiki/Digital_pathology\" target=\"_blank\">page</a> and this <a href=\"https://pubmed.ncbi.nlm.nih.gov/32452840/\" target=\"_blank\">page</a>.</li>\n</ul>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F6ee9fa18d47da716421dda5871689fe3%2FWhole_slide_image_of_Wilms_tumor.png?generation=1687598887580886&amp;alt=media\" alt=\"WSI Example\"></p>\n<ul>\n<li><a href=\"https://en.wikipedia.org/wiki/Glomerulus_(kidney)\" target=\"_blank\">Glomerulus</a>: a network of small blood vessels (capillaries) known as a tuft, located at the beginning of a nephron in the kidney. </li>\n</ul>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F40140790e6e7643bbc02aacce24805e5%2F500px-Bowmans_capsule_and_glomerulus.svg.png?generation=1687598869681355&amp;alt=media\" alt=\"Glomerulus Example\"></p>\n<ul>\n<li>Small blood vessel structures: arterioles, capillaries and venules. These are the focus of this competition.</li>\n<li>Large blood vessel structures: arteries and veins. These aren't the focus of this competition and haven't been segmented.</li>\n</ul>\n<h1>&nbsp;Data</h1>\n<p>The data in this competition comes from tiles extracted from <strong>5 WSI</strong> (Whole Slides Images). These make <strong>2 datasets</strong>: </p>\n<ul>\n<li><strong>Dataset 1</strong> have annotations that have been expert reviewed. </li>\n<li><strong>Dataset 2</strong> comprises the remaining tiles from these same WSIs and contain sparse annotations that have not been expert reviewed.</li>\n</ul>\n<h2>Train</h2>\n<p>The training set comes from 2 WSI (out of the 5). </p>\n<ul>\n<li><p>Images are <strong><a href=\"https://en.wikipedia.org/wiki/TIFF\" target=\"_blank\">TIFF</a></strong> files (as is often the case for medical imaging) and each is <strong>512 x 512</strong>. </p></li>\n<li><p>Segmentation masks are stored as a <a href=\"https://jsonlines.org/\" target=\"_blank\">JSONL</a> file. Each line corresponds to masks of a single train image identified with id. Each annotation contains the <strong>type</strong> of the identified structure and  <strong>coordinates</strong> of the polygon mask.</p></li>\n</ul>\n<p>The <code>type</code> values are: </p>\n<ul>\n<li><code>blood_vessel</code>: The target structure to predict. Your goal in this competition is to predict these kinds of masks on the test set.</li>\n<li><a href=\"https://en.wikipedia.org/wiki/Glomerulus_(kidney)\" target=\"_blank\"><code>glomerulus</code></a>: A capillary ball structure in the kidney. These parts of the images were excluded from blood vessel annotation. You should ensure none of your test set predictions occur within glomerulus structures as they will be counted as false positives. Annotations are provided for test set tiles in the hidden version of the dataset.</li>\n<li><code>unsure</code> A structure the expert annotators cannot confidently distinguish as a blood vessel.</li>\n</ul>\n<p>One way to plot an image with the masks is the following:</p>\n<pre><code> skimage.io  imread, imshow\n matplotlib.pylab  plt\n numpy  np\n pandas  pd\n json\n\n\n\n ():\n    coords_array = np.array(coords).squeeze()\n    xs = coords_array[:, ]\n    ys = coords_array[:, ]\n\n     xs, ys\n\n ()  f:\n    data = f.read()\n\n\nres = []\n file  data.splitlines():\n    d = json.loads(file)\n    res.append(d)\n\n\nd = res[]\nimg_id = d[]\npath = \nimg = imread(path)\n\n\nfig, ax = plt.subplots(, , figsize=(, ))\nax.imshow(img)\n e  d[]:\n     e[] == :\n        coordinates = e[]\n        xs, ys = get_cartesian_coords(coordinates)\n        ax.plot(xs, ys, c=)\nfig.show()\n</code></pre>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F9dd2c6d3de53701074e4d653bfe62c6d%2FScreenshot%20from%202023-06-26%2021-50-15.png?generation=1687809043003722&amp;alt=media\" alt=\"A sample image with masks\"></p>\n<h2>Test</h2>\n<p>Test tiles all come from <strong>dataset 1</strong>. <br>\nThis is a code competition and a portion of the test dataset is hidden.<br>\nThe full test dataset contains 650 tiles. </p>\n<h2>&nbsp;Additional</h2>\n<p>There is a whole <strong>dataset 3</strong> containing <strong>9 additional WSIs</strong>. These aren't annotated and can be used for further training using semi-supervised or self-supervised techniques.</p>\n<h1>&nbsp;Metric</h1>\n<p>The evaluation metric for this competition is  IoU with a threshold of 0.6. In a few words, this means</p>\n<h1>&nbsp;Resources</h1>\n<p>Here are some resources to help you get started:</p>\n<ul>\n<li>Previous HubMAP competition: <a href=\"https://www.kaggle.com/competitions/hubmap-kidney-segmentation/\" target=\"_blank\">https://www.kaggle.com/competitions/hubmap-kidney-segmentation/</a></li>\n<li>Another previous HubMAP competition: <a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/\" target=\"_blank\">https://www.kaggle.com/competitions/hubmap-organ-segmentation/</a></li>\n<li>Working with TIFF files (warning, my own work): <a href=\"https://www.kaggle.com/code/yassinealouini/working-with-tiff-files\" target=\"_blank\">https://www.kaggle.com/code/yassinealouini/working-with-tiff-files</a></li>\n<li>A nice EDA notebook: <a href=\"https://www.kaggle.com/code/ihelon/hubmap-exploratory-data-analysis\" target=\"_blank\">https://www.kaggle.com/code/ihelon/hubmap-exploratory-data-analysis</a></li>\n<li>Top solutions of past HuBMAP competitions: <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412307\" target=\"_blank\">https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412307</a></li>\n</ul>",
  "messages": [
    {
      "id": 2315661,
      "postDate": "2023-06-24T09:37:02.350Z",
      "content": "<p>A new competition, a new insights post!</p>\n<p><strong>Work In Progress</strong>, I am adding insights as I go!</p>\n<h1>Task</h1>\n<p>This is a medical <strong><a href=\"https://en.wikipedia.org/wiki/Image_segmentation\" target=\"_blank\">segmentation</a></strong>  competition of  <strong>microvasculature structures</strong> (a type of small blood vessels).</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F987b808ae0a60acf751f1d79d26b0878%2Fkidney.jpg?generation=1687598808006204&amp;alt=media\" alt=\"Kidney Anatomy\"></p>\n<p>(source: <a href=\"https://www.ncbi.nlm.nih.gov/books/NBK459158/figure/article-28333.image.f1/?report=objectonly\" target=\"_blank\">https://www.ncbi.nlm.nih.gov/books/NBK459158/figure/article-28333.image.f1/?report=objectonly</a>)</p>\n<h1>&nbsp;Keywords and Concepts</h1>\n<p>[<strong>IMPORTANT NOTE</strong>] As pointed up by Katherine Gustilo (@katherinegustilo), the image below in the zoomed-in WSI depicts tumorous tissue whereas the WSI in the competition comes from healthy patients. An example can be found in the <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/overview/biological-overview\" target=\"_blank\">biological overview page</a>.</p>\n<ul>\n<li>WSI: short for whole slides images. Whole slides imaging is an imaging technique for getting medical. To learn more, check this wikipedia <a href=\"https://en.wikipedia.org/wiki/Digital_pathology\" target=\"_blank\">page</a> and this <a href=\"https://pubmed.ncbi.nlm.nih.gov/32452840/\" target=\"_blank\">page</a>.</li>\n</ul>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F6ee9fa18d47da716421dda5871689fe3%2FWhole_slide_image_of_Wilms_tumor.png?generation=1687598887580886&amp;alt=media\" alt=\"WSI Example\"></p>\n<ul>\n<li><a href=\"https://en.wikipedia.org/wiki/Glomerulus_(kidney)\" target=\"_blank\">Glomerulus</a>: a network of small blood vessels (capillaries) known as a tuft, located at the beginning of a nephron in the kidney. </li>\n</ul>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F40140790e6e7643bbc02aacce24805e5%2F500px-Bowmans_capsule_and_glomerulus.svg.png?generation=1687598869681355&amp;alt=media\" alt=\"Glomerulus Example\"></p>\n<ul>\n<li>Small blood vessel structures: arterioles, capillaries and venules. These are the focus of this competition.</li>\n<li>Large blood vessel structures: arteries and veins. These aren't the focus of this competition and haven't been segmented.</li>\n</ul>\n<h1>&nbsp;Data</h1>\n<p>The data in this competition comes from tiles extracted from <strong>5 WSI</strong> (Whole Slides Images). These make <strong>2 datasets</strong>: </p>\n<ul>\n<li><strong>Dataset 1</strong> have annotations that have been expert reviewed. </li>\n<li><strong>Dataset 2</strong> comprises the remaining tiles from these same WSIs and contain sparse annotations that have not been expert reviewed.</li>\n</ul>\n<h2>Train</h2>\n<p>The training set comes from 2 WSI (out of the 5). </p>\n<ul>\n<li><p>Images are <strong><a href=\"https://en.wikipedia.org/wiki/TIFF\" target=\"_blank\">TIFF</a></strong> files (as is often the case for medical imaging) and each is <strong>512 x 512</strong>. </p></li>\n<li><p>Segmentation masks are stored as a <a href=\"https://jsonlines.org/\" target=\"_blank\">JSONL</a> file. Each line corresponds to masks of a single train image identified with id. Each annotation contains the <strong>type</strong> of the identified structure and  <strong>coordinates</strong> of the polygon mask.</p></li>\n</ul>\n<p>The <code>type</code> values are: </p>\n<ul>\n<li><code>blood_vessel</code>: The target structure to predict. Your goal in this competition is to predict these kinds of masks on the test set.</li>\n<li><a href=\"https://en.wikipedia.org/wiki/Glomerulus_(kidney)\" target=\"_blank\"><code>glomerulus</code></a>: A capillary ball structure in the kidney. These parts of the images were excluded from blood vessel annotation. You should ensure none of your test set predictions occur within glomerulus structures as they will be counted as false positives. Annotations are provided for test set tiles in the hidden version of the dataset.</li>\n<li><code>unsure</code> A structure the expert annotators cannot confidently distinguish as a blood vessel.</li>\n</ul>\n<p>One way to plot an image with the masks is the following:</p>\n<pre><code> skimage.io  imread, imshow\n matplotlib.pylab  plt\n numpy  np\n pandas  pd\n json\n\n\n\n ():\n    coords_array = np.array(coords).squeeze()\n    xs = coords_array[:, ]\n    ys = coords_array[:, ]\n\n     xs, ys\n\n ()  f:\n    data = f.read()\n\n\nres = []\n file  data.splitlines():\n    d = json.loads(file)\n    res.append(d)\n\n\nd = res[]\nimg_id = d[]\npath = \nimg = imread(path)\n\n\nfig, ax = plt.subplots(, , figsize=(, ))\nax.imshow(img)\n e  d[]:\n     e[] == :\n        coordinates = e[]\n        xs, ys = get_cartesian_coords(coordinates)\n        ax.plot(xs, ys, c=)\nfig.show()\n</code></pre>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F9dd2c6d3de53701074e4d653bfe62c6d%2FScreenshot%20from%202023-06-26%2021-50-15.png?generation=1687809043003722&amp;alt=media\" alt=\"A sample image with masks\"></p>\n<h2>Test</h2>\n<p>Test tiles all come from <strong>dataset 1</strong>. <br>\nThis is a code competition and a portion of the test dataset is hidden.<br>\nThe full test dataset contains 650 tiles. </p>\n<h2>&nbsp;Additional</h2>\n<p>There is a whole <strong>dataset 3</strong> containing <strong>9 additional WSIs</strong>. These aren't annotated and can be used for further training using semi-supervised or self-supervised techniques.</p>\n<h1>&nbsp;Metric</h1>\n<p>The evaluation metric for this competition is  IoU with a threshold of 0.6. In a few words, this means</p>\n<h1>&nbsp;Resources</h1>\n<p>Here are some resources to help you get started:</p>\n<ul>\n<li>Previous HubMAP competition: <a href=\"https://www.kaggle.com/competitions/hubmap-kidney-segmentation/\" target=\"_blank\">https://www.kaggle.com/competitions/hubmap-kidney-segmentation/</a></li>\n<li>Another previous HubMAP competition: <a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/\" target=\"_blank\">https://www.kaggle.com/competitions/hubmap-organ-segmentation/</a></li>\n<li>Working with TIFF files (warning, my own work): <a href=\"https://www.kaggle.com/code/yassinealouini/working-with-tiff-files\" target=\"_blank\">https://www.kaggle.com/code/yassinealouini/working-with-tiff-files</a></li>\n<li>A nice EDA notebook: <a href=\"https://www.kaggle.com/code/ihelon/hubmap-exploratory-data-analysis\" target=\"_blank\">https://www.kaggle.com/code/ihelon/hubmap-exploratory-data-analysis</a></li>\n<li>Top solutions of past HuBMAP competitions: <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412307\" target=\"_blank\">https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412307</a></li>\n</ul>",
      "rawMarkdown": "A new competition, a new insights post!\n\n**Work In Progress**, I am adding insights as I go!\n\n# Task\n\nThis is a medical **[segmentation](https://en.wikipedia.org/wiki/Image_segmentation)**  competition of  **microvasculature structures** (a type of small blood vessels).\n\n![Kidney Anatomy](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F987b808ae0a60acf751f1d79d26b0878%2Fkidney.jpg?generation=1687598808006204&alt=media)\n\n(source: https://www.ncbi.nlm.nih.gov/books/NBK459158/figure/article-28333.image.f1/?report=objectonly)\n\n\n# Keywords and Concepts\n\n[**IMPORTANT NOTE**] As pointed up by Katherine Gustilo (@katherinegustilo), the image below in the zoomed-in WSI depicts tumorous tissue whereas the WSI in the competition comes from healthy patients. An example can be found in the [biological overview page]( https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/overview/biological-overview).\n\n* WSI: short for whole slides images. Whole slides imaging is an imaging technique for getting medical. To learn more, check this wikipedia [page](https://en.wikipedia.org/wiki/Digital_pathology) and this [page](https://pubmed.ncbi.nlm.nih.gov/32452840/).\n\n![WSI Example](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F6ee9fa18d47da716421dda5871689fe3%2FWhole_slide_image_of_Wilms_tumor.png?generation=1687598887580886&alt=media)\n\n* [Glomerulus](https://en.wikipedia.org/wiki/Glomerulus_(kidney)): a network of small blood vessels (capillaries) known as a tuft, located at the beginning of a nephron in the kidney. \n\n![Glomerulus Example](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F40140790e6e7643bbc02aacce24805e5%2F500px-Bowmans_capsule_and_glomerulus.svg.png?generation=1687598869681355&alt=media)\n\n* Small blood vessel structures: arterioles, capillaries and venules. These are the focus of this competition.\n* Large blood vessel structures: arteries and veins. These aren't the focus of this competition and haven't been segmented.\n\n# Data \n\nThe data in this competition comes from tiles extracted from **5 WSI** (Whole Slides Images). These make **2 datasets**: \n\n* **Dataset 1** have annotations that have been expert reviewed. \n* **Dataset 2** comprises the remaining tiles from these same WSIs and contain sparse annotations that have not been expert reviewed.\n\n## Train\n\nThe training set comes from 2 WSI (out of the 5). \n\n* Images are **[TIFF](https://en.wikipedia.org/wiki/TIFF)** files (as is often the case for medical imaging) and each is **512 x 512**. \n\n* Segmentation masks are stored as a [JSONL](https://jsonlines.org/) file. Each line corresponds to masks of a single train image identified with id. Each annotation contains the **type** of the identified structure and  **coordinates** of the polygon mask.\n\nThe `type` values are: \n\n* `blood_vessel`: The target structure to predict. Your goal in this competition is to predict these kinds of masks on the test set.\n* [`glomerulus`](https://en.wikipedia.org/wiki/Glomerulus_(kidney)): A capillary ball structure in the kidney. These parts of the images were excluded from blood vessel annotation. You should ensure none of your test set predictions occur within glomerulus structures as they will be counted as false positives. Annotations are provided for test set tiles in the hidden version of the dataset.\n* `unsure` A structure the expert annotators cannot confidently distinguish as a blood vessel.\n\nOne way to plot an image with the masks is the following:\n\n``` python\n\nfrom skimage.io import imread, imshow\nimport matplotlib.pylab as plt\nimport numpy as np\nimport pandas as pd\nimport json\n\n\n# From https://www.kaggle.com/code/leonidkulyk/eda-hubmap-hhv-interactive-annotations\ndef get_cartesian_coords(coords, img_height=512):\n    coords_array = np.array(coords).squeeze()\n    xs = coords_array[:, 0]\n    ys = coords_array[:, 1]\n    \n    return xs, ys\n\nwith open(\"../input/hubmap-hacking-the-human-vasculature/polygons.jsonl\") as f:\n    data = f.read()\n    \n    \nres = []\nfor file in data.splitlines():\n    d = json.loads(file)\n    res.append(d)\n\n# One random sample\nd = res[500]\nimg_id = d[\"id\"]\npath = f\"../input/hubmap-hacking-the-human-vasculature/train/{img_id}.tif\"\nimg = imread(path)\n\n\nfig, ax = plt.subplots(1, 1, figsize=(10, 10))\nax.imshow(img)\nfor e in d[\"annotations\"]:\n    if e[\"type\"] == \"blood_vessel\":\n        coordinates = e[\"coordinates\"]\n        xs, ys = get_cartesian_coords(coordinates)\n        ax.plot(xs, ys, c=\"red\")\nfig.show()\n```\n\n![A sample image with masks](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F9dd2c6d3de53701074e4d653bfe62c6d%2FScreenshot%20from%202023-06-26%2021-50-15.png?generation=1687809043003722&alt=media)\n\n\n## Test\n\nTest tiles all come from **dataset 1**. \nThis is a code competition and a portion of the test dataset is hidden.\nThe full test dataset contains 650 tiles. \n\n## Additional \n\nThere is a whole **dataset 3** containing **9 additional WSIs**. These aren't annotated and can be used for further training using semi-supervised or self-supervised techniques.\n\n# Metric\n\nThe evaluation metric for this competition is  IoU with a threshold of 0.6. In a few words, this means\n\n# Resources\n\nHere are some resources to help you get started:\n\n* Previous HubMAP competition: https://www.kaggle.com/competitions/hubmap-kidney-segmentation/\n* Another previous HubMAP competition: https://www.kaggle.com/competitions/hubmap-organ-segmentation/\n* Working with TIFF files (warning, my own work): https://www.kaggle.com/code/yassinealouini/working-with-tiff-files\n* A nice EDA notebook: https://www.kaggle.com/code/ihelon/hubmap-exploratory-data-analysis\n* Top solutions of past HuBMAP competitions: https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412307\n",
      "votes": 14
    },
    {
      "id": 2318767,
      "postDate": "2023-06-26T15:15:31.173Z",
      "content": "<p>Hi Yassine, </p>\n<p>Thank you for posting this nice summary. I do want to avoid any confusion and point out that the WSI and zoomed in region image from the Wikipedia page is depicting pathological data. This is tumorous tissue. However, the dataset used for this competition is derived from healthy kidney tissue slides (any highly fibrotic or pathological tissue sections were excluded). The glomeruli would appear quite different in health tissue. See the biology overview slides for some examples: <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/overview/biological-overview\" target=\"_blank\">https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/overview/biological-overview</a>. In figure 1, lower right corner, there is a nice example of a normal glomeruli. Keep up the great work, and please let me know if you have any biologically relevant questions.</p>\n<p>Best,<br>\nKate Gustilo, Anatomist &amp; Research Analyst</p>",
      "rawMarkdown": "Hi Yassine, \n\nThank you for posting this nice summary. I do want to avoid any confusion and point out that the WSI and zoomed in region image from the Wikipedia page is depicting pathological data. This is tumorous tissue. However, the dataset used for this competition is derived from healthy kidney tissue slides (any highly fibrotic or pathological tissue sections were excluded). The glomeruli would appear quite different in health tissue. See the biology overview slides for some examples: https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/overview/biological-overview. In figure 1, lower right corner, there is a nice example of a normal glomeruli. Keep up the great work, and please let me know if you have any biologically relevant questions.\n\nBest,\nKate Gustilo, Anatomist & Research Analyst",
      "votes": 3,
      "replies": [
        {
          "id": 2318949,
          "postDate": "2023-06-26T17:36:10.390Z",
          "content": "<p>That's a good point, I will update the post with the appropriate details, thanks!</p>",
          "rawMarkdown": "That's a good point, I will update the post with the appropriate details, thanks!"
        }
      ]
    },
    {
      "id": 2320380,
      "postDate": "2023-06-27T18:34:34.467Z",
      "content": "<p>For those confused about how dataset and WSI are linked, <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> has made this nice diagram:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F0cf7296b8ee72900f41d85739f7d9608%2Finbox_113660_6e8220459e613e8c48e579bdc9ea4510_Selection_999(2256).png?generation=1687890011503191&amp;alt=media\" alt=\"\"></p>\n<p>source: <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419143#2315708\" target=\"_blank\">https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419143#2315708</a></p>\n<p>As you can see:</p>\n<ul>\n<li>WSI 3 and 4 only come from dataset 2 and thus aren't annotated by experts.</li>\n<li>WSI 1 contains both datasets with a balanced mix.</li>\n<li>WSI 2 contains also both datasets with more coming from dataset 2.</li>\n</ul>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2Faf1187ff14d1ea75907dc1ad2f1c27cf%2FScreenshot%20from%202023-06-27%2020-43-28.png?generation=1687891594340672&amp;alt=media\" alt=\"tiles metadata\"></p>\n<p>As for dataset3, it contains WSI 6 to  14, and they aren't annotated at all.</p>",
      "rawMarkdown": "For those confused about how dataset and WSI are linked, @hengck23 has made this nice diagram:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F0cf7296b8ee72900f41d85739f7d9608%2Finbox_113660_6e8220459e613e8c48e579bdc9ea4510_Selection_999(2256).png?generation=1687890011503191&alt=media)\n\nsource: https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419143#2315708\n\nAs you can see:\n\n* WSI 3 and 4 only come from dataset 2 and thus aren't annotated by experts.\n* WSI 1 contains both datasets with a balanced mix.\n* WSI 2 contains also both datasets with more coming from dataset 2.\n\n\n![tiles metadata](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2Faf1187ff14d1ea75907dc1ad2f1c27cf%2FScreenshot%20from%202023-06-27%2020-43-28.png?generation=1687891594340672&alt=media)\n\nAs for dataset3, it contains WSI 6 to  14, and they aren't annotated at all.",
      "votes": 1
    },
    {
      "id": 2319063,
      "postDate": "2023-06-26T19:53:09.510Z",
      "content": "<p>One way to plot an image with masks on top =&gt;</p>\n<pre><code> skimage.io  imread, imshow\n matplotlib.pylab  plt\n numpy  np\n pandas  pd\n json\n\n\n\n ():\n    coords_array = np.array(coords).squeeze()\n    xs = coords_array[:, ]\n    ys = coords_array[:, ]\n\n     xs, ys\n\n ()  f:\n    data = f.read()\n\n\nres = []\n file  data.splitlines():\n    d = json.loads(file)\n    res.append(d)\n\n\nd = res[]\nimg_id = d[]\npath = \nimg = imread(path)\n\n\nfig, ax = plt.subplots(, , figsize=(, ))\nax.imshow(img)\n e  d[]:\n     e[] == :\n        coordinates = e[]\n        xs, ys = get_cartesian_coords(coordinates)\n        ax.plot(xs, ys, c=)\nfig.show()\n</code></pre>",
      "rawMarkdown": "One way to plot an image with masks on top =>\n\n```python\nfrom skimage.io import imread, imshow\nimport matplotlib.pylab as plt\nimport numpy as np\nimport pandas as pd\nimport json\n\n\n# From https://www.kaggle.com/code/leonidkulyk/eda-hubmap-hhv-interactive-annotations\ndef get_cartesian_coords(coords):\n    coords_array = np.array(coords).squeeze()\n    xs = coords_array[:, 0]\n    ys = coords_array[:, 1]\n\n    return xs, ys\n\nwith open(\"../input/hubmap-hacking-the-human-vasculature/polygons.jsonl\") as f:\n    data = f.read()\n\n\nres = []\nfor file in data.splitlines():\n    d = json.loads(file)\n    res.append(d)\n\n# One random sample\nd = res[500]\nimg_id = d[\"id\"]\npath = f\"../input/hubmap-hacking-the-human-vasculature/train/{img_id}.tif\"\nimg = imread(path)\n\n\nfig, ax = plt.subplots(1, 1, figsize=(10, 10))\nax.imshow(img)\nfor e in d[\"annotations\"]:\n    if e[\"type\"] == \"blood_vessel\":\n        coordinates = e[\"coordinates\"]\n        xs, ys = get_cartesian_coords(coordinates)\n        ax.plot(xs, ys, c=\"red\")\nfig.show()\n```",
      "votes": 1
    },
    {
      "id": 2323313,
      "postDate": "2023-06-29T20:46:30.653Z",
      "content": "<p>An interesting thread that explains how <strong>mAP</strong> is useful for instance segmentation (whereas we expect that <strong>mIoU</strong> would be more useful): <a href=\"https://stats.stackexchange.com/questions/462279/why-is-map-mean-average-precision-used-for-instance-segmentation-tasks\" target=\"_blank\">https://stats.stackexchange.com/questions/462279/why-is-map-mean-average-precision-used-for-instance-segmentation-tasks</a></p>",
      "rawMarkdown": "An interesting thread that explains how **mAP** is useful for instance segmentation (whereas we expect that **mIoU** would be more useful): https://stats.stackexchange.com/questions/462279/why-is-map-mean-average-precision-used-for-instance-segmentation-tasks"
    },
    {
      "id": 2317473,
      "postDate": "2023-06-25T18:18:38.737Z",
      "content": "<p>I will keep updating this post in the coming days, stay tuned!</p>",
      "rawMarkdown": "I will keep updating this post in the coming days, stay tuned!",
      "replies": [
        {
          "id": 2321619,
          "postDate": "2023-06-28T17:43:17.207Z",
          "content": "<p>thank you for your sharing. It looks that we have to do something about the WSI and dataset. </p>",
          "rawMarkdown": "thank you for your sharing. It looks that we have to do something about the WSI and dataset. ",
          "votes": 1,
          "replies": [
            {
              "id": 2322180,
              "postDate": "2023-06-29T06:10:16.600Z",
              "content": "<p>Yes most likely. This is an important aspect of how the dataset is split and how different tiles are organized. Some approaches might take advantage of neighbouring tiles. </p>",
              "rawMarkdown": "Yes most likely. This is an important aspect of how the dataset is split and how different tiles are organized. Some approaches might take advantage of neighbouring tiles. "
            }
          ]
        }
      ]
    },
    {
      "id": 2317491,
      "postDate": "2023-06-25T18:36:12.413Z",
      "rawMarkdown": "",
      "votes": -1,
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 2318767,
      "author_name": "Katherine Gustilo",
      "author_url": "",
      "post_date": "2023-06-26T15:15:31.173000",
      "content": "<p>Hi Yassine, </p>\n<p>Thank you for posting this nice summary. I do want to avoid any confusion and point out that the WSI and zoomed in region image from the Wikipedia page is depicting pathological data. This is tumorous tissue. However, the dataset used for this competition is derived from healthy kidney tissue slides (any highly fibrotic or pathological tissue sections were excluded). The glomeruli would appear quite different in health tissue. See the biology overview slides for some examples: <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/overview/biological-overview\" target=\"_blank\">https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/overview/biological-overview</a>. In figure 1, lower right corner, there is a nice example of a normal glomeruli. Keep up the great work, and please let me know if you have any biologically relevant questions.</p>\n<p>Best,<br>\nKate Gustilo, Anatomist &amp; Research Analyst</p>",
      "votes": 3,
      "replies": [
        {
          "id": 2318949,
          "author_name": "Yassine Alouini",
          "author_url": "",
          "post_date": "2023-06-26T17:36:10.390000",
          "content": "<p>That's a good point, I will update the post with the appropriate details, thanks!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 2320380,
      "author_name": "Yassine Alouini",
      "author_url": "",
      "post_date": "2023-06-27T18:34:34.467000",
      "content": "<p>For those confused about how dataset and WSI are linked, <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">@hengck23</a> has made this nice diagram:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F0cf7296b8ee72900f41d85739f7d9608%2Finbox_113660_6e8220459e613e8c48e579bdc9ea4510_Selection_999(2256).png?generation=1687890011503191&amp;alt=media\" alt=\"\"></p>\n<p>source: <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419143#2315708\" target=\"_blank\">https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419143#2315708</a></p>\n<p>As you can see:</p>\n<ul>\n<li>WSI 3 and 4 only come from dataset 2 and thus aren't annotated by experts.</li>\n<li>WSI 1 contains both datasets with a balanced mix.</li>\n<li>WSI 2 contains also both datasets with more coming from dataset 2.</li>\n</ul>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2Faf1187ff14d1ea75907dc1ad2f1c27cf%2FScreenshot%20from%202023-06-27%2020-43-28.png?generation=1687891594340672&amp;alt=media\" alt=\"tiles metadata\"></p>\n<p>As for dataset3, it contains WSI 6 to  14, and they aren't annotated at all.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2319063,
      "author_name": "Yassine Alouini",
      "author_url": "",
      "post_date": "2023-06-26T19:53:09.510000",
      "content": "<p>One way to plot an image with masks on top =&gt;</p>\n<pre><code> skimage.io  imread, imshow\n matplotlib.pylab  plt\n numpy  np\n pandas  pd\n json\n\n\n\n ():\n    coords_array = np.array(coords).squeeze()\n    xs = coords_array[:, ]\n    ys = coords_array[:, ]\n\n     xs, ys\n\n ()  f:\n    data = f.read()\n\n\nres = []\n file  data.splitlines():\n    d = json.loads(file)\n    res.append(d)\n\n\nd = res[]\nimg_id = d[]\npath = \nimg = imread(path)\n\n\nfig, ax = plt.subplots(, , figsize=(, ))\nax.imshow(img)\n e  d[]:\n     e[] == :\n        coordinates = e[]\n        xs, ys = get_cartesian_coords(coordinates)\n        ax.plot(xs, ys, c=)\nfig.show()\n</code></pre>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 2323313,
      "author_name": "Yassine Alouini",
      "author_url": "",
      "post_date": "2023-06-29T20:46:30.653000",
      "content": "<p>An interesting thread that explains how <strong>mAP</strong> is useful for instance segmentation (whereas we expect that <strong>mIoU</strong> would be more useful): <a href=\"https://stats.stackexchange.com/questions/462279/why-is-map-mean-average-precision-used-for-instance-segmentation-tasks\" target=\"_blank\">https://stats.stackexchange.com/questions/462279/why-is-map-mean-average-precision-used-for-instance-segmentation-tasks</a></p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 2317473,
      "author_name": "Yassine Alouini",
      "author_url": "",
      "post_date": "2023-06-25T18:18:38.737000",
      "content": "<p>I will keep updating this post in the coming days, stay tuned!</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2321619,
          "author_name": "HongCheng",
          "author_url": "",
          "post_date": "2023-06-28T17:43:17.207000",
          "content": "<p>thank you for your sharing. It looks that we have to do something about the WSI and dataset. </p>",
          "votes": 1,
          "replies": [
            {
              "id": 2322180,
              "author_name": "Yassine Alouini",
              "author_url": "",
              "post_date": "2023-06-29T06:10:16.600000",
              "content": "<p>Yes most likely. This is an important aspect of how the dataset is split and how different tiles are organized. Some approaches might take advantage of neighbouring tiles. </p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2317491,
      "author_name": "",
      "author_url": "",
      "post_date": "2023-06-25T18:36:12.413000",
      "content": "",
      "votes": -1,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2315661": "A new competition, a new insights post!\n\n**Work In Progress**, I am adding insights as I go!\n\n# Task\n\nThis is a medical **[segmentation](https://en.wikipedia.org/wiki/Image_segmentation)**  competition of  **microvasculature structures** (a type of small blood vessels).\n\n![Kidney Anatomy](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F987b808ae0a60acf751f1d79d26b0878%2Fkidney.jpg?generation=1687598808006204&alt=media)\n\n(source: https://www.ncbi.nlm.nih.gov/books/NBK459158/figure/article-28333.image.f1/?report=objectonly)\n\n\n# Keywords and Concepts\n\n[**IMPORTANT NOTE**] As pointed up by Katherine Gustilo (@katherinegustilo), the image below in the zoomed-in WSI depicts tumorous tissue whereas the WSI in the competition comes from healthy patients. An example can be found in the [biological overview page]( https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/overview/biological-overview).\n\n* WSI: short for whole slides images. Whole slides imaging is an imaging technique for getting medical. To learn more, check this wikipedia [page](https://en.wikipedia.org/wiki/Digital_pathology) and this [page](https://pubmed.ncbi.nlm.nih.gov/32452840/).\n\n![WSI Example](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F6ee9fa18d47da716421dda5871689fe3%2FWhole_slide_image_of_Wilms_tumor.png?generation=1687598887580886&alt=media)\n\n* [Glomerulus](https://en.wikipedia.org/wiki/Glomerulus_(kidney)): a network of small blood vessels (capillaries) known as a tuft, located at the beginning of a nephron in the kidney. \n\n![Glomerulus Example](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F40140790e6e7643bbc02aacce24805e5%2F500px-Bowmans_capsule_and_glomerulus.svg.png?generation=1687598869681355&alt=media)\n\n* Small blood vessel structures: arterioles, capillaries and venules. These are the focus of this competition.\n* Large blood vessel structures: arteries and veins. These aren't the focus of this competition and haven't been segmented.\n\n# Data \n\nThe data in this competition comes from tiles extracted from **5 WSI** (Whole Slides Images). These make **2 datasets**: \n\n* **Dataset 1** have annotations that have been expert reviewed. \n* **Dataset 2** comprises the remaining tiles from these same WSIs and contain sparse annotations that have not been expert reviewed.\n\n## Train\n\nThe training set comes from 2 WSI (out of the 5). \n\n* Images are **[TIFF](https://en.wikipedia.org/wiki/TIFF)** files (as is often the case for medical imaging) and each is **512 x 512**. \n\n* Segmentation masks are stored as a [JSONL](https://jsonlines.org/) file. Each line corresponds to masks of a single train image identified with id. Each annotation contains the **type** of the identified structure and  **coordinates** of the polygon mask.\n\nThe `type` values are: \n\n* `blood_vessel`: The target structure to predict. Your goal in this competition is to predict these kinds of masks on the test set.\n* [`glomerulus`](https://en.wikipedia.org/wiki/Glomerulus_(kidney)): A capillary ball structure in the kidney. These parts of the images were excluded from blood vessel annotation. You should ensure none of your test set predictions occur within glomerulus structures as they will be counted as false positives. Annotations are provided for test set tiles in the hidden version of the dataset.\n* `unsure` A structure the expert annotators cannot confidently distinguish as a blood vessel.\n\nOne way to plot an image with the masks is the following:\n\n``` python\n\nfrom skimage.io import imread, imshow\nimport matplotlib.pylab as plt\nimport numpy as np\nimport pandas as pd\nimport json\n\n\n# From https://www.kaggle.com/code/leonidkulyk/eda-hubmap-hhv-interactive-annotations\ndef get_cartesian_coords(coords, img_height=512):\n    coords_array = np.array(coords).squeeze()\n    xs = coords_array[:, 0]\n    ys = coords_array[:, 1]\n    \n    return xs, ys\n\nwith open(\"../input/hubmap-hacking-the-human-vasculature/polygons.jsonl\") as f:\n    data = f.read()\n    \n    \nres = []\nfor file in data.splitlines():\n    d = json.loads(file)\n    res.append(d)\n\n# One random sample\nd = res[500]\nimg_id = d[\"id\"]\npath = f\"../input/hubmap-hacking-the-human-vasculature/train/{img_id}.tif\"\nimg = imread(path)\n\n\nfig, ax = plt.subplots(1, 1, figsize=(10, 10))\nax.imshow(img)\nfor e in d[\"annotations\"]:\n    if e[\"type\"] == \"blood_vessel\":\n        coordinates = e[\"coordinates\"]\n        xs, ys = get_cartesian_coords(coordinates)\n        ax.plot(xs, ys, c=\"red\")\nfig.show()\n```\n\n![A sample image with masks](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F9dd2c6d3de53701074e4d653bfe62c6d%2FScreenshot%20from%202023-06-26%2021-50-15.png?generation=1687809043003722&alt=media)\n\n\n## Test\n\nTest tiles all come from **dataset 1**. \nThis is a code competition and a portion of the test dataset is hidden.\nThe full test dataset contains 650 tiles. \n\n## Additional \n\nThere is a whole **dataset 3** containing **9 additional WSIs**. These aren't annotated and can be used for further training using semi-supervised or self-supervised techniques.\n\n# Metric\n\nThe evaluation metric for this competition is  IoU with a threshold of 0.6. In a few words, this means\n\n# Resources\n\nHere are some resources to help you get started:\n\n* Previous HubMAP competition: https://www.kaggle.com/competitions/hubmap-kidney-segmentation/\n* Another previous HubMAP competition: https://www.kaggle.com/competitions/hubmap-organ-segmentation/\n* Working with TIFF files (warning, my own work): https://www.kaggle.com/code/yassinealouini/working-with-tiff-files\n* A nice EDA notebook: https://www.kaggle.com/code/ihelon/hubmap-exploratory-data-analysis\n* Top solutions of past HuBMAP competitions: https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412307\n",
    "2318767": "Hi Yassine, \n\nThank you for posting this nice summary. I do want to avoid any confusion and point out that the WSI and zoomed in region image from the Wikipedia page is depicting pathological data. This is tumorous tissue. However, the dataset used for this competition is derived from healthy kidney tissue slides (any highly fibrotic or pathological tissue sections were excluded). The glomeruli would appear quite different in health tissue. See the biology overview slides for some examples: https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/overview/biological-overview. In figure 1, lower right corner, there is a nice example of a normal glomeruli. Keep up the great work, and please let me know if you have any biologically relevant questions.\n\nBest,\nKate Gustilo, Anatomist & Research Analyst",
    "2320380": "For those confused about how dataset and WSI are linked, @hengck23 has made this nice diagram:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2F0cf7296b8ee72900f41d85739f7d9608%2Finbox_113660_6e8220459e613e8c48e579bdc9ea4510_Selection_999(2256).png?generation=1687890011503191&alt=media)\n\nsource: https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419143#2315708\n\nAs you can see:\n\n* WSI 3 and 4 only come from dataset 2 and thus aren't annotated by experts.\n* WSI 1 contains both datasets with a balanced mix.\n* WSI 2 contains also both datasets with more coming from dataset 2.\n\n\n![tiles metadata](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F172860%2Faf1187ff14d1ea75907dc1ad2f1c27cf%2FScreenshot%20from%202023-06-27%2020-43-28.png?generation=1687891594340672&alt=media)\n\nAs for dataset3, it contains WSI 6 to  14, and they aren't annotated at all.",
    "2319063": "One way to plot an image with masks on top =>\n\n```python\nfrom skimage.io import imread, imshow\nimport matplotlib.pylab as plt\nimport numpy as np\nimport pandas as pd\nimport json\n\n\n# From https://www.kaggle.com/code/leonidkulyk/eda-hubmap-hhv-interactive-annotations\ndef get_cartesian_coords(coords):\n    coords_array = np.array(coords).squeeze()\n    xs = coords_array[:, 0]\n    ys = coords_array[:, 1]\n\n    return xs, ys\n\nwith open(\"../input/hubmap-hacking-the-human-vasculature/polygons.jsonl\") as f:\n    data = f.read()\n\n\nres = []\nfor file in data.splitlines():\n    d = json.loads(file)\n    res.append(d)\n\n# One random sample\nd = res[500]\nimg_id = d[\"id\"]\npath = f\"../input/hubmap-hacking-the-human-vasculature/train/{img_id}.tif\"\nimg = imread(path)\n\n\nfig, ax = plt.subplots(1, 1, figsize=(10, 10))\nax.imshow(img)\nfor e in d[\"annotations\"]:\n    if e[\"type\"] == \"blood_vessel\":\n        coordinates = e[\"coordinates\"]\n        xs, ys = get_cartesian_coords(coordinates)\n        ax.plot(xs, ys, c=\"red\")\nfig.show()\n```",
    "2323313": "An interesting thread that explains how **mAP** is useful for instance segmentation (whereas we expect that **mIoU** would be more useful): https://stats.stackexchange.com/questions/462279/why-is-map-mean-average-precision-used-for-instance-segmentation-tasks",
    "2317473": "I will keep updating this post in the coming days, stay tuned!",
    "2317491": ""
  }
}