code: def _load_imgs(file_paths, slice_, color, resize):
      """Internally used to load images"""
  
      # Try to import imread and imresize from PIL. We do this here to prevent
      # the whole sklearn.datasets module from depending on PIL.
      try:
          try:
              from scipy.misc import imread
          except ImportError:
              from scipy.misc.pilutil import imread
          from scipy.misc import imresize
      except ImportError:
          raise ImportError(
              "The Python Imaging Library (PIL)"
              " is required to load data from jpeg files"
          )
  
      # 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.info("Loading face #%05d / %05d", i + 1, n_faces)
  
          # Checks if jpeg reading worked. Refer to issue #3594 for more
          # details.
          img = imread(file_path)
          if img.ndim is 0:
              raise RuntimeError(
                  "Failed to read the image file %s, "
                  "Please make sure that libjpeg is installed"
                  % file_path
              )
  
          face = np.asarray(img[slice_], dtype=np.float32)
          face /= (
              255.0  # scale uint8 coded colors to the [0.0, 1.0] floats
          )
          if resize is not None:
              face = imresize(face, resize)
          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/py2/sklearn/datasets/lfw.py
imports: from os import listdir, makedirs, remove, rename
  from os.path import join, exists, isdir
  from sklearn.utils import deprecated
  import logging
  import numpy
  from .base import get_data_home, Bunch
  from ..externals.joblib import Memory
  from ..externals.six import b
label_desc: Use image node_id 3 for calling a global function with example usage: _load_imgs(file_paths, slice_, color, resize) and returns: faces