Closed Captainsean007 closed 5 years ago
You get the min-max values as the minimum and maximum feature (i.e. Pixel) values over all training set samples after having applied GCN (Global Contrast Normalization) to them.
You find the code for GCN in the global_contrast_normalization
-function in src/datasets/preprocessing.py
. Note that we applied GCN with the L1-norm.
Also note that the training sets in the one-class classification setting always only consist of the training samples from the respective normal class. Let me know if you cannot reproduce our precomputed values.
This should not be the case. You can change the normal class with the --normal_class
option in the main.py
script, e.g. --normal_class 3
. If no class is specified, the default is normal_class = 0
. Could you provide code for reproducing the error?
Hi lukasruff,
Thinks for your answers, I have achived this code on my own application. This is a good idea!
- You get the min-max values as the minimum and maximum feature (i.e. Pixel) values over all training set samples after having applied GCN (Global Contrast Normalization) to them. You find the code for GCN in the
global_contrast_normalization
-function insrc/datasets/preprocessing.py
. Note that we applied GCN with the L1-norm. Also note that the training sets in the one-class classification setting always only consist of the training samples from the respective normal class. Let me know if you cannot reproduce our precomputed values.
I'm not able to reproduce your min-max value, can you provide the code for doing it?
train_set_full = MyMNIST(root=root, train=True, download=True,
transform=None, target_transform=None)
MIN = []
MAX = []
for normal_classes in range(10):
train_idx_normal = get_target_label_idx(train_set_full.train_labels.clone().data.cpu().numpy(), normal_classes)
train_set = Subset(train_set_full, train_idx_normal)
_min_ = []
_max_ = []
for idx in train_set.indices:
gcm = global_contrast_normalization(train_set.dataset.data[idx].float(), 'l1')
_min_.append(gcm.min())
_max_.append(gcm.max())
MIN.append(np.min(_min_))
MAX.append(np.max(_max_))
print(list(zip(MIN, MAX)))
Hi lukasruff,
Thinks for your answers, I have achived this code on my own application. This is a good idea!
Can you share me your code that you achieved? @Captainsean007
First, How can I get min-max values for a new dataset? I cannot find the code. Second, there is a Bug exists in this code that no matter how I change the normal_class number, It always chooses 0 class as normal_class.