How to use the mediapipe.util.sequence.media_sequence_util function in mediapipe

To help you get started, we’ve selected a few mediapipe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / mediapipe / mediapipe / util / sequence / media_sequence.py View on Github external
ALTERNATIVE_CLIP_MEDIA_ID_KEY = "clip/alternative_media_id"
# The encoded bytes for storing media directly in the SequenceExample.
CLIP_ENCODED_MEDIA_BYTES_KEY = "clip/encoded_media_bytes"
# The start time for the encoded media if not preserved during encoding.
CLIP_ENCODED_MEDIA_START_TIMESTAMP_KEY = "clip/encoded_media_start_timestamp"
# The start time, in microseconds, for the start of the clip in the media.
CLIP_START_TIMESTAMP_KEY = "clip/start/timestamp"
# The end time, in microseconds, for the end of the clip in the media.
CLIP_END_TIMESTAMP_KEY = "clip/end/timestamp"
# A list of label indices for this clip.
CLIP_LABEL_INDEX_KEY = "clip/label/index"
# A list of label strings for this clip.
CLIP_LABEL_STRING_KEY = "clip/label/string"
# A list of label confidences for this clip.
CLIP_LABEL_CONFIDENCE_KEY = "clip/label/confidence"
msu.create_bytes_context_feature(
    "example_id", EXAMPLE_ID_KEY, module_dict=globals())
msu.create_bytes_context_feature(
    "example_dataset_name", EXAMPLE_DATASET_NAME_KEY, module_dict=globals())
msu.create_bytes_context_feature(
    "clip_media_id", CLIP_MEDIA_ID_KEY, module_dict=globals())
msu.create_bytes_context_feature(
    "clip_alternative_media_id", ALTERNATIVE_CLIP_MEDIA_ID_KEY,
    module_dict=globals())
msu.create_bytes_context_feature(
    "clip_encoded_media_bytes", CLIP_ENCODED_MEDIA_BYTES_KEY,
    module_dict=globals())
msu.create_bytes_context_feature(
    "clip_data_path", CLIP_DATA_PATH_KEY, module_dict=globals())
msu.create_int_context_feature(
    "clip_encoded_media_start_timestamp",
    CLIP_ENCODED_MEDIA_START_TIMESTAMP_KEY, module_dict=globals())
github google / mediapipe / mediapipe / util / sequence / media_sequence.py View on Github external
def add_prefixed_bbox(values, sequence_example, prefix):
    add_bbox_ymin(values[:, 0], sequence_example, prefix=prefix)
    add_bbox_xmin(values[:, 1], sequence_example, prefix=prefix)
    add_bbox_ymax(values[:, 2], sequence_example, prefix=prefix)
    add_bbox_xmax(values[:, 3], sequence_example, prefix=prefix)
  def get_prefixed_bbox_size(sequence_example, prefix):
    return get_bbox_ymin_size(sequence_example, prefix=prefix)
  def has_prefixed_bbox(sequence_example, prefix):
    return has_bbox_ymin(sequence_example, prefix=prefix)
  def clear_prefixed_bbox(sequence_example, prefix):
    clear_bbox_ymin(sequence_example, prefix=prefix)
    clear_bbox_xmin(sequence_example, prefix=prefix)
    clear_bbox_ymax(sequence_example, prefix=prefix)
    clear_bbox_xmax(sequence_example, prefix=prefix)
  # pylint: enable=undefined-variable
  msu.add_functions_to_module({
      "get_" + name + "_at":
          functools.partial(get_prefixed_bbox_at, prefix=prefix),
      "add_" + name:
          functools.partial(add_prefixed_bbox, prefix=prefix),
      "get_" + name + "_size":
          functools.partial(get_prefixed_bbox_size, prefix=prefix),
      "has_" + name:
          functools.partial(has_prefixed_bbox, prefix=prefix),
      "clear_" + name:
          functools.partial(clear_prefixed_bbox, prefix=prefix),
  }, module_dict=globals())
github google / mediapipe / mediapipe / util / sequence / media_sequence.py View on Github external
name + "_class_confidence", REGION_CLASS_CONFIDENCE_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_bytes_list_feature_list(
      name + "_track_string", REGION_TRACK_STRING_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_int_list_feature_list(
      name + "_track_index", REGION_TRACK_INDEX_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_float_list_feature_list(
      name + "_track_confidence", REGION_TRACK_CONFIDENCE_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_float_list_feature_list(name + "_ymin", REGION_BBOX_YMIN_KEY,
                                     prefix=prefix, module_dict=globals())
  msu.create_float_list_feature_list(name + "_xmin", REGION_BBOX_XMIN_KEY,
                                     prefix=prefix, module_dict=globals())
  msu.create_float_list_feature_list(name + "_ymax", REGION_BBOX_YMAX_KEY,
                                     prefix=prefix, module_dict=globals())
  msu.create_float_list_feature_list(name + "_xmax", REGION_BBOX_XMAX_KEY,
                                     prefix=prefix, module_dict=globals())
  msu.create_float_list_feature_list(name + "_point_x", REGION_POINT_X_KEY,
                                     prefix=prefix, module_dict=globals())
  msu.create_float_list_feature_list(name + "_point_y", REGION_POINT_Y_KEY,
                                     prefix=prefix, module_dict=globals())
  msu.create_bytes_list_context_feature(name + "_parts",
                                        REGION_PARTS_KEY,
                                        prefix=prefix, module_dict=globals())
  msu.create_float_list_context_feature(
      name + "_embedding_dimensions_per_region",
      REGION_EMBEDDING_DIMENSIONS_PER_REGION_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_bytes_context_feature(name + "_embedding_format",
                                   REGION_EMBEDDING_FORMAT_KEY,

mediapipe

MediaPipe is the simplest way for researchers and developers to build world-class ML solutions and applications for mobile, edge, cloud and the web.

Apache-2.0
Latest version published 12 days ago

Package Health Score

91 / 100
Full package analysis