How to use the mediapipe.util.sequence.media_sequence_util.create_int_context_feature 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
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())
msu.create_int_context_feature(
    "clip_start_timestamp", CLIP_START_TIMESTAMP_KEY, module_dict=globals())
msu.create_int_context_feature(
    "clip_end_timestamp", CLIP_END_TIMESTAMP_KEY, module_dict=globals())
msu.create_bytes_list_context_feature(
    "clip_label_string", CLIP_LABEL_STRING_KEY, module_dict=globals())
msu.create_int_list_context_feature(
    "clip_label_index", CLIP_LABEL_INDEX_KEY, module_dict=globals())
msu.create_float_list_context_feature(
    "clip_label_confidence", CLIP_LABEL_CONFIDENCE_KEY, module_dict=globals())

##################################  SEGMENTS  #################################
# A list of segment start times in microseconds.
SEGMENT_START_TIMESTAMP_KEY = "segment/start/timestamp"
# A list of indices marking the first frame index >= the start timestamp.
SEGMENT_START_INDEX_KEY = "segment/start/index"
# A list of segment end times in microseconds.
github google / mediapipe / mediapipe / util / sequence / media_sequence.py View on Github external
def _create_image_with_prefix(name, prefix):
  """Create multiple accessors for image based data."""
  msu.create_bytes_context_feature(name + "_format", IMAGE_FORMAT_KEY,
                                   prefix=prefix, module_dict=globals())
  msu.create_bytes_context_feature(name + "_colorspace", IMAGE_COLORSPACE_KEY,
                                   prefix=prefix, module_dict=globals())
  msu.create_int_context_feature(name + "_channels", IMAGE_CHANNELS_KEY,
                                 prefix=prefix, module_dict=globals())
  msu.create_int_context_feature(name + "_height", IMAGE_HEIGHT_KEY,
                                 prefix=prefix, module_dict=globals())
  msu.create_int_context_feature(name + "_width", IMAGE_WIDTH_KEY,
                                 prefix=prefix, module_dict=globals())
  msu.create_bytes_feature_list(name + "_encoded", IMAGE_ENCODED_KEY,
                                prefix=prefix, module_dict=globals())
  msu.create_float_context_feature(name + "_frame_rate", IMAGE_FRAME_RATE_KEY,
                                   prefix=prefix, module_dict=globals())
  msu.create_bytes_list_context_feature(
      name + "_class_label_string", IMAGE_CLASS_LABEL_STRING_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_int_list_context_feature(
      name + "_class_label_index", IMAGE_CLASS_LABEL_INDEX_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_int_list_context_feature(
github google / mediapipe / mediapipe / util / sequence / media_sequence.py View on Github external
def _create_image_with_prefix(name, prefix):
  """Create multiple accessors for image based data."""
  msu.create_bytes_context_feature(name + "_format", IMAGE_FORMAT_KEY,
                                   prefix=prefix, module_dict=globals())
  msu.create_bytes_context_feature(name + "_colorspace", IMAGE_COLORSPACE_KEY,
                                   prefix=prefix, module_dict=globals())
  msu.create_int_context_feature(name + "_channels", IMAGE_CHANNELS_KEY,
                                 prefix=prefix, module_dict=globals())
  msu.create_int_context_feature(name + "_height", IMAGE_HEIGHT_KEY,
                                 prefix=prefix, module_dict=globals())
  msu.create_int_context_feature(name + "_width", IMAGE_WIDTH_KEY,
                                 prefix=prefix, module_dict=globals())
  msu.create_bytes_feature_list(name + "_encoded", IMAGE_ENCODED_KEY,
                                prefix=prefix, module_dict=globals())
  msu.create_float_context_feature(name + "_frame_rate", IMAGE_FRAME_RATE_KEY,
                                   prefix=prefix, module_dict=globals())
  msu.create_bytes_list_context_feature(
      name + "_class_label_string", IMAGE_CLASS_LABEL_STRING_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_int_list_context_feature(
      name + "_class_label_index", IMAGE_CLASS_LABEL_INDEX_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_int_list_context_feature(
      name + "_object_class_index", IMAGE_OBJECT_CLASS_INDEX_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_bytes_context_feature(name + "_data_path", IMAGE_DATA_PATH_KEY,
                                   prefix=prefix, module_dict=globals())
github google / mediapipe / mediapipe / util / sequence / media_sequence.py View on Github external
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())
msu.create_int_context_feature(
    "clip_start_timestamp", CLIP_START_TIMESTAMP_KEY, module_dict=globals())
msu.create_int_context_feature(
    "clip_end_timestamp", CLIP_END_TIMESTAMP_KEY, module_dict=globals())
msu.create_bytes_list_context_feature(
    "clip_label_string", CLIP_LABEL_STRING_KEY, module_dict=globals())
msu.create_int_list_context_feature(
    "clip_label_index", CLIP_LABEL_INDEX_KEY, module_dict=globals())
msu.create_float_list_context_feature(
    "clip_label_confidence", CLIP_LABEL_CONFIDENCE_KEY, module_dict=globals())

##################################  SEGMENTS  #################################
# A list of segment start times in microseconds.
SEGMENT_START_TIMESTAMP_KEY = "segment/start/timestamp"
github google / mediapipe / mediapipe / util / sequence / media_sequence.py View on Github external
# It is occasionally useful to indicate that a feature applies to a given range.
# This should be used for features only and annotations should be provided as
# segments.
FEATURE_DURATION_KEY = "feature/duration"
# Encodes an optional confidence score for the generated features.
FEATURE_CONFIDENCE_KEY = "feature/confidence"

msu.create_int_list_context_feature(
    "feature_dimensions", FEATURE_DIMENSIONS_KEY, module_dict=globals())
msu.create_float_context_feature(
    "feature_rate", FEATURE_RATE_KEY, module_dict=globals())
msu.create_bytes_context_feature(
    "feature_bytes_format", FEATURE_BYTES_FORMAT_KEY, module_dict=globals())
msu.create_float_context_feature(
    "feature_sample_rate", FEATURE_SAMPLE_RATE_KEY, module_dict=globals())
msu.create_int_context_feature(
    "feature_num_channels", FEATURE_NUM_CHANNELS_KEY, module_dict=globals())
msu.create_int_context_feature(
    "feature_num_samples", FEATURE_NUM_SAMPLES_KEY, module_dict=globals())
msu.create_float_context_feature(
    "feature_packet_rate", FEATURE_PACKET_RATE_KEY, module_dict=globals())
msu.create_float_context_feature(
    "feature_audio_sample_rate", FEATURE_AUDIO_SAMPLE_RATE_KEY,
    module_dict=globals())
msu.create_float_list_feature_list(
    "feature_floats", FEATURE_FLOATS_KEY, module_dict=globals())
msu.create_bytes_list_feature_list(
    "feature_bytes", FEATURE_BYTES_KEY, module_dict=globals())
msu.create_int_list_feature_list(
    "feature_ints", FEATURE_INTS_KEY, module_dict=globals())
msu.create_int_feature_list(
    "feature_timestamp", FEATURE_TIMESTAMP_KEY, module_dict=globals())
github google / mediapipe / mediapipe / util / sequence / media_sequence.py View on Github external
def _create_image_with_prefix(name, prefix):
  """Create multiple accessors for image based data."""
  msu.create_bytes_context_feature(name + "_format", IMAGE_FORMAT_KEY,
                                   prefix=prefix, module_dict=globals())
  msu.create_bytes_context_feature(name + "_colorspace", IMAGE_COLORSPACE_KEY,
                                   prefix=prefix, module_dict=globals())
  msu.create_int_context_feature(name + "_channels", IMAGE_CHANNELS_KEY,
                                 prefix=prefix, module_dict=globals())
  msu.create_int_context_feature(name + "_height", IMAGE_HEIGHT_KEY,
                                 prefix=prefix, module_dict=globals())
  msu.create_int_context_feature(name + "_width", IMAGE_WIDTH_KEY,
                                 prefix=prefix, module_dict=globals())
  msu.create_bytes_feature_list(name + "_encoded", IMAGE_ENCODED_KEY,
                                prefix=prefix, module_dict=globals())
  msu.create_float_context_feature(name + "_frame_rate", IMAGE_FRAME_RATE_KEY,
                                   prefix=prefix, module_dict=globals())
  msu.create_bytes_list_context_feature(
      name + "_class_label_string", IMAGE_CLASS_LABEL_STRING_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_int_list_context_feature(
      name + "_class_label_index", IMAGE_CLASS_LABEL_INDEX_KEY,
      prefix=prefix, module_dict=globals())
  msu.create_int_list_context_feature(
      name + "_object_class_index", IMAGE_OBJECT_CLASS_INDEX_KEY,
      prefix=prefix, module_dict=globals())
github google / mediapipe / mediapipe / util / sequence / media_sequence.py View on Github external
# segments.
FEATURE_DURATION_KEY = "feature/duration"
# Encodes an optional confidence score for the generated features.
FEATURE_CONFIDENCE_KEY = "feature/confidence"

msu.create_int_list_context_feature(
    "feature_dimensions", FEATURE_DIMENSIONS_KEY, module_dict=globals())
msu.create_float_context_feature(
    "feature_rate", FEATURE_RATE_KEY, module_dict=globals())
msu.create_bytes_context_feature(
    "feature_bytes_format", FEATURE_BYTES_FORMAT_KEY, module_dict=globals())
msu.create_float_context_feature(
    "feature_sample_rate", FEATURE_SAMPLE_RATE_KEY, module_dict=globals())
msu.create_int_context_feature(
    "feature_num_channels", FEATURE_NUM_CHANNELS_KEY, module_dict=globals())
msu.create_int_context_feature(
    "feature_num_samples", FEATURE_NUM_SAMPLES_KEY, module_dict=globals())
msu.create_float_context_feature(
    "feature_packet_rate", FEATURE_PACKET_RATE_KEY, module_dict=globals())
msu.create_float_context_feature(
    "feature_audio_sample_rate", FEATURE_AUDIO_SAMPLE_RATE_KEY,
    module_dict=globals())
msu.create_float_list_feature_list(
    "feature_floats", FEATURE_FLOATS_KEY, module_dict=globals())
msu.create_bytes_list_feature_list(
    "feature_bytes", FEATURE_BYTES_KEY, module_dict=globals())
msu.create_int_list_feature_list(
    "feature_ints", FEATURE_INTS_KEY, module_dict=globals())
msu.create_int_feature_list(
    "feature_timestamp", FEATURE_TIMESTAMP_KEY, module_dict=globals())
msu.create_int_list_feature_list(
    "feature_duration", FEATURE_DURATION_KEY, module_dict=globals())

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 8 days ago

Package Health Score

91 / 100
Full package analysis