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

norm[-1,1]for net='vgg'? #84

Open
DISAPPEARED13 opened this issue Oct 19, 2021 · 5 comments
Open

norm[-1,1]for net='vgg'? #84

DISAPPEARED13 opened this issue Oct 19, 2021 · 5 comments

Comments

@DISAPPEARED13
Copy link

DISAPPEARED13 commented Oct 19, 2021

I found that you mention that we need to normalize the RGB images range into [-1, 1], but I saw that example worked at when net='alex', I wanna know that if this work for net='vgg', too?
Because I found some comments in https://discuss.pytorch.org/t/how-to-preprocess-input-for-pre-trained-networks/683/2 , @smth said that input should be norm to [0, 1], and now I am confused...
And I noticed that you also load your own pretrained network by giving "net" and "version", are you just use the framework defined by torchvision.model.vgg16 and then you trained it with ImageNet by norm to [-1, 1]?
sorry to bother and thanks a lot! : )

@DISAPPEARED13 DISAPPEARED13 changed the title norm[-1,1]for net= norm[-1,1]for net='vgg'? Oct 19, 2021
@DISAPPEARED13
Copy link
Author

I saw the relative question opened at #83 , and @richzhang said, the mean and std is for [-1, 1], I wanna know if our data do from grayscale to RGB with repeat single slice to 3 channel, should i just remove the ScalingLayer when LPIPS.forward?
Thanks!

@richzhang
Copy link
Owner

I think you can scale the data to [-1, +1], and repeat to 3 channels, and keep the scaling layer

@DISAPPEARED13
Copy link
Author

I think you can scale the data to [-1, +1], and repeat to 3 channels, and keep the scaling layer

Thanks for replying! and is it properly that I use that std and mean value to scale my own grayscale medical image? or change the parameters in the layer?

@richzhang
Copy link
Owner

I think just keep the parameters, but there's no 100% correctly solution. This network was pretrained on Imagenet classification of natural images, so there's no real guarentee it works well for medical images

@DISAPPEARED13
Copy link
Author

I think just keep the parameters, but there's no 100% correctly solution. This network was pretrained on Imagenet classification of natural images, so there's no real guarentee it works well for medical images

Thanks alot. I think it maybe a explainable option to do so with different distribution like natural imges and medical images.

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

2 participants