class_docstr: Generic Metadata writer.
  
  Example usage:
  
  For an example model which requires two inputs: image and general feature
  inputs, and generates one output: classification.
  
  with open(model_path, 'rb') as f:
    writer = MetadataWriter.create(f.read())
    model_content, metadata_json_content = writer
        .add_genernal_info('model_name', 'model description')
        .add_image_input()
        .add_feature_input()
        .add_classification_output(Labels().add(['A', 'B']))
        .populate()
class_docstr_tok: ["Generic","Metadata","writer",".","Example","usage",":","For","an","example","model","which","requires","two","inputs",":","image","and","general","feature","inputs",",","and","generates","one","output",":","classification",".","with","open","(","model_path",",","'rb","'",")","as","f",":","writer","=","MetadataWriter.create","(","f.read","(",")",")","model_content",",","metadata_json_content","=","writer",".add_genernal_info","(","'model_name","'",",","'model","description","'",")",".add_image_input","(",")",".add_feature_input","(",")",".add_classification_output","(","Labels","(",")",".add","(","[","'","A","'",",","'","B","'","]",")",")",".populate","(",")"]
docstr: Add a classification head metadata for classification output tensor.
  
  Example usage:
    writer.add_classification_output(
      Labels()
        .add(['/m/011l78', '/m/031d23'])
        .add(['cat', 'dog], 'en')
        .add(['chat', 'chien], 'fr')
        )
  
  Args:
    labels: an instance of Labels helper class.
    score_calibration: an instance of ScoreCalibration helper class.
    score_thresholding: an instance of ScoreThresholding.
    name: Metadata name of the tensor. Note that this is different from tensor
      name in the flatbuffer.
    description: human readable description of what the output is.
  
  Returns:
    The current Writer instance to allow chained operation.
code: def add_classification_output(
      self,
      labels: Optional[Labels] = None,
      score_calibration: Optional[ScoreCalibration] = None,
      score_thresholding: Optional[ScoreThresholding] = None,
      name: str = _OUTPUT_CLASSIFICATION_NAME,
      description: str = _OUTPUT_CLASSIFICATION_DESCRIPTION,
  ) -> "MetadataWriter":
      """Add a classification head metadata for classification output tensor.
  
      Example usage:
        writer.add_classification_output(
          Labels()
            .add(['/m/011l78', '/m/031d23'])
            .add(['cat', 'dog], 'en')
            .add(['chat', 'chien], 'fr')
            )
  
      Args:
        labels: an instance of Labels helper class.
        score_calibration: an instance of ScoreCalibration helper class.
        score_thresholding: an instance of ScoreThresholding.
        name: Metadata name of the tensor. Note that this is different from tensor
          name in the flatbuffer.
        description: human readable description of what the output is.
  
      Returns:
        The current Writer instance to allow chained operation.
      """
      calibration_md = self._create_score_calibration_md(
          score_calibration
      )
      score_thresholding_md = None
      if score_thresholding:
          score_thresholding_md = metadata_info.ScoreThresholdingMd(
              score_thresholding.global_score_threshold
          )
  
      label_files = self._create_label_file_md(labels)
      output_md = metadata_info.ClassificationTensorMd(
          name=name,
          description=description,
          label_files=label_files,
          tensor_type=self._output_tensor_type(len(self._output_mds)),
          score_calibration_md=calibration_md,
          score_thresholding_md=score_thresholding_md,
      )
      self._output_mds.append(output_md)
      return self
  
imports: import collections
  import csv
  import dataclasses
  import os
  import tempfile
  from typing import List, Optional, Tuple, Union
  import flatbuffers
  from mediapipe.tasks.metadata import metadata_schema_py_generated
  from mediapipe.tasks.python.metadata import metadata
  from mediapipe.tasks.python.metadata.metadata_writers import metadata_info
  from mediapipe.tasks.python.metadata.metadata_writers import writer_utils
label_desc: Use image node_id 9 for calling the MetadataWriter obj's underlying member method code with example usage: obj.add_classification_output(labels, score_calibration, score_thresholding, name, description) and returns: self