class_docstr: A optimzied ImageFolder using libjpeg_turbo to load jpg images.
class_docstr_tok: ["A","optimzied","ImageFolder","using","libjpeg_turbo","to","load","jpg","images","."]
code: def __getitem__(self, idx: int):
      path = self.imgs[idx][0]
      label = self.imgs[idx][1]
  
      if self.jpeg is not None and (
          path.endswith(".jpg") or path.endswith(".jpeg")
      ):
          img_str = self._read_image_to_bytes(path)
          img = self._decode_img_libjpeg_turbo(img_str)
      else:
          img = cv2.imread(path)
      img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
  
      if self.transform:
          img = self.transform(img)
  
      img = img.numpy()
      return img.astype("float32"), label
  
file_path: BigDL/python/nano/src/bigdl/nano/pytorch/vision/datasets/datasets.py
imports: from typing import Union, Callable, Optional
  from turbojpeg import TurboJPEG, TJPF_GRAY
  import torchvision
  import cv2
  import os
  import numpy
  import torch
  from logging import warning
  from os.path import split, join, realpath
label_desc: Use image node_id 4 for calling the ImageFolder obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: img,  label