docstr: Load dataset from given path.
  Args:
      path: string, path of folder containing dataset
      target_shape: shape of output image
      shuffle: Shuffles the dataset randomly. Expects bool or int.
      encode_classes: Will sparse encode classes if True
      allowed_ext: Allowed Image file extensions. Defaults are `jpg | png | jpeg`
  Returns: image, label -> tf.data.Dataset prefetched with tf.data.AUTOTUNE
  
  By default the loaded image size is 224x224, pass None to load original size.
  You will get error on `batch()` method if all image size are not same.
docstr_tok: ["Load","dataset","from","given","path",".","Args",":","path",":","string",",","path","of","folder","containing","dataset","target_shape",":","shape","of","output","image","shuffle",":","Shuffles","the","dataset","randomly",".","Expects","bool","or","int",".","encode_classes",":","Will","sparse","encode","classes","if","True","allowed_ext",":","Allowed","Image","file","extensions",".","Defaults","are","`","jpg","|","png","|","jpeg","`","Returns",":","image",",","label","-",">","tf.data.Dataset","prefetched","with","tf.data.AUTOTUNE","By","default","the","loaded","image","size","is","224x224",",","pass","None","to","load","original","size",".","You","will","get","error","on","`","batch","(",")","`","method","if","all","image","size","are","not","same","."]
code: def from_folder(
      self,
      path: Union[str, pathlib.Path],
      target_shape: Union[None, tuple] = (224, 224),
      shuffle: Union[bool, int] = True,
      encode_classes: bool = True,
      allowed_ext: Optional[List[str]] = DEFAULT_EXT,
  ):
      """Load dataset from given path.
      Args:
          path: string, path of folder containing dataset
          target_shape: shape of output image
          shuffle: Shuffles the dataset randomly. Expects bool or int.
          encode_classes: Will sparse encode classes if True
          allowed_ext: Allowed Image file extensions. Defaults are `jpg | png | jpeg`
      Returns: image, label -> tf.data.Dataset prefetched with tf.data.AUTOTUNE
  
      By default the loaded image size is 224x224, pass None to load original size.
      You will get error on `batch()` method if all image size are not same.
      """
      if not isinstance(path, (str, pathlib.Path)):
          raise AssertionError
      if not isinstance(shuffle, (bool, int)):
          raise AssertionError(
              print(
                  f"Arg: shuffle is either bool or int but got {shuffle} : {type(shuffle)}"
              )
          )
  
      path = pathlib.Path(path)
      remove_dsstore(path)
  
      self.shape = target_shape
  
      list_folders = tf.data.Dataset.list_files(str(path / "*"))
  
      list_images = self._get_image_list(str(path))
      if shuffle:
          list_images.shuffle(shuffle).cache()
      else:
          list_images.cache()
  
      self._get_classnames(list_folders, encode_classes)
  
      if encode_classes:
          print(f"CLASSES ENCODED: {self.class_to_idx}")
      else:
          print(f"CLASSES FOUND: {self.CLASS_NAMES}")
  
      data = list_images.map(
          self._process_path, num_parallel_calls=AUTOTUNE
      )
  
      data = data.map(self._ensure_shape, num_parallel_calls=AUTOTUNE)
  
      self.data = data
  
      return data
  
imports: import math
  import os
  import pathlib
  from glob import glob
  from typing import List, Optional, Union
  import matplotlib.pyplot
  import tensorflow
  from chitra.image.tf_image import read_image, resize_image
  from .core import remove_dsstore
  from .utility.tf_utils import get_basename
label_desc: Use image node_id 9 for calling the Clf obj's underlying member method code with example usage: obj.from_folder(path, target_shape, shuffle, encode_classes, allowed_ext) and returns: data