code: def img_dataloader(
      image_dir: PurePath,
      batch_size: int,
      basenet_preprocess: Callable[[np.array], torch.tensor],
      recursive: Optional[bool],
      num_workers: int,
  ) -> DataLoader:
      img_dataset = ImgDataset(
          image_dir=image_dir,
          basenet_preprocess=basenet_preprocess,
          recursive=recursive,
      )
      return DataLoader(
          dataset=img_dataset,
          batch_size=batch_size,
          collate_fn=_collate_fn,
          num_workers=num_workers,
      )
  
file_path: imagededup/imagededup/utils/data_generator.py
imports: from pathlib import PurePath
  from typing import Dict, Callable, Optional, List, Tuple
  import numpy
  import torch
  from torch.utils.data import Dataset, DataLoader
  from imagededup.utils.image_utils import load_image
  from imagededup.utils.general_utils import generate_files
label_desc: Use image node_id 2 for calling a global function with example usage: img_dataloader(image_dir, batch_size, basenet_preprocess, recursive, num_workers) and returns: DataLoader