GFPGAN is a blind face restoration algorithm towards real-world face images.

Related tags

Admin PanelsGFPGAN
Overview

GFPGAN (CVPR 2021)

Paper | Project Page    English | 简体中文

GFPGAN is a blind face restoration algorithm towards real-world face images.

google colab logo Colab Demo

📖 GFP-GAN: Towards Real-World Blind Face Restoration with Generative Facial Prior

[Paper]   [Project Page]   [Demo]
Xintao Wang, Yu Li, Honglun Zhang, Ying Shan
Applied Research Center (ARC), Tencent PCG

Abstract

Blind face restoration usually relies on facial priors, such as facial geometry prior or reference prior, to restore realistic and faithful details. However, very low-quality inputs cannot offer accurate geometric prior while high-quality references are inaccessible, limiting the applicability in real-world scenarios. In this work, we propose GFP-GAN that leverages rich and diverse priors encapsulated in a pretrained face GAN for blind face restoration. This Generative Facial Prior (GFP) is incorporated into the face restoration process via novel channel-split spatial feature transform layers, which allow our method to achieve a good balance of realness and fidelity. Thanks to the powerful generative facial prior and delicate designs, our GFP-GAN could jointly restore facial details and enhance colors with just a single forward pass, while GAN inversion methods require expensive image-specific optimization at inference. Extensive experiments show that our method achieves superior performance to prior art on both synthetic and real-world datasets.

BibTeX

@InProceedings{wang2021gfpgan,
    author = {Xintao Wang and Yu Li and Honglun Zhang and Ying Shan},
    title = {Towards Real-World Blind Face Restoration with Generative Facial Prior},
    booktitle={The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
    year = {2021}
}


🔧 Dependencies and Installation

Installation

  1. Clone repo

    git clone https://github.com/xinntao/GFPGAN.git
    cd GFPGAN
  2. Install dependent packages

    # Install basicsr - https://github.com/xinntao/BasicSR
    # We use BasicSR for both training and inference
    # Set BASICSR_EXT=True to compile the cuda extensions in the BasicSR - It may take several minutes to compile, please be patient
    BASICSR_EXT=True pip install basicsr
    
    # Install facexlib - https://github.com/xinntao/facexlib
    # We use face detection and face restoration helper in the facexlib package
    pip install facexlib
    
    pip install -r requirements.txt

Quick Inference

Download pre-trained models: GFPGANv1.pth

wget https://github.com/TencentARC/GFPGAN/releases/download/v0.1.0/GFPGANv1.pth -P experiments/pretrained_models
python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/whole_imgs

# for aligned images
python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/cropped_faces --aligned

💻 Training

We provide complete training codes for GFPGAN.
You could improve it according to your own needs.

  1. Dataset preparation: FFHQ

  2. Download pre-trained models and other data. Put them in the experiments/pretrained_models folder.

    1. Pretrained StyleGAN2 model: StyleGAN2_512_Cmul1_FFHQ_B12G4_scratch_800k.pth
    2. Component locations of FFHQ: FFHQ_eye_mouth_landmarks_512.pth
    3. A simple ArcFace model: arcface_resnet18.pth
  3. Modify the configuration file train_gfpgan_v1.yml accordingly.

  4. Training

python -m torch.distributed.launch --nproc_per_node=4 --master_port=22021 train.py -opt train_gfpgan_v1.yml --launcher pytorch

📜 License and Acknowledgement

GFPGAN is realeased under Apache License Version 2.0.

📧 Contact

If you have any question, please email [email protected] or [email protected].

Comments
  • 训练日志异常

    训练日志异常

    为什么当我将4gpu调整为2gpu,训练时就不输出结果?无论是实时终端,亦或是experiments内项目文件下本应出现的log文件,都无。改动如下:

    # general settings
    name: train_GFPGANv1_512_2gpu
    model_type: GFPGANModel
    num_gpu: 2     # 4
    manual_seed: 0
    

    2021-07-06 10-33-58 的屏幕截图 gpu看情况是进入训练状态的。 ps:之前复现您的BasicSR中的esrgan也是类似情况

    opened by JiaweiShiCV 28
  • ImportError: No module named 'deform_conv'

    ImportError: No module named 'deform_conv'

    I run Quick Inference after I finish the installation: "python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/cropped_faces --aligned". Then I encountered the following error:

    `(GFPGAN) D:\Profession\Git\GFPGAN>python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/cropped_faces --aligned ----compiler_info: 用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.16.27045 版 版权所有(C) Microsoft Corporation。保留所有权利。

    用法: cl [ 选项... ] 文件名... [ /link 链接选项... ]

    ----match: <re.Match object; span=(35, 46), match='19.16.27045'> Traceback (most recent call last): File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\basicsr\ops\dcn\deform_conv.py", line 10, in from . import deform_conv_ext ImportError: cannot import name 'deform_conv_ext' from 'basicsr.ops.dcn' (D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\basicsr\ops\dcn_init_.py)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "inference_gfpgan_full.py", line 10, in from archs.gfpganv1_arch import GFPGANv1 File "D:\Profession\Git\GFPGAN\archs_init_.py", line 4, in from basicsr.utils import scandir File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\basicsr_init_.py", line 3, in from .archs import * File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\basicsr\archs_init_.py", line 16, in arch_modules = [importlib.import_module(f'basicsr.archs.{file_name}') for file_name in arch_filenames] File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\basicsr\archs_init.py", line 16, in arch_modules = [importlib.import_module(f'basicsr.archs.{file_name}') for file_name in arch_filenames] File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\importlib_init.py", line 127, in import_module return _bootstrap.gcd_import(name[level:], package, level) File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\basicsr\archs\edsr_arch.py", line 4, in from basicsr.archs.arch_util import ResidualBlockNoBN, Upsample, make_layer File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\basicsr\archs\arch_util.py", line 8, in from basicsr.ops.dcn import ModulatedDeformConvPack, modulated_deform_conv File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\basicsr\ops\dcn_init.py", line 1, in from .deform_conv import (DeformConv, DeformConvPack, ModulatedDeformConv, ModulatedDeformConvPack, deform_conv, File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\basicsr\ops\dcn\deform_conv.py", line 22, in os.path.join(module_path, 'src', 'deform_conv_cuda_kernel.cu'), File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\torch\utils\cpp_extension.py", line 983, in load keep_intermediates=keep_intermediates) File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\torch\utils\cpp_extension.py", line 1199, in _jit_compile return _import_module_from_library(name, build_directory, is_python_module) File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\site-packages\torch\utils\cpp_extension.py", line 1546, in _import_module_from_library file, path, description = imp.find_module(module_name, [path]) File "D:\Profession\ProgramData\Anaconda3\envs\GFPGAN\lib\imp.py", line 296, in find_module raise ImportError(_ERR_MSG.format(name), name=name) ImportError: No module named 'deform_conv'`

    I found that someone had the same problem as me, but it didn’t solve it. Is there a solution to this ERROR?Thanks for the ANY HELP~

    opened by EndeCC0 16
  • NameError: name 'fused_act_ext' is not defined

    NameError: name 'fused_act_ext' is not defined

    Attempt for quick inference is throwing NameError: name 'fused_act_ext' is not defined. I'll highly appreciate your assistance. Below are the details of the error and conda packages.

    Your assistance can also come in a form of simply sharing your list installed packages.

    $ python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/whole_imgs
    Processing 00.jpg ...
    Traceback (most recent call last):
    File "/deepmind/github/tencentarc/gfpgan/inference_gfpgan_full.py", line 120, in <module>
    restoration(
    File "/deepmind/github/tencentarc/gfpgan/inference_gfpgan_full.py", line 49, in restoration
    output = gfpgan(cropped_face_t, return_rgb=False)[0]
    File "/storage/usr/conda/envs/gfpgan/lib/python3.9/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
    File "/deepmind/github/tencentarc/gfpgan/archs/gfpganv1_arch.py", line 348, in forward
    feat = self.conv_body_first(x)
    File "/storage/usr/conda/envs/gfpgan/lib/python3.9/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
    File "/storage/usr/conda/envs/gfpgan/lib/python3.9/site-packages/torch/nn/modules/container.py", line 117, in forward
    input = module(input)
    File "/storage/usr/conda/envs/gfpgan/lib/python3.9/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
    File "/storage/usr/conda/envs/gfpgan/lib/python3.9/site-packages/basicsr/ops/fused_act/fused_act.py", line 85, in forward
    return fused_leaky_relu(input, self.bias, self.negative_slope, self.scale)
    File "/storage/usr/conda/envs/gfpgan/lib/python3.9/site-packages/basicsr/ops/fused_act/fused_act.py", line 89, in fused_leaky_relu
    return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
    File "/storage/usr/conda/envs/gfpgan/lib/python3.9/site-packages/basicsr/ops/fused_act/fused_act.py", line 59, in forward
    out = fused_act_ext.fused_bias_act(input, bias, empty, 3, 0, negative_slope, scale)
    NameError: name 'fused_act_ext' is not defined
    
    $ conda list
    # packages in environment at /storage/usr/conda/envs/gfpgan:
    #
    # Name                    Version                   Build  Channel
    _libgcc_mutex             0.1                 conda_forge    conda-forge
    _openmp_mutex             4.5                      1_llvm    conda-forge
    _pytorch_select           0.1                       cpu_0    anaconda
    absl-py                   0.13.0             pyhd8ed1ab_0    conda-forge
    addict                    2.4.0            py39hf3d152e_0    conda-forge
    aiohttp                   3.7.4.post0      py39h3811e60_0    conda-forge
    alsa-lib                  1.2.3                h516909a_0    conda-forge
    appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
    async-timeout             3.0.1                   py_1000    conda-forge
    attrs                     21.2.0             pyhd8ed1ab_0    conda-forge
    basicsr                   1.3.3.4                  pypi_0    pypi
    blas                      1.0                         mkl    anaconda
    blinker                   1.4                        py_1    conda-forge
    blosc                     1.21.0               h9c3ff4c_0    conda-forge
    brotli                    1.0.9                h9c3ff4c_4    conda-forge
    brotlipy                  0.7.0           py39h3811e60_1001    conda-forge
    brunsli                   0.1                  h9c3ff4c_0    conda-forge
    bzip2                     1.0.8                h7f98852_4    conda-forge
    c-ares                    1.17.1               h7f98852_1    conda-forge
    ca-certificates           2021.5.30            ha878542_0    conda-forge
    cachetools                4.2.2              pyhd8ed1ab_0    conda-forge
    cairo                     1.16.0            h6cf1ce9_1008    conda-forge
    certifi                   2021.5.30        py39hf3d152e_0    conda-forge
    cffi                      1.14.5           py39he32792d_0    conda-forge
    cfitsio                   3.470                hb418390_7    conda-forge
    chardet                   4.0.0            py39hf3d152e_1    conda-forge
    charls                    2.2.0                h9c3ff4c_0    conda-forge
    click                     8.0.1            py39hf3d152e_0    conda-forge
    cloudpickle               1.6.0                      py_0    conda-forge
    cryptography              3.4.7            py39hbca0aa6_0    conda-forge
    cudatoolkit               10.2.89              h8f6ccaa_8    conda-forge
    cycler                    0.10.0                     py_2    conda-forge
    cytoolz                   0.11.0           py39h3811e60_3    conda-forge
    dask-core                 2021.6.1           pyhd8ed1ab_0    conda-forge
    dataclasses               0.8                pyhc8e2a94_1    conda-forge
    dbus                      1.13.18              hb2f20db_0    anaconda
    decorator                 5.0.9              pyhd8ed1ab_0    conda-forge
    expat                     2.4.1                h9c3ff4c_0    conda-forge
    facexlib                  0.1.3                    pypi_0    pypi
    ffmpeg                    4.3.1                hca11adc_2    conda-forge
    fontconfig                2.13.1            hba837de_1005    conda-forge
    freetype                  2.10.4               h0708190_1    conda-forge
    fsspec                    2021.6.0           pyhd8ed1ab_0    conda-forge
    future                    0.18.2           py39hf3d152e_3    conda-forge
    gettext                   0.21.0               hf68c758_0  
    giflib                    5.2.1                h36c2ea0_2    conda-forge
    glib                      2.68.3               h9c3ff4c_0    conda-forge
    glib-tools                2.68.3               h9c3ff4c_0    conda-forge
    gmp                       6.2.1                h58526e2_0    conda-forge
    gnutls                    3.6.15               he1e5248_0  
    google-auth               1.31.0             pyhd3eb1b0_0  
    google-auth-oauthlib      0.4.1                      py_2    conda-forge
    graphite2                 1.3.14               h23475e2_0    anaconda
    grpcio                    1.38.0           py39hff7568b_0    conda-forge
    gst-plugins-base          1.18.4               hf529b03_2    conda-forge
    gstreamer                 1.18.4               h76c114f_2    conda-forge
    harfbuzz                  2.8.1                h83ec7ef_0    conda-forge
    hdf5                      1.10.6          nompi_h6a2412b_1114    conda-forge
    icu                       68.1                 h58526e2_0    conda-forge
    idna                      2.10               pyh9f0ad1d_0    conda-forge
    imagecodecs               2021.6.8         py39h44211f0_0    conda-forge
    imageio                   2.9.0                      py_0    conda-forge
    importlib-metadata        4.5.0            py39hf3d152e_0    conda-forge
    jasper                    1.900.1           h07fcdf6_1006    conda-forge
    jbig                      2.1               h7f98852_2003    conda-forge
    jpeg                      9d                   h36c2ea0_0    conda-forge
    jxrlib                    1.1                  h7f98852_2    conda-forge
    kiwisolver                1.3.1            py39h1a9c180_1    conda-forge
    krb5                      1.19.1               hcc1bbae_0    conda-forge
    lame                      3.100             h7f98852_1001    conda-forge
    lcms2                     2.12                 hddcbb42_0    conda-forge
    ld_impl_linux-64          2.35.1               hea4e1c9_2    conda-forge
    lerc                      2.2.1                h9c3ff4c_0    conda-forge
    libaec                    1.0.5                h9c3ff4c_0    conda-forge
    libblas                   3.9.0                     8_mkl    conda-forge
    libcblas                  3.9.0                     8_mkl    conda-forge
    libclang                  11.1.0          default_ha53f305_1    conda-forge
    libcurl                   7.77.0               h2574ce0_0    conda-forge
    libdeflate                1.7                  h7f98852_5    conda-forge
    libedit                   3.1.20210216         h27cfd23_1  
    libev                     4.33                 h516909a_1    conda-forge
    libevent                  2.1.10               hcdb4288_3    conda-forge
    libffi                    3.3                  h58526e2_2    conda-forge
    libgcc-ng                 9.3.0               h2828fa1_19    conda-forge
    libgfortran-ng            9.3.0               hff62375_19    conda-forge
    libgfortran5              9.3.0               hff62375_19    conda-forge
    libglib                   2.68.3               h3e27bee_0    conda-forge
    libiconv                  1.16                 h516909a_0    conda-forge
    libidn2                   2.3.1                h7f98852_0    conda-forge
    liblapack                 3.9.0                     8_mkl    conda-forge
    liblapacke                3.9.0                     8_mkl    conda-forge
    libllvm11                 11.1.0               hf817b99_2    conda-forge
    libnghttp2                1.43.0               h812cca2_0    conda-forge
    libogg                    1.3.5                h27cfd23_1  
    libopencv                 4.5.2            py39h2406f9b_0    conda-forge
    libopus                   1.3.1                h7f98852_1    conda-forge
    libpng                    1.6.37               h21135ba_2    conda-forge
    libpq                     13.3                 hd57d9b9_0    conda-forge
    libprotobuf               3.15.8               h780b84a_0    conda-forge
    libssh2                   1.9.0                ha56f1ee_6    conda-forge
    libstdcxx-ng              9.3.0               h6de172a_19    conda-forge
    libtasn1                  4.16.0               h27cfd23_0  
    libtiff                   4.3.0                hf544144_1    conda-forge
    libunistring              0.9.10               h14c3975_0    conda-forge
    libuuid                   2.32.1            h7f98852_1000    conda-forge
    libuv                     1.41.0               h7f98852_0    conda-forge
    libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
    libwebp-base              1.2.0                h7f98852_2    conda-forge
    libxcb                    1.14                 h7b6447c_0    anaconda
    libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
    libxml2                   2.9.12               h72842e0_0    conda-forge
    libzopfli                 1.0.3                h9c3ff4c_0    conda-forge
    llvm-openmp               11.1.0               h4bd325d_1    conda-forge
    lmdb                      1.2.1                    pypi_0    pypi
    locket                    0.2.1            py39h06a4308_1  
    lz4-c                     1.9.3                h9c3ff4c_0    conda-forge
    markdown                  3.3.4              pyhd8ed1ab_0    conda-forge
    matplotlib-base           3.4.2            py39h2fa2bec_0    conda-forge
    mkl                       2020.4             h726a3e6_304    conda-forge
    multidict                 5.1.0            py39h3811e60_1    conda-forge
    mysql-common              8.0.25               ha770c72_2    conda-forge
    mysql-libs                8.0.25               hfa10184_2    conda-forge
    ncurses                   6.2                  h58526e2_4    conda-forge
    nettle                    3.7.3                hbbd107a_1  
    networkx                  2.5                        py_0    anaconda
    ninja                     1.10.2               h4bd325d_0    conda-forge
    nspr                      4.30                 h9c3ff4c_0    conda-forge
    nss                       3.67                 hb5efdd6_0    conda-forge
    numpy                     1.20.3           py39hdbf815f_1    conda-forge
    oauthlib                  3.1.1              pyhd8ed1ab_0    conda-forge
    olefile                   0.46               pyh9f0ad1d_1    conda-forge
    opencv                    4.5.2            py39hf3d152e_0    conda-forge
    opencv-python             4.5.2.54                 pypi_0    pypi
    openh264                  2.1.1                h780b84a_0    conda-forge
    openjpeg                  2.4.0                hb52868f_1    conda-forge
    openssl                   1.1.1k               h7f98852_0    conda-forge
    packaging                 20.9               pyh44b312d_0    conda-forge
    partd                     1.2.0              pyhd8ed1ab_0    conda-forge
    pcre                      8.45                 h9c3ff4c_0    conda-forge
    pillow                    8.2.0            py39hf95b381_1    conda-forge
    pip                       21.1.2             pyhd8ed1ab_0    conda-forge
    pixman                    0.40.0               h36c2ea0_0    conda-forge
    pooch                     1.4.0              pyhd8ed1ab_0    conda-forge
    protobuf                  3.15.8           py39he80948d_0    conda-forge
    py-opencv                 4.5.2            py39hef51801_0    conda-forge
    pyasn1                    0.4.8                      py_0    conda-forge
    pyasn1-modules            0.2.8                      py_0    anaconda
    pycparser                 2.20               pyh9f0ad1d_2    conda-forge
    pyjwt                     2.1.0              pyhd8ed1ab_0    conda-forge
    pyopenssl                 20.0.1             pyhd8ed1ab_0    conda-forge
    pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
    pysocks                   1.7.1            py39hf3d152e_3    conda-forge
    python                    3.9.5           h49503c6_0_cpython    conda-forge
    python-dateutil           2.8.1                      py_0    conda-forge
    python_abi                3.9                      1_cp39    conda-forge
    pytorch                   1.7.1           py3.9_cuda10.2.89_cudnn7.6.5_0    pytorch
    pywavelets                1.1.1            py39hce5d2b2_3    conda-forge
    pyyaml                    5.4.1            py39h3811e60_0    conda-forge
    qt                        5.12.9               hda022c4_4    conda-forge
    readline                  8.1                  h46c0cb4_0    conda-forge
    requests                  2.25.1             pyhd3deb0d_0    conda-forge
    requests-oauthlib         1.3.0              pyh9f0ad1d_0    conda-forge
    rsa                       4.7.2              pyh44b312d_0    conda-forge
    scikit-image              0.18.1           py39hde0f152_0    conda-forge
    scipy                     1.6.3            py39hee8e79c_0    conda-forge
    setuptools                52.0.0           py39h06a4308_0  
    six                       1.16.0             pyh6c4a22f_0    conda-forge
    sleef                     3.5.1                h7f98852_1    conda-forge
    snappy                    1.1.8                he1b5a44_3    conda-forge
    sqlite                    3.35.5               h74cdb3f_0    conda-forge
    tb-nightly                2.6.0a20210615           pypi_0    pypi
    tensorboard               2.5.0              pyhd8ed1ab_0    conda-forge
    tensorboard-data-server   0.6.0            py39h3da14fd_0    conda-forge
    tensorboard-plugin-wit    1.8.0              pyh44b312d_0    conda-forge
    tifffile                  2021.6.14          pyhd8ed1ab_0    conda-forge
    tk                        8.6.10               h21135ba_1    conda-forge
    toolz                     0.11.1                     py_0    conda-forge
    torchvision               0.8.2           cpu_py39ha229d99_0  
    tornado                   6.1              py39h3811e60_1    conda-forge
    tqdm                      4.61.1             pyhd8ed1ab_0    conda-forge
    typing-extensions         3.10.0.0             hd8ed1ab_0    conda-forge
    typing_extensions         3.10.0.0           pyha770c72_0    conda-forge
    tzdata                    2021a                he74cb21_0    conda-forge
    urllib3                   1.26.5             pyhd8ed1ab_0    conda-forge
    werkzeug                  2.0.1              pyhd8ed1ab_0    conda-forge
    wheel                     0.36.2             pyhd3deb0d_0    conda-forge
    x264                      1!161.3030           h7f98852_1    conda-forge
    xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
    xorg-libice               1.0.10               h7f98852_0    conda-forge
    xorg-libsm                1.2.3             hd9c2040_1000    conda-forge
    xorg-libx11               1.7.2                h7f98852_0    conda-forge
    xorg-libxext              1.3.4                h7f98852_1    conda-forge
    xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
    xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
    xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
    xorg-xproto               7.0.31            h7f98852_1007    conda-forge
    xz                        5.2.5                h516909a_1    conda-forge
    yaml                      0.2.5                h516909a_0    conda-forge
    yapf                      0.31.0             pyhd8ed1ab_0    conda-forge
    yarl                      1.6.3            py39h3811e60_1    conda-forge
    zfp                       0.5.5                h9c3ff4c_5    conda-forge
    zipp                      3.4.1              pyhd8ed1ab_0    conda-forge
    zlib                      1.2.11            h516909a_1010    conda-forge
    zstd                      1.5.0                ha95c52a_0    conda-forge
    
    opened by jerrymatjila 15
  • I want export

    I want export "GFPGANCleanv1-NoCE-C2.pth" to ONNX

    I want to use dynamic weights in F.conv2d in pytorch.

        def forward(self, x, style):
            b, c, h, w = x.shape  # c = c_in
    
            style = self.modulation(style).view(b, 1, c, 1, 1)
            weight = self.weight * style  # (b, c_out, c_in, k, k)
            weight = weight.view(b * self.out_channels, c, self.kernel_size, self.kernel_size)
    
            b, c, h, w = x.shape
            x = x.view(1, b * c, h, w)
    
            out = F.conv2d(x, weight, padding=self.padding, groups=b)
            out = out.view(b, self.out_channels, *out.shape[2:4])
    
            return out
    

    However, only constant weights are supported in Barracuda.

    How can I change F.conv2d?

    opened by jjeamin 11
  • Complile error when building extension 'deform_conv'

    Complile error when building extension 'deform_conv'

    I have followed the "Installation" but encountering below error. Details are attached below. Any help will be grateful. When running cmd: CUDA_HOME=/usr/local/cuda-10.2 BASICSR_EXT=True pip install basicsr below error shows: ERROR: Command errored out with exit status 1: command: /data/anaconda3/envs/pytorch18/bin/python3.8 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ekcq6eum/basicsr_4146e4815a4548d195157ceecc274ac0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ekcq6eum/basicsr_4146e4815a4548d195157ceecc274ac0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-uoof9gcv cwd: /tmp/pip-install-ekcq6eum/basicsr_4146e4815a4548d195157ceecc274ac0/ Complete output (260 lines): Traceback (most recent call last): File "/tmp/pip-install-ekcq6eum/basicsr_4146e4815a4548d195157ceecc274ac0/basicsr/ops/dcn/deform_conv.py", line 10, in <module> from . import deform_conv_ext ImportError: cannot import name 'deform_conv_ext' from partially initialized module 'basicsr.ops.dcn' (most likely due to a circular import) (/tmp/pip-install-ekcq6eum/basicsr_4146e4815a4548d195157ceecc274ac0/basicsr/ops/dcn/__init__.py)

    The error shows we can't import deform_conv_ext. I think it says that module deform_conv_ext has not been built successfully. But i don't know how to check it when using pip install. So i try to install basicsr by git clone and compile following this link. But when i ran command: CUDA_HOME=/usr/local/cuda-10.2 BASICSR_EXT=True python setup.py develop It failed when building 'basicsr.ops.dcn.deform_conv_ext' extension image

    I have googled it and found no useful information. Here is my enviroment: gcc: 7.5.0 cuda: 10.2 image torch.config.show() 'PyTorch built with:\n - GCC 7.3\n - C++ Version: 201402\n

    opened by syfbme 11
  • Has colorization been removed or only disabled?

    Has colorization been removed or only disabled?

    Generative facial prior is genius. Wonderful research

    Was colorization removed or just disabled by feature? I was unable to locate color jitter or grey settings.

    opened by Ghee36 10
  • Add Docker environment & web demo

    Add Docker environment & web demo

    Hey @xinntao ! 👋

    Appreciated your feedback on the previous PR. It has been modified accordingly in this PR.

    This pull request makes it possible to run your model inside a Docker environment, which makes it easier for other people to run it. We're using an open source tool called Cog to make this process easier.

    This also means we can make a web page where other people can try out your model! View it here: https://replicate.ai/xinntao/gfpgan (We noticed that you have a demo on Gradio, but some of the example images, e.g. 10045.png, would show error there).

    Claim your page here so you can edit it, and we'll feature it on our website and tweet about it too.

    In case you're wondering who I am, I'm from Replicate, where we're trying to make machine learning reproducible. We got frustrated that we couldn't run all the really interesting ML work being done. So, we're going round implementing models we like. 😊

    opened by chenxwh 9
  • 你好大佬,请教几个环境问题

    你好大佬,请教几个环境问题

    大佬好,今天尝试运行这个项目,安装环境失败。 第一次尝试torch==1.9.0+cu111,提示CUDA driver initialization failed, you might not have a CUDA gpu 第二次尝试torch==1.7.0+cu10.2,提示The NVIDIA driver on your system is too old (found version 10010). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. 之前运行DFDNET和GPEN都是没问题的,请问我这是哪里出问题了?希望百忙之中能抽时间帮忙解答下,感谢!

    opened by theoldsong 8
  • 使用checkpoint继续训练的bug

    使用checkpoint继续训练的bug

    当我想要从断点继续训练,我修改了.yml文件以下内容:

    # path
    path:
      pretrain_network_g: experiments/train_GFPGANv1_512/models/net_g_490000.pth
      param_key_g: params_ema
      strict_load_g: ~
      pretrain_network_d: experiments/train_GFPGANv1_512/models/net_d_490000.pth
      pretrain_network_d_left_eye: experiments/train_GFPGANv1_512/models/net_d_left_eye_490000.pth
      pretrain_network_d_right_eye: experiments/train_GFPGANv1_512/models/net_d_right_eye_490000.pth
      pretrain_network_d_mouth: experiments/train_GFPGANv1_512/models/net_d_mouth_490000.pth
      pretrain_network_identity: experiments/pretrained_models/arcface_resnet18.pth
      # resume
      resume_state: experiments/train_GFPGANv1_512/training_states/490000.state
      ignore_resume_networks: ['network_identity']
    

    我并没有修改pretrain_network_identity项。 但是随后报错:

    FileNotFoundError: [Errno 2] No such file or directory: 'GFPGAN/experiments/train_GFPGANv1_512/models/net_identity_490000.pth'
    

    一脸懵啊。。。 翻看log初始打印所有配置,此时pretrain_network_identity已经变了:

    2021-07-11 22:21:11,000 INFO: Loading ResNetArcFace model from GFPGAN/experiments/train_GFPGANv1_512/models/net_identity_490000.pth.
    

    这。。。。

    opened by JiaweiShiCV 8
  • results are strange while testing on whole img

    results are strange while testing on whole img

    Hi, I'm using pretrain model for testing, while testing on align cropped faces, the results are promising. However, while testing as whole img the results are wrong, seems the detection is not working well because in results cmp folder there is no faces or sereval faces in one img.

    I didn't change the code, is there anything wrong the whole img testing? Thanks in advance.

    opened by tachikoma777 7
  • only paste back from already restored faces

    only paste back from already restored faces

    Is it possible to do this without restoring faces again just with 2x esrgan?

    like

    "python inference_gfpgan.py --upscale 2 --model_path nomodel --test_path results/restored_faces --save_root results/restored_images --paste_back_only"

    ?

    opened by NoUserNameForYou 6
  • Cannot find ground truth images in lfw_cropped_faces, CelebChild-Test, and WebPhoto-Test dataset

    Cannot find ground truth images in lfw_cropped_faces, CelebChild-Test, and WebPhoto-Test dataset

    Hi @xinntao ,

    Thank you so much for your awesome work. Recently, I tried to follow this paper and show comparisons on datasets. However, I cannot find the ground-truth images in lfw_cropped_faces, CelebChild-Test, and WebPhoto-Test datasets. Could you give me some advice? Thanks!

    Best, Wanglong

    opened by LonglongaaaGo 0
  • Replicate and Huggingface Gradio Demos, different image download problem

    Replicate and Huggingface Gradio Demos, different image download problem

    After the face restoration is done in the demos, the image we download is a different image. Presumably, it's a picture uploaded by another person doing face restoration at the same time.

    opened by sezginibis 0
  • Can't Import basicsr

    Can't Import basicsr

    when I install basicsr on my serve,I found it will stuck when I import basicsr image and also,When i want to reinstall basicsr,I find i can't install it with this error image

    opened by yitianlian 0
  • Face identification box is too large, so the fixing function breaks hair and accessories

    Face identification box is too large, so the fixing function breaks hair and accessories

    Is there a way to adjust the face identification to focus only on eyes or really only inside the face?

    The current box is too large and breaks anything outside the face (hair accessory, earrings).

    00005-240035775-mdjrny-v4 style, portrait of a male cleric, D D, fantasy, intricate, elegant, highly detailed, digital painting, artstation, con_00

    Using a simpler but probably not generally accurate code we can find the eyes only.

    But it has been hard to then run the fixing function through it.

    localhost embedded

    Any way to make the face identification much tighter or focus only on eyes?

    Thanks!

    Simple code to identify only eyes.

    import facexlib
    import tensorflow as tf
    import cv2
    from google.colab.patches import cv2_imshow
    
    # Load the Haar cascade for detecting eyes
    eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
    
    # Read the image and convert it to grayscale
    image = cv2.imread('img.png')
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    
    # Adjust the scale factor and minimum neighbor count for the classifier
    scale_factor = 1.33
    min_neighbors = 18
    
    # Detect eyes in the image
    eyes = eye_cascade.detectMultiScale(gray, scale_factor, min_neighbors)
    
    # Draw a rectangle around the eyes
    for (x,y,w,h) in eyes:
        cv2.rectangle(image, (x,y), (x+w, y+h), (255,0,0), 2)
    
    # Show the image
    cv2_imshow(image)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    
    opened by grexzen 1
Releases(v1.3.8)
Owner
Applied Research Center (ARC), Tencent PCG
Applied Research Center (ARC), Tencent PCG
A Django app for easily adding object tools in the Django admin

Django Object Actions If you've ever tried making admin object tools you may have thought, "why can't this be as easy as making Django Admin Actions?"

Chris Chang 524 Dec 26, 2022
Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap.

Xadmin Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap. Liv

差沙 4.7k Dec 31, 2022
Awesome Video Datasets

Awesome Video Datasets

Yunhua Zhang 462 Jan 02, 2023
Python code for "Machine learning: a probabilistic perspective" (2nd edition)

Python code for "Machine learning: a probabilistic perspective" (2nd edition)

Probabilistic machine learning 5.3k Dec 31, 2022
Tactical RMM is a remote monitoring & management tool for Windows computers, built with Django and Vue.

Tactical RMM is a remote monitoring & management tool for Windows computers, built with Django and Vue. It uses an agent written in golan

Dan 1.4k Dec 30, 2022
aiohttp admin is generator for admin interface based on aiohttp

aiohttp admin is generator for admin interface based on aiohttp

Mykhailo Havelia 17 Nov 16, 2022
Extends the Django Admin to include a extensible dashboard and navigation menu

django-admin-tools django-admin-tools is a collection of extensions/tools for the default django administration interface, it includes: a full feature

Django Admin Tools 731 Dec 28, 2022
📱 An extension for Django admin that makes interface mobile-friendly. Merged into Django 2.0

Django Flat Responsive django-flat-responsive is included as part of Django from version 2.0! 🎉 Use this app if your project is powered by an older D

elky 248 Sep 02, 2022
WordPress look and feel for Django administration panel

Django WP Admin WordPress look and feel for Django administration panel. Features WordPress look and feel New styles for selector, calendar and timepi

Maciej Marczewski 266 Nov 21, 2022
Disable dark mode in Django admin user interface in Django 3.2.x.

Django Non Dark Admin Disable or enable dark mode user interface in Django admin panel (Django==3.2). Installation For install this app run in termina

Artem Galichkin 6 Nov 23, 2022
GFPGAN is a blind face restoration algorithm towards real-world face images.

GFPGAN is a blind face restoration algorithm towards real-world face images.

Applied Research Center (ARC), Tencent PCG 25.6k Jan 04, 2023
Django Semantic UI admin theme

Django Semantic UI admin theme A completely free (MIT) Semantic UI admin theme for Django. Actually, this is my 3rd admin theme for Django. The first

Alex 69 Dec 28, 2022
Collection of admin fields and decorators to help to create computed or custom fields more friendly and easy way

django-admin-easy Collection of admin fields, decorators and mixin to help to create computed or custom fields more friendly and easy way Installation

Ezequiel Bertti 364 Jan 08, 2023
Freqtrade is a free and open source crypto trading bot written in Python

Freqtrade is a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram. It contains backtesting, plotting and money man

20.2k Jan 02, 2023
A Django admin theme using Twitter Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed apps.

django-admin-bootstrapped A Django admin theme using Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed ap

1.6k Dec 28, 2022
Extendable, adaptable rewrite of django.contrib.admin

django-admin2 One of the most useful parts of django.contrib.admin is the ability to configure various views that touch and alter data. django-admin2

Jazzband 1.2k Dec 29, 2022
Lazymux is a tool installer that is specially made for termux user which provides a lot of tool mainly used tools in termux and its easy to use

Lazymux is a tool installer that is specially made for termux user which provides a lot of tool mainly used tools in termux and its easy to use, Lazymux install any of the given tools provided by it

DedSecTL 1.8k Jan 09, 2023
Legacy django jet rebooted , supports only Django 3

Django JET Reboot Rebooting the original project : django-jet. Django Jet is modern template for Django admin interface with improved functionality. W

215 Dec 31, 2022
An administration website for Django

yawd-admin, a django administration website yawd-admin now has a live demo at http://yawd-admin.yawd.eu/. Use demo / demo as username & passowrd. yawd

Pantelis Petridis 140 Oct 30, 2021
Video Visual Relation Detection (VidVRD) tracklets generation. also for ACM MM Visual Relation Understanding Grand Challenge

VidVRD-tracklets This repository contains codes for Video Visual Relation Detection (VidVRD) tracklets generation based on MEGA and deepSORT. These tr

25 Dec 21, 2022