DECA icon indicating copy to clipboard operation
DECA copied to clipboard

Lack of `template.mtl` file

Open pstorozenko opened this issue 3 years ago • 15 comments

Hi, these results are very interesting! However I keep getting the following warning:

UserWarning: Mtl file does not exist: /home/jupyter/DECA/data/template.mtl
  warnings.warn(f"Mtl file does not exist: {f}")

Where does template.mtl file should come from? There is no such file in yours archive, BFM nor FLAME model files. Am I missing something?

pstorozenko avatar Oct 04 '21 11:10 pstorozenko

same issue

zhih-li avatar Oct 05 '21 01:10 zhih-li

same issue

mkh321 avatar Oct 06 '21 03:10 mkh321

Enter on the command line:python demos/demo_reconstruct.py -i TestSamples/examples --saveDepth True --saveObj True

lin-girl avatar Oct 11 '21 08:10 lin-girl

@lin-girl, thanks for answering! I've tried what you've written but I get:

python demos/demo_reconstruct.py -i TestSamples/examples --saveDepth True --saveObj True
creating the FLAME Decoder
trained model found. load /home/jupyter/DECA/data/deca_model.tar
/opt/conda/envs/deca/lib/python3.7/site-packages/pytorch3d/io/obj_io.py:533: UserWarning: Mtl file does not exist: /home/jupyter/DECA/data/template.mtl
  warnings.warn(f"Mtl file does not exist: {f}")
  0%|                                                                                                                                                                     | 0/9 [00:00<?, ?it/s]/opt/conda/envs/deca/lib/python3.7/site-packages/torch/nn/functional.py:3458: 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)
/opt/conda/envs/deca/lib/python3.7/site-packages/torch/nn/functional.py:3829: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
  "Default grid_sample and affine_grid behavior has changed "
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 9/9 [00:20<00:00,  2.24s/it]
-- please check the results in TestSamples/examples/results

And resulting obj looks as following: image

It seems as template.mtl is not generated but should be delivered somewhere, am I right? Maybe I set something wrong and you quickly see what might be the issue, thanks helping :)

pstorozenko avatar Oct 11 '21 09:10 pstorozenko

Add parameter --useTex True Try this command python demos/demo_reconstruct.py -i TestSamples/examples --saveDepth True --saveObj True --useTex True

Nyquist0 avatar Oct 13 '21 04:10 Nyquist0

Thanks for answering @Nyquist0 !!! The results seem different but I still get the following error regarding template.mtl

python demos/demo_reconstruct.py -i TestSamples/examples --saveDepth True --saveObj True --useTex True
creating the FLAME Decoder
trained model found. load /home/jupyter/DECA/data/deca_model.tar
/opt/conda/envs/deca/lib/python3.7/site-packages/pytorch3d/io/obj_io.py:533: UserWarning: Mtl file does not exist: /home/jupyter/DECA/data/template.mtl
  warnings.warn(f"Mtl file does not exist: {f}")
  0%|                                                     | 0/9 [00:00<?, ?it/s]/opt/conda/envs/deca/lib/python3.7/site-packages/torch/nn/functional.py:3458: 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)
/opt/conda/envs/deca/lib/python3.7/site-packages/torch/nn/functional.py:3829: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
  "Default grid_sample and affine_grid behavior has changed "
100%|█████████████████████████████████████████████| 9/9 [00:13<00:00,  1.50s/it]
-- please check the results in TestSamples/examples/results

And the resulting obj looks like: image

However, resulting _vis file contains fitted texture, I don't know how to understand this.

IMG_0392_inputs_vis

Some help on how to obtain an obj with fitted texture, not glued photo will be much appreciated!.

pstorozenko avatar Oct 13 '21 07:10 pstorozenko

I am having a similar issue regarding the lack of template.mtl - would appreciate any help on how to resolve this issue.

arshamg avatar Oct 13 '21 22:10 arshamg

I am having a similar issue regarding the lack of template.mtl - would appreciate any help on how to resolve this issue.

is it raise error from Pillow package? i guess you can follow this https://stackoverflow.com/questions/42462431/oserror-broken-data-stream-when-reading-image-file

from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True

zhih-li avatar Oct 18 '21 08:10 zhih-li

Hmm, thanks for answering, but it's a raised by pytorch3d. Maybe I didn't explain it clearly, but the template.mtl file doesn't really exist anywhere on the disk. Should it be like that?

pstorozenko avatar Oct 18 '21 11:10 pstorozenko

Hmm, thanks for answering, but it's a raised by pytorch3d. Maybe I didn't explain it clearly, but the template.mtl file doesn't really exist anywhere on the disk. Should it be like that?

Hi, have you found the mtl file finally?

kevinlee9 avatar Mar 22 '22 09:03 kevinlee9

@pstorozenko HI , is there only have 5023 vertices in the reconstruction result obj file? But I see that he display have more vertices.

lxzlwhy avatar Apr 28 '22 14:04 lxzlwhy

Hi guys, you can solve this error adding a template.mtl file on your own with this info inside: newmtl FaceTexture map_Kd mean_texture.jpg

Javisda avatar Apr 13 '23 11:04 Javisda

Hi guys, you can solve this error adding a template.mtl file on your own with this info inside: newmtl FaceTexture map_Kd mean_texture.jpg @Javisda Hi, bro, I met the same issue at Emoca reference. Do you mean that I can write a template.mtl file with newmtl FaceTexture map_Kd mean_texture.jpg which can fix this issue?

lxdphys avatar Aug 28 '23 06:08 lxdphys

Hello @Javisda Can u tell where is map_Kd mean_texture.jpg

zardamhussain avatar Feb 18 '24 15:02 zardamhussain