akarshzingade / image-similarity-deep-ranking

369 stars 103 forks source link

Explanation regarding tripletSampler with response for issue#8. #15

Closed atj1012 closed 6 years ago

atj1012 commented 6 years ago

Hey akarsh,

I have a doubt about your previous explanation about the triplet.txt file generation....

as you mentioned above:

Hey, Sanket. To run the deepRanking.py you need the triplets.txt file. To generate the triplets.txt, you will have to run the tripletSampler.py. For your custom dataset, you will have to segregate similar images to different folders. The structure of your dataset will be like:

dataset/
|__SimilarityClass1/
|    |__Image1.jpg, Image2.jpg and so on....
|
|__SimilarityClass2/
|    |_Image1.jpg, Image2.jpg and so on....
|
and so on...

Now, run the tripletSampler.py script with this. Hope this helps :) Let me know if you have any further questions

which according to me means that any directory should have different/non-similar images... but on the contrary in the code of tripletSampler.py, you are finding the no of positive images from the same directory...

positive_images = get_positive_images(image_name,image_names,num_pos_images)

where image_name is the query image and image_names is the list of images in the current directory/class .

So this sounds incorrect to me as there should be no positive images or similar images in the same directory.

Could you please explain if you understand my doubt.

wagnertimo commented 6 years ago

Hey @atj1012

like he said in the answer: "...you will have to segregate similar images to different folders.. ". This means that indeed there should be positive/similar images in the same folder (SimilarityClass1, SimilarityClass2 etc.). Hence the triplet sampling gets simplified by declaring the negative images as one random image from all other similarity class folders then the query image. Hope this helps.

Best regards Timo

akarshzingade commented 6 years ago

Timo is correct. Please let us know if you have further questions :)