当前位置: 首页>>代码示例>>Python>>正文


Python utool.inject函数代码示例

本文整理汇总了Python中utool.inject函数的典型用法代码示例。如果您正苦于以下问题:Python inject函数的具体用法?Python inject怎么用?Python inject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了inject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: plot_keypoint_scales

# flake8: noqa
from __future__ import absolute_import, division, print_function
import numpy as np
from plottool import draw_func2 as df2
from vtool import keypoint as ktool
from utool import util_latex
from ibeis.model import Config
import utool
print, print_, printDBG, rrr, profile = utool.inject(__name__, '[devport]', DEBUG=False)


def plot_keypoint_scales(hs, fnum=1):
    print('[dev] plot_keypoint_scales()')
    cx2_kpts = hs.feats.cx2_kpts
    if len(cx2_kpts) == 0:
        hs.refresh_features()
        cx2_kpts = hs.feats.cx2_kpts
    cx2_nFeats = map(len, cx2_kpts)
    kpts = np.vstack(cx2_kpts)
    print('[dev] --- LaTeX --- ')
    _printopts = np.get_printoptions()
    np.set_printoptions(precision=3)
    print(util_latex.latex_scalar(r'\# keypoints, ', len(kpts)))
    print(util_latex.latex_mystats(r'\# keypoints per image', cx2_nFeats))
    scales = ktool.get_scales(kpts)
    scales = np.array(sorted(scales))
    print(util_latex.latex_mystats(r'keypoint scale', scales))
    np.set_printoptions(**_printopts)
    print('[dev] ---/LaTeX --- ')
    #
    df2.figure(fnum=fnum, docla=True, title='sorted scales')
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:dev_port.py

示例2: reload_subs

### __init__.py ###
# flake8: noqa
from __future__ import absolute_import, division, print_function

import utool as ut

ut.noinject(__name__, "[ibeis.control.__init__]", DEBUG=False)


from ibeis.control import DB_SCHEMA
from ibeis.control import IBEISControl
from ibeis.control import _sql_helpers
from ibeis.control import accessor_decors
import utool

print, print_, printDBG, rrr, profile = utool.inject(__name__, "[ibeis.control]")


def reload_subs(verbose=True):
    """ Reloads ibeis.control and submodules """
    rrr(verbose=verbose)
    getattr(DB_SCHEMA, "rrr", lambda verbose: None)(verbose=verbose)
    getattr(IBEISControl, "rrr", lambda verbose: None)(verbose=verbose)
    getattr(SQLDatabaseControl, "rrr", lambda verbose: None)(verbose=verbose)
    getattr(_sql_helpers, "rrr", lambda verbose: None)(verbose=verbose)
    getattr(accessor_decors, "rrr", lambda verbose: None)(verbose=verbose)
    rrr(verbose=verbose)


rrrr = reload_subs
开发者ID:Erotemic,项目名称:ibeis,代码行数:30,代码来源:__init__.py

示例3: ColumnListTableView

# DEPRICATE?
from __future__ import absolute_import, division, print_function
from guitool.__PYQT__ import QtCore, QtGui
from guitool.__PYQT__.QtCore import Qt
from guitool.guitool_delegates import ComboDelegate, ButtonDelegate
from guitool import qtype
from six.moves import range, map
import utool

(print, print_, printDBG, rrr, profile) = utool.inject(__name__, "[guitbls]", DEBUG=False)


class ColumnListTableView(QtGui.QTableView):
    """ Table View for an AbstractItemModel """

    def __init__(view, *args, **kwargs):
        super(ColumnListTableView, view).__init__(*args, **kwargs)
        view.setSortingEnabled(True)
        view.vertical_header = view.verticalHeader()
        view.vertical_header.setVisible(True)
        # view.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        view.resizeColumnsToContents()

    @QtCore.pyqtSlot()
    def cellButtonClicked(self):
        print(self.sender())
        print(self.sender().text())


class ColumnListItemModel(QtCore.QAbstractTableModel):
    """ Item model for displaying a list of columns """
开发者ID:Erotemic,项目名称:guitool,代码行数:31,代码来源:guitool_tables.py

示例4: default_interact_qres_params

from six.moves import range
import functools
import six
from collections import OrderedDict as odict
import utool as ut
import vtool as vt
from plottool import interact_helpers as ih
from plottool import plot_helpers as ph
import matplotlib as mpl
import plottool.draw_func2 as df2
from ibeis import ibsfuncs
from ibeis.viz import viz_helpers as vh
from ibeis.viz import viz_matches
from ibeis.viz.interact.interact_sver import ishow_sver

(print, print_, printDBG, rrr, profile) = ut.inject(
    __name__, '[interact_qres2]')


BREAK_MATCH_PREF = 'break match'
NEW_MATCH_PREF   = 'new match'
RENAME1_PREF     = 'rename query: '
RENAME2_PREF     = 'rename result: '


def default_interact_qres_params():
    params = {
        'fnum'               : 512,
        'nPerPage'           : 6,
        'ranks_lt'           : 3,
        'on_change_callback' : None
    }
开发者ID:heroinlin,项目名称:ibeis,代码行数:32,代码来源:interact_qres2.py

示例5: TEST_GUI_ALL

#!/usr/bin/env python2.7
# TODO: ADD COPYRIGHT TAG
from __future__ import absolute_import, division, print_function
import multiprocessing
import utool
import numpy as np
from ibeis.dev import sysres
from vtool.tests import grabdata
import ibeis
print, print_, printDBG, rrr, profile = utool.inject(__name__, '[TEST_GUI_ALL]')
np.tau = 2 * np.pi


def TEST_GUI_ALL(ibs, back, gpath_list):
    """
    Creates a new database
    Adds test images
    Creates dummy ANNOTATIONS
    Selects things
    """
    # DELETE OLD
    print('[TEST] DELETE_OLD_DATABASE')
    work_dir   = sysres.get_workdir()
    new_dbname = 'testdb_guiall'
    new_dbdir = utool.truepath(utool.join(work_dir, new_dbname))
    ibs_dbdir = utool.truepath(ibs.dbdir)
    msg = 'must start in different dir new_dbdir=%r != ibs_dbdir=%r,' % (new_dbdir, ibs_dbdir)
    assert new_dbdir != ibs_dbdir, msg
    print('passed: ' + msg)
    utool.delete(new_dbdir, ignore_errors=False)
    #
开发者ID:byteyoo,项目名称:ibeis,代码行数:31,代码来源:test_gui_all.py

示例6: build_name_context_options

"""
from __future__ import absolute_import, division, print_function
import numpy as np
import utool as ut
from six.moves import zip
from plottool import interact_helpers as ih
import functools
import plottool as pt
from ibeis import viz
from ibeis import constants as const
from ibeis.viz import viz_helpers as vh
from ibeis.other import ibsfuncs
from ibeis.viz import viz_chip
from plottool.abstract_interaction import AbstractInteraction
(print, print_, printDBG, rrr, profile) = ut.inject(__name__, '[interact_name]', DEBUG=False)


#==========================
# Name Interaction
#==========================

MAX_COLS = 3


def build_name_context_options(ibs, nids):
    callback_list = []
    from ibeis.viz import viz_graph
    callback_list.append(
        ('Interact name graph', functools.partial(viz_graph.make_name_graph_interaction, ibs, nids=nids)),
    )
开发者ID:Erotemic,项目名称:ibeis,代码行数:30,代码来源:interact_name.py

示例7:

from __future__ import absolute_import, division, print_function
import utool
from ibeis import constants
#from itertools import izip
(print, print_, printDBG, rrr, profile) = utool.inject(__name__, '[headers]', DEBUG=False)

ENCOUNTER_TABLE  = 'encounters'
IMAGE_TABLE      = 'images'
IMAGE_GRID       = 'image_grid'
ANNOTATION_TABLE = 'annotations'
NAME_TABLE       = 'names'
NAMES_TREE       = 'names_tree'
QRES_TABLE       = 'qres'
THUMB_TABLE      = 'thumbs'

#-----------------
# Define the tables
#-----------------

# available tables
TABLENAME_LIST = [
    IMAGE_TABLE,
    ANNOTATION_TABLE,
    #NAME_TABLE,
    ENCOUNTER_TABLE,
    IMAGE_GRID,
    THUMB_TABLE,
    NAMES_TREE
]

# table nice names
开发者ID:byteyoo,项目名称:ibeis,代码行数:31,代码来源:guiheaders.py

示例8:

import plottool as pt
import ibeis
if __name__ == '__main__':
    multiprocessing.freeze_support()
    ibeis._preload()
    #from ibeis.all_imports import *  # NOQA
#utool.util_importer.dynamic_import(__name__, ('_devcmds_ibeis', None),
#                                   developing=True)
from ibeis._devcmds_ibeis import *  # NOQA
# IBEIS
from ibeis.init import main_helpers  # NOQA
from ibeis.other import dbinfo  # NOQA
from ibeis.expt import experiment_configs  # NOQA
from ibeis.expt import harness  # NOQA
from ibeis import params  # NOQA
print, print_, printDBG, rrr, profile = utool.inject(__name__, '[dev]')


#------------------
# DEV DEVELOPMENT
#------------------
# This is where you write all of the functions that will become pristine
# and then go in _devcmds_ibeis.py


"""
./dev.py -e print_results --db PZ_Master1 -a varysize_pzm:dper_name=[1,2],dsize=1500 -t candidacy_k:K=1 --intersect_hack
./dev.py -e draw_rank_cdf -t baseline -a baseline --show --db PZ_Master1
./dev.py -e get_dbinfo --db PZ_Master1 --aid_list=baseline
./dev.py -e get_dbinfo --db PZ_MTEST
./dev.py -e get_dbinfo --db PZ_Master1 --aid_list=baseline --hackshow-unixtime --show
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:dev.py

示例9: timeit2

#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# TODO: ADD COPYRIGHT TAG
from __future__ import absolute_import, division, print_function
# Python
import multiprocessing
# Tools
import utool
from functools import partial
print, print_, printDBG, rrr, profile = utool.inject(__name__,
                                                     '[TIME_GEN_PREPROC]')


def timeit2(stmt, setup='', number=1000):
    import timeit
    stmt_ = utool.unindent(stmt)
    setup_ = utool.unindent(setup)
    print('----------')
    print('TIMEIT: \n' + stmt_)
    try:
        total_time = timeit.timeit(stmt_, setup_, number=number)
    except Exception as ex:
        utool.printex(ex, iswarning=False)
        raise
    print(' * timed: %r seconds' % (total_time))


@profile
def TIME_GEN_PREPROC_IMG(ibs):
    from ibeis.algo.preproc.preproc_image import add_images_params_gen
    print('[TIME_GEN_PREPROC_IMG]')
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:time_generate_preproc_image.py

示例10: fix_compname_configs

# developer convenience functions for ibs
from __future__ import absolute_import, division, print_function
import utool
from six.moves import zip
from itertools import izip
from ibeis import constants
from ibeis.dev import ibsfuncs

# Inject utool functions
(print, print_, printDBG, rrr, profile) = utool.inject(__name__, '[duct_tape]', DEBUG=False)


def fix_compname_configs(ibs):
    """ duct tape to keep version in check """
    #ibs.MANUAL_CONFIG_SUFFIX = '_MANUAL_'  #+ utool.get_computer_name()
    #ibs.MANUAL_CONFIGID = ibs.add_config(ibs.MANUAL_CONFIG_SUFFIX)
    # We need to fix the manual config suffix to not use computer names anymore

    configid_list = ibs.get_valid_configids()
    cfgsuffix_list = ibs.get_config_suffixes(configid_list)

    ibs.MANUAL_CONFIG_SUFFIX = 'MANUAL_CONFIG'
    ibs.MANUAL_CONFIGID = ibs.add_config(ibs.MANUAL_CONFIG_SUFFIX)

    for rowid, suffix in filter(lambda tup:
                                tup[1].startswith('_MANUAL_'),
                                izip(configid_list, cfgsuffix_list)):
        print("EVALUATING: %r, %r" % (rowid, suffix))
        # Fix the tables with bad config_rowids
        ibs.db.executeone(
            '''
开发者ID:byteyoo,项目名称:ibeis,代码行数:31,代码来源:duct_tape.py

示例11: show_chip

from __future__ import absolute_import, division, print_function
import utool
import plottool.draw_func2 as df2
from plottool.viz_keypoints import _annotate_kpts
from plottool import viz_image2
from . import viz_helpers as vh
from . import viz_image
(print, print_, printDBG, rrr, profile) = utool.inject(__name__, '[viz_chip]',
                                                       DEBUG=False)


@utool.indent_func
def show_chip(ibs, aid, in_image=False, annote=True, **kwargs):
    """ Driver function to show chips """
    printDBG('[viz] show_chip()')
    vh.ibsfuncs.assert_valid_aids(ibs, (aid,))
    #utool.embed()
    # Get chip
    chip = vh.get_chips(ibs, aid, in_image, **kwargs)
    # Create chip title
    chip_text = vh.get_annot_texts(ibs, [aid], **kwargs)[0]
    # Draw chip
    fig, ax = df2.imshow(chip, **kwargs)
    # Populate axis user data
    vh.set_ibsdat(ax, 'viztype', 'chip')
    vh.set_ibsdat(ax, 'aid', aid)
    if annote and not kwargs.get('nokpts', False):
        # Get and draw keypoints
        kpts = vh.get_kpts(ibs, aid, in_image, **kwargs)
        _annotate_kpts(kpts, **kwargs)
    df2.upperleft_text(chip_text, color=kwargs.get('text_color', None))
开发者ID:byteyoo,项目名称:ibeis,代码行数:31,代码来源:viz_chip.py

示例12: TEST_HOTS_SPLITTREE

#!/usr/bin/env python2.7
# TODO: ADD COPYRIGHT TAG
from __future__ import absolute_import, division, print_function
# Python
import multiprocessing
# Tools
import utool
print, print_, printDBG, rrr, profile = utool.inject(__name__, '[TEST_HOTS_SPLITTREE]')


def TEST_HOTS_SPLITTREE(ibs):
    from ibeis.model.hots.hots_nn_index import NNSplitIndex
    num_forests = 8
    daid_list = ibs.get_valid_aids()
    num_neighbors = 3
    qfx2_desc = ibs.get_annot_desc(daid_list[2])

    split_index = NNSplitIndex(ibs, daid_list, num_forests=num_forests)

    #nid_list  = ibs.get_annot_nids(aid_list)
    ##flag_list = ibs.get_annot_exemplar_flag(aid_list)
    #nid2_aids = utool.group_items(aid_list, nid_list)
    #key_list = nid2_aids.keys()
    #val_list = nid2_aids.values()
    #isunknown_list = ibs.is_nid_unknown(key_list)

    #num_forests = 8
    ## Put one name per forest
    #forest_aids, overflow_aids = utool.sample_zip(val_list, num_forests, allow_overflow=True)

    #forest_indexes = []
开发者ID:byteyoo,项目名称:ibeis,代码行数:31,代码来源:test_hots_split_trees.py

示例13: plot_rank_stem

#flake8:noqa
from __future__ import absolute_import, division, print_function
from os.path import join
from plottool import draw_func2 as df2
import numpy as np
import os
import utool
print, print_, printDBG, rrr, profile = utool.inject(__name__, '[viz_allres]', DEBUG=False)
# Global variables
BROWSE = True
DUMP = False
FIGNUM = 1


def plot_rank_stem(allres, orgres_type='true'):
    print('[viz] plotting rank stem')
    # Visualize rankings with the stem plot
    ibs = allres.ibs
    title = orgres_type + 'rankings stem plot\n' + allres.title_suffix
    orgres = allres.__dict__[orgres_type]
    df2.figure(fnum=FIGNUM, doclf=True, title=title)
    x_data = orgres.qcxs
    y_data = orgres.ranks
    df2.draw_stems(x_data, y_data)
    slice_num = int(np.ceil(np.log10(len(orgres.qcxs))))
    df2.set_xticks(ibs.test_sample_cx[::slice_num])
    df2.set_xlabel('query chip indeX (qcx)')
    df2.set_ylabel('groundtruth chip ranks')
    #df2.set_yticks(list(seen_ranks))
    __dump_or_browse(allres.ibs, 'rankviz')
开发者ID:byteyoo,项目名称:ibeis,代码行数:30,代码来源:viz_allres.py

示例14: reload_subs

# flake8: noqa
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
ut.noinject(__name__, '[ibeis.algo.preproc.__init__]', DEBUG=False)

from ibeis.algo.preproc import preproc_chip
from ibeis.algo.preproc import preproc_detectimg
from ibeis.algo.preproc import preproc_encounter
from ibeis.algo.preproc import preproc_feat
from ibeis.algo.preproc import preproc_featweight
from ibeis.algo.preproc import preproc_image
from ibeis.algo.preproc import preproc_probchip
from ibeis.algo.preproc import preproc_residual
from ibeis.algo.preproc import preproc_rvec
import utool
print, print_, printDBG, rrr, profile = utool.inject(
    __name__, '[ibeis.algo.preproc]')


def reload_subs(verbose=True):
    """ Reloads ibeis.algo.preproc and submodules """
    rrr(verbose=verbose)
    def fbrrr(*args, **kwargs):
        """ fallback reload """
        pass
    #getattr(preproc_annot, 'rrr', fbrrr)(verbose=verbose)
    getattr(preproc_chip, 'rrr', fbrrr)(verbose=verbose)
    getattr(preproc_detectimg, 'rrr', fbrrr)(verbose=verbose)
    getattr(preproc_encounter, 'rrr', fbrrr)(verbose=verbose)
    getattr(preproc_feat, 'rrr', fbrrr)(verbose=verbose)
    getattr(preproc_featweight, 'rrr', fbrrr)(verbose=verbose)
    getattr(preproc_image, 'rrr', fbrrr)(verbose=verbose)
开发者ID:heroinlin,项目名称:ibeis,代码行数:32,代码来源:__init__.py

示例15: get_hsdb_image_gpaths

#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""
Converts an IBEIS database to a hotspotter db
"""
# TODO: ADD COPYRIGHT TAG
from __future__ import absolute_import, division, print_function
from six.moves import map
from os.path import join, relpath

# import ibeis
import utool as ut

print, print_, printDBG, rrr, profile = ut.inject(__name__, "[export_hsdb]")


def get_hsdb_image_gpaths(ibs, gid_list):
    r"""
    Args:
        ibs (IBEISController):  ibeis controller object
        gid_list (list):

    Returns:
        list: gpath_list

    CommandLine:
        python -m ibeis.dbio.export_hsdb --test-get_hsdb_image_gpaths

    Example:
        >>> # ENABLE_DOCTEST
        >>> from ibeis.dbio.export_hsdb import *  # NOQA
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:export_hsdb.py


注:本文中的utool.inject函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。