Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/10336963master
| @@ -1,3 +1,5 @@ | |||||
| # Part of the implementation is borrowed and modified from BasicSR, publicly available at | |||||
| # https://github.com/XPixelGroup/BasicSR/blob/master/basicsr/metrics/psnr_ssim.py | |||||
| from typing import Dict | from typing import Dict | ||||
| import numpy as np | import numpy as np | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation is adopted from stylegan2-pytorch, made public available under the MIT License | |||||
| # at https://github.com/rosinality/stylegan2-pytorch/blob/master/op/conv2d_gradfix.py | |||||
| import contextlib | import contextlib | ||||
| import warnings | import warnings | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation is adopted from stylegan2-pytorch, made public available under the MIT License | |||||
| # t https://github.com/rosinality/stylegan2-pytorch/blob/master/op/fused_act.py | |||||
| import os | import os | ||||
| import torch | import torch | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation is adopted from stylegan2-pytorch, made public available under the MIT License | |||||
| # at https://github.com/rosinality/stylegan2-pytorch/blob/master/op/upfirdn2d.py | |||||
| import os | import os | ||||
| from collections import abc | from collections import abc | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation is adopted from stylegan2-pytorch, | |||||
| # made public available under the MIT License at https://github.com/rosinality/stylegan2-pytorch/blob/master/model.py | |||||
| import functools | import functools | ||||
| import math | import math | ||||
| import operator | import operator | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation here is modified based on DeOldify, originally MIT License | |||||
| # and publicly available at https://github.com/jantic/DeOldify/blob/master/deoldify/unet.py | |||||
| import numpy as np | import numpy as np | ||||
| import torch | import torch | ||||
| import torch.nn as nn | import torch.nn as nn | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation here is modified based on DeOldify, originally MIT License and | |||||
| # publicly available at https://github.com/jantic/DeOldify/blob/master/fastai/callbacks/hooks.py | |||||
| import functools | import functools | ||||
| from enum import Enum | from enum import Enum | ||||
| @@ -1,3 +1,5 @@ | |||||
| # Part of the implementation is borrowed and modified from Face-Alignment, | |||||
| # publicly available at https://github.com/foamliu/Face-Alignment/blob/master/align_faces.py | |||||
| import cv2 | import cv2 | ||||
| import numpy as np | import numpy as np | ||||
| from skimage import transform as trans | from skimage import transform as trans | ||||
| @@ -1,3 +1,4 @@ | |||||
| # Copyright (c) Alibaba, Inc. and its affiliates. | |||||
| import os | import os | ||||
| import cv2 | import cv2 | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation is adopted from FaceQuality, made publicly available under the MIT License | |||||
| # at https://github.com/deepcam-cn/FaceQuality/blob/master/models/model_resnet.py | |||||
| import torch | import torch | ||||
| from torch import nn | from torch import nn | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The GPEN implementation is also open-sourced by the authors, | |||||
| # and available at https://github.com/yangxy/GPEN/blob/main/face_model/gpen_model.py | |||||
| import functools | import functools | ||||
| import itertools | import itertools | ||||
| import math | import math | ||||
| @@ -1,3 +1,4 @@ | |||||
| # Copyright (c) Alibaba, Inc. and its affiliates. | |||||
| import math | import math | ||||
| import os.path as osp | import os.path as osp | ||||
| from copy import deepcopy | from copy import deepcopy | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation is adopted from InsightFace_Pytorch, | |||||
| # made publicly available under the MIT License at https://github.com/TreB1eN/InsightFace_Pytorch/blob/master/model.py | |||||
| from collections import namedtuple | from collections import namedtuple | ||||
| import torch | import torch | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The GPEN implementation is also open-sourced by the authors, | |||||
| # and available at https://github.com/yangxy/GPEN/tree/main/training/loss/id_loss.py | |||||
| import torch | import torch | ||||
| import torch.nn as nn | import torch.nn as nn | ||||
| import torch.nn.functional as F | import torch.nn.functional as F | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation is adopted from InsightFace_Pytorch, | |||||
| # made publicly available under the MIT License at https://github.com/TreB1eN/InsightFace_Pytorch/blob/master/model.py | |||||
| from torch.nn import (BatchNorm1d, BatchNorm2d, Conv2d, Dropout, Linear, | from torch.nn import (BatchNorm1d, BatchNorm2d, Conv2d, Dropout, Linear, | ||||
| Module, PReLU, Sequential) | Module, PReLU, Sequential) | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The GPEN implementation is also open-sourced by the authors, | |||||
| # and available at https://github.com/yangxy/GPEN/blob/main/face_detect/retinaface_detection.py | |||||
| import os | import os | ||||
| import cv2 | import cv2 | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation is adopted from Pytorch_Retinaface, made pubicly available under the MIT License | |||||
| # at https://github.com/biubug6/Pytorch_Retinaface/tree/master/models/net.py | |||||
| import time | import time | ||||
| import torch | import torch | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation is adopted from Pytorch_Retinaface, made pubicly available under the MIT License | |||||
| # at https://github.com/biubug6/Pytorch_Retinaface/tree/master/models/retinaface.py | |||||
| from collections import OrderedDict | from collections import OrderedDict | ||||
| import torch | import torch | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation is adopted from BasicSR, made public available under the Apache 2.0 License | |||||
| # at https://github.com/XPixelGroup/BasicSR/blob/master/basicsr/archs/arch_util.py | |||||
| import collections.abc | import collections.abc | ||||
| import math | import math | ||||
| import warnings | import warnings | ||||
| @@ -1,3 +1,5 @@ | |||||
| # The implementation is adopted from BasicSR, made public available under the Apache 2.0 License | |||||
| # at https://github.com/XPixelGroup/BasicSR/blob/master/basicsr/archs/rrdbnet_arch.py | |||||
| import torch | import torch | ||||
| from torch import nn as nn | from torch import nn as nn | ||||
| from torch.nn import functional as F | from torch.nn import functional as F | ||||