1.论文
2.环境配置
项目使用pytorch为1.7.0版本
在环境配置时,下面这三个可以直接在安装requirements.txt时一块自动安装。
git+https://github.com/openai/CLIP.git
git+https://github.com/nghorbani/human_body_prior.git
git+https://github.com/nghorbani/body_visualizer.git
但可能因网络会出现以下问题 ,解决方法如下
#单独安装
pip install git+https://github.com/openai/CLIP.git
#或直接下载源码自己安装
git clone https://github.com/openai/CLIP.git
3.项目运行
在运行下面的代码时,如果环境没问题较快就会生成.obj文件,若长时间等待则是因为显卡和上面那个项目不兼容的问题,并且也不会生成结果。
python main.py --target_txt 'a 3d rendering of a strong man in unreal engine'
#使用abrahamlincoln的配置文件生成林肯的模型(两个不是同一个mian)
python main.py --mode train_clip --conf confs/examples/abrahamlincoln.conf
源项目配置需要使用30多g的显存,单卡生成模型要24h
4.问题解决
问题1
出现下面的问题
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/miniconda3/envs/ACLIP/lib/python3.7/site-packages/cv2/__init__.py", line 5, in <module>
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
这样解决 解决方式
sudo apt-get install libgl1-mesa-glx
问题2
ImportError: ('Unable to load OpenGL library', 'libgcrypt.so.11: cannot open shared object file: No such file or directory', '/root/anaconda3/envs/ACLIP/lib/libOSMesa.so.8', '/root/anaconda3/envs/ACLIP/lib/libOSMesa.so.8')
这是缺少 libgcrypt.so.11这个文件,下载后把文件复制到相应位置即可 解决办法
curl -o libgcrypt11.rpm ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/bosconovic:/branches:/home:/elimat:/lsi/openSUSE_Leap_15.1/x86_64/libgcrypt11-1.5.4-lp151.23.29.x86_64.rpm
rpm2cpio libgcrypt11.rpm | cpio -id
问题3
Exception: pyglet 2.0.5 requires Python 3.8 or newer.
将版本降为1.5.9
问题4
cuda问题。配置环境时不要用项目中给的方式安装pytorch
python main.py --target_txt 'a 3d rendering of a strong man in unreal engine'#用带cuda版本的方式
pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
问题5
neural_renderer安装.
这个项目很老,其中AvatarCLIP项目提供的已经可以适配高版本的pytorch(但还会有警报)
特别注意:安装前检测nvcc,即cuda。如果自己安装cuda可能会有版本不对等问题,最好直接找个带nvcc的镜像。cuda11.3不代表有nvcc。
#查看版本
nvcc --version
这个项目不能使用3090等高算力显卡(>=8.0的显卡,3090是8.6)安装其他教程修改算力可以配置成功这个项目,但跑不起来AvatarCLIP 。这个跟pytorch安装方式有关
问题6
安装skimage
pip install scikit-image
安装tensorboard
pip install tensorboard