yfeng95 / DECA

DECA: Detailed Expression Capture and Animation (SIGGRAPH 2021)
Other
2.17k stars 429 forks source link

TypeError: '<=' not supported between instances of 'list' and 'int' #124

Open AliButtar opened 2 years ago

AliButtar commented 2 years ago

Followed the exact instructions as mentioned in the README.md but when running the command:

python demos/demo_reconstruct.py -i TestSamples/examples --saveDepth True --saveObj True

This error comes up:

creating the FLAME Decoder
trained model found. load /home/alibuttar/Projects/DECA/data/deca_model.tar
/home/alibuttar/miniconda3/envs/deca-env/lib/python3.7/site-packages/pytorch3d/io/obj_io.py:457: UserWarning: Mtl file does not exist: /home/alibuttar/Projects/DECA/data/template.mtl
  warnings.warn(f"Mtl file does not exist: {f}")
  0%|                                                                                       | 0/1 [00:00<?, ?it/s]/home/alibuttar/miniconda3/envs/deca-env/lib/python3.7/site-packages/torch/nn/functional.py:3121: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  "See the documentation of nn.Upsample for details.".format(mode))
/home/alibuttar/Projects/DECA/decalib/deca.py:128: UserWarning: Mixed memory format inputs detected while calling the operator. The operator will output channels_last tensor even if some of the inputs are not in channels_last format. (Triggered internally at  /pytorch/aten/src/ATen/native/TensorIterator.cpp:924.)
  uv_detail_normals = uv_detail_normals*self.uv_face_eye_mask + uv_coarse_normals*(1-self.uv_face_eye_mask)
  0%|                                                                                       | 0/1 [00:04<?, ?it/s]
Traceback (most recent call last):
  File "demos/demo_reconstruct.py", line 126, in <module>
    main(parser.parse_args())
  File "demos/demo_reconstruct.py", line 52, in main
    opdict, visdict = deca.decode(codedict) #tensor
  File "/home/alibuttar/Projects/DECA/decalib/deca.py", line 229, in decode
    shape_images, _, grid, alpha_images = self.render.render_shape(verts, trans_verts, h=h, w=w, images=background, return_grid=True)
  File "/home/alibuttar/Projects/DECA/decalib/utils/renderer.py", line 377, in render_shape
    rendering = self.rasterizer(transformed_vertices, self.faces.expand(batch_size, -1, -1), attributes, h, w)
  File "/home/alibuttar/miniconda3/envs/deca-env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/alibuttar/Projects/DECA/decalib/utils/renderer.py", line 158, in forward
    perspective_correct=raster_settings.perspective_correct,
  File "/home/alibuttar/miniconda3/envs/deca-env/lib/python3.7/site-packages/pytorch3d/renderer/mesh/rasterize_meshes.py", line 115, in rasterize_meshes
    if image_size <= 64:
TypeError: '<=' not supported between instances of 'list' and 'int'

Please help in solving this. The installation process of the libraries went smoothly with no errors. Thanks.

AliButtar commented 2 years ago

Please update the requirements in order to run the repo

The error above was because of pytorch3d. Thanks to this comment, I was able to install and run it correctly.

The steps I did were as follows:

conda create -n deca python=3.8.10
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=11.0 -c pytorch
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install pytorch3d -c pytorch3d

then pip install -r requirements.txt

where requirements.txt is:

#`pip install -r requirements.txt`
numpy
scipy
chumpy
scikit-image
opencv-python
scikit-image     #skimage
PyYAML       
# torch==1.6.0   # for compatible with pytorch3d
# torchvision==0.7.0
face-alignment
yacs
kornia==0.5.0
ninja
# fvcore
# pytorch3d  
alicedingyueming commented 2 years ago

I face the same problem. the error was because of pytorch3d. I follow the advice of AliButtarhttps://github.com/YadiraF/DECA/issues/124#issuecomment-1106474784 and another error emerged that the GeForce driver version is old. So I set the project on another computer with CUDA11. And everything is ok.

adevra commented 2 years ago

After 3 days of struggle to the point of making a dual-boot setup to creating countless environments just to run the demo, I finally made it and yes, requirements needs update.

I'm running WSL 2 Ubuntu 20.04 on Windows11, NVIDIA-SMI 515.65.01 Driver Version: 516.94 CUDA Version: 11.7 (had to install cuda 11.7 to windows and to the WSL via these steps to finally see nvcc -version https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions )

then followed up @AliButtar 's steps https://github.com/YadiraF/DECA/issues/124#issuecomment-1106474784

with this little change; and it worked conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge