Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify the dimension to squeeze #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions pnet2_layers/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ def build(self, input_shape):

def call(self, xyz, points, training=True):

if points is not None:
if len(points.shape) < 3:
points = tf.expand_dims(points, axis=0)

if self.group_all:
nsample = xyz.get_shape()[1]
new_xyz, new_points, idx, grouped_xyz = utils.sample_and_group_all(xyz, points, self.use_xyz)
Expand All @@ -56,7 +52,7 @@ def call(self, xyz, points, training=True):

new_points = tf.math.reduce_max(new_points, axis=2, keepdims=True)

return new_xyz, tf.squeeze(new_points)
return new_xyz, tf.squeeze(new_points, [2])


class Pointnet_SA_MSG(Layer):
Expand Down Expand Up @@ -89,10 +85,6 @@ def build(self, input_shape):

def call(self, xyz, points, training=True):

if points is not None:
if len(points.shape) < 3:
points = tf.expand_dims(points, axis=0)

new_xyz = utils.gather_point(xyz, utils.farthest_point_sample(self.npoint, xyz))

new_points_list = []
Expand Down Expand Up @@ -145,13 +137,6 @@ def build(self, input_shape):

def call(self, xyz1, xyz2, points1, points2, training=True):

if points1 is not None:
if len(points1.shape) < 3:
points1 = tf.expand_dims(points1, axis=0)
if points2 is not None:
if len(points2.shape) < 3:
points2 = tf.expand_dims(points2, axis=0)

dist, idx = utils.three_nn(xyz1, xyz2)
dist = tf.maximum(dist, 1e-10)
norm = tf.reduce_sum((1.0/dist),axis=2, keepdims=True)
Expand All @@ -168,8 +153,6 @@ def call(self, xyz1, xyz2, points1, points2, training=True):
for i, mlp_layer in enumerate(self.mlp_list):
new_points1 = mlp_layer(new_points1, training=training)

new_points1 = tf.squeeze(new_points1)
if len(new_points1.shape) < 3:
new_points1 = tf.expand_dims(new_points1, axis=0)
new_points1 = tf.squeeze(new_points1, [2])

return new_points1