dgs.models.dataset.keypoint_rcnn.KeypointRCNNBackbone

class dgs.models.dataset.keypoint_rcnn.KeypointRCNNBackbone(*args: Any, **kwargs: Any)[source]

Metaclass for the torchvision Key Point RCNN backbone model.

This class sets up the RCNN model and validates and sets the basic modules parameters.

Params

data_path (FilePath):

A single path or a list of paths. The path is either a directory, a single image file, or a list of image filepaths.

Optional Params

score_threshold (float, optional):

Detections with a score lower than the threshold will be ignored. Default DEF_VAL.dataset.kprcnn.score_threshold.

iou_threshold (float, optional):

Bounding-boxes with IoU above this threshold will be ignored. Default DEF_VAL.dataset.kprcnn.iou_threshold.

force_reshape (bool, optional):

Whether to force reshape all the input images. Change the size and mode via image_mode and image_size parameters, iff force_reshape is True. Default DEF_VAL.images.force_reshape.

image_size (ImgSize, optional):

The size, the loaded image should have, iff force_reshape is True. Default DEF_VAL.images.image_size.

image_mode (str, optional):

The mode to use when loading the image, iff force_reshape is True. Default DEF_VAL.images.image_mode.

crop_size (ImgSize, optional):

The size, the image crop should have. Default DEF_VAL.images.crop_size.

crop_mode (str, optional):

The mode to use when cropping the image. Default DEF_VAL.images.crop_mode.

bbox_min_size (float, optional):

The minimum side length a bounding box should have in pixels. Smaller detections will be discarded. Works in addition to the threshold parameter. If you do not want to discard smaller bounding boxes, make sure to set bbox_min_size to 1.0. The size of the bounding boxes is in relation to the original image. Default DEF_VAL.images.bbox_min_size.

weights (KeypointRCNN_ResNet50_FPN_Weights, optional):

The weights to load for the model. Default KeypointRCNN_ResNet50_FPN_Weights.COCO_V1.

__init__(config: dict[str, any], path: list[str]) None[source]

Methods

arbitrary_to_ds(a, idx)

Given an index, convert arbitrary data into a State or a list of States.

configure_torch_module(module[, train])

Set compute mode and send model to the device or multiple parallel devices if applicable.

get_image_crops(ds)

Add the image crops and local key-points to a given state.

get_path_in_dataset(path)

Given an arbitrary file- or directory-path, return its absolute path.

images_to_states

terminate()

Terminate this module and all of its submodules.

transform_crop_resize()

Given one single image, with its corresponding bounding boxes and key-points, obtain a cropped image for every bounding box with localized key-points.

transform_resize_image()

Given an image, bboxes, and key-points, resize them with custom modes.

validate_params(validations[, attrib_name])

Given per key validations, validate this module's parameters.

Attributes

device

Get the device of this module.

is_training

Get whether this module is set to training-mode.

module_name

Get the name of the module.

module_type

name

Get the name of the module.

name_safe

Get the escaped name of the module usable in filepaths by replacing spaces and underscores.

precision

Get the (floating point) precision used in multiple parts of this module.

model

data

Arbitrary data, which will be converted using self.arbitrary_to_ds()

dataset_path

The base path to the dataset.