diplomat.processing.Pose
- class diplomat.processing.Pose(x: ndarray, y: ndarray, prob: ndarray)[source]
Bases:
objectClass defines the Poses for given amount of frames and body parts… Note that pose has no concept of multiple predictions for body part, but rather simply expects the multiple predictions to be stored side-by-side as multiple body parts. Also, it should be noted that data is stored in terms of original video coordinates, not probability source map indexes.
- __init__(x: ndarray, y: ndarray, prob: ndarray)[source]
Create a new Pose object, or batch of poses for frames.
- Parameters:
x – All x video coordinates for these poses, in ndarray indexing format frame -> body part -> x-value
y – All y video coordinates for these poses, in ndarray indexing format frame -> body part -> y-value
prob – All probabilities for these poses, in ndarray indexing format frame -> body part -> p-value
Methods
__init__(x, y, prob)Create a new Pose object, or batch of poses for frames.
empty_pose(frame_count, part_count)Returns an empty pose object, or a pose object with numpy arrays full of zeros.
get_all()Returns all data combined into a numpy array.
Returns probability data for all frames and body parts...
Returns x video coordinates for all frames and body parts.
Returns y video coordinates for all frames and body parts.
Gets the amount of body parts per frame in this pose object
Returns the amount of frames in this pose object
get_prob_at(frame, bodypart)Get the probability values for specific body parts or frames.
get_x_at(frame, bodypart)Get the x video coordinates for specific body parts or frames.
get_y_at(frame, bodypart)Get the y video coordinates for specific body parts or frames.
set_all_prob(probs)Set the probability values of this batch of Poses
set_all_x(x)Set the x video coordinates of this batch of Poses.
set_all_y(y)Sets the y video coordinates of this batch of Poses.
set_at(frame, bodypart, scmap_coord, offset, ...)Set the probability data at a given location or locations to the specified data.
set_at_no_offset(frame, bodypart, ...[, ...])Set the probability data at a given location or locations to the specified data.
set_prob_at(frame, bodypart, values)Set the probability values for specific body parts or frames.
set_x_at(frame, bodypart, values)Set the x video coordinates for specific body parts or frames.
set_y_at(frame, bodypart, values)Set the y video coordinates for specific body parts or frames.
Attributes
FloatPointDataalias of
Tuple[float|ndarray,float|ndarray]Indexalias of
int|slicePointDataalias of
Tuple[int|ndarray,int|ndarray]- classmethod empty_pose(frame_count: int, part_count: int) Pose[source]
Returns an empty pose object, or a pose object with numpy arrays full of zeros. It will have space for “frame_count” frames and “part_count” body parts.
- Parameters:
frame_count – The amount of frames to allocate space for in the underlying array, an Integer.
part_count – The amount of body parts to allocate space for in the underlying array, an Integer.
- Returns:
A new Pose object.
- get_all() ndarray[source]
Returns all data combined into a numpy array. Note method is mostly useful to DLC, not Predictor plugins.
- Returns:
A numpy array with indexing of the dimensions: [frame -> x, y or prob every 3-slots].
- get_all_prob() ndarray[source]
Returns probability data for all frames and body parts…
- Returns:
The probability data for all frames and body parts…
- get_all_x() ndarray[source]
Returns x video coordinates for all frames and body parts.
- Returns:
The x video coordinates for all frames and body parts…
- get_all_y() ndarray[source]
Returns y video coordinates for all frames and body parts.
- Returns:
The y video coordinates for all frames and body parts…
- get_bodypart_count() int[source]
Gets the amount of body parts per frame in this pose object
- Returns:
The amount of body parts per frame, as an integer.
- get_frame_count() int[source]
Returns the amount of frames in this pose object
- Returns:
An integer, being the amount of total frames stored in this pose
- get_prob_at(frame: int | slice, bodypart: int | slice) ndarray[source]
Get the probability values for specific body parts or frames.
- Parameters:
frame – The frame index, can be a slice or integer
bodypart – The body part index, can be a slice or integer
- Returns:
The probability values for the given frames, in the form of a numpy array…
- get_x_at(frame: int | slice, bodypart: int | slice) ndarray[source]
Get the x video coordinates for specific body parts or frames.
- Parameters:
frame – The frame index, can be a slice or integer
bodypart – The body part index, can be a slice or integer
- Returns:
The x video coordinates for the given frames, in the form of a numpy array…
- get_y_at(frame: int | slice, bodypart: int | slice) ndarray[source]
Get the y video coordinates for specific body parts or frames.
- Parameters:
frame – The frame index, can be a slice or integer
bodypart – The body part index, can be a slice or integer
- Returns:
The y video coordinates for the given frames, in the form of a numpy array…
- set_all_prob(probs: ndarray)[source]
Set the probability values of this batch of Poses
- Parameters:
probs – An ndarray with same dimensions as this Pose object, providing all probability values for given x, y video coordinates…
- set_all_x(x: ndarray)[source]
Set the x video coordinates of this batch of Poses.
- Parameters:
x – A ndarray with the same dimensions as this Pose object, providing all x video coordinates…
- set_all_y(y: ndarray)[source]
Sets the y video coordinates of this batch of Poses.
- Parameters:
y – An ndarray with same dimensions as this pose object, providing all y video coordinates…
- set_at(frame: int | slice, bodypart: int | slice, scmap_coord: Tuple[int | ndarray, int | ndarray], offset: Tuple[float | ndarray, float | ndarray] | None, prob: float | ndarray, down_scale: int = 1)[source]
Set the probability data at a given location or locations to the specified data.
- Parameters:
frame – The index of the frame or frames to set, an integer or a slice.
bodypart – The index of the bodypart or bodyparts to set, integer or a slice
scmap_coord – The source map index to set this Pose’s location to, specifically the index directly selected from the downscaled source map stored in the TrackingData object. It is a tuple of two integer or numpy arrays representing x and y coordinates…
offset – The offset of the source map point once scaled to fit the video. This data should be collected using get_offset_map in the TrackingData object. Is a tuple of x and y floating point coordinates, or numpy arrays of floating point coordinates.
prob – The probabilities to be set in this Pose object, between 0 and 1. Is a numpy array of floating point numbers or a single floating point number.
down_scale – The downscale factor of the original source map relative to the video, an integer. this is typically collected from the method TrackingData.get_down_scaling(). Ex. Value of 8 means TrackingData probability map is 1/8th the size of the original video.
- Returns:
Nothing…
- set_at_no_offset(frame: int | slice, bodypart: int | slice, scmap_coord: Tuple[int | ndarray, int | ndarray], prob: float | ndarray, down_scale: int = 1)[source]
Set the probability data at a given location or locations to the specified data.
- Parameters:
frame – The index of the frame or frames to set, an integer or a slice.
bodypart – The index of the bodypart or bodyparts to set, integer or a slice
scmap_coord – The source map index to set this Pose’s location to, specifically the index directly selected from the downscaled source map stored in the TrackingData object, including the offset. It is a tuple of two floats or numpy arrays of floats representing exact x and y coordinates. They are assumed to be downscaled, so they are multiplied by the downscale factor.
prob – The probabilities to be set in this Pose object, between 0 and 1. Is a numpy array of floating point numbers or a single floating point number.
down_scale – The downscale factor of the original source map relative to the video, an integer. this is typically collected from the method TrackingData.get_down_scaling(). Ex. Value of 8 means TrackingData probability map is 1/8th the size of the original video.
- Returns:
Nothing…
- set_prob_at(frame: int | slice, bodypart: int | slice, values: ndarray)[source]
Set the probability values for specific body parts or frames.
- Parameters:
frame – The frame index, can be a slice or integer
bodypart – The body part index, can be a slice or integer
values – The values to set this pose’s probabilities to, as a numpy array…
- set_x_at(frame: int | slice, bodypart: int | slice, values: ndarray)[source]
Set the x video coordinates for specific body parts or frames.
- Parameters:
frame – The frame index, can be a slice or integer
bodypart – The body part index, can be a slice or integer
values – The values to set this Pose’s x video coordinates to, as a numpy array…
- set_y_at(frame: int | slice, bodypart: int | slice, values: ndarray)[source]
Set the y video coordinates for specific body parts or frames.
- Parameters:
frame – The frame index, can be a slice or integer
bodypart – The body part index, can be a slice or integer
values – The values to set this Pose’s y video coordinates to, as a numpy array…