def computeMOT(self, i): # create sqlite and cfg file with id i cfg_name = config_files +str(i)+'.cfg' sql_name = sqlite_files +str(i)+'.sqlite' open(cfg_name,'w').close() config = ConfigObj(cfg_name) cfg_list.write_config(i ,config) command = ['cp', 'tracking_only.sqlite', sql_name] process = subprocess.Popen(command) process.wait() command = ['trajextract.py', args.inputVideo, '-o', args.homography, '-t', cfg_name, '-d', sql_name, '--gf'] # suppress output of grouping extraction devnull = open(os.devnull, 'wb') process = subprocess.Popen(command, stdout = devnull) process.wait() obj = trajstorage.CVsqlite(sql_name) print "loading", i obj.loadObjects() motp, mota, mt, mme, fpt, gt = moving.computeClearMOT(cdb.annotations, obj.objects, args.matchDistance, firstFrame, lastFrame) if motp is None: motp = 0 self.lock.acquire() self.IDlist.put(i) self.motplist.put(motp) self.motalist.put(mota) obj.close() if args.PrintMOTA: print("ID: mota:{} motp:{}".format(mota, motp)) self.lock.release() return mota
def computeMOT(self, i): obj = trajstorage.CVsqlite(sqlite_files + str(i) + ".sqlite") obj.loadObjects() motp, mota, mt, mme, fpt, gt = moving.computeClearMOT( cdb.annotations, obj.objects, args.matchDistance, firstFrame, lastFrame) self.lock.acquire() self.IDlist.put(i) self.motalist.put(mota) obj.close() if args.PrintMOTA: print("ID", i, " : ", mota) self.lock.release() return mota
def computeMOT(i, lock, printlock, motalist, IDlist): obj = trajstorage.CVsqlite(sqlite_files + str(i) + ".sqlite") obj.loadObjects() motp, mota, mt, mme, fpt, gt = moving.computeClearMOT( cdb.annotations, obj.objects, args.matchDistance, firstFrame, lastFrame) lock.acquire() IDlist.put(i) motalist.put(mota) obj.close() lock.release() printlock.acquire() if args.PrintMOTA: print("Done ID ----- ", i, "With MOTA:", mota) else: print("Done ID ----- ", i) printlock.release()
help="parameter for ram_monitor", default=50, type=float) parser.add_argument('-bm', '--block-monitor', dest='BlockMonitor', action='store_true', help="Block RamMonitor") args = parser.parse_args() dbfile = args.databaseFile homography = loadtxt(args.homography) sqlite_files = "sql_files/Sqlite_ID_" start = timeit.default_timer() cdb = trajstorage.CVsqlite(dbfile) cdb.open() cdb.getLatestAnnotation() cdb.createBoundingBoxTable(cdb.latestannotations, inv(homography)) cdb.loadAnnotaion() for a in cdb.annotations: a.computeCentroidTrajectory(homography) print("Latest Annotaions in " + dbfile + ": ", cdb.latestannotations) # for row in cdb.boundingbox: # print(row) cdb.frameNumbers = cdb.getFrameList() firstFrame = cdb.frameNumbers[0] lastFrame = cdb.frameNumbers[-1] foundmota = Queue() IDs = Queue()
"List tables in the database and the number of records in each one.") parser.add_argument( '-y', dest='dontConfirm', action='store_true', help= "Skip confirmation before performing an action that will change the database." ) parser.add_argument('--drop', dest='dropTables', nargs='+', help="Drop the given tables from the database.") args = parser.parse_args() # open the database db = trajstorage.CVsqlite(args.databaseFilename) if args.listTables: # get the table info and print it tableInfo = db.getTableInfo() for tn in sorted(tableInfo.keys()): nr = tableInfo[tn] print("{}: {} records".format(tn, nr)) elif len(args.dropTables) > 0: # confirm the change print("Going to delete tables {} from database '{}'".format( args.dropTables, args.databaseFilename)) if args.dontConfirm or cvgui.yesno( "This action cannot be undone. Are you sure you want to do this? [y/N]" ): db.dropTables(args.dropTables)