class_docstr: Dataset library for face stylizer fine tuning.
class_docstr_tok: ["Dataset","library","for","face","stylizer","fine","tuning","."]
docstr: Creates a dataset from single image.
  
  Supported input image formats include 'jpg', 'jpeg', 'png'.
  
  Args:
    filename: Name of the image file.
  
  Returns:
    Dataset containing image and label and other related info.
docstr_tok: ["Creates","a","dataset","from","single","image",".","Supported","input","image","formats","include","'jpg","'",",","'jpeg","'",",","'png","'",".","Args",":","filename",":","Name","of","the","image","file",".","Returns",":","Dataset","containing","image","and","label","and","other","related","info","."]
code: def from_image(
      cls, filename: str
  ) -> classification_dataset.ClassificationDataset:
      """Creates a dataset from single image.
  
      Supported input image formats include 'jpg', 'jpeg', 'png'.
  
      Args:
        filename: Name of the image file.
  
      Returns:
        Dataset containing image and label and other related info.
      """
      file_path = os.path.abspath(filename)
      image_filename = os.path.basename(filename)
      image_name, ext_name = os.path.splitext(image_filename)
  
      if not ext_name.endswith((".jpg", ".jpeg", ".png")):
          raise ValueError("Unsupported image formats: %s" % ext_name)
  
      image_data = _preprocess_face_dataset([file_path])
      label_names = [image_name]
  
      image_ds = tf.data.Dataset.from_tensor_slices(image_data)
  
      # Load label
      label_ds = tf.data.Dataset.from_tensor_slices(
          tf.cast([0], tf.int64)
      )
  
      # Create a dataset of (image, label) pairs
      image_label_ds = tf.data.Dataset.zip((image_ds, label_ds))
  
      logging.info("Create dataset for style: %s.", image_name)
  
      return Dataset(
          dataset=image_label_ds,
          label_names=label_names,
          size=1,
      )
  
file_path: mediapipe/mediapipe/model_maker/python/vision/face_stylizer/dataset.py
imports: from typing import Sequence
  import logging
  import os
  import tensorflow
  from mediapipe.model_maker.python.core.data import classification_dataset
  from mediapipe.model_maker.python.vision.face_stylizer import constants
  from mediapipe.python._framework_bindings import image
  from mediapipe.tasks.python.core import base_options
  from mediapipe.tasks.python.vision import face_aligner
label_desc: Use image node_id 1 for calling the Dataset obj's underlying member method code with example usage: obj.from_image(cls, filename) and returns: Dataset