walsvid / Pixel2MeshPlusPlus

Pixel2Mesh++: Multi-View 3D Mesh Generation via Deformation. In ICCV2019.
https://arxiv.org/abs/1908.01491
BSD 3-Clause "New" or "Revised" License
356 stars 56 forks source link

How to modify the code if I want to use four or even five views for training. #22

Open YufanJia opened 3 years ago

YufanJia commented 3 years ago

Hi,@walsvid, thanks for your sharing! It' really an excellent idea. Since I'm new to all this, I don't know many things very well. I want to use four views to train the model, but I don't know how to modify it, if it's convenient, can you tell me how to do it? Regards.

topinfrassi01 commented 3 years ago

Hey, I'm not a maintainer of this project but I've looked at the source code quite a bit.

It really depends if you want to always use the same number of views or if it could vary. If you're set on always using four views, for example, the modifications aren't too exhaustive.

Regarding the model itself, the images are used by the GraphProjection and LocalGraphProjection layers. At lines 208 and 371 of layers.py, there is a parameter named view_number, you could simply change this from 3 to 4.

Next, you need to change how the data is fed into the model. I'll take for example the train_mvp2m.py file, but it's the same for train_p2mpp and their test equivalent.

Inside the placeholders, starting at line 30, you'd need to change the first dimension of img_inp and cameras from 3 to 4.

Finally, inside the dataloader.py file, well you'd need to change the code so that it outputs four images instead of three. It's not too complicated and well, by 'Ctrl+F'ing the number 3 inside this file you should be able to figure out where to make the changes.

Good luck!