{
  "id": 197765,
  "title": "How to open large .TIFF?",
  "url": "/competitions/hubmap-kidney-segmentation/discussion/197765",
  "author_name": "",
  "post_date": "2020-11-18T00:44:36.202359700Z",
  "votes": 3,
  "comment_count": 6,
  "views": 0,
  "content": "<p>A faced to this problem when tried to open TIFF file with the size more than 1.2Gb. For this moment I’ve tried:</p>\n<ul>\n<li>cv2</li>\n<li>PIL</li>\n<li>tifffile<br>\nand had a problem with installation of glob<br>\nAny advises, any thoughts about this issue?</li>\n</ul>",
  "messages": [
    {
      "id": "1082500",
      "postDate": "11/18/2020 00:44:36",
      "content": "<p>A faced to this problem when tried to open TIFF file with the size more than 1.2Gb. For this moment I’ve tried:</p>\n<ul>\n<li>cv2</li>\n<li>PIL</li>\n<li>tifffile<br>\nand had a problem with installation of glob<br>\nAny advises, any thoughts about this issue?</li>\n</ul>",
      "rawMarkdown": "A faced to this problem when tried to open TIFF file with the size more than 1.2Gb. For this moment I’ve tried:\n-\tcv2\n-\tPIL\n-\ttifffile\nand had a problem with installation of glob\nAny advises, any thoughts about this issue?",
      "votes": null
    },
    {
      "id": "1082620",
      "postDate": "11/18/2020 04:48:20",
      "content": "<p>Give <a href=\"https://pypi.org/project/tifffile/\" target=\"_blank\">TiffFile</a> a try. Back in the day I had to write my own BigTiff (that's the format name) reader in C, but you might be able to use this library.</p>",
      "rawMarkdown": "Give [TiffFile](https://pypi.org/project/tifffile/) a try. Back in the day I had to write my own BigTiff (that's the format name) reader in C, but you might be able to use this library.",
      "votes": null
    },
    {
      "id": "1082687",
      "postDate": "11/18/2020 06:17:19",
      "content": "<p>Ok, great. Looking forward for the BigTiff release. Hope it will not be so painful in installation like <strong>glob</strong> and really effective. Thanks, John.</p>",
      "rawMarkdown": "Ok, great. Looking forward for the BigTiff release. Hope it will not be so painful in installation like **glob** and really effective. Thanks, John.",
      "votes": null
    },
    {
      "id": "1085872",
      "postDate": "11/21/2020 08:56:19",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/yuriikochurovskyi\" target=\"_blank\">@yuriikochurovskyi</a> </p>\n<p>The Tiff files can be opened and visualized using the 'tiffile' PyPi package. They are quite large and it is not quite possible to feed such large files to models without immensely large and custom CNNs not to mention the compute power required.</p>\n<p>Please try the approach of tiling the images where the images and annotations are split into tiles carefully. This has the upside of no loss of information compared to downscaling the image to fit a model.</p>\n<p><strong>Please  check out my notebook where I have tiled images converted to COCO annotation format for easy loading to provide extended support for multiple frameworks such as Blendmask in Adelaidet, detectron2, TF Mask RCNN etc.</strong></p>\n<p><a href=\"https://www.kaggle.com/sreevishnudamodaran/build-custom-coco-annotations-512x512-tiled\" target=\"_blank\">https://www.kaggle.com/sreevishnudamodaran/build-custom-coco-annotations-512x512-tiled</a></p>\n<p><a href=\"https://www.kaggle.com/sreevishnudamodaran/hubmap-coco-dataset-512x512-tiled\" target=\"_blank\">https://www.kaggle.com/sreevishnudamodaran/hubmap-coco-dataset-512x512-tiled</a></p>\n<p>The  above notebook and dataset can be easily used to train models.</p>\n<p>This notebook by Marcos explains the tiling and TFRecord creation.</p>\n<p><a href=\"https://www.kaggle.com/marcosnovaes/hubmap-read-data-and-build-tfrecords\" target=\"_blank\">https://www.kaggle.com/marcosnovaes/hubmap-read-data-and-build-tfrecords</a></p>\n<p>Hope this was useful. Thanks! 🙂</p>",
      "rawMarkdown": "Hi @yuriikochurovskyi \n\nThe Tiff files can be opened and visualized using the 'tiffile' PyPi package. They are quite large and it is not quite possible to feed such large files to models without immensely large and custom CNNs not to mention the compute power required.\n\nPlease try the approach of tiling the images where the images and annotations are split into tiles carefully. This has the upside of no loss of information compared to downscaling the image to fit a model.\n \n**Please  check out my notebook where I have tiled images converted to COCO annotation format for easy loading to provide extended support for multiple frameworks such as Blendmask in Adelaidet, detectron2, TF Mask RCNN etc.**\n\nhttps://www.kaggle.com/sreevishnudamodaran/build-custom-coco-annotations-512x512-tiled\n\nhttps://www.kaggle.com/sreevishnudamodaran/hubmap-coco-dataset-512x512-tiled\n\nThe  above notebook and dataset can be easily used to train models.\n\nThis notebook by Marcos explains the tiling and TFRecord creation.\n\nhttps://www.kaggle.com/marcosnovaes/hubmap-read-data-and-build-tfrecords\n\nHope this was useful. Thanks! 🙂",
      "votes": null
    },
    {
      "id": "1087151",
      "postDate": "11/22/2020 12:04:30",
      "content": "<p>Thanks, man. Definitely it was helpful </p>",
      "rawMarkdown": "Thanks, man. Definitely it was helpful",
      "votes": null
    },
    {
      "id": "1087693",
      "postDate": "11/23/2020 02:17:21",
      "content": "<p>you can try add these  code before you use PIL to read the tiff image :<br>\nfrom PIL import Image<br>\nImage.MAX_IMAGE_PIXELS = 1000000000</p>",
      "rawMarkdown": "you can try add these  code before you use PIL to read the tiff image :\n\nfrom PIL import Image\nImage.MAX_IMAGE_PIXELS = 1000000000",
      "votes": null
    },
    {
      "id": "1088206",
      "postDate": "11/23/2020 12:33:20",
      "content": "<p>Yeah, thanks. will try</p>",
      "rawMarkdown": "Yeah, thanks. will try",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1082620,
      "author_name": "johnrocamora",
      "author_url": "",
      "post_date": "11/18/2020 04:48:20",
      "content": "<p>Give <a href=\"https://pypi.org/project/tifffile/\" target=\"_blank\">TiffFile</a> a try. Back in the day I had to write my own BigTiff (that's the format name) reader in C, but you might be able to use this library.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1082687,
          "author_name": "yuriikochurovskyi",
          "author_url": "",
          "post_date": "11/18/2020 06:17:19",
          "content": "<p>Ok, great. Looking forward for the BigTiff release. Hope it will not be so painful in installation like <strong>glob</strong> and really effective. Thanks, John.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1085872,
      "author_name": "sreevishnudamodaran",
      "author_url": "",
      "post_date": "11/21/2020 08:56:19",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/yuriikochurovskyi\" target=\"_blank\">@yuriikochurovskyi</a> </p>\n<p>The Tiff files can be opened and visualized using the 'tiffile' PyPi package. They are quite large and it is not quite possible to feed such large files to models without immensely large and custom CNNs not to mention the compute power required.</p>\n<p>Please try the approach of tiling the images where the images and annotations are split into tiles carefully. This has the upside of no loss of information compared to downscaling the image to fit a model.</p>\n<p><strong>Please  check out my notebook where I have tiled images converted to COCO annotation format for easy loading to provide extended support for multiple frameworks such as Blendmask in Adelaidet, detectron2, TF Mask RCNN etc.</strong></p>\n<p><a href=\"https://www.kaggle.com/sreevishnudamodaran/build-custom-coco-annotations-512x512-tiled\" target=\"_blank\">https://www.kaggle.com/sreevishnudamodaran/build-custom-coco-annotations-512x512-tiled</a></p>\n<p><a href=\"https://www.kaggle.com/sreevishnudamodaran/hubmap-coco-dataset-512x512-tiled\" target=\"_blank\">https://www.kaggle.com/sreevishnudamodaran/hubmap-coco-dataset-512x512-tiled</a></p>\n<p>The  above notebook and dataset can be easily used to train models.</p>\n<p>This notebook by Marcos explains the tiling and TFRecord creation.</p>\n<p><a href=\"https://www.kaggle.com/marcosnovaes/hubmap-read-data-and-build-tfrecords\" target=\"_blank\">https://www.kaggle.com/marcosnovaes/hubmap-read-data-and-build-tfrecords</a></p>\n<p>Hope this was useful. Thanks! 🙂</p>",
      "votes": null,
      "replies": [
        {
          "id": 1087151,
          "author_name": "yuriikochurovskyi",
          "author_url": "",
          "post_date": "11/22/2020 12:04:30",
          "content": "<p>Thanks, man. Definitely it was helpful </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1087693,
      "author_name": "abiaozju",
      "author_url": "",
      "post_date": "11/23/2020 02:17:21",
      "content": "<p>you can try add these  code before you use PIL to read the tiff image :<br>\nfrom PIL import Image<br>\nImage.MAX_IMAGE_PIXELS = 1000000000</p>",
      "votes": null,
      "replies": [
        {
          "id": 1088206,
          "author_name": "yuriikochurovskyi",
          "author_url": "",
          "post_date": "11/23/2020 12:33:20",
          "content": "<p>Yeah, thanks. will try</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1082500": "A faced to this problem when tried to open TIFF file with the size more than 1.2Gb. For this moment I’ve tried:\n-\tcv2\n-\tPIL\n-\ttifffile\nand had a problem with installation of glob\nAny advises, any thoughts about this issue?",
    "1082620": "Give [TiffFile](https://pypi.org/project/tifffile/) a try. Back in the day I had to write my own BigTiff (that's the format name) reader in C, but you might be able to use this library.",
    "1082687": "Ok, great. Looking forward for the BigTiff release. Hope it will not be so painful in installation like **glob** and really effective. Thanks, John.",
    "1085872": "Hi @yuriikochurovskyi \n\nThe Tiff files can be opened and visualized using the 'tiffile' PyPi package. They are quite large and it is not quite possible to feed such large files to models without immensely large and custom CNNs not to mention the compute power required.\n\nPlease try the approach of tiling the images where the images and annotations are split into tiles carefully. This has the upside of no loss of information compared to downscaling the image to fit a model.\n \n**Please  check out my notebook where I have tiled images converted to COCO annotation format for easy loading to provide extended support for multiple frameworks such as Blendmask in Adelaidet, detectron2, TF Mask RCNN etc.**\n\nhttps://www.kaggle.com/sreevishnudamodaran/build-custom-coco-annotations-512x512-tiled\n\nhttps://www.kaggle.com/sreevishnudamodaran/hubmap-coco-dataset-512x512-tiled\n\nThe  above notebook and dataset can be easily used to train models.\n\nThis notebook by Marcos explains the tiling and TFRecord creation.\n\nhttps://www.kaggle.com/marcosnovaes/hubmap-read-data-and-build-tfrecords\n\nHope this was useful. Thanks! 🙂",
    "1087151": "Thanks, man. Definitely it was helpful",
    "1087693": "you can try add these  code before you use PIL to read the tiff image :\n\nfrom PIL import Image\nImage.MAX_IMAGE_PIXELS = 1000000000",
    "1088206": "Yeah, thanks. will try"
  },
  "source": "meta"
}