ibeis package

Subpackages

Submodules

ibeis.__main__ module

Runs IBIES gui

ibeis.__main__.dependencies_for_myprogram()[source]

Let pyintaller find these modules

References

http://stackoverflow.com/questions/18596410/importerror-no-module-named-mpl-toolkits-with-maptlotlib-1-3-0-and-py2exe

ibeis.__main__.run_ibeis()[source]

CommandLine:

python -m ibeis
python -m ibeis --tf find_installed_tomcat
python -m ibeis --tf get_annot_groundtruth:1

ibeis._devcmds_ibeis module

ibeis._devcmds_ibeis.export(ibs, aid_pairs=None)[source]

3 - 4 different animals 2 views of each matching keypoint coordinates on each annotation

ibeis._devcmds_ibeis.test_openworkdirs()[source]
problems:
PZ_DanExt_All PZ_DanExt_Test GZ_March2012 Wildebeest_ONLY_MATCHES

python dev.py –convert –dbdir /raid/work/PZ_Marianne –force-delete python dev.py –convert –dbdir /raid/work/SL_Siva –force-delete python dev.py –convert –dbdir /raid/work/PZ_SweatwaterSmall –force-delete

ibeis._devscript module

ibeis._devscript.devcmd(*args)[source]

Decorator which registers a function as a developer command

ibeis._devscript.devprecmd(*args)[source]

Decorator which registers a function as a developer precommand

ibeis._devscript.hack_argv(arg)[source]

ibeis.all_imports module

TODO DEPRICATE

This file contains most every module I’ve ever used. Serves as a good check to make sure either everything I want to use is imported / exists.

ibeis.all_imports.class_reload()[source]
ibeis.all_imports.embed(back)[source]

Allows for embedding in an environment with all imports

ibeis.all_imports.find_unregisterd()[source]
ibeis.all_imports.reload_all()[source]

ibeis.annotmatch_funcs module

ibeis.annotmatch_funcs.get_annot_has_reviewed_matching_aids(ibs, aid_list, eager=True, nInput=None)[source]
ibeis.annotmatch_funcs.get_annot_num_reviewed_matching_aids(ibs, aid1_list, eager=True, nInput=None)[source]
Parameters:
  • aid_list (int) – list of annotation ids
  • eager (bool) –
  • nInput (None) –
Returns:

num_annot_reviewed_list

Return type:

list

CommandLine:

python -m ibeis.annotmatch_funcs --test-get_annot_num_reviewed_matching_aids

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.annotmatch_funcs import *  # NOQA
>>> import ibeis
>>> # build test data
>>> ibs = ibeis.opendb('testdb2')
>>> aid1_list = ibs.get_valid_aids()
>>> eager = True
>>> nInput = None
>>> # execute function
>>> num_annot_reviewed_list = get_annot_num_reviewed_matching_aids(ibs, aid_list, eager, nInput)
>>> # verify results
>>> result = str(num_annot_reviewed_list)
>>> print(result)
ibeis.annotmatch_funcs.get_annot_pair_is_reviewed(ibs, aid1_list, aid2_list)[source]
Parameters:
  • aid1_list (list) –
  • aid2_list (list) –
Returns:

annotmatch_reviewed_list

Return type:

list

CommandLine:

python -m ibeis.annotmatch_funcs --test-get_annot_pair_is_reviewed

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.annotmatch_funcs import *  # NOQA
>>> import ibeis
>>> # build test data
>>> ibs = ibeis.opendb('testdb2')
>>> aid_list = ibs.get_valid_aids()
>>> pairs = list(ut.product(aid_list, aid_list))
>>> aid1_list = ut.get_list_column(pairs, 0)
>>> aid2_list = ut.get_list_column(pairs, 1)
>>> # execute function
>>> annotmatch_reviewed_list = get_annot_pair_is_reviewed(ibs, aid1_list, aid2_list)
>>> # verify results
>>> reviewed_pairs = ut.compress(pairs, annotmatch_reviewed_list)
>>> result = len(reviewed_pairs)
>>> print(result)
104
ibeis.annotmatch_funcs.get_annot_pair_timdelta(ibs, aid_list1, aid_list2)[source]
Parameters:
  • ibs (IBEISController) – ibeis controller object
  • aid_list1 (int) – list of annotation ids
  • aid_list2 (int) – list of annotation ids
Returns:

timedelta_list

Return type:

list

CommandLine:

python -m ibeis.annotmatch_funcs --test-get_annot_pair_timdelta

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.annotmatch_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb('PZ_MTEST')
>>> aid_list = ibs.get_valid_aids(hasgt=True)
>>> unixtimes = ibs.get_annot_image_unixtimes(aid_list)
>>> aid_list = ut.compress(aid_list, np.array(unixtimes) != -1)
>>> gt_aids_list = ibs.get_annot_groundtruth(aid_list, daid_list=aid_list)
>>> aid_list1 = [aid for aid, gt_aids in zip(aid_list, gt_aids_list) if len(gt_aids) > 0][0:5]
>>> aid_list2 = [gt_aids[0] for gt_aids in gt_aids_list if len(gt_aids) > 0][0:5]
>>> timedelta_list = ibs.get_annot_pair_timdelta(aid_list1, aid_list2)
>>> result = ut.numpy_str(timedelta_list, precision=2)
>>> print(result)
np.array([  7.57e+07,   7.57e+07,   2.41e+06,   1.98e+08,   9.69e+07], dtype=np.float64)
ibeis.annotmatch_funcs.get_annot_pair_truth(ibs, aid1_list, aid2_list)[source]

CAREFUL: uses annot match table for truth, so only works if reviews have happend

ibeis.annotmatch_funcs.get_annot_reviewed_matching_aids(ibs, aid_list, eager=True, nInput=None)[source]

Returns a list of the aids that were reviewed as candidate matches to the input aid

aid_list = ibs.get_valid_aids()

ibeis.annotmatch_funcs.get_annotmatch_rowids_from_aid(ibs, aid_list, eager=True, nInput=None, force_method=None)[source]

Undirected version

TODO autogenerate

Returns a list of the aids that were reviewed as candidate matches to the input aid

aid_list = ibs.get_valid_aids()

CommandLine:

python -m ibeis.annotmatch_funcs --exec-get_annotmatch_rowids_from_aid
python -m ibeis.annotmatch_funcs --exec-get_annotmatch_rowids_from_aid:1 --show

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.annotmatch_funcs import *  # NOQA
>>> import ibeis
>>> # setup_pzmtest_subgraph()
>>> ibs = ibeis.opendb(defaultdb='PZ_MTEST')
>>> aid_list = ibs.get_valid_aids()[0:4]
>>> eager = True
>>> nInput = None
>>> annotmatch_rowid_list = get_annotmatch_rowids_from_aid(ibs, aid_list,
>>>                                                        eager, nInput)
>>> result = ('annotmatch_rowid_list = %s' % (str(annotmatch_rowid_list),))
>>> print(result)
Example2:
>>> # TIME TEST
>>> # setup_pzmtest_subgraph()
>>> from ibeis.annotmatch_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='PZ_Master1')
>>> aid_list = ibs.get_valid_aids()
>>> from functools import partial
>>> func_list = [
>>>     partial(ibs.get_annotmatch_rowids_from_aid),
>>>     partial(ibs.get_annotmatch_rowids_from_aid, force_method=1),
>>>     partial(ibs.get_annotmatch_rowids_from_aid, force_method=2),
>>> ]
>>> num_list = [1, 10, 50, 100, 300, 325, 350, 400, 500]
>>> def args_list(count, aid_list=aid_list, num_list=num_list):
>>>    return (aid_list[0:num_list[count]],)
>>> searchkw = dict(
>>>     func_labels=['combo', 'sql', 'numpy'],
>>>     count_to_xtick=lambda count, args: len(args[0]),
>>>     title='Timings of get_annotmatch_rowids_from_aid',
>>> )
>>> niters = len(num_list)
>>> time_result = ut.gridsearch_timer(func_list, args_list, niters, **searchkw)
>>> time_result['plot_timings']()
>>> ut.show_if_requested()
ibeis.annotmatch_funcs.get_annotmatch_rowids_from_aid1(ibs, aid1_list, eager=True, nInput=None)[source]

TODO autogenerate

Returns a list of the aids that were reviewed as candidate matches to the input aid

aid_list = ibs.get_valid_aids() :param ibs: ibeis controller object :type ibs: IBEISController :param aid1_list: :type aid1_list: list :param eager: (default = True) :type eager: bool :param nInput: (default = None)

Returns:annotmatch_rowid_list
Return type:list
ibeis.annotmatch_funcs.get_annotmatch_rowids_from_aid2(ibs, aid2_list, eager=True, nInput=None, force_method=None)[source]

# This one is slow because aid2 is the second part of the index

TODO autogenerate

Returns a list of the aids that were reviewed as candidate matches to the input aid

aid_list = ibs.get_valid_aids()

CommandLine:

python -m ibeis.annotmatch_funcs --exec-get_annotmatch_rowids_from_aid2 --show
Example2:
>>> # TIME TEST
>>> # setup_pzmtest_subgraph()
>>> from ibeis.annotmatch_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='PZ_Master1')
>>> aid2_list = ibs.get_valid_aids()
>>> func_list = [
>>>     partial(ibs.get_annotmatch_rowids_from_aid2, force_method=1),
>>>     partial(ibs.get_annotmatch_rowids_from_aid2, force_method=2),
>>> ]
>>> num_list = [1, 10, 50, 100, 300, 325, 350, 400, 500]
>>> def args_list(count, aid2_list=aid2_list, num_list=num_list):
>>>    return (aid2_list[0:num_list[count]],)
>>> searchkw = dict(
>>>     func_labels=['sql', 'numpy'],
>>>     count_to_xtick=lambda count, args: len(args[0]),
>>>     title='Timings of get_annotmatch_rowids_from_aid2',
>>> )
>>> niters = len(num_list)
>>> time_result = ut.gridsearch_timer(func_list, args_list, niters, **searchkw)
>>> time_result['plot_timings']()
>>> ut.show_if_requested()
ibeis.annotmatch_funcs.get_annotmatch_subgraph(ibs)[source]

http://bokeh.pydata.org/en/latest/ https://github.com/jsexauer/networkx_viewer

TODO: Need a special visualization
In the web I need:

This should share functionality with a name view.

Parameters:ibs (IBEISController) – ibeis controller object

CommandLine:

python -m ibeis.annotmatch_funcs --exec-get_annotmatch_subgraph --show

# Networkx example
python -m ibeis.viz.viz_graph --test-show_chipmatch_graph:0 --show

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.annotmatch_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='PZ_MTEST')
>>> result = get_annotmatch_subgraph(ibs)
>>> ut.show_if_requested()
ibeis.annotmatch_funcs.review_subgraph(ibs, nid_list)[source]

CommandLine:

python -m ibeis.annotmatch_funcs --exec-review_subgraph --show

Example

>>> # SCRIPT
>>> from ibeis.annotmatch_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='PZ_MTEST')
>>> nid_list = ibs.get_valid_nids()[0:5]
>>> result = review_subgraph(ibs, nid_list)
>>> ut.show_if_requested()
ibeis.annotmatch_funcs.review_tagged_joins()[source]

CommandLine:

python -m ibeis.annotmatch_funcs --exec-review_tagged_joins --show --db PZ_Master1
python -m ibeis.annotmatch_funcs --exec-review_tagged_joins --show --db testdb1

Example

>>> from ibeis.gui.guiback import *  # NOQA
>>> import numpy as np
>>> import vtool as vt
>>> #back = testdata_guiback(defaultdb='PZ_Master1', activate=False)
>>> #ibs = back.ibs
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='PZ_Master1')
>>> # Find aids that still need Joins
>>> aid_pair_list = ibs.filter_aidpairs_by_tags(has_any='JoinCase')
>>> if ibs.get_dbname() == 'testdb1':
>>>     aid_pair_list = [[1, 2]]
>>> truth_list_ = ibs.get_aidpair_truths(*zip(*aid_pair_list))
>>> truth_list = truth_list_ != 1
>>> _aid_list = ut.compress(aid_pair_list, truth_list)
>>> _nids_list = np.array(ibs.unflat_map(ibs.get_annot_name_rowids, _aid_list))
>>> edge_ids = vt.get_undirected_edge_ids(_nids_list)
>>> edge_ids = np.array(edge_ids)
>>> unique_edgeids, groupxs = vt.group_indices(edge_ids)
>>> problem_aids_list = vt.apply_grouping(np.array(_aid_list), groupxs)
>>> problem_nids_list = vt.apply_grouping(np.array(_nids_list), groupxs)
>>> join_nids = [np.unique(nids.ravel()) for nids in problem_nids_list]
>>> join_aids_list = ibs.unflat_map(ibs.get_name_aids, join_nids)
>>> assert len(join_aids_list) > 0, 'JOIN cases are finished'
>>> problem_aid_pairs = problem_aids_list[0]
>>> aid_list = join_aids_list[0]
>>> #
>>> print('Run JOINS for taged problem cases %r' % (problem_aid_pairs))
>>> #back.run_annot_splits(aid_list)
>>> print('Review splits for tagd problem cases %r' % (problem_aid_pairs))
>>> from ibeis.viz import viz_graph
>>> nids = join_nids[0]
>>> selected_aids = np.unique(problem_aid_pairs.ravel()).tolist()
>>> ut.flatten(ibs.get_name_aids(nids))
>>> aids = ibs.sample_annots_general(ut.flatten(ibs.get_name_aids(nids)), sample_per_name=4, verbose=True)
>>> import itertools
>>> aids = ut.unique(aids + selected_aids)
>>> self = viz_graph.make_name_graph_interaction(ibs, aids=aids, selected_aids=selected_aids, with_all=False, invis_edges=list(itertools.combinations(selected_aids, 2)))
>>> #self = viz_graph.make_name_graph_interaction(ibs, nids, selected_aids=selected_aids)
>>> ut.show_if_requested()

rowids = ibs.get_annotmatch_rowid_from_superkey(problem_aids.T[0], problem_aids.T[1]) ibs.get_annotmatch_prop(‘SplitCase’, rowids) #ibs.set_annotmatch_prop(‘SplitCase’, rowids, [False])

ibeis.annotmatch_funcs.review_tagged_splits()[source]

CommandLine:

python -m ibeis.annotmatch_funcs --exec-review_tagged_splits --show
python -m ibeis.annotmatch_funcs --exec-review_tagged_splits --show --db

Example

>>> from ibeis.gui.guiback import *  # NOQA
>>> import numpy as np
>>> #back = testdata_guiback(defaultdb='PZ_Master1', activate=False)
>>> #ibs = back.ibs
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='PZ_Master1')
>>> # Find aids that still need splits
>>> aid_pair_list = ibs.filter_aidpairs_by_tags(has_any='SplitCase')
>>> truth_list = ibs.get_aidpair_truths(*zip(*aid_pair_list))
>>> _aid_list = ut.compress(aid_pair_list, truth_list)
>>> _nids_list = ibs.unflat_map(ibs.get_annot_name_rowids, _aid_list)
>>> _nid_list = ut.get_list_column(_nids_list, 0)
>>> import vtool as vt
>>> split_nids, groupxs = vt.group_indices(np.array(_nid_list))
>>> problem_aids_list = vt.apply_grouping(np.array(_aid_list), groupxs)
>>> #
>>> split_aids_list = ibs.get_name_aids(split_nids)
>>> assert len(split_aids_list) > 0, 'SPLIT cases are finished'
>>> problem_aids = problem_aids_list[0]
>>> aid_list = split_aids_list[0]
>>> #
>>> print('Run splits for tagd problem cases %r' % (problem_aids))
>>> #back.run_annot_splits(aid_list)
>>> print('Review splits for tagd problem cases %r' % (problem_aids))
>>> from ibeis.viz import viz_graph
>>> nid = split_nids[0]
>>> selected_aids = np.unique(problem_aids.ravel()).tolist()
>>> selected_aids = [] if ut.get_argflag('--noselect') else  selected_aids
>>> print('selected_aids = %r' % (selected_aids,))
>>> selected_aids = []
>>> aids = ibs.get_name_aids(nid)
>>> self = viz_graph.make_name_graph_interaction(ibs, aids=aids,
>>>                                              with_all=False,
>>>                                              selected_aids=selected_aids,
>>>                                              with_images=True,
>>>                                              prog='neato', rankdir='LR',
>>>                                              augment_graph=False,
>>>                                              ensure_edges=problem_aids.tolist())
>>> ut.show_if_requested()

rowids = ibs.get_annotmatch_rowid_from_superkey(problem_aids.T[0], problem_aids.T[1]) ibs.get_annotmatch_prop(‘SplitCase’, rowids) #ibs.set_annotmatch_prop(‘SplitCase’, rowids, [False])

ibeis.annotmatch_funcs.set_annot_pair_as_negative_match(ibs, aid1, aid2, dryrun=False, on_nontrivial_split=None)[source]

TODO: ELEVATE THIS FUNCTION

Parameters:
  • ibs (IBEISController) – ibeis controller object
  • aid1 (int) – annotation id
  • aid2 (int) – annotation id
  • dryrun (bool) –

CommandLine:

python -m ibeis.annotmatch_funcs --test-set_annot_pair_as_negative_match

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.annotmatch_funcs import *  # NOQA
>>> import ibeis
>>> # build test data
>>> ibs = ibeis.opendb('testdb1')
>>> aid1, aid2 = ibs.get_valid_aids()[0:2]
>>> dryrun = True
>>> # execute function
>>> result = set_annot_pair_as_negative_match(ibs, aid1, aid2, dryrun)
>>> # verify results
>>> print(result)
ibeis.annotmatch_funcs.set_annot_pair_as_positive_match(ibs, aid1, aid2, dryrun=False, on_nontrivial_merge=None)[source]

Safe way to perform links. Errors on invalid operations.

TODO: ELEVATE THIS FUNCTION Change into make_task_set_annot_pair_as_positive_match and it returns what needs to be done.

Need to test several cases:
uknown, unknown knownA, knownA knownB, knownA unknown, knownA knownA, unknown
Parameters:
  • ibs (IBEISController) – ibeis controller object
  • aid1 (int) – query annotation id
  • aid2 (int) – matching annotation id

CommandLine:

python -m ibeis.annotmatch_funcs --test-set_annot_pair_as_positive_match

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.annotmatch_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb('testdb1')
>>> aid1, aid2 = ibs.get_valid_aids()[0:2]
>>> dryrun = True
>>> status = set_annot_pair_as_positive_match(ibs, aid1, aid2, dryrun)
>>> # verify results
>>> print(status)
ibeis.annotmatch_funcs.set_annot_pair_as_reviewed(ibs, aid1, aid2)[source]

denote that this match was reviewed and keep whatever status it is given

ibeis.annotmatch_funcs.set_annot_pair_as_unknown_match(ibs, aid1, aid2, dryrun=False, on_nontrivial_merge=None)[source]
ibeis.annotmatch_funcs.setup_pzmtest_subgraph()[source]

ibeis.constants module

It is better to use constant variables instead of hoping you spell the same string correctly every time you use it. (Also it makes it much easier if a string name changes)

class ibeis.constants.PATH_NAMES[source]

Bases: object

Path names for internal IBEIS database

backups = u'_ibeis_backups'
bigcache = u'qres_bigcache_new'
cache = u'_ibeis_cache'
chips = u'chips'
detectimg = u'detectimg'
distinctdir = u'distinctiveness_model'
figures = u'figures'
flann = u'flann'
images = u'images'
nets = u'nets'
qres = u'qres_new'
scorenormdir = u'scorenorm'
smartpatrol = u'smart_patrol'
sqldb = u'_ibeis_database.sqlite3'
thumbs = u'thumbs'
trashdir = u'trashed_images'
trees = u'trees'
uploads = u'uploads'
class ibeis.constants.REL_PATHS[source]

Bases: object

all paths are relative to ibs.dbdir

backups = u'_ibsdb/_ibeis_backups'
bigcache = u'_ibsdb/_ibeis_cache/qres_bigcache_new'
cache = u'_ibsdb/_ibeis_cache'
chips = u'_ibsdb/_ibeis_cache/chips'
distinctdir = u'_ibsdb/_ibeis_cache/distinctiveness_model'
figures = u'_ibsdb/figures'
flann = u'_ibsdb/_ibeis_cache/flann'
images = u'_ibsdb/images'
nets = u'_ibsdb/nets'
qres = u'_ibsdb/_ibeis_cache/qres_new'
thumbs = u'_ibsdb/_ibeis_cache/thumbs'
trashdir = u'trashed_images'
trees = u'_ibsdb/trees'
uploads = u'_ibsdb/uploads'
class ibeis.constants.TEST_SPECIES[source]

Bases: object

BEAR_POLAR = u'bear_polar'
BUILDING = u'building'
GIR_MASAI = u'giraffe_masai'
GIR_RETICULATED = u'giraffe_reticulated'
UNKNOWN = u'____'
WHALE_FLUKE = (u'whale_fluke',)
WHALE_HUMPBACK = (u'whale_humpback',)
ZEB_GREVY = u'zebra_grevys'
ZEB_HYBRID = u'zebra_hybrid'
ZEB_PLAIN = u'zebra_plains'
class ibeis.constants.ZIPPED_URLS[source]

Bases: object

GZ_DISTINCTIVE = u'https://lev.cs.rpi.edu/public/models/distinctivness_zebra_grevys.zip'
NAUTS = u'https://lev.cs.rpi.edu/public/databases/NAUT_test.zip'
PZ_DISTINCTIVE = u'https://lev.cs.rpi.edu/public/models/distinctivness_zebra_plains.zip'
PZ_MTEST = u'https://lev.cs.rpi.edu/public/databases/PZ_MTEST.zip'
WDS = u'https://lev.cs.rpi.edu/public/databases/wd_peter2.zip'

ibeis.core_annots module

IBEIS CORE Defines the core dependency cache supported by the image analysis api

Extracts annotation chips from imaages and applies optional image normalizations.

TODO:
  • interactive callback functions
  • detection interface
  • identification interface

Notes

HOW TO DESIGN INTERACTIVE PLOTS:
decorate as interactive depc.get_property(recompute=True) instead of calling preproc as a generator and then adding, calls preproc and passes in a callback function. preproc spawns interaction and must call callback function when finished. callback function adds the rowids to the table.
Needed Tables:

Chip NormChip Feats Keypoints Descriptors ProbChip

IdentifyQuery NeighborIndex QualityClassifier ViewpointClassifier

CommandLine:

python -m ibeis.control.IBEISControl --test-show_depc_annot_graph --show
Setup:
>>> from ibeis.core_annots import *  # NOQA
>>> import ibeis
>>> import plottool as pt
>>> ibs = ibeis.opendb('testdb1')
>>> depc = ibs.depc_annot
>>> aid_list = ibs.get_valid_aids()[0:2]
class ibeis.core_annots.AnnotMaskConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

class ibeis.core_annots.ChipConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

class ibeis.core_annots.FeatConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

Example

>>> from ibeis.core_annots import *  # NOQA
>>> feat_cfg = FeatConfig()
>>> result = str(feat_cfg)
>>> print(result)
<FeatConfig(hesaff+sift)>
get_hesaff_params()[source]
get_param_info_list()[source]
class ibeis.core_annots.FeatWeightConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

class ibeis.core_annots.IndexerConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

Example

>>> from ibeis.core_annots import *  # NOQA
>>> cfg = VsOneConfig()
>>> result = str(cfg)
>>> print(result)
get_flann_params(cfg)[source]
class ibeis.core_annots.LabelerConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

class ibeis.core_annots.ProbchipConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

class ibeis.core_annots.VsOneConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

Example

>>> from ibeis.core_annots import *  # NOQA
>>> cfg = VsOneConfig()
>>> result = str(cfg)
>>> print(result)
class ibeis.core_annots.VsOneRequest[source]

Bases: dtool.base.VsOneSimilarityRequest

postprocess_execute(request, parent_rowids, result_list)[source]
rrr(verbose=True)

special class reloading function

ibeis.core_annots.cnn_probchips(ibs, species, probchip_fpath_list, inputchip_fpaths, smooth_thresh, smooth_ksize)[source]
ibeis.core_annots.compute_annotmask(depc, aid_list, config=None)[source]

Interaction dispatcher for annotation masks.

Parameters:
  • depc (ibeis.depends_cache.DependencyCache) –
  • aid_list (list) – list of annotation rowids
  • config (AnnotMaskConfig) – (default = None)
Yields:

(uri, int, int) – tup

CommandLine:

python -m ibeis.core_annots --exec-compute_annotmask --show
python -m ibeis.core_annots --exec-compute_annotmask --show --edit

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.core_annots import *  # NOQA
>>> ibs, depc, aid_list = testdata_core()
>>> config = AnnotMaskConfig(dim_size=None)
>>> chip_config = config.chip_cfg
>>> edit = ut.get_argflag('--edit')
>>> mask = depc.get_property('annotmask', aid_list, 'img', config, recompute=edit)[0]
>>> chip = depc.get_property('chips', aid_list, 'img', config=chip_config)[0]
>>> ut.quit_if_noshow()
>>> import plottool as pt
>>> resized = vt.resize_mask(mask, chip)
>>> blended = vt.blend_images_multiply(chip, resized)
>>> pt.imshow(blended, title='mask')
>>> pt.show_if_requested()
ibeis.core_annots.compute_chip(depc, aid_list, config=None)[source]

Extracts the annotation chip from the bounding box

Parameters:
  • depc (ibeis.depends_cache.DependencyCache) –
  • aid_list (list) – list of annotation rowids
  • config (dict) – (default = None)
Yields:

(uri, int, int) – tup

CommandLine:

ibeis --tf compute_chip --show
ibeis --tf compute_chip --show --pad=64 --dim_size=256 --db PZ_MTEST
ibeis --tf compute_chip --show --pad=64 --dim_size=None --db PZ_MTEST
ibeis --tf compute_chip --show --db humpbacks

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.core_annots import *  # NOQA
>>> import ibeis
>>> defaultdb = 'testdb1'
>>> ibs = ibeis.opendb(defaultdb=defaultdb)
>>> depc = ibs.depc_annot
>>> config = ChipConfig.from_argv_dict(dim_size=None)
>>> aid_list = ibs.get_valid_aids()[0:8]
>>> chips = depc.get_property('chips', aid_list, 'img', config={'dim_size': 256})
>>> ut.quit_if_noshow()
>>> import plottool as pt
>>> #interact_obj = pt.interact_multi_image.MultiImageInteraction(chips, nPerPage=4)
>>> import ibeis.viz.interact.interact_chip
>>> interact_obj = ibeis.viz.interact.interact_chip.interact_multichips(ibs, aid_list, config2_=config)
>>> interact_obj.start()
>>> pt.show_if_requested()
ibeis.core_annots.compute_dlen_sqrd(depc, aid_list, config=None)[source]
ibeis.core_annots.compute_feats(depc, cid_list, config=None)[source]

Computes features and yields results asynchronously: TODO: Remove IBEIS from this equation. Move the firewall towards the controller

Parameters:
  • depc (dtool.DependencyCache) –
  • cid_list (list) –
  • config (None) –
Returns:

generates param tups

Return type:

generator

SeeAlso:
~/code/ibeis_cnn/ibeis_cnn/_plugin.py

CommandLine:

python -m ibeis.core_annots --test-compute_feats:0 --show
python -m ibeis.core_annots --test-compute_feats:1

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.core_annots import *  # NOQA
>>> ibs, depc, aid_list = testdata_core()
>>> chip_config = {}
>>> config = FeatConfig()
>>> cid_list = depc.get_rowids('chips', aid_list, config=chip_config)
>>> featgen = compute_feats(depc, cid_list, config)
>>> feat_list = list(featgen)
>>> assert len(feat_list) == len(aid_list)
>>> (nFeat, kpts, vecs) = feat_list[0]
>>> assert nFeat == len(kpts) and nFeat == len(vecs)
>>> assert kpts.shape[1] == 6
>>> assert vecs.shape[1] == 128
>>> ut.quit_if_noshow()
>>> import plottool as pt
>>> chip = depc.get_native('chips', cid_list[0:1], 'img')[0]
>>> pt.interact_keypoints.KeypointInteraction(chip, kpts, vecs, autostart=True)
>>> ut.show_if_requested()

Example

>>> # TIMING
>>> from ibeis.core_annots import *  # NOQA
>>> ibs, depc, aid_list = testdata_core('PZ_MTEST', 100)
>>> config = {'dim_size': 450}
>>> num_feats = depc.get('feat', aid_list, 'num_feats', config=config, recompute=True)

ibs.delete_annot_feats(aid_list) ibs.get_annot_feat_rowids(aid_list)

ibeis.core_annots.compute_fgweights(depc, fid_list, pcid_list, config=None)[source]
Parameters:
  • depc (dtool.DependencyCache) – depc
  • fid_list (list) –
  • config (None) – (default = None)

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.core_annots import *  # NOQA
>>> ibs, depc, aid_list = testdata_core()
>>> full_config = {}
>>> config = FeatConfig()
>>> fid_list = depc.get_rowids('feat', aid_list, config=full_config)
>>> pcid_list = depc.get_rowids('probchip', aid_list, config=full_config)
>>> prop_list = list(compute_fgweights(depc, fid_list, pcid_list))
>>> featweight_list = ut.take_column(prop_list, 0)
>>> result = np.array_str(featweight_list[0][0:3], precision=3)
>>> print(result)
ibeis.core_annots.compute_labels_annotations(depc, aid_list, config=None)[source]

Extracts the detections for a given input image

Parameters:
  • depc (ibeis.depends_cache.DependencyCache) –
  • gid_list (list) – list of image rowids
  • config (dict) – (default = None)
Yields:

(float, str) – tup

CommandLine:

ibeis compute_labels_annotations

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.core_images import *  # NOQA
>>> import ibeis
>>> defaultdb = 'PZ_MTEST'
>>> ibs = ibeis.opendb(defaultdb=defaultdb)
>>> depc = ibs.depc_annot
>>> aid_list = ibs.get_valid_aids()[0:8]
>>> # depc.delete_property('labeler', aid_list)
>>> results = depc.get_property('labeler', aid_list, None)
>>> print(results)
ibeis.core_annots.compute_neighbor_index(depc, fids_list, config)[source]
Parameters:
  • depc (dtool.DependencyCache) –
  • fids_list (list) –
  • config (dtool.Config) –

CommandLine:

python -m ibeis.core_annots --exec-compute_neighbor_index --show
python -m ibeis.control.IBEISControl --test-show_depc_annot_table_input --show --tablename=neighbor_index

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.core_annots import *  # NOQA
>>> import ibeis
>>> ibs, aid_list = ibeis.testdata_aids('testdb1')
>>> depc = ibs.depc_annot
>>> fid_list = depc.get_rowids('feat', aid_list)
>>> aids_list = tuple([aid_list])
>>> fids_list = tuple([fid_list])
>>> # Compute directly from function
>>> config = ibs.depc_annot['neighbor_index'].configclass()
>>> result1 = list(compute_neighbor_index(depc, fids_list, config))
>>> nnindexer1 = result1[0][0]
>>> # Compute using depcache
>>> result2 = ibs.depc_annot.get('neighbor_index', [aids_list], 'indexer', config, recompute=False, _debug=True)
>>> #result3 = ibs.depc_annot.get('neighbor_index', [tuple(fids_list)], 'indexer', config, recompute=False)
>>> print(result2)
>>> print(result3)
>>> assert result2[0] is not result3[0]
>>> assert nnindexer1.knn(ibs.get_annot_vecs(1), 1) is not None
>>> assert result3[0].knn(ibs.get_annot_vecs(1), 1) is not None
ibeis.core_annots.compute_one_vs_one(depc, qaids, daids, config)[source]

CommandLine:

python -m ibeis.core_annots --test-compute_one_vs_one --show
python -m ibeis.control.IBEISControl --test-show_depc_annot_graph --show
python -m ibeis.control.IBEISControl --test-show_depc_annot_table_input --show --tablename=vsone

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.core_annots import *  # NOQA
>>> #ibs, depc, aid_list = testdata_core(size=5)
>>> import ibeis
>>> #ibs, aid_list = ibeis.testdata_aids('wd_peter2', 'timectrl:pername=2,view=left,view_ext=0,exclude_reference=True')
>>> ibs, aid_list = ibeis.testdata_aids('testdb2', 'default:')
>>> _, aids = ut.items_sorted_by_value(ut.group_items(aid_list, ibs.get_annot_occurrence_text(aid_list)), key=len)[-1]
>>> aid_list = aids
>>> depc = ibs.depc_annot
>>> request = depc.new_request('vsone', aid_list, aid_list, {'resize_dim': 'width', 'dim_size': 450})
>>> config = request.config
>>> parent_rowids_T = request.parent_rowids_T
>>> qaids, daids = request.parent_rowids_T
>>> # Compute using request
>>> print('...Test vsone cache')
>>> rawres_list2 = request.execute(postprocess=False)
>>> score_list2 = ut.take_column(rawres_list2, 0)
>>> res_list2 = request.execute()
>>> print(res_list2)
>>> # Compute using function
>>> #print('...Test vsone function')
>>> #rawres_list1 = list(compute_one_vs_one(depc, qaids, daids, config))
>>> #score_list1 = ut.take_column(rawres_list1, 0)
>>> #print(score_list1)
>>> #assert np.all(score_list1 == score_list2)
>>> ut.quit_if_noshow()
>>> ut.ensure_pylab_qt4()
>>> match = res_list2[0]
>>> match.print_inspect_str(request)
>>> #match.show_analysis(qreq_=request)
>>> #match.ishow_analysis(qreq_=request)
>>> #match.ishow_single_annotmatch(qreq_=request)
>>> match.show_single_annotmatch(qreq_=request, vert=False)
>>> ut.show_if_requested()
ibeis.core_annots.compute_probchip(depc, aid_list, config=None)[source]

Computes probability chips using pyrf

CommandLine:

python -m ibeis.core_annots --test-compute_probchip --nocnn --show --db PZ_MTEST
python -m ibeis.core_annots --test-compute_probchip --show --fw_detector=cnn
python -m ibeis.core_annots --test-compute_probchip --show --fw_detector=rf --smooth_thresh=None
Example1:
>>> # DISABLE_DOCTEST
>>> from ibeis.core_annots import *  # NOQA
>>> import ibeis
>>> ibs, depc, aid_list = testdata_core()
>>> aid_list = ibs.get_valid_aids(species='zebra_plains')[0:10]
>>> config = ProbchipConfig.from_argv_dict(fw_detector='rf', smooth_thresh=None)
>>> #probchip_fpath_list_ = ut.take_column(list(compute_probchip(depc, aid_list, config)), 0)
>>> probchip_list_ = ut.take_column(list(compute_probchip(depc, aid_list, config)), 0)
>>> #result = ut.list_str(probchip_fpath_list_)
>>> #print(result)
>>> ut.quit_if_noshow()
>>> import plottool as pt
>>> #xlabel_list = list(map(str, [vt.image.open_image_size(p) for p in probchip_fpath_list_]))
>>> #iteract_obj = pt.interact_multi_image.MultiImageInteraction(probchip_fpath_list_, nPerPage=4, xlabel_list=xlabel_list)
>>> xlabel_list = [str(vt.get_size(img)) for img in probchip_list_]
>>> iteract_obj = pt.interact_multi_image.MultiImageInteraction(probchip_list_, nPerPage=4, xlabel_list=xlabel_list)
>>> iteract_obj.start()
>>> ut.show_if_requested()
ibeis.core_annots.gen_feat_worker(tup)[source]

Function to be parallelized by multiprocessing / joblib / whatever. Must take in one argument to be used by multiprocessing.map_async

Parameters:tup (tuple) –
Returns:(None, kpts, vecs)
Return type:tuple

CommandLine:

python -m ibeis.core_annots --exec-gen_feat_worker --show
python -m ibeis.core_annots --exec-gen_feat_worker --show --aid 1988 --db GZ_Master1 --affine-invariance=False --scale_max=30
python -m ibeis.core_annots --exec-gen_feat_worker --show --aid 1988 --db GZ_Master1 --affine-invariance=False --maskmethod=None  --scale_max=30

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.core_annots import *  # NOQA
>>> ibs, depc, aid_list = testdata_core()
>>> aid = aid_list[0]
>>> config = {}
>>> feat_config = FeatConfig.from_argv_dict()
>>> chip_fpath = ibs.depc_annot.get('chips', aid_list[0], 'img', config=config, read_extern=False)
>>> maskmethod = ut.get_argval('--maskmethod', type_=str, default='cnn')
>>> probchip_fpath = ibs.depc_annot.get('probchip', aid_list[0], 'img', config=config, read_extern=False) if feat_config['maskmethod'] == 'cnn' else None
>>> hesaff_params = feat_config.asdict()
>>> # Exec function source
>>> tup = (chip_fpath, probchip_fpath, hesaff_params)
>>> masked_chip, num_kpts, kpts, vecs = ut.exec_func_src(
>>>     gen_feat_worker, key_list=['masked_chip', 'num_kpts', 'kpts', 'vecs'],
>>>     sentinal='num_kpts = kpts.shape[0]')
>>> result = ('(num_kpts, kpts, vecs) = %s' % (ut.repr2((num_kpts, kpts, vecs)),))
>>> print(result)
>>> ut.quit_if_noshow()
>>> import plottool as pt
>>> from plottool.interactions import ExpandableInteraction
>>> interact = ExpandableInteraction()
>>> interact.append_plot(pt.interact_keypoints.KeypointInteraction(masked_chip, kpts, vecs))
>>> interact.append_plot(lambda **kwargs: pt.plot_score_histograms([vt.get_scales(kpts)], **kwargs))
>>> interact.start()
>>> ut.show_if_requested()
ibeis.core_annots.gen_featweight_worker(tup)[source]

Function to be parallelized by multiprocessing / joblib / whatever. Must take in one argument to be used by multiprocessing.map_async

Parameters:tup (aid, tuple(kpts(ndarray) – keypoints and probability chip file path aid, kpts, probchip_fpath

CommandLine:

python -m ibeis.core_annots --test-gen_featweight_worker --show
python -m ibeis.core_annots --test-gen_featweight_worker --show --dpath figures --save ~/latex/crall-candidacy-2015/figures/gen_featweight.jpg
python -m ibeis.core_annots --test-gen_featweight_worker --show --db PZ_MTEST --qaid_list=1,2,3,4,5,6,7,8,9

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.core_annots import *  # NOQA
>>> #test_featweight_worker()
>>> ibs, depc, aid_list = testdata_core()
>>> aid_list = aid_list[0:1]
>>> config = {'dim_size': 450, 'resize_dim': 'area', 'smooth_thresh': 0, 'smooth_ksize': 0}
>>> probchip = depc.get('probchip', aid_list, 'img', config=config)[0]
>>> chipsize = depc.get('chips', aid_list, ('width', 'height'), config=config)[0]
>>> kpts = depc.get('feat', aid_list, 'kpts', config=config)[0]
>>> tup = (kpts, probchip, chipsize)
>>> weights = gen_featweight_worker(tup)
>>> assert np.all(weights <= 1.0), 'weights cannot be greater than 1'
>>> chip = depc.get('chips', aid_list, 'img', config=config)[0]
>>> ut.quit_if_noshow()
>>> import plottool as pt
>>> fnum = 1
>>> pnum_ = pt.make_pnum_nextgen(1, 3)
>>> pt.figure(fnum=fnum, doclf=True)
>>> pt.imshow(chip, pnum=pnum_(0), fnum=fnum)
>>> pt.imshow(probchip, pnum=pnum_(2), fnum=fnum)
>>> pt.imshow(chip, pnum=pnum_(1), fnum=fnum)
>>> color_list = pt.draw_kpts2(kpts, weights=weights, ell_alpha=.3)
>>> cb = pt.colorbar(weights, color_list)
>>> cb.set_label('featweights')
>>> pt.show_if_requested()
ibeis.core_annots.postprocess_mask(mask, thresh=20, kernel_size=20)[source]
Parameters:mask (ndarray) –
Returns:mask2
Return type:ndarray

CommandLine:

python -m ibeis.core_annots --exec-postprocess_mask --cnn --show --aid=1 --db PZ_MTEST
python -m ibeis --tf postprocess_mask --cnn --show --db PZ_MTEST --adapteq=True
SeeAlso:
python -m ibeis_cnn –tf generate_species_background_mask –show –db PZ_Master1 –aid 9970

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.core_annots import *  # NOQA
>>> import plottool as pt
>>> ibs, depc, aid_list = testdata_core()
>>> config = ChipConfig.from_argv_dict()
>>> probchip_config = ProbchipConfig(smooth_thresh=None)
>>> chip = ibs.depc_annot.get('chips', aid_list, 'img', config)[0]
>>> mask = ibs.depc_annot.get('probchip', aid_list, 'img', probchip_config)[0]
>>> mask2 = postprocess_mask(mask)
>>> ut.quit_if_noshow()
>>> fnum = 1
>>> pt.imshow(chip, pnum=(1, 3, 1), fnum=fnum, xlabel=str(chip.shape))
>>> pt.imshow(mask, pnum=(1, 3, 2), fnum=fnum, title='before', xlabel=str(mask.shape))
>>> pt.imshow(mask2, pnum=(1, 3, 3), fnum=fnum, title='after', xlabel=str(mask2.shape))
>>> ut.show_if_requested()
ibeis.core_annots.rf_probchips(ibs, aids, species, probchip_fpaths, inputchip_fpaths, pad, smooth_thresh, smooth_ksize)[source]
ibeis.core_annots.test_cut(ibs, parent_rowids_T, score_list2)[source]
ibeis.core_annots.testdata_core(defaultdb=u'testdb1', size=2)[source]

ibeis.core_images module

IBEIS CORE Defines the core dependency cache supported by the image analysis api

Extracts detection results from images and applies additional processing automatically

Ex
python -m ibeis.control.IBEISControl –test-show_depc_image_graph –show python -m ibeis.control.IBEISControl –test-show_depc_image_graph –show –reduced

TODO:

Notes

HOW TO DESIGN INTERACTIVE PLOTS:

decorate as interactive

depc.get_property(recompute=True)

instead of calling preproc as a generator and then adding, calls preproc and passes in a callback function. preproc spawns interaction and must call callback function when finished.

callback function adds the rowids to the table.

Needed Tables:
Detections QualityClassifier ViewpointClassifier
class ibeis.core_images.ClassifierConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

class ibeis.core_images.DetectorConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

class ibeis.core_images.LabelerConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

class ibeis.core_images.LocalizerConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

class ibeis.core_images.ThumbnailConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

ibeis.core_images.compute_classifications(depc, gid_list, config=None)[source]

Extracts the detections for a given input image

Parameters:
  • depc (ibeis.depends_cache.DependencyCache) –
  • gid_list (list) – list of image rowids
  • config (dict) – (default = None)
Yields:

(float, str) – tup

CommandLine:

ibeis compute_classifications

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.core_images import *  # NOQA
>>> import ibeis
>>> defaultdb = 'PZ_MTEST'
>>> ibs = ibeis.opendb(defaultdb=defaultdb)
>>> depc = ibs.depc_image
>>> gid_list = ibs.get_valid_gids()[0:8]
>>> # depc.delete_property('classifier', gid_list)
>>> results = depc.get_property('classifier', gid_list, None)
>>> print(results)
ibeis.core_images.compute_detections(depc, gid_list, config=None)[source]

Extracts the detections for a given input image

Parameters:
  • depc (ibeis.depends_cache.DependencyCache) –
  • gid_list (list) – list of image rowids
  • config (dict) – (default = None)
Yields:

(float, np.ndarray, np.ndarray, np.ndarray, np.ndarray) – tup

CommandLine:

ibeis compute_detections

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.core_images import *  # NOQA
>>> import ibeis
>>> defaultdb = 'PZ_MTEST'
>>> ibs = ibeis.opendb(defaultdb=defaultdb)
>>> # dbdir = '/Users/bluemellophone/Desktop/GGR-IBEIS-TEST/'
>>> # dbdir = '/media/danger/GGR/GGR-IBEIS-TEST/'
>>> # ibs = ibeis.opendb(dbdir=dbdir)
>>> depc = ibs.depc_image
>>> gid_list = ibs.get_valid_gids()[0:10]
>>> depc.delete_property('detections', gid_list)
>>> detects = depc.get_property('detections', gid_list, None)
>>> print(detects)
ibeis.core_images.compute_labels_localizations(depc, loc_id_list, config=None)[source]

Extracts the detections for a given input image

Parameters:
  • depc (ibeis.depends_cache.DependencyCache) –
  • loc_id_list (list) – list of localization rowids
  • config (dict) – (default = None)
Yields:

(float, str) – tup

CommandLine:

ibeis compute_labels_localizations

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.core_images import *  # NOQA
>>> import ibeis
>>> defaultdb = 'PZ_MTEST'
>>> ibs = ibeis.opendb(defaultdb=defaultdb)
>>> depc = ibs.depc_image
>>> gid_list = ibs.get_valid_gids()[0:100]
>>> depc.delete_property('labeler', gid_list)
>>> results = depc.get_property('labeler', gid_list, None)
>>> results = depc.get_property('labeler', gid_list, 'species')
>>> print(results)
ibeis.core_images.compute_localizations(depc, gid_list, config=None)[source]

Extracts the localizations for a given input image

Parameters:
  • depc (ibeis.depends_cache.DependencyCache) –
  • gid_list (list) – list of image rowids
  • config (dict) – (default = None)
Yields:

(float, np.ndarray, np.ndarray, np.ndarray, np.ndarray) – tup

CommandLine:

ibeis compute_localizations

CommandLine:

python -m ibeis.core_images compute_localizations --show

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.core_images import *  # NOQA
>>> import ibeis
>>> defaultdb = 'PZ_MTEST'
>>> ibs = ibeis.opendb(defaultdb=defaultdb)
>>> depc = ibs.depc_image
>>> print(depc.get_tablenames())
>>> gid_list = ibs.get_valid_gids()[0:1]
>>> config = {'algo': 'yolo'}
>>> depc.delete_property('localizations', gid_list, config=config)
>>> detects = depc.get_property('localizations', gid_list, 'bboxes', config=config)
>>> print(detects)
>>> config = {'algo': 'pyrf'}
>>> depc.delete_property('localizations', gid_list, config=config)
>>> detects = depc.get_property('localizations', gid_list, 'bboxes', config=config)
>>> print(detects)
ibeis.core_images.compute_thumbnails(depc, gid_list, config=None)[source]

Computers the thumbnail for a given input image

Parameters:
  • depc (ibeis.depends_cache.DependencyCache) –
  • gid_list (list) – list of image rowids
  • config (dict) – (default = None)
Yields:

(uri, int, int) – tup

CommandLine:

ibeis --tf compute_thumbnails --show --db PZ_MTEST

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.core_images import *  # NOQA
>>> import ibeis
>>> defaultdb = 'testdb1'
>>> ibs = ibeis.opendb(defaultdb=defaultdb)
>>> depc = ibs.depc_image
>>> gid_list = ibs.get_valid_gids()[0:10]
>>> thumbs = depc.get_property('thumbnails', gid_list, 'img', config={'thumbsize': 221})
>>> ut.quit_if_noshow()
>>> import plottool as pt
>>> iteract_obj = pt.interact_multi_image.MultiImageInteraction(thumbs, nPerPage=4)
>>> iteract_obj.start()
>>> pt.show_if_requested()
ibeis.core_images.draw_thumb_helper(tup)[source]

ibeis.dev module

DEV SCRIPT

This is a hacky script meant to be run mostly automatically with the option of interactions.

dev.py is supposed to be a developer non-gui interface into the IBEIS software. dev.py runs experiments and serves as a scratchpad for new code and quick scripts

TODO:

Test to find typical “good” descriptor scores. Find nearest neighbors and noramlizers for each feature in a query image. Based on ground truth and spatial verification mark feature matches as true or false. Visualize the feature scores of good matches vs bad matches. Lowe shows the pdf of correct matches and the PDF for incorrect matches. We should also show the same thing.
Done:
Cache nearest neighbors so different parameters later in the pipeline dont take freaking forever.

CommandLine:

python dev.py --wshow -t query --db PZ_MTEST --qaid 110 --cfg score_method:nsum prescore_method:nsum
python dev.py --wshow -t query --db PZ_MTEST --qaid 110
python dev.py --wshow -t query --db PZ_MTEST --qaid 110 --cfg fg_on=True
python dev.py --wshow -t query --db PZ_MTEST --qaid 110 --cfg
ibeis.dev.dev_snippets(main_locals)[source]

Common variables for convineince when interacting with IPython

ibeis.dev.devfunc(ibs, qaid_list)[source]

Function for developing something

ibeis.dev.devmain()[source]
The Developer Script

A command line interface to almost everything

-w # wait / show the gui / figures are visible
--cmd # ipython shell to play with variables
-t # run list of tests

Examples:

ibeis.dev.get_ibslist(ibs)[source]
ibeis.dev.get_sortbystr(str_list, key_list, strlbl=None, keylbl=None)[source]
ibeis.dev.run_dev(ibs)[source]

main developer command

CommandLine:

python dev.py --db PZ_Master0 --controlled --print-rankhist
ibeis.dev.run_devcmds(ibs, qaid_list, daid_list, acfg=None)[source]

This function runs tests passed in with the -t flag

ibeis.dev.run_devprecmds()[source]

Looks for pre-tests specified with the -t flag and runs them

ibeis.filter_configs module

ibeis.main_module module

This module defines the entry point into the IBEIS system ibeis.opendb and ibeis.main are the main entry points

ibeis.main_module.main(gui=True, dbdir=None, defaultdb='cache', allow_newdir=False, db=None, delete_ibsdir=False, **kwargs)[source]

Program entry point Inits the system environment, an IBEISControl, and a GUI if requested

Parameters:
  • gui (bool) – (default=True) If gui is False a gui instance will not be created
  • dbdir (None) – full directory of a database to load
  • db (None) – name of database to load relative to the workdir
  • allow_newdir (bool) – (default=False) if False an error is raised if a a new database is created
  • defaultdb (str) – codename of database to load if db and dbdir is None. a value of ‘cache’ will open the last database opened with the GUI.
Returns:

main_locals

Return type:

dict

ibeis.main_module.main_close(main_locals=None)[source]
ibeis.main_module.main_loop(main_locals, rungui=True, ipy=False, persist=True)[source]

Runs the qt loop if the GUI was initialized and returns an executable string for embedding an IPython terminal if requested.

If rungui is False the gui will not loop even if back has been created

the main locals dict must be callsed main_locals in the scope you call this function in.

Parameters:
  • main_locals (dict_) –
  • rungui (bool) –
  • ipy (bool) –
  • persist (bool) –
Returns:

execstr

Return type:

str

ibeis.main_module.opendb(db=None, dbdir=None, defaultdb='cache', allow_newdir=False, delete_ibsdir=False, verbose=False, use_cache=True, web=None, **kwargs)[source]

main without the preload (except for option to delete database before opening)

Parameters:
  • db (str) – database name in your workdir used only if dbdir is None
  • dbdir (None) – full database path
  • defaultdb (str) – dbdir search stratagy when db is None and dbdir is None
  • allow_newdir (bool) – (default=True) if True errors when opening a nonexisting database
  • delete_ibsdir (bool) – BE CAREFUL! (default=False) if True deletes the entire
  • verbose (bool) – verbosity flag
  • web (bool) – starts webserver if True (default=param specification)
  • use_cache (bool) – if True will try to return a previously loaded controller
Returns:

ibs

Return type:

ibeis.IBEISController

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.main_module import *  # NOQA
>>> db = None
>>> dbdir = None
>>> defaultdb = 'cache'
>>> allow_newdir = False
>>> delete_ibsdir = False
>>> verbose = False
>>> use_cache = True
>>> ibs = opendb(db, dbdir, defaultdb, allow_newdir, delete_ibsdir,
>>>              verbose, use_cache)
>>> result = str(ibs)
>>> print(result)
ibeis.main_module.opendb_bg_web(*args, **kwargs)[source]

Wrapper around opendb_in_background, returns a nice web_ibs object to execute web calls using normal python-like syntax

Accespts domain and port as kwargs

Kwargs:
port, domain

CommandLine:

python -m ibeis.main_module opendb_bg_web

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.main_module import *  # NOQA
>>> print('Opening a web_ibs')
>>> web_ibs = opendb_bg_web()
>>> print('SUCESS Opened a web_ibs!')
>>> print(web_ibs)
>>> print('Now kill the web_ibs')
>>> web_ibs.terminate2()
ibeis.main_module.opendb_in_background(*args, **kwargs)[source]

Starts a web server in the background

ibeis.main_module.profile(func)[source]
ibeis.main_module.set_newfile_permissions()[source]

sets this processes default permission bits when creating new files

CommandLine:

python -m ibeis.main_module --test-set_newfile_permissions

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.main_module import *  # NOQA
>>> import os
>>> import utool as ut
>>> # write before umask
>>> ut.delete('tempfile1.txt')
>>> ut.write_to('tempfile1.txt', 'foo')
>>> stat_result1 = os.stat('tempfile1.txt')
>>> # apply umask
>>> set_newfile_permissions()
>>> ut.delete('tempfile2.txt')
>>> ut.write_to('tempfile2.txt', 'foo')
>>> stat_result2 = os.stat('tempfile2.txt')
>>> # verify results
>>> print('old masked all bits = %o' % (stat_result1.st_mode))
>>> print('new masked all bits = %o' % (stat_result2.st_mode))
ibeis.main_module.start(*args, **kwargs)[source]

alias for main()

ibeis.main_module.test_main(gui=True, dbdir=None, defaultdb='cache', allow_newdir=False, db=None)[source]

alias for main()

ibeis.new_annots module

class ibeis.new_annots.InvertedIndex[source]

Bases: utool.util_dev.NiceRepr

rrr(verbose=True)

special class reloading function

class ibeis.new_annots.InvertedStackAssignment(invassign, fstack, vocab, wx2_idxs, wx2_maws, wx2_fxs, wx2_axs)[source]

Bases: utool.util_dev.NiceRepr

compute_agg_rvecs(invassign, wx)[source]

Sums and normalizes all rvecs that belong to the same word and the same annotation id

compute_nonagg_rvecs(invassign, wx, compress=False)[source]

Driver function for nonagg residual computation

Parameters:
  • words (ndarray) – array of words
  • idx2_vec (dict) – stacked vectors
  • wx_sublist (list) – words of interest
  • idxs_list (list) – list of idxs grouped by wx_sublist
Returns:

(rvecs_list, flags_list)

Return type:

tuple

get_patches(invassign, wx)[source]
get_vecs(invassign, wx)[source]
rrr(verbose=True)

special class reloading function

class ibeis.new_annots.StackedFeatures(fstack, ibs, aid_list, config=None)[source]

Bases: utool.util_dev.NiceRepr

inverted_assignment(fstack, vocab, nAssign=1)[source]
rrr(verbose=True)

special class reloading function

class ibeis.new_annots.VisualVocab(words=None)[source]

Bases: utool.util_dev.NiceRepr

assign_to_words(idx2_vec, nAssign, massign_alpha=1.2, massign_sigma=80.0, massign_equal_weights=False)[source]

Assigns descriptor-vectors to nearest word.

Parameters:
  • wordflann (FLANN) – nearest neighbor index over words
  • words (ndarray) – vocabulary words
  • idx2_vec (ndarray) – descriptors to assign
  • nAssign (int) – number of words to assign each descriptor to
  • massign_alpha (float) – multiple-assignment ratio threshold
  • massign_sigma (float) – multiple-assignment gaussian variance
  • massign_equal_weights (bool) – assign equal weight to all multiassigned words
Returns:

inverted index, multi-assigned weights, and forward index formated as:

* wx2_idxs - word index   -> vector indexes
* wx2_maws - word index   -> multi-assignment weights
* idf2_wxs - vector index -> assigned word indexes

Return type:

tuple

Example

>>> # SLOW_DOCTEST
>>> idx2_vec = depc.d.get_feat_vecs(aid_list)[0][0::300]
>>> idx2_vec = np.vstack((idx2_vec, self.wx2_word[0]))
>>> nAssign = 2
>>> massign_equal_weights = False
>>> massign_alpha = 1.2
>>> massign_sigma = 80.0
>>> nAssign = 2
>>> idx2_wxs, idx2_maws = self.assign_to_words(idx2_vec, nAssign)
>>> print('idx2_maws = %s' % (ut.repr2(idx2_wxs, precision=2),))
>>> print('idx2_wxs = %s' % (ut.repr2(idx2_maws, precision=2),))
invert_assignment(idx2_wxs, idx2_maws, *other_idx2_prop)[source]

Inverts assignment of vectors to words into words to vectors.

Example

>>> idx2_idx = np.arange(len(idx2_wxs))
>>> other_idx2_prop = (idx2_idx,)
>>> wx2_idxs, wx2_maws, wx2_idxs_ = self.invert_assignment(idx2_wxs, idx2_maws, idx2_idx)
>>> assert ut.dict_str(wx2_idxs) == ut.dict_str(wx2_idxs_)
nn_index(idx2_vec, nAssign)[source]
>>> idx2_vec = depc.d.get_feat_vecs(aid_list)[0]
>>> self = vocab
>>> nAssign = 1
on_load(nnindexer, depc)[source]
on_save(nnindexer, depc, fpath)[source]
reindex(verbose=True)[source]
rrr(verbose=True)

special class reloading function

class ibeis.new_annots.VocabConfig(cfg, **kwargs)[source]

Bases: dtool.base.Config

Example

>>> from ibeis.core_annots import *  # NOQA
>>> cfg = VocabConfig()
>>> result = str(cfg)
>>> print(result)
ibeis.new_annots.aggregate_rvecs(rvecs, maws, compress=False)[source]

helper for compute_agg_rvecs

ibeis.new_annots.compute_vocab(depc, fid_list, config)[source]
Parameters:
  • depc (dtool.DependencyCache) –
  • fids_list (list) –
  • config (dtool.Config) –

CommandLine:

python -m ibeis.core_annots --exec-compute_neighbor_index --show
python -m ibeis.control.IBEISControl --test-show_depc_annot_table_input --show --tablename=neighbor_index

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.new_annots import *  # NOQA
>>> import ibeis
>>> ibs, aid_list = ibeis.testdata_aids('testdb1')
>>> depc = ibs.depc_annot
>>> fid_list = depc.get_rowids('feat', aid_list)
>>> config = VocabConfig()
>>> vocab, train_vecs = ut.exec_func_src(compute_vocab, key_list=['vocab', 'train_vecs'])
>>> idx2_vec = depc.d.get_feat_vecs(aid_list)[0]
>>> self = vocab
>>> ut.quit_if_noshow()
>>> data = train_vecs
>>> centroids = vocab.wx2_word
>>> import plottool as pt
>>> vt.plot_centroids(data, centroids, num_pca_dims=2)
>>> ut.show_if_requested()
>>> #config = ibs.depc_annot['vocab'].configclass()
>>>
ibeis.new_annots.extract_patches(ibs, aid_list, fxs_list=None, patch_size=None, colorspace=None)[source]

Example

>>> # DISABLE_DOCTEST
>>> from ibeis_cnn.ingest_ibeis import *  # NOQA
>>> ut.show_if_requested()
ibeis.new_annots.test_visualize_vocab_interact()[source]

python -m ibeis.new_annots –exec-test_visualize_vocab_interact –show

Example

>>> from ibeis.new_annots import *  # NOQA
>>> test_visualize_vocab_interact()
>>> ut.show_if_requested()
ibeis.new_annots.testdata_vocab()[source]
ibeis.new_annots.visualize_vocab_word(ibs, invassign, wx, fnum=None)[source]

Example

>>> from ibeis.new_annots import *  # NOQA
>>> import plottool as pt
>>> pt.qt4ensure()
>>> ibs, aid_list, vocab = testdata_vocab()
>>> #aid_list = aid_list[0:1]
>>> fstack = StackedFeatures(ibs, aid_list)
>>> nAssign = 2
>>> invassign = fstack.inverted_assignment(vocab, nAssign)
>>> sortx = ut.argsort(invassign.num_list)[::-1]
>>> wx_list = ut.take(invassign.wx_list, sortx)
>>> wx = wx_list[0]

ibeis.params module

this module lists most of the command line args available for use. there are still many cases where util_arg.get_argval and util_arg.get_argflag are used instead of this module. Those command line arguments will not be represented here and they should eventually be integrated into this module (hopefully automagically)

TODO: nnkj/enerate this module automagically from

import utool as ut utool_parse_codeblock = ut.util_arg.autogen_argparse_block(extra_args=parsed_args) ut.util_arg.reset_argrecord() import ibeis parsed_args = ut.util_arg.parse_used_arg_flags_and_vals(ibeis, recursive=True) ibeis_parse_codeblock = ut.util_arg.autogen_argparse_block(extra_args=parsed_args)

ut.util_arg.autogenerate_parse_py([utool_parse_codeblock, ibeis_parse_codeblock])

utool_parse_codeblock ut.util_arg

print(parse_codeblock)

ibeis.params.parse_args()[source]

ibeis.species module

ibeis.tag_funcs module

ibeis.tag_funcs.append_annot_case_tags(ibs, aid_list, tag_list)[source]

Generally appends tags to annotations. Careful not to introduce too many random tags. Maybe we should just let that happen and introduce tag-aliases

Note: this is more of a set add rather than a list append

TODO: remove

ibeis.tag_funcs.consolodate_annotmatch_tags(case_tags)[source]
ibeis.tag_funcs.export_tagged_chips(ibs, aid_list, dpath=u'.')[source]

CommandLine:

python -m ibeis.tag_funcs --exec-export_tagged_chips --tags Hard interesting needswork --db PZ_Master1
python -m ibeis.tag_funcs --exec-export_tagged_chips --logic=or --any_startswith quality occlusion --has_any lighting needswork interesting hard --db GZ_Master1 --dpath=/media/raid
python -m ibeis.tag_funcs --exec-export_tagged_chips --db GZ_Master1 --min_num=1  --dpath /media/raid

Example

>>> # SCRIPT
>>> from ibeis.tag_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='testdb1')
>>> kwargs = ut.argparse_dict(ut.get_kwdefaults2(filterflags_general_tags), type_hint=ut.ddict(list, logic=str))
>>> ut.print_dict(kwargs, 'filter args')
>>> aid_list = ibs.filter_annots_by_tags(**kwargs)
>>> print('len(aid_list) = %r' % (len(aid_list),))
>>> dpath = ut.get_argval('--dpath', default='')
>>> all_tags = ut.flatten(ibs.get_annot_all_tags(aid_list))
>>> filtered_tag_hist = ut.dict_hist(all_tags)
>>> ut.print_dict(filtered_tag_hist, key_order_metric='val')
>>> export_tagged_chips(ibs, aid_list, dpath)
ibeis.tag_funcs.filter_aidpairs_by_tags(ibs, has_any=None, has_all=None, min_num=None, max_num=None)[source]

list(zip(aid_pairs, undirected_tags))

ibeis.tag_funcs.filter_annotmatch_by_tags(ibs, annotmatch_rowids=None, **kwargs)[source]

ignores case

Parameters:
Returns:

list

CommandLine:

python -m ibeis.tag_funcs --exec-filter_annotmatch_by_tags --show
python -m ibeis.tag_funcs --exec-filter_annotmatch_by_tags --show --db PZ_Master1 --min-num=1
python -m ibeis.tag_funcs --exec-filter_annotmatch_by_tags --show --db PZ_Master1 --tags JoinCase
python -m ibeis.tag_funcs --exec-filter_annotmatch_by_tags --show --db PZ_Master1 --tags SplitCase
python -m ibeis.tag_funcs --exec-filter_annotmatch_by_tags --show --db PZ_Master1 --tags occlusion
python -m ibeis.tag_funcs --exec-filter_annotmatch_by_tags --show --db PZ_Master1 --tags viewpoint
python -m ibeis.tag_funcs --exec-filter_annotmatch_by_tags --show --db PZ_Master1 --tags SceneryMatch
python -m ibeis.tag_funcs --exec-filter_annotmatch_by_tags --show --db PZ_Master1 --tags Photobomb

python -m ibeis.tag_funcs --exec-filter_annotmatch_by_tags --show --db GZ_Master1 --tags needswork

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.tag_funcs import *  # NOQA
>>> import ibeis
>>> #ibs = ibeis.opendb(defaultdb='testdb1')
>>> ibs = ibeis.opendb(defaultdb='PZ_Master1')
>>> #tags = ['Photobomb', 'SceneryMatch']
>>> has_any = ut.get_argval('--tags', type_=list, default=['SceneryMatch', 'Photobomb'])
>>> min_num = ut.get_argval('--min_num', type_=int, default=1)
>>> prop = has_any[0]
>>> filtered_annotmatch_rowids = filter_annotmatch_by_tags(ibs, None, has_any=has_any, min_num=min_num)
>>> aid1_list = np.array(ibs.get_annotmatch_aid1(filtered_annotmatch_rowids))
>>> aid2_list = np.array(ibs.get_annotmatch_aid2(filtered_annotmatch_rowids))
>>> aid_pairs = np.vstack([aid1_list, aid2_list]).T
>>> # Dont double count
>>> xs = vt.find_best_undirected_edge_indexes(aid_pairs)
>>> aid1_list = aid1_list.take(xs)
>>> aid2_list = aid2_list.take(xs)
>>> valid_tags_list = ibs.get_annotmatch_case_tags(filtered_annotmatch_rowids)
>>> print('valid_tags_list = %s' % (ut.list_str(valid_tags_list, nl=1),))
>>> #
>>> print('Aid pairs with has_any=%s' % (has_any,))
>>> print('Aid pairs with min_num=%s' % (min_num,))
>>> print('aid_pairs = ' + ut.list_str(list(zip(aid1_list, aid2_list))))
>>> # Show timedelta info
>>> ut.quit_if_noshow()
>>> timedelta_list = ibs.get_annot_pair_timdelta(aid1_list, aid2_list)
>>> import plottool as pt
>>> pt.draw_timedelta_pie(timedelta_list, label='timestamp of tags=%r' % (has_any,))
>>> ut.show_if_requested()
ibeis.tag_funcs.filter_annots_by_tags(ibs, aid_list=None, **kwargs)[source]

Filter / Find / Search for annotations with particular tags

CommandLine:

python -m ibeis.tag_funcs --exec-filter_annots_by_tags --helpx
python -m ibeis.tag_funcs --exec-filter_annots_by_tags --db GZ_Master1
python -m ibeis.tag_funcs --exec-filter_annots_by_tags --db GZ_Master1 --min_num=1
python -m ibeis.tag_funcs --exec-filter_annots_by_tags --db GZ_Master1 --has_any=lighting --has_all=lighting:underexposed --show
SeeAlso:
python -m ibeis.init.filter_annots –exec-filter_annots_general

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.tag_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='testdb1')
>>> aid_list = ibs.get_valid_aids()
>>> kwargs = ut.argparse_dict(ut.get_kwdefaults2(filterflags_general_tags), type_hint=ut.ddict(list, logic=str))
>>> ut.print_dict(kwargs, 'filter args')
>>> aid_list = ibs.filter_annots_by_tags(aid_list, **kwargs)
>>> print('len(aid_list) = %r' % (len(aid_list),))
>>> # print results
>>> all_tags = ut.flatten(ibs.get_annot_all_tags(aid_list))
>>> filtered_tag_hist = ut.dict_hist(all_tags)
>>> ut.print_dict(filtered_tag_hist, key_order_metric='val')
>>> print('len(aid_list) = %r' % (len(aid_list),))
>>> print('sum(tags) = %r' % (sum(filtered_tag_hist.values()),))
>>> ut.quit_if_noshow()
>>> import ibeis.viz.interact
>>> ibeis.viz.interact.interact_chip.interact_multichips(ibs, aid_list)
>>> ut.show_if_requested()
ibeis.tag_funcs.filterflags_annot_tags(ibs, aid_list, **kwargs)[source]

Filter / Find / Search for annotations with particular tags

ibeis.tag_funcs.filterflags_general_tags(tags_list, has_any=None, has_all=None, has_none=None, min_num=None, max_num=None, any_startswith=None, any_endswith=None, any_match=None, none_match=None, logic=u'and')[source]

maybe integrate into utool? Seems pretty general

Parameters:
  • tags_list (list) –
  • has_any (None) – (default = None)
  • has_all (None) – (default = None)
  • min_num (None) – (default = None)
  • max_num (None) – (default = None)

CommandLine:

python -m ibeis.tag_funcs --exec-filterflags_general_tags
python -m ibeis.tag_funcs --exec-filterflags_general_tags:0  --helpx
python -m ibeis.tag_funcs --exec-filterflags_general_tags:0
python -m ibeis.tag_funcs --exec-filterflags_general_tags:0  --none_match n
python -m ibeis.tag_funcs --exec-filterflags_general_tags:0  --has_none=n,o
python -m ibeis.tag_funcs --exec-filterflags_general_tags:1
python -m ibeis.tag_funcs --exec-filterflags_general_tags:2
Example0:
>>> # DISABLE_DOCTEST
>>> from ibeis.tag_funcs import *  # NOQA
>>> tags_list = [['v'], [], ['P'], ['P', 'o'], ['n', 'o',], [], ['n', 'N'], ['e', 'i', 'p', 'b', 'n'], ['q', 'v'], ['n'], ['n'], ['N']]
>>> kwargs = ut.argparse_dict(ut.get_kwdefaults2(filterflags_general_tags), type_hint=list)
>>> print('kwargs = %r' % (kwargs,))
>>> flags = filterflags_general_tags(tags_list, **kwargs)
>>> print(flags)
>>> result = ut.compress(tags_list, flags)
>>> print('result = %r' % (result,))
Example1:
>>> # ENABLE_DOCTEST
>>> from ibeis.tag_funcs import *  # NOQA
>>> tags_list = [['v'], [], ['P'], ['P'], ['n', 'o',], [], ['n', 'N'], ['e', 'i', 'p', 'b', 'n'], ['n'], ['n'], ['N']]
>>> has_all = 'n'
>>> min_num = 1
>>> flags = filterflags_general_tags(tags_list, has_all=has_all, min_num=min_num)
>>> result = ut.compress(tags_list, flags)
>>> print('result = %r' % (result,))
Example2:
>>> # ENABLE_DOCTEST
>>> from ibeis.tag_funcs import *  # NOQA
>>> tags_list = [['vn'], ['vn', 'no'], ['P'], ['P'], ['n', 'o',], [], ['n', 'N'], ['e', 'i', 'p', 'b', 'n'], ['n'], ['n', 'nP'], ['NP']]
>>> kwargs = {
>>>     'any_endswith': 'n',
>>>     'any_match': None,
>>>     'any_startswith': 'n',
>>>     'has_all': None,
>>>     'has_any': None,
>>>     'has_none': None,
>>>     'max_num': 3,
>>>     'min_num': 1,
>>>     'none_match': ['P'],
>>> }
>>> flags = filterflags_general_tags(tags_list, **kwargs)
>>> filtered = ut.compress(tags_list, flags)
>>> result = ('result = %s' % (ut.repr2(filtered),))
result = [['vn', 'no'], ['n', 'o'], ['n', 'N'], ['n'], ['n', 'nP']]
ibeis.tag_funcs.get_aidpair_tags(ibs, aid1_list, aid2_list, directed=True)[source]
Parameters:
  • ibs (IBEISController) – ibeis controller object
  • aid1_list (list) –
  • aid2_list (list) –
  • directed (bool) – (default = True)
Returns:

tags_list

Return type:

list

CommandLine:

python -m ibeis.tag_funcs --exec-get_aidpair_tags --db PZ_Master1 --tags Hard interesting

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.tag_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='testdb1')
>>> has_any = ut.get_argval('--tags', type_=list, default=None)
>>> min_num = ut.get_argval('--min_num', type_=int, default=1)
>>> aid_pairs = filter_aidpairs_by_tags(ibs, has_any=has_any, min_num=1)
>>> aid1_list = aid_pairs.T[0]
>>> aid2_list = aid_pairs.T[1]
>>> undirected_tags = get_aidpair_tags(ibs, aid1_list, aid2_list, directed=False)
>>> tagged_pairs = list(zip(aid_pairs.tolist(), undirected_tags))
>>> print(ut.list_str(tagged_pairs))
>>> tag_dict = ut.groupby_tags(tagged_pairs, undirected_tags)
>>> print(ut.dict_str(tag_dict, nl=2))
>>> print(ut.dict_str(ut.map_dict_vals(len, tag_dict)))
ibeis.tag_funcs.get_annot_all_tags(ibs, aid_list=None)[source]

CommandLine:

python -m ibeis.tag_funcs --exec-get_annot_all_tags --db GZ_Master1

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.tag_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='testdb1')
>>> aid_list = ibs.get_valid_aids()
>>> all_tags = ut.flatten(ibs.get_annot_all_tags(aid_list))
>>> tag_hist = ut.dict_hist(all_tags)
>>> ut.print_dict(tag_hist)
ibeis.tag_funcs.get_annot_annotmatch_tags(ibs, aid_list)[source]
Parameters:
  • ibs (IBEISController) – ibeis controller object
  • aid_list (list) – list of annotation rowids
Returns:

annotmatch_tags_list

Return type:

list

CommandLine:

python -m ibeis.tag_funcs --exec-get_annot_annotmatch_tags --db GZ_Master1

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.tag_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='testdb1')
>>> aid_list = ibs.get_valid_aids()
>>> all_tags = ut.flatten(get_annot_annotmatch_tags(ibs, aid_list))
>>> tag_hist = ut.dict_hist(all_tags)
>>> ut.print_dict(tag_hist)
ibeis.tag_funcs.get_annot_case_tags(ibs, aid_list)[source]

returns list of tags. Use instead of get_annot_tag_text

Parameters:
  • ibs (IBEISController) – ibeis controller object
  • aid_list (list) – list of annotation rowids
Returns:

tags_list

Return type:

list

CommandLine:

python -m ibeis.tag_funcs --exec-get_annot_case_tags

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.tag_funcs import *  # NOQA
>>> from ibeis.tag_funcs import _parse_note # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='testdb1')
>>> aid_list = ibs.get_valid_aids()
>>> tags_list = get_annot_case_tags(ibs, aid_list)
>>> result = ('tags_list = %s' % (str(tags_list),))
>>> print(result)
ibeis.tag_funcs.get_annot_prop(ibs, prop, aid_list)[source]

Annot tags

ibeis.tag_funcs.get_annotmatch_case_tags(ibs, annotmatch_rowids)[source]
Parameters:
Returns:

filtered_aid_list

Return type:

list

CommandLine:

python -m ibeis.tag_funcs --exec-get_annotmatch_case_tags

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.tag_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='PZ_Master1')
>>> annotmatch_rowids = ibs._get_all_annotmatch_rowids()
>>> tags_list = get_annotmatch_case_tags(ibs, annotmatch_rowids)
>>> result = ('tags_list = %s' % (str(tags_list),))
>>> print(result)
tags_list = [[u'occlusion', u'pose', 'Hard', 'NonDistinct'], [], ['Hard']]
ibeis.tag_funcs.get_annotmatch_other_prop(ibs, prop, annotmatch_rowids)[source]
ibeis.tag_funcs.get_annotmatch_prop(ibs, prop, annotmatch_rowids)[source]

hacky getter for dynamic properties of annotmatches using notes table

Parameters:
  • prop (str) –
  • annotmatch_rowids
Returns:

filtered_aid_list

Return type:

list

CommandLine:

python -m ibeis.tag_funcs --exec-get_annotmatch_prop

Example

>>> # DISABLE_DOCTEST
>>> # Test setting and getting standard keys
>>> from ibeis.tag_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='testdb1')
>>> prop = 'hard'
>>> annotmatch_rowids = ibs._get_all_annotmatch_rowids()
>>> flag_list = get_annotmatch_prop(ibs, prop, annotmatch_rowids)
>>> flag_list = ('filtered_aid_list = %s' % (str(flag_list),))
>>> subset_rowids = annotmatch_rowids[::2]
>>> set_annotmatch_prop(ibs, prop, subset_rowids, [True] * len(subset_rowids))
>>> flag_list2 = get_annotmatch_prop(ibs, prop, annotmatch_rowids)
>>> print('flag_list2 = %r' % (flag_list2,))

Example

>>> # DISABLE_DOCTEST
>>> # Test setting and getting non-standard keys
>>> from ibeis.tag_funcs import *  # NOQA
>>> import ibeis
>>> ibs = ibeis.opendb(defaultdb='testdb1')
>>> prop = 'occlusion'
>>> annotmatch_rowids = ibs._get_all_annotmatch_rowids()
>>> flag_list = get_annotmatch_prop(ibs, prop, annotmatch_rowids)
>>> flag_list = ('filtered_aid_list = %s' % (str(flag_list),))
>>> subset_rowids = annotmatch_rowids[1::2]
>>> subset_rowids1 = annotmatch_rowids[::2]
>>> set_annotmatch_prop(ibs, prop, subset_rowids1, [True] * len(subset_rowids))
>>> set_annotmatch_prop(ibs, 'pose', subset_rowids1, [True] * len(subset_rowids))
>>> flag_list2 = get_annotmatch_prop(ibs, prop, annotmatch_rowids)
>>> print('flag_list2 = %r' % (flag_list2,))
ibeis.tag_funcs.get_annotmatch_standard_prop(ibs, prop, annotmatch_rowids)[source]
ibeis.tag_funcs.get_available_annot_tags()[source]
ibeis.tag_funcs.get_cate_categories()[source]
ibeis.tag_funcs.get_tags_in_textformat(prop, text_list)[source]

general text tag getter hack

ibeis.tag_funcs.rename_and_reduce_tags(ibs, annotmatch_rowids)[source]

Script to update tags to newest values

CommandLine:

python -m ibeis.tag_funcs --exec-rename_and_reduce_tags --db PZ_Master1

Example

>>> from ibeis.tag_funcs import *  # NOQA
>>> import ibeis
>>> #ibs = ibeis.opendb(defaultdb='PZ_Master1')
>>> ibs = ibeis.opendb(defaultdb='testdb1')
>>> annotmatch_rowids = filter_annotmatch_by_tags(ibs, min_num=1)
>>> rename_and_reduce_tags(ibs, annotmatch_rowids)
ibeis.tag_funcs.set_annot_prop(ibs, prop, aid_list, flags)[source]

sets nonstandard properties using the notes column

http://localhost:5000/group_review/?aid_list=1,2,3,4

ibeis.tag_funcs.set_annotmatch_other_prop(ibs, prop, annotmatch_rowids, flags)[source]

sets nonstandard properties using the notes column

ibeis.tag_funcs.set_annotmatch_prop(ibs, prop, annotmatch_rowids, flags)[source]

hacky setter for dynamic properties of annotmatches using notes table

ibeis.tag_funcs.set_tags_in_textformat(prop, text_list, flags)[source]

general text tag setter hack

ibeis.workspace module

ibeis.workspace.chip_tester()[source]
ibeis.workspace.choose_exemplars()[source]
ibeis.workspace.detect_merges()[source]
ibeis.workspace.detect_photobombs()[source]
ibeis.workspace.detect_splits()[source]
ibeis.workspace.dummy_cut_example()[source]

CommandLine:

python -m ibeis.workflow --exec-dummy_cut_example --show

Example

>>> # DISABLE_DOCTEST
>>> from ibeis.workflow import *  # NOQA
>>> result = dummy_cut_example()
>>> print(result)
>>> ut.quit_if_noshow()
>>> import plottool as pt
>>> ut.show_if_requested()
ibeis.workspace.dummy_multicut()[source]
ibeis.workspace.find_most_disitnctive_keypoints()[source]

CommandLine:

python -m ibeis.workflow --exec-find_most_disitnctive_keypoints --show

Example

>>> # ENABLE_DOCTEST
>>> from ibeis.workflow import *  # NOQA
>>> find_most_disitnctive_keypoints()
ibeis.workspace.intra_encounter_matching()[source]
ibeis.workspace.segmentation_example()[source]
ibeis.workspace.test_sharpness()[source]
ibeis.workspace.testdata_workflow(defaltdb=u'PZ_MTEST', t=[u'default'], a=[u'defualt'])[source]
ibeis.workspace.vs_exemplar_matching()[source]

Module contents

IBEIS: main package init

TODO: LAZY IMPORTS?
http://code.activestate.com/recipes/473888-lazy-module-imports/
ibeis.import_subs()[source]
ibeis.reload_subs(verbose=True)[source]

Reloads ibeis and submodules

ibeis.rrrr(verbose=True)

Reloads ibeis and submodules

ibeis.run_experiment(e=u'print', db=u'PZ_MTEST', a=[u'unctrl'], t=[u'default'], initial_aids=None, qaid_override=None, daid_override=None, lazy=False, **kwargs)[source]

Convience function

CommandLine:

ibeis -e print
Parameters:
  • e (str) – (default = ‘print’)
  • db (str) – (default = ‘PZ_MTEST’)
  • a (list) – (default = [‘unctrl’])
  • t (list) – (default = [‘default’])
  • qaid_override (None) – (default = None)
  • lazy (bool) – (default = False)
Returns:

func - live python function

Return type:

function

CommandLine:

python -m ibeis.__init__ --exec-run_experiment --show

Example

>>> # DISABLE_DOCTEST
>>> from ibeis import *  # NOQA
>>> e = 'rank_cdf'
>>> db = 'testdb1'
>>> a = ['default:species=primary']
>>> t = ['default']
>>> initial_aids = [2, 3, 4, 7, 9, 10, 11]
>>> qaid_override = [1, 9, 10, 11, 2, 3]
>>> testres = run_experiment(e, db, a, t, qaid_override=qaid_override,
>>>                          initial_aids=initial_aids)
>>> result = ('testres = %s' % (str(testres),))
>>> print(result)
>>> ut.quit_if_noshow()
>>> testres.draw_func()
>>> ut.show_if_requested()