Skip to content

Commit

Permalink
Remove random transformations from mock datasets in PT classification (
Browse files Browse the repository at this point in the history
…openvinotoolkit#929)

This will allow to make results with mock datasets more stable
  • Loading branch information
kshpv committed Sep 15, 2021
1 parent 4bc7b2f commit ced4a84
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions examples/torch/classification/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def create_datasets(config):

input_info_list = create_input_infos(config)
image_size = input_info_list[0].shape[-1]

size = int(image_size / 0.875)
if dataset_config in ['cifar10', 'cifar100']:
val_transform = transforms.Compose([
transforms.ToTensor(),
Expand All @@ -401,8 +401,20 @@ def create_datasets(config):
transforms.ToTensor(),
normalize,
])
elif dataset_config in ['mock_32x32', 'mock_299x299']:
val_transform = transforms.Compose([
transforms.Resize(size),
transforms.CenterCrop(image_size),
transforms.ToTensor(),
normalize,
])
train_transforms = transforms.Compose([
transforms.Resize(size),
transforms.CenterCrop(image_size),
transforms.ToTensor(),
normalize,
])
else:
size = int(image_size / 0.875)
val_transform = transforms.Compose([
transforms.Resize(size),
transforms.CenterCrop(image_size),
Expand Down

0 comments on commit ced4a84

Please sign in to comment.