diff --git a/MLclf/MLclf.py b/MLclf/MLclf.py index 7f908b8..8a6877a 100644 --- a/MLclf/MLclf.py +++ b/MLclf/MLclf.py @@ -290,7 +290,14 @@ def _feature_norm(feature, transform=None): else: transform = transform feature_shape = np.shape(feature) - feature_output = torch.empty((feature_shape[0], feature_shape[3], feature_shape[1], feature_shape[2])) + for trans in transform.transforms: + if isinstance(trans, transforms.Resize): + transform_has_resize = True + resize_size = trans.size + if transform_has_resize: + feature_output = torch.empty((feature_shape[0], feature_shape[3], resize_size[0], resize_size[1])) + else: + feature_output = torch.empty((feature_shape[0], feature_shape[3], feature_shape[1], feature_shape[2])) for i, feature_i in enumerate(feature): feature_output[i] = transform(feature_i) # feature is a tensor here. @@ -636,8 +643,6 @@ def tinyimagenet_data_raw(data_dir=None): print('train_dataset: ', train_dataset, np.shape(train_dataset)) - - """ Note for updating to PyPi website: python3 setup.py sdist bdist_wheel @@ -659,9 +664,4 @@ def tinyimagenet_data_raw(data_dir=None): shuffle=True, num_workers=0) """ - - - - - - + \ No newline at end of file diff --git a/MLclf/__pycache__/MLclf.cpython-38.pyc b/MLclf/__pycache__/MLclf.cpython-38.pyc new file mode 100644 index 0000000..e3922b9 Binary files /dev/null and b/MLclf/__pycache__/MLclf.cpython-38.pyc differ diff --git a/MLclf/__pycache__/__init__.cpython-38.pyc b/MLclf/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..e23a093 Binary files /dev/null and b/MLclf/__pycache__/__init__.cpython-38.pyc differ