You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you calculate the dot product between the anchor feature and all positive features, you are calculating the product between the first image of anchor layer (total 10 images, using a batch of 30 as in your example) and all images of the positive layer.
archor_feature = bottom[0].data[0]
for i in range(self.triplet):
positive_feature = bottom[0].data[i+self.triplet]
a_p = archor_feature - positive_feature
ap = np.dot(a_p,a_p)
aps[i+self.triplet] = ap
You repeat a similar procedure between the first image in the anchor layer and all images in the negative layer:
for i in range(self.triplet):
negative_feature = bottom[0].data[i+self.triplet*2]
a_n = archor_feature - negative_feature
an = np.dot(a_n,a_n)
ans[i+self.triplet*2] = an
I am not sure if there is a away around it, but what are all the other images in the anchor layer used for? (in your example 9 images, from image 1 to image 9)? nothing?
The text was updated successfully, but these errors were encountered:
If there are 9 images, first three (self.triplet==3 here) are used as anchors (anchor is given by the positive_feature variable).
Note that positive feature is changing at every iteration.
a_p = archor_feature - positive_feature subtracts the positive feature from the whole batch.
ap = np.dot(a_p,a_p) calculates the l2 distance.
When you calculate the dot product between the anchor feature and all positive features, you are calculating the product between the first image of anchor layer (total 10 images, using a batch of 30 as in your example) and all images of the positive layer.
You repeat a similar procedure between the first image in the anchor layer and all images in the negative layer:
I am not sure if there is a away around it, but what are all the other images in the anchor layer used for? (in your example 9 images, from image 1 to image 9)? nothing?
The text was updated successfully, but these errors were encountered: