docstr: Parameters
  ----------
  folder: str or None
      folder to use for reference images. If None, 1 random image is created.
  model: str
      model name to use
  
  Yields
  ------
  ExperimentFunction
      an experiment function corresponding to 1 of the image of the provided folder dataset.
docstr_tok: ["Parameters","--","--","--","--","--","folder",":","str","or","None","folder","to","use","for","reference","images",".","If","None",",","1","random","image","is","created",".","model",":","str","model","name","to","use","Yields","--","--","--","ExperimentFunction","an","experiment","function","corresponding","to","1","of","the","image","of","the","provided","folder","dataset","."]
code: def make_folder_functions(
      cls,
      folder: tp.Optional[tp.PathLike],
      model: str = "resnet50",
  ) -> tp.Generator["ImageAdversarial", None, None]:
      """
  
      Parameters
      ----------
      folder: str or None
          folder to use for reference images. If None, 1 random image is created.
      model: str
          model name to use
  
      Yields
      ------
      ExperimentFunction
          an experiment function corresponding to 1 of the image of the provided folder dataset.
      """
      assert model in {"resnet50", "test"}
      tags = {
          "folder": "#FAKE#" if folder is None else Path(folder).name,
          "model": model,
      }
      classifier: tp.Any = (
          Resnet50() if model == "resnet50" else TestClassifier()
      )
      classifier.eval()
  
      transform = tr.Compose(
          [tr.Resize(256), tr.CenterCrop(224), tr.ToTensor()]
      )
      if folder is None:
          x = torch.zeros(1, 3, 224, 224)
          _, pred = torch.max(classifier(x), axis=1)
          data_loader: tp.Iterable[tp.Tuple[tp.Any, tp.Any]] = [
              (x, pred)
          ]
      elif Path(folder).is_dir():
          ifolder = torchvision.datasets.ImageFolder(
              folder, transform=transform
          )
          data_loader = torch.utils.data.DataLoader(
              ifolder,
              batch_size=1,
              shuffle=True,
              num_workers=8,
              pin_memory=True,
          )
      else:
          raise ValueError(f"{folder} is not a valid folder.")
  
      for data, target in itertools.islice(data_loader, 0, 100):
          _, pred = torch.max(classifier(data), axis=1)
          if pred == target:
              func = cls(
                  classifier=classifier,
                  image=data[0],
                  label=int(target),
                  targeted=False,
                  epsilon=0.05,
              )
              func.add_descriptors(**tags)
              yield func
  
imports: import os
  import itertools
  from pathlib import Path
  import cv2
  import numpy
  import PIL.Image
  import torch.nn
  import torch
  import torchvision
  from torchvision.models import resnet50
  import torchvision.transforms
  import nevergrad
  import nevergrad.common.typing
  from nevergrad.common import errors
  from ..None import base
  from .None import imagelosses
label_desc: Use image node_id 5 for calling the ImageAdversarial obj's underlying member method code with example usage: obj.make_folder_functions(cls, folder, model) without return types