Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions MLclf/MLclf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -659,9 +664,4 @@ def tinyimagenet_data_raw(data_dir=None):
shuffle=True, num_workers=0)
"""








Binary file added MLclf/__pycache__/MLclf.cpython-38.pyc
Binary file not shown.
Binary file added MLclf/__pycache__/__init__.cpython-38.pyc
Binary file not shown.