NVlabs / nvdiffrec

Official code for the CVPR 2022 (oral) paper "Extracting Triangular 3D Models, Materials, and Lighting From Images".
Other
2.09k stars 222 forks source link

How to generate dmtit file, .obj #135

Open Williamarvin opened 1 year ago

Williamarvin commented 1 year ago

After running train.py, I cannot seem to generate the dmtit file but instead, only output png files, do you know how i can do that? Also, it stops after all the training is done e.g 1000/1000, and showed psnr 7.89.. So my main concern is how to generate these dmtit file, not just png

Thanks in advance

These are the parameters { "ref_mesh": "data/fox/needed", "random_textures": true, "iter": 1000, "save_interval": 100, "texture_res": [ 1024, 1024 ], "train_res": [700, 700], "batch": 1, "learning_rate": [0.03, 0.03], "kd_min" : [0.03, 0.03, 0.03], "kd_max" : [0.8, 0.8, 0.8], "ks_min" : [0, 0.08, 0], "ks_max" : [0, 1.0, 1.0], "dmtet_grid" : 64, "mesh_scale" : 7, "camera_space_light" : true, "background" : "white", "display" : [{"bsdf":"kd"}, {"bsdf":"ks"}, {"bsdf" : "normal"}], "out_dir": "nerd_ehead" }

jmunkberg commented 1 year ago

Hello @Williamarvin ,

With the dmtet file, are you referring to the surface mesh? That should be saved automatically after the first pass. Here is the relevant code: https://github.com/NVlabs/nvdiffrec/blob/main/train.py#L613

The dmtet tetrahedral mesh used in the optimization is read from disk as shown here: https://github.com/NVlabs/nvdiffrec/blob/main/geometry/dmtet.py#L171

There are instructions here if you want to generate tet meshes of different resolutions: https://github.com/NVlabs/nvdiffrec/tree/main/data/tets

From your parameters, "mesh_scale" : 7, looks fairly high. The tet grid should tightly cover the bounding box of your model for best results, otherwise triangles density is wasted. Easiest to look at the pngs from early optimization steps.

I would also recommend a batch size of 4-8 if you have enough memory.