示例#1
0
#resnet50: https://download.pytorch.org/models/resnet50-19c8e357.pth
imageNet_pretrain = 'resnet50-19c8e357.pth'

train_dataset = imgdataset(dataset_dir=src_dir,
                           txt_path=src_annfile,
                           transformer='train')
train_loader = DataLoader(dataset=train_dataset,
                          batch_size=batch_size,
                          shuffle=True,
                          num_workers=4,
                          drop_last=True)

train_dataset_t = imgdataset_camtrans(dataset_dir=tar_dir,
                                      txt_path=tar_annfile,
                                      transformer='train',
                                      num_cam=num_cam,
                                      K=K)
train_loader_t = DataLoader(dataset=train_dataset_t,
                            batch_size=int(batch_size / K),
                            shuffle=True,
                            num_workers=4,
                            drop_last=True)

test_dataset_t = imgdataset(dataset_dir=tar_dir_test,
                            txt_path=tar_annfile_test,
                            transformer='test')
test_loader_t = DataLoader(dataset=test_dataset_t,
                           batch_size=4,
                           shuffle=False,
                           num_workers=0)
示例#2
0
from utils.evaluate_joint_sim import evaluate_joint

os.environ["CUDA_VISIBLE_DEVICES"] = "1"

dataset_path = 'data/dataset/'
ann_file_train = 'list_market/list_market_train.txt'
ann_file_test = 'list_market/list_market_test.txt'

snapshot = 'snapshot/resnet50_duke2market_epoch00100.pth'

num_cam = 6
###########   DATASET   ###########
img_dir = dataset_path + 'Market-1501/bounding_box_train_camstyle_merge/'
train_dataset = imgdataset_camtrans(dataset_dir=img_dir,
                                    txt_path=ann_file_train,
                                    transformer='test',
                                    K=num_cam,
                                    num_cam=num_cam)
train_loader = DataLoader(dataset=train_dataset,
                          batch_size=1,
                          shuffle=False,
                          num_workers=4)

img_dir = dataset_path + 'Market-1501/'
test_dataset = imgdataset(dataset_dir=img_dir,
                          txt_path=ann_file_test,
                          transformer='test')
test_loader = DataLoader(dataset=test_dataset,
                         batch_size=1,
                         shuffle=False,
                         num_workers=4)