use_metric_cuhk03 = False
cuhk03_classic_split = False
########################################################
if torch.cuda.is_available():
    device = torch.device("cuda")
else:
    device = torch.device("cpu")

sys.stdout = Logger(osp.join(PATH, 'log_train.txt'))

print("Dataset is being initialized")

dataset = dataset_manager.init_img_dataset(
    root='data',
    name=dataset_name,
    split_id=split_id,
    cuhk03_labeled=cuhk03_labeled,
    cuhk03_classic_split=cuhk03_classic_split,
)

tfms_train = tfms.Compose([
    tfms.Random2DTranslation(height, width),
    tfms.RandomHorizontalFlip(),
    tfms.ToTensor(),
    tfms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])

tfms_test = tfms.Compose([
    tfms.Resize(size=(height, width)),
    tfms.ToTensor(),
    tfms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
Beispiel #2
0
print_freq = 10
eval_step = 20
start_eval = 0
PATH = 'log'
use_metric_cuhk03 = False
########################################################
if torch.cuda.is_available():
    device = torch.device("cuda")
else:
    device = torch.cuda("cpu")

sys.stdout = Logger(osp.join(PATH, 'log_train.txt'))

print("Dataset is being initialized")
dataset = dataset_manager.init_img_dataset(root='data',
                                           name=dataset_name,
                                           split_id=0)

tfms_train = tfms.Compose([
    tfms.Random2DTranslation(256, 128),
    tfms.RandomHorizontalFlip(),
    tfms.ToTensor(),
    tfms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])

tfms_test = tfms.Compose([
    tfms.Resize((256, 128)),
    tfms.ToTensor(),
    tfms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])