fartashf / vsepp

PyTorch Code for the paper "VSE++: Improving Visual-Semantic Embeddings with Hard Negatives"
Apache License 2.0
488 stars 125 forks source link

evaluation problems #11

Closed chirstinaFan closed 6 years ago

chirstinaFan commented 6 years ago

def t2i(images, captions, npts=None, measure='cosine', return_ranks=False): """ Text->Images (Image Search) Images: (5N, K) matrix of images Captions: (5N, K) matrix of captions """ if npts is None: npts = int(images.shape[0] / 5) ims = numpy.array([images[i] for i in range(0, len(images), 5)])

why divide 5?

fartashf commented 6 years ago

For datasets used, there is always exactly 5 captions per image. These are made into 5N pairs where every 5 consecutive pair has the same image.

chirstinaFan commented 6 years ago

Thank you very much. IN our datasets,there is always exactly 1 captions per image.should I just devide 1?

fartashf commented 6 years ago

Sure. Make sure you change all other places where this assumption is used. Search for the number 5 in the code.

chirstinaFan commented 6 years ago

OK, thanks for your help.