code: def _img_fnames_to_df(
      img_folder,
      pattern,
      image_column="image_name",
      label_column="label",
      verbose=1,
  ):
      # get fnames
      fnames = []
      for ext in ("*.gif", "*.png", "*.jpg"):
          fnames.extend(glob.glob(os.path.join(img_folder, ext)))
  
      # process filenames and labels
      image_names = []
      labels = []
      p = re.compile(pattern)
      for fname in fnames:
          r = p.search(fname)
          if r:
              image_names.append(os.path.basename(fname))
              labels.append(r.group(1))
          else:
              warnings.warn(
                  "Could not extract target for %s -  skipping this file"
                  % (fname)
              )
      dct = {"image_name": image_names, "label": labels}
      return pd.DataFrame(dct)
  
imports: from ..None import utils
  from ..imports import *
  from .preprocessor import ImagePreprocessor
label_desc: Use image node_id 17 for calling a global function with example usage: _img_fnames_to_df(img_folder, pattern, image_column, label_column, verbose) and returns: pd