GithubHelp home page GithubHelp logo

Could you please provide a demo code for how to visualize the effect of mask decoder, such as the following figure? about convnext-v2 HOT 2 OPEN

facebookresearch avatar facebookresearch commented on July 22, 2024
Could you please provide a demo code for how to visualize the effect of mask decoder, such as the following figure?

from convnext-v2.

Comments (2)

Mogul5306 avatar Mogul5306 commented on July 22, 2024

Have you sovled the noise in the reconstructed images?

from convnext-v2.

hughsando avatar hughsando commented on July 22, 2024

There is nothing the the pipeline to force the output for the unmasked (ie, kept) patches to resemble the input because the differences are explicitly masked off in the forward_loss function. All the masked patches have a 'mask_token' vector from the encoder, and none of the unmasked ones do. I think it is the relative magnitudes of the mask_token and the 'pred' coefficients that cause high values in the reconstruction.
You can factor in a little of the unmasked pixels in the loss if the reconstruction is important to you - I am not sure how this affects performance on downstream tasks.

def forward_loss(self, imgs, pred, mask):
    ...
    #loss = (loss * mask).sum() / mask.sum()

    # Factor in a little of the unmasked stuff too:
    loss = 0.1*loss.mean()  + 0.9* (loss * mask).sum() / mask.sum()

Some experiments with scaling the 'pred' vector also seem to help - although I am not using sparse tensors, so I may have made a mistake elsewhere.

    torch.nn.init.xavier_uniform_(self.pred.weight,0.01)
    torch.nn.init.normal_(self.mask_token, std=10.0)

from convnext-v2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.