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

About wordid in image search module #12

Open
yang2640 opened this issue Nov 25, 2013 · 0 comments
Open

About wordid in image search module #12

yang2640 opened this issue Nov 25, 2013 · 0 comments

Comments

@yang2640
Copy link

def add_to_index(self,imname,descr):
""" Take an image with feature descriptors,
project on vocabulary and add to database. """
if self.is_indexed(imname): return print ’indexing’, imname

get the imid

imid = self.get_id(imname)

get the words

imwords = self.voc.project(descr)
nbr_words = imwords.shape[0]

link each word to image

for i in range(nbr_words):
word = imwords[i]

wordid is the word number itself self.con.execute("insert into imwords(imid,wordid,vocname)

      values (?,?,?)", (imid,word,self.voc.name))

store word histogram for image

use pickle to encode NumPy arrays as strings self.con.execute("insert into imhistograms(imid,histogram,vocname)

values (?,?,?)", (imid,pickle.dumps(imwords),self.voc.name))

For the following code:

wordid is the word number itself

self.con.execute("insert into imwords(imid,wordid,vocname)")

In the imwords table, we want to see for a given visual word, which of the images are related to the visual word, so we should insert the (imid,word index) if its word number is non-zero, why do we insert the word number itself? the word number can be the index for one word??

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

No branches or pull requests

1 participant