filipradenovic/cnnimageretrieval-pytorch

can you explain how to decrease positions of positives in cirtorch.utils.evaluate?

Opened this issue · 0 comments

Your working is really great! It help me a lot. When I calculated the MAP through your code, I found a problem. In cirtorch.utils.evaluate.py, you define a function:

def compute_map(ranks, gnd, kappas=[]):
......
k = 0;
ij = 0;
if len(junk):
# decrease positions of positives based on the number of
# junk images appearing before them
ip = 0
while (ip < len(pos)):
while (ij < len(junk) and pos[ip] > junk[ij]):
k += 1
ij += 1
pos[ip] = pos[ip] - k
ip += 1
.......
In this code from line 83 in evaluate.py, why do you reset the k=0 and ij=0 in the "while(ip < len(pos))"? In my opinion, if we do not reset k and ij, it may not be reasonable. Can you explain the reason? Thank you very much!