• 稀疏3d卷积


    稀疏3d卷积网络

    输入

    稀疏卷积的输入包括两部分,一个是坐标,另一个是特征。

    self.scn_input = scn.InputLayer(3, sparse_shape.tolist()) # [h,w,l]

    coors = coors.int()[:, [1, 2, 3, 0]] # [h, w, l, batch] 将 batch_size调换到最后一个位置

    ret = self.scn_input((coors.cpu(), voxel_features, batch_size)) #[45287, 4] [45287, 1] 2

    稀疏卷积的spatial_size确定:

    self.spatial_size = self.sparseModel.input_spatial_size(torch.LongTensor([1,1]))

    3d稀疏卷积

    m = None
    m = scn.Sequential()
    m.add(scn.SubmanifoldConvolution(3, i, o, 3, False))
    m.add(scn.BatchNormLeakyReLU(i ,leakiness=leakiness)).add(
          scn.Convolution(dimension, i, o, 3, 2, False))
    
    def block(self, m, a, b, dimension=3, residual_blocks=False, leakiness=0):  # default using residual_block
            if residual_blocks: #ResNet style blocks
                m.add(scn.ConcatTable()
                      .add(scn.Identity() if a == b else scn.NetworkInNetwork(a, b, False))
                      .add(scn.Sequential()
                        .add(scn.BatchNormLeakyReLU(a,leakiness=leakiness))
                        .add(scn.SubmanifoldConvolution(dimension, a, b, 3, False))
                        .add(scn.BatchNormLeakyReLU(b,leakiness=leakiness))
                        .add(scn.SubmanifoldConvolution(dimension, b, b, 3, False)))
                 ).add(scn.AddTable())
            else: #VGG style blocks
                m.add(scn.Sequential()
                     .add(scn.BatchNormLeakyReLU(a,leakiness=leakiness))
                     .add(scn.SubmanifoldConvolution(dimension, a, b, 3, False)))
    

    稀疏3d卷积

    子流形卷积scn.SubmanifoldConvolution(2, 1, 8, 3, False): # batch_size, channel_in, channel_out, filter_size

    稀疏卷积 scn.Convolution(2, 32, 32, 3, 2, False): # batch_size, channel_in, channel_out, filter_size, strides

    批归一化scn.BatchNormalization(32): # channel_in

    稀疏到稠密转化scn.SparseToDense(2, 32): # batch_size, channel_in

    输入scn.InputBatch(2, sparse_shape): # batch_size, sparse_shape

    设置输入input.set_locations(locations, features,0) # locations [N, 2] features [N, 1] 保存N个特征的位置,N个特征

    输入scn.InputLayer(2, spatial_size, 2) # dimension, spatial_size, mode=3

    ​ mode == 0 if the input is guaranteed to have no duplicates

    ​ mode == 1 to use the last item at each spatial location

    ​ mode == 2 to keep the first item at each spatial location

    ​ mode == 3 to sum feature vectors sharing one spatial location

    ​ mode == 4 to average feature vectors at each spatial location

    self.scn_input((coors.cpu(), voxel_features, batch_size)): 将坐标及相应的feature转换成可以处理用稀疏3d卷积处理的数据类型

  • 相关阅读:
    ssi服务器端指令
    json格式的转换为json字符串函数
    接口测试基础和jmeter
    【JZOJ6274】梦境
    【JZOJ6275】小L的数列
    【luoguP4721】分治 FFT
    【luoguP3868】猜数字
    中国剩余定理与扩展中国剩余定理
    【JZOJ6277】矩阵游戏
    【JZOJ6271】锻造 (forging)
  • 原文地址:https://www.cnblogs.com/o-v-o/p/10948618.html
Copyright © 2020-2023  润新知