Question about pos and neg mask
Closed this issue · 1 comments
Hi, thanks for your great work.
I'm a new learner and have been confused at make_collate_fn
part when reading your code:
MinkLoc3D-SI/datasets/dataset_utils.py
Lines 63 to 135 in b4581ce
Assuming batch size = 2
and the structure of training data is as follows:
{
"0": { "query": path/to/file/xxx.bin
"positives": 1, 116, 117, 345, 346, ...
"negatives": 18671, 15181, 8746, 2052, 7919...
}
"1": { "query": path/to/file/xxx.bin
"positives": 0, 2, 117, 118, 346, ...
"negatives": 10283, 20550, 17938, 4424, 8452...
}
...
}
For query 0
, labels
is [0, 1], its corresponding positives_masks
is dataset.queries[0]['positives'][0]
, dataset.queries[0]['positives'][1]
. Because dataset.queries
has been binarized to range(len(index))
and has excluded query_idx itself, in this case of small batch size, positives_masks
should be [1,1]. Similarly, negatives_masks
should be [0,0].
For query i
and query i+1
, labels
is [i, i+1], and then get the i'th and (i+1)'th pos and neg bit-label. Actually we always get the next batch_size
labels from i.
- Is there anything wrong with my understanding?
- What is the meaning of
positives_mask
andnegatives_mask
? - why not feed pos and neg into network and calculate the embedding distance between anchor and them?
Could you please give me some brief explanation?
Thanks in advance.
could refer to this