facebookresearch / neuromorph

Implementation of the NeuroMorph method from CVPR 2021.
Other
46 stars 15 forks source link

Unable to reproduce simple example #4

Open peekxc opened 1 year ago

peekxc commented 1 year ago

I'm trying to reproduce the simple interpolation between the cow and the pig from the paper.

From an initial loss of ~24.64, I trained a model via roughly 200 epochs until the validation loss stabilized around 0.37 on cow.obj and pig.obj from SHREC'20.

        interpol = create_interpol(
            dataset=dataset_val,
            dataset_val=dataset_val,
            time_stamp=time_stamp,
            hyp_param=hyp_param,
        )
        interpol.load_self(save_path(folder_str=time_stamp))
        interpol.interp_module.param.num_timesteps = 10
        shape_x_out, shape_y_out, points_out = interpol.test(dataset_val)
        ...

Upon inspection, shape_x_out and shape_y_out are each length-4 lists containing shape_utils.Shape's, the first two being cows and the last two being pigs. I'm not sure why the length is 4 since there are only two shapes---I assume it's training to interpolate all pairwise combinations, but as there is no documentation I cannot be sure.

Similarly, points_out is a length-4 list of tensors each of shape [num. points/resolution, 3, num timesteps+1]. I assume this tensor yields the interpolation between the cow to pig.

Unfortunately, upon further inspection, effectively no interpolation has occurred:

shape_idx = 0 # same result for any of the four interpolations
print(np.max(np.abs(pdist(points_out[shape_idx][:,:,0]) - pdist(points_out[shape_idx][:,:,9]))))
# ~ 0.009

I also confirmed this from visual inspection

Screen Shot 2023-05-08 at 10 00 29 AM Screen Shot 2023-05-08 at 10 00 36 AM

Is there any way to reproduce the front cover image from the paper?

marvin-eisenberger commented 1 year ago

The validation loss of 0.37 sounds like the obtained solution is in the right ballpark. However, the results from the teaser figure were obtained by training on the full SHREC'20 dataset (not just one pair). Please also double-check, that the shapes are preprocessed appropriately, following the preprocess_dataset.m script.

The interpol.test script indeed outputs interpolation sequences. This is done for all pairs of training shapes (2x2=4 pairs in your case). The identity pairs are included, so in the example you show above, the pair shape_idx = 0 will be the trivial map between the first shape (cow) with itself.

We recommend using the script neuromorph/main_test.py, which saves all relevant test results (sequences) to .mat files, as well as thumbnails of the resulting interpolation sequences to .png files.