1、项目介绍:
2、环境安装
- 平台:windows 10
- 编译器:pycharm
- cuda 11.3
- cudnn 8.2.0.53
conda create -n cyclegan python=3.7
conda activate cyclegan
pip install opencv-python
pip install pillow
pip install face_alignment
pip install tensorflow=1.15.0
pip install protobuf==3.20.0
pip install dlib-19.19.0-cp37-cp37m-win_amd64.whl
pip install torch-1.11.0+cu113-cp37-cp37m-win_amd64.whl
pip install torchvision-0.11.2+cu113-cp37-cp37m-win_amd64.whl
3、执行代码
python test.py --photo_path ./images/1.jpg --save_path ./images/2.png
批量裁剪图像:
python data_process.py --data_path YourPhotoFolderPath --save_path YourSaveFolderPath
# 重新训练
# 请自己准备真实人脸图片进行训练。放在dataset\trainA和dataset\testA
python train.py --dataset photo2cartoon
4、效果展示
![](http://43.138.69.59/wp-content/uploads/2023/04/1-1-1013x1024.jpg)
![](http://43.138.69.59/wp-content/uploads/2023/04/1-1.png)
![](http://43.138.69.59/wp-content/uploads/2023/04/3-2.jpg)
![](http://43.138.69.59/wp-content/uploads/2023/04/3-3.png)
![](http://43.138.69.59/wp-content/uploads/2023/04/a-2.jpeg)
![](http://43.138.69.59/wp-content/uploads/2023/04/a11.png)