Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

No output file #3

Closed
Michaelwhite34 opened this issue Jul 21, 2021 · 14 comments
Closed

No output file #3

Michaelwhite34 opened this issue Jul 21, 2021 · 14 comments

Comments

@Michaelwhite34
Copy link

(deep3d_pytorch) PS D:\Deep3DFaceRecon_pytorch> python test.py --name=CelebA --epoch=20 --img_folder=./datasets/examples
D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\kornia\augmentation\augmentation.py:1875: DeprecationWarning: GaussianBlur is no longer maintained and will be removed from the future versions. Please use RandomGaussianBlur instead.
category=DeprecationWarning,
D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\torch\utils\cpp_extension.py:4: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
----------------- Options ---------------
add_image: True
bfm_folder: BFM
bfm_model: BFM_model_front.mat
camera_d: 10.0
center: 112.0
checkpoints_dir: ./checkpoints
dataset_mode: None
ddp_port: 12355
display_per_batch: True
epoch: 20 [default: latest]
eval_batch_nums: inf
focal: 1015.0
gpu_ids: 0
img_folder: ./datasets/examples [default: examples]
init_path: checkpoints/init_model/resnet50-0676ba61.pth
isTrain: False [default: None]
model: facerecon
name: CelebA [default: face_recon]
net_recon: resnet50
phase: test
suffix:
use_ddp: False [default: True]
use_last_fc: False
verbose: False
vis_batch_nums: 1
world_size: 1
z_far: 15.0
z_near: 5.0
----------------- End -------------------
model [FaceReconModel] was created
loading the model from ./checkpoints\CelebA\epoch_20.pth
0 ./datasets/examples\000002.jpg
1 ./datasets/examples\000006.jpg
2 ./datasets/examples\000007.jpg
3 ./datasets/examples\000031.jpg
4 ./datasets/examples\000033.jpg
5 ./datasets/examples\000037.jpg
6 ./datasets/examples\000050.jpg
7 ./datasets/examples\000055.jpg
8 ./datasets/examples\000114.jpg
9 ./datasets/examples\000125.jpg
10 ./datasets/examples\000126.jpg
11 ./datasets/examples\015259.jpg
12 ./datasets/examples\015270.jpg
13 ./datasets/examples\015309.jpg
14 ./datasets/examples\015310.jpg
15 ./datasets/examples\015316.jpg
16 ./datasets/examples\015384.jpg
17 ./datasets/examples\vd006.png
18 ./datasets/examples\vd025.png
19 ./datasets/examples\vd026.png
20 ./datasets/examples\vd034.png
21 ./datasets/examples\vd051.png
22 ./datasets/examples\vd070.png
23 ./datasets/examples\vd092.png
24 ./datasets/examples\vd102.png

@YuDeng
Copy link
Collaborator

YuDeng commented Jul 21, 2021

Hi, the original code use '/' as the separation sign which leads to wrong file path in windows environment. We have fix this error now.
However, there are still some issues when running on windows (mostly due to the installation of nvdiffrast). We recommand using Linux environment to run the code at this moment.

@Michaelwhite34
Copy link
Author

Michaelwhite34 commented Jul 21, 2021

Hi, the original code use '/' as the separation sign which leads to wrong file path in windows environment. We have fix this error now.
However, there are still some issues when running on windows (mostly due to the installation of nvdiffrast). We recommand using Linux environment to run the code at this moment.

I am trying to run on Ubuntu, I get this" raise EnvironmentError('CUDA_HOME environment variable is not set. '
OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
".Do I need to install cuda from nvidia official website ?

@YuDeng
Copy link
Collaborator

YuDeng commented Jul 21, 2021

Yes. You have to first install Nvidia CUDA driver.

You might also need to install some dependencies for nvdiffrast following the docker file provided by it which contains libraries related to OpenGL ( libglvnd0
libgl1
libglx0
libegl1
libgles2
libglvnd-dev
libgl1-mesa-dev
libegl1-mesa-dev
libgles2-mesa-dev ).
There is another issue #2 reports some errors due to incorrect OpenGL installation.

@Michaelwhite34
Copy link
Author

For the updated test.py on windows,I get this error.
"model [FaceReconModel] was created
loading the model from ./checkpoints\CelebA\epoch_20.pth
0 ./datasets/examples\000002.jpg
Traceback (most recent call last):
File "test.py", line 72, in
main(0, opt,opt.img_folder)
File "test.py", line 62, in main
model.test() # run inference
File "D:\Deep3DFaceRecon_pytorch\models\base_model.py", line 162, in test
self.forward()
File "D:\Deep3DFaceRecon_pytorch\models\facerecon_model.py", line 139, in forward
self.pred_vertex, self.facemodel.face_buf, feat=self.pred_color)
File "D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Deep3DFaceRecon_pytorch\util\nvdiffrast.py", line 57, in forward
self.glctx = dr.RasterizeGLContext(device=device)
File "D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\nvdiffrast\torch\ops.py", line 151, in init
self.cpp_wrapper = _get_plugin().RasterizeGLStateWrapper(output_db, mode == 'automatic', cuda_device_idx)
File "D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\nvdiffrast\torch\ops.py", line 40, in _get_plugin
raise RuntimeError("Could not locate a supported Microsoft Visual C++ installation")
RuntimeError: Could not locate a supported Microsoft Visual C++ installation"

@YuDeng
Copy link
Collaborator

YuDeng commented Jul 21, 2021

For the updated test.py on windows,I get this error.
"model [FaceReconModel] was created
loading the model from ./checkpoints\CelebA\epoch_20.pth
0 ./datasets/examples\000002.jpg
Traceback (most recent call last):
File "test.py", line 72, in
main(0, opt,opt.img_folder)
File "test.py", line 62, in main
model.test() # run inference
File "D:\Deep3DFaceRecon_pytorch\models\base_model.py", line 162, in test
self.forward()
File "D:\Deep3DFaceRecon_pytorch\models\facerecon_model.py", line 139, in forward
self.pred_vertex, self.facemodel.face_buf, feat=self.pred_color)
File "D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Deep3DFaceRecon_pytorch\util\nvdiffrast.py", line 57, in forward
self.glctx = dr.RasterizeGLContext(device=device)
File "D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\nvdiffrast\torch\ops.py", line 151, in init
self.cpp_wrapper = _get_plugin().RasterizeGLStateWrapper(output_db, mode == 'automatic', cuda_device_idx)
File "D:\anaconda3\envs\deep3d_pytorch\lib\site-packages\nvdiffrast\torch\ops.py", line 40, in _get_plugin
raise RuntimeError("Could not locate a supported Microsoft Visual C++ installation")
RuntimeError: Could not locate a supported Microsoft Visual C++ installation"

The installation of Nvdiffrast on Windows is a bit different from the instruction provided in our repo. You may need to follow their official guidance to install it on Windows.

Anyway, we will try to give a more thorough guidance in our repo soon.

@Michaelwhite34
Copy link
Author

Yes. You have to first install Nvidia CUDA driver.

You might also need to install some dependencies for nvdiffrast following the docker file provided by it which contains libraries related to OpenGL ( libglvnd0
libgl1
libglx0
libegl1
libgles2
libglvnd-dev
libgl1-mesa-dev
libegl1-mesa-dev
libgles2-mesa-dev ).
There is another issue #2 reports some errors due to incorrect OpenGL installation.

Only nvidia drvier ? No Cuda and Cudnn required ?

@YuDeng
Copy link
Collaborator

YuDeng commented Jul 21, 2021

CUDA toolkit and cudnn is required as well.

@Michaelwhite34
Copy link
Author

CUDA toolkit and cudnn is required as well.

Are specific versions of Cuda and cudnn needed ?

@YuDeng
Copy link
Collaborator

YuDeng commented Jul 21, 2021

cuda toolkit 11.0 with corresponding cudnn should be fine. Other cuda version such as 10.1 or 10.2 should also work.

@Michaelwhite34
Copy link
Author

cuda toolkit 11.0 with corresponding cudnn should be fine. Other cuda version such as 10.1 or 10.2 should also work.

Finally successed with Cuda 11.4 on Ubuntu

@Michaelwhite34
Copy link
Author

I have a question tho,where is the texture and lighting information ? Obj file should only contain mesh data and the mat file is very small.

@YuDeng
Copy link
Collaborator

YuDeng commented Jul 21, 2021

The .mat file contains the 257 dimensional coefficients which is enough to generate the geometry and texture of a 3D face based on the BFM face model. We use Spherical Harmonics functions to model the diffuse light therefore the lighting information is also included in the coefficients. The obj file contains shape as well as color.

@Michaelwhite34
Copy link
Author

The .mat file contains the 257 dimensional coefficients which is enough to generate the geometry and texture of a 3D face based on the BFM face model. We use Spherical Harmonics functions to model the diffuse light therefore the lighting information is also included in the coefficients. The obj file contains shape as well as color.

I see, the obj files are using vertex color so I guess I can’t get high quality texture even with large face photo ?

@YuDeng
Copy link
Collaborator

YuDeng commented Jul 22, 2021

That’s true. The BFM face model defines texture on its vertex instead of using texture map so we are also restricted by this configuration.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants