示例#1
0
def targets(
    ctx: click.Context,
    shapefile: str,
    record: Tuple[str, ...],
    name: str,
    every: int,
    dtype: str,
    normalise: bool,
    random_seed: int,
) -> None:
    """Build target file from shapefile."""
    record_list = list(record)
    categorical = dtype == "categorical"
    batchMB = ctx.obj.batchMB
    catching_f = errors.catch_and_exit(targets_entrypoint)
    catching_f(
        batchMB,
        shapefile,
        record_list,
        name,
        every,
        categorical,
        normalise,
        random_seed,
    )
示例#2
0
def traintest(ctx: click.Context, targets: str, split: Tuple[int, ...],
              random_seed: int, name: str, features: str,
              halfwidth: int) -> None:
    """Extract training and testing data to train and validate a model."""
    fold, nfolds = split
    catching_f = errors.catch_and_exit(traintest_entrypoint)
    catching_f(targets, fold, nfolds, random_seed, name, halfwidth,
               ctx.obj.nworkers, features, ctx.obj.batchMB)
示例#3
0
def predict(
        ctx: click.Context,
        config: str,
        checkpoint: str,
        data: str
        ) -> None:
    """Predict using a learned model."""
    catching_f = errors.catch_and_exit(predict_entrypoint)
    catching_f(config, checkpoint, data, ctx.obj.batchMB, ctx.obj.gpu)
示例#4
0
def train(
    ctx: click.Context,
    data: str,
    config: str,
    maxpoints: Optional[int],
    random_seed: int,
) -> None:
    """Train a model specified by an sklearn input configuration."""
    catching_f = errors.catch_and_exit(train_entrypoint)
    catching_f(data, config, maxpoints, random_seed, ctx.obj.batchMB)
示例#5
0
def tifs(ctx: click.Context, categorical: Tuple[str, ...],
         continuous: Tuple[str, ...], normalise: bool, name: str,
         ignore_crs: bool) -> None:
    """Build a tif stack from a set of input files."""
    nworkers = ctx.obj.nworkers
    batchMB = ctx.obj.batchMB
    cat_list = list(categorical)
    con_list = list(continuous)
    catching_f = errors.catch_and_exit(tifs_entrypoint)
    catching_f(nworkers, batchMB, cat_list, con_list, normalise, name,
               ignore_crs)
示例#6
0
def train(ctx: click.Context,
          data: str,
          config: str,
          epochs: int,
          batchsize: int,
          test_batchsize: int,
          iterations: Optional[int],
          checkpoint: Optional[str]
          ) -> None:
    """Train a model specified by a config file."""
    log.info("Ignoring batch-mb option, using specified or default batchsize")
    catching_f = errors.catch_and_exit(train_entrypoint)
    catching_f(data, config, epochs, batchsize, test_batchsize,
               iterations, ctx.obj.gpu, checkpoint)
示例#7
0
def query(
    ctx: click.Context, strip: Tuple[int, int], name: str, features: str, halfwidth: int
) -> None:
    """Extract query data for making prediction images."""
    catching_f = errors.catch_and_exit(query_entrypoint)
    catching_f(features, ctx.obj.batchMB, ctx.obj.nworkers, halfwidth, strip, name)