CBIR icon indicating copy to clipboard operation
CBIR copied to clipboard

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

Open redhat12345 opened this issue 7 years ago • 6 comments

Hi,

Can you tell us that how you get this images?

redhat12345 avatar Jul 31 '18 00:07 redhat12345

I want to know it too...

ClaryK avatar Aug 16 '18 13:08 ClaryK

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.

pochih avatar Sep 28 '18 15:09 pochih

@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?

dgtlmoon avatar Oct 18 '18 18:10 dgtlmoon

@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.

KarthikDutt avatar Nov 02 '19 10:11 KarthikDutt

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

dgtlmoon avatar Nov 05 '19 18:11 dgtlmoon

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

Praveenk8051 avatar Jul 28 '21 15:07 Praveenk8051