8.1.1.7.1.2.1.1. blueoil.networks.keypoint_detection.base

8.1.1.7.1.2.1.1.1. Module Contents

8.1.1.7.1.2.1.1.1.1. Classes

Base

base network for keypoint detection

class blueoil.networks.keypoint_detection.base.Base(*args, **kwargs)

Bases: blueoil.networks.base.BaseNetwork

base network for keypoint detection

This base network is for keypoint detection. Each keypoint detection network class should extend this class.

placeholders(self)

Placeholders.

Return placeholders.

Returns

Placeholders.

Return type

tf.compat.v1.placeholder

inference(self, images, is_training)

Inference.

Parameters

images – images tensor. shape is (batch_num, height, width, channel)

_colored_heatmaps(self, heatmaps, color, name='')

Visualize heatmaps with given color.

Parameters
  • heatmaps – a Tensor of shape (batch_size, height, width, num_joints).

  • color – a numpy array of shape (batch_size, 1, 1, num_joints, 3).

  • name – str, name to display on tensorboard.

static py_post_process(heatmaps, num_dimensions=2, stride=2)

Convert from heatmaps to joints, it is mainly used for visualization and metrics in training time.

Parameters
  • heatmaps – a numpy array of shape (batch_size, height, width, num_joints).

  • num_dimensions – int.

  • stride – int, stride = image_height / heatmap_height.

Returns

a numpy array of shape (batch_size, num_joints, 3).

Return type

batch_joints

post_process(self, output)

Tensorflow mirror method for py_post_process(), it is mainly used for visualization and metrics in training time.

Parameters

output – a Tensor of shape (batch_size, height, width, num_joints).

Returns

a Tensor of shape (batch_size, num_joints, 3).

Return type

joints

static py_visualize_output(images, heatmaps, stride=2)

Visualize pose estimation, it is mainly used for visualization in training time.

Parameters
  • images – a numpy array of shape (batch_size, height, width, 3).

  • heatmaps – a numpy array of shape (batch_size, height, width, num_joints).

  • stride – int, stride = image_height / heatmap_height.

Returns

a numpy array of shape (batch_size, height, width, 3).

Return type

drawed_images

_visualize_output(self, images, output, name='visualize_output')

A tensorflow mirror method for py_visualize_output().

Parameters
  • images – a Tensor of shape (batch_size, height, width, 3).

  • output – a Tensor of shape (batch_size, height, width, num_joints).

  • name – str, name to display on tensorboard.

_compute_oks(self, output, labels)

Compute object keypoint similarity between output and labels.

Parameters
  • output – a Tensor of shape (batch_size, height, width, num_joints).

  • labels – a Tensor of shape (batch_size, height, width, num_joints).

Returns

a Tensor represents object keypoint similarity.

Return type

oks

summary(self, output, labels=None)

Summary for tensorboard.

Parameters
  • output – a Tensor of shape (batch_size, height, width, num_joints).

  • labels – a Tensor of shape (batch_size, height, width, num_joints).

metrics(self, output, labels)

Compute metrics for single-person pose estimation task.

Parameters
  • output – a Tensor of shape (batch_size, height, width, num_joints).

  • labels – a Tensor of shape (batch_size, height, width, num_joints).

Returns

a dict, {metric_name: metric_tensor}. updates_op: an operation that increments the total and count variables appropriately.

Return type

results