sydai / referring-expression-counting

MIT License
11 stars 1 forks source link

Why isn't mask_bi taken from the index of img_cap_list? #5

Open Kkkkkz21 opened 3 months ago

Kkkkkz21 commented 3 months ago

Why isn't mask_bi taken from the index of img_cap_list? image If i is taken, there will be corresponding errors in calculating the contrastive loss later. image

PREPONDERANCE commented 3 months ago

Because mask_bi is not really the index of the img_cap_list. Rather, it's the batch index.

See the below example:

a = [[1,2],[1,2],[3,4]]
mask_bi = [i for i,e in enumerate(a) for _ in e]
print(mask_bi)

>>> [0, 0, 1, 1, 2, 2]

(Suppose the structure of img_cap_list is the same of a)