文件最后提交记录最后更新时间
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
fix link validity Co-authored-by: frozenleaves<914814442@qq.com> # message auto-generated for no-merge-commit merge: !7517 merge master into master fix link validity Created-by: frozenn Commit-by: frozenleaves Merged-by: ascend-robot Description: ## Motivation Please describe the motivation of this PR and the goal you want to achieve through this PR. ## Modification Please briefly describe what modification is made in this PR. ## Self-test (Optional) If modifications to this PR may cause/fix function/accuracy/performance DTSs/issues, a self-inspection record needs to be attached. ## BC-breaking (Optional) If there are compatibility issues, such as dependencies on cann/torch_npu versions, they need to be explained in the PR. ## Checklist **Before PR**: - [ ] The new code needs to comply with the Clean Code specification. - [ ] The PR content is self-checked, and the expression can be clear and the writing standardized **After PR**: - [ ] CLA has been signed and all committers have signed the CLA in this PR. - [ ] The ci-pipeline is passed, Code Check is passed. See merge request: Ascend/ModelZoo-PyTorch!75171 个月前
!5831 Network address of models to be rectified: 25 Merge pull request !5831 from Yss/network_declaration_25 2 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
!3062 【上海交通大学】人脸增强模型GPEN !3062 【上海交通大学】人脸增强模型GPEN 3 年前
readme.md

GPEN

包含GPEN的NPU平台实现。

GPEN

GPEN模型的训练需要FFHQ数据集,在Data Preparation中有更详细的描述。

我们提供了部分预训练模型,请参阅 Models 了解我们提供的模型,并参阅 Getting Started 了解有关训练和评估的说明。

@inproceedings{yang2021gan,
  title={Gan prior embedded network for blind face restoration in the wild},
  author={Yang, Tao and Ren, Peiran and Xie, Xuansong and Zhang, Lei},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={672--681},
  year={2021}
}

Updates

Installation

环境要求:

  • Linux 环境 Python 版本 >= 3.7
  • PyTorch 版本 >= 1.5
  • 具体参考requirements.txt

Code Structure

  • 具体请参考相关文档
  • cann: 包含cann运行结果
  • examples: 包含部分示例代码
  • face_detect:包含面部识别代码
  • face_model:包含gpen模型
  • face_parse: 包含面部分割代码
  • profiler:包含profiling运行代码和结果
  • weights:包含预训练模型
  • training:包含部分模型训练所需代码
  • train_simple.py:训练核心代码
  • run.sh:训练脚本
  • requirements.txt:环境配置

Data Preparation

模型训练需要FFHQ数据集:

  • FFHQ: FFHQ全称Flickr-Faces-High-Quality(Flickr-Faces-HQ),最初是作为生成式对抗网络(GAN)的基准创建的,也用于StyleGAN的训练数据集中,并由英伟达于2019年开源。FFHQ是一个高质量的人脸数据集,包含1024×1024分辨率的70000张PNG格式高清人脸图像,在年龄、种族和图像背景上丰富多样且差异明显,在人脸属性上也拥有非常多的变化,拥有不同的年龄、性别、种族、肤色、表情、脸型、发型、人脸姿态等,囊盖普通眼镜、太阳镜、帽子、发饰及围巾等多种人脸周边配件,因此该数据集也是可以用于开发一些人脸属性分类或者人脸语义分割模型的。FFHQ的图像从Flickr上爬取,且均有许可才会下载,并使用了dlib进行人脸对齐和裁剪,之后使用算法移除了一些非真实人脸如雕像、画作及照片等图像。

Models

我们在weights目录下中提供了部分可供下载的预训练模型,命名按照训练epoch数保存。

Getting Started

Training

  1. 直接运行训练脚本run.sh

  2. 进入仓库运行以下代码进行训练

    python3 train_simple.py --size 512 --channel_multiplier 2 --narrow 1 --ckpt weights --sample results --batch 2 --path ../ffhq_gpen/images1024x1024_align
    

部分参数说明:

  • size:分辨率
  • ckpt:模型保存目录
  • batch:batchsize
  • path:ffhq数据集目录

Testing

  1. weights目录下选择合适的预训练模型

  2. 运行脚本

    python3 demo.py --task FaceEnhancement --model 110000 --in_size 512 --channel_multiplier 2 --narrow 1 --use_sr --sr_scale 4 --use_cuda --save_face --indir examples/imgs --outdir examples/outs-bfr
    

部分参数说明:

  • task:任务类型
  • model:预训练模型位置(在weights目录下的位置)
  • in_size:输入图像分辨率
  • indir:输入图像目录
  • outdir:输出图像目录

Reference:

code: yangxy/GPEN (github.com)

paper: GPEN

Statement

For details about the public address of the code in this repository, you can get from the file public_address_statement.md