code: def _load_imgs(file_paths, slice_, color, resize):
      """Internally used to load images"""
      try:
          from PIL import Image
      except ImportError:
          raise ImportError(
              "The Python Imaging Library (PIL) is required to load data "
              "from jpeg files. Please refer to "
              "https://pillow.readthedocs.io/en/stable/installation.html "
              "for installing PIL."
          )
  
      # compute the portion of the images to load to respect the slice_ parameter
      # given by the caller
      default_slice = (slice(0, 250), slice(0, 250))
      if slice_ is None:
          slice_ = default_slice
      else:
          slice_ = tuple(
              s or ds for s, ds in zip(slice_, default_slice)
          )
  
      h_slice, w_slice = slice_
      h = (h_slice.stop - h_slice.start) // (h_slice.step or 1)
      w = (w_slice.stop - w_slice.start) // (w_slice.step or 1)
  
      if resize is not None:
          resize = float(resize)
          h = int(resize * h)
          w = int(resize * w)
  
      # allocate some contiguous memory to host the decoded image slices
      n_faces = len(file_paths)
      if not color:
          faces = np.zeros((n_faces, h, w), dtype=np.float32)
      else:
          faces = np.zeros((n_faces, h, w, 3), dtype=np.float32)
  
      # iterate over the collected file path to load the jpeg files as numpy
      # arrays
      for i, file_path in enumerate(file_paths):
          if i % 1000 == 0:
              logger.debug("Loading face #%05d / %05d", i + 1, n_faces)
  
          # Checks if jpeg reading worked. Refer to issue #3594 for more
          # details.
          pil_img = Image.open(file_path)
          pil_img = pil_img.crop(
              (w_slice.start, h_slice.start, w_slice.stop, h_slice.stop)
          )
          if resize is not None:
              pil_img = pil_img.resize((w, h))
          face = np.asarray(pil_img, dtype=np.float32)
  
          if face.ndim == 0:
              raise RuntimeError(
                  "Failed to read the image file %s, "
                  "Please make sure that libjpeg is installed"
                  % file_path
              )
  
          face /= (
              255.0  # scale uint8 coded colors to the [0.0, 1.0] floats
          )
          if not color:
              # average the color channels to compute a gray levels
              # representation
              face = face.mean(axis=2)
  
          faces[i, ...] = face
  
      return faces
  
file_path: catboost/contrib/python/scikit-learn/py3/sklearn/datasets/_lfw.py
imports: import logging
  from numbers import Integral, Real
  from os import PathLike, listdir, makedirs, remove
  from os.path import exists, isdir, join
  import numpy
  from joblib import Memory
  from ..utils import Bunch
  from ..utils._param_validation import Hidden, Interval, StrOptions, validate_params
  from ._base import RemoteFileMetadata, _fetch_remote, get_data_home, load_descr
label_desc: Use image node_id 2 for calling a global function with example usage: _load_imgs(file_paths, slice_, color, resize) and returns: faces