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

PatchCore only support 224x224 input, and 28x28 feature maps. #40

Closed
samet-akcay opened this issue Dec 21, 2021 · 4 comments
Closed

PatchCore only support 224x224 input, and 28x28 feature maps. #40

samet-akcay opened this issue Dec 21, 2021 · 4 comments
Labels
Bug Something isn't working

Comments

@samet-akcay
Copy link
Contributor

No description provided.

@samet-akcay samet-akcay created this issue from a note in Feature Requests (To do) Dec 21, 2021
@samet-akcay samet-akcay added the Bug Something isn't working label Jan 7, 2022
@soad89
Copy link

soad89 commented Jan 28, 2022

Hello, can you please guide me a bit what needs to be modified to allow higher input resolutions?
Thanks

@Lucas-Steinmann
Copy link

Lucas-Steinmann commented Mar 11, 2022

Hi,
I solved this problem by inferring the largest feature map size from the given feature layer names and the input/tiling size.
I assumed

  • the layer names to be of the same format as ResNet ("layer1", "layer2", ...) and
  • the sub-sampling ratios are the same as in ResNet, i.e. 2**(1+layer_num)

I know this is kind of hard-coded, but if that is general enough for the maintainers of anomalib, then I'm happy to create a pull request.
Support for other backbones of torchvision could be added by someone motivated enough, to collect all output shapes of various backbones.

More general solutions would either require:

  • forwarding a blank image and collecting the feature maps, to get their sizes, or
  • inspecting the network to infer the output shapes/sub-sampling ratio. But this is difficult, since the network implementation of torchvision does not keep track of the output shapes explicitly. Some other libraries (e.g. detectron2 with their ShapeSpec) do this.

@samet-akcay
Copy link
Contributor Author

Hi @Lucas-Steinmann, thanks for looking at the issue and proposing a solution. Would be good if you could create the PR. It would also be great if you could document/comment the code based on what you described above so that future enhancements could be built on top of this.

Lucas-Steinmann added a commit to Lucas-Steinmann/anomalib that referenced this issue Mar 11, 2022
Clean up implementation of feature map size inference for PR.

Fixes issue openvinotoolkit#40 for ResNets.
@samet-akcay
Copy link
Contributor Author

Since PR #148 addressed this, I'm closing the issue.

Feature Requests automation moved this from To do to Done Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
No open projects
Development

No branches or pull requests

3 participants