Code Monkey home page Code Monkey logo

Comments (3)

James1944 avatar James1944 commented on July 20, 2024

each element in the mask variable is either 1 or 0 depending on the ground truth sentence length.
The function finalCaptions() in utils.py computes the sentence length, producing a mask of 1s equal to the length of the sentence and zeros until the mask sentence length.

from soft-attention-image-captioning.

markdtw avatar markdtw commented on July 20, 2024

hi, sorry for the super late reply

The reason to do masking is to exclude the trailing captions. If we didn't mask out the redundant captions, the loss would include these information which basically is the wrong loss calculation.

AFAIK This is a common approach to deal with the inability of variable length output with LSTM.

Thanks!

from soft-attention-image-captioning.

James1944 avatar James1944 commented on July 20, 2024

Hi Mark,
That makes perfect sense! Thanks. I'm going to check out training a model today
Best wishes!

from soft-attention-image-captioning.

Related Issues (4)

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.