np.random.seed(args.manualSeed) torch.manual_seed(args.manualSeed) if cfg.CUDA: torch.cuda.manual_seed_all(args.manualSeed) ########################################################################## output_dir = '../output/%s' % (cfg.CONFIG_NAME) model_dir = os.path.join(output_dir, 'Model') image_dir = os.path.join(output_dir, 'Image') log_dir = os.path.join(output_dir, 'Log') mkdir_p(model_dir) mkdir_p(image_dir) mkdir_p(log_dir) logger = setup_logger(name=cfg.CONFIG_NAME, save_dir=log_dir) torch.cuda.set_device(cfg.GPU_ID) cudnn.benchmark = True # Get data loader ################################################## imsize = cfg.TREE.BASE_SIZE * (2**(cfg.TREE.BRANCH_NUM - 1)) batch_size = cfg.TRAIN.BATCH_SIZE if cfg.TRAIN.TRANS == 'org': image_transform = transforms.Compose([ transforms.Scale(int(imsize * 76 / 64)), transforms.RandomCrop(imsize), transforms.RandomHorizontalFlip() ]) else: image_transform = transforms.Compose([
if args.data_dir != '': cfg.DATA_DIR = args.data_dir assert 'real' in cfg.CONFIG_NAME output_dir = '../output/%s_%s' % \ (cfg.DATASET_NAME, cfg.CONFIG_NAME) log_dir = output_dir + '/log' mkdir_p(output_dir) mkdir_p(output_dir + '/imgs') mkdir_p(output_dir + '/models') mkdir_p(log_dir) logger = setup_logger(cfg.CONFIG_NAME, log_dir) logger.info('Using config:') logger.info(str(cfg)) if not cfg.TRAIN.FLAG: args.manualSeed = 100 elif args.manualSeed is None: args.manualSeed = 100 #args.manualSeed = random.randint(1, 10000) logger.info("seed now is : ", str(args.manualSeed)) random.seed(args.manualSeed) np.random.seed(args.manualSeed) torch.manual_seed(args.manualSeed) #if cfg.CUDA: torch.cuda.manual_seed_all(args.manualSeed)
cfg.GPU_ID = args.gpu_id if args.data_dir != '': cfg.DATA_DIR = args.data_dir output_dir = '../output/%s_%s' % \ (cfg.DATASET_NAME, cfg.CONFIG_NAME) log_dir = output_dir + '/log' mkdir_p(output_dir) mkdir_p(output_dir+'/imgs') mkdir_p(output_dir+'/models') mkdir_p(log_dir) #logger = setup_logger(cfg.CONFIG_NAME,log_dir) logger = setup_logger(cfg.CONFIG_NAME,'') logger.info('Using config:') logger.info(cfg) if not cfg.TRAIN.FLAG: args.manualSeed = 100 elif args.manualSeed is None: args.manualSeed = 100 #args.manualSeed = random.randint(1, 10000) logger.info("seed now is : ",args.manualSeed) random.seed(args.manualSeed) np.random.seed(args.manualSeed) torch.manual_seed(args.manualSeed) if cfg.CUDA: torch.cuda.manual_seed_all(args.manualSeed)