Visual-Behavior / aloception-oss

Aloception is a set of package for computer vision: aloscene, alodataset, alonet.
Other
93 stars 7 forks source link

normalizing frames with custom mean_std instead of defaulting to resnet #316

Closed Dee61298 closed 1 year ago

Dee61298 commented 1 year ago

x=torch.rand(3,600,600) x=aloscene.Frame(x,mean_std=((0.333,0.333,0.333),(0.333,0.333,0.333)))

x=x.norm_meanstd() print("normalization de x ",x.normalization) print("Mean_std de x",x.mean_std)

x=x.norm_meanstd(name="resnet") print("normalization de x ",x.normalization) print("Mean_std de x",x.mean_std)

x=x.norm_meanstd(mean_std=((0.440,0.220,0.880),(0.333,0.333,0.333)), name="my_norm") print("normalization de x ",x.normalization) print("Mean_std de x",x.mean_std)


* ***Output*** : 
```python
normalization de x  None
Mean_std de x ((0.333, 0.333, 0.333), (0.333, 0.333, 0.333))
normalization de x  resnet
Mean_std de x ((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))
normalization de x  my_norm
Mean_std de x ((0.44, 0.22, 0.88), (0.333, 0.333, 0.333))

This pull request includes

Data-Iab commented 1 year ago

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
Dee61298 commented 1 year ago

Duplicated in #317 with the correct commits. Closing this one.