NVIDIA / MinkowskiEngine

Minkowski Engine is an auto-diff neural network library for high-dimensional sparse tensors
https://nvidia.github.io/MinkowskiEngine
Other
2.46k stars 365 forks source link

Clarification for reconstruction example #132

Closed dkoh0207 closed 3 years ago

dkoh0207 commented 4 years ago

Hello and thank you very much for the library.

I am trying to build several autoencoder type networks, where the decoding parts generate new coordinates. In your reconstruction.py example, you create a target sparse tensor by giving batched coordinates as:

        # Generate target sparse tensor
        cm = sin.coords_man
        target_key = cm.create_coords_key(
            ME.utils.batched_coordinates(data_dict['xyzs']),
            force_creation=True,
            allow_duplicate_coords=True)

        # Generate from a dense tensor
        out_cls, targets, sout = net(sin, target_key)

Of course, this makes sense during training the generative network. Yet during inference I would like to generate a sparse tensor at full resolution (768x768x768) from a latent vector (1x1x1), and in doing so I don't have access to any priors on my coordinates other than they fit inside a [0,768]^3 grid. What would be the correct way to define coordinate manager and target coordinate keys in this case? Thanks,

chrischoy commented 4 years ago

You would need to write your own forward function that does not require the target_key input. Copy the entire forward and remove all functions that require target. The network keeps track of the target for evaluation purpose only.