Skip to content

Commit

Permalink
update configs; remove points in mlp decoders; sync for paper results…
Browse files Browse the repository at this point in the history
… reproduction
  • Loading branch information
HaoyiZhu committed Mar 26, 2024
1 parent 7741218 commit b890d36
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 32 deletions.
12 changes: 7 additions & 5 deletions configs/s3dis/pretrain-ponder-spunet-v1m1-0-base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,31 @@
field=dict(
type="SDFField",
sdf_decoder=dict(
in_dim=128,
in_dim=64,
out_dim=65, # 64 + 1
hidden_size=128,
n_blocks=1,
points_factor=0.0,
),
rgb_decoder=dict(
in_dim=198, # 128 + 64 + 3 + 3
in_dim=134, # 64 + 64 + 3 + 3
out_dim=3,
hidden_size=128,
n_blocks=0,
points_factor=0.0,
),
semantic_decoder=dict(
in_dim=195, # 128 + 64 + 3, no directions
in_dim=131, # 128 + 64 + 3, no directions
out_dim=512,
hidden_size=128,
n_blocks=0,
points_factor=0.0,
),
beta_init=0.3,
use_gradient=True,
volume_type="default",
padding_mode="zeros",
share_volume=True,
share_volume=False,
norm_pts=True,
norm_padding=0.1,
),
Expand Down Expand Up @@ -93,7 +96,6 @@
ray_nsample=256,
padding=0.1,
pool_type="mean",
share_volume=True,
render_semantic=True,
conditions=("S3DIS",),
template=(
Expand Down
14 changes: 8 additions & 6 deletions configs/scannet/pretrain-ponder-ppt-v1m1-0-sc-s3-st-spunet.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

mix_prob = 0.0
empty_cache = True
enable_amp = True
enable_amp = False
evaluate = False
find_unused_parameters = True

Expand Down Expand Up @@ -46,28 +46,31 @@
field=dict(
type="SDFField",
sdf_decoder=dict(
in_dim=128,
in_dim=64,
out_dim=65, # 64 + 1
hidden_size=128,
n_blocks=1,
points_factor=0.0,
),
rgb_decoder=dict(
in_dim=198, # 128 + 64 + 3 + 3
in_dim=134, # 64 + 64 + 3 + 3
out_dim=3,
hidden_size=128,
n_blocks=0,
points_factor=0.0,
),
semantic_decoder=dict(
in_dim=195, # 128 + 64 + 3, no directions
in_dim=131, # 64 + 64 + 3, no directions
out_dim=512,
hidden_size=128,
n_blocks=0,
points_factor=0.0,
),
beta_init=0.3,
use_gradient=True,
volume_type="default",
padding_mode="zeros",
share_volume=True,
share_volume=False,
norm_pts=True,
norm_padding=0.1,
),
Expand Down Expand Up @@ -108,7 +111,6 @@
backbone_out_channels=96,
context_channels=256,
pool_type="mean",
share_volume=True,
render_semantic=True,
conditions=("Structured3D", "ScanNet", "S3DIS"),
template=(
Expand Down
20 changes: 12 additions & 8 deletions configs/scannet/pretrain-ponder-spunet-v1m1-0-base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,33 @@
field=dict(
type="SDFField",
sdf_decoder=dict(
in_dim=128,
in_dim=64,
out_dim=65, # 64 + 1
hidden_size=128,
n_blocks=1,
pos_enc=False,
points_factor=0.0,
),
rgb_decoder=dict(
in_dim=198, # 128 + 64 + 3 + 3
in_dim=134, # 64 + 64 + 3 + 3
out_dim=3,
hidden_size=128,
n_blocks=0,
pos_enc=False,
points_factor=0.0,
),
semantic_decoder=dict(
in_dim=195, # 128 + 64 + 3, no directions
in_dim=131, # 64 + 64 + 3, no directions
out_dim=512,
hidden_size=128,
n_blocks=0,
points_factor=0.0,
),
beta_init=0.3,
use_gradient=True,
volume_type="default",
padding_mode="zeros",
share_volume=True,
share_volume=False,
norm_pts=True,
norm_padding=0.1,
),
Expand Down Expand Up @@ -93,7 +98,6 @@
ray_nsample=256,
padding=0.1,
pool_type="mean",
share_volume=True,
render_semantic=True,
conditions=("ScanNet",),
template=(
Expand Down Expand Up @@ -146,10 +150,10 @@
)

# scheduler settings
epoch = 800
epoch = 2000
optimizer = dict(
type="SGD",
lr=0.0001 * batch_size / 8,
lr=0.0005 * batch_size / 8,
momentum=0.9,
weight_decay=0.0001,
nesterov=True,
Expand Down Expand Up @@ -288,7 +292,7 @@
),
],
test_mode=False,
loop=1, # sampling weight
loop=2, # sampling weight
),
)

Expand Down
12 changes: 7 additions & 5 deletions configs/structured3d/pretrain-ponder-spunet-v1m1-0-base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,31 @@
field=dict(
type="SDFField",
sdf_decoder=dict(
in_dim=128,
in_dim=64,
out_dim=65, # 64 + 1
hidden_size=128,
n_blocks=1,
points_factor=0.0,
),
rgb_decoder=dict(
in_dim=198, # 128 + 64 + 3 + 3
in_dim=134, # 64 + 64 + 3 + 3
out_dim=3,
hidden_size=128,
n_blocks=0,
points_factor=0.0,
),
semantic_decoder=dict(
in_dim=195, # 128 + 64 + 3, no directions
in_dim=131, # 64 + 64 + 3, no directions
out_dim=512,
hidden_size=128,
n_blocks=0,
points_factor=0.0,
),
beta_init=0.3,
use_gradient=True,
volume_type="default",
padding_mode="zeros",
share_volume=True,
share_volume=False,
norm_pts=True,
norm_padding=0.1,
),
Expand Down Expand Up @@ -93,7 +96,6 @@
ray_nsample=256,
padding=0.1,
pool_type="mean",
share_volume=True,
render_semantic=True,
conditions=("Structured3D",),
template=(
Expand Down
2 changes: 0 additions & 2 deletions ponder/models/ponder/ponder_indoor_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def __init__(
backbone_out_channels=96,
context_channels=256,
pool_type="mean",
share_volume=True,
render_semantic=False, # whether to render 2D semantic maps.
conditions=None,
template=None,
Expand All @@ -50,7 +49,6 @@ def __init__(
self.pool_type = pool_type
self.val_ray_split = val_ray_split
self.ray_nsample = ray_nsample
self.share_volume = share_volume
self.mask = mask

self.bounds = [
Expand Down
30 changes: 24 additions & 6 deletions ponder/models/ponder/render_utils/decoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@


class SDFDecoder(nn.Module):
def __init__(self, in_dim, out_dim, hidden_size=256, n_blocks=5, **kwargs):
def __init__(
self, in_dim, out_dim, hidden_size=256, n_blocks=5, points_factor=1.0, **kwargs
):
super().__init__()

dims = [hidden_size] + [hidden_size for _ in range(n_blocks)] + [out_dim]
Expand All @@ -21,8 +23,10 @@ def __init__(self, in_dim, out_dim, hidden_size=256, n_blocks=5, **kwargs):

self.activation = nn.Softplus(beta=100)

self.points_factor = points_factor

def forward(self, points, point_feats):
x = self.fc_p(points)
x = self.fc_p(points) * self.points_factor
for l in range(self.num_layers - 1):
x = x + self.fc_c[l](point_feats)
lin = getattr(self, "lin" + str(l))
Expand All @@ -33,7 +37,15 @@ def forward(self, points, point_feats):


class RGBDecoder(nn.Module):
def __init__(self, in_dim, out_dim=3, hidden_size=256, n_blocks=5, **kwargs):
def __init__(
self,
in_dim,
out_dim=3,
hidden_size=256,
n_blocks=5,
points_factor=1.0,
**kwargs
):
super().__init__()

dims = [hidden_size] + [hidden_size for _ in range(n_blocks)] + [out_dim]
Expand All @@ -50,8 +62,10 @@ def __init__(self, in_dim, out_dim=3, hidden_size=256, n_blocks=5, **kwargs):
)
self.activation = nn.ReLU()

self.points_factor = points_factor

def forward(self, points, point_feats):
x = self.fc_p(points)
x = self.fc_p(points) * self.points_factor
for l in range(self.num_layers - 1):
x = x + self.fc_c[l](point_feats)
lin = getattr(self, "lin" + str(l))
Expand All @@ -63,7 +77,9 @@ def forward(self, points, point_feats):


class SemanticDecoder(nn.Module):
def __init__(self, in_dim, out_dim, hidden_size=256, n_blocks=5, **kwargs):
def __init__(
self, in_dim, out_dim, hidden_size=256, n_blocks=5, points_factor=1.0, **kwargs
):
super().__init__()

dims = [hidden_size] + [hidden_size for _ in range(n_blocks)] + [out_dim]
Expand All @@ -80,8 +96,10 @@ def __init__(self, in_dim, out_dim, hidden_size=256, n_blocks=5, **kwargs):
)
self.activation = nn.ReLU()

self.points_factor = points_factor

def forward(self, points, point_feats):
x = self.fc_p(points)
x = self.fc_p(points) * self.points_factor
for l in range(self.num_layers - 1):
x = x + self.fc_c[l](point_feats)
lin = getattr(self, "lin" + str(l))
Expand Down

0 comments on commit b890d36

Please sign in to comment.