NVIDIA / MinkowskiEngine

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

Do you consider to add groupnorm? #302

Closed qiaozhijian closed 3 years ago

qiaozhijian commented 3 years ago

There are some functions that cannot be implemented with this library, such as netvlad, so I can only use my own code. But because of voxelization, the numbers of point clouds in a batch are not the same, so I can only pass one point cloud to my netvlad each time (not a batch), but in this case, It can’t use batchnorm anymore. So I want to use groupnorm (although instancenorm is also very good, but slightly worse than groupnorm)

chrischoy commented 3 years ago

I am not quite following you on what you want.

You can pass as many pointclouds as you want with minkowskiengine. All examples in the Minkowski Engine uses many point clouds to create a single batch. Please refer to the examples on how to pass multiple point clouds with voxelization. Also, try to read documentations and read papers before assuming that it can't be done.

Also, please read how batched coordinates work in the documentation to understand this.

jac99 commented 3 years ago

@qiaozhijian I suppose you use MinkowskiEngine to compute local features for a batch of input point clouds (each having a different number of poitns). And then you want to process a batch of these feature maps (each having different number of elements) using NetVLAD layer (which requires an input in the form of a typical batch (batch_size, number of elements, number of channels)). In such case just add dummy elements with all zeros to make all batch elements of the same size. I've tried such approach with NetVLAD layer and it worked.

qiaozhijian commented 3 years ago

@qiaozhijian I suppose you use MinkowskiEngine to compute local features for a batch of input point clouds (each having a different number of poitns). And then you want to process a batch of these feature maps (each having different number of elements) using NetVLAD layer (which requires an input in the form of a typical batch (batch_size, number of elements, number of channels)). In such case just add dummy elements with all zeros to make all batch elements of the same size. I've tried such approach with NetVLAD layer and it worked.

Thank you.

qiaozhijian commented 3 years ago

I am not quite following you on what you want.

You can pass as many pointclouds as you want with minkowskiengine. All examples in the Minkowski Engine uses many point clouds to create a single batch. Please refer to the examples on how to pass multiple point clouds with voxelization. Also, try to read documentations and read papers before assuming that it can't be done.

Also, please read how batched coordinates work in the documentation to understand this.

Thanks a lot! The key point is that I want to create a torch.nn.Parameter(a scalar or a matrix) and use it to multiply the sparsetensor. I read the implementation of MinkowskiBroadcastMultiplication and MinkowskiLinear. Maybe I can do like them. But it’s better if this library has corresponding functions.

chrischoy commented 3 years ago

If you are looking for local features for 3d point cloud please refer to FCGF.

The groupnorm seems like a good addition to the library for the next release, but I am not following you on why it is important that you need groupnorm or instance norm for NetVLAD. Are you saying that you can’t use MinkowskiBatchNorm when you implement NetVLAD? Just to clarify, NetVLAD is a feature aggregation method and groupnorm, instancenorm, and batchnorm are methods you can use to improve the network to learn better and faster and NetVLAD is independent of the network normalization.

Also, if you want to extract features for every point, please refer to TensorField https://github.com/NVIDIA/MinkowskiEngine/blob/master/examples/indoor.py#L125 where you can extract features for all points.