FENGGENYU / CAPRI-Net

Code for CAPRI-Net
MIT License
46 stars 6 forks source link

Cannot reproduce reconstruction results in Fig 3. #2

Closed Grem-Lin closed 2 years ago

Grem-Lin commented 2 years ago

Hi I am trying to reproduce the reconstruction result in Fig3 with ABC voxel setting, but I met with several issues:

  1. I cannot get the reconstructed mesh for the CAD shape in the second row in Fig3. This shape is the 10th (index starting from 0) shape in the abc_all dataset with the name of "00023582_9c917172a61b472fb0e6ae3c_trimesh_002.off". When I tested on pretrained network or on fine-turned network, the reconstructed results actually show meshes of 11th shape. There is a 1 shape shift. Here are the code that I run:

    python test_pretrain.py -e abc_voxel -g 0 -p 0 -c initial --test --voxel --start 10 --end 11 --mc_threshold 0.5
    python fine-tuning.py -e abc_voxel -g 0 --test --voxel --start 10 --end 11
    python test.py -e abc_voxel -g 0 -p 2 -c best_stage2 --test --voxel --start 10 --end 11

    I actually test on other start and end values and I found that when start >= 10, there is always a 1-shape shift. Saying that I am working on nth shape with start=n (n >= 10), the code generates n+1th shape.

  2. May I have the mc_threshold of each of the four shapes listed in Fig3 when you generated the mesh? I didn't find any proper mc_threshold to get exactly the same reconstructed results in Fig3. The generated meshes either have pretty unsmooth surfaces (mc_threshold=0.9, left image below) or smooth surfaces but no holes (mc_threshold=0.1, right image below). I used the shared ABC voxel network weights mentioned here https://github.com/FENGGENYU/CAPRI-Net/issues/1#issuecomment-1208888852

Thank you!

FENGGENYU commented 2 years ago

Please add --csg to your command:

python test.py -e abc_voxel -g 0 -p 2 -c best_stage2 --test --voxel --start 10 --end 11 --csg

Default setting should work.

Grem-Lin commented 2 years ago

Thanks, but I got an error of running:

python test.py -e abc_voxel -g 0 -p 2 -c best_stage2 --test --voxel --start 10 --end 11 --csg

Here is the error:

Traceback (most recent call last):
  File "test.py", line 206, in <module>
    inter_results_flag = True, final_result_flag = True
  File "/home/CAPRI-Net/utils/cad_meshing.py", line 220, in create_cad_mesh
    connection_t[0,:,i] = 0
RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation.

Any ideas?

FENGGENYU commented 2 years ago

I don't face this problem.

Please try several possible solutions.

  1. adding connection_t.requires_grad= False before it.
  2. connection_t = connection_t.unsqueeze(0).detach() at line 167
Grem-Lin commented 2 years ago

Thank you! The second solution works. A follow-up question, regarding --csg, I understand why and how create_cad_meshworks, but why it hascreate_mesh_mc as a default setting to create mesh?

Any ideas about the first issue that I asked about, the 1-shape shift issue? Thanks!

FENGGENYU commented 2 years ago

We provide two output options: 1. create mesh from marching-cube(mc), 2. create mesh from CSG. We set the first one as default before since it is faster to get the results and both pre-trained model and fine-tuned model can use mc to get mesh. Only fine-tuned model can create mesh from CSG.

The first shape index is 0, so when you set start_index to be 10, it will start from 11th shape.

Grem-Lin commented 2 years ago

Regarding that 1-shape shift issue, I believe that you didn't get me. I do know that the first shape index is 0 (as I mentioned at the beginning). So, using your words, if I set start_index as 10, it DIDN'T start from the 11th shape, it starts from the 12th shape and returns the 12th reconstructed shape.

FENGGENYU commented 1 year ago

Thank you for finding this data shift issue.

Just updated the abc data and please download the new data.

Best,

Fenggen