akarshzingade / image-similarity-deep-ranking

369 stars 103 forks source link

Basic flow #8

Closed Sanketyeru closed 6 years ago

Sanketyeru commented 6 years ago

Hey hi, Akarsh, I am new in this area of work. Needs some guidance from you. For the image-similarity-ranking how do I generate the triplet.txt file? Basically, I didn't understand which script has to be run fast and how to use it with my custom dataset. it will be very useful for me if you could guild me for this.

akarshzingade commented 6 years ago

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

CattleOfRa commented 6 years ago

How to I generate the deepranking.h5?

I am currently getting an error when I try to run deepRanking.py: python deepRanking.py

Traceback (most recent call last): File "deepRanking.py", line 121, in deep_rank_model.load_weights('deepranking.h5') File "/Library/Python/2.7/site-packages/keras/engine/topology.py", line 2658, in load_weights with h5py.File(filepath, mode='r') as f: File "/Library/Python/2.7/site-packages/h5py/_hl/files.py", line 269, in init fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr) File "/Library/Python/2.7/site-packages/h5py/_hl/files.py", line 99, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5f.pyx", line 78, in h5py.h5f.open IOError: Unable to open file (unable to open file: name = 'deepranking.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

Sanketyeru commented 6 years ago

@CattleOfRa, Inside the file "deepranking.py", you need to comment the line where it is loading that model. as shown in image below.

39591443-61b414a6-4ec9-11e8-820e-c1885d76ec99

And that should solve this problem.

akarshzingade commented 6 years ago

Hey, Daniel. Sanket is right, you just have to comment out that line. The line tries to load the saved weights. If the weights are not in the path mentioned in that line, it throws this error.