-
Notifications
You must be signed in to change notification settings - Fork 7
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
normalizing frames with custom mean_std instead of defaulting to resnet #316
Conversation
@@ -507,10 +510,27 @@ def mean_std_norm(self, mean, std, name) -> Frame: | |||
|
|||
return tensor | |||
|
|||
def norm_meanstd(self, mean_std=None, name=None) -> Frame: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having two methodes with nearly the same name is not a good practice. try to fix mean_std_norm
instead
return self.norm_resnet() | ||
elif mean_std is not None and len(mean_std) == 2: | ||
return self.mean_std_norm(mean=mean_std[0], std=mean_std[1], name=name) | ||
elif self.mean_std is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no difference between this condition and the one above.
elif mean_std is not None and len(mean_std) == 2: | ||
return self.mean_std_norm(mean=mean_std[0], std=mean_std[1], name=name) | ||
elif self.mean_std is not None: | ||
return self.mean_std_norm(mean=self.mean_std[0], std=self.mean_std[1], name=name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attribute mean_std
is used to store the current normalization parameters. You can delete this
Thing you can add : normlization from minmax -> meanstd import torch
import aloscene
x = torch.rand(3,10,10)
x = aloscene.Frame(x,mean_std=((0.333,0.333,0.333),(0.333,0.333,0.333)))
x = x.norm_minmax_sym()
x = x.mean_std_norm(mean=(0.333,0.333,0.333), std=(0.333,0.333,0.333), name="custom") # Exception raised |
Duplicated in #317 with the correct commits. Closing this one. |
You can now normalize frame with custom mean_std instead of defaulting to resnet.
Either you pass the mean_std at instanciation or you pass it as a parameter to the norm_meanstd function :
This pull request includes