Ejemplo n.º 1
0
    def forward(self, inputs):
        x1 = self._conv_dw_1(inputs)
        x1 = self._conv_linear_1(x1)
        x2 = self._conv_pw_2(inputs)
        x2 = self._conv_dw_2(x2)
        x2 = self._conv_linear_2(x2)
        out = paddle.concat([x1, x2], axis=1)

        return channel_shuffle(out, 2)
Ejemplo n.º 2
0
 def forward(self, inputs):
     x1, x2 = paddle.split(
         inputs,
         num_or_sections=[inputs.shape[1] // 2, inputs.shape[1] // 2],
         axis=1)
     x2 = self._conv_pw(x2)
     x2 = self._conv_dw(x2)
     x2 = self._conv_linear(x2)
     out = paddle.concat([x1, x2], axis=1)
     return channel_shuffle(out, 2)
Ejemplo n.º 3
0
 def forward(self, x):
     if self.stride > 1:
         x1 = self.branch1(x)
         x2 = self.branch2(x)
     else:
         x1, x2 = x.chunk(2, axis=1)
         x2 = self.branch2(x2)
     out = paddle.concat([x1, x2], axis=1)
     out = channel_shuffle(out, groups=2)
     return out
Ejemplo n.º 4
0
    def forward(self, x):
        x = self.conv1(x)
        x1, x2 = x.chunk(2, axis=1)
        x1 = self.branch1(x1)
        x2 = self.expand_conv(x2)
        x2 = self.depthwise_conv(x2)
        x2 = self.linear_conv(x2)
        out = paddle.concat([x1, x2], axis=1)
        out = channel_shuffle(out, groups=2)

        return out
Ejemplo n.º 5
0
    def forward(self, x):
        x = [s.chunk(2, axis=1) for s in x]
        x1 = [s[0] for s in x]
        x2 = [s[1] for s in x]

        x2 = self.cross_resolution_weighting(x2)
        x2 = [dw(s) for s, dw in zip(x2, self.depthwise_convs)]
        x2 = [sw(s) for s, sw in zip(x2, self.spatial_weighting)]

        out = [paddle.concat([s1, s2], axis=1) for s1, s2 in zip(x1, x2)]
        out = [channel_shuffle(s, groups=2) for s in out]
        return out