experimenting.utils package

Submodules

experimenting.utils.cv_helpers module

experimenting.utils.cv_helpers.get_heatmaps_steps(xyz, p_mat, width, height)
Args
xyz :

xyz coordinates as 3XNUM_JOINTS wrt world coord system

p_mat :

projection matrix from world to image plane

width :

width of the resulting frame

height :

height of the resulting frame

Returns

xyz wrf image coord system, uv image points of skeleton’s joints, uv mask

experimenting.utils.cv_helpers.decompose_projection_matrix(P)

QR decomposition of world2imageplane projection matrix

Args
P :

Projection matrix word 2 image plane

Returns

M matrix, camera matrix

experimenting.utils.cv_helpers.reproject_xyz_onto_world_coord(xyz, M, invert_z_axis=True)
Parameters
  • M – World to camera projection matrix

  • xyz – Skeleton joints as NUM_JOINTSx3

Returns

Skeleton joints reprojected in world coord system with shape NUM_JOINTSx3

experimenting.utils.cv_helpers.project_xyz_onto_camera_coord(xyz: torch.Tensor, M: torch.Tensor, invert_z_axis=True) → torch.Tensor
Args
xyz :

xyz coordinates as NUM_JOINTSx3 wrt world coord

M :

word2cam EXTRINSIC matrix

Returns

xyz coordinates projected onto cam coordinates system

experimenting.utils.cv_helpers.compose_projection_matrix(K, M)

Compose intrinsics (K) and extrinsics (M) parameters to get a projection matrix

experimenting.utils.dsntnn module

Differentiable DSNT operations for use in PyTorch computation graphs. Author: A. Nibali Url: https://github.com/anibali/margipose License: Apache

experimenting.utils.dsntnn.js_reg_losses(heatmaps, mu_t, sigma_t)

Calculate Jensen-Shannon divergences between heatmaps and target Gaussians.

Parameters
  • heatmaps (torch.Tensor) – Heatmaps generated by the model

  • mu_t (torch.Tensor) – Centers of the target Gaussians (in normalized units)

  • sigma_t (float) – Standard deviation of the target Gaussians (in pixels)

Returns

Per-location JS divergences.

experimenting.utils.dsntnn.dsnt(heatmaps)

Differentiable spatial to numerical transform.

Parameters

heatmaps (torch.Tensor) – Spatial representation of locations

Returns

Numerical coordinates corresponding to the locations in the heatmaps.

experimenting.utils.dsntnn.average_loss(losses, mask=None)

Calculate the average of per-location losses.

Parameters
  • losses (Tensor) – Predictions (B x L)

  • mask (Tensor, optional) – Mask of points to include in the loss calculation (B x L), defaults to including everything

experimenting.utils.nn_helpers module

Integration toolbox for pytorch nn package

class experimenting.utils.nn_helpers.FlatSoftmax

experimenting.utils.skeleton_helpers module

Skeleton wrapper. It provides a toolbox for plotting, projection, normalization, and denormalization of skeletons joints

experimenting.utils.train_helpers module