summaryrefslogtreecommitdiff
path: root/models/layers.py
diff options
context:
space:
mode:
authorJordan Gong <jordan.gong@protonmail.com>2021-02-08 18:31:52 +0800
committerJordan Gong <jordan.gong@protonmail.com>2021-02-08 18:31:52 +0800
commitd380e04df37593e414bd5641db100613fb2ad882 (patch)
tree1e3b3ea55a464d59d790711372bbca42cb203d0a /models/layers.py
parenta040400d7caa267d4bfbe8e5520568806f92b3d4 (diff)
parent99ddd7c142a4ec97cb8bd14b204651790b3cf4ee (diff)
Merge branch 'master' into python3.8
# Conflicts: # models/hpm.py # models/layers.py # models/model.py # models/rgb_part_net.py # utils/configuration.py
Diffstat (limited to 'models/layers.py')
-rw-r--r--models/layers.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/models/layers.py b/models/layers.py
index 7f2ccec..98e4c10 100644
--- a/models/layers.py
+++ b/models/layers.py
@@ -167,12 +167,13 @@ class HorizontalPyramidPooling(BasicConv2d):
self,
in_channels: int,
out_channels: int,
- kernel_size: Union[int, Tuple[int, int]] = 1,
+ use_1x1conv: bool = False,
use_avg_pool: bool = True,
- use_max_pool: bool = True,
+ use_max_pool: bool = False,
**kwargs
):
- super().__init__(in_channels, out_channels, kernel_size, **kwargs)
+ super().__init__(in_channels, out_channels, kernel_size=1, **kwargs)
+ self.use_1x1conv = use_1x1conv
self.use_avg_pool = use_avg_pool
self.use_max_pool = use_max_pool
assert use_avg_pool or use_max_pool, 'Pooling layer(s) required.'
@@ -186,5 +187,6 @@ class HorizontalPyramidPooling(BasicConv2d):
x = self.avg_pool(x)
elif not self.use_avg_pool and self.use_max_pool:
x = self.max_pool(x)
- x = super().forward(x)
+ if self.use_1x1conv:
+ x = super().forward(x)
return x