docstr: Create a Dataset object that can generate tf.data.Dataset
  Args:
      train_dir:
      image_size:
      transforms:
      default_encode:
      **kwargs:
docstr_tok: ["Create","a","Dataset","object","that","can","generate","tf.data.Dataset","Args",":","train_dir",":","image_size",":","transforms",":","default_encode",":","*","*","kwargs",":"]
code: def __init__(
      self,
      train_dir: Union[str, Path],
      image_size=None,
      transforms=None,
      default_encode=True,
      **kwargs,
  ):
      """
      Create a Dataset object that can generate tf.data.Dataset
      Args:
          train_dir:
          image_size:
          transforms:
          default_encode:
          **kwargs:
      """
      self.get_filenames = get_filenames
      self.read_image = read_image
      self.get_label = get_label
      self.transforms = transforms
  
      self.root_dir = train_dir
      self.default_encode = default_encode
      self.filenames = self.get_filenames(train_dir)
      self.num_files = len(self.filenames)
      self.image_size = image_size
      self.img_sz_list = ImageSizeList(self.image_size)
      self.step_size = None
      self.labels = kwargs.get("labels", self.get_labels())
  
imports: import os
  import pathlib
  import random
  import time
  from functools import partial
  from glob import glob
  from pathlib import Path
  from typing import Callable, Union
  import tensorflow
  from typeguard import check_argument_types, typechecked
  from chitra.image.tf_image import read_image, resize_image
label_desc: Use image node_id 1 to create a new Dataset object  with example: obj = Dataset(train_dir, image_size, transforms, default_encode)