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

Drawing of Figure 2 #39

Open
Newones11 opened this issue Jan 15, 2025 · 1 comment
Open

Drawing of Figure 2 #39

Newones11 opened this issue Jan 15, 2025 · 1 comment

Comments

@Newones11
Copy link

Thank you for your excellent works. Could you please tell me how Figure 2 was drawn? I would be grateful!

@ming053l
Copy link
Owner

Hi, regarding Figure 2, you can add an output during the network's forward process to access the feature maps for visualization.

please consider the following pseudo code (especially at "")

    def forward_features(self, x):

        x_size = (x.shape[2], x.shape[3])

        x = self.patch_embed(x)
        if self.ape:
            x = x + self.absolute_pos_embed
        x = self.pos_drop(x)
       **feature_map = ""**
        for layer in self.layers:
            x = layer(x, x_size)
            **if layer == 2:**
                 **feature_map = x**
        x = self.norm(x)  # b seq_len c
        x = self.patch_unembed(x, x_size)
       
        return x, feature_map

    def forward(self, x):
        self.mean = self.mean.type_as(x)
        x = (x - self.mean) * self.img_range

        if self.upsampler == 'pixelshuffle':
            # for classical SR
            x = self.conv_first(x)
           **y, feature_map = (self.forward_features(x)**
           ** x= self.conv_after_body(y) + x**
            x = self.conv_before_upsample(x)
            x = self.conv_last(self.upsample(x))

        x = x / self.img_range + self.mean

        return x**, feature_map**

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

2 participants