Command-line interface¶
Most configuration for camfi is done with a configuration file rather than with command-line arguments and options. Documentation for the configuration can be found here: Configuration.
Camfi makes a bunch of sub-commands available to the command line (listed below). If multiple commands are given to a single camfi command, they will be executed in sequence. For example, the command:
$ camfi \
--input project.json --root datadir \
--output project_with_wingbeats.json \
load-exif extract-wingbeats write
will first load a VIA project from a file, then load EXIF metadata from the image files (in datadir) into the project (load-exif), then the camfi wingbeat extraction algoritm will be run to obtain wingbeat frequencies (extract-wingbeats), and finally the project will be written to project_with_wingbeats.json (write).
Another command:
$ camfi train annotate validate
would load a VIA project from a file, train an instance segmentation model using the images and (manually obtained) annotations in the project, and save the new model to disk (train). Then camfi would re-annotate (annotate) the images in the project using the newly trained model, saving the newly obtained annotations to a new file (assuming annotator is properly configured). Finally, camfi would validate the automatically-obtained annotations against the manually-obtained ones (validate). All this, while properly handling keeping training and test image sets separate where required (and as per the configuration).
usage: camfi [-h] [--version] [-c path] [-i path] [-o path] [-r dir] [-d] [-p]
[-j path] [-y path] [-q] [-v]
[command ...]
Positional Arguments¶
- command
Possible choices: annotate, do-nothing, extract-wingbeats, filelist, filter-images, filter-regions, image-table, load-exif, region-table, table, train, validate, write, zip-images
One or more commands to be executed sequentially by camfi. Each command uses the same configuration, as specified by
-c/--config.Default: “do-nothing”
Named Arguments¶
- --version
Show version and exit.
Default: False
- -c, --config
Path to configuration file. Can be JSON (.json) or StrictYAML (.yaml|.yml). If no configuration file is supplied, a default (empty) configuration is used. Most commands require at least some configuration.
- -i, --input
Path to input VIA project file. Replaces
via_project_filein configuration file, providing an alternative to setting it in the configuration file.- -o, --output
Path to output file. Replaces
default_outputin configuration file, providing an alternative to setting specific outputs in the configuration file.- -r, --root
Directory containing all images for the project. Replaces
rootin configuration file.- -d, --disable-progress-bar
Disables progress bars. By default, disable on non-TTY.
- -p, --progress-bar
Forces progress bars. By default, disable on non-TTY.
- -j, --json-conf-out
If set, configuration will be written to file in JSON format after it is parsed. Set to - to have config written to stdout.
- -y, --yaml-conf-out
If set, configuration will be written to file in StrictYAML format after it is parsed. Set to - to have config written to stdout.
- -q, --quiet
Suppress cli info. You may also like to use
-d.Default: False
- -v, --verbose
Extra verbose cli info.
Default: False
Below are the list of commands available to Camfi.
- annotate
Performs automatic annotation on all the images in via_project, outputting the resulting annotated VIA project file to the configured
output_pathspecified underannotator.inferencein the configuration file. Requiresannotator.inferenceto be configured. While not strictly required,annotator.inference.output_pathshould be configured, otherwise the result of annotation will not be saved before the program terminates (and this is probably not what you want). Alternatively, you can configuredefault_outputeither in the configuration file or by using the-o/--outputflag.- do-nothing
Does nothing, except parse options and configuration. This can be useful if all you want to do is validate and/or convert the configuration file. This is the default command which is run when
camfiis called.- extract-wingbeats
Runs the Camfi algorithm to extract wingbeat data from all images in the VIA project, inserting that data into the project in-place. Requires
cameraandwingbeat_extractionto be configured.- filelist
Lists the images in the VIA project to stdout or file (set using
default_outputconfiguration parameter or-o/--output).- filter-images
Applies filters to exclude images from VIA project. Operates in-place on the VIA project. Does nothing if
filters.image_filtersisn’t configured.- filter-regions
Applies filters to exclude regions (annotations) from VIA project. Operates in-place on the VIA project. Does nothing if
filters.region_filtersisn’t configured.- image-table
Produces a table with one row per image, with various image metadata columns, including n_annotations (the number of annotations in the image). Table is written to stout or file (set using
default_outputconfiguration parameter or-o/--output).- load-exif
Loads EXIF metadata into VIA project in-place after reading it from file. If
time(and optionallycamera) are configured, then this will also insert location and corrected timestamp metadata.- region-table
Produces a table with one row per region (annotation). Table is written to stout or file (set using
default_outputconfiguration parameter or-o/--output).- table
Similar to
image-table, but includes weather and sun time columns. Produces a table with one row per image, with various image metadata columns, including n_annotations (the number of annotations in the image). Table is written to stout or file (set usingdefault_outputconfiguration parameter or-o/--output).- train
Trains a camfi instance segmentation annotation model on manually annotated dataset, saving to trained model to the
outdirconfigured underannotator.training. Requiresannotator.trainingto be configured. Ifannotator.inferenceis configured, but under itmodelhas not been explicitely set, then after the model is trainedmodelofannotator.inferencewill be set to the newly trained model. This means that with proper configuration,trainandannotatecan be strung together in one command (i.e.camfi train annotate).- validate
Validates automatically aquired annotations against ground-truth annotations, saving the results to the
output_dirconfigured underannotator.validation. Requiresannotator.validationto be configured. While not strictly required,annotator.validation.output_dirshould be configured, otherwise the result of validation will not be saved before the program terminates (and this is probably not what you want). Ifimage_setunderannotator.validationcontains “train” or “test”, thentest_set(ortest_set_file) underannotator.trainingshould also be configured. Ifannotator.trainingis not set, then the “train”image_setwill be equivalent to “all”, and “test” will be an empty set of images. It is also possible to leaveautoannotated_via_project_fileunderannotator.validationunconfigured. In this case, theoutput_pathfromannotation.inferencewill be validated (so at least one of these must be configured). Alternatively, you can configuredefault_outputeither in the configuration file or by using the-o/--outputflag.- write
Writes VIA project to stdout or file (set using
default_outputconfiguration parameter or-o/--output). Can be used after other commands which act in-place on the VIA project (e.g.load- exif,extract-wingbeatsandapply-filters). Prints to stdout if no output is given.- zip-images
Makes a zip archive of all the images in the VIA project file (
default_outputconfiguration parameter or-o/--outputmust be set).