parameters: (self, key, download_output,
                           video_path_format_string=None)
docstring: For each row in the annotation CSV, generates the corresponding metadata.
  
      Args:
        key: which split to process.
        download_output: the tuple output of _download_data containing
          - annotations_files: dict of keys to CSV annotation paths.
          - label_map: dict mapping from label strings to numeric indices.
        video_path_format_string: The format string for the path to local files.
      Yields:
        Each tf.SequenceExample of metadata, ready to pass to MediaPipe.
docstring_summary: For each row in the annotation CSV, generates the corresponding metadata.
docstring_tokens: For each row in the annotation CSV generates the corresponding metadata .
function: def _generate_metadata(self, key, download_output,
                           video_path_format_string=None):
      """For each row in the annotation CSV, generates the corresponding metadata.
  
      Args:
        key: which split to process.
        download_output: the tuple output of _download_data containing
          - annotations_files: dict of keys to CSV annotation paths.
          - label_map: dict mapping from label strings to numeric indices.
        video_path_format_string: The format string for the path to local files.
      Yields:
        Each tf.SequenceExample of metadata, ready to pass to MediaPipe.
      """
      annotations_files, label_map = download_output
      with open(annotations_files[key], "r") as annotations:
        reader = csv.reader(annotations)
        for i, csv_row in enumerate(reader):
          if i == 0:  # the first row is the header
            continue
          # rename the row with a constitent set of names.
          if len(csv_row) == 5:
            row = dict(
                list(
                    zip(["label_name", "video", "start", "end", "split"],
                        csv_row)))
          else:
            row = dict(list(zip(["video", "start", "end", "split"], csv_row)))
          metadata = tf.train.SequenceExample()
          ms.set_example_id(bytes23(row["video"] + "_" + row["start"]),
                            metadata)
          ms.set_clip_media_id(bytes23(row["video"]), metadata)
          ms.set_clip_alternative_media_id(bytes23(row["split"]), metadata)
          if video_path_format_string:
            filepath = video_path_format_string.format(**row)
            ms.set_clip_data_path(bytes23(filepath), metadata)
          assert row["start"].isdigit(), "Invalid row: %s" % str(row)
          assert row["end"].isdigit(), "Invalid row: %s" % str(row)
          if "label_name" in row:
            ms.set_clip_label_string([bytes23(row["label_name"])], metadata)
            if label_map:
              ms.set_clip_label_index([label_map[row["label_name"]]], metadata)
          yield metadata
function_tokens: def _generate_metadata ( self , key , download_output , video_path_format_string = None ) : annotations_files , label_map = download_output with open ( annotations_files [ key ] , "r" ) as annotations : reader = csv . reader ( annotations ) for i , csv_row in enumerate ( reader ) : if i == 0 : # the first row is the header continue # rename the row with a constitent set of names. if len ( csv_row ) == 5 : row = dict ( list ( zip ( [ "label_name" , "video" , "start" , "end" , "split" ] , csv_row ) ) ) else : row = dict ( list ( zip ( [ "video" , "start" , "end" , "split" ] , csv_row ) ) ) metadata = tf . train . SequenceExample ( ) ms . set_example_id ( bytes23 ( row [ "video" ] + "_" + row [ "start" ] ) , metadata ) ms . set_clip_media_id ( bytes23 ( row [ "video" ] ) , metadata ) ms . set_clip_alternative_media_id ( bytes23 ( row [ "split" ] ) , metadata ) if video_path_format_string : filepath = video_path_format_string . format ( * * row ) ms . set_clip_data_path ( bytes23 ( filepath ) , metadata ) assert row [ "start" ] . isdigit ( ) , "Invalid row: %s" % str ( row ) assert row [ "end" ] . isdigit ( ) , "Invalid row: %s" % str ( row ) if "label_name" in row : ms . set_clip_label_string ( [ bytes23 ( row [ "label_name" ] ) ] , metadata ) if label_map : ms . set_clip_label_index ( [ label_map [ row [ "label_name" ] ] ] , metadata ) yield metadata