{
  "id": 422607,
  "title": "3 Weeks left! Here is everything that happened up to this point",
  "url": "/competitions/hubmap-hacking-the-human-vasculature/discussion/422607",
  "author_name": "",
  "post_date": "2023-07-10T18:36:09.971069500Z",
  "votes": 67,
  "comment_count": 6,
  "views": 0,
  "content": "<h3>3 Weeks left! Here is everything that happened up to this point</h3>\n<p>We are approaching the final stage of the competition.<br>\nA good point to take a look back and summarize everything we know up to this point.</p>\n<p>I went through all the discussion threads (<strong>I went.</strong> not ChatGPT went. I actually read everything) and summarized the most interesting bits I found into this post.</p>\n<p>Enjoy!</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419143\" target=\"_blank\">[LB 0.458] my experiment results</a> By <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">Heng Cher Keng</a></h5>\n<p><strong>Highly recommended read.</strong></p>\n<ul>\n<li>Heng stared a thread with an ongoing research journal, I suggest reading it all because it is gold.</li>\n</ul>\n<blockquote>\n  <p>Not going to post all of it here as it is too long.</p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412307\" target=\"_blank\">🏆 HuBMAP last year winner solution 🏆</a> By <a href=\"https://www.kaggle.com/dwchen\" target=\"_blank\">Dewei Chen</a></h5>\n<p><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation\" target=\"_blank\"><strong>Last year Competition</strong></a></p>\n<ul>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/356201\" target=\"_blank\">1st place</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354857\" target=\"_blank\">2nd place</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354683\" target=\"_blank\">3rd place solution</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354851\" target=\"_blank\">4th place solution</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354859\" target=\"_blank\">7th place solution</a></li>\n</ul>\n<p><a href=\"https://www.kaggle.com/competitions/hubmap-kidney-segmentation\" target=\"_blank\"><strong>HuBMAN Two years ago</strong></a></p>\n<ul>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238198\" target=\"_blank\">1st place</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238013\" target=\"_blank\">3rd place</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238024\" target=\"_blank\">4th place</a></li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901\" target=\"_blank\">Dilation increases the score, who understands why?</a> By <a href=\"https://www.kaggle.com/maksimovka\" target=\"_blank\">Kostiantyn Maksymov</a></h5>\n<p><a href=\"https://www.kaggle.com/maksimovka\" target=\"_blank\">Kostiantyn Maksymov</a> discusses an interesting finding regarding the use of dilation in postprocessing to improve the score on the leaderboard.</p>\n<ul>\n<li>A significant improvement in the score after dialation (0.239 to 0.345).</li>\n<li>Some people in the comments suggest that dilation helps include the edges of the blood vessel in the binary mask, which might not be captured by the model's original thresholding condition.</li>\n<li>There is a discussion about the different iterations of dilation and input sizes are discussed in the comments, and participants share their experiences and insights.</li>\n<li>The overall consensus is that dilation seems to be beneficial for the model's performance in this particular competition.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412316\" target=\"_blank\">SOTA and Popular Segment method: OneFormer and UNet</a> By <a href=\"https://www.kaggle.com/dwchen\" target=\"_blank\">Dewei Chen</a></h5>\n<p>The field is moving fast lately, so this is a great opportunity to catch up with the latest SOTA segmentation models.<br>\nHere they are:</p>\n<p><strong>OneFormer: One Transformer to Rule Universal Image Segmentation</strong></p>\n<ul>\n<li>OneFormer is a method based on transformer, and achieve the SOTA in 2023 CVPR</li>\n<li><a href=\"https://arxiv.org/pdf/2211.06220v2.pdf\" target=\"_blank\">paper</a> <a href=\"https://github.com/SHI-Labs/OneFormer\" target=\"_blank\">Implementation</a></li>\n</ul>\n<p><strong>U-Net: Convolutional Networks for Biomedical Image Segmentation</strong></p>\n<ul>\n<li>U-Net is the most popular segmentation method in bio relation topic.<br>\n<a href=\"https://arxiv.org/pdf/1505.04597v1.pdf\" target=\"_blank\">paper</a> [Implementation](<a href=\"https://github.com/milesial/Pytorch-UNet\" target=\"_blank\">https://github.com/milesial/Pytorch-UNet</a> or <a href=\"https://github.com/open-mmlab/mmsegmentation\" target=\"_blank\">https://github.com/open-mmlab/mmsegmentation</a>)</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412396\" target=\"_blank\">StainTools for Augmentation</a> By <a href=\"https://www.kaggle.com/ravishah1\" target=\"_blank\">Ravi Shah</a></h5>\n<p><a href=\"https://www.kaggle.com/ravishah1\" target=\"_blank\">Ravi Shah</a> shares with us a useful library for tissue image stain normalization and augmentation.</p>\n<p><strong>You can use it like this:</strong></p>\n<pre><code>!pip install staintools\n!pip install spams\n\nimport spams\nimport staintools\nimport numpy as np\nimport matplotlib as plt\ntarget = staintools()\nto_transform = staintools()\nStandardize brightness (optional, can improve the tissue  calculation)\n\ntarget = staintools(target)\nto_transform = staintools(to_transform)\n\nnormalizer = staintools(method=)\nnormalizer(target)\ntransformed1 = normalizer(to_transform)\nplt(transformed1)\n</code></pre>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417374\" target=\"_blank\">Can you annotate this image accurately?</a> By <a href=\"https://www.kaggle.com/itsuki9180\" target=\"_blank\">ITK8191</a></h5>\n<p><a href=\"https://www.kaggle.com/itsuki9180\" target=\"_blank\">ITK8191</a> shares with us harder ground truth samples from the dataset.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2294613%2F4519f684fb29efbc97bc075e1bef8ca2%2F9.png?generation=1686830802312243&amp;alt=media\" alt=\"\"></p>\n<p>As you can see, it is hard to tell what the white area should be.<br>\nThe post later on continue and discuss the importance of using the context of the image to improve the results.</p>\n<p><a href=\"https://www.kaggle.com/code/itsuki9180/investigate-tiles-on-wsi-1-and-2\" target=\"_blank\">notebook</a></p>\n<p>There are some interesting comments in the discussion about this but I think that the most important one is the comment by <a href=\"https://www.kaggle.com/snaker\" target=\"_blank\">Chenglu</a> that says:</p>\n<p>That we can use tile_meta.csv in test set. <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414669#2303907\" target=\"_blank\">source</a></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419848\" target=\"_blank\">segmentation_models_pytorch for instance segmentation</a> By <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">Heng Cher Keng</a></h5>\n<p>Sharing with us a <code>segmentation_models_pytorch</code> option for instance segmentation.</p>\n<p><a href=\"https://github.com/Lee-Gihun/MEDIAR\" target=\"_blank\">link</a></p>\n<p><a href=\"https://openreview.net/submissions?venue=NeurIPS.cc/2022/Challenge/CellSeg\" target=\"_blank\">Read more</a></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/415508\" target=\"_blank\">▲CV vs LB scores ▼</a> By <a href=\"https://www.kaggle.com/benihime91\" target=\"_blank\">Ayushman Buragohain</a></h5>\n<p>CV vs LB Scores Discussion:</p>\n<p><strong><a href=\"https://www.kaggle.com/benihime91\" target=\"_blank\">Ayushman Buragohain</a></strong></p>\n<ul>\n<li><strong>CV:</strong> 0.494</li>\n<li><strong>LB:</strong> 0.303</li>\n<li><strong>Model:</strong> resnet50_mask_rcnn</li>\n<li><a href=\"https://www.kaggle.com/code/benihime91/hubmap-2023-create-coco-annotations\" target=\"_blank\">notebook</a></li>\n</ul>\n<p><strong><a href=\"https://www.kaggle.com/abebe9849\" target=\"_blank\">patriot</a></strong></p>\n<ul>\n<li><strong>LB:</strong> 0.412</li>\n<li><strong>Val_coco-iou@0.5:0.95</strong> 0.39</li>\n<li><strong>Data:</strong> Only from dataset1,only use \"blood_vessel\" (dismiss \"unsure\" label)</li>\n<li><strong>Split:</strong> Random 8:2</li>\n</ul>\n<p><strong>[DYS]()</strong><br>\nReporting a strange issue:</p>\n<ul>\n<li><strong>LB:</strong> 0.14</li>\n<li><strong>CV:</strong> 0.4+</li>\n<li><strong>Model:</strong> mask-rcnn</li>\n<li><strong>Split:</strong> One fold</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412943\" target=\"_blank\">Introduction to SAM (Segment Anything Model) by Meta AI</a> By <a href=\"https://www.kaggle.com/azminetoushikwasi\" target=\"_blank\">Azmine Toushik Wasi</a></h5>\n<p><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412943\" target=\"_blank\">Post</a> by <a href=\"https://www.kaggle.com/azminetoushikwasi\" target=\"_blank\">Azmine Toushik Wasi</a></p>\n<p>Meta AI had introduced an incredibly powerful computer vision model lately: SAM (Segment Anything Model). In this post we get some materials about using it effectively to accurately segment any object in an image.</p>\n<blockquote>\n  <p><strong>How is this possible?</strong> This is a few-shot model, it generalizes to the context you give it.</p>\n</blockquote>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7168168%2Fb8c6d4829d3ed9d1122362cef035a149%2F68747470733a2f2f6d656469612e726f626f666c6f772e636f6d2f6e6f7465626f6f6b732f6578616d706c65732f7365676d656e742d616e797468696e672d6d6f64656c2d626c6f67706f73742e706e67.png?generation=1685069463019129&amp;alt=media\" alt=\"Image\"></p>\n<p><strong>Complementary Materials:</strong></p>\n<ul>\n<li><a href=\"https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-segment-anything-with-sam.ipynb\" target=\"_blank\">Colab Notebook</a></li>\n<li><a href=\"https://youtu.be/D-D6ZmadzPE\" target=\"_blank\">YouTube Video</a></li>\n<li><a href=\"https://blog.roboflow.com/how-to-use-segment-anything-model-sam\" target=\"_blank\">Roboflow Blog</a></li>\n<li><a href=\"https://blog.roboflow.com/how-to-use-segment-anything-model-sam\" target=\"_blank\">Segment Anything Model Blogpost</a></li>\n<li><a href=\"https://kaggle.com/kernels/welcome?src=https://github.com/roboflow-ai/notebooks/blob/main/notebooks/zero-shot-object-detection-with-grounding-dino.ipynb\" target=\"_blank\">Kaggle Kernel</a></li>\n<li><a href=\"https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-segment-anything-with-sam.ipynb\" target=\"_blank\">Google Colab Notebook</a></li>\n</ul>\n<p><strong>Useful Links:</strong> <a href=\"https://www.kaggle.com/code/fnands/yolov7-sam-inference-only\" target=\"_blank\">Yolov7 + SAM Inference</a>, <a href=\"https://www.kaggle.com/code/dlobatog/capillaries-sam-pretrained\" target=\"_blank\">Pretrained SAM</a>, <a href=\"https://youtu.be/fAw13m3Eb28\" target=\"_blank\">Mask Contours Analysis</a></p>\n<blockquote>\n  <p><strong>Note:</strong> I am not sure how much this model could hold up against a well fine-tuned model specifically made for this competition. But I think it is worth a try.</p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413038\" target=\"_blank\">Question about WSI, Dataset and Split</a> By <a href=\"https://www.kaggle.com/pt0x0e\" target=\"_blank\">PT0X0E</a></h5>\n<p>An interesting post about the splitting method of the data in this competition.<br>\nMore specifically, the confusion is around the phrase <code>Two of the WSIs make up the training set, two WSIs make up the public test set</code> used in the competition description.</p>\n<p>After some back and forth, the following chat is concluded and presumed to be the correct one:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F12313384%2Fd0fad19fa693732c2cae00c41453adf4%2F2023-05-29%2020.32.10.png?generation=1685363555970493&amp;alt=media\" alt=\"\"></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417314\" target=\"_blank\">yet another puzzle game?</a> By <a href=\"https://www.kaggle.com/snaker\" target=\"_blank\">Chenglu</a></h5>\n<p>This post was written before the it was announced that we can use the <code>tile_meta.csv</code> file during test time but anyway there is an interesting discussion here.<br>\nIf we were not given this file, the main challenge would have been to run semantic segmentation (maybe not even instance segmentation) of the full image and then somehow stitch the tiles together.</p>\n<p>But <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">Heng Cher Keng</a> suggested an interesting idea: <strong>Zoom and focus:</strong> We can perform semantic segmentation on the larger image and then lower the resolution by creating possible candidate slices.</p>\n<p>Elegant and simple solution!</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414896\" target=\"_blank\">Does it make sense to train your model for identifying glomeruli?</a> By <a href=\"https://www.kaggle.com/janhuebi\" target=\"_blank\">Jan H</a></h5>\n<p><a href=\"https://www.kaggle.com/janhuebi\" target=\"_blank\">Jan H</a> raises an interesting question: Wondering if it is useful to train the model for 3 classes (background, blood vessel and glomerulus) or if it was sufficient to not include glomeruli mask and prediction class in the training of the model.</p>\n<p>In this <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414896\" target=\"_blank\">post</a>, the author raises a question about the necessity of training the model to identify glomeruli in addition to blood vessels. The author wonders if excluding the glomeruli mask and prediction class from the training data would suffice since the challenge's focus is on identifying blood vessels.</p>\n<p><strong>Answer (from the hosts):</strong></p>\n<blockquote>\n  <p>The annotations for glomeruli in the test set will be available during submission. You may use these to exclude your blood vessel predictions that lie within the glomeruli structures. You don't need to predict glomeruli.</p>\n</blockquote>\n<p>Followup question by <a href=\"https://www.kaggle.com/alabibojesomo\" target=\"_blank\">HungryLearner</a>:</p>\n<blockquote>\n  <p>Where can we get these annotations for glomerulus during inference in order to use these in excluding the blood vessel predictions within them.</p>\n</blockquote>\n<p><strong>Answer (from the hosts):</strong></p>\n<blockquote>\n  <p>The hidden version of the polygons.jsonl file should contain glomerulus annotations for the test set images. They aren't present in the public version of the dataset, but are added in the hidden version available to your notebook during inference.</p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417012\" target=\"_blank\">Test data annotation</a> By <a href=\"https://www.kaggle.com/aleksandrmogilevskiy\" target=\"_blank\">Sasha Mogilevskii</a></h5>\n<p><a href=\"https://www.kaggle.com/aleksandrmogilevskiy\" target=\"_blank\">Sasha Mogilevskii</a> is pointing out that dataset 1 and dataset 2 are annotated <strong>differently</strong>.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6197543%2F9b3efffbbe418bfb299d90f66b0d79de%2FScreenshot_4.jpg?generation=1686689058146565&amp;alt=media\" alt=\"\"></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6197543%2Fb2d5de8f842635d33d280d7405104789%2FScreenshot_2.jpg?generation=1686689091526052&amp;alt=media\" alt=\"\"></p>\n<ul>\n<li><a href=\"https://www.kaggle.com/maksimovka\" target=\"_blank\">Kostiantyn Maksymov</a> pointing out that this might be the reason that dilation <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901\" target=\"_blank\">works so well</a> on this data.</li>\n</ul>\n<p><strong>Answer (from the hosts):</strong></p>\n<blockquote>\n  <p>Some noise in the labels is to be expected with any such dataset. In this particular dataset, the borders of microvasculature structures are not always clearly distinguishable given the tissue thickness and resolution of the images. For example, when annotating peritubular capillaries, the endothelial cell membrane may be indistinguishable from the tubular epithelial membrane, leading to some overlap of annotation borders with tubular epithelium borders. One other thing to note is that often the borders of the annotations themselves can obscure important visual information used to distinguish the vessels from surrounding structures. It is helpful to have a side by side comparison of both annotated and un-annotated images to distinguish vessels.</p>\n</blockquote>\n<p><strong>Interesting read, recommended</strong></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412278\" target=\"_blank\">Dataset in JPG format.</a> By <a href=\"https://www.kaggle.com/kalelpark\" target=\"_blank\">Wongi Park</a></h5>\n<p><a href=\"https://www.kaggle.com/kalelpark\" target=\"_blank\">Wongi Park</a> shares with us the dataset in JPG format. The dataset maintains the original pixel dimensions.</p>\n<p>The <a href=\"https://www.kaggle.com/datasets/kalelpark/2023-hubmap-dataset-512x512\" target=\"_blank\">dataset</a></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417267\" target=\"_blank\">how to avoid overfit to WSI 1&amp;2?</a> By <a href=\"https://www.kaggle.com/abebe9849\" target=\"_blank\">patriot</a></h5>\n<p><a href=\"https://www.kaggle.com/abebe9849\" target=\"_blank\">Patriot</a> discusses strategies to avoid overfitting to the two WSIs used for learning and local validation, when the private test WSI is unknown. Since only two WSIs annotated by experts are provided, the challenge is to find data similarity and address any domain shift.</p>\n<p><strong>Some suggested approaches from the comments:</strong></p>\n<ul>\n<li>Normalize the data: Find a way to normalize the data such that the WSIs (1, 2, 3, 4, 6, 7, etc.) are similar. This can help mitigate the effect of domain shift.</li>\n<li>Measure similarity: Train a classifier to classify tiles into different classes (1, 2, 3, 4, 6, 7, etc.). Then, assess the similarity of the hidden private test (5) with respect to the known WSIs. This could be done by probing the hidden test data or embedding them into a common feature space using techniques like t-SNE or UMAP. The goal is to identify if the hidden test data falls within a certain distance of the known WSIs.</li>\n<li>Robust model training: If the domain shift is known, train a model that is robust within this shift. This can be achieved by using techniques like data augmentation or adaptation layers to make the model more resilient to variations in the data.</li>\n<li>Online learning and zero-shot learning: Maybe using online learning techniques along with a self/unsupervised approach like mask autoencoder. This allows the model to train on the hidden test data in a self/unsupervised manner, aiding in generalization.</li>\n<li>Leaving one WSI as validation on each fold.</li>\n</ul>\n<p>For more details, see the full post (Also: Interesting read).</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/418009\" target=\"_blank\">De-duplicated annotations - dataset</a> By <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a></h5>\n<ul>\n<li><p><a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a> discovered that about <strong>6% of the labels are duplicates</strong> in the annotations dataset.</p></li>\n<li><p>And created a  cleaned de-duplicated version of the dataset, available <a href=\"https://www.kaggle.com/datasets/fnands/de-duplicated-annotations-for-hubmap-hhv\" target=\"_blank\">here</a> (Same format as the original dataset).</p></li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419133\" target=\"_blank\">Some Insights</a> By <a href=\"https://www.kaggle.com/yassinealouini\" target=\"_blank\">Yassine Alouini</a></h5>\n<p>A very detailed summary of all useful details that are important to know for participating in this competition - Task, Keywords, Concepts, The Data, Train, Test, Metric and additional resources to read more.</p>\n<p><strong>Highly Recommended!</strong>.</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412683\" target=\"_blank\"> 📊Interactive visualization of tile annotations</a> By <a href=\"https://www.kaggle.com/leonidkulyk\" target=\"_blank\">Leonid Kulyk</a></h5>\n<p><a href=\"https://www.kaggle.com/leonidkulyk\" target=\"_blank\">Leonid Kulyk</a> shares an interactive visualization of the annotated samples for easy exploratory data analysis.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4158783%2F61a90a1661881b1607531bcb443b488f%2Fimage_2023-05-24_22-53-07.png?generation=1684958049039597&amp;alt=media\" alt=\"\"></p>\n<p><a href=\"https://www.kaggle.com/code/leonidkulyk/eda-hubmap-hhv-interactive-annotations\" target=\"_blank\">notebook</a></p>\n<p>Really cool! Thank you <a href=\"https://www.kaggle.com/leonidkulyk\" target=\"_blank\">Leonid Kulyk</a> for sharing this!</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419469\" target=\"_blank\">An amazing guide for detectron2 Faster R-CNN</a> By <a href=\"https://www.kaggle.com/gunesevitan\" target=\"_blank\">Gunes Evitan</a></h5>\n<p>Sharing with us two resources for understanding and implementing Detectron2's Faster R-CNN.</p>\n<ul>\n<li>In this <a href=\"https://medium.com/@hirotoschwert/digging-into-detectron-2-47b2e794fabd\" target=\"_blank\">medium series</a>, hirotoschwert provides a guide for understanding and implementing Detectron2's Faster R-CNN.</li>\n<li>And also shares a useful parameter documentation for Detectron2, which can be found <a href=\"https://detectron2.readthedocs.io/en/latest/modules/config.html#yaml-config-references\" target=\"_blank\">here</a>.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416380\" target=\"_blank\">Duplication of \"coordinates\"?</a> By <a href=\"https://www.kaggle.com/ptran1203\" target=\"_blank\">Phat Tran</a></h5>\n<p><a href=\"https://www.kaggle.com/ptran1203\" target=\"_blank\">Phat Tran</a> shares an interesting observation: Many images has duplicated <code>coordinates</code> in the annotations.</p>\n<blockquote>\n  <p>This means that the same polygons are repeated more than once in some images. For example, in the image <code>adadaeaa3635</code>, there is a polygon with duplicated coordinates for a \"blood_vessel\" type.</p>\n</blockquote>\n<p>Both <a href=\"https://www.kaggle.com/snaker\" target=\"_blank\">Chenglu</a> and <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a> confirmed that this is the case. And <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a> also shared a <a href=\"https://www.kaggle.com/datasets/fnands/de-duplicated-annotations-for-hubmap-hhv\" target=\"_blank\">notebook</a> to explore this issue further.</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416452\" target=\"_blank\">How far can we push SAM? [LB 0.372]</a> By <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a></h5>\n<ul>\n<li>In this <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416452\" target=\"_blank\">post</a>, <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a> experiments with Meta's <a href=\"https://github.com/facebookresearch/segment-anything/tree/main\" target=\"_blank\">SegmentAnything Model (SAM)</a> for object segmentation in the context of the competition.</li>\n<li>The goal is to train a lightweight object detection model (YOLOv7) to find objects, and then use SAM to refine the masks.</li>\n</ul>\n<blockquote>\n  <p>Reminder: SAM is a self-supervised model that can be used to refine masks on unseen images.</p>\n</blockquote>\n<ul>\n<li><p>First attempt is <a href=\"https://www.kaggle.com/code/fnands/yolov7-sam-inference-only\" target=\"_blank\">here</a></p></li>\n<li><p><strong>Improvement:</strong> Fine-tuning the mask decoder on dataset 1 improves the score from 0.195 to 0.364.</p></li>\n<li><p><strong>Improvement:</strong> Training on both dataset 1 and 2 lowers the LB score compared to training on dataset 1 only.</p></li>\n<li><p><strong>Improvement:</strong> Adding dilation improves the score from 0.148 to 0.195. Idea from <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901\" target=\"_blank\">here</a></p></li>\n<li><p><strong>Improvement:</strong> Fine-tuning the encoder for the ViT-b size improves the LB score from 0.365 to 0.372. <a href=\"https://torchmetrics.readthedocs.io/en/stable/detection/mean_average_precision.html\" target=\"_blank\">using torchmetrics</a></p></li>\n</ul>\n<blockquote>\n  <p>WOW <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a>! Thank you for this!</p>\n</blockquote>\n<ul>\n<li><strong>Another Attempt:</strong> Training the prompt encoder makes no significant difference in the performance.</li>\n<li><strong>Improvement:</strong> Switching from ViT-b to ViT-l size of SAM only increases the LB score by 0.001.</li>\n</ul>\n<p>(All credit for this post goes to <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a>)</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420764\" target=\"_blank\">onmipose demo: unet-based instance segmentation</a> By <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">Heng Cher Keng</a></h5>\n<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">Heng</a> introduces the Unet-based instance segmentation method using the Onmipose framework.</p>\n<p>And as usual also stared another research journal for this method.</p>\n<p><a href=\"https://www.kaggle.com/code/hengck23/unet-instance-segmentation-onmipose-part1\" target=\"_blank\">code part 1</a><br>\n<a href=\"https://www.kaggle.com/code/hengck23/unet-instance-segmentation-onmipose-part2\" target=\"_blank\">code part 2</a></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F113660%2F82351c00fc0cd7979ced374ae5190108%2FSelection_999(2454).png?generation=1688300870548277&amp;alt=media\" alt=\"\"></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414002\" target=\"_blank\">Inquiry | About mask format for submission</a> By <a href=\"https://www.kaggle.com/shinyatakaramoto\" target=\"_blank\">Shin</a></h5>\n<p>This post asks if we need to submit the filled mask or the contour mask.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5869697%2F0cb832b5148d52bd4a1cf9a1238e3efe%2Fimage.png?generation=1685498820470810&amp;alt=media\" alt=\"\"></p>\n<p><strong>Answer:</strong> The filled mask.</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419309\" target=\"_blank\">[Metric] Code to compute segm-mAP  CV scores</a> By <a href=\"https://www.kaggle.com/namgalielei\" target=\"_blank\">The Nam</a></h5>\n<p>This post provides code to compute mAP for this competition.</p>\n<blockquote>\n  <p><strong>Why?</strong> Most mAP calculators are integrated within specific frameworks and may lack flexibility when ensembling different models. (And some standalone implementations only compute box-mAP, not segm-mAP)</p>\n</blockquote>\n<p><a href=\"https://www.kaggle.com/code/namgalielei/hubmap-cv-score-map-calculator/notebook?scriptVersionId=134782419\" target=\"_blank\">notebook</a></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258\" target=\"_blank\">Introduction to SegFormer</a> By <a href=\"https://www.kaggle.com/ravishah1\" target=\"_blank\">Ravi Shah</a></h5>\n<p><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258\" target=\"_blank\">This post</a> provides an overview of the <strong>SegFormer model</strong>, which was used by the winner of a previous image segmentation competition.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6537187%2F3217f32058c82d8840284c040ae7e5b0%2FSegFormerImg.png?generation=1684803209937286&amp;alt=media\" alt=\"\"></p>\n<p><strong>TL;DR:</strong></p>\n<ul>\n<li>The SegFormer model is a Transformer for semantic segmentation.</li>\n<li>Using an improved transformer encoder and decoder with some novel architecture components.</li>\n<li>It achieves state-of-the-art results.</li>\n<li>You can find the full details and references in the <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258\" target=\"_blank\">post</a> but take in mind that the model is not allowed in the current competition.</li>\n</ul>\n<blockquote>\n  <p><strong>Important note: SegFormer is not allowed in the current competition. <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413834#2281425\" target=\"_blank\">source</a></strong></p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412802\" target=\"_blank\">ViT Segmentation Overview for HuBMAP - Hacking the Kidney</a> By <a href=\"https://www.kaggle.com/elcaiseri\" target=\"_blank\">Kassem</a></h5>\n<p><a href=\"https://www.kaggle.com/elcaiseri\" target=\"_blank\">Kassem</a> shares a brief overview of using Vision Transformer (ViT).</p>\n<ul>\n<li>Training Code from the previous comp: <a href=\"https://www.kaggle.com/code/elcaiseri/hubmap-pytorch-vit-segmentation-starter-train\" target=\"_blank\">hubmap-pytorch-vit-segmentation-train</a></li>\n<li>Inference Code from the previous comp: <a href=\"https://www.kaggle.com/code/elcaiseri/hubmap-pytorch-vit-segmentation-sub1\" target=\"_blank\">hubmap-pytorch-vit-segmentation-inference</a></li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413000\" target=\"_blank\">Data: Legal Issue</a> By <a href=\"https://www.kaggle.com/janglinko2\" target=\"_blank\">JanGlinko2</a></h5>\n<p><strong>Question:</strong> Is using annotated data from Dataset3 &amp; external human resources (doctors) is allowed?</p>\n<ul>\n<li><strong>Response:</strong> The response clarifies that human annotation of data is not allowed.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414525\" target=\"_blank\">[LB 0.246] detectron2 inference</a> By <a href=\"https://www.kaggle.com/plugin1689\" target=\"_blank\">whd</a></h5>\n<ul>\n<li><a href=\"https://www.kaggle.com/plugin1689\" target=\"_blank\">whd</a> shared a notebook <a href=\"https://www.kaggle.com/code/plugin1689/inference-detectron2\" target=\"_blank\">here</a> that serves as a baseline for inference using the <code>x101fpn</code> (<code>detectron2</code>).</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413834\" target=\"_blank\">MIT (segformer) models usage</a> By <a href=\"https://www.kaggle.com/maksimovka\" target=\"_blank\">Kostiantyn Maksymov</a></h5>\n<ul>\n<li>Since there has been a change in the license for SegFormer models (restricting commercial use) the use of SegFormer models is no longer allowed.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414513\" target=\"_blank\">how to use mmdet==3.x with python=3.10 in kaggle notebooks?</a> By <a href=\"https://www.kaggle.com/abebe9849\" target=\"_blank\">patriot</a></h5>\n<p>For everyone that face issues installing mmcv without internet access: Look <a href=\"https://www.kaggle.com/code/zzy990106/mmdet3-wheels\" target=\"_blank\">here</a></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419825\" target=\"_blank\">What versions of Yolo we can use in competitions?</a> By <a href=\"https://www.kaggle.com/pablolarrosa\" target=\"_blank\">Pablo Larrosa</a></h5>\n<p>Question: What versions of YOLO are we allowed to use in this competition?</p>\n<ul>\n<li>The licence for yolox is apache 2.0, so there seem to be no restrictions on its use for this competition.</li>\n<li>But the question about <code>yolov5</code>, <code>yolov7</code> and <code>yolov8</code> are still open.</li>\n<li>The licence for these appears to be AGPL or GPL 3.0. Commercial use does not seem to be completely restricted, but there seem to be some conditions (perhaps, disclosure of source code and modification).</li>\n</ul>\n<blockquote>\n  <p>No answers from the hosts yet.</p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421579\" target=\"_blank\">What are we missing out on?</a> By <a href=\"https://www.kaggle.com/bhavesjain\" target=\"_blank\">Bhavesh Jain</a></h5>\n<p>In this post by <a href=\"https://www.kaggle.com/bhavesjain\" target=\"_blank\">Bhavesh Jain</a>, the author raises the question of what could be missing in the current approaches and models for the competition.</p>\n<p>Although there is less discussion compared to previous competitions There are serveral potential areas for improvement listed in this discussion thread:</p>\n<ul>\n<li><strong>Dilation:</strong> The use of dilation on the predicted mask to improve performance on the test data.</li>\n<li><strong>Segmentation models:</strong> Considering the use of blending and different segmentation models such as YOLOv7, YOLOv8, and MaskR-CNN.</li>\n<li><strong>Training data division:</strong> Exploring different strategies for dividing the training dataset.</li>\n<li><strong>Changing inference size:</strong> Modifying the size of the inference to potentially improve results.</li>\n<li><strong>Also Note:</strong> Preprocessing the predicited mask using mask dilation increase the LB by about 0.1</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416432\" target=\"_blank\">How to install Pycoco library.</a> By <a href=\"https://www.kaggle.com/krish0202\" target=\"_blank\">Krish Sharma</a></h5>\n<p>For anyone struggling with installing pycoco, here is a solution:</p>\n<p>Include <a href=\"https://www.kaggle.com/datasets/ermak9/pycocotools\" target=\"_blank\">this</a> dataset and run the following code:</p>\n<pre><code>!cp -r nput working/pycocotools\n!pip install workingpycocotools-.  --no-index ---links=working\n</code></pre>\n<blockquote>\n  <p>Solution by <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnand</a></p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421546\" target=\"_blank\">Best way to ensemble models from different folds?</a> By <a href=\"https://www.kaggle.com/xstargate\" target=\"_blank\">xsong2020</a></h5>\n<p>Ensembling models in this competition is not trivial but there are several approaches to consider:</p>\n<ul>\n<li><a href=\"https://www.kaggle.com/code/mistag/sartorius-tta-with-weighted-segments-fusion\" target=\"_blank\">Weighted boxes fusion</a> (WBF)</li>\n<li><a href=\"https://arxiv.org/abs/1704.04503\" target=\"_blank\">Soft NMS</a> (non-maximum suppression)</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413151\" target=\"_blank\">My predicition output is just one 512*512 mask in float32, submission help needed!</a> By <a href=\"https://www.kaggle.com/wqx20000115\" target=\"_blank\">Eren Jaeger</a></h5>\n<p>In this post, there is a question about formatting for this competition: How to separate the prediction strings for multiple instance masks of the same image with a space on request.</p>\n<p><strong>Code by (<a href=\"https://www.kaggle.com/alabibojesomo\" target=\"_blank\">HungryLearner</a>)</strong></p>\n<pre><code> skimage import morphology\n skimage import , regionprops, regionprops_table\n\ndef get_vessels():\n    mask = image.(bool)\n    label_img = (mask)\n    regions = (label_img)\n    label_items = []\n    for region in regions:\n        minr, minc, maxr, maxc = region.bbox\n        zero = np.(mask.shape)\n        zero[minr:maxr, minc:maxc] = \n        label_item = (mask*zero).(bool)\n        label_items.(label_item)\n    return  label_items\n\nwidths = []\nheights = []\nids = preds[]\nprediction_strings = []\nfor k in ((ids)):\n    mask = preds[][k].().().()\n    h, w = mask.shape\n    seg_instances = (mask) #preds[][k].().())\n    # after seg infer\n    pred_string = \n    for i, binmask in (seg_instances):\n        encoded = (binmask)\n        if i == : pred_string += f\n        else: pred_string += f\n    heights.(h)\n    widths.(w)\n    prediction_strings.(pred_string)\n\nsubmission = pd.()\nsubmission[] = ids\nsubmission[] = heights\nsubmission[] = widths\nsubmission[] = prediction_strings\nsubmission[] = prediction_strings\nsubmission = submission.()\nsubmission.()\n\n(submission)\n</code></pre>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420063\" target=\"_blank\">LB :  0.377(single model) and 0.382(ensemble) with YoLoV7</a> By <a href=\"https://www.kaggle.com/chg0901\" target=\"_blank\">HongCheng</a></h5>\n<ul>\n<li>In this <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420063\" target=\"_blank\">post</a>, <a href=\"https://www.kaggle.com/chg0901\" target=\"_blank\">HongCheng</a> shares their current settings for training a single model and an ensemble using YoLoV7.</li>\n<li><strong>The Trick:</strong> The model training is done without the \"unsure\" label area.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420120\" target=\"_blank\">Please help! The Usage of TTA in Instance Segmentation</a> By <a href=\"https://www.kaggle.com/bent1e\" target=\"_blank\">bent1e</a></h5>\n<ul>\n<li><a href=\"https://www.kaggle.com/bent1e\" target=\"_blank\">bent1e</a> is seeking assistance with using Test-Time Augmentation (TTA) in instance segmentation to evaluate their model's performance.</li>\n<li>The current approach involves inverting the mask obtained after flipping and rotating onto the original image, but it is yielding inconsistent results in terms of the number of instance segmentation objects detected.</li>\n<li>Suggestions for TTA in instance segmentation:<ul>\n<li>Limit the transforms to geometric ones, such as rotation (multiples of 90 degrees), zoom, and affine transformations.</li>\n<li>Perform the inverse transformation accordingly.</li></ul></li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416613\" target=\"_blank\">Help with Notebook Threw Exception</a> By <a href=\"https://www.kaggle.com/robertsun2\" target=\"_blank\">Roberto</a></h5>\n<ul>\n<li>The author is having an issue with their notebook. When they submit it, they get a \"Notebook Threw Exception\" error, even though the notebook has completed successfully.</li>\n<li><strong>Debugging Suggestion:</strong> Some suggest simplifying the notebook to only include the inference part and remove any debugging or visualization code.</li>\n<li><strong>Proposal:</strong> Others suggest freeing up GPU memory by deleting tensors in the GPU. One comment mentions that the hidden test set contains multiple images, causing the GPU memory issue.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421788\" target=\"_blank\">Advice to newbie about learning parameters</a> By <a href=\"https://www.kaggle.com/jurassimo\" target=\"_blank\">Jura Moshkov</a></h5>\n<p>In this <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421788\" target=\"_blank\">post</a>, the author seeks advice on finding the best learning parameters for a model.</p>\n<ul>\n<li>Good <a href=\"https://github.com/google-research/tuning_playbook\" target=\"_blank\">link</a></li>\n<li>Users mention that different models may require different parameters, and experimentation is key to finding the best ones.</li>\n<li>Manual parameter tuning is often done by hand, looking at the results of each experiment one by one.</li>\n<li>Optuna and grid search may not be practical due to computational resource limitations.</li>\n<li>Intuition-based parameter tuning is considered a good approach for most deep learning tasks.</li>\n</ul>\n<hr>",
  "messages": [
    {
      "id": "2338410",
      "postDate": "07/10/2023 18:36:09",
      "content": "<h3>3 Weeks left! Here is everything that happened up to this point</h3>\n<p>We are approaching the final stage of the competition.<br>\nA good point to take a look back and summarize everything we know up to this point.</p>\n<p>I went through all the discussion threads (<strong>I went.</strong> not ChatGPT went. I actually read everything) and summarized the most interesting bits I found into this post.</p>\n<p>Enjoy!</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419143\" target=\"_blank\">[LB 0.458] my experiment results</a> By <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">Heng Cher Keng</a></h5>\n<p><strong>Highly recommended read.</strong></p>\n<ul>\n<li>Heng stared a thread with an ongoing research journal, I suggest reading it all because it is gold.</li>\n</ul>\n<blockquote>\n  <p>Not going to post all of it here as it is too long.</p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412307\" target=\"_blank\">🏆 HuBMAP last year winner solution 🏆</a> By <a href=\"https://www.kaggle.com/dwchen\" target=\"_blank\">Dewei Chen</a></h5>\n<p><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation\" target=\"_blank\"><strong>Last year Competition</strong></a></p>\n<ul>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/356201\" target=\"_blank\">1st place</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354857\" target=\"_blank\">2nd place</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354683\" target=\"_blank\">3rd place solution</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354851\" target=\"_blank\">4th place solution</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354859\" target=\"_blank\">7th place solution</a></li>\n</ul>\n<p><a href=\"https://www.kaggle.com/competitions/hubmap-kidney-segmentation\" target=\"_blank\"><strong>HuBMAN Two years ago</strong></a></p>\n<ul>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238198\" target=\"_blank\">1st place</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238013\" target=\"_blank\">3rd place</a></li>\n<li><a href=\"https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238024\" target=\"_blank\">4th place</a></li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901\" target=\"_blank\">Dilation increases the score, who understands why?</a> By <a href=\"https://www.kaggle.com/maksimovka\" target=\"_blank\">Kostiantyn Maksymov</a></h5>\n<p><a href=\"https://www.kaggle.com/maksimovka\" target=\"_blank\">Kostiantyn Maksymov</a> discusses an interesting finding regarding the use of dilation in postprocessing to improve the score on the leaderboard.</p>\n<ul>\n<li>A significant improvement in the score after dialation (0.239 to 0.345).</li>\n<li>Some people in the comments suggest that dilation helps include the edges of the blood vessel in the binary mask, which might not be captured by the model's original thresholding condition.</li>\n<li>There is a discussion about the different iterations of dilation and input sizes are discussed in the comments, and participants share their experiences and insights.</li>\n<li>The overall consensus is that dilation seems to be beneficial for the model's performance in this particular competition.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412316\" target=\"_blank\">SOTA and Popular Segment method: OneFormer and UNet</a> By <a href=\"https://www.kaggle.com/dwchen\" target=\"_blank\">Dewei Chen</a></h5>\n<p>The field is moving fast lately, so this is a great opportunity to catch up with the latest SOTA segmentation models.<br>\nHere they are:</p>\n<p><strong>OneFormer: One Transformer to Rule Universal Image Segmentation</strong></p>\n<ul>\n<li>OneFormer is a method based on transformer, and achieve the SOTA in 2023 CVPR</li>\n<li><a href=\"https://arxiv.org/pdf/2211.06220v2.pdf\" target=\"_blank\">paper</a> <a href=\"https://github.com/SHI-Labs/OneFormer\" target=\"_blank\">Implementation</a></li>\n</ul>\n<p><strong>U-Net: Convolutional Networks for Biomedical Image Segmentation</strong></p>\n<ul>\n<li>U-Net is the most popular segmentation method in bio relation topic.<br>\n<a href=\"https://arxiv.org/pdf/1505.04597v1.pdf\" target=\"_blank\">paper</a> [Implementation](<a href=\"https://github.com/milesial/Pytorch-UNet\" target=\"_blank\">https://github.com/milesial/Pytorch-UNet</a> or <a href=\"https://github.com/open-mmlab/mmsegmentation\" target=\"_blank\">https://github.com/open-mmlab/mmsegmentation</a>)</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412396\" target=\"_blank\">StainTools for Augmentation</a> By <a href=\"https://www.kaggle.com/ravishah1\" target=\"_blank\">Ravi Shah</a></h5>\n<p><a href=\"https://www.kaggle.com/ravishah1\" target=\"_blank\">Ravi Shah</a> shares with us a useful library for tissue image stain normalization and augmentation.</p>\n<p><strong>You can use it like this:</strong></p>\n<pre><code>!pip install staintools\n!pip install spams\n\nimport spams\nimport staintools\nimport numpy as np\nimport matplotlib as plt\ntarget = staintools()\nto_transform = staintools()\nStandardize brightness (optional, can improve the tissue  calculation)\n\ntarget = staintools(target)\nto_transform = staintools(to_transform)\n\nnormalizer = staintools(method=)\nnormalizer(target)\ntransformed1 = normalizer(to_transform)\nplt(transformed1)\n</code></pre>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417374\" target=\"_blank\">Can you annotate this image accurately?</a> By <a href=\"https://www.kaggle.com/itsuki9180\" target=\"_blank\">ITK8191</a></h5>\n<p><a href=\"https://www.kaggle.com/itsuki9180\" target=\"_blank\">ITK8191</a> shares with us harder ground truth samples from the dataset.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2294613%2F4519f684fb29efbc97bc075e1bef8ca2%2F9.png?generation=1686830802312243&amp;alt=media\" alt=\"\"></p>\n<p>As you can see, it is hard to tell what the white area should be.<br>\nThe post later on continue and discuss the importance of using the context of the image to improve the results.</p>\n<p><a href=\"https://www.kaggle.com/code/itsuki9180/investigate-tiles-on-wsi-1-and-2\" target=\"_blank\">notebook</a></p>\n<p>There are some interesting comments in the discussion about this but I think that the most important one is the comment by <a href=\"https://www.kaggle.com/snaker\" target=\"_blank\">Chenglu</a> that says:</p>\n<p>That we can use tile_meta.csv in test set. <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414669#2303907\" target=\"_blank\">source</a></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419848\" target=\"_blank\">segmentation_models_pytorch for instance segmentation</a> By <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">Heng Cher Keng</a></h5>\n<p>Sharing with us a <code>segmentation_models_pytorch</code> option for instance segmentation.</p>\n<p><a href=\"https://github.com/Lee-Gihun/MEDIAR\" target=\"_blank\">link</a></p>\n<p><a href=\"https://openreview.net/submissions?venue=NeurIPS.cc/2022/Challenge/CellSeg\" target=\"_blank\">Read more</a></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/415508\" target=\"_blank\">▲CV vs LB scores ▼</a> By <a href=\"https://www.kaggle.com/benihime91\" target=\"_blank\">Ayushman Buragohain</a></h5>\n<p>CV vs LB Scores Discussion:</p>\n<p><strong><a href=\"https://www.kaggle.com/benihime91\" target=\"_blank\">Ayushman Buragohain</a></strong></p>\n<ul>\n<li><strong>CV:</strong> 0.494</li>\n<li><strong>LB:</strong> 0.303</li>\n<li><strong>Model:</strong> resnet50_mask_rcnn</li>\n<li><a href=\"https://www.kaggle.com/code/benihime91/hubmap-2023-create-coco-annotations\" target=\"_blank\">notebook</a></li>\n</ul>\n<p><strong><a href=\"https://www.kaggle.com/abebe9849\" target=\"_blank\">patriot</a></strong></p>\n<ul>\n<li><strong>LB:</strong> 0.412</li>\n<li><strong>Val_coco-iou@0.5:0.95</strong> 0.39</li>\n<li><strong>Data:</strong> Only from dataset1,only use \"blood_vessel\" (dismiss \"unsure\" label)</li>\n<li><strong>Split:</strong> Random 8:2</li>\n</ul>\n<p><strong>[DYS]()</strong><br>\nReporting a strange issue:</p>\n<ul>\n<li><strong>LB:</strong> 0.14</li>\n<li><strong>CV:</strong> 0.4+</li>\n<li><strong>Model:</strong> mask-rcnn</li>\n<li><strong>Split:</strong> One fold</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412943\" target=\"_blank\">Introduction to SAM (Segment Anything Model) by Meta AI</a> By <a href=\"https://www.kaggle.com/azminetoushikwasi\" target=\"_blank\">Azmine Toushik Wasi</a></h5>\n<p><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412943\" target=\"_blank\">Post</a> by <a href=\"https://www.kaggle.com/azminetoushikwasi\" target=\"_blank\">Azmine Toushik Wasi</a></p>\n<p>Meta AI had introduced an incredibly powerful computer vision model lately: SAM (Segment Anything Model). In this post we get some materials about using it effectively to accurately segment any object in an image.</p>\n<blockquote>\n  <p><strong>How is this possible?</strong> This is a few-shot model, it generalizes to the context you give it.</p>\n</blockquote>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7168168%2Fb8c6d4829d3ed9d1122362cef035a149%2F68747470733a2f2f6d656469612e726f626f666c6f772e636f6d2f6e6f7465626f6f6b732f6578616d706c65732f7365676d656e742d616e797468696e672d6d6f64656c2d626c6f67706f73742e706e67.png?generation=1685069463019129&amp;alt=media\" alt=\"Image\"></p>\n<p><strong>Complementary Materials:</strong></p>\n<ul>\n<li><a href=\"https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-segment-anything-with-sam.ipynb\" target=\"_blank\">Colab Notebook</a></li>\n<li><a href=\"https://youtu.be/D-D6ZmadzPE\" target=\"_blank\">YouTube Video</a></li>\n<li><a href=\"https://blog.roboflow.com/how-to-use-segment-anything-model-sam\" target=\"_blank\">Roboflow Blog</a></li>\n<li><a href=\"https://blog.roboflow.com/how-to-use-segment-anything-model-sam\" target=\"_blank\">Segment Anything Model Blogpost</a></li>\n<li><a href=\"https://kaggle.com/kernels/welcome?src=https://github.com/roboflow-ai/notebooks/blob/main/notebooks/zero-shot-object-detection-with-grounding-dino.ipynb\" target=\"_blank\">Kaggle Kernel</a></li>\n<li><a href=\"https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-segment-anything-with-sam.ipynb\" target=\"_blank\">Google Colab Notebook</a></li>\n</ul>\n<p><strong>Useful Links:</strong> <a href=\"https://www.kaggle.com/code/fnands/yolov7-sam-inference-only\" target=\"_blank\">Yolov7 + SAM Inference</a>, <a href=\"https://www.kaggle.com/code/dlobatog/capillaries-sam-pretrained\" target=\"_blank\">Pretrained SAM</a>, <a href=\"https://youtu.be/fAw13m3Eb28\" target=\"_blank\">Mask Contours Analysis</a></p>\n<blockquote>\n  <p><strong>Note:</strong> I am not sure how much this model could hold up against a well fine-tuned model specifically made for this competition. But I think it is worth a try.</p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413038\" target=\"_blank\">Question about WSI, Dataset and Split</a> By <a href=\"https://www.kaggle.com/pt0x0e\" target=\"_blank\">PT0X0E</a></h5>\n<p>An interesting post about the splitting method of the data in this competition.<br>\nMore specifically, the confusion is around the phrase <code>Two of the WSIs make up the training set, two WSIs make up the public test set</code> used in the competition description.</p>\n<p>After some back and forth, the following chat is concluded and presumed to be the correct one:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F12313384%2Fd0fad19fa693732c2cae00c41453adf4%2F2023-05-29%2020.32.10.png?generation=1685363555970493&amp;alt=media\" alt=\"\"></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417314\" target=\"_blank\">yet another puzzle game?</a> By <a href=\"https://www.kaggle.com/snaker\" target=\"_blank\">Chenglu</a></h5>\n<p>This post was written before the it was announced that we can use the <code>tile_meta.csv</code> file during test time but anyway there is an interesting discussion here.<br>\nIf we were not given this file, the main challenge would have been to run semantic segmentation (maybe not even instance segmentation) of the full image and then somehow stitch the tiles together.</p>\n<p>But <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">Heng Cher Keng</a> suggested an interesting idea: <strong>Zoom and focus:</strong> We can perform semantic segmentation on the larger image and then lower the resolution by creating possible candidate slices.</p>\n<p>Elegant and simple solution!</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414896\" target=\"_blank\">Does it make sense to train your model for identifying glomeruli?</a> By <a href=\"https://www.kaggle.com/janhuebi\" target=\"_blank\">Jan H</a></h5>\n<p><a href=\"https://www.kaggle.com/janhuebi\" target=\"_blank\">Jan H</a> raises an interesting question: Wondering if it is useful to train the model for 3 classes (background, blood vessel and glomerulus) or if it was sufficient to not include glomeruli mask and prediction class in the training of the model.</p>\n<p>In this <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414896\" target=\"_blank\">post</a>, the author raises a question about the necessity of training the model to identify glomeruli in addition to blood vessels. The author wonders if excluding the glomeruli mask and prediction class from the training data would suffice since the challenge's focus is on identifying blood vessels.</p>\n<p><strong>Answer (from the hosts):</strong></p>\n<blockquote>\n  <p>The annotations for glomeruli in the test set will be available during submission. You may use these to exclude your blood vessel predictions that lie within the glomeruli structures. You don't need to predict glomeruli.</p>\n</blockquote>\n<p>Followup question by <a href=\"https://www.kaggle.com/alabibojesomo\" target=\"_blank\">HungryLearner</a>:</p>\n<blockquote>\n  <p>Where can we get these annotations for glomerulus during inference in order to use these in excluding the blood vessel predictions within them.</p>\n</blockquote>\n<p><strong>Answer (from the hosts):</strong></p>\n<blockquote>\n  <p>The hidden version of the polygons.jsonl file should contain glomerulus annotations for the test set images. They aren't present in the public version of the dataset, but are added in the hidden version available to your notebook during inference.</p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417012\" target=\"_blank\">Test data annotation</a> By <a href=\"https://www.kaggle.com/aleksandrmogilevskiy\" target=\"_blank\">Sasha Mogilevskii</a></h5>\n<p><a href=\"https://www.kaggle.com/aleksandrmogilevskiy\" target=\"_blank\">Sasha Mogilevskii</a> is pointing out that dataset 1 and dataset 2 are annotated <strong>differently</strong>.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6197543%2F9b3efffbbe418bfb299d90f66b0d79de%2FScreenshot_4.jpg?generation=1686689058146565&amp;alt=media\" alt=\"\"></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6197543%2Fb2d5de8f842635d33d280d7405104789%2FScreenshot_2.jpg?generation=1686689091526052&amp;alt=media\" alt=\"\"></p>\n<ul>\n<li><a href=\"https://www.kaggle.com/maksimovka\" target=\"_blank\">Kostiantyn Maksymov</a> pointing out that this might be the reason that dilation <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901\" target=\"_blank\">works so well</a> on this data.</li>\n</ul>\n<p><strong>Answer (from the hosts):</strong></p>\n<blockquote>\n  <p>Some noise in the labels is to be expected with any such dataset. In this particular dataset, the borders of microvasculature structures are not always clearly distinguishable given the tissue thickness and resolution of the images. For example, when annotating peritubular capillaries, the endothelial cell membrane may be indistinguishable from the tubular epithelial membrane, leading to some overlap of annotation borders with tubular epithelium borders. One other thing to note is that often the borders of the annotations themselves can obscure important visual information used to distinguish the vessels from surrounding structures. It is helpful to have a side by side comparison of both annotated and un-annotated images to distinguish vessels.</p>\n</blockquote>\n<p><strong>Interesting read, recommended</strong></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412278\" target=\"_blank\">Dataset in JPG format.</a> By <a href=\"https://www.kaggle.com/kalelpark\" target=\"_blank\">Wongi Park</a></h5>\n<p><a href=\"https://www.kaggle.com/kalelpark\" target=\"_blank\">Wongi Park</a> shares with us the dataset in JPG format. The dataset maintains the original pixel dimensions.</p>\n<p>The <a href=\"https://www.kaggle.com/datasets/kalelpark/2023-hubmap-dataset-512x512\" target=\"_blank\">dataset</a></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417267\" target=\"_blank\">how to avoid overfit to WSI 1&amp;2?</a> By <a href=\"https://www.kaggle.com/abebe9849\" target=\"_blank\">patriot</a></h5>\n<p><a href=\"https://www.kaggle.com/abebe9849\" target=\"_blank\">Patriot</a> discusses strategies to avoid overfitting to the two WSIs used for learning and local validation, when the private test WSI is unknown. Since only two WSIs annotated by experts are provided, the challenge is to find data similarity and address any domain shift.</p>\n<p><strong>Some suggested approaches from the comments:</strong></p>\n<ul>\n<li>Normalize the data: Find a way to normalize the data such that the WSIs (1, 2, 3, 4, 6, 7, etc.) are similar. This can help mitigate the effect of domain shift.</li>\n<li>Measure similarity: Train a classifier to classify tiles into different classes (1, 2, 3, 4, 6, 7, etc.). Then, assess the similarity of the hidden private test (5) with respect to the known WSIs. This could be done by probing the hidden test data or embedding them into a common feature space using techniques like t-SNE or UMAP. The goal is to identify if the hidden test data falls within a certain distance of the known WSIs.</li>\n<li>Robust model training: If the domain shift is known, train a model that is robust within this shift. This can be achieved by using techniques like data augmentation or adaptation layers to make the model more resilient to variations in the data.</li>\n<li>Online learning and zero-shot learning: Maybe using online learning techniques along with a self/unsupervised approach like mask autoencoder. This allows the model to train on the hidden test data in a self/unsupervised manner, aiding in generalization.</li>\n<li>Leaving one WSI as validation on each fold.</li>\n</ul>\n<p>For more details, see the full post (Also: Interesting read).</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/418009\" target=\"_blank\">De-duplicated annotations - dataset</a> By <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a></h5>\n<ul>\n<li><p><a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a> discovered that about <strong>6% of the labels are duplicates</strong> in the annotations dataset.</p></li>\n<li><p>And created a  cleaned de-duplicated version of the dataset, available <a href=\"https://www.kaggle.com/datasets/fnands/de-duplicated-annotations-for-hubmap-hhv\" target=\"_blank\">here</a> (Same format as the original dataset).</p></li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419133\" target=\"_blank\">Some Insights</a> By <a href=\"https://www.kaggle.com/yassinealouini\" target=\"_blank\">Yassine Alouini</a></h5>\n<p>A very detailed summary of all useful details that are important to know for participating in this competition - Task, Keywords, Concepts, The Data, Train, Test, Metric and additional resources to read more.</p>\n<p><strong>Highly Recommended!</strong>.</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412683\" target=\"_blank\"> 📊Interactive visualization of tile annotations</a> By <a href=\"https://www.kaggle.com/leonidkulyk\" target=\"_blank\">Leonid Kulyk</a></h5>\n<p><a href=\"https://www.kaggle.com/leonidkulyk\" target=\"_blank\">Leonid Kulyk</a> shares an interactive visualization of the annotated samples for easy exploratory data analysis.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4158783%2F61a90a1661881b1607531bcb443b488f%2Fimage_2023-05-24_22-53-07.png?generation=1684958049039597&amp;alt=media\" alt=\"\"></p>\n<p><a href=\"https://www.kaggle.com/code/leonidkulyk/eda-hubmap-hhv-interactive-annotations\" target=\"_blank\">notebook</a></p>\n<p>Really cool! Thank you <a href=\"https://www.kaggle.com/leonidkulyk\" target=\"_blank\">Leonid Kulyk</a> for sharing this!</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419469\" target=\"_blank\">An amazing guide for detectron2 Faster R-CNN</a> By <a href=\"https://www.kaggle.com/gunesevitan\" target=\"_blank\">Gunes Evitan</a></h5>\n<p>Sharing with us two resources for understanding and implementing Detectron2's Faster R-CNN.</p>\n<ul>\n<li>In this <a href=\"https://medium.com/@hirotoschwert/digging-into-detectron-2-47b2e794fabd\" target=\"_blank\">medium series</a>, hirotoschwert provides a guide for understanding and implementing Detectron2's Faster R-CNN.</li>\n<li>And also shares a useful parameter documentation for Detectron2, which can be found <a href=\"https://detectron2.readthedocs.io/en/latest/modules/config.html#yaml-config-references\" target=\"_blank\">here</a>.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416380\" target=\"_blank\">Duplication of \"coordinates\"?</a> By <a href=\"https://www.kaggle.com/ptran1203\" target=\"_blank\">Phat Tran</a></h5>\n<p><a href=\"https://www.kaggle.com/ptran1203\" target=\"_blank\">Phat Tran</a> shares an interesting observation: Many images has duplicated <code>coordinates</code> in the annotations.</p>\n<blockquote>\n  <p>This means that the same polygons are repeated more than once in some images. For example, in the image <code>adadaeaa3635</code>, there is a polygon with duplicated coordinates for a \"blood_vessel\" type.</p>\n</blockquote>\n<p>Both <a href=\"https://www.kaggle.com/snaker\" target=\"_blank\">Chenglu</a> and <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a> confirmed that this is the case. And <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a> also shared a <a href=\"https://www.kaggle.com/datasets/fnands/de-duplicated-annotations-for-hubmap-hhv\" target=\"_blank\">notebook</a> to explore this issue further.</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416452\" target=\"_blank\">How far can we push SAM? [LB 0.372]</a> By <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a></h5>\n<ul>\n<li>In this <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416452\" target=\"_blank\">post</a>, <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a> experiments with Meta's <a href=\"https://github.com/facebookresearch/segment-anything/tree/main\" target=\"_blank\">SegmentAnything Model (SAM)</a> for object segmentation in the context of the competition.</li>\n<li>The goal is to train a lightweight object detection model (YOLOv7) to find objects, and then use SAM to refine the masks.</li>\n</ul>\n<blockquote>\n  <p>Reminder: SAM is a self-supervised model that can be used to refine masks on unseen images.</p>\n</blockquote>\n<ul>\n<li><p>First attempt is <a href=\"https://www.kaggle.com/code/fnands/yolov7-sam-inference-only\" target=\"_blank\">here</a></p></li>\n<li><p><strong>Improvement:</strong> Fine-tuning the mask decoder on dataset 1 improves the score from 0.195 to 0.364.</p></li>\n<li><p><strong>Improvement:</strong> Training on both dataset 1 and 2 lowers the LB score compared to training on dataset 1 only.</p></li>\n<li><p><strong>Improvement:</strong> Adding dilation improves the score from 0.148 to 0.195. Idea from <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901\" target=\"_blank\">here</a></p></li>\n<li><p><strong>Improvement:</strong> Fine-tuning the encoder for the ViT-b size improves the LB score from 0.365 to 0.372. <a href=\"https://torchmetrics.readthedocs.io/en/stable/detection/mean_average_precision.html\" target=\"_blank\">using torchmetrics</a></p></li>\n</ul>\n<blockquote>\n  <p>WOW <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a>! Thank you for this!</p>\n</blockquote>\n<ul>\n<li><strong>Another Attempt:</strong> Training the prompt encoder makes no significant difference in the performance.</li>\n<li><strong>Improvement:</strong> Switching from ViT-b to ViT-l size of SAM only increases the LB score by 0.001.</li>\n</ul>\n<p>(All credit for this post goes to <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnands</a>)</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420764\" target=\"_blank\">onmipose demo: unet-based instance segmentation</a> By <a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">Heng Cher Keng</a></h5>\n<p><a href=\"https://www.kaggle.com/hengck23\" target=\"_blank\">Heng</a> introduces the Unet-based instance segmentation method using the Onmipose framework.</p>\n<p>And as usual also stared another research journal for this method.</p>\n<p><a href=\"https://www.kaggle.com/code/hengck23/unet-instance-segmentation-onmipose-part1\" target=\"_blank\">code part 1</a><br>\n<a href=\"https://www.kaggle.com/code/hengck23/unet-instance-segmentation-onmipose-part2\" target=\"_blank\">code part 2</a></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F113660%2F82351c00fc0cd7979ced374ae5190108%2FSelection_999(2454).png?generation=1688300870548277&amp;alt=media\" alt=\"\"></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414002\" target=\"_blank\">Inquiry | About mask format for submission</a> By <a href=\"https://www.kaggle.com/shinyatakaramoto\" target=\"_blank\">Shin</a></h5>\n<p>This post asks if we need to submit the filled mask or the contour mask.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5869697%2F0cb832b5148d52bd4a1cf9a1238e3efe%2Fimage.png?generation=1685498820470810&amp;alt=media\" alt=\"\"></p>\n<p><strong>Answer:</strong> The filled mask.</p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419309\" target=\"_blank\">[Metric] Code to compute segm-mAP  CV scores</a> By <a href=\"https://www.kaggle.com/namgalielei\" target=\"_blank\">The Nam</a></h5>\n<p>This post provides code to compute mAP for this competition.</p>\n<blockquote>\n  <p><strong>Why?</strong> Most mAP calculators are integrated within specific frameworks and may lack flexibility when ensembling different models. (And some standalone implementations only compute box-mAP, not segm-mAP)</p>\n</blockquote>\n<p><a href=\"https://www.kaggle.com/code/namgalielei/hubmap-cv-score-map-calculator/notebook?scriptVersionId=134782419\" target=\"_blank\">notebook</a></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258\" target=\"_blank\">Introduction to SegFormer</a> By <a href=\"https://www.kaggle.com/ravishah1\" target=\"_blank\">Ravi Shah</a></h5>\n<p><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258\" target=\"_blank\">This post</a> provides an overview of the <strong>SegFormer model</strong>, which was used by the winner of a previous image segmentation competition.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6537187%2F3217f32058c82d8840284c040ae7e5b0%2FSegFormerImg.png?generation=1684803209937286&amp;alt=media\" alt=\"\"></p>\n<p><strong>TL;DR:</strong></p>\n<ul>\n<li>The SegFormer model is a Transformer for semantic segmentation.</li>\n<li>Using an improved transformer encoder and decoder with some novel architecture components.</li>\n<li>It achieves state-of-the-art results.</li>\n<li>You can find the full details and references in the <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258\" target=\"_blank\">post</a> but take in mind that the model is not allowed in the current competition.</li>\n</ul>\n<blockquote>\n  <p><strong>Important note: SegFormer is not allowed in the current competition. <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413834#2281425\" target=\"_blank\">source</a></strong></p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412802\" target=\"_blank\">ViT Segmentation Overview for HuBMAP - Hacking the Kidney</a> By <a href=\"https://www.kaggle.com/elcaiseri\" target=\"_blank\">Kassem</a></h5>\n<p><a href=\"https://www.kaggle.com/elcaiseri\" target=\"_blank\">Kassem</a> shares a brief overview of using Vision Transformer (ViT).</p>\n<ul>\n<li>Training Code from the previous comp: <a href=\"https://www.kaggle.com/code/elcaiseri/hubmap-pytorch-vit-segmentation-starter-train\" target=\"_blank\">hubmap-pytorch-vit-segmentation-train</a></li>\n<li>Inference Code from the previous comp: <a href=\"https://www.kaggle.com/code/elcaiseri/hubmap-pytorch-vit-segmentation-sub1\" target=\"_blank\">hubmap-pytorch-vit-segmentation-inference</a></li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413000\" target=\"_blank\">Data: Legal Issue</a> By <a href=\"https://www.kaggle.com/janglinko2\" target=\"_blank\">JanGlinko2</a></h5>\n<p><strong>Question:</strong> Is using annotated data from Dataset3 &amp; external human resources (doctors) is allowed?</p>\n<ul>\n<li><strong>Response:</strong> The response clarifies that human annotation of data is not allowed.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414525\" target=\"_blank\">[LB 0.246] detectron2 inference</a> By <a href=\"https://www.kaggle.com/plugin1689\" target=\"_blank\">whd</a></h5>\n<ul>\n<li><a href=\"https://www.kaggle.com/plugin1689\" target=\"_blank\">whd</a> shared a notebook <a href=\"https://www.kaggle.com/code/plugin1689/inference-detectron2\" target=\"_blank\">here</a> that serves as a baseline for inference using the <code>x101fpn</code> (<code>detectron2</code>).</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413834\" target=\"_blank\">MIT (segformer) models usage</a> By <a href=\"https://www.kaggle.com/maksimovka\" target=\"_blank\">Kostiantyn Maksymov</a></h5>\n<ul>\n<li>Since there has been a change in the license for SegFormer models (restricting commercial use) the use of SegFormer models is no longer allowed.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414513\" target=\"_blank\">how to use mmdet==3.x with python=3.10 in kaggle notebooks?</a> By <a href=\"https://www.kaggle.com/abebe9849\" target=\"_blank\">patriot</a></h5>\n<p>For everyone that face issues installing mmcv without internet access: Look <a href=\"https://www.kaggle.com/code/zzy990106/mmdet3-wheels\" target=\"_blank\">here</a></p>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419825\" target=\"_blank\">What versions of Yolo we can use in competitions?</a> By <a href=\"https://www.kaggle.com/pablolarrosa\" target=\"_blank\">Pablo Larrosa</a></h5>\n<p>Question: What versions of YOLO are we allowed to use in this competition?</p>\n<ul>\n<li>The licence for yolox is apache 2.0, so there seem to be no restrictions on its use for this competition.</li>\n<li>But the question about <code>yolov5</code>, <code>yolov7</code> and <code>yolov8</code> are still open.</li>\n<li>The licence for these appears to be AGPL or GPL 3.0. Commercial use does not seem to be completely restricted, but there seem to be some conditions (perhaps, disclosure of source code and modification).</li>\n</ul>\n<blockquote>\n  <p>No answers from the hosts yet.</p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421579\" target=\"_blank\">What are we missing out on?</a> By <a href=\"https://www.kaggle.com/bhavesjain\" target=\"_blank\">Bhavesh Jain</a></h5>\n<p>In this post by <a href=\"https://www.kaggle.com/bhavesjain\" target=\"_blank\">Bhavesh Jain</a>, the author raises the question of what could be missing in the current approaches and models for the competition.</p>\n<p>Although there is less discussion compared to previous competitions There are serveral potential areas for improvement listed in this discussion thread:</p>\n<ul>\n<li><strong>Dilation:</strong> The use of dilation on the predicted mask to improve performance on the test data.</li>\n<li><strong>Segmentation models:</strong> Considering the use of blending and different segmentation models such as YOLOv7, YOLOv8, and MaskR-CNN.</li>\n<li><strong>Training data division:</strong> Exploring different strategies for dividing the training dataset.</li>\n<li><strong>Changing inference size:</strong> Modifying the size of the inference to potentially improve results.</li>\n<li><strong>Also Note:</strong> Preprocessing the predicited mask using mask dilation increase the LB by about 0.1</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416432\" target=\"_blank\">How to install Pycoco library.</a> By <a href=\"https://www.kaggle.com/krish0202\" target=\"_blank\">Krish Sharma</a></h5>\n<p>For anyone struggling with installing pycoco, here is a solution:</p>\n<p>Include <a href=\"https://www.kaggle.com/datasets/ermak9/pycocotools\" target=\"_blank\">this</a> dataset and run the following code:</p>\n<pre><code>!cp -r nput working/pycocotools\n!pip install workingpycocotools-.  --no-index ---links=working\n</code></pre>\n<blockquote>\n  <p>Solution by <a href=\"https://www.kaggle.com/fnands\" target=\"_blank\">fnand</a></p>\n</blockquote>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421546\" target=\"_blank\">Best way to ensemble models from different folds?</a> By <a href=\"https://www.kaggle.com/xstargate\" target=\"_blank\">xsong2020</a></h5>\n<p>Ensembling models in this competition is not trivial but there are several approaches to consider:</p>\n<ul>\n<li><a href=\"https://www.kaggle.com/code/mistag/sartorius-tta-with-weighted-segments-fusion\" target=\"_blank\">Weighted boxes fusion</a> (WBF)</li>\n<li><a href=\"https://arxiv.org/abs/1704.04503\" target=\"_blank\">Soft NMS</a> (non-maximum suppression)</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413151\" target=\"_blank\">My predicition output is just one 512*512 mask in float32, submission help needed!</a> By <a href=\"https://www.kaggle.com/wqx20000115\" target=\"_blank\">Eren Jaeger</a></h5>\n<p>In this post, there is a question about formatting for this competition: How to separate the prediction strings for multiple instance masks of the same image with a space on request.</p>\n<p><strong>Code by (<a href=\"https://www.kaggle.com/alabibojesomo\" target=\"_blank\">HungryLearner</a>)</strong></p>\n<pre><code> skimage import morphology\n skimage import , regionprops, regionprops_table\n\ndef get_vessels():\n    mask = image.(bool)\n    label_img = (mask)\n    regions = (label_img)\n    label_items = []\n    for region in regions:\n        minr, minc, maxr, maxc = region.bbox\n        zero = np.(mask.shape)\n        zero[minr:maxr, minc:maxc] = \n        label_item = (mask*zero).(bool)\n        label_items.(label_item)\n    return  label_items\n\nwidths = []\nheights = []\nids = preds[]\nprediction_strings = []\nfor k in ((ids)):\n    mask = preds[][k].().().()\n    h, w = mask.shape\n    seg_instances = (mask) #preds[][k].().())\n    # after seg infer\n    pred_string = \n    for i, binmask in (seg_instances):\n        encoded = (binmask)\n        if i == : pred_string += f\n        else: pred_string += f\n    heights.(h)\n    widths.(w)\n    prediction_strings.(pred_string)\n\nsubmission = pd.()\nsubmission[] = ids\nsubmission[] = heights\nsubmission[] = widths\nsubmission[] = prediction_strings\nsubmission[] = prediction_strings\nsubmission = submission.()\nsubmission.()\n\n(submission)\n</code></pre>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420063\" target=\"_blank\">LB :  0.377(single model) and 0.382(ensemble) with YoLoV7</a> By <a href=\"https://www.kaggle.com/chg0901\" target=\"_blank\">HongCheng</a></h5>\n<ul>\n<li>In this <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420063\" target=\"_blank\">post</a>, <a href=\"https://www.kaggle.com/chg0901\" target=\"_blank\">HongCheng</a> shares their current settings for training a single model and an ensemble using YoLoV7.</li>\n<li><strong>The Trick:</strong> The model training is done without the \"unsure\" label area.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420120\" target=\"_blank\">Please help! The Usage of TTA in Instance Segmentation</a> By <a href=\"https://www.kaggle.com/bent1e\" target=\"_blank\">bent1e</a></h5>\n<ul>\n<li><a href=\"https://www.kaggle.com/bent1e\" target=\"_blank\">bent1e</a> is seeking assistance with using Test-Time Augmentation (TTA) in instance segmentation to evaluate their model's performance.</li>\n<li>The current approach involves inverting the mask obtained after flipping and rotating onto the original image, but it is yielding inconsistent results in terms of the number of instance segmentation objects detected.</li>\n<li>Suggestions for TTA in instance segmentation:<ul>\n<li>Limit the transforms to geometric ones, such as rotation (multiples of 90 degrees), zoom, and affine transformations.</li>\n<li>Perform the inverse transformation accordingly.</li></ul></li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416613\" target=\"_blank\">Help with Notebook Threw Exception</a> By <a href=\"https://www.kaggle.com/robertsun2\" target=\"_blank\">Roberto</a></h5>\n<ul>\n<li>The author is having an issue with their notebook. When they submit it, they get a \"Notebook Threw Exception\" error, even though the notebook has completed successfully.</li>\n<li><strong>Debugging Suggestion:</strong> Some suggest simplifying the notebook to only include the inference part and remove any debugging or visualization code.</li>\n<li><strong>Proposal:</strong> Others suggest freeing up GPU memory by deleting tensors in the GPU. One comment mentions that the hidden test set contains multiple images, causing the GPU memory issue.</li>\n</ul>\n<hr>\n<h5><a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421788\" target=\"_blank\">Advice to newbie about learning parameters</a> By <a href=\"https://www.kaggle.com/jurassimo\" target=\"_blank\">Jura Moshkov</a></h5>\n<p>In this <a href=\"https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421788\" target=\"_blank\">post</a>, the author seeks advice on finding the best learning parameters for a model.</p>\n<ul>\n<li>Good <a href=\"https://github.com/google-research/tuning_playbook\" target=\"_blank\">link</a></li>\n<li>Users mention that different models may require different parameters, and experimentation is key to finding the best ones.</li>\n<li>Manual parameter tuning is often done by hand, looking at the results of each experiment one by one.</li>\n<li>Optuna and grid search may not be practical due to computational resource limitations.</li>\n<li>Intuition-based parameter tuning is considered a good approach for most deep learning tasks.</li>\n</ul>\n<hr>",
      "rawMarkdown": "### 3 Weeks left! Here is everything that happened up to this point\n\nWe are approaching the final stage of the competition.\nA good point to take a look back and summarize everything we know up to this point.\n\nI went through all the discussion threads (**I went.** not ChatGPT went. I actually read everything) and summarized the most interesting bits I found into this post.\n\nEnjoy!\n\n_____\n\n##### [[LB 0.458] my experiment results](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419143) By [Heng Cher Keng](https://www.kaggle.com/hengck23)\n\n**Highly recommended read.**\n\n- Heng stared a thread with an ongoing research journal, I suggest reading it all because it is gold.\n\n> Not going to post all of it here as it is too long.\n\n_____\n\n##### [🏆 HuBMAP last year winner solution 🏆](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412307) By [Dewei Chen](https://www.kaggle.com/dwchen)\n\n[**Last year Competition**](https://www.kaggle.com/competitions/hubmap-organ-segmentation)\n\n- [1st place](https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/356201)\n- [2nd place](https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354857)\n- [3rd place solution](https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354683)\n- [4th place solution](https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354851)\n- [7th place solution](https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354859)\n\n[**HuBMAN Two years ago**](https://www.kaggle.com/competitions/hubmap-kidney-segmentation)\n- [1st place](https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238198)\n- [3rd place](https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238013)\n- [4th place](https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238024)\n\n\n\n_____\n\n##### [Dilation increases the score, who understands why?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901) By [Kostiantyn Maksymov](https://www.kaggle.com/maksimovka)\n\n[Kostiantyn Maksymov](https://www.kaggle.com/maksimovka) discusses an interesting finding regarding the use of dilation in postprocessing to improve the score on the leaderboard.\n\n- A significant improvement in the score after dialation (0.239 to 0.345).\n- Some people in the comments suggest that dilation helps include the edges of the blood vessel in the binary mask, which might not be captured by the model's original thresholding condition.\n- There is a discussion about the different iterations of dilation and input sizes are discussed in the comments, and participants share their experiences and insights.\n- The overall consensus is that dilation seems to be beneficial for the model's performance in this particular competition.\n\n_____\n\n\n##### [SOTA and Popular Segment method: OneFormer and UNet](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412316) By [Dewei Chen](https://www.kaggle.com/dwchen)\n\nThe field is moving fast lately, so this is a great opportunity to catch up with the latest SOTA segmentation models.\nHere they are:\n\n**OneFormer: One Transformer to Rule Universal Image Segmentation**\n- OneFormer is a method based on transformer, and achieve the SOTA in 2023 CVPR\n- [paper](https://arxiv.org/pdf/2211.06220v2.pdf) [Implementation](https://github.com/SHI-Labs/OneFormer)\n\n**U-Net: Convolutional Networks for Biomedical Image Segmentation**\n- U-Net is the most popular segmentation method in bio relation topic.\n[paper](https://arxiv.org/pdf/1505.04597v1.pdf) [Implementation](https://github.com/milesial/Pytorch-UNet or https://github.com/open-mmlab/mmsegmentation)\n\n_____\n\n##### [StainTools for Augmentation](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412396) By [Ravi Shah](https://www.kaggle.com/ravishah1)\n\n[Ravi Shah](https://www.kaggle.com/ravishah1) shares with us a useful library for tissue image stain normalization and augmentation.\n\n**You can use it like this:**\n\n```\n!pip install staintools\n!pip install spams\n\nimport spams\nimport staintools\nimport numpy as np\nimport matplotlib.pyplot as plt\ntarget = staintools.read_image(\"./data/my_target_image.png\")\nto_transform = staintools.read_image(\"./data/my_image_to_transform.png\")\nStandardize brightness (optional, can improve the tissue mask calculation)\n\ntarget = staintools.LuminosityStandardizer.standardize(target)\nto_transform = staintools.LuminosityStandardizer.standardize(to_transform)\n\nnormalizer = staintools.StainNormalizer(method='vahadane')\nnormalizer.fit(target)\ntransformed1 = normalizer.transform(to_transform)\nplt.imshow(transformed1)\n```\n\n\n_____\n\n##### [Can you annotate this image accurately?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417374) By [ITK8191](https://www.kaggle.com/itsuki9180)\n\n[ITK8191](https://www.kaggle.com/itsuki9180) shares with us harder ground truth samples from the dataset.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2294613%2F4519f684fb29efbc97bc075e1bef8ca2%2F9.png?generation=1686830802312243&alt=media)\n\nAs you can see, it is hard to tell what the white area should be.\nThe post later on continue and discuss the importance of using the context of the image to improve the results.\n\n[notebook](https://www.kaggle.com/code/itsuki9180/investigate-tiles-on-wsi-1-and-2)\n\nThere are some interesting comments in the discussion about this but I think that the most important one is the comment by [Chenglu](https://www.kaggle.com/snaker) that says:\n\nThat we can use tile_meta.csv in test set. [source](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414669#2303907)\n\n_____\n\n##### [segmentation_models_pytorch for instance segmentation](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419848) By [Heng Cher Keng](https://www.kaggle.com/hengck23)\n\nSharing with us a `segmentation_models_pytorch` option for instance segmentation.\n\n[link](https://github.com/Lee-Gihun/MEDIAR)\n\n[Read more](https://openreview.net/submissions?venue=NeurIPS.cc/2022/Challenge/CellSeg)\n\n_____\n\n##### [▲CV vs LB scores ▼](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/415508) By [Ayushman Buragohain](https://www.kaggle.com/benihime91)\n\nCV vs LB Scores Discussion:\n\n**[Ayushman Buragohain](https://www.kaggle.com/benihime91)**\n - **CV:** 0.494\n - **LB:** 0.303\n - **Model:** resnet50_mask_rcnn\n - [notebook](https://www.kaggle.com/code/benihime91/hubmap-2023-create-coco-annotations)\n\n**[patriot](https://www.kaggle.com/abebe9849)**\n- **LB:** 0.412\n- **Val_coco-iou@0.5:0.95** 0.39\n- **Data:** Only from dataset1,only use \"blood_vessel\" (dismiss \"unsure\" label)\n- **Split:** Random 8:2\n\n**[DYS]()**\nReporting a strange issue:\n- **LB:** 0.14\n- **CV:** 0.4+\n- **Model:** mask-rcnn\n- **Split:** One fold\n\n_____\n\n##### [Introduction to SAM (Segment Anything Model) by Meta AI](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412943) By [Azmine Toushik Wasi](https://www.kaggle.com/azminetoushikwasi)\n\n[Post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412943) by [Azmine Toushik Wasi](https://www.kaggle.com/azminetoushikwasi)\n\nMeta AI had introduced an incredibly powerful computer vision model lately: SAM (Segment Anything Model). In this post we get some materials about using it effectively to accurately segment any object in an image.\n\n> **How is this possible?** This is a few-shot model, it generalizes to the context you give it.\n\n![Image](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7168168%2Fb8c6d4829d3ed9d1122362cef035a149%2F68747470733a2f2f6d656469612e726f626f666c6f772e636f6d2f6e6f7465626f6f6b732f6578616d706c65732f7365676d656e742d616e797468696e672d6d6f64656c2d626c6f67706f73742e706e67.png?generation=1685069463019129&alt=media)\n\n**Complementary Materials:**\n- [Colab Notebook](https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-segment-anything-with-sam.ipynb)\n- [YouTube Video](https://youtu.be/D-D6ZmadzPE)\n- [Roboflow Blog](https://blog.roboflow.com/how-to-use-segment-anything-model-sam)\n- [Segment Anything Model Blogpost](https://blog.roboflow.com/how-to-use-segment-anything-model-sam)\n- [Kaggle Kernel](https://kaggle.com/kernels/welcome?src=https://github.com/roboflow-ai/notebooks/blob/main/notebooks/zero-shot-object-detection-with-grounding-dino.ipynb)\n- [Google Colab Notebook](https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-segment-anything-with-sam.ipynb)\n\n**Useful Links:** [Yolov7 + SAM Inference](https://www.kaggle.com/code/fnands/yolov7-sam-inference-only), [Pretrained SAM](https://www.kaggle.com/code/dlobatog/capillaries-sam-pretrained), [Mask Contours Analysis](https://youtu.be/fAw13m3Eb28)\n\n> **Note:** I am not sure how much this model could hold up against a well fine-tuned model specifically made for this competition. But I think it is worth a try.\n\n_____\n\n##### [Question about WSI, Dataset and Split](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413038) By [PT0X0E](https://www.kaggle.com/pt0x0e)\n\nAn interesting post about the splitting method of the data in this competition.\nMore specifically, the confusion is around the phrase `Two of the WSIs make up the training set, two WSIs make up the public test set` used in the competition description.\n\nAfter some back and forth, the following chat is concluded and presumed to be the correct one:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F12313384%2Fd0fad19fa693732c2cae00c41453adf4%2F2023-05-29%2020.32.10.png?generation=1685363555970493&alt=media)\n\n_____\n\n##### [yet another puzzle game?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417314) By [Chenglu](https://www.kaggle.com/snaker)\n\nThis post was written before the it was announced that we can use the `tile_meta.csv` file during test time but anyway there is an interesting discussion here.\nIf we were not given this file, the main challenge would have been to run semantic segmentation (maybe not even instance segmentation) of the full image and then somehow stitch the tiles together.\n\nBut [Heng Cher Keng](https://www.kaggle.com/hengck23) suggested an interesting idea: **Zoom and focus:** We can perform semantic segmentation on the larger image and then lower the resolution by creating possible candidate slices.\n\nElegant and simple solution!\n_____\n\n##### [Does it make sense to train your model for identifying glomeruli?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414896) By [Jan H](https://www.kaggle.com/janhuebi)\n\n[Jan H](https://www.kaggle.com/janhuebi) raises an interesting question: Wondering if it is useful to train the model for 3 classes (background, blood vessel and glomerulus) or if it was sufficient to not include glomeruli mask and prediction class in the training of the model.\n\nIn this [post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414896), the author raises a question about the necessity of training the model to identify glomeruli in addition to blood vessels. The author wonders if excluding the glomeruli mask and prediction class from the training data would suffice since the challenge's focus is on identifying blood vessels.\n\n**Answer (from the hosts):**\n\n> The annotations for glomeruli in the test set will be available during submission. You may use these to exclude your blood vessel predictions that lie within the glomeruli structures. You don't need to predict glomeruli.\n\nFollowup question by [HungryLearner](https://www.kaggle.com/alabibojesomo):\n\n> Where can we get these annotations for glomerulus during inference in order to use these in excluding the blood vessel predictions within them.\n\n**Answer (from the hosts):**\n\n> The hidden version of the polygons.jsonl file should contain glomerulus annotations for the test set images. They aren't present in the public version of the dataset, but are added in the hidden version available to your notebook during inference.\n\n_____\n\n##### [Test data annotation](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417012) By [Sasha Mogilevskii](https://www.kaggle.com/aleksandrmogilevskiy)\n\n[Sasha Mogilevskii](https://www.kaggle.com/aleksandrmogilevskiy) is pointing out that dataset 1 and dataset 2 are annotated **differently**.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6197543%2F9b3efffbbe418bfb299d90f66b0d79de%2FScreenshot_4.jpg?generation=1686689058146565&alt=media)\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6197543%2Fb2d5de8f842635d33d280d7405104789%2FScreenshot_2.jpg?generation=1686689091526052&alt=media)\n\n- [Kostiantyn Maksymov](https://www.kaggle.com/maksimovka) pointing out that this might be the reason that dilation [works so well](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901) on this data.\n\n**Answer (from the hosts):**\n\n> Some noise in the labels is to be expected with any such dataset. In this particular dataset, the borders of microvasculature structures are not always clearly distinguishable given the tissue thickness and resolution of the images. For example, when annotating peritubular capillaries, the endothelial cell membrane may be indistinguishable from the tubular epithelial membrane, leading to some overlap of annotation borders with tubular epithelium borders. One other thing to note is that often the borders of the annotations themselves can obscure important visual information used to distinguish the vessels from surrounding structures. It is helpful to have a side by side comparison of both annotated and un-annotated images to distinguish vessels.\n\n\n**Interesting read, recommended**\n\n\n_____\n\n##### [Dataset in JPG format.](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412278) By [Wongi Park](https://www.kaggle.com/kalelpark)\n\n[Wongi Park](https://www.kaggle.com/kalelpark) shares with us the dataset in JPG format. The dataset maintains the original pixel dimensions.\n\nThe [dataset](https://www.kaggle.com/datasets/kalelpark/2023-hubmap-dataset-512x512)\n\n\n_____\n\n##### [how to avoid overfit to WSI 1&amp;2?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417267) By [patriot](https://www.kaggle.com/abebe9849)\n\n[Patriot](https://www.kaggle.com/abebe9849) discusses strategies to avoid overfitting to the two WSIs used for learning and local validation, when the private test WSI is unknown. Since only two WSIs annotated by experts are provided, the challenge is to find data similarity and address any domain shift.\n\n**Some suggested approaches from the comments:**\n\n- Normalize the data: Find a way to normalize the data such that the WSIs (1, 2, 3, 4, 6, 7, etc.) are similar. This can help mitigate the effect of domain shift.\n- Measure similarity: Train a classifier to classify tiles into different classes (1, 2, 3, 4, 6, 7, etc.). Then, assess the similarity of the hidden private test (5) with respect to the known WSIs. This could be done by probing the hidden test data or embedding them into a common feature space using techniques like t-SNE or UMAP. The goal is to identify if the hidden test data falls within a certain distance of the known WSIs.\n- Robust model training: If the domain shift is known, train a model that is robust within this shift. This can be achieved by using techniques like data augmentation or adaptation layers to make the model more resilient to variations in the data.\n- Online learning and zero-shot learning: Maybe using online learning techniques along with a self/unsupervised approach like mask autoencoder. This allows the model to train on the hidden test data in a self/unsupervised manner, aiding in generalization.\n- Leaving one WSI as validation on each fold.\n\nFor more details, see the full post (Also: Interesting read).\n\n_____\n\n\n##### [De-duplicated annotations - dataset](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/418009) By [fnands](https://www.kaggle.com/fnands)\n\n- [fnands](https://www.kaggle.com/fnands) discovered that about **6% of the labels are duplicates** in the annotations dataset.\n\n- And created a  cleaned de-duplicated version of the dataset, available [here](https://www.kaggle.com/datasets/fnands/de-duplicated-annotations-for-hubmap-hhv) (Same format as the original dataset).\n\n_____\n\n\n##### [Some Insights](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419133) By [Yassine Alouini](https://www.kaggle.com/yassinealouini)\n\n\nA very detailed summary of all useful details that are important to know for participating in this competition - Task, Keywords, Concepts, The Data, Train, Test, Metric and additional resources to read more.\n\n**Highly Recommended!**.\n\n\n_____\n\n##### [ 📊Interactive visualization of tile annotations](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412683) By [Leonid Kulyk](https://www.kaggle.com/leonidkulyk)\n\n[Leonid Kulyk](https://www.kaggle.com/leonidkulyk) shares an interactive visualization of the annotated samples for easy exploratory data analysis.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4158783%2F61a90a1661881b1607531bcb443b488f%2Fimage_2023-05-24_22-53-07.png?generation=1684958049039597&alt=media)\n\n[notebook](https://www.kaggle.com/code/leonidkulyk/eda-hubmap-hhv-interactive-annotations)\n\nReally cool! Thank you [Leonid Kulyk](https://www.kaggle.com/leonidkulyk) for sharing this!\n\n_____\n\n##### [An amazing guide for detectron2 Faster R-CNN](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419469) By [Gunes Evitan](https://www.kaggle.com/gunesevitan)\n\nSharing with us two resources for understanding and implementing Detectron2's Faster R-CNN.\n\n- In this [medium series](https://medium.com/@hirotoschwert/digging-into-detectron-2-47b2e794fabd), hirotoschwert provides a guide for understanding and implementing Detectron2's Faster R-CNN.\n- And also shares a useful parameter documentation for Detectron2, which can be found [here](https://detectron2.readthedocs.io/en/latest/modules/config.html#yaml-config-references).\n\n\n_____\n\n\n##### [Duplication of \"coordinates\"?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416380) By [Phat Tran](https://www.kaggle.com/ptran1203)\n\n[Phat Tran](https://www.kaggle.com/ptran1203) shares an interesting observation: Many images has duplicated `coordinates` in the annotations.\n\n> This means that the same polygons are repeated more than once in some images. For example, in the image `adadaeaa3635`, there is a polygon with duplicated coordinates for a \"blood_vessel\" type.\n\nBoth [Chenglu](https://www.kaggle.com/snaker) and [fnands](https://www.kaggle.com/fnands) confirmed that this is the case. And [fnands](https://www.kaggle.com/fnands) also shared a [notebook](https://www.kaggle.com/datasets/fnands/de-duplicated-annotations-for-hubmap-hhv) to explore this issue further.\n\n_____\n\n\n##### [How far can we push SAM? [LB 0.372]](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416452) By [fnands](https://www.kaggle.com/fnands)\n\n\n- In this [post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416452), [fnands](https://www.kaggle.com/fnands) experiments with Meta's [SegmentAnything Model (SAM)](https://github.com/facebookresearch/segment-anything/tree/main) for object segmentation in the context of the competition.\n- The goal is to train a lightweight object detection model (YOLOv7) to find objects, and then use SAM to refine the masks.\n\n> Reminder: SAM is a self-supervised model that can be used to refine masks on unseen images.\n\n- First attempt is [here](https://www.kaggle.com/code/fnands/yolov7-sam-inference-only)\n\n- **Improvement:** Fine-tuning the mask decoder on dataset 1 improves the score from 0.195 to 0.364.\n- **Improvement:** Training on both dataset 1 and 2 lowers the LB score compared to training on dataset 1 only.\n- **Improvement:** Adding dilation improves the score from 0.148 to 0.195. Idea from [here](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901)\n- **Improvement:** Fine-tuning the encoder for the ViT-b size improves the LB score from 0.365 to 0.372. [using torchmetrics](https://torchmetrics.readthedocs.io/en/stable/detection/mean_average_precision.html)\n\n> WOW [fnands](https://www.kaggle.com/fnands)! Thank you for this!\n\n- **Another Attempt:** Training the prompt encoder makes no significant difference in the performance.\n- **Improvement:** Switching from ViT-b to ViT-l size of SAM only increases the LB score by 0.001.\n\n(All credit for this post goes to [fnands](https://www.kaggle.com/fnands))\n\n\n_____\n\n##### [onmipose demo: unet-based instance segmentation](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420764) By [Heng Cher Keng](https://www.kaggle.com/hengck23)\n\n[Heng](https://www.kaggle.com/hengck23) introduces the Unet-based instance segmentation method using the Onmipose framework.\n\nAnd as usual also stared another research journal for this method.\n\n[code part 1](https://www.kaggle.com/code/hengck23/unet-instance-segmentation-onmipose-part1)\n[code part 2](https://www.kaggle.com/code/hengck23/unet-instance-segmentation-onmipose-part2)\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F113660%2F82351c00fc0cd7979ced374ae5190108%2FSelection_999(2454).png?generation=1688300870548277&alt=media)\n\n_____\n\n##### [Inquiry | About mask format for submission](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414002) By [Shin](https://www.kaggle.com/shinyatakaramoto)\n\nThis post asks if we need to submit the filled mask or the contour mask.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5869697%2F0cb832b5148d52bd4a1cf9a1238e3efe%2Fimage.png?generation=1685498820470810&alt=media)\n\n**Answer:** The filled mask.\n\n_____\n\n##### [[Metric] Code to compute segm-mAP  CV scores](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419309) By [The Nam](https://www.kaggle.com/namgalielei)\n\nThis post provides code to compute mAP for this competition.\n\n> **Why?** Most mAP calculators are integrated within specific frameworks and may lack flexibility when ensembling different models. (And some standalone implementations only compute box-mAP, not segm-mAP)\n\n[notebook](https://www.kaggle.com/code/namgalielei/hubmap-cv-score-map-calculator/notebook?scriptVersionId=134782419)\n\n_____\n\n##### [Introduction to SegFormer](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258) By [Ravi Shah](https://www.kaggle.com/ravishah1)\n\n[This post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258) provides an overview of the **SegFormer model**, which was used by the winner of a previous image segmentation competition.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6537187%2F3217f32058c82d8840284c040ae7e5b0%2FSegFormerImg.png?generation=1684803209937286&alt=media)\n\n**TL;DR:**\n\n- The SegFormer model is a Transformer for semantic segmentation.\n- Using an improved transformer encoder and decoder with some novel architecture components.\n- It achieves state-of-the-art results.\n- You can find the full details and references in the [post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258) but take in mind that the model is not allowed in the current competition.\n\n> **Important note: SegFormer is not allowed in the current competition. [source](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413834#2281425)**\n\n_____\n\n##### [ViT Segmentation Overview for HuBMAP - Hacking the Kidney](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412802) By [Kassem](https://www.kaggle.com/elcaiseri)\n\n[Kassem](https://www.kaggle.com/elcaiseri) shares a brief overview of using Vision Transformer (ViT).\n\n- Training Code from the previous comp: [hubmap-pytorch-vit-segmentation-train](https://www.kaggle.com/code/elcaiseri/hubmap-pytorch-vit-segmentation-starter-train)\n- Inference Code from the previous comp: [hubmap-pytorch-vit-segmentation-inference](https://www.kaggle.com/code/elcaiseri/hubmap-pytorch-vit-segmentation-sub1)\n\n_____\n\n##### [Data: Legal Issue](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413000) By [JanGlinko2](https://www.kaggle.com/janglinko2)\n\n**Question:** Is using annotated data from Dataset3 & external human resources (doctors) is allowed?\n\n- **Response:** The response clarifies that human annotation of data is not allowed.\n\n_____\n\n##### [[LB 0.246] detectron2 inference](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414525) By [whd](https://www.kaggle.com/plugin1689)\n\n- [whd](https://www.kaggle.com/plugin1689) shared a notebook [here](https://www.kaggle.com/code/plugin1689/inference-detectron2) that serves as a baseline for inference using the `x101fpn` (`detectron2`).\n\n_____\n\n##### [MIT (segformer) models usage](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413834) By [Kostiantyn Maksymov](https://www.kaggle.com/maksimovka)\n\n- Since there has been a change in the license for SegFormer models (restricting commercial use) the use of SegFormer models is no longer allowed.\n\n_____\n\n##### [how to use mmdet==3.x with python=3.10 in kaggle notebooks?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414513) By [patriot](https://www.kaggle.com/abebe9849)\n\nFor everyone that face issues installing mmcv without internet access: Look [here](https://www.kaggle.com/code/zzy990106/mmdet3-wheels)\n\n_____\n\n##### [What versions of Yolo we can use in competitions?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419825) By [Pablo Larrosa](https://www.kaggle.com/pablolarrosa)\n\nQuestion: What versions of YOLO are we allowed to use in this competition?\n\n- The licence for yolox is apache 2.0, so there seem to be no restrictions on its use for this competition.\n- But the question about `yolov5`, `yolov7` and `yolov8` are still open.\n- The licence for these appears to be AGPL or GPL 3.0. Commercial use does not seem to be completely restricted, but there seem to be some conditions (perhaps, disclosure of source code and modification).\n\n> No answers from the hosts yet.\n\n_____\n\n##### [What are we missing out on?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421579) By [Bhavesh Jain](https://www.kaggle.com/bhavesjain)\n\nIn this post by [Bhavesh Jain](https://www.kaggle.com/bhavesjain), the author raises the question of what could be missing in the current approaches and models for the competition.\n\nAlthough there is less discussion compared to previous competitions There are serveral potential areas for improvement listed in this discussion thread:\n\n- **Dilation:** The use of dilation on the predicted mask to improve performance on the test data.\n- **Segmentation models:** Considering the use of blending and different segmentation models such as YOLOv7, YOLOv8, and MaskR-CNN.\n- **Training data division:** Exploring different strategies for dividing the training dataset.\n- **Changing inference size:** Modifying the size of the inference to potentially improve results.\n- **Also Note:** Preprocessing the predicited mask using mask dilation increase the LB by about 0.1\n_____\n\n\n##### [How to install Pycoco library.](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416432) By [Krish Sharma](https://www.kaggle.com/krish0202)\n\nFor anyone struggling with installing pycoco, here is a solution:\n\nInclude [this](https://www.kaggle.com/datasets/ermak9/pycocotools) dataset and run the following code:\n\n```\n!cp -r /kaggle/input/pycocotools/ /kaggle/working/pycocotools\n!pip install /kaggle/working/pycocotools/pycocotools-2.0.6  --no-index --find-links=/kaggle/working/pycocotools/\n```\n\n> Solution by [fnand](https://www.kaggle.com/fnands)\n\n_____\n\n\n##### [Best way to ensemble models from different folds?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421546) By [xsong2020](https://www.kaggle.com/xstargate)\n\nEnsembling models in this competition is not trivial but there are several approaches to consider:\n\n- [Weighted boxes fusion](https://www.kaggle.com/code/mistag/sartorius-tta-with-weighted-segments-fusion) (WBF)\n- [Soft NMS](https://arxiv.org/abs/1704.04503) (non-maximum suppression)\n\n_____\n\n##### [My predicition output is just one 512*512 mask in float32, submission help needed!](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413151) By [Eren Jaeger](https://www.kaggle.com/wqx20000115)\n\n\nIn this post, there is a question about formatting for this competition: How to separate the prediction strings for multiple instance masks of the same image with a space on request.\n\n**Code by ([HungryLearner](https://www.kaggle.com/alabibojesomo))**\n\n```\nfrom skimage import morphology\nfrom skimage.measure import label, regionprops, regionprops_table\n\ndef get_vessels(mask):\n    mask = image.astype(bool)\n    label_img = label(mask)\n    regions = regionprops(label_img)\n    label_items = []\n    for region in regions:\n        minr, minc, maxr, maxc = region.bbox\n        zero = np.zeros(mask.shape)\n        zero[minr:maxr, minc:maxc] = 1\n        label_item = (mask*zero).astype(bool)\n        label_items.append(label_item)\n    return  label_items\n\nwidths = []\nheights = []\nids = preds['s_id']\nprediction_strings = []\nfor k in range(len(ids)):\n    mask = preds['preds'][k].cpu().numpy().astype('bool')\n    h, w = mask.shape\n    seg_instances = get_vessels(mask) #preds['preds'][k].cpu().numpy())\n    # after seg infer\n    pred_string = \"\"\n    for i, binmask in enumerate(seg_instances):\n        encoded = encode_binary_mask(binmask)\n        if i == 0: pred_string += f\"0 1.0 {encoded.decode('utf-8')}\"\n        else: pred_string += f\" 0 1.0 {encoded.decode('utf-8')}\"\n    heights.append(h)\n    widths.append(w)\n    prediction_strings.append(pred_string)\n\nsubmission = pd.DataFrame()\nsubmission['id'] = ids\nsubmission['height'] = heights\nsubmission['width'] = widths\nsubmission['prediction_string'] = prediction_strings\nsubmission['prediction_string'] = prediction_strings\nsubmission = submission.set_index('id')\nsubmission.to_csv(\"submission.csv\")\n\nprint(submission)\n```\n\n_____\n\n##### [LB :  0.377(single model) and 0.382(ensemble) with YoLoV7](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420063) By [HongCheng](https://www.kaggle.com/chg0901)\n\n- In this [post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420063), [HongCheng](https://www.kaggle.com/chg0901) shares their current settings for training a single model and an ensemble using YoLoV7.\n- **The Trick:** The model training is done without the \"unsure\" label area.\n_____\n\n\n##### [Please help! The Usage of TTA in Instance Segmentation](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420120) By [bent1e](https://www.kaggle.com/bent1e)\n\n- [bent1e](https://www.kaggle.com/bent1e) is seeking assistance with using Test-Time Augmentation (TTA) in instance segmentation to evaluate their model's performance.\n- The current approach involves inverting the mask obtained after flipping and rotating onto the original image, but it is yielding inconsistent results in terms of the number of instance segmentation objects detected.\n- Suggestions for TTA in instance segmentation:\n  - Limit the transforms to geometric ones, such as rotation (multiples of 90 degrees), zoom, and affine transformations.\n  - Perform the inverse transformation accordingly.\n\n_____\n\n##### [Help with Notebook Threw Exception](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416613) By [Roberto](https://www.kaggle.com/robertsun2)\n\n- The author is having an issue with their notebook. When they submit it, they get a \"Notebook Threw Exception\" error, even though the notebook has completed successfully.\n- **Debugging Suggestion:** Some suggest simplifying the notebook to only include the inference part and remove any debugging or visualization code.\n- **Proposal:** Others suggest freeing up GPU memory by deleting tensors in the GPU. One comment mentions that the hidden test set contains multiple images, causing the GPU memory issue.\n\n_____\n\n##### [Advice to newbie about learning parameters](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421788) By [Jura Moshkov](https://www.kaggle.com/jurassimo)\n\nIn this [post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421788), the author seeks advice on finding the best learning parameters for a model.\n\n- Good [link](https://github.com/google-research/tuning_playbook)\n- Users mention that different models may require different parameters, and experimentation is key to finding the best ones.\n- Manual parameter tuning is often done by hand, looking at the results of each experiment one by one.\n- Optuna and grid search may not be practical due to computational resource limitations.\n- Intuition-based parameter tuning is considered a good approach for most deep learning tasks.\n\n_____",
      "votes": null
    },
    {
      "id": "2339608",
      "postDate": "07/11/2023 00:15:24",
      "content": "<p>Thank you for putting this together so carefully. It's an incredible job !!!</p>",
      "rawMarkdown": "Thank you for putting this together so carefully. It's an incredible job !!!",
      "votes": null
    },
    {
      "id": "2340814",
      "postDate": "07/11/2023 17:28:55",
      "content": "<p>Well-curated content. great efforts. Thank you</p>",
      "rawMarkdown": "Well-curated content. great efforts. Thank you",
      "votes": null
    },
    {
      "id": "2342048",
      "postDate": "07/12/2023 13:14:05",
      "content": "<p>Nice summary dude… </p>",
      "rawMarkdown": "Nice summary dude...",
      "votes": null
    },
    {
      "id": "2352167",
      "postDate": "07/20/2023 17:15:19",
      "content": "<p>ModuleNotFoundError: No module named 'yolov7'.<br>\nHow to resolve it</p>",
      "rawMarkdown": "ModuleNotFoundError: No module named 'yolov7'.\nHow to resolve it",
      "votes": null
    },
    {
      "id": "2355171",
      "postDate": "07/23/2023 06:19:27",
      "content": "<p>Amazing work!</p>",
      "rawMarkdown": "Amazing work!",
      "votes": null
    },
    {
      "id": "2356394",
      "postDate": "07/24/2023 06:52:46",
      "content": "<p>Amazing work!</p>",
      "rawMarkdown": "Amazing work!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2339608,
      "author_name": "mitsuyasuhoshino",
      "author_url": "",
      "post_date": "07/11/2023 00:15:24",
      "content": "<p>Thank you for putting this together so carefully. It's an incredible job !!!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2340814,
      "author_name": "harishkumardatalab",
      "author_url": "",
      "post_date": "07/11/2023 17:28:55",
      "content": "<p>Well-curated content. great efforts. Thank you</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2342048,
      "author_name": "raufie",
      "author_url": "",
      "post_date": "07/12/2023 13:14:05",
      "content": "<p>Nice summary dude… </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2352167,
      "author_name": "prashantshukla91",
      "author_url": "",
      "post_date": "07/20/2023 17:15:19",
      "content": "<p>ModuleNotFoundError: No module named 'yolov7'.<br>\nHow to resolve it</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2355171,
      "author_name": "adamham",
      "author_url": "",
      "post_date": "07/23/2023 06:19:27",
      "content": "<p>Amazing work!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2356394,
      "author_name": "dduni1",
      "author_url": "",
      "post_date": "07/24/2023 06:52:46",
      "content": "<p>Amazing work!</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2338410": "### 3 Weeks left! Here is everything that happened up to this point\n\nWe are approaching the final stage of the competition.\nA good point to take a look back and summarize everything we know up to this point.\n\nI went through all the discussion threads (**I went.** not ChatGPT went. I actually read everything) and summarized the most interesting bits I found into this post.\n\nEnjoy!\n\n_____\n\n##### [[LB 0.458] my experiment results](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419143) By [Heng Cher Keng](https://www.kaggle.com/hengck23)\n\n**Highly recommended read.**\n\n- Heng stared a thread with an ongoing research journal, I suggest reading it all because it is gold.\n\n> Not going to post all of it here as it is too long.\n\n_____\n\n##### [🏆 HuBMAP last year winner solution 🏆](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412307) By [Dewei Chen](https://www.kaggle.com/dwchen)\n\n[**Last year Competition**](https://www.kaggle.com/competitions/hubmap-organ-segmentation)\n\n- [1st place](https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/356201)\n- [2nd place](https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354857)\n- [3rd place solution](https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354683)\n- [4th place solution](https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354851)\n- [7th place solution](https://www.kaggle.com/competitions/hubmap-organ-segmentation/discussion/354859)\n\n[**HuBMAN Two years ago**](https://www.kaggle.com/competitions/hubmap-kidney-segmentation)\n- [1st place](https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238198)\n- [3rd place](https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238013)\n- [4th place](https://www.kaggle.com/competitions/hubmap-kidney-segmentation/discussion/238024)\n\n\n\n_____\n\n##### [Dilation increases the score, who understands why?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901) By [Kostiantyn Maksymov](https://www.kaggle.com/maksimovka)\n\n[Kostiantyn Maksymov](https://www.kaggle.com/maksimovka) discusses an interesting finding regarding the use of dilation in postprocessing to improve the score on the leaderboard.\n\n- A significant improvement in the score after dialation (0.239 to 0.345).\n- Some people in the comments suggest that dilation helps include the edges of the blood vessel in the binary mask, which might not be captured by the model's original thresholding condition.\n- There is a discussion about the different iterations of dilation and input sizes are discussed in the comments, and participants share their experiences and insights.\n- The overall consensus is that dilation seems to be beneficial for the model's performance in this particular competition.\n\n_____\n\n\n##### [SOTA and Popular Segment method: OneFormer and UNet](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412316) By [Dewei Chen](https://www.kaggle.com/dwchen)\n\nThe field is moving fast lately, so this is a great opportunity to catch up with the latest SOTA segmentation models.\nHere they are:\n\n**OneFormer: One Transformer to Rule Universal Image Segmentation**\n- OneFormer is a method based on transformer, and achieve the SOTA in 2023 CVPR\n- [paper](https://arxiv.org/pdf/2211.06220v2.pdf) [Implementation](https://github.com/SHI-Labs/OneFormer)\n\n**U-Net: Convolutional Networks for Biomedical Image Segmentation**\n- U-Net is the most popular segmentation method in bio relation topic.\n[paper](https://arxiv.org/pdf/1505.04597v1.pdf) [Implementation](https://github.com/milesial/Pytorch-UNet or https://github.com/open-mmlab/mmsegmentation)\n\n_____\n\n##### [StainTools for Augmentation](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412396) By [Ravi Shah](https://www.kaggle.com/ravishah1)\n\n[Ravi Shah](https://www.kaggle.com/ravishah1) shares with us a useful library for tissue image stain normalization and augmentation.\n\n**You can use it like this:**\n\n```\n!pip install staintools\n!pip install spams\n\nimport spams\nimport staintools\nimport numpy as np\nimport matplotlib.pyplot as plt\ntarget = staintools.read_image(\"./data/my_target_image.png\")\nto_transform = staintools.read_image(\"./data/my_image_to_transform.png\")\nStandardize brightness (optional, can improve the tissue mask calculation)\n\ntarget = staintools.LuminosityStandardizer.standardize(target)\nto_transform = staintools.LuminosityStandardizer.standardize(to_transform)\n\nnormalizer = staintools.StainNormalizer(method='vahadane')\nnormalizer.fit(target)\ntransformed1 = normalizer.transform(to_transform)\nplt.imshow(transformed1)\n```\n\n\n_____\n\n##### [Can you annotate this image accurately?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417374) By [ITK8191](https://www.kaggle.com/itsuki9180)\n\n[ITK8191](https://www.kaggle.com/itsuki9180) shares with us harder ground truth samples from the dataset.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F2294613%2F4519f684fb29efbc97bc075e1bef8ca2%2F9.png?generation=1686830802312243&alt=media)\n\nAs you can see, it is hard to tell what the white area should be.\nThe post later on continue and discuss the importance of using the context of the image to improve the results.\n\n[notebook](https://www.kaggle.com/code/itsuki9180/investigate-tiles-on-wsi-1-and-2)\n\nThere are some interesting comments in the discussion about this but I think that the most important one is the comment by [Chenglu](https://www.kaggle.com/snaker) that says:\n\nThat we can use tile_meta.csv in test set. [source](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414669#2303907)\n\n_____\n\n##### [segmentation_models_pytorch for instance segmentation](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419848) By [Heng Cher Keng](https://www.kaggle.com/hengck23)\n\nSharing with us a `segmentation_models_pytorch` option for instance segmentation.\n\n[link](https://github.com/Lee-Gihun/MEDIAR)\n\n[Read more](https://openreview.net/submissions?venue=NeurIPS.cc/2022/Challenge/CellSeg)\n\n_____\n\n##### [▲CV vs LB scores ▼](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/415508) By [Ayushman Buragohain](https://www.kaggle.com/benihime91)\n\nCV vs LB Scores Discussion:\n\n**[Ayushman Buragohain](https://www.kaggle.com/benihime91)**\n - **CV:** 0.494\n - **LB:** 0.303\n - **Model:** resnet50_mask_rcnn\n - [notebook](https://www.kaggle.com/code/benihime91/hubmap-2023-create-coco-annotations)\n\n**[patriot](https://www.kaggle.com/abebe9849)**\n- **LB:** 0.412\n- **Val_coco-iou@0.5:0.95** 0.39\n- **Data:** Only from dataset1,only use \"blood_vessel\" (dismiss \"unsure\" label)\n- **Split:** Random 8:2\n\n**[DYS]()**\nReporting a strange issue:\n- **LB:** 0.14\n- **CV:** 0.4+\n- **Model:** mask-rcnn\n- **Split:** One fold\n\n_____\n\n##### [Introduction to SAM (Segment Anything Model) by Meta AI](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412943) By [Azmine Toushik Wasi](https://www.kaggle.com/azminetoushikwasi)\n\n[Post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412943) by [Azmine Toushik Wasi](https://www.kaggle.com/azminetoushikwasi)\n\nMeta AI had introduced an incredibly powerful computer vision model lately: SAM (Segment Anything Model). In this post we get some materials about using it effectively to accurately segment any object in an image.\n\n> **How is this possible?** This is a few-shot model, it generalizes to the context you give it.\n\n![Image](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7168168%2Fb8c6d4829d3ed9d1122362cef035a149%2F68747470733a2f2f6d656469612e726f626f666c6f772e636f6d2f6e6f7465626f6f6b732f6578616d706c65732f7365676d656e742d616e797468696e672d6d6f64656c2d626c6f67706f73742e706e67.png?generation=1685069463019129&alt=media)\n\n**Complementary Materials:**\n- [Colab Notebook](https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-segment-anything-with-sam.ipynb)\n- [YouTube Video](https://youtu.be/D-D6ZmadzPE)\n- [Roboflow Blog](https://blog.roboflow.com/how-to-use-segment-anything-model-sam)\n- [Segment Anything Model Blogpost](https://blog.roboflow.com/how-to-use-segment-anything-model-sam)\n- [Kaggle Kernel](https://kaggle.com/kernels/welcome?src=https://github.com/roboflow-ai/notebooks/blob/main/notebooks/zero-shot-object-detection-with-grounding-dino.ipynb)\n- [Google Colab Notebook](https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-segment-anything-with-sam.ipynb)\n\n**Useful Links:** [Yolov7 + SAM Inference](https://www.kaggle.com/code/fnands/yolov7-sam-inference-only), [Pretrained SAM](https://www.kaggle.com/code/dlobatog/capillaries-sam-pretrained), [Mask Contours Analysis](https://youtu.be/fAw13m3Eb28)\n\n> **Note:** I am not sure how much this model could hold up against a well fine-tuned model specifically made for this competition. But I think it is worth a try.\n\n_____\n\n##### [Question about WSI, Dataset and Split](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413038) By [PT0X0E](https://www.kaggle.com/pt0x0e)\n\nAn interesting post about the splitting method of the data in this competition.\nMore specifically, the confusion is around the phrase `Two of the WSIs make up the training set, two WSIs make up the public test set` used in the competition description.\n\nAfter some back and forth, the following chat is concluded and presumed to be the correct one:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F12313384%2Fd0fad19fa693732c2cae00c41453adf4%2F2023-05-29%2020.32.10.png?generation=1685363555970493&alt=media)\n\n_____\n\n##### [yet another puzzle game?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417314) By [Chenglu](https://www.kaggle.com/snaker)\n\nThis post was written before the it was announced that we can use the `tile_meta.csv` file during test time but anyway there is an interesting discussion here.\nIf we were not given this file, the main challenge would have been to run semantic segmentation (maybe not even instance segmentation) of the full image and then somehow stitch the tiles together.\n\nBut [Heng Cher Keng](https://www.kaggle.com/hengck23) suggested an interesting idea: **Zoom and focus:** We can perform semantic segmentation on the larger image and then lower the resolution by creating possible candidate slices.\n\nElegant and simple solution!\n_____\n\n##### [Does it make sense to train your model for identifying glomeruli?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414896) By [Jan H](https://www.kaggle.com/janhuebi)\n\n[Jan H](https://www.kaggle.com/janhuebi) raises an interesting question: Wondering if it is useful to train the model for 3 classes (background, blood vessel and glomerulus) or if it was sufficient to not include glomeruli mask and prediction class in the training of the model.\n\nIn this [post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414896), the author raises a question about the necessity of training the model to identify glomeruli in addition to blood vessels. The author wonders if excluding the glomeruli mask and prediction class from the training data would suffice since the challenge's focus is on identifying blood vessels.\n\n**Answer (from the hosts):**\n\n> The annotations for glomeruli in the test set will be available during submission. You may use these to exclude your blood vessel predictions that lie within the glomeruli structures. You don't need to predict glomeruli.\n\nFollowup question by [HungryLearner](https://www.kaggle.com/alabibojesomo):\n\n> Where can we get these annotations for glomerulus during inference in order to use these in excluding the blood vessel predictions within them.\n\n**Answer (from the hosts):**\n\n> The hidden version of the polygons.jsonl file should contain glomerulus annotations for the test set images. They aren't present in the public version of the dataset, but are added in the hidden version available to your notebook during inference.\n\n_____\n\n##### [Test data annotation](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417012) By [Sasha Mogilevskii](https://www.kaggle.com/aleksandrmogilevskiy)\n\n[Sasha Mogilevskii](https://www.kaggle.com/aleksandrmogilevskiy) is pointing out that dataset 1 and dataset 2 are annotated **differently**.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6197543%2F9b3efffbbe418bfb299d90f66b0d79de%2FScreenshot_4.jpg?generation=1686689058146565&alt=media)\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6197543%2Fb2d5de8f842635d33d280d7405104789%2FScreenshot_2.jpg?generation=1686689091526052&alt=media)\n\n- [Kostiantyn Maksymov](https://www.kaggle.com/maksimovka) pointing out that this might be the reason that dilation [works so well](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901) on this data.\n\n**Answer (from the hosts):**\n\n> Some noise in the labels is to be expected with any such dataset. In this particular dataset, the borders of microvasculature structures are not always clearly distinguishable given the tissue thickness and resolution of the images. For example, when annotating peritubular capillaries, the endothelial cell membrane may be indistinguishable from the tubular epithelial membrane, leading to some overlap of annotation borders with tubular epithelium borders. One other thing to note is that often the borders of the annotations themselves can obscure important visual information used to distinguish the vessels from surrounding structures. It is helpful to have a side by side comparison of both annotated and un-annotated images to distinguish vessels.\n\n\n**Interesting read, recommended**\n\n\n_____\n\n##### [Dataset in JPG format.](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412278) By [Wongi Park](https://www.kaggle.com/kalelpark)\n\n[Wongi Park](https://www.kaggle.com/kalelpark) shares with us the dataset in JPG format. The dataset maintains the original pixel dimensions.\n\nThe [dataset](https://www.kaggle.com/datasets/kalelpark/2023-hubmap-dataset-512x512)\n\n\n_____\n\n##### [how to avoid overfit to WSI 1&amp;2?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/417267) By [patriot](https://www.kaggle.com/abebe9849)\n\n[Patriot](https://www.kaggle.com/abebe9849) discusses strategies to avoid overfitting to the two WSIs used for learning and local validation, when the private test WSI is unknown. Since only two WSIs annotated by experts are provided, the challenge is to find data similarity and address any domain shift.\n\n**Some suggested approaches from the comments:**\n\n- Normalize the data: Find a way to normalize the data such that the WSIs (1, 2, 3, 4, 6, 7, etc.) are similar. This can help mitigate the effect of domain shift.\n- Measure similarity: Train a classifier to classify tiles into different classes (1, 2, 3, 4, 6, 7, etc.). Then, assess the similarity of the hidden private test (5) with respect to the known WSIs. This could be done by probing the hidden test data or embedding them into a common feature space using techniques like t-SNE or UMAP. The goal is to identify if the hidden test data falls within a certain distance of the known WSIs.\n- Robust model training: If the domain shift is known, train a model that is robust within this shift. This can be achieved by using techniques like data augmentation or adaptation layers to make the model more resilient to variations in the data.\n- Online learning and zero-shot learning: Maybe using online learning techniques along with a self/unsupervised approach like mask autoencoder. This allows the model to train on the hidden test data in a self/unsupervised manner, aiding in generalization.\n- Leaving one WSI as validation on each fold.\n\nFor more details, see the full post (Also: Interesting read).\n\n_____\n\n\n##### [De-duplicated annotations - dataset](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/418009) By [fnands](https://www.kaggle.com/fnands)\n\n- [fnands](https://www.kaggle.com/fnands) discovered that about **6% of the labels are duplicates** in the annotations dataset.\n\n- And created a  cleaned de-duplicated version of the dataset, available [here](https://www.kaggle.com/datasets/fnands/de-duplicated-annotations-for-hubmap-hhv) (Same format as the original dataset).\n\n_____\n\n\n##### [Some Insights](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419133) By [Yassine Alouini](https://www.kaggle.com/yassinealouini)\n\n\nA very detailed summary of all useful details that are important to know for participating in this competition - Task, Keywords, Concepts, The Data, Train, Test, Metric and additional resources to read more.\n\n**Highly Recommended!**.\n\n\n_____\n\n##### [ 📊Interactive visualization of tile annotations](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412683) By [Leonid Kulyk](https://www.kaggle.com/leonidkulyk)\n\n[Leonid Kulyk](https://www.kaggle.com/leonidkulyk) shares an interactive visualization of the annotated samples for easy exploratory data analysis.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4158783%2F61a90a1661881b1607531bcb443b488f%2Fimage_2023-05-24_22-53-07.png?generation=1684958049039597&alt=media)\n\n[notebook](https://www.kaggle.com/code/leonidkulyk/eda-hubmap-hhv-interactive-annotations)\n\nReally cool! Thank you [Leonid Kulyk](https://www.kaggle.com/leonidkulyk) for sharing this!\n\n_____\n\n##### [An amazing guide for detectron2 Faster R-CNN](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419469) By [Gunes Evitan](https://www.kaggle.com/gunesevitan)\n\nSharing with us two resources for understanding and implementing Detectron2's Faster R-CNN.\n\n- In this [medium series](https://medium.com/@hirotoschwert/digging-into-detectron-2-47b2e794fabd), hirotoschwert provides a guide for understanding and implementing Detectron2's Faster R-CNN.\n- And also shares a useful parameter documentation for Detectron2, which can be found [here](https://detectron2.readthedocs.io/en/latest/modules/config.html#yaml-config-references).\n\n\n_____\n\n\n##### [Duplication of \"coordinates\"?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416380) By [Phat Tran](https://www.kaggle.com/ptran1203)\n\n[Phat Tran](https://www.kaggle.com/ptran1203) shares an interesting observation: Many images has duplicated `coordinates` in the annotations.\n\n> This means that the same polygons are repeated more than once in some images. For example, in the image `adadaeaa3635`, there is a polygon with duplicated coordinates for a \"blood_vessel\" type.\n\nBoth [Chenglu](https://www.kaggle.com/snaker) and [fnands](https://www.kaggle.com/fnands) confirmed that this is the case. And [fnands](https://www.kaggle.com/fnands) also shared a [notebook](https://www.kaggle.com/datasets/fnands/de-duplicated-annotations-for-hubmap-hhv) to explore this issue further.\n\n_____\n\n\n##### [How far can we push SAM? [LB 0.372]](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416452) By [fnands](https://www.kaggle.com/fnands)\n\n\n- In this [post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416452), [fnands](https://www.kaggle.com/fnands) experiments with Meta's [SegmentAnything Model (SAM)](https://github.com/facebookresearch/segment-anything/tree/main) for object segmentation in the context of the competition.\n- The goal is to train a lightweight object detection model (YOLOv7) to find objects, and then use SAM to refine the masks.\n\n> Reminder: SAM is a self-supervised model that can be used to refine masks on unseen images.\n\n- First attempt is [here](https://www.kaggle.com/code/fnands/yolov7-sam-inference-only)\n\n- **Improvement:** Fine-tuning the mask decoder on dataset 1 improves the score from 0.195 to 0.364.\n- **Improvement:** Training on both dataset 1 and 2 lowers the LB score compared to training on dataset 1 only.\n- **Improvement:** Adding dilation improves the score from 0.148 to 0.195. Idea from [here](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416901)\n- **Improvement:** Fine-tuning the encoder for the ViT-b size improves the LB score from 0.365 to 0.372. [using torchmetrics](https://torchmetrics.readthedocs.io/en/stable/detection/mean_average_precision.html)\n\n> WOW [fnands](https://www.kaggle.com/fnands)! Thank you for this!\n\n- **Another Attempt:** Training the prompt encoder makes no significant difference in the performance.\n- **Improvement:** Switching from ViT-b to ViT-l size of SAM only increases the LB score by 0.001.\n\n(All credit for this post goes to [fnands](https://www.kaggle.com/fnands))\n\n\n_____\n\n##### [onmipose demo: unet-based instance segmentation](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420764) By [Heng Cher Keng](https://www.kaggle.com/hengck23)\n\n[Heng](https://www.kaggle.com/hengck23) introduces the Unet-based instance segmentation method using the Onmipose framework.\n\nAnd as usual also stared another research journal for this method.\n\n[code part 1](https://www.kaggle.com/code/hengck23/unet-instance-segmentation-onmipose-part1)\n[code part 2](https://www.kaggle.com/code/hengck23/unet-instance-segmentation-onmipose-part2)\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F113660%2F82351c00fc0cd7979ced374ae5190108%2FSelection_999(2454).png?generation=1688300870548277&alt=media)\n\n_____\n\n##### [Inquiry | About mask format for submission](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414002) By [Shin](https://www.kaggle.com/shinyatakaramoto)\n\nThis post asks if we need to submit the filled mask or the contour mask.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F5869697%2F0cb832b5148d52bd4a1cf9a1238e3efe%2Fimage.png?generation=1685498820470810&alt=media)\n\n**Answer:** The filled mask.\n\n_____\n\n##### [[Metric] Code to compute segm-mAP  CV scores](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419309) By [The Nam](https://www.kaggle.com/namgalielei)\n\nThis post provides code to compute mAP for this competition.\n\n> **Why?** Most mAP calculators are integrated within specific frameworks and may lack flexibility when ensembling different models. (And some standalone implementations only compute box-mAP, not segm-mAP)\n\n[notebook](https://www.kaggle.com/code/namgalielei/hubmap-cv-score-map-calculator/notebook?scriptVersionId=134782419)\n\n_____\n\n##### [Introduction to SegFormer](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258) By [Ravi Shah](https://www.kaggle.com/ravishah1)\n\n[This post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258) provides an overview of the **SegFormer model**, which was used by the winner of a previous image segmentation competition.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F6537187%2F3217f32058c82d8840284c040ae7e5b0%2FSegFormerImg.png?generation=1684803209937286&alt=media)\n\n**TL;DR:**\n\n- The SegFormer model is a Transformer for semantic segmentation.\n- Using an improved transformer encoder and decoder with some novel architecture components.\n- It achieves state-of-the-art results.\n- You can find the full details and references in the [post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412258) but take in mind that the model is not allowed in the current competition.\n\n> **Important note: SegFormer is not allowed in the current competition. [source](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413834#2281425)**\n\n_____\n\n##### [ViT Segmentation Overview for HuBMAP - Hacking the Kidney](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/412802) By [Kassem](https://www.kaggle.com/elcaiseri)\n\n[Kassem](https://www.kaggle.com/elcaiseri) shares a brief overview of using Vision Transformer (ViT).\n\n- Training Code from the previous comp: [hubmap-pytorch-vit-segmentation-train](https://www.kaggle.com/code/elcaiseri/hubmap-pytorch-vit-segmentation-starter-train)\n- Inference Code from the previous comp: [hubmap-pytorch-vit-segmentation-inference](https://www.kaggle.com/code/elcaiseri/hubmap-pytorch-vit-segmentation-sub1)\n\n_____\n\n##### [Data: Legal Issue](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413000) By [JanGlinko2](https://www.kaggle.com/janglinko2)\n\n**Question:** Is using annotated data from Dataset3 & external human resources (doctors) is allowed?\n\n- **Response:** The response clarifies that human annotation of data is not allowed.\n\n_____\n\n##### [[LB 0.246] detectron2 inference](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414525) By [whd](https://www.kaggle.com/plugin1689)\n\n- [whd](https://www.kaggle.com/plugin1689) shared a notebook [here](https://www.kaggle.com/code/plugin1689/inference-detectron2) that serves as a baseline for inference using the `x101fpn` (`detectron2`).\n\n_____\n\n##### [MIT (segformer) models usage](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413834) By [Kostiantyn Maksymov](https://www.kaggle.com/maksimovka)\n\n- Since there has been a change in the license for SegFormer models (restricting commercial use) the use of SegFormer models is no longer allowed.\n\n_____\n\n##### [how to use mmdet==3.x with python=3.10 in kaggle notebooks?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/414513) By [patriot](https://www.kaggle.com/abebe9849)\n\nFor everyone that face issues installing mmcv without internet access: Look [here](https://www.kaggle.com/code/zzy990106/mmdet3-wheels)\n\n_____\n\n##### [What versions of Yolo we can use in competitions?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/419825) By [Pablo Larrosa](https://www.kaggle.com/pablolarrosa)\n\nQuestion: What versions of YOLO are we allowed to use in this competition?\n\n- The licence for yolox is apache 2.0, so there seem to be no restrictions on its use for this competition.\n- But the question about `yolov5`, `yolov7` and `yolov8` are still open.\n- The licence for these appears to be AGPL or GPL 3.0. Commercial use does not seem to be completely restricted, but there seem to be some conditions (perhaps, disclosure of source code and modification).\n\n> No answers from the hosts yet.\n\n_____\n\n##### [What are we missing out on?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421579) By [Bhavesh Jain](https://www.kaggle.com/bhavesjain)\n\nIn this post by [Bhavesh Jain](https://www.kaggle.com/bhavesjain), the author raises the question of what could be missing in the current approaches and models for the competition.\n\nAlthough there is less discussion compared to previous competitions There are serveral potential areas for improvement listed in this discussion thread:\n\n- **Dilation:** The use of dilation on the predicted mask to improve performance on the test data.\n- **Segmentation models:** Considering the use of blending and different segmentation models such as YOLOv7, YOLOv8, and MaskR-CNN.\n- **Training data division:** Exploring different strategies for dividing the training dataset.\n- **Changing inference size:** Modifying the size of the inference to potentially improve results.\n- **Also Note:** Preprocessing the predicited mask using mask dilation increase the LB by about 0.1\n_____\n\n\n##### [How to install Pycoco library.](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416432) By [Krish Sharma](https://www.kaggle.com/krish0202)\n\nFor anyone struggling with installing pycoco, here is a solution:\n\nInclude [this](https://www.kaggle.com/datasets/ermak9/pycocotools) dataset and run the following code:\n\n```\n!cp -r /kaggle/input/pycocotools/ /kaggle/working/pycocotools\n!pip install /kaggle/working/pycocotools/pycocotools-2.0.6  --no-index --find-links=/kaggle/working/pycocotools/\n```\n\n> Solution by [fnand](https://www.kaggle.com/fnands)\n\n_____\n\n\n##### [Best way to ensemble models from different folds?](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421546) By [xsong2020](https://www.kaggle.com/xstargate)\n\nEnsembling models in this competition is not trivial but there are several approaches to consider:\n\n- [Weighted boxes fusion](https://www.kaggle.com/code/mistag/sartorius-tta-with-weighted-segments-fusion) (WBF)\n- [Soft NMS](https://arxiv.org/abs/1704.04503) (non-maximum suppression)\n\n_____\n\n##### [My predicition output is just one 512*512 mask in float32, submission help needed!](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/413151) By [Eren Jaeger](https://www.kaggle.com/wqx20000115)\n\n\nIn this post, there is a question about formatting for this competition: How to separate the prediction strings for multiple instance masks of the same image with a space on request.\n\n**Code by ([HungryLearner](https://www.kaggle.com/alabibojesomo))**\n\n```\nfrom skimage import morphology\nfrom skimage.measure import label, regionprops, regionprops_table\n\ndef get_vessels(mask):\n    mask = image.astype(bool)\n    label_img = label(mask)\n    regions = regionprops(label_img)\n    label_items = []\n    for region in regions:\n        minr, minc, maxr, maxc = region.bbox\n        zero = np.zeros(mask.shape)\n        zero[minr:maxr, minc:maxc] = 1\n        label_item = (mask*zero).astype(bool)\n        label_items.append(label_item)\n    return  label_items\n\nwidths = []\nheights = []\nids = preds['s_id']\nprediction_strings = []\nfor k in range(len(ids)):\n    mask = preds['preds'][k].cpu().numpy().astype('bool')\n    h, w = mask.shape\n    seg_instances = get_vessels(mask) #preds['preds'][k].cpu().numpy())\n    # after seg infer\n    pred_string = \"\"\n    for i, binmask in enumerate(seg_instances):\n        encoded = encode_binary_mask(binmask)\n        if i == 0: pred_string += f\"0 1.0 {encoded.decode('utf-8')}\"\n        else: pred_string += f\" 0 1.0 {encoded.decode('utf-8')}\"\n    heights.append(h)\n    widths.append(w)\n    prediction_strings.append(pred_string)\n\nsubmission = pd.DataFrame()\nsubmission['id'] = ids\nsubmission['height'] = heights\nsubmission['width'] = widths\nsubmission['prediction_string'] = prediction_strings\nsubmission['prediction_string'] = prediction_strings\nsubmission = submission.set_index('id')\nsubmission.to_csv(\"submission.csv\")\n\nprint(submission)\n```\n\n_____\n\n##### [LB :  0.377(single model) and 0.382(ensemble) with YoLoV7](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420063) By [HongCheng](https://www.kaggle.com/chg0901)\n\n- In this [post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420063), [HongCheng](https://www.kaggle.com/chg0901) shares their current settings for training a single model and an ensemble using YoLoV7.\n- **The Trick:** The model training is done without the \"unsure\" label area.\n_____\n\n\n##### [Please help! The Usage of TTA in Instance Segmentation](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/420120) By [bent1e](https://www.kaggle.com/bent1e)\n\n- [bent1e](https://www.kaggle.com/bent1e) is seeking assistance with using Test-Time Augmentation (TTA) in instance segmentation to evaluate their model's performance.\n- The current approach involves inverting the mask obtained after flipping and rotating onto the original image, but it is yielding inconsistent results in terms of the number of instance segmentation objects detected.\n- Suggestions for TTA in instance segmentation:\n  - Limit the transforms to geometric ones, such as rotation (multiples of 90 degrees), zoom, and affine transformations.\n  - Perform the inverse transformation accordingly.\n\n_____\n\n##### [Help with Notebook Threw Exception](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/416613) By [Roberto](https://www.kaggle.com/robertsun2)\n\n- The author is having an issue with their notebook. When they submit it, they get a \"Notebook Threw Exception\" error, even though the notebook has completed successfully.\n- **Debugging Suggestion:** Some suggest simplifying the notebook to only include the inference part and remove any debugging or visualization code.\n- **Proposal:** Others suggest freeing up GPU memory by deleting tensors in the GPU. One comment mentions that the hidden test set contains multiple images, causing the GPU memory issue.\n\n_____\n\n##### [Advice to newbie about learning parameters](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421788) By [Jura Moshkov](https://www.kaggle.com/jurassimo)\n\nIn this [post](https://www.kaggle.com/competitions/hubmap-hacking-the-human-vasculature/discussion/421788), the author seeks advice on finding the best learning parameters for a model.\n\n- Good [link](https://github.com/google-research/tuning_playbook)\n- Users mention that different models may require different parameters, and experimentation is key to finding the best ones.\n- Manual parameter tuning is often done by hand, looking at the results of each experiment one by one.\n- Optuna and grid search may not be practical due to computational resource limitations.\n- Intuition-based parameter tuning is considered a good approach for most deep learning tasks.\n\n_____",
    "2339608": "Thank you for putting this together so carefully. It's an incredible job !!!",
    "2340814": "Well-curated content. great efforts. Thank you",
    "2342048": "Nice summary dude...",
    "2352167": "ModuleNotFoundError: No module named 'yolov7'.\nHow to resolve it",
    "2355171": "Amazing work!",
    "2356394": "Amazing work!"
  },
  "source": "meta"
}