              name = name[name.rfind("_") + 1:].title()
              try:
                  logger.debug("Displaying preview: '%s'", img)
                  size = self._get_current_size(name)
                  self._previewtrain[name] = [Image.open(img), None, modified]
                  self.resize_image(name, size)
                  self._errcount = 0
              except ValueError:
 
</s> remove                     self._previewtrain[name] = None
 </s> add                     del self._previewtrain[name] </s> remove     def _get_current_size(self, name):
 </s> add     def _get_current_size(self, name: str) -> Optional[Tuple[int, int]]: </s> remove         for fname in self._previewcache["filenames"]:
 </s> add         for fname in cast(List[str], self._previewcache["filenames"]): </s> remove         self._pathoutput = None
        self._previewoutput = None
        self._previewtrain = {}
        self._previewcache = dict(modified=None,  # cache for extract and convert
                                  images=None,
                                  filenames=[],
                                  placeholder=None)
 </s> add         self._pathoutput: Optional[str] = None
        self._batch_mode = False
        self._previewoutput: Optional[Tuple[Image.Image, ImageTk.PhotoImage]] = None
        self._previewtrain: Dict[str, List[Union[Image.Image,
                                                 ImageTk.PhotoImage,
                                                 None,
                                                 float]]] = {}
        self._previewcache: Dict[str, Union[None, float, np.ndarray, List[str]]] = dict(
            modified=None,  # cache for extract and convert
            images=None,
            filenames=[],
            placeholder=None) </s> remove         samples = []
 </s> add         samples: List[np.ndarray] = []
                if not size:
                    return
              name = name[name.rfind("_") + 1:].title()
              try:
                  logger.debug("Displaying preview: '%s'", img)
                  size = self._get_current_size(name)
                if not size:
                    return
                  self._previewtrain[name] = [Image.open(img), None, modified]
                  self.resize_image(name, size)
                  self._errcount = 0
              except ValueError:
keep keep keep add keep keep keep keep
 Bugfix: Preview for extract in batch mode 
lib/gui/utils.py