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

Which normalization transform whould I use to use pre-trained models? #42

Open
GeorgeBatch opened this issue Jun 4, 2022 · 4 comments

Comments

@GeorgeBatch
Copy link
Contributor

Hi,

I want to use your pre-trained ResNet models, but I could not find which transforms you used. To be more precise, when using ImageNet pre-trained models on new inputs, people normalize the input images before passing them to the pre-trained extractor using ImageNet normalization constants (mean=[0.485, 0.456, 0.406] and std=[0.229, 0.224, 0.225]).

What normalization should I perform to use your pre-trained models?

Many thanks,
George Batchkala

@binli123
Copy link
Owner

binli123 commented Jun 14, 2022

I tried using ImageNet pretrained ResNet18 on the TCGA dataset without normalizing the input image patches, it worked decently well. Make sure the model uses BatchNorm (not InstanceNorm which is the one I used in SimCLR training) and the model is in evaluation mode when computing the features.

@GeorgeBatch
Copy link
Contributor Author

Thanks! For people who will read this issue later, to follow @binli123's advice, add --norm_layer 'batch' when running python compute_feats.py. By default, --norm_layer is 'instance'.

@xiachenrui
Copy link

But I notice in your paper, the pre-trained ResNet18 have a bad performance in Table3. Can you explain this more detailly?

Thanks !

image

I tried using ImageNet pretrained ResNet18 on the TCGA dataset without normalizing the input image patches, it worked decently well. Make sure the model uses BatchNorm (not InstanceNorm which is the one I used in SimCLR training) and the model is in evaluation mode when computing the features.

@ZechengLi19
Copy link

I tried using ImageNet pretrained ResNet18 on the TCGA dataset without normalizing the input image patches, it worked decently well. Make sure the model uses BatchNorm (not InstanceNorm which is the one I used in SimCLR training) and the model is in evaluation mode when computing the features.

I'm curious why you use InstanceNorm instead of BatchNorm, can you share your thoughts?

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

No branches or pull requests

4 participants