dgs.models.dataset.posetrack21.extract_crops_from_json_annotation¶
- dgs.models.dataset.posetrack21.extract_crops_from_json_annotation(base_dataset_path: str, json_file: str, crops_dir: str, individually: bool = False, **kwargs) None [source]¶
Given the path to a json file containing images and annotations in the PT21 style, extract all the bbox image crops.
- Parameters:
base_dataset_path (FilePath) – The absolute path to the base of the dataset.
json_file (FilePath) – The absolute path to the json file containing the annotations.
crops_dir (FilePath) – The absolute path to the directory containing all the crops of the current dataset-split.
individually (bool) – Whether to load and crop the images all at once or individually. If the sizes of the images in one json file don’t match, individually has to be set to True. Default False.
- Keyword Arguments:
check_img_sizes (bool) – Whether to check if all images in a given folder have the same size before stacking them for cropping. Default
DEF_VAL.dataset.pt21.check_img_sizes
.device (Device) – Device to run the cropping on. Defaults to “cuda” if available “cpu” otherwise.
Notes
For more kwargs see
extract_crops_from_images()
.Notes
The image crops are saved in subfolders of the
crops
folder equal to the original structure of the images’ directory. The name of the image crops is:{image_id}_{person_id}.jpg
. The name of the file containing the local keypoints is:{image_id}_{person_id}.pt
.