Skip to content

Latest commit

 

History

History
67 lines (45 loc) · 2.69 KB

File metadata and controls

67 lines (45 loc) · 2.69 KB

SpeciesNet CLI

speciesnet-cli is a CLI for running a cameratrapai ensemble written in Rust.

Installation

Cargo

cargo install --git https://github.com/zubalis/speciesnet-rust.git --path speciesnet-cli

Cargo features

  • download-model, enabled by default, downloads the ONNX-converted detector and classifier model automatically to be used, you will have to manually pass the path to the extracted model folder in order to run the program if this feature is turned off.

Usage

The CLI is designed to be pretty similar to how google/cameratrapai is, except there are some differences as we're working towards the python equivalent.

  • The input instance file only support filepath, country, and admin1_region keys.
  • The classifier output only support the classes, and scores key.
  • Other keys of predictions are still not supported on both reading from and writing to files.
  • The Rust version does not override or edit an existing predictions.json file, if one is found when supplied using --predictions-json, CLI will error saying the file already existed.
  • The CLI flag --country and --admin1-region currently does nothing to the input.

The following examples show how to run speciesnet-cli compared to cameratrapai.

Running only the detector

# cameratrapai.
python3 -m speciesnet.scripts.run_model --instance_json ./instances.json --predictions_json ./predictions.json --detector_only

# speciesnet-rust.
speciesnet-cli --instances-json ./instances.json --predictions-json ./predictions.json --detector-only

Running only the classifier

# cameratrapai.
python3 -m speciesnet.scripts.run_model --instance_json ./instances.json --predictions_json ./predictions.json --classifier_only

# speciesnet-rust.
speciesnet-cli --instances-json ./instances.json --predictions-json ./predictions.json --classifier-only

Running only the ensemble

# cameratrapai.
python3 -m speciesnet.scripts.run_model --instance_json ./instances.json --classifications_json ./output_classifier.json --detections_json ./output_detector.json --predictions_json ./predictions.json --ensemble_only

# speciesnet-rust.
speciesnet-cli --instances-json ./instances.json --classifications-json ./output_classifier.json --detections-json ./output_detector.json --predictions-json ./predictions.json --ensemble-only

Running the whole inference pipeline

# cameratrapai.
python3 -m speciesnet.scripts.run_model --instance_json ./instances.json --predictions_json ./predictions.json

# speciesnet-rust.
speciesnet-cli --instances-json ./instances.json --predictions-json ./predictions.json