{
  "id": 222722,
  "title": "HPA Segmentation tool showing error for image size 1728?",
  "url": "/competitions/hpa-single-cell-image-classification/discussion/222722",
  "author_name": "Ayush Thakur",
  "post_date": "2021-02-28T21:15:51.215000",
  "votes": 2,
  "comment_count": 7,
  "views": 0,
  "content": "<p>Hey all,</p>\n<p>I am trying to set up my inference notebook. The segmentation tool provided by the competition hosts works perfectly for image sizes 2048 and 3072. However, it's throwing an error when I try to use <code>nuc_segmentation = segmentator.pred_nuclei([img])</code>. </p>\n<p>I am using the default configuration for the segmentation model.</p>\n<pre><code>segmentator = cellsegmentator.CellSegmentator(\n    NUC_MODEL,\n    CELL_MODEL,\n    scale_factor=0.25,\n    device=\"cuda\",\n    padding=False,\n    multi_channel_model=True,\n)\n</code></pre>\n<p>Did anyone of you face this? I didn't investigate much though but would appreciate any help. Maybe I am missing something.</p>",
  "messages": [
    {
      "id": 1221325,
      "postDate": "2021-02-28T22:23:09.240Z",
      "content": "<p>Yes, I got the same error. One solution is to resize 1728 to 2048 prior to apply HPA segmentation.<br>\nI'm just wondering how the organizers had built the ground truth with this error. Did they resize or pad? Or maybe this error does not appear in private test data?</p>\n<p>Also I noticed that a few public test images are in 8 bits instead of 16 bits. It's not a big problem but pay attention how you read/normalize test images.</p>",
      "rawMarkdown": "Yes, I got the same error. One solution is to resize 1728 to 2048 prior to apply HPA segmentation.\nI'm just wondering how the organizers had built the ground truth with this error. Did they resize or pad? Or maybe this error does not appear in private test data?\n\nAlso I noticed that a few public test images are in 8 bits instead of 16 bits. It's not a big problem but pay attention how you read/normalize test images.",
      "votes": 1
    },
    {
      "id": 1221294,
      "postDate": "2021-02-28T21:21:38.930Z",
      "content": "<p>Hi, Please change the 'padding' parameter to True. Should work.</p>",
      "rawMarkdown": "Hi, Please change the 'padding' parameter to True. Should work.",
      "votes": 1
    },
    {
      "id": 1221982,
      "postDate": "2021-03-01T13:05:53.703Z",
      "content": "<p>I would recommend switching your approach to utilize the notebooks/methodology created by <a href=\"https://www.kaggle.com/linshokaku\" target=\"_blank\"><strong>linshokaku</strong></a> and refined by <a href=\"https://www.kaggle.com/samusram\" target=\"_blank\"><strong>Raman</strong></a>. This will fix your problem (I believe they used <strong>padding=<code>True</code></strong>) and it will set you up for much (MUCH) faster notebooks.</p>\n<hr>\n<p><strong><em>Please see these notebooks for more details.</em></strong></p>\n<ul>\n<li><a href=\"https://www.kaggle.com/linshokaku/faster-hpa-cell-segmentation\" target=\"_blank\">https://www.kaggle.com/linshokaku/faster-hpa-cell-segmentation</a></li>\n<li><a href=\"https://www.kaggle.com/samusram/even-faster-hpa-cell-segmentation/notebook\" target=\"_blank\">https://www.kaggle.com/samusram/even-faster-hpa-cell-segmentation/notebook</a></li>\n<li><a href=\"https://github.com/SamusRam/HPA-Cell-Segmentation\" target=\"_blank\">https://github.com/SamusRam/HPA-Cell-Segmentation</a></li>\n</ul>",
      "rawMarkdown": "I would recommend switching your approach to utilize the notebooks/methodology created by [**linshokaku**](https://www.kaggle.com/linshokaku) and refined by [**Raman**](https://www.kaggle.com/samusram). This will fix your problem (I believe they used **padding=`True`**) and it will set you up for much (MUCH) faster notebooks.\n\n---\n\n***Please see these notebooks for more details.***\n\n- https://www.kaggle.com/linshokaku/faster-hpa-cell-segmentation\n- https://www.kaggle.com/samusram/even-faster-hpa-cell-segmentation/notebook\n- https://github.com/SamusRam/HPA-Cell-Segmentation",
      "votes": 2,
      "replies": [
        {
          "id": 1222038,
          "postDate": "2021-03-01T13:50:06.650Z",
          "content": "<p>Thanks for sharing. :)</p>",
          "rawMarkdown": "Thanks for sharing. :)"
        }
      ]
    },
    {
      "id": 1221824,
      "postDate": "2021-03-01T10:27:45.523Z",
      "content": "<p>If you set <code>padding=True</code>, the problem should be resolved. If not, please let me know.</p>",
      "rawMarkdown": "If you set `padding=True`, the problem should be resolved. If not, please let me know.",
      "votes": 2,
      "replies": [
        {
          "id": 1221959,
          "postDate": "2021-03-01T12:42:37.237Z",
          "content": "<p>Thank you for the infor. </p>",
          "rawMarkdown": "Thank you for the infor. "
        }
      ]
    },
    {
      "id": 1221767,
      "postDate": "2021-03-01T08:58:40.103Z",
      "content": "<p>The same problem fixed by setting: <code>padding=True</code></p>",
      "rawMarkdown": "The same problem fixed by setting: ```padding=True```",
      "votes": 2
    },
    {
      "id": 1221292,
      "postDate": "2021-02-28T21:15:51.217Z",
      "content": "<p>Hey all,</p>\n<p>I am trying to set up my inference notebook. The segmentation tool provided by the competition hosts works perfectly for image sizes 2048 and 3072. However, it's throwing an error when I try to use <code>nuc_segmentation = segmentator.pred_nuclei([img])</code>. </p>\n<p>I am using the default configuration for the segmentation model.</p>\n<pre><code>segmentator = cellsegmentator.CellSegmentator(\n    NUC_MODEL,\n    CELL_MODEL,\n    scale_factor=0.25,\n    device=\"cuda\",\n    padding=False,\n    multi_channel_model=True,\n)\n</code></pre>\n<p>Did anyone of you face this? I didn't investigate much though but would appreciate any help. Maybe I am missing something.</p>",
      "rawMarkdown": "Hey all,\n\nI am trying to set up my inference notebook. The segmentation tool provided by the competition hosts works perfectly for image sizes 2048 and 3072. However, it's throwing an error when I try to use `nuc_segmentation = segmentator.pred_nuclei([img])`. \n\nI am using the default configuration for the segmentation model.\n\n```Python\nsegmentator = cellsegmentator.CellSegmentator(\n    NUC_MODEL,\n    CELL_MODEL,\n    scale_factor=0.25,\n    device=\"cuda\",\n    padding=False,\n    multi_channel_model=True,\n)\n```\n\nDid anyone of you face this? I didn't investigate much though but would appreciate any help. Maybe I am missing something.",
      "votes": 2
    }
  ],
  "comments": [
    {
      "id": 1221325,
      "author_name": "MPWARE",
      "author_url": "",
      "post_date": "2021-02-28T22:23:09.240000",
      "content": "<p>Yes, I got the same error. One solution is to resize 1728 to 2048 prior to apply HPA segmentation.<br>\nI'm just wondering how the organizers had built the ground truth with this error. Did they resize or pad? Or maybe this error does not appear in private test data?</p>\n<p>Also I noticed that a few public test images are in 8 bits instead of 16 bits. It's not a big problem but pay attention how you read/normalize test images.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1221294,
      "author_name": "Tadeusz Hupało",
      "author_url": "",
      "post_date": "2021-02-28T21:21:38.930000",
      "content": "<p>Hi, Please change the 'padding' parameter to True. Should work.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1221982,
      "author_name": "Darien Schettler",
      "author_url": "",
      "post_date": "2021-03-01T13:05:53.703000",
      "content": "<p>I would recommend switching your approach to utilize the notebooks/methodology created by <a href=\"https://www.kaggle.com/linshokaku\" target=\"_blank\"><strong>linshokaku</strong></a> and refined by <a href=\"https://www.kaggle.com/samusram\" target=\"_blank\"><strong>Raman</strong></a>. This will fix your problem (I believe they used <strong>padding=<code>True</code></strong>) and it will set you up for much (MUCH) faster notebooks.</p>\n<hr>\n<p><strong><em>Please see these notebooks for more details.</em></strong></p>\n<ul>\n<li><a href=\"https://www.kaggle.com/linshokaku/faster-hpa-cell-segmentation\" target=\"_blank\">https://www.kaggle.com/linshokaku/faster-hpa-cell-segmentation</a></li>\n<li><a href=\"https://www.kaggle.com/samusram/even-faster-hpa-cell-segmentation/notebook\" target=\"_blank\">https://www.kaggle.com/samusram/even-faster-hpa-cell-segmentation/notebook</a></li>\n<li><a href=\"https://github.com/SamusRam/HPA-Cell-Segmentation\" target=\"_blank\">https://github.com/SamusRam/HPA-Cell-Segmentation</a></li>\n</ul>",
      "votes": 2,
      "replies": [
        {
          "id": 1222038,
          "author_name": "Ayush Thakur",
          "author_url": "",
          "post_date": "2021-03-01T13:50:06.650000",
          "content": "<p>Thanks for sharing. :)</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1221824,
      "author_name": "Casper Winsnes",
      "author_url": "",
      "post_date": "2021-03-01T10:27:45.523000",
      "content": "<p>If you set <code>padding=True</code>, the problem should be resolved. If not, please let me know.</p>",
      "votes": 2,
      "replies": [
        {
          "id": 1221959,
          "author_name": "Ayush Thakur",
          "author_url": "",
          "post_date": "2021-03-01T12:42:37.237000",
          "content": "<p>Thank you for the infor. </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1221767,
      "author_name": "seefun",
      "author_url": "",
      "post_date": "2021-03-01T08:58:40.103000",
      "content": "<p>The same problem fixed by setting: <code>padding=True</code></p>",
      "votes": 2,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1221325": "Yes, I got the same error. One solution is to resize 1728 to 2048 prior to apply HPA segmentation.\nI'm just wondering how the organizers had built the ground truth with this error. Did they resize or pad? Or maybe this error does not appear in private test data?\n\nAlso I noticed that a few public test images are in 8 bits instead of 16 bits. It's not a big problem but pay attention how you read/normalize test images.",
    "1221294": "Hi, Please change the 'padding' parameter to True. Should work.",
    "1221982": "I would recommend switching your approach to utilize the notebooks/methodology created by [**linshokaku**](https://www.kaggle.com/linshokaku) and refined by [**Raman**](https://www.kaggle.com/samusram). This will fix your problem (I believe they used **padding=`True`**) and it will set you up for much (MUCH) faster notebooks.\n\n---\n\n***Please see these notebooks for more details.***\n\n- https://www.kaggle.com/linshokaku/faster-hpa-cell-segmentation\n- https://www.kaggle.com/samusram/even-faster-hpa-cell-segmentation/notebook\n- https://github.com/SamusRam/HPA-Cell-Segmentation",
    "1221824": "If you set `padding=True`, the problem should be resolved. If not, please let me know.",
    "1221767": "The same problem fixed by setting: ```padding=True```",
    "1221292": "Hey all,\n\nI am trying to set up my inference notebook. The segmentation tool provided by the competition hosts works perfectly for image sizes 2048 and 3072. However, it's throwing an error when I try to use `nuc_segmentation = segmentator.pred_nuclei([img])`. \n\nI am using the default configuration for the segmentation model.\n\n```Python\nsegmentator = cellsegmentator.CellSegmentator(\n    NUC_MODEL,\n    CELL_MODEL,\n    scale_factor=0.25,\n    device=\"cuda\",\n    padding=False,\n    multi_channel_model=True,\n)\n```\n\nDid anyone of you face this? I didn't investigate much though but would appreciate any help. Maybe I am missing something."
  }
}