ajamjoom / Image-Captions

BERT + Image Captioning
130 stars 30 forks source link

cap = u'[CLS] '+cap ??? #2

Open y78h11b09 opened 4 years ago

y78h11b09 commented 4 years ago
       embeddings = []
        for cap_idx in  encoded_captions:

            # padd caption to correct size
            while len(cap_idx) < max_dec_len:
                cap_idx.append(PAD)

            cap = ' '.join([vocab.idx2word[word_idx.item()] for word_idx in cap_idx])
            cap = u'[CLS] '+cap

Hello, I want to know why here is the code "cap = u'[CLS] '+cap ", is not "cap = u'[CLS]'+cap+u'[SEP]'

mathshangw commented 2 years ago

i know that your question is old, but excuse me do you know why? and what is encoded_captions, does that the captions or the sentences?

y78h11b09 commented 2 years ago

Yes, it denotes the sentence about the content of image.

y78h11b09

@. | On 1/27/2022 @.> wrote:

i know that your question is old, but excuse me do you know why? and what is encoded_captions, does that the captions or the sentences?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

mathshangw commented 2 years ago

thanks so cap_idx is string contain sentence or id ?

y78h11b09 commented 2 years ago

I'am sorry to reply you lately, cap_idx is long number that denoted the index of sentence. Kind regards.

y78h11b09

@. | On 1/31/2022 @.> wrote:

thanks so cap_idx is string contain sentence or id ?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

mathshangw commented 2 years ago

Thanks a lot.

  for cap_idx in  encoded_captions:
          # padd caption to correct size
          while len(cap_idx) < max_dec_len:
                  cap_idx.append(PAD)

len(cap_idx)does means the sentence after encoding ? or the index ? because there is padding for the length, not the name. sorry for my confusion