HeatmapDatasetο
- class lightning_pose.data.datasets.HeatmapDataset[source]ο
Bases:
BaseTrackingDatasetHeatmap dataset that contains the images and keypoints in 2D arrays.
Attributes Summary
Methods Summary
compute_heatmap(example_dict[,Β ignore_nans])Compute 2D heatmaps from arbitrary (x, y) coordinates.
Compute initial 2D heatmaps for all labeled data.
Attributes Documentation
- output_shapeο
Methods Documentation
- compute_heatmap(example_dict: BaseLabeledExampleDict, ignore_nans: bool = False) Tensor, {'__torchtyping__': True, 'details': ('num_keypoints', 'heatmap_height', 'heatmap_width',), 'cls_name': 'TensorType'}][source]ο
Compute 2D heatmaps from arbitrary (x, y) coordinates.
- compute_heatmaps()[source]ο
Compute initial 2D heatmaps for all labeled data. Note this will apply augmentations.
original image dims e.g., (406, 396) -> resized image dims e.g., (384, 384) -> potentially downsampled heatmaps e.g., (96, 96)
- __init__(root_directory: str, csv_path: str, image_resize_height: int, image_resize_width: int, header_rows: list[int] | None = [0, 1, 2], imgaug_transform: Callable | None = None, downsample_factor: Literal[1, 2, 3] = 2, do_context: bool = False, resize: bool = True, uniform_heatmaps: bool = False, bbox_path: str | None = None) None[source]ο
Initialize the Heatmap Dataset.
- Parameters:
root_directory β path to data directory
csv_path β path to CSV or h5 file (within root_directory). CSV file should be in the form (image_path, bodypart_1_x, bodypart_1_y, β¦, bodypart_n_y) Note: image_path is relative to the given root_directory
image_resize_height β height to resize images before sending to network
image_resize_width β height to resize images before sending to network
header_rows β which rows in the csv are header rows
imgaug_transform β imgaug transform pipeline to apply to images
downsample_factor β factor by which to downsample original image dims to have a smaller heatmap
do_context β include additional frames of context if possible
resize β True to add final resizing augmentation before sending data to network. This can be set to False if inheritors of this class need to implement more sophisticated augmentations before resizing (e.g. 3d augmentations). Note that when this is False, it is up to the child class to perform this resizing on both images and keypoints before returning a batch of data.
uniform_heatmaps β True to force the model to output uniform heatmaps for missing data; False will output all-zero heatmaps
bbox_path β path to csv file that contains bounding box information; rows must be in same order as csv file
- __new__(**kwargs)ο