Skip to content

command line

Amira Burns edited this page Feb 20, 2025 · 1 revision

Deploy CameraTrapDetector Version 3 Models on the command line for faster runtime and optimal use with GPU or HPC systems.

Prerequisites: please confirm you have Python installed by opening a terminal and typing python or py. If you do not see a message confirming a Python version, download and install Python v>=3.5 before proceeding.

  1. Download the model zip folder named species_v3_cl and containing command line deployment files.
  2. Unzip the folder in an accessible location. Confirm you have the following files: deploy_model_v3.py, requirements.txt, and weights.pt
  3. Open a terminal.
  4. Navigate to the model folder using the cd command:
    cd /path/to/dir/species_v3_cl
  5. Create a new python environment with the command: python -m venv <environment_name> replacing the environment name with one of your choosing. For this example, we will proceed with the name deploy_ctd
    python -m venv deploy_ctd
  6. Activate the new environment
    a. Windows: deploy_ctd/Scripts/activate
    b. Mac / Linux: source deploy_ctd/bin/activate
  7. Install required packages from the requirements.txt file (now is a good time to take a break while packages install): pip install -r requirements.txt
  8. Review the script arguments with the command: python deploy_model_v3.py –help
    image
  9. Run the model with desired arguments as detailed in the output from Step 8. Note that model_file and image_dir are required arguments, all other arguments are optional. See below for sample output of model run on 6 test images, which completed on a single CPU in under 2 seconds. image

Clone this wiki locally