Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PatchGenerator does not support certain image sizes #171

Open
andreped opened this issue Mar 27, 2023 · 3 comments
Open

PatchGenerator does not support certain image sizes #171

andreped opened this issue Mar 27, 2023 · 3 comments
Labels

Comments

@andreped
Copy link
Contributor

Describe the bug
When attempting to run inference with a ResNet50 patch-wise classifier using FastPathology, it was observed that image size 299 x 299 was not supported.

According to the source code, FAST does not support image patches that are not divisible by 2 (see here).

System:

  • OS and version: [e.g. Windows 10/Ubuntu 18.04] Ubuntu 20.04
  • GPU and OpenCL vendor (NVIDIA, AMD, Intel) NVIDIA

Expected behavior
The PatchGenerator PO should support "any" input shape

cc: @MarkusDrange

@andreped andreped added the bug label Mar 27, 2023
@smistad
Copy link
Owner

smistad commented Mar 27, 2023

This is not really a bug. TIFF requires the tile size to be a multiplum of 16. TIFF is used in the PatchStitcher when creating a segmentation ImagePyramid on the fly. The TIFF tile size could be different to the patch generator size, but this would lead to very inefficient stitching.

@andreped
Copy link
Contributor Author

andreped commented Mar 28, 2023

Hmm, I understand. Perhaps we should add a disclaimer regarding this, either in FAST or in FP to inform users about this, as I believe there will be people that may run into the same issue. 299x299 is common for ResNets and Inception backbones.

@MarkusDrange for now I would just use 256x256 input to the ResNet50 classifier when creating the network. Be sure to change the input layer of the network to use the appropriate image size. In this case, doing resizing in the Compose is no longer necessary.

@smistad
Copy link
Owner

smistad commented Mar 28, 2023

Note that you can have a patch generator which generates patches at 304x304 (which is a multiplum of 16), and a network which requires 299x299. FAST will then automatically resize the 304x304 patches to 299x299. You should then set the resize back to normal size option in the SegmentationNetwork.

This might be solved more smoothly with adding some overlap automatically to satisfy both constraints, so leave this issue open for now and I can take a look when I have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants