spconv
spconv copied to clipboard
New features request: Upsampling layer (after pooled features); sparse tensor concatenation.
Hi traveller,
Thanks for the great work! I think the following features could nice to have:
- Upsampling layer. Although there is spconv.SparseInverseConv3d(), it seems limited to upsampling a stride-convoluted (spconv.SpaseConv3d(stride>1)) tensor.
Empirically I find for standard CNNs, maxpooling>=2 performs better than stride>=2 and
Upsampling a tensor then perform convolution is better than transpose conv.
Thus based on these two experience I am suggesting to implement either i) Interpolation function (this could be non-trivial for sparse tensors) or ii) SparseInverseConv3d that supports maxpooling.
- Sparse tensor concatenation. This function should be very similar to Sparse_add, except it's concatenation, which could maintain more feature information. This actually could be done by:
def sparse_cat(tensor1, tensor2):
tensor1 = replace_feature(tensor1, torch.cat((tensor1.features, torch.zeros_like(tensor1.features)), -1))
tensor2 = replace_feature(tensor2, torch.cat((torch.zeros_like(tensor2.features), tensor2.features), -1))
return Fsp.sparse_add(tensor1, tensor2)
Lastly it would be nice to show some example code for a Unet. All of these requests are the missing part for a standard U-net. Though there are some workarounds, they sacrifice performance.