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

Espnetv2 redundant avg pooling in input reinforcement #40

Open
mayaboker opened this issue Jul 29, 2021 · 0 comments
Open

Espnetv2 redundant avg pooling in input reinforcement #40

mayaboker opened this issue Jul 29, 2021 · 0 comments

Comments

@mayaboker
Copy link

In the input reinforcement branches it seem that there are redundants Average pool on the original input in the deeper stages.
Do you see any problem to pass the strided average input image after each DownSample block to the next one?
In DownSampler forward method, return input2:

def forward(self, input, input2=None):
        '''
        :param input: input feature map
        :return: feature map down-sampled by a factor of 2
        '''
        avg_out = self.avg(input)
        eesp_out = self.eesp(input)
        output = torch.cat([avg_out, eesp_out], 1)

        if input2 is not None:
            #assuming the input is a square image
            # Shortcut connection with the input image
            w1 = avg_out.size(2)
            while True:
                input2 = F.avg_pool2d(input2, kernel_size=3, padding=1, stride=2)
                w2 = input2.size(2)
                if w2 == w1:
                    break
            output = output + self.inp_reinf(input2)

        return self.act(output), input2

In Espnet class, overwrite the input object:

out_l3_0, input = self.level3_0(out_l2, input)  # down-sample

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant