Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How you get the this figure in Part3: image retrieval (return top 5 of each method)? #5

Open
redhat12345 opened this issue Jul 31, 2018 · 6 comments
Labels

Comments

@redhat12345
Copy link

Hi,

Can you tell us that how you get this images?

@ClaryK
Copy link

ClaryK commented Aug 16, 2018

I want to know it too...

@pochih
Copy link
Owner

pochih commented Sep 28, 2018

Generally, when it comes to IR ranking with deep learning model, we use the outputs of the second last layer as input image's feature.
Because the outputs of the last layer is for classification and has no matter with our task.

Compare the feature of query image and the feature of each image in the database.
We can sorting all database images according to the similarity.
Similarity can be counted with L2 distance or cosine similarity.

@dgtlmoon
Copy link

@pochih thanks for your work so far - so you're saying that this codebase merely generates a DB of various features/descriptors/etc, and that is does not having anything todo with retrieving content (images) given a query image?

Compare the feature of query image and the feature of each image in the database.
We can sorting all database images according to the similarity.
Similarity can be counted with L2 distance or cosine similarity.

This is actually a really inefficient way of dealing with this problem.

Can you explain exactly why you called this project "A content-based image retrieval (CBIR) system" ? because there is no retrieval going on here? or am I wrong?

@KarthikDutt
Copy link

@dgtlmoon - Its been a year but if you are still interested in this, then this response might be useful.

You can load the file containing the features extracted for each image. The file will be created in the cache directory of your root folder.
This file contains a list of dictionaries, one dictionary per image of your dataset. It is of the form {'img':'xxx', 'cls','123','hist': ''} where img is the name of the image, cls is the class and hist holds the histogram generated for that image.
You can choose one of the element of this list as your query image and then call the function infer which is inside evaluate.py to calculate the similarity distance of the query image and the other images and return the most similar results.

Code mentioned below could be helpful:
from evaluate import infer
samples = cPickle.load(open('D:\Work\CBIR\CBIR-master\cache\histogram_cache-region-n_bin12-n_slice3', "rb", True))
query=samples[13627]
ap,res=infer(query,samples,db=None, sample_db_fn=None, depth=10, d_type='d1')
depth is the number of similar images you want to retrieve and d_type is the type of simialrity metric you want to use.

You might want to modify the function infer inside evaluate to return also the matched image name along with class and distance which it is presently retrieving.

@dgtlmoon
Copy link

dgtlmoon commented Nov 5, 2019

man i wish it was possible to ban/delete comments, like the one above

@Praveenk8051
Copy link

@dgtlmoon You are right , the retrieval is not going on. What's the whole point of retrieving the image by passing the class_name !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants