  #!/usr/bin python3
  """ VGG_Face2 inference
  Model exported from: https://github.com/WeidiXie/Keras-VGGFace2-ResNet50
  which is based on: https://www.robots.ox.ac.uk/~vgg/software/vgg_face/
  
  Licensed under Creative Commons Attribution License.
  https://creativecommons.org/licenses/by-nc/4.0/
  """
  
  import logging
  import sys
  import os
  import psutil
 
</s> remove         Input images should be in BGR Order """
 </s> add     Extracts feature vectors from faces in order to compare similarity.

    Parameters
    ----------
    backend: ['GPU', 'CPU']
        Whether to run inference on a GPU or on the CPU
    loglevel: ['INFO', 'VERBODE', 'DEBUG', 'TRACE']
        The system log level

    Notes
    -----
    Input images should be in BGR Order

    Model exported from: https://github.com/WeidiXie/Keras-VGGFace2-ResNet50 which is based on:
    https://www.robots.ox.ac.uk/~vgg/software/vgg_face/


    Licensed under Creative Commons Attribution License.
    https://creativecommons.org/licenses/by-nc/4.0/
    """ </s> remove from lib.gui.utils import get_images, initialize_images
 </s> add from lib.gui.utils import get_images, initialize_config, initialize_images </s> remove     def get_model(git_model_id, model_filename, backend):
        """ Check if model is available, if not, download and unzip it """
 </s> add     def _get_model(git_model_id, model_filename, backend):
        """ Check if model is available, if not, download and unzip it

        Parameters
        ----------
        git_model_id: int
            The second digit in the github tag that identifies this model. See
            https://github.com/deepfakes-models/faceswap-models for more information
        model_filename: str
            The name of the model to be loaded (see :class:`lib.utils.GetModel` for more
            information)
        backend: ['GPU', 'CPU']
            Whether to run inference on a GPU or on the CPU

        See Also
        --------
        lib.utils.GetModel: The model downloading and allocation class.
        """ </s> remove     def seriation(self, tree, points, current_index):
        """ Seriation method for sorted similarity
            input:
                - tree is a hierarchical tree (dendrogram)
                - points is the number of points given to the clustering process
                - current_index is the position in the tree for the recursive traversal
            output:
                - order implied by the hierarchical tree
 </s> add     def _seriation(self, tree, points, current_index):
        """ Seriation method for sorted similarity. </s> remove         """ Sort a matrix of predictions by similarity Adapted from:
            https://gmarti.gitlab.io/ml/2017/09/07/how-to-sort-distance-matrix.html
        input:
            - predictions is a stacked matrix of vgg_face predictions shape: (x, 4096)
            - method = ["ward","single","average","complete"]
        output:
            - result_order is a list of indices with the order implied by the hierarhical tree

        sorted_similarity transforms a distance matrix into a sorted distance matrix according to
        the order implied by the hierarchical tree (dendrogram)
 </s> add         """ Sort a matrix of predictions by similarity.

        Transforms a distance matrix into a sorted distance matrix according to the order implied
        by the hierarchical tree (dendrogram).

        Parameters
        ----------
        predictions: numpy.ndarray
            A stacked matrix of vgg_face2 predictions of the shape (`N`, `D`) where `N` is the
            number of observations and `D` are the number of dimensions.  NB: The given
            :attr:`predictions` will be overwritten to save memory. If you still require the 
            original values you should take a copy prior to running this method
        method: ['single','centroid','median','ward']
            The clustering method to use.

        Returns
        -------
        list:
            List of indices with the order implied by the hierarchical tree
""" VGG_Face2 inference and sorting """
  #!/usr/bin python3
""" VGG_Face2 inference and sorting """
""" VGG_Face2 inference and sorting """
""" VGG_Face2 inference and sorting """
""" VGG_Face2 inference and sorting """
""" VGG_Face2 inference and sorting """
""" VGG_Face2 inference and sorting """
""" VGG_Face2 inference and sorting """
  
  import logging
  import sys
  import os
  import psutil
keep replace replace replace replace replace replace replace keep keep keep keep keep
 bugfix: tools.preview - Fix for new icons
bugfix: lib.vgg_face2_keras - Remove debug code
documentation: lib.vgg_face2_keras 
lib/vgg_face2_keras.py