Crop

Crops a video or labeled frames based on model predictions. Requires model predictions to already have been generated using litpose predict.

Cropped videos are saved to:

<model_dir>/
└── video_preds/
    β”œβ”€β”€ <video_filename>.csv              (predictions)
    β”œβ”€β”€ <video_filename>_bbox.csv         (bbox)
    └── remapped_<video_filename>.csv     (TODO move to remap command)
└── cropped_videos/
    └── cropped_<video_filename>.mp4      (cropped video)

Cropped images are saved to:

<model_dir>/
└── image_preds/
    └── <csv_file_name>/
        β”œβ”€β”€ predictions.csv
        β”œβ”€β”€ bbox.csv                      (bbox)
        └── cropped_<csv_file_name>.csv   (cropped labels)
└── cropped_images/
        └── a/b/c/<image_name>.png        (cropped images)

For an end-to-end usage example of the Cropzoom workflow, see the user guide: Cropzoom pipeline.

usage: litpose crop <model_dir> <input_path:video|csv>... [--crop_ratio=CROP_RATIO | --crop_size=CROP_SIZE] [--anchor_keypoints=x,y,z]

Positional Arguments

model_dir

path to a model directory

input_path

one or more files

Named Arguments

--crop_ratio

Crop a bounding box this much larger than the animal (default 2.0 when neither –crop_ratio nor –crop_size is given). Mutually exclusive with –crop_size.

--crop_size

Fixed square bounding box side length in pixels, centred on the per-frame mean of the anchor keypoints. Mutually exclusive with –crop_ratio.

--anchor_keypoints

Comma-separated list of anchor keypoint names, defaults to all keypoints

Default: ''