parser.add_argument('--no_build_summary', action='store_true', help='Dont save sammary when training to save space') parser.add_argument('--save_ckpt_freq', default=10, type=int, help='Save checkpoint frequency') parser.add_argument('--evaluate_only', action='store_true', help='Evaluate pretrained models') parser.add_argument('--no_validate', action='store_true', help='No validation') parser.add_argument('--strict', action='store_true', help='Strict mode when loading checkpoints') parser.add_argument('--val_metric', default='epe', help='Validation metric to select best model') args = parser.parse_args() logger = utils.get_logger() utils.check_path(args.checkpoint_dir) utils.save_args(args) filename = 'command_test.txt' if args.mode == 'test' else 'command_train.txt' utils.save_command(args.checkpoint_dir, filename) def main(): # For reproducibility torch.manual_seed(args.seed) torch.cuda.manual_seed(args.seed) np.random.seed(args.seed) torch.backends.cudnn.benchmark = True device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # Train loader train_transform_list = [transforms.RandomCrop(args.img_height, args.img_width), transforms.RandomColor(),
parser.add_argument('--save_type', default='png', choices=['pfm', 'png', 'npy'], help='Save file type') parser.add_argument('--visualize', action='store_true', help='Visualize disparity map') # Log parser.add_argument('--count_time', action='store_true', help='Inference on a subset for time counting only') parser.add_argument('--num_images', default=100, type=int, help='Number of images for inference') args = parser.parse_args() model_name = os.path.basename(args.pretrained_aanet)[:-4] model_dir = os.path.basename(os.path.dirname(args.pretrained_aanet)) args.output_dir = os.path.join(args.output_dir, model_dir + '-' + model_name) utils.check_path(args.output_dir) utils.save_command(args.output_dir) def main(): # For reproducibility torch.manual_seed(args.seed) torch.cuda.manual_seed(args.seed) np.random.seed(args.seed) torch.backends.cudnn.benchmark = True device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # Test loader test_transform = transforms.Compose([ transforms.ToTensor(),
# 尝试分布式训练 local_master = True if not args.distributed else args.local_rank == 0 utils.save_args(args) if local_master else None # 打印所用的参数 if local_master: logger.info('[Info] used parameters: {}'.format(vars(args))) torch.backends.cudnn.benchmark = True # https://blog.csdn.net/byron123456sfsfsfa/article/details/96003317 utils.check_path(args.checkpoint_dir) utils.save_args(args) if local_master else None filename = 'command_test.txt' if args.mode == 'test' else 'command_train.txt' utils.save_command(args.checkpoint_dir, filename) if local_master else None def main(): # For reproducibility torch.manual_seed(args.seed) torch.cuda.manual_seed(args.seed) np.random.seed(args.seed) train_loader, val_loader = getDataLoader(args, logger) # Network aanet = nets.AANet( args.max_disp, num_downsample=args.num_downsample, feature_type=args.feature_type,