用Python编程计算机视觉第7章

用Python编程计算机视觉第7章,python,computer-vision,Python,Computer Vision,我正在关注扬·埃里克·索莱姆写的书 我对第7章有点困惑,关于将图像添加到SQLite数据集中 在“将_添加到_索引”方法中 imwords是一个直方图列表 imwords = self.voc.project(descr) 下面的代码让我很困惑: word = imwords[i] #wordid is the word number itself self.con.execute("insert into imwords(imid,wordid,vocname) values (?,?,?)

我正在关注扬·埃里克·索莱姆写的书

我对第7章有点困惑,关于将图像添加到SQLite数据集中

在“将_添加到_索引”方法中

imwords是一个直方图列表

imwords = self.voc.project(descr)
下面的代码让我很困惑:

word = imwords[i]
#wordid is the word number itself
self.con.execute("insert into imwords(imid,wordid,vocname) values (?,?,?)", (imid,word,self.voc.name)
这让我很困惑,因为imwords[i]只会给出单词在词汇表中的频率,而不会指明是哪个单词

因此,我在想,如果我们想添加一个图像所具有的词语,它是否应该像它一样:

word = imwords[i]
if word > 0:
    self.con.execute("insert into imwords(imid,wordid,vocname) values (?,?,?)", (imid,i,self.voc.name))

注意,在sql语句中,我已将word替换为i。

请与作者联系并询问他。这是他的书,所以他应该知道得最清楚只是快速浏览了一下你的书的在线草稿版本。这似乎真的很奇怪。另外,如果图像的签名由这些词频而不是它们的ID组成,那么它不是更有意义吗?我只是认为评论是错误的,但代码是好的。