def preload_commands(dbdir, **kwargs): """ Preload commands work with command line arguments and global caches """ #print('[main_cmd] preload_commands') if params.args.dump_argv: print(utool.dict_str(vars(params.args))) if params.args.dump_global_cache: utool.global_cache_dump() # debug command, dumps to stdout if params.args.workdir is not None: sysres.set_workdir(params.args.workdir) if params.args.logdir is not None: sysres.set_logdir(params.args.logdir) if utool.get_flag('--vwd'): vwd() if utool.get_flag('--vdq'): print('got arg --vdq') vdq(dbdir) if kwargs.get('delete_ibsdir', False): ibsfuncs.delete_ibeis_database(dbdir) if params.args.convert: preload_convert_hsdb(dbdir) if params.args.merge_species is not None: ibsfuncs.merge_species_databases(params.args.merge_species) if params.args.preload_exit: print('[main_cmd] preload exit') sys.exit(1)
def _init_matplotlib(): import matplotlib as mpl import utool backend = mpl.get_backend() if not sys.platform.startswith('win32') and not sys.platform.startswith('darwin') and os.environ.get('DISPLAY', None) is None: # Write to files if we cannot display TARGET_BACKEND = 'PDF' else: TARGET_BACKEND = 'Qt4Agg' if utool.in_main_process(): if not utool.QUIET and utool.VERBOSE: print('--- INIT MPL---') print('[main] current backend is: %r' % backend) print('[main] mpl.use(%r)' % TARGET_BACKEND) if backend != TARGET_BACKEND: mpl.use(TARGET_BACKEND, warn=True, force=True) backend = mpl.get_backend() if not utool.QUIET and utool.VERBOSE: print('[main] current backend is: %r' % backend) if utool.get_flag('--notoolbar'): toolbar = 'None' else: toolbar = 'toolbar2' mpl.rcParams['toolbar'] = toolbar mpl.rc('text', usetex=False) mpl_keypress_shortcuts = [key for key in mpl.rcParams.keys() if key.find('keymap') == 0] for key in mpl_keypress_shortcuts: mpl.rcParams[key] = ''
def __init__(db, sqldb_dpath='.', sqldb_fname='database.sqlite3', text_factory=unicode): """ Creates db and opens connection """ with utool.Timer('New SQLDatabaseController'): #printDBG('[sql.__init__]') # Table info db.table_columns = utool.odict() db.table_constraints = utool.odict() db.table_docstr = utool.odict() # TODO: db.stack = [] db.cache = {} # key \in [tblname][colnames][rowid] # Get SQL file path db.dir_ = sqldb_dpath db.fname = sqldb_fname assert exists(db.dir_), '[sql] db.dir_=%r does not exist!' % db.dir_ fpath = join(db.dir_, db.fname) if not exists(fpath): print('[sql] Initializing new database') # Open the SQL database connection with support for custom types #lite.enable_callback_tracebacks(True) #fpath = ':memory:' db.connection = lite.connect2(fpath) db.connection.text_factory = text_factory #db.connection.isolation_level = None # turns sqlite3 autocommit off COPY_TO_MEMORY = utool.get_flag('--copy-db-to-memory') if COPY_TO_MEMORY: db._copy_to_memory() db.connection.text_factory = text_factory # Get a cursor which will preform sql commands / queries / executions db.cur = db.connection.cursor()
def TIME_GEN_PREPROC_IMG(ibs): from ibeis.model.preproc.preproc_image import add_images_params_gen print('[TIME_GEN_PREPROC_IMG]') gid_list = ibs.get_valid_gids() gpath_list = ibs.get_image_paths(gid_list) # STABILITY if not utool.get_flag('--nostable'): # TEST 1 with utool.Timer('parallel chunksize=1'): output1 = list(add_images_params_gen(gpath_list, chunksize=1)) print(utool.truncate_str(str(output1), 80)) assert len(output1) == len(gpath_list), 'chuncksize changes output' # TEST 2 with utool.Timer('parallel chunksize=2'): output2 = list(add_images_params_gen(gpath_list, chunksize=2)) print(utool.truncate_str(str(output2), 80)) assert output1 == output2, 'chuncksize changes output' # TEST N with utool.Timer('parallel chunksize=None'): outputN = list(add_images_params_gen(gpath_list, chunksize=None)) print(utool.truncate_str(str(output2), 80)) assert outputN == output2, 'chuncksize changes output' # BENCHMARK setup = utool.unindent( ''' from ibeis.model.preproc.preproc_image import add_images_params_gen genkw = dict(prog=False, verbose=True) gpath_list = %r ''' % (gpath_list,)) print(utool.truncate_str(str(gpath_list), 80)) print('Processing %d images' % (len(gpath_list),)) timeit3 = partial(timeit2, setup=setup, number=3) timeit3('list(add_images_params_gen(gpath_list, chunksize=None, **genkw))') timeit3('list(add_images_params_gen(gpath_list, chunksize=None, **genkw))') timeit3('list(add_images_params_gen(gpath_list, chunksize=1, **genkw))') timeit3('list(add_images_params_gen(gpath_list, chunksize=2, **genkw))') timeit3('list(add_images_params_gen(gpath_list, chunksize=4, **genkw))') timeit3('list(add_images_params_gen(gpath_list, chunksize=8, **genkw))') timeit3('list(add_images_params_gen(gpath_list, chunksize=16, **genkw))') timeit3('list(add_images_params_gen(gpath_list, chunksize=32, **genkw))') print('[/TIME_GEN_PREPROC_IMG]') return locals()
from vtool import spatial_verification as sver # Hotspotter from ibeis.model.hots import hots_query_result from ibeis.model.hots import exceptions as hsexcept from ibeis.model.hots import coverage_image from ibeis.model.hots import nn_filters from ibeis.model.hots import voting_rules2 as vr2 import utool from functools import partial #profile = utool.profile print, print_, printDBG, rrr, profile = utool.inject(__name__, '[mf]', DEBUG=False) np.tau = 2 * np.pi # tauday.com NOT_QUIET = utool.NOT_QUIET and not utool.get_flag('--quiet-query') VERBOSE = utool.VERBOSE or utool.get_flag('--verbose-query') #================= # Cython Metadata #================= """ ctypedef np.float32_t float32_t ctypedef np.float64_t float64_t ctypedef np.uint8_t uint8_t ctypedef np.uint8_t desc_t ctypedef ktool.KPTS_T kpts_t ctypedef ktool.DESC_T desc_t cdef int MARK_AFTER cdef double tau
# Python import functools # Qt from PyQt4 import QtGui, QtCore from PyQt4.QtCore import Qt # IBEIS import utool from guitool import slot_, signal_ from ibeis.gui import rowidtables from ibeis.gui.Skeleton import Ui_mainSkel print, print_, printDBG, profile, rrr = utool.inject(__name__, '[front*]', DEBUG=False) QUIET = utool.get_flag('--quiet') VERBOSE = utool.get_flag(('--verbose', '--verbose-front', '--vf')) UID_TYPE = rowidtables.UID_TYPE ENC_TYPE = str # imagesets are ided with imagesettext right now QUTF8 = QtGui.QApplication.UnicodeUTF8 QTRANSLATE = QtGui.QApplication.translate #================= # Decorators / Helpers #================= def rowid_tbl_clicked(func): """ Wrapper around item_clicked slot, which takes only the item.
#!/usr/bin/env python2.7 # TODO: ADD COPYRIGHT TAG from __future__ import absolute_import, division, print_function import utool import ibeis import multiprocessing from ibeis.model.detect import randomforest # IBEIS print, print_, printDBG, rrr, profile = utool.inject(__name__, '[TEST_DETECT]') SPECIAL = utool.get_flag('--special') or utool.inIPython() def TEST_DETECT(ibs): # Create a HotSpotter API (hs) and GUI backend (back) print('get_valid_ANNOTATIONS') gid_list = ibs.get_valid_gids()[0:1] if SPECIAL: gid_list = utool.safe_slice(ibs.get_valid_gids(), 3) #gid_list.extend(ibs.add_images([utool.unixpath('~/Dropbox/Chuck/detect_testimg/testgrevy.jpg')])) species = 'zebra_grevys' detectkw = { 'quick': True, 'save_detection_images': SPECIAL, 'save_scales': SPECIAL, } detect_gen = randomforest.generate_detections(ibs, gid_list, species, **detectkw) gid_list2 = [] bbox_list2 = [] for gid, bboxes, confidences, img_conf in detect_gen: for bbox in bboxes:
#import ibeis from ibeis.control import IBEISControl from ibeis import sysres from ibeis import constants from ibeis.dev import ibsfuncs from itertools import izip import utool import re import csv print, print_, printDBG, rrr, profile = utool.inject( __name__, '[ingest_hsbd]') SUCCESS_FLAG_FNAME = '_hsdb_to_ibeis_convert_success' FORCE_DELETE = utool.get_flag('--force-delete') def is_succesful_convert(dbdir): return exists(join(dbdir, constants.PATH_NAMES._ibsdb, SUCCESS_FLAG_FNAME)) def get_unconverted_hsdbs(workdir=None): import os import numpy as np from vtool import linalg as ltool if workdir is None: workdir = sysres.get_workdir() dbname_list = os.listdir(workdir) dbpath_list = np.array([join(workdir, name) for name in dbname_list]) is_hsdb_list = np.array(map(sysres.is_hsdb, dbpath_list))
from __future__ import absolute_import, division, print_function from itertools import izip import utool from PyQt4 import QtGui, QtCore from PyQt4.QtCore import Qt from PyQt4.QtGui import QAbstractItemView (print, print_, printDBG, rrr, profile) = utool.inject(__name__, '[rowidtables]', DEBUG=False) from ibeis.control import DB_SCHEMA USER_MODE = utool.get_flag('--usermode') # Define which columns are usable in tables: # Specified in (type, header, fancy_header) format COLUMN_DEFS = [ (int, 'gid', 'Image ID'), (int, 'rid', 'ROI ID'), (int, 'nid', 'Name ID'), (int, 'imgsetid', 'ImageSet ID'), (int, 'nRids', '#ROIs'), (int, 'nGt', '#GT'), (int, 'nFeats', '#Features'), (str, 'rank', 'Rank'), # needs to be a string for !Query (float, 'unixtime', 'unixtime'), (str, 'imagesettext', 'ImageSet'), (str, 'gname', 'Image Name'), (str, 'name', 'Name'), (str, 'notes', 'Notes'), (str, 'match_name', 'Matching Name'),
from __future__ import absolute_import, division, print_function # Python import functools # Qt from PyQt4 import QtGui, QtCore from PyQt4.QtCore import Qt # IBEIS import utool from guitool import slot_, signal_ from ibeis.gui import rowidtables from ibeis.gui.Skeleton import Ui_mainSkel print, print_, printDBG, profile, rrr = utool.inject( __name__, '[front*]', DEBUG=False) QUIET = utool.get_flag('--quiet') VERBOSE = utool.get_flag(('--verbose', '--verbose-front', '--vf')) UID_TYPE = rowidtables.UID_TYPE ENC_TYPE = str # encounters are ided with enctext right now QUTF8 = QtGui.QApplication.UnicodeUTF8 QTRANSLATE = QtGui.QApplication.translate #================= # Decorators / Helpers #================= def rowid_tbl_clicked(func): """
from __future__ import absolute_import, division, print_function import utool (print, print_, printDBG, rrr, profile) = utool.inject( __name__, '[qreq]', DEBUG=False) # Standard from itertools import izip # Scientific import utool __REQUEST_BASE__ = utool.DynStruct if utool.get_flag('--debug') else object class QueryRequest(__REQUEST_BASE__): # This will allow for a pipelining structure of requests and results def __init__(qreq, qresdir, bigcachedir): super(QueryRequest, qreq).__init__() qreq.cfg = None # Query config pointer qreq.qaids = [] qreq.daids = [] qreq.data_index = None # current index qreq.dftup2_index = {} # cached indexes qreq.vsmany = False qreq.vsone = False qreq.qresdir = qresdir # Where to cache individual results qreq.bigcachedir = bigcachedir # Where to cache large results #def __del__(qreq): # for key in qreq.dftup2_index.keys(): # del qreq.dftup2_index[key] # qreq.data_index = None
#class ColumnsCache(object): # def __init__(self): # self._cache = {} # def __setitem__(self, index, value): # self._cache[index] = value # def __getitem__(self, index): # return self._cache[index] # def __delitem__(self, index): # del self._cache[index] API_CACHE = utool.get_flag('--api-cache') if utool.in_main_process(): if API_CACHE: print('[accessor_decors] API_CACHE IS ENABLED') else: print('[accessor_decors] API_CACHE IS DISABLED') def init_tablecache(): #return utool.ddict(ColumnsCache) return utool.ddict(lambda: utool.ddict(dict)) def _delete_items(dict_, key_list): invalid_keys = iter(set(key_list) - set(dict_.rows())) for key in invalid_keys:
from vtool import linalg as ltool from vtool import spatial_verification as sver # Hotspotter from ibeis.model.hots import hots_query_result from ibeis.model.hots import exceptions as hsexcept from ibeis.model.hots import coverage_image from ibeis.model.hots import nn_filters from ibeis.model.hots import voting_rules2 as vr2 import utool from functools import partial #profile = utool.profile print, print_, printDBG, rrr, profile = utool.inject(__name__, '[mf]', DEBUG=False) np.tau = 2 * np.pi # tauday.com NOT_QUIET = utool.NOT_QUIET and not utool.get_flag('--quiet-query') VERBOSE = utool.VERBOSE or utool.get_flag('--verbose-query') #================= # Cython Metadata #================= """ ctypedef np.float32_t float32_t ctypedef np.float64_t float64_t ctypedef np.uint8_t uint8_t ctypedef np.uint8_t desc_t ctypedef ktool.KPTS_T kpts_t ctypedef ktool.DESC_T desc_t cdef int MARK_AFTER
from os.path import join, exists import utool # Tools from ibeis.control._sql_helpers import (_unpacker, sanatize_sql, SQLExecutionContext) from ibeis.control import __SQLITE3__ as lite (print, print_, printDBG, rrr, profile) = utool.inject(__name__, '[sql]') def default_decorator(func): return func #return profile(func) #return utool.indent_func('[sql.' + func.func_name + ']')(func) VERBOSE = utool.VERBOSE QUIET = utool.QUIET or utool.get_flag('--quiet-sql') AUTODUMP = utool.get_flag('--auto-dump') """ If would be really great if we could get a certain set of setters, getters, and deleters to be indexed into only with rowids. If we could do this than for that subset of data, we could hook up a least recently used cache which is populated whenever you get data from some table/colname using the rowid as the key. The cache would then only have to be invalidated if we were going to set / get data from that same rowid. This would offer big speadups for both the recognition algorithm and the GUI. """ from functools import wraps def common_decor(func): @wraps(func)
def TIME_GEN_PREPROC_FEAT(ibs): print('[TIME_GEN_PREPROC_FEAT]') from ibeis.model.preproc.preproc_feat import generate_feats from itertools import izip import numpy as np def _listeq(x1, x2): if isinstance(x1, np.ndarray): return np.all(x2 == x2) return x1 == x2 aid_list = ibs.get_valid_aids() cid_list = ibs.get_annot_cids(aid_list) cfpath_list = ibs.get_chip_paths(cid_list) # STABILITY if not utool.get_flag('--nostable'): # TEST 1 with utool.Timer('parallel chunksize=1'): output1 = list(generate_feats(cfpath_list, chunksize=1)) print(utool.truncate_str(str(output1), 80)) # TEST 2 with utool.Timer('parallel chunksize=2'): output2 = list(generate_feats(cfpath_list, chunksize=2)) print(utool.truncate_str(str(output2), 80)) assert all([_listeq(*xtup) for tup in izip(output1, output2) for xtup in izip(*tup)]), 'chuncksize changes output' # TEST N with utool.Timer('parallel chunksize=None'): outputN = list(generate_feats(cfpath_list, chunksize=None)) print(utool.truncate_str(str(output2), 80)) assert all([_listeq(*xtup) for tup in izip(outputN, output2) for xtup in izip(*tup)]), 'chuncksize changes output' # BENCHMARK setup = utool.unindent( ''' from ibeis.model.preproc.preproc_feat import generate_feats genkw = dict(prog=False, verbose=True) cfpath_list = %r ''' % (cfpath_list,)) print(utool.truncate_str(str(cid_list), 80)) print('Processing %d chips' % (len(cid_list),)) timeit3 = partial(timeit2, setup=setup, number=1) timeit3('list(generate_feats(cfpath_list, chunksize=None, **genkw))') timeit3('list(generate_feats(cfpath_list, chunksize=None, **genkw))') timeit3('list(generate_feats(cfpath_list, chunksize=1, **genkw))') timeit3('list(generate_feats(cfpath_list, chunksize=2, **genkw))') timeit3('list(generate_feats(cfpath_list, chunksize=4, **genkw))') timeit3('list(generate_feats(cfpath_list, chunksize=8, **genkw))') timeit3('list(generate_feats(cfpath_list, chunksize=16, **genkw))') timeit3('list(generate_feats(cfpath_list, chunksize=32, **genkw))') timeit3('list(generate_feats(cfpath_list, chunksize=64, **genkw))') #list(generate_feats(cfpath_list, chunksize=None, **genkw)) #[parallel] initializing pool with 7 processes #[parallel] executing 1049 gen_feat_worker tasks using 7 processes with chunksize=21 # * timed: 125.17100650510471 seconds #---------- #list(generate_feats(cfpath_list, chunksize=None, **genkw)) #[parallel] executing 1049 gen_feat_worker tasks using 7 processes with chunksize=21 # * timed: 97.37531812573734 seconds #---------- #list(generate_feats(cfpath_list, chunksize=1, **genkw)) #[parallel] executing 1049 gen_feat_worker tasks using 7 processes with chunksize=1 # * timed: 89.11060989484363 seconds #---------- #list(generate_feats(cfpath_list, chunksize=2, **genkw)) #[parallel] executing 1049 gen_feat_worker tasks using 7 processes with chunksize=2 # * timed: 89.3294122591355 seconds #---------- #list(generate_feats(cfpath_list, chunksize=4, **genkw)) #[parallel] executing 1049 gen_feat_worker tasks using 7 processes with chunksize=4 # * timed: 114.7752637914524 seconds #---------- #list(generate_feats(cfpath_list, chunksize=8, **genkw)) #[parallel] executing 1049 gen_feat_worker tasks using 7 processes with chunksize=8 # * timed: 123.35112345890252 seconds #---------- #list(generate_feats(cfpath_list, chunksize=16, **genkw)) #[parallel] executing 1049 gen_feat_worker tasks using 7 processes with chunksize=16 # * timed: 124.47361485097099 seconds #---------- #list(generate_feats(cfpath_list, chunksize=32, **genkw)) #[parallel] executing 1049 gen_feat_worker tasks using 7 processes with chunksize=32 # * timed: 126.47238857719219 seconds #---------- #list(generate_feats(cfpath_list, chunksize=64, **genkw)) #[parallel] executing 1049 gen_feat_worker tasks using 7 processes with chunksize=64 # * timed: 137.3404114996564 seconds print('[/TIME_GEN_PREPROC_FEAT]') return locals()
'https://github.com/Erotemic/plottool.git', 'https://github.com/Erotemic/vtool.git', 'https://github.com/bluemellophone/detecttools.git', 'https://github.com/Erotemic/hesaff.git', 'https://github.com/bluemellophone/pyrf.git', 'https://github.com/hjweide/pygist', 'https://github.com/Erotemic/ibeis.git', ], CODE_DIR, forcessh=False) PROJECT_REPO_URLS = IBEIS_REPO_URLS + TPL_REPO_URLS PROJECT_REPO_DIRS = IBEIS_REPO_DIRS + TPL_REPO_DIRS utool.set_project_repos(PROJECT_REPO_URLS, PROJECT_REPO_DIRS) if utool.get_flag('--status'): utool.gg_command('git status') utool.sys.exit(0) else: utool.gg_command('ensure') if utool.get_flag('--pull'): utool.gg_command('git pull') if utool.get_flag('--build'): # Build tpl repos for repo in TPL_REPO_DIRS: utool.util_git.std_build_command(repo) # Executes {plat}_build.{ext} # Build only IBEIS repos with setup.py utool.set_project_repos(IBEIS_REPO_URLS, IBEIS_REPO_DIRS)
from __future__ import absolute_import, division, print_function import utool import plottool.draw_sv as draw_sv (print, print_, printDBG, rrr, profile) = utool.inject(__name__, '[viz_misc]', DEBUG=False) WRITE_SV_DEBUG = utool.get_flag('--write-sv-debug') def _get_sv_vartup_for_plottool(ibs, aid1, aid2, chipmatch_FILT, aid2_svtup): """ Compiles IBEIS information into info suitable for plottool """ chip1, chip2 = ibs.get_annot_chips([aid1, aid2]) kpts1, kpts2 = ibs.get_annot_kpts([aid1, aid2]) aid2_fm, aid2_fs, aid2_fk = chipmatch_FILT fm = aid2_fm[aid2] (homog_inliers, H, aff_inliers, Aff) = aid2_svtup[aid2] homog_tup = (homog_inliers, H) aff_tup = (aff_inliers, Aff) sv_vartup = chip1, chip2, kpts1, kpts2, fm, homog_tup, aff_tup return sv_vartup def _compute_svvars(ibs, aid1): """ If spatial-verfication dbginfo is not in we need to compute it """ from ibeis.model.hots import query_helpers qaids = [aid1] qcomp = query_helpers.get_query_components(ibs, qaids) qaid2_chipmatch_FILT = qcomp['qaid2_chipmatch_FILT'] qaid2_svtups = qcomp['qaid2_svtups'] chipmatch_FILT = qaid2_chipmatch_FILT[aid1] aid2_svtup = qaid2_svtups[aid1]
def _init_components(ibswgt): """ Defines gui components """ # Layout ibswgt.vlayout = QtGui.QVBoxLayout(ibswgt) ibswgt.hsplitter = guitool.newSplitter(ibswgt, Qt.Horizontal, verticalStretch=18) ibswgt.vsplitter = guitool.newSplitter(ibswgt, Qt.Vertical) #ibswgt.hsplitter = guitool.newWidget(ibswgt, Qt.Horizontal, verticalStretch=18) #ibswgt.vsplitter = guitool.newWidget(ibswgt) # # Tables Tab ibswgt._tab_table_wgt = APITabWidget(ibswgt, horizontalStretch=81) #guitool.newTabWidget(ibswgt, horizontalStretch=81) for tblname, WidgetClass, ModelClass, ViewClass in ibswgt.modelview_defs: #widget = WidgetClass(parent=ibswgt) #ibswgt.widgets[tblname] = widget #ibswgt.models[tblname] = widget.model #ibswgt.views[tblname] = widget.view ibswgt.views[tblname] = ViewClass(parent=ibswgt) # Make view first to pass as parent # FIXME: It is very bad to give the model a view. Only the view should have a model ibswgt.models[tblname] = ModelClass(parent=ibswgt.views[tblname]) # Connect models and views for tblname in ibswgt.super_tblname_list: ibswgt.views[tblname].setModel(ibswgt.models[tblname]) # Add Image, ANNOTATION, and Names as tabs for tblname in ibswgt.tblname_list: #ibswgt._tab_table_wgt.addTab(ibswgt.widgets[tblname], tblname) ibswgt._tab_table_wgt.addTab(ibswgt.views[tblname], tblname) # Custom Encounter Tab Wiget ibswgt.enc_tabwgt = EncoutnerTabWidget(parent=ibswgt, horizontalStretch=19) # Other components ibswgt.outputLog = guitool.newOutputLog(ibswgt, pointSize=8, visible=utool.get_flag('--guilog'), verticalStretch=6) ibswgt.progressBar = guitool.newProgressBar(ibswgt, visible=False, verticalStretch=1) # New widget has black magic (for implicit layouts) in it ibswgt.status_wgt = guitool.newWidget(ibswgt, Qt.Vertical, verticalStretch=6, horizontalSizePolicy=QSizePolicy.Maximum) ibswgt.statusBar = QtGui.QHBoxLayout(ibswgt) _NEWLBL = functools.partial(guitool.newLabel, ibswgt) ibswgt.statusLabel_list = [ _NEWLBL(''), _NEWLBL('Status Bar'), _NEWLBL(''), _NEWLBL(''), ] ibswgt.buttonBars = [] _NEWBUT = functools.partial(guitool.newButton, ibswgt) _COMBO = functools.partial(guitool.newComboBox, ibswgt) back = ibswgt.back #_SEP = lambda: None ibswgt.query_button = _NEWBUT('Run Identification', ibswgt.back.compute_queries, bgcolor=(150, 150, 255), fgcolor=(0, 0, 0)) detection_combo_box_options = [ # Text # Value ('Select Species', 'none'), ] + zip(constants.SPECIES_NICE, constants.VALID_SPECIES) ibswgt.species_combo = _COMBO(detection_combo_box_options, ibswgt.back.change_detection_species) ibswgt.species_button = _NEWBUT('Update Encounter Species', ibswgt.back.encounter_set_species, bgcolor=(150, 255, 150)) ibswgt.reviewed_button = _NEWBUT('Set Encounter as Reviewed', ibswgt.back.encounter_reviewed_all_images, bgcolor=(0, 232, 211)) ibswgt.import_button = _NEWBUT('Step 1) Import Images\n(via files)', back.import_images_from_file, bgcolor=(235, 200, 200),) ibswgt.encounter_button = _NEWBUT('Step 2) Group Images into Encounters', ibswgt.back.compute_encounters, bgcolor=(255, 255, 150)) ibswgt.detect_button = _NEWBUT('Step 3) Detect', ibswgt.back.run_detection_coarse, bgcolor=(150, 255, 150)) detection_combo_box_options = [ # Text # Value ('Step 4) Intra Encounter', constants.INTRA_ENC_KEY), ('Step 5) Vs Exemplars', constants.VS_EXEMPLARS_KEY), ] ibswgt.querydb_combo = _COMBO(detection_combo_box_options, ibswgt.back.change_query_mode) ibswgt.button_list = [ [ ibswgt.import_button, #_NEWBUT('Import Images\n(via dir)', # back.import_images_from_dir, # bgcolor=(235, 200, 200)), #_NEWBUT('Import Images\n(via dir + size filter)', # bgcolor=(235, 200, 200)), #_NEWBUT('Filter Images (GIST)'), ibswgt.encounter_button, ibswgt.species_combo, ibswgt.detect_button, ], [ #_NEWBUT('Review Detections', # ibswgt.back.review_detections, # bgcolor=(170, 250, 170)), ibswgt.species_button, ibswgt.reviewed_button, ibswgt.querydb_combo, ibswgt.query_button, #_NEWBUT('Identify\n(vs exemplar database)', # ibswgt.back.compute_queries_vs_exemplar, # bgcolor=(150, 150, 255), # fgcolor=(0, 0, 0)), #_NEWBUT('Review Recognitions', # ibswgt.back.review_queries, # bgcolor=(170, 170, 250), # fgcolor=(0, 0, 0)), # _SEP(), #_NEWBUT('Delete Encounters', ibswgt.back.delete_all_encounters, # bgcolor=(255, 0, 0), # fgcolor=(0, 0, 0)), ] ]
import utool # IBEIS from ibeis.model.hots import match_chips3 as mc3 from ibeis.model.hots import matching_functions as mf from ibeis.dev import params from ibeis.dev import experiment_helpers as eh from ibeis.dev import experiment_printres print, print_, printDBG, rrr, profile = utool.inject( __name__, '[expt_harn]', DEBUG=False) BATCH_MODE = '--nobatch' not in sys.argv NOMEMORY = '--nomemory' in sys.argv QUIET = '--quiet' in sys.argv TESTRES_VERBOSITY = 2 - (2 * QUIET) NOCACHE_TESTRES = utool.get_flag('--nocache-testres', False) TEST_INFO = True STRICT = utool.STRICT def _get_qx2_besrank_batch(ibs, qreq): print('[harn] querying in batch mode') # Query Chip / Row Loop qaid2_qres = mc3.process_query_request(ibs, qreq, safe=False) qx2_bestranks = [[qaid2_qres[qaid].get_best_gt_rank(ibs)] for qaid in qreq.qaids] return qx2_bestranks def _get_qx2_besrank_iterative(ibs, qreq, nTotalQueries, nPrevQueries, cfglbl=''): # TODO: INCORPORATE MINIBATCH SIZE TO MATCH_CHIPS3 AND DEPRICATE THIS print('[harn] querying one query at a time')
from __future__ import absolute_import, division, print_function from itertools import izip import utool from PyQt4 import QtGui, QtCore from PyQt4.QtCore import Qt from PyQt4.QtGui import QAbstractItemView (print, print_, printDBG, rrr, profile) = utool.inject(__name__, '[rowidtables]', DEBUG=False) from ibeis.control import DB_SCHEMA USER_MODE = utool.get_flag('--usermode') # Define which columns are usable in tables: # Specified in (type, header, fancy_header) format COLUMN_DEFS = [ (int, 'gid', 'Image ID'), (int, 'rid', 'ROI ID'), (int, 'nid', 'Name ID'), (int, 'imgsetid', 'ImageSet ID'), (int, 'nRids', '#ROIs'), (int, 'nGt', '#GT'), (int, 'nFeats', '#Features'), (str, 'rank', 'Rank'), # needs to be a string for !Query (float, 'unixtime', 'unixtime'), (str, 'imagesettext', 'ImageSet'), (str, 'gname', 'Image Name'), (str, 'name', 'Name'), (str, 'notes', 'Notes'), (str, 'match_name', 'Matching Name'), (str, 'bbox', 'BBOX (x, y, w, h)'), # Non editables are safe as strs (str, 'score', 'Confidence'),