BatBot CLI

BatBot is the machine learning interface for the Kitware BatAI project. This page specifies the Command Line Interface (CLI) to interact with all of the algorithms and machine learning models that have been pretrained for inference in a production environment.

batbot

BatBot CLI

Usage

batbot [OPTIONS] COMMAND [ARGS]...

batch

Run the BatBot pipeline in batch on a list of input WAV filepaths. An example output of the JSON can be seen below.

{
    '/path/to/file1.wav': {
        'classifier': 0.5,
    },
    '/path/to/file2.wav': {
        'classifier': 0.8,
    },
    ...
}

Usage

batbot batch [OPTIONS] [FILEPATHS]...

Options

--config <config>

Which ML model to use for inference

Options:

usgs

--output <output>

Path to output JSON (if unspecified, results are printed to screen)

Arguments

FILEPATHS

Optional argument(s)

example

Run a test of the pipeline on an example WAV with the default configuration.

Usage

batbot example [OPTIONS]

fetch

Fetch the required machine learning ONNX model for the classifier

Usage

batbot fetch [OPTIONS]

Options

--config <config>

Which ML model to use for inference

Options:

usgs

pipeline

Usage

batbot pipeline [OPTIONS] FILEPATH

Options

--output <output_path>

Path to output folder for the results

Arguments

FILEPATH

Required argument

preprocess

Generate compressed spectrogram images for input wav files into the same or a specified output directory. Takes one or more space separated arguments of filepaths to process. If given a directory name argument, will recursively search through the directory and all subfolders to find all contained *.wav files. Alternatively, the argument can be given as a string using wildcard ** for folders and/or * in filenames (if ** wildcard is used, will recursively search through all subfolders).

Examples:
batbot preprocess ../data -o ./tmp
batbot preprocess “../data/**/*.wav”
batbot preprocess ../data -o ./tmp -n 32
batbot preprocess ../data -o ./tmp -n 32 -fm
batbot preprocess ../data -o ./tmp -f –dry-run –output-json dry_run.json
batbot preprocess ../data -o ./tmp –cleanup

Usage

batbot preprocess [OPTIONS] [FILEPATHS]...

Options

-o, --output-dir <output_dir>

Processed file root output directory. Outputs will attempt to mirror input file directory structure if given multiple inputs (unless –no-file-structure flag is given). Defaults to current working directory.

-m, --process-metadata

Use a slower version of the pipeline which increases spectogram compression quality and also outputs bat call metadata.

-f, --force-overwrite

Force overwriting of compressed spectrogram and other output files.

-n, --num-workers <num_workers>

Number of parallel workers to use. Set to zero for serial computation only.

--output-json <output_json>

Path to output JSON (if unspecified, output file locations are printed to screen).

-d, --dry-run

List out all the audio files to be loaded and all the anticipated output files. Additionally lists all “extra” files in the output directory that would be deleted if using the –cleanup flag.

--cleanup

For the given input filepaths and –output-dir arguments, delete any extra files that would not have been created by the batbot preprocess. Skips hidden files starting with “.”. Acts as if –force-overwrite flag is given (does not delete existing, preprocessed outputs). WARNING: This will delete files, recommend running with the –dry-run flag first and carefully examining the output!

--no-file-structure

(Not recommended) Turn off input file directory structure mirroring. All outputs will be written directly into the provided output dir. WARNING: If multiple input files have the same filename, outputs will overwrite!

Arguments

FILEPATHS

Optional argument(s)

Environment Variables

The BatBot API and CLI have two environment variables (envars) that allow you to configure global settings and configurations.

  • VERBOSE (default: not set)

    A verbosity flag that can be set to turn on debug logging. Defaults to “not set”, which translates to no debug logging. Setting this value to anything will turn on debug logging (e.g., VERBOSE=1).