def main(config):
    cudnn.benchmark = True
    if (not os.path.exists(config.model_path)):
        os.makedirs(config.model_path)
    if (not os.path.exists(config.result_path)):
        os.makedirs(config.result_path)
    config.result_path = os.path.join(config.result_path)
    if (not os.path.exists(config.result_path)):
        os.makedirs(config.result_path)
    if (config.train_dataset == 'african'):
        config.img_size = (640, 640)
    elif (config.train_dataset == 'asian'):
        config.img_size = (640, 480)
    elif (config.train_dataset == 'mobile'):
        config.img_size = (384, 384)
    print(config)
    train_loader = data.DataLoader(Train_dataset(root=config.train_path, dataset_type=config.train_dataset, img_size=config.img_size, transform=traindata_augmentation, mode='train'), batch_size=config.batch_size, shuffle=True, num_workers=config.num_workers)
    valid_loader = data.DataLoader(Train_valid_dataset(root=config.valid_path, dataset_type=config.train_dataset, img_size=config.img_size, transform=testdata_augmentation, mode='valid'), batch_size=config.batch_size, shuffle=True, num_workers=config.num_workers)
    if (config.test_mode == 1):
        test1_loader = data.DataLoader(Test1_dataset(root=config.test_path, dataset_type=config.train_dataset, img_size=config.img_size, transform=testdata_augmentation, mode='test'), batch_size=config.batch_size, shuffle=False, num_workers=config.num_workers)
    elif (config.test_mode == 2):
        test2_loader = data.DataLoader(Test2_dataset(root=config.test_path, dataset_type=config.train_dataset, img_size=config.img_size, transform=testdata_augmentation, mode='test'), batch_size=config.batch_size, shuffle=False, num_workers=config.num_workers)
    if (config.test_mode == 1):
        solver = Solver(config, train_loader, valid_loader, test1_loader)
    elif (config.test_mode == 2):
        solver = Solver(config, train_loader, valid_loader, test2_loader)
    if (config.mode == 'train'):
        solver.train()
    elif ((config.mode == 'test') and (config.test_mode == 1)):
        solver.test_1()
    elif ((config.mode == 'test') and (config.test_mode == 2)):
        solver.test_2()
def main(config):
    cudnn.benchmark = True
    if (not os.path.exists(config.model_path)):
        os.makedirs(config.model_path)
    if (not os.path.exists(config.result_path)):
        os.makedirs(config.result_path)
    config.result_path = os.path.join(config.result_path)
    if (not os.path.exists(config.result_path)):
        os.makedirs(config.result_path)
    if (config.train_dataset == 'african'):
        config.img_size = (640, 640)
    elif (config.train_dataset == 'asian'):
        config.img_size = (640, 480)
    elif (config.train_dataset == 'mobile'):
        config.img_size = (384, 384)
    print(config)
    train_loader = data.DataLoader(Train_dataset(root=config.train_path, dataset_type=config.train_dataset, img_size=config.img_size, transform=traindata_augmentation, mode='train'), batch_size=config.batch_size, shuffle=True, num_workers=config.num_workers)
    valid_loader = data.DataLoader(Train_valid_dataset(root=config.valid_path, dataset_type=config.train_dataset, img_size=config.img_size, transform=testdata_augmentation, mode='valid'), batch_size=config.batch_size, shuffle=True, num_workers=config.num_workers)
    if (config.test_mode == 1):
        test1_loader = data.DataLoader(Test1_dataset(root=config.test_path, dataset_type=config.train_dataset, img_size=config.img_size, transform=testdata_augmentation, mode='test'), batch_size=config.batch_size, shuffle=False, num_workers=config.num_workers)
    elif (config.test_mode == 2):
        test2_loader = data.DataLoader(Test2_dataset(root=config.test_path, dataset_type=config.train_dataset, img_size=config.img_size, transform=testdata_augmentation, mode='test'), batch_size=config.batch_size, shuffle=False, num_workers=config.num_workers)
    if (config.test_mode == 1):
        solver = Solver(config, train_loader, valid_loader, test1_loader)
    elif (config.test_mode == 2):
        solver = Solver(config, train_loader, valid_loader, test2_loader)
    if (config.mode == 'train'):
        solver.train()
    elif ((config.mode == 'test') and (config.test_mode == 1)):
        solver.test_1()
    elif ((config.mode == 'test') and (config.test_mode == 2)):
        solver.test_2()