【毕设中期报告总结】MMGEN-FaceStylor的环境配置总结

0. 引言

编程环境配置:客户端(Window 11、PyCharm 2022.1.3),服务器端为Ubuntu,其中PyCharm使用SSH技术连接Ubuntu终端进行开发

1. Python环境配置

RTX 3090芯片(CUDA版本需要11.1及以上,否则会因为算力太高无法运行程序)
CUDA 11.1
Python 3
PyTorch ==1.9.0
MMCV-Full >= 1.4.2 <= 1.9.0
MMGeneration >= 0.3.0

2. 安装步骤

2.1 创建虚拟环境

我们首先创建conda虚拟环境并对它进行激活

conda create -n facestylor python=3.7 -y
conda activate facestylor

假设您已经安装了CUDA 11.1,您需要使用CUDA 11.1安装预构建的PyTorch。

pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

2.2 安装MMCV和MMGEN

我们可以通过运行以下命令来安装MMCV

pip install mmcv-full==1.4.2 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html

当然我们还可以通过MMCV文档进行安装(命令行安装或者源码编译)
然后,我们应该安装包含将在本项目中使用的基本生成模型的MMGEN。

# Clone the MMGeneration repository.
git clone https://github.com/open-mmlab/mmgeneration.git
cd mmgeneration
# Install build requirements and then install MMGeneration.
pip install -r requirements.txt
pip install -v -e .  # or "python setup.py develop"
cd ..

-v : verbose,or more output.(输出更详细的信息)
-e : installing a project in editable mode.(以可编辑的模式安装项目)
. : 一个点,代表相对路径,也就是当前路径(代表路径)

2.3 克隆存储库并准备数据和权重

现在,我们需要克隆这个存储库并安装依赖。

git clone https://github.com/open-mmlab/MMGEN-FaceStylor.git
cd MMGEN-FaceStylor
pip install -r requirements.txt

为了方便起见,我们在MMGEN-FaceStylor中创建以下的文件夹。

mkdir data
mkdir work_dirs
mkdir work_dirs/experiments
mkdir work_dirs/pre-trained

对于test和train,您需要下载AgileGAN提供的一些必要数据并将它们放在数据文件夹下。或者只是运行以下命令:
wget的使用方法详解

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1AavRxpZJYeCrAOghgtthYqVB06y9QJd3' -O data/shape_predictor_68_face_landmarks.dat

然后,您可以在data文件夹下放置或创建数据的软连接,并将您的实验结果放在work_dirs/experiments。
或者:

wget --no-check-certificate https://github.com/JeffTrain/selfie/raw/master/shape_predictor_68_face_landmarks.dat -O data/shape_predictor_68_face_landmarks.dat

我们也可以提供一些预训练好的权重。

Pre-trained Weights
FFHQ-1024 StyleGAN2
FFHQ-256 StyleGAN2
IR-SE50 Model
Encoder for FFHQ-1024 StyleGAN2
Encoder for FFHQ-256 StyleGAN2
MetFace-Oil 1024 StyleGAN2
MetFace-Sketch 1024 StyleGAN2
Toonify 1024 StyleGAN2
Cartoon 256
Bitmoji 256
Comic 256
More Styles on the Way!

3. Play with MMGEN-FaceStylor

3.1 Quick Try

我们可以运行以下指令来快速尝试项目

python demo/quick_try.py demo/src.png --style toonify

然后你就可以在work_dirs/demos/agile_result.png中查看结果。

可以使用的style类型有:toonify,oil,sketch,bitmoji,cartoon和comic。

如果运行上述命令出现问题,很可能是以下问题,写者这些盘点几个自己运行这段命令遇到的错误
1、CUDA11.1版本的安装与运行
2、conda使用不同版本的cuda

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

highlight2333

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值