dvlab-research / SMR

Self-Supervised 3D Mesh Reconstruction from Single Images (CVPR2021)
93 stars 8 forks source link

TypeError: prepare_vertices() missing 1 required positional argument: 'camera_rot' #7

Closed M202071895 closed 3 years ago

M202071895 commented 3 years ago

I ran into this problem when I was training. I looked at the source file of this function:def prepare_vertices(vertices, faces, camera_rot, camera_trans, camera_proj) (in kaolin.render.mesh)

Why can you successfully run this code? I strictly follow the installation process you provided

Thank you so much !

tau-yihouxiang commented 3 years ago

Hundred of problems come from mismatching package version. It is very likely that you didn't correctly install of Kaolin v0.9.0. Please first check whether you can run kaolin example normally.

zhixuanli commented 2 years ago

Hi, @tau-yihouxiang I have encountered this problem too, which cost me almost a whole day.

You have listed two versions of kaolin, including v0.9.0 and 5554bce48187d2acfcbce62cc5f8c511a082de92. And I have tried both of them.

If I use version v0.9.0, the same problem with this issue will happen. And I'm sure I have followed the official instructions(of yours and kaolin library).

If I use the second version 5554bce48187d2acfcbce62cc5f8c511a082de92, there is a problem when compiling the kaolin code. The error is more than one instance of overloaded function "log2" matches the argument list:.

Could you please experiment on a new virtual env and provide a foo version to us? I believe SMR is an essential work in this field and thanks for your patience.

Hoping for your replying.

tau-yihouxiang commented 2 years ago

Thank you for your reporting, I will reinstall kaolin v0.9.0 to check.

zhixuanli commented 2 years ago

The second version 5554bce48187d2acfcbce62cc5f8c511a082de92 is correct.

install kaolin

$ git clone --recursive https://github.com/NVIDIAGameWorks/kaolin
$ git checkout 5554bce48187d2acfcbce62cc5f8c511a082de92
$ python setup.py develop

fix the bug of log2

There is a type error in the code of kaolin/csrc/ops/conversions/unbatched_mcube/unbatched_mcube_cuda.cu

You can change #line 658~660 as following:

  gridSizeLog2.x = (int) log2(i * 1.0);
  gridSizeLog2.y = (int) log2(j * 1.0);
  gridSizeLog2.z = (int) log2(k * 1.0);

And now we can compile and run the training code.

Name:  ./log/Bird/SMR
[0/500][0/248]
LossD: 0.0010 lossD_real: -0.0000 lossD_fake: 0.0000 lossD_gp: 0.0010
lossR: 0.9353 lossR_fake: -0.0000 lossR_reg: 0.2225 lossR_data: 0.5515 lossR_IC: 0.1407 

Elapsed time in update: 0.844983
Name:  ./log/Bird/SMR
[0/500][1/248]
LossD: 0.0010 lossD_real: -0.0000 lossD_fake: 0.0000 lossD_gp: 0.0010
lossR: 1.0701 lossR_fake: -0.0000 lossR_reg: 0.3620 lossR_data: 0.5807 lossR_IC: 0.1064 

Elapsed time in update: 0.748916
Name:  ./log/Bird/SMR
[0/500][2/248]
LossD: 0.0010 lossD_real: -0.0000 lossD_fake: 0.0000 lossD_gp: 0.0010
lossR: 0.8825 lossR_fake: -0.0000 lossR_reg: 0.1489 lossR_data: 0.6115 lossR_IC: 0.1025 

Elapsed time in update: 0.744629
Name:  ./log/Bird/SMR
[0/500][3/248]
LossD: 0.0010 lossD_real: -0.0000 lossD_fake: 0.0000 lossD_gp: 0.0010
lossR: 0.8643 lossR_fake: -0.0000 lossR_reg: 0.1289 lossR_data: 0.5920 lossR_IC: 0.1240 

Elapsed time in update: 0.741169
Name:  ./log/Bird/SMR
[0/500][4/248]
LossD: 0.0010 lossD_real: -0.0000 lossD_fake: 0.0000 lossD_gp: 0.0010
lossR: 0.8159 lossR_fake: -0.0000 lossR_reg: 0.0868 lossR_data: 0.5955 lossR_IC: 0.1148 

Thanks for your awesome work!

tau-yihouxiang commented 2 years ago

I have built a new environment and set up the packages from pip install -r requirement , and it works. Also, thank you for your reminding of the existing of different versions of kaolin v0.9.0. (5554bce48187d2acfcbce62cc5f8c511a082de92) is the correct one.

zhixuanli commented 2 years ago

Bravo! Thanks for your rapid reply!