summaryrefslogtreecommitdiff
path: root/models/part_net.py
diff options
context:
space:
mode:
authorJordan Gong <jordan.gong@protonmail.com>2021-02-26 20:23:26 +0800
committerJordan Gong <jordan.gong@protonmail.com>2021-02-26 20:23:57 +0800
commit8745ffeb51b29cfe7d3eee2d845910086ba8b046 (patch)
tree4eccf715f0a17c0d54c75d38b54e1d682dc26b99 /models/part_net.py
parent9b1828be1db7fd1be8731a7cec66162de9145285 (diff)
parent5f75d7ef65f6dcd0e72df320c58b6bd141937b5f (diff)
Merge branch 'data_parallel' into data_parallel_py3.8
# Conflicts: # models/part_net.py # models/rgb_part_net.py
Diffstat (limited to 'models/part_net.py')
-rw-r--r--models/part_net.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/models/part_net.py b/models/part_net.py
index f34f993..d9b954f 100644
--- a/models/part_net.py
+++ b/models/part_net.py
@@ -111,32 +111,22 @@ class TemporalFeatureAggregator(nn.Module):
class PartNet(nn.Module):
def __init__(
self,
- in_channels: int = 3,
- feature_channels: int = 32,
- kernel_sizes: Tuple[Tuple, ...] = ((5, 3), (3, 3), (3, 3)),
- paddings: Tuple[Tuple, ...] = ((2, 1), (1, 1), (1, 1)),
- halving: Tuple[int, ...] = (0, 2, 3),
+ in_channels: int = 128,
squeeze_ratio: int = 4,
num_part: int = 16
):
super().__init__()
self.num_part = num_part
- self.fpfe = FrameLevelPartFeatureExtractor(
- in_channels, feature_channels, kernel_sizes, paddings, halving
- )
-
- num_fconv_blocks = len(self.fpfe.fconv_blocks)
- self.tfa_in_channels = feature_channels * 2 ** (num_fconv_blocks - 1)
self.tfa = TemporalFeatureAggregator(
- self.tfa_in_channels, squeeze_ratio, self.num_part
+ in_channels, squeeze_ratio, self.num_part
)
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.max_pool = nn.AdaptiveMaxPool2d(1)
def forward(self, x):
- n, t, _, _, _ = x.size()
- x = self.fpfe(x)
+ n, t, c, h, w = x.size()
+ x = x.view(n * t, c, h, w)
# n * t x c x h x w
# Horizontal Pooling