pixelite1201/pytorch_coma

Serious problem with data normalize

Opened this issue · 0 comments

data.py, Line91-99
The inherited attribute is 'pre_transform', while during __init__ another 'pre_tranform'(tranform v.s. tranSform) is initialized.

Here only the mean and std of 'pre_tranform'(no S) is initialized, but later used is 'pre_transform'(with S)

In this way, a serious normalize problem happens here.

        if self.pre_transform is not None:
            if hasattr(self.pre_transform, 'mean') and hasattr(self.pre_transform, 'std'):
                if self.pre_tranform.mean is None:
                    self.pre_tranform.mean = mean_train # no S
                if self.pre_transform.std is None:
                    self.pre_tranform.std = std_train # no S
            train_data = [self.pre_transform(td) for td in train_data] # with S
            val_data = [self.pre_transform(td) for td in val_data]
            test_data = [self.pre_transform(td) for td in test_data]

pytorch_coma/data.py

Lines 91 to 99 in 8446eec

if self.pre_transform is not None:
if hasattr(self.pre_transform, 'mean') and hasattr(self.pre_transform, 'std'):
if self.pre_tranform.mean is None:
self.pre_tranform.mean = mean_train
if self.pre_transform.std is None:
self.pre_tranform.std = std_train
train_data = [self.pre_transform(td) for td in train_data]
val_data = [self.pre_transform(td) for td in val_data]
test_data = [self.pre_transform(td) for td in test_data]