Пример #1
0
def parse_args():
    parser = argparse.ArgumentParser(description='Train the SZO nowcasting model')
    parser.add_argument('--batch_size', dest='batch_size', help="batchsize of the training process",
                        default=None, type=int)
    parser.add_argument('--cfg', dest='cfg_file', help='Optional configuration file', default=None, type=str)
    parser.add_argument('--save_dir', help='The saving directory', required=True, type=str)
    parser.add_argument('--ctx', dest='ctx', help='Running Context. E.g `--ctx gpu` or `--ctx gpu0,gpu1` or `--ctx cpu`',
                        type=str, default='gpu')
    parser.add_argument('--resume', dest='resume', action='store_true', default=False)
    parser.add_argument('--resume_param_only', dest='resume_param_only', action='store_true', default=False)
    parser.add_argument('--lr', dest='lr', help='learning rate', default=None, type=float)
    parser.add_argument('--wd', dest='wd', help='weight decay', default=None, type=float)
    parser.add_argument('--grad_clip', dest='grad_clip', help='gradient clipping threshold',
                        default=None, type=float)
    args = parser.parse_args()
    args.ctx = parse_ctx(args.ctx)
    if args.cfg_file is not None:
        cfg_from_file(args.cfg_file, target=cfg.MODEL)
    if args.batch_size is not None:
        cfg.MODEL.TRAIN.BATCH_SIZE = args.batch_size
    if args.lr is not None:
        cfg.MODEL.TRAIN.LR = args.lr
    if args.wd is not None:
        cfg.MODEL.TRAIN.WD = args.wd
    if args.grad_clip is not None:
        cfg.MODEL.TRAIN.GRAD_CLIP = args.grad_clip
    if args.wd is not None:
        cfg.MODEL.TRAIN.WD = args.wd
    cfg.MODEL.SAVE_DIR = args.save_dir
    logging.info(args)
    return args
Пример #2
0
def parse_args():
    parser = argparse.ArgumentParser(
        description='Train the Meteotn nowcasting model')
    parser.add_argument('--batch_size',
                        dest='batch_size',
                        help="batchsize of the training process",
                        default=None,
                        type=int)
    parser.add_argument('--cfg',
                        dest='cfg_file',
                        help='Configuration file',
                        required=True,
                        type=str)
    parser.add_argument('--save_dir',
                        help='The saving directory',
                        required=True,
                        type=str)
    parser.add_argument(
        '--data_dir',
        help=
        'The data directory with hdf_archives folder, hdf_metadata.csv and mask.png',
        required=True,
        type=str)
    parser.add_argument(
        '--data_csv',
        help=
        'alternate metadata CSV file (default: [data_dir]/hdf_metadata.csv)',
        default=None,
        type=str)
    parser.add_argument(
        '--date_start',
        help='Start date to filter the sequences (e.g. 2010-12-31)',
        default=None,
        type=lambda s: datetime.strptime(s, '%Y-%m-%d'))
    parser.add_argument(
        '--date_end',
        help='End date to filter the sequences (e.g. 2016-12-31)',
        default=None,
        type=lambda s: datetime.strptime(s, '%Y-%m-%d'))
    parser.add_argument(
        '--ctx',
        default='cpu',
        help='Running Context. (default: %(default)s): `--ctx gpu` '
        'or `--ctx gpu0,gpu1` for GPU(s). `--ctx cpu` for CPU')
    parser.add_argument('--threshold',
                        dest='threshold',
                        help='rainfall filter threshold (default 0.28)',
                        default=None,
                        type=float)
    args = parser.parse_args()
    args.ctx = parse_ctx(args.ctx)
    if args.cfg_file is not None:
        cfg_from_file(args.cfg_file, target=cfg.MODEL)
    if args.batch_size is not None:
        cfg.MODEL.TRAIN.BATCH_SIZE = args.batch_size
    if args.threshold is not None:
        cfg.HKO.ITERATOR.FILTER_RAINFALL_THRESHOLD = float(args.threshold)
    cfg.MODEL.SAVE_DIR = args.save_dir
    logging.info(args)
    return args
Пример #3
0
def parse_args():
    parser = argparse.ArgumentParser(
        description=
        'Generate Predictions using TrajGRU model on TAASRAD19 dataset.')
    parser.add_argument('--model_cfg',
                        required=True,
                        help='Model Configuration file (yaml)')
    parser.add_argument('--model_dir',
                        required=True,
                        help='Folder with model weights')
    parser.add_argument('--model_iter',
                        required=True,
                        type=int,
                        default=99999,
                        help='Model itartion to load (default: %(default)s)')
    parser.add_argument(
        '--data_dir',
        help=
        'The data directory with hdf_archives folder, hdf_metadata.csv and mask.png',
        required=True,
        type=str)
    parser.add_argument('--save_dir',
                        default='.',
                        help='Output folder for npz files')
    parser.add_argument('--batch_size',
                        type=int,
                        default=1,
                        help='Batch size (default: %(default)s)')
    parser.add_argument(
        '--ctx',
        default='cpu',
        help='Running Context. (default: %(default)s): `--ctx gpu` '
        'or `--ctx gpu0,gpu1` for GPU(s). `--ctx cpu` for CPU')
    parser.add_argument(
        '--data_csv',
        default=None,
        help=
        'alternate metadata CSV file (default: [data_dir]/hdf_metadata.csv)')
    parser.add_argument(
        '--date_start',
        help='Start date to filter the sequences (e.g. 2017-01-01)',
        default=None,
        type=lambda s: datetime.strptime(s, '%Y-%m-%d'))
    parser.add_argument(
        '--date_end',
        help='End date to filter the sequence (e.g. 2017-03-01)',
        default=None,
        type=lambda s: datetime.strptime(s, '%Y-%m-%d'))

    args = parser.parse_args()
    args.ctx = parse_ctx(args.ctx)
    logging.info(args)
    return args
Пример #4
0
def parse_args():
    parser = argparse.ArgumentParser(
        description='Test the MovingMNIST++ dataset')
    parser.add_argument('--batch_size',
                        dest='batch_size',
                        help="batchsize of the testing process",
                        default=None,
                        type=int)
    parser.add_argument('--cfg',
                        dest='cfg_file',
                        help='Testing configuration file',
                        default=None,
                        type=str)
    parser.add_argument('--load_dir',
                        help='The loading directory',
                        default=None,
                        type=str)
    parser.add_argument('--load_iter',
                        help='The loading iterator',
                        default=None,
                        type=int)
    parser.add_argument('--save_dir',
                        help='The saving directory',
                        required=True,
                        type=str)
    parser.add_argument(
        '--ctx',
        dest='ctx',
        help=
        'Running Context. E.g `--ctx gpu` or `--ctx gpu0,gpu1` or `--ctx cpu`',
        type=str,
        default='gpu')
    args = parser.parse_args()
    args.ctx = parse_ctx(args.ctx)
    if args.cfg_file is not None:
        cfg_from_file(args.cfg_file, target=cfg)
    if args.load_dir is not None:
        cfg.MODEL.LOAD_DIR = args.load_dir
    if args.load_iter is not None:
        cfg.MODEL.LOAD_ITER = args.load_iter
    cfg.MODEL.SAVE_DIR = args.save_dir
    logging.info(args)
    return args
Пример #5
0
def parse_args():
    parser = argparse.ArgumentParser(description='Test the HKO nowcasting model')
    parser.add_argument('--cfg', dest='cfg_file', help='Optional configuration file', type=str)
    parser.add_argument('--load_dir', help='The directory to load the model', default=None, type=str)
    parser.add_argument('--load_iter', help='The iterator to load', default=-1, type=int)
    parser.add_argument('--save_dir', help='The saving directory', required=True, type=str)
    parser.add_argument('--ctx', dest='ctx', help='Running Context. E.g `--ctx gpu` or `--ctx gpu0,gpu1` or `--ctx cpu`',
                        type=str, default='gpu')
    parser.add_argument('--finetune', dest='finetune', help='Whether to do online finetuning',
                        default=None, type=int)
    parser.add_argument('--finetune_min_mse', dest='finetune_min_mse', help='Minimum error for finetuning',
                        default=None, type=float)
    parser.add_argument('--mode', dest='mode', help='Whether to used fixed setting or online setting',
                        required=True, type=str)
    parser.add_argument('--dataset', dest='dataset', help='Whether to used the test set or the validation set',
                        default="test", type=str)
    parser.add_argument('--lr', dest='lr', help='learning rate', default=None, type=float)
    parser.add_argument('--wd', dest='wd', help='weight decay', default=None, type=float)
    parser.add_argument('--grad_clip', dest='grad_clip', help='gradient clipping threshold',
                        default=None, type=float)
    args = parser.parse_args()
    args.ctx = parse_ctx(args.ctx)
    if args.cfg_file is not None:
        cfg_from_file(args.cfg_file, target=cfg.MODEL)
    if args.load_dir is not None:
        cfg.MODEL.LOAD_DIR = args.load_dir
    if args.load_iter != -1:
        cfg.MODEL.LOAD_ITER = args.load_iter
    if args.lr is not None:
        cfg.MODEL.TEST.ONLINE.LR = args.lr
    if args.wd is not None:
        cfg.MODEL.TEST.ONLINE.WD = args.wd
    if args.grad_clip is not None:
        cfg.MODEL.TEST.ONLINE.GRAD_CLIP = args.grad_clip
    if args.mode is not None:
        cfg.MODEL.TEST.MODE = args.mode
    if args.finetune is not None:
        cfg.MODEL.TEST.FINETUNE = (args.finetune != 0)
    if args.finetune_min_mse is not None:
        cfg.MODEL.TEST.ONLINE.FINETUNE_MIN_MSE = args.finetune_min_mse
    cfg.MODEL.SAVE_DIR = args.save_dir
    logging.info(args)
    return args
Пример #6
0
def parse_args():
    parser = argparse.ArgumentParser(
        description="Test the SST nowcasting model")
    parser.add_argument("--cfg",
                        dest="cfg_file",
                        help="Optional configuration file",
                        type=str)
    parser.add_argument("--load_dir",
                        help="The directory to load the model",
                        default=None,
                        type=str)
    parser.add_argument("--load_iter",
                        help="The iterator to load",
                        default=-1,
                        type=int)
    parser.add_argument("--save_dir",
                        help="The saving directory",
                        required=True,
                        type=str)
    parser.add_argument(
        "--ctx",
        dest="ctx",
        help=
        "Running Context. E.g `--ctx gpu` or `--ctx gpu0,gpu1` or `--ctx cpu`",
        type=str,
        default="gpu",
    )
    parser.add_argument(
        "--finetune",
        dest="finetune",
        help="Whether to do online finetuning",
        default=None,
        type=int,
    )
    parser.add_argument(
        "--finetune_min_mse",
        dest="finetune_min_mse",
        help="Minimum error for finetuning",
        default=None,
        type=float,
    )
    parser.add_argument(
        "--mode",
        dest="mode",
        help="Whether to used fixed setting or online setting",
        required=True,
        type=str,
    )
    parser.add_argument(
        "--dataset",
        dest="dataset",
        help="Whether to used the test set or the validation set",
        default="test",
        type=str,
    )
    parser.add_argument("--lr",
                        dest="lr",
                        help="learning rate",
                        default=None,
                        type=float)
    parser.add_argument("--wd",
                        dest="wd",
                        help="weight decay",
                        default=None,
                        type=float)
    parser.add_argument(
        "--grad_clip",
        dest="grad_clip",
        help="gradient clipping threshold",
        default=None,
        type=float,
    )
    args = parser.parse_args()
    args.ctx = parse_ctx(args.ctx)
    if args.cfg_file is not None:
        cfg_from_file(args.cfg_file, target=cfg.MODEL)
    if args.load_dir is not None:
        cfg.MODEL.LOAD_DIR = args.load_dir
    if args.load_iter != -1:
        cfg.MODEL.LOAD_ITER = args.load_iter
    if args.lr is not None:
        cfg.MODEL.TEST.ONLINE.LR = args.lr
    if args.wd is not None:
        cfg.MODEL.TEST.ONLINE.WD = args.wd
    if args.grad_clip is not None:
        cfg.MODEL.TEST.ONLINE.GRAD_CLIP = args.grad_clip
    if args.mode is not None:
        cfg.MODEL.TEST.MODE = args.mode
    if args.finetune is not None:
        cfg.MODEL.TEST.FINETUNE = args.finetune != 0
    if args.finetune_min_mse is not None:
        cfg.MODEL.TEST.ONLINE.FINETUNE_MIN_MSE = args.finetune_min_mse
    cfg.MODEL.SAVE_DIR = args.save_dir
    logging.info(args)
    return args
Пример #7
0
def parse_args():
    parser = argparse.ArgumentParser(
        description="Train the SST nowcasting model")
    parser.add_argument(
        "--batch_size",
        dest="batch_size",
        help="batchsize of the training process",
        default=None,
        type=int,
    )
    parser.add_argument(
        "--cfg",
        dest="cfg_file",
        help="Optional configuration file",
        default=None,
        type=str,
    )
    parser.add_argument("--save_dir",
                        help="The saving directory",
                        required=True,
                        type=str)
    parser.add_argument(
        "--ctx",
        dest="ctx",
        help=
        "Running Context. E.g `--ctx gpu` or `--ctx gpu0,gpu1` or `--ctx cpu`",
        type=str,
        default="gpu",
    )
    parser.add_argument("--lr",
                        dest="lr",
                        help="learning rate",
                        default=None,
                        type=float)
    parser.add_argument("--wd",
                        dest="wd",
                        help="weight decay",
                        default=None,
                        type=float)
    parser.add_argument(
        "--grad_clip",
        dest="grad_clip",
        help="gradient clipping threshold",
        default=None,
        type=float,
    )
    args = parser.parse_args()
    args.ctx = parse_ctx(args.ctx)
    if args.cfg_file is not None:
        cfg_from_file(args.cfg_file, target=cfg.MODEL)
    if args.batch_size is not None:
        cfg.MODEL.TRAIN.BATCH_SIZE = args.batch_size
    if args.lr is not None:
        cfg.MODEL.TRAIN.LR = args.lr
    if args.wd is not None:
        cfg.MODEL.TRAIN.WD = args.wd
    if args.grad_clip is not None:
        cfg.MODEL.TRAIN.GRAD_CLIP = args.grad_clip
    if args.wd is not None:
        cfg.MODEL.TRAIN.WD = args.wd
    cfg.MODEL.SAVE_DIR = args.save_dir
    logging.info(args)
    return args