當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。