当前位置: 首页>>代码示例>>Python>>正文


Python tf_interpolate.three_interpolate方法代码示例

本文整理汇总了Python中tf_interpolate.three_interpolate方法的典型用法代码示例。如果您正苦于以下问题:Python tf_interpolate.three_interpolate方法的具体用法?Python tf_interpolate.three_interpolate怎么用?Python tf_interpolate.three_interpolate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tf_interpolate的用法示例。


在下文中一共展示了tf_interpolate.three_interpolate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fun

# 需要导入模块: import tf_interpolate [as 别名]
# 或者: from tf_interpolate import three_interpolate [as 别名]
def fun(xyz1,xyz2,pts2):
    with tf.device('/cpu:0'):
        points = tf.constant(np.expand_dims(pts2,0))
        xyz1 = tf.constant(np.expand_dims(xyz1,0))
        xyz2 = tf.constant(np.expand_dims(xyz2,0))
        dist, idx = three_nn(xyz1, xyz2)
        #weight = tf.ones_like(dist)/3.0
        dist = tf.maximum(dist, 1e-10)
        norm = tf.reduce_sum((1.0/dist),axis=2,keep_dims=True)
        norm = tf.tile(norm, [1,1,3])
        print norm
        weight = (1.0/dist) / norm
        interpolated_points = three_interpolate(points, idx, weight)
    with tf.Session('') as sess:
        tmp,pts1,d,w = sess.run([xyz1, interpolated_points, dist, weight])
        #print w
        pts1 = pts1.squeeze()
    return pts1 
开发者ID:mhsung,项目名称:deep-functional-dictionaries,代码行数:20,代码来源:visu_interpolation.py

示例2: fun

# 需要导入模块: import tf_interpolate [as 别名]
# 或者: from tf_interpolate import three_interpolate [as 别名]
def fun(xyz1,xyz2,pts2):
    with tf.device('/cpu:0'):
        points = tf.constant(np.expand_dims(pts2,0))
        xyz1 = tf.constant(np.expand_dims(xyz1,0))
        xyz2 = tf.constant(np.expand_dims(xyz2,0))
        dist, idx = three_nn(xyz1, xyz2)
        #weight = tf.ones_like(dist)/3.0
        dist = tf.maximum(dist, 1e-10)
        norm = tf.reduce_sum((1.0/dist),axis=2,keep_dims=True)
        norm = tf.tile(norm, [1,1,3])
        print(norm)
        weight = (1.0/dist) / norm
        interpolated_points = three_interpolate(points, idx, weight)
    with tf.Session('') as sess:
        tmp,pts1,d,w = sess.run([xyz1, interpolated_points, dist, weight])
        #print w
        pts1 = pts1.squeeze()
    return pts1 
开发者ID:xingyul,项目名称:meteornet,代码行数:20,代码来源:visu_interpolation.py

示例3: pc_upsampling

# 需要导入模块: import tf_interpolate [as 别名]
# 或者: from tf_interpolate import three_interpolate [as 别名]
def pc_upsampling(xyz_upsample,
                  xyz,
                  feat,
                  scope='upsampling'):
  """ Fully connected layer with non-linear operation.
  
  Args:
    xyz_upsample: 3-D tensor B x N2 x 3
    xyz: 3-D tensor B x N x 3
    feat: 3-D tensor B x N x C
  
  Returns:
    feat_upsample: 3-D tensor B x N2 x C
  """
  with tf.variable_scope(scope) as sc:
    dist, idx_de = three_nn(xyz_upsample, xyz)
    dist = tf.maximum(dist, 1e-10)
    norm = tf.reduce_sum((1.0/dist),axis=2,keep_dims=True)
    norm = tf.tile(norm,[1,1,3])
    weight = (1.0/dist) / norm
    feat_upsample = three_interpolate(feat, idx_de, weight)

    return feat_upsample 
开发者ID:xyf513,项目名称:SpiderCNN,代码行数:25,代码来源:tf_util.py

示例4: pointnet_upsample

# 需要导入模块: import tf_interpolate [as 别名]
# 或者: from tf_interpolate import three_interpolate [as 别名]
def pointnet_upsample(xyz1, xyz2, points2, scope):
    """ PointNet Feature Propogation (FP) Module
            Input:
                xyz1: (batch_size, ndataset1, 3) TF tensor
                xyz2: (batch_size, ndataset2, 3) TF tensor, sparser than xyz1
                points2: (batch_size, ndataset2, nchannel2) TF tensor
            Return:
                new_points: (batch_size, ndataset1, nchannel2) TF tensor
    """
    with tf.variable_scope(scope) as sc:
        dist, idx = three_nn(xyz1, xyz2)
        dist = tf.maximum(dist, 1e-10)
        norm = tf.reduce_sum((1.0 / dist), axis=2, keep_dims=True)
        norm = tf.tile(norm, [1, 1, 3])
        weight = (1.0 / dist) / norm
        interpolated_points = three_interpolate(points2, idx, weight)  # B x ndataset1 x nchannel2

        return interpolated_points 
开发者ID:dlinzhao,项目名称:JSNet,代码行数:20,代码来源:pointnet_util.py

示例5: fun

# 需要导入模块: import tf_interpolate [as 别名]
# 或者: from tf_interpolate import three_interpolate [as 别名]
def fun(xyz1, xyz2, pts2):
    with tf.device('/cpu:0'):
        points = tf.constant(np.expand_dims(pts2, 0))
        xyz1 = tf.constant(np.expand_dims(xyz1, 0))
        xyz2 = tf.constant(np.expand_dims(xyz2, 0))
        dist, idx = three_nn(xyz1, xyz2)
        # weight = tf.ones_like(dist)/3.0
        dist = tf.maximum(dist, 1e-10)
        norm = tf.reduce_sum((1.0 / dist), axis=2, keep_dims=True)
        norm = tf.tile(norm, [1, 1, 3])
        print(norm)
        weight = (1.0 / dist) / norm
        interpolated_points = three_interpolate(points, idx, weight)
    with tf.Session('') as sess:
        tmp, pts1, d, w = sess.run([xyz1, interpolated_points, dist, weight])
        # print w
        pts1 = pts1.squeeze()
    return pts1 
开发者ID:dlinzhao,项目名称:JSNet,代码行数:20,代码来源:visu_interpolation.py

示例6: test_grad

# 需要导入模块: import tf_interpolate [as 别名]
# 或者: from tf_interpolate import three_interpolate [as 别名]
def test_grad(self):
    with self.test_session():
      points = tf.constant(np.random.random((1,8,16)).astype('float32'))
      print points
      xyz1 = tf.constant(np.random.random((1,128,3)).astype('float32'))
      xyz2 = tf.constant(np.random.random((1,8,3)).astype('float32'))
      dist, idx = three_nn(xyz1, xyz2)
      weight = tf.ones_like(dist)/3.0
      interpolated_points = three_interpolate(points, idx, weight)
      print interpolated_points
      err = tf.test.compute_gradient_error(points, (1,8,16), interpolated_points, (1,128,16))
      print err
      self.assertLess(err, 1e-4) 
开发者ID:mhsung,项目名称:deep-functional-dictionaries,代码行数:15,代码来源:tf_interpolate_op_test.py

示例7: pointnet_fp_module

# 需要导入模块: import tf_interpolate [as 别名]
# 或者: from tf_interpolate import three_interpolate [as 别名]
def pointnet_fp_module(xyz1, xyz2, points1, points2, mlp, is_training, bn_decay, scope, bn=True):
    ''' PointNet Feature Propogation (FP) Module
        Input:                                                                                                      
            xyz1: (batch_size, ndataset1, 3) TF tensor                                                              
            xyz2: (batch_size, ndataset2, 3) TF tensor, sparser than xyz1                                           
            points1: (batch_size, ndataset1, nchannel1) TF tensor                                                   
            points2: (batch_size, ndataset2, nchannel2) TF tensor
            mlp: list of int32 -- output size for MLP on each point                                                 
        Return:
            new_points: (batch_size, ndataset1, mlp[-1]) TF tensor
    '''
    with tf.variable_scope(scope) as sc:
        dist, idx = three_nn(xyz1, xyz2)
        dist = tf.maximum(dist, 1e-10)
        norm = tf.reduce_sum((1.0/dist),axis=2,keep_dims=True)
        norm = tf.tile(norm,[1,1,3])
        weight = (1.0/dist) / norm
        interpolated_points = three_interpolate(points2, idx, weight)

        if points1 is not None:
            new_points1 = tf.concat(axis=2, values=[interpolated_points, points1]) # B,ndataset1,nchannel1+nchannel2
        else:
            new_points1 = interpolated_points
        new_points1 = tf.expand_dims(new_points1, 2)
        for i, num_out_channel in enumerate(mlp):
            new_points1 = tf_util.conv2d(new_points1, num_out_channel, [1,1],
                                         padding='VALID', stride=[1,1],
                                         bn=bn, is_training=is_training,
                                         scope='conv_%d'%(i), bn_decay=bn_decay)
        new_points1 = tf.squeeze(new_points1, [2]) # B,ndataset1,mlp[-1]
        return new_points1 
开发者ID:mhsung,项目名称:deep-functional-dictionaries,代码行数:33,代码来源:pointnet_util.py

示例8: pointnet_fp_module

# 需要导入模块: import tf_interpolate [as 别名]
# 或者: from tf_interpolate import three_interpolate [as 别名]
def pointnet_fp_module(xyz1, xyz2, points1, points2, mlp, is_training, bn_decay, scope, bn=True):
    ''' PointNet Feature Propogation (FP) Module
        Input:
            xyz1: (batch_size, ndataset1, 3) TF tensor
            xyz2: (batch_size, ndataset2, 3) TF tensor, sparser than xyz1
            points1: (batch_size, ndataset1, nchannel1) TF tensor
            points2: (batch_size, ndataset2, nchannel2) TF tensor
            mlp: list of int32 -- output size for MLP on each point
        Return:
            new_points: (batch_size, ndataset1, mlp[-1]) TF tensor
    '''
    with tf.variable_scope(scope) as sc:
        dist, idx = three_nn(xyz1, xyz2)
        dist = tf.maximum(dist, 1e-10)
        norm = tf.reduce_sum((1.0/dist),axis=2, keepdims=True)
        norm = tf.tile(norm,[1,1,3])
        weight = (1.0/dist) / norm
        interpolated_points = three_interpolate(points2, idx, weight)

        if points1 is not None:
            new_points1 = tf.concat(axis=2, values=[interpolated_points, points1]) # B,ndataset1,nchannel1+nchannel2
        else:
            new_points1 = interpolated_points
        new_points1 = tf.expand_dims(new_points1, 2)
        for i, num_out_channel in enumerate(mlp):
            new_points1 = tf_util.conv2d(new_points1, num_out_channel, [1,1],
                                         padding='VALID', stride=[1,1],
                                         bn=bn, is_training=is_training,
                                         scope='conv_%d'%(i), bn_decay=bn_decay)
        new_points1 = tf.squeeze(new_points1, [2]) # B,ndataset1,mlp[-1]
        return new_points1 
开发者ID:xingyul,项目名称:meteornet,代码行数:33,代码来源:net_utils.py

示例9: pointnet_fp_module

# 需要导入模块: import tf_interpolate [as 别名]
# 或者: from tf_interpolate import three_interpolate [as 别名]
def pointnet_fp_module(xyz1,
                       xyz2,
                       points1,
                       points2,
                       mlp,
                       last_mlp_activation=True,
                       scope='fp'):
    ''' PointNet Feature Propogation (FP) Module
        Input:
            xyz1:       (batch_size, ndataset1, 3) TF tensor
            xyz2:       (batch_size, ndataset2, 3) TF tensor, sparser than xyz1
            points1:    (batch_size, ndataset1, nchannel1) TF tensor
            points2:    (batch_size, ndataset2, nchannel2) TF tensor
            mlp:        list of int32 -- output size for MLP on each point
        Return:
            new_points: (batch_size, ndataset1, mlp[-1]) TF tensor
    '''
    with tf.variable_scope(scope) as sc:
        dist, idx = three_nn(xyz1, xyz2)
        dist = tf.maximum(dist, 1e-10)
        norm = tf.reduce_sum((1.0/dist),axis=2, keepdims=True)
        norm = tf.tile(norm,[1,1,3])
        weight = (1.0/dist) / norm
        interpolated_points = three_interpolate(points2, idx, weight)

        if points1 is not None:
            new_points1 = tf.concat(axis=2, values=[interpolated_points, points1])  # B,ndataset1,nchannel1+nchannel2
        else:
            new_points1 = interpolated_points
        new_points1 = tf.expand_dims(new_points1, 2)
        for i, num_out_channel in enumerate(mlp):
            if i == len(mlp)-1 and not(last_mlp_activation):
                activation_fn = None
            else:
                activation_fn = tf.nn.relu
            new_points1 = conv2d(inputs=new_points1, filters=num_out_channel, name='mlp_%d'%(i+1))

        new_points1 = tf.squeeze(new_points1, [2])                                  # B,ndataset1,mlp[-1]
        return new_points1 
开发者ID:hehefan,项目名称:PointRNN,代码行数:41,代码来源:pointnet2.py

示例10: pointnet_fp_module

# 需要导入模块: import tf_interpolate [as 别名]
# 或者: from tf_interpolate import three_interpolate [as 别名]
def pointnet_fp_module(xyz1, xyz2, points1, points2, mlp, is_training, bn_decay, scope, bn=True):
    ''' PointNet Feature Propogation (FP) Module
        Input:                                                                                                      
            xyz1: (batch_size, ndataset1, 3) TF tensor                                                              
            xyz2: (batch_size, ndataset2, 3) TF tensor, sparser than xyz1                                           
            points1: (batch_size, ndataset1, nchannel1) TF tensor                                                   
            points2: (batch_size, ndataset2, nchannel2) TF tensor
            mlp: list of int32 -- output size for MLP on each point                                                 
        Return:
            new_points: (batch_size, ndataset1, mlp[-1]) TF tensor
    '''
    with tf.variable_scope(scope) as sc:
        dist, idx = three_nn(xyz1, xyz2)
        dist = tf.maximum(dist, 1e-10)
        norm = tf.reduce_sum((1.0/dist),axis=2,keepdims=True)
        norm = tf.tile(norm,[1,1,3])
        weight = (1.0/dist) / norm
        interpolated_points = three_interpolate(points2, idx, weight)

        if points1 is not None:
            new_points1 = tf.concat(axis=2, values=[interpolated_points, points1]) # B,ndataset1,nchannel1+nchannel2
        else:
            new_points1 = interpolated_points
        new_points1 = tf.expand_dims(new_points1, 2)
        for i, num_out_channel in enumerate(mlp):
            new_points1 = tf_util.conv2d(new_points1, num_out_channel, [1,1],
                                         padding='VALID', stride=[1,1],
                                         bn=bn, is_training=is_training,
                                         scope='conv_%d'%(i), bn_decay=bn_decay)
        new_points1 = tf.squeeze(new_points1, [2]) # B,ndataset1,mlp[-1]
        return new_points1 
开发者ID:lingxiaoli94,项目名称:SPFN,代码行数:33,代码来源:pointnet_util.py

示例11: test_grad

# 需要导入模块: import tf_interpolate [as 别名]
# 或者: from tf_interpolate import three_interpolate [as 别名]
def test_grad(self):
    with self.test_session():
      points = tf.constant(np.random.random((1,8,16)).astype('float32'))
      print(points)
      xyz1 = tf.constant(np.random.random((1,128,3)).astype('float32'))
      xyz2 = tf.constant(np.random.random((1,8,3)).astype('float32'))
      dist, idx = three_nn(xyz1, xyz2)
      weight = tf.ones_like(dist)/3.0
      interpolated_points = three_interpolate(points, idx, weight)
      print(interpolated_points)
      err = tf.test.compute_gradient_error(points, (1,8,16), interpolated_points, (1,128,16))
      print(err)
      self.assertLess(err, 1e-4) 
开发者ID:voidrank,项目名称:Geo-CNN,代码行数:15,代码来源:tf_interpolate_op_test.py


注:本文中的tf_interpolate.three_interpolate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。