From 416c52ea167971369780f61788a7d43f0fd00612 Mon Sep 17 00:00:00 2001 From: torzdf <36920800+torzdf@users.noreply.github.com> Date: Sun, 16 Jun 2019 15:03:29 +0100 Subject: [PATCH] Formatting cleanup --- lib/cli.py | 7 +++++-- lib/logger.py | 2 +- lib/umeyama.py | 41 ++++++++++++++++++++++++++++++----------- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/lib/cli.py b/lib/cli.py index eb39960a75..2c6c15bceb 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 """ Command Line Arguments """ + +# pylint: disable=too-many-lines + import argparse import logging import os @@ -532,7 +535,7 @@ def get_optional_arguments(): "extraction speed cost. Different methods will yield " "different results on different sets." "\nL|'none': Don't perform normalization on the face." - "\nL|`clahe`: Perform Contrast Limited Adaptive Histogram " + "\nL|'clahe': Perform Contrast Limited Adaptive Histogram " "Equalization on the face." "\nL|'hist': Equalize the histograms on the RGB channels." "\nL|'mean': Normalize the face colors to the mean."}) @@ -734,7 +737,7 @@ def get_optional_arguments(): False), "default": "opencv", "help": "R|The plugin to use to output the converted images. The " - "writers are configurable in '/config/convert.ini' or `Edit " + "writers are configurable in '/config/convert.ini' or 'Edit " "> Configure Convert Plugins:'" "\nL|ffmpeg: [video] Writes out the convert straight to " "video. When the input is a series of images then the " diff --git a/lib/logger.py b/lib/logger.py index f62b696fe8..e2e27fb3bf 100644 --- a/lib/logger.py +++ b/lib/logger.py @@ -137,7 +137,7 @@ def stream_handler(loglevel, is_gui): def crash_handler(log_format): - """ Add a handler that sores the last 50 debug lines to `debug_buffer` + """ Add a handler that sores the last 50 debug lines to 'debug_buffer' for use in crash reports """ log_crash = logging.StreamHandler(debug_buffer) log_crash.setFormatter(log_format) diff --git a/lib/umeyama.py b/lib/umeyama.py index f3af365a9a..d767a01144 100644 --- a/lib/umeyama.py +++ b/lib/umeyama.py @@ -1,15 +1,33 @@ -## License (Modified BSD) -## Copyright (C) 2011, the scikit-image team All rights reserved. -## -## Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -## -## Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -## Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -## Neither the name of skimage nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. -## THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# umeyama function from scikit-image/skimage/transform/_geometric.py +#!/usr/bin/env python3 +""" Umeyama for Faceswap + License (Modified BSD) + Copyright (C) 2011, the scikit-image team All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, this list of + conditions and the following disclaimer in the documentation and/or other materials provided + with the distribution. + + Neither the name of skimage nor the names of its contributors may be used to endorse or promote + products derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + umeyama function from scikit-image/skimage/transform/_geometric.py +""" import numpy as np MEAN_FACE_X = np.array([ @@ -32,6 +50,7 @@ 0.864805, 0.784792, 0.778746, 0.785343, 0.778746, 0.784792, 0.824182, 0.831803, 0.824182]) + def umeyama(src, estimate_scale, dst=None): """Estimate N-D similarity transformation with or without scaling. Parameters