  # faceswap imports
  from lib.cli import FullHelpArgumentParser
  from lib.serializer import get_serializer_from_filename
  from lib.faces_detect import DetectedFace
  from lib.image import read_image
  from lib.vgg_face2_keras import VGGFace2 as VGGFace
  from plugins.extract.pipeline import Extractor, ExtractMedia
  
  from . import cli
  
 
</s> remove         free_ram = psutil.virtual_memory().free / divider
 </s> add         free_ram = psutil.virtual_memory().available / divider </s> remove     exit(0)
 </s> add     sys.exit(0) </s> remove         logger.info("Calculating face identifiers...")
        preds = np.array([self.vgg_face.predict(img)
                          for img in tqdm(image_list, desc="Calculating...", file=sys.stdout)])
 </s> add         # TODO This should be set in init
        self._loader = ImagesLoader(self.args.input_dir)

        filenames = []
        preds = np.empty((self._loader.count, 512), dtype="float32")
        for idx, (filename, image) in enumerate(tqdm(self._loader.load(),
                                                     desc="Classifying Faces...",
                                                     total=self._loader.count)):
            filenames.append(filename)
            preds[idx] = self.vgg_face.predict(image) </s> remove         img_list = np.array(filename_list)[indices]
 </s> add         img_list = np.array(filenames)[indices]
from lib.image import ImagesLoader, read_image
  # faceswap imports
  from lib.cli import FullHelpArgumentParser
  from lib.serializer import get_serializer_from_filename
  from lib.faces_detect import DetectedFace
from lib.image import ImagesLoader, read_image
  from lib.vgg_face2_keras import VGGFace2 as VGGFace
  from plugins.extract.pipeline import Extractor, ExtractMedia
  
  from . import cli
  
keep keep keep keep replace keep keep keep keep keep
 tools.sort - Optimize sort by face 
tools/sort.py