  import os
  
  def get_image_paths( directory ):
      return [ x.path for x in scandir( directory ) if x.name.endswith('.jpg') or x.name.endswith('.png') ]
  
  def load_images( image_paths, convert=None ):
      iter_all_images = ( cv2.imread(fn) for fn in image_paths )
      if convert:
 
</s> remove     return [ x.path for x in os.scandir( directory ) if x.name.endswith(".jpg") or x.name.endswith(".png") ]
 </s> add     return [ x.path for x in scandir( directory ) if x.name.endswith('.jpg') or x.name.endswith('.png') ]
 </s> remove     cv2.imshow( '', figure )
    # If run from Docker, imshow won't work. Use:
    # cv2.imwrite( '_sample.jpg', figure )
 </s> add     cv2.imwrite( '_sample.jpg', figure )

from pathlib import Path
from scandir import scandir

def get_folder( path ):
    output_dir = Path( path )
    #output_dir.mkdir( parents=True, exist_ok=True )
    return output_dir


  import os
  
from pathlib import Path
from scandir import scandir

def get_folder( path ):
    output_dir = Path( path )
    #output_dir.mkdir( parents=True, exist_ok=True )
    return output_dir

  def get_image_paths( directory ):
      return [ x.path for x in scandir( directory ) if x.name.endswith('.jpg') or x.name.endswith('.png') ]
  
  def load_images( image_paths, convert=None ):
      iter_all_images = ( cv2.imread(fn) for fn in image_paths )
      if convert:
keep add keep keep keep keep keep keep
 Patch to better work with the dockerfile
Can be reverted if you improve Dockerfile 
lib/utils.py