Can someone explain to me where this error came from? And what does it mean? and how can i fix it? Maybe my question is so general! sorry, but I donβt know what I should add here !: P
Error:
Traceback (most recent call last): File "C:\test\7.4.3.bench.py", line 9, in <module> print imagesearch.compute_ukbench_score(src,imlist[:100]) File "C:\test\imagesearch.py", line 168, in compute_ukbench_score pos[i] = [w[1]-1 for w in src.query(imlist[i])[:4]] File "C:\test\imagesearch.py", line 128, in query h = self.get_imhistogram(imname) File "C:\test\imagesearch.py", line 91, in get_imhistogram "select rowid from imlist where filename='%s'" % imname).fetchone() ValueError: cannot copy sequence with size 2 to array axis with dimension 4
Here is imagesearch.py:
from numpy import * import pickle from pysqlite2 import dbapi2 as sqlite class Indexer(object): def __init__(self,db,voc): """ Initialize with the name of the database and a vocabulary object. """ self.con = sqlite.connect(db) self.voc = voc def __del__(self): self.con.close() def db_commit(self): self.con.commit() def get_id(self,imname): """ Get an entry id and add if not present. """ cur = self.con.execute( "select rowid from imlist where filename='%s'" % imname) res=cur.fetchone() if res==None: cur = self.con.execute( "insert into imlist(filename) values ('%s')" % imname) return cur.lastrowid else: return res[0] def is_indexed(self,imname): """ Returns True if imname has been indexed. """ im = self.con.execute("select rowid from imlist where filename='%s'" % imname).fetchone() return im != None 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
Aress source share