-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Add inceptionv4 pretrained model #43
base: main
Are you sure you want to change the base?
Conversation
is it the same input normalization as all other models in the current zoo? |
I am not sure, but it might be this i.e. sub(0.5) then mul(2.0) I will evaluate the model on ImageNet in the near futur to be sure that everything is alright. |
We could probably adjust the first layer weights to match the |
We could also add the preprocessing information that way, i.e. as an attribute. |
I used the imagenet example to evaluate the model. Beware, the targets are associated to the labels in the same order, but inceptionv4 has 1001 classes. The first class (index 0) is said to be the "dummy class". Thus, I shifted the targets number that way I preprocessed images that way: normalize = transforms.Normalize(mean=[0.5, 0.5, 0.5],
std=[0.5, 0.5, 0.5])
...
val_loader = torch.utils.data.DataLoader(
datasets.ImageFolder(valdir, transforms.Compose([
transforms.Scale(342),
transforms.CenterCrop(299),
transforms.ToTensor(),
normalize
])),
batch_size=args.batch_size, shuffle=False,
num_workers=args.workers, pin_memory=True) |
@apaszke I am not sure, but I don't think it's possible, because you must add a bias by color channel (the normalization in pytorch vision is made by channel). The problem is the following. Let's simplify the equation. We have x one pixel, w one weight, y the output. Without biases, we have to find an epsilon e such as x, w and y remain unchanged. (x - 0.485 ) / 0.229 * e = (x - 0.5) / 0.5 Thus, without biases per color channel you can't do it, because the epsilon depends on the input x. |
If it is not possible, I think we should find a nice way to associate pretrained parameters to their normalization. Let me explain myself. I saw that you retrained VGG on ImageNet. That's really cool and we could do the same with InceptionV4, but it would be nice also that for instance people who want to reproduce results from papers using the VGG pretrained with caffe (with a different kind of normalization maybe) should be able to download the pretrained parameters of their choice associated with an information about how to normalize the input (be it on imagenet or any other dataset). |
Made with Tensorflow Model Zoo for Torch7 and PyTorch