Pre-computed min-max values
kumarneelabh13 opened this issue · 2 comments
kumarneelabh13 commented
I think there's a problem with precomputing min-max values for separate classes. The problem is that this technique will not be suitable for a new and "unknown" sample.
from datasets/cifar10.py
# Pre-computed min and max values (after applying GCN) from train data per class
min_max = [(-28.94083453598571, 13.802961825439636),
(-6.681770233365245, 9.158067708230273),
(-34.924463588638204, 14.419298165027628),
(-10.599172931391799, 11.093187820377565),
(-11.945022995801637, 10.628045447867583),
(-9.691969487694928, 8.948326776180823),
(-9.174940012342555, 13.847014686472365),
(-6.876682005899029, 12.282371383343161),
(-15.603507135507172, 15.2464923804279),
(-6.132882973622672, 8.046098172351265)]
Or am I missing something?
kumarneelabh13 commented
I got it. So all the train and test samples get re-scaled according to the normal class values.
matteoguarrera commented
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)))