本文整理汇总了Python中utool.inject2函数的典型用法代码示例。如果您正苦于以下问题:Python inject2函数的具体用法?Python inject2怎么用?Python inject2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了inject2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_query_components
# -*- coding: utf-8 -*-
# TODO: ADD COPYRIGHT TAG
# TODO: Restructure
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import utool as ut
from six.moves import zip, range, map
print, rrr, profile = ut.inject2(__name__, '[query_helpers]')
def get_query_components(ibs, qaids):
r"""
Args:
ibs (IBEISController): ibeis controller object
qaids (?):
Returns:
?:
CommandLine:
python -m ibeis.algo.hots.query_helpers --test-get_query_components
Example:
>>> # DISABLE_DOCTEST
>>> from ibeis.algo.hots.query_helpers import * # NOQA
>>> import ibeis
>>> # build test data
>>> ibs = ibeis.opendb('testdb1')
>>> qaids = ibs.get_valid_aids()
>>> # execute function
>>> result = get_query_components(ibs, qaids)
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:query_helpers.py
示例2:
# -*- coding: utf-8 -*-
# flake8: noqa
from __future__ import absolute_import, division, print_function
import utool
(print, rrr, profile) = utool.inject2(__name__, '[web]')
from ibeis.web import apis_detect
from ibeis.web import apis_engine
from ibeis.web import apis_json
from ibeis.web import apis_query
from ibeis.web import apis
from ibeis.web import app
from ibeis.web import appfuncs
from ibeis.web import routes_ajax
from ibeis.web import routes_csv
from ibeis.web import routes_submit
from ibeis.web import routes
开发者ID:Erotemic,项目名称:ibeis,代码行数:17,代码来源:__init__.py
示例3: add_contributors
"""
controller functions for contributors, versions, configs, and other metadata
"""
from __future__ import absolute_import, division, print_function
#import uuid
import six # NOQA
#from os.path import join
import functools
from six.moves import range, input, zip, map # NOQA
from ibeis import constants as const
from ibeis.control import accessor_decors, controller_inject
import utool as ut
from ibeis.algo import Config
#from ibeis import ibsfuncs
from ibeis.control.controller_inject import make_ibs_register_decorator
print, print_, profile = ut.inject2(__name__, '[manual_meta]')
CLASS_INJECT_KEY, register_ibs_method = make_ibs_register_decorator(__name__)
register_api = controller_inject.get_ibeis_flask_api(__name__)
register_route = controller_inject.get_ibeis_flask_route(__name__)
@register_ibs_method
@accessor_decors.adder
@register_api('/api/contributor/', methods=['POST'])
def add_contributors(ibs, tag_list, uuid_list=None, name_first_list=None, name_last_list=None,
loc_city_list=None, loc_state_list=None,
loc_country_list=None, loc_zip_list=None,
开发者ID:heroinlin,项目名称:ibeis,代码行数:31,代码来源:manual_meta_funcs.py
示例4: parse_exif
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from PIL import Image
from os.path import splitext, basename
import warnings # NOQA
import vtool.exif as vtexif
import utool as ut
#import numpy as np # NOQA
#import hashlib
#import uuid
(print, rrr, profile) = ut.inject2(__name__, '[preproc_img]', DEBUG=False)
#@profile
def parse_exif(pil_img):
""" Image EXIF helper
Cyth::
cdef:
Image pil_img
dict exif_dict
long lat
long lon
long exiftime
"""
exif_dict = vtexif.get_exif_dict(pil_img)
# TODO: More tags
# (mainly the orientation tag)
lat, lon = vtexif.get_lat_lon(exif_dict)
time = vtexif.get_unixtime(exif_dict)
return time, lat, lon
开发者ID:heroinlin,项目名称:ibeis,代码行数:31,代码来源:preproc_image.py
示例5: testdata_pipecfg
# -*- coding: utf-8 -*-
"""
This module defines helper functions to access common input needed to test many
functions. These functions give a rich command line interface to specifically
select subsets of annotations, pipeline configurations, and other filters.
TODO: standardize function signatures
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
import six # NOQA
from ibeis.init import old_main_helpers
(print, rrr, profile) = ut.inject2(__name__, '[main_helpers]')
# DEPRICATE
get_test_daids = old_main_helpers.get_test_daids
get_test_qaids = old_main_helpers.get_test_qaids
VERB_TESTDATA, VERYVERB_TESTDATA = ut.get_verbflag('testdata', 'td')
VERYVERB_MAIN_HELPERS = VERYVERB_TESTDATA
VERB_MAIN_HELPERS = VERB_TESTDATA
#VERB_TESTDATA = ut.get_argflag(('--verbose-testdata', '--verbtd')) or VERYVERB_TESTDATA
#VERB_MAIN_HELPERS = ut.get_argflag(('--verbose-main-helpers', '--verbmhelp'))
#or ut.VERBOSE or VERB_TESTDATA
def testdata_pipecfg(p=None, t=None):
r"""
Returns:
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:main_helpers.py
示例6:
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import six
from six.moves import zip, map
import numpy as np
import vtool as vt
import utool as ut
from ibeis.control import controller_inject
print, rrr, profile = ut.inject2(__name__, '[tag_funcs]')
# Create dectorator to inject functions in this module into the IBEISController
CLASS_INJECT_KEY, register_ibs_method = controller_inject.make_ibs_register_decorator(
__name__)
# TODO : make a annot_tags file
ANNOTMATCH_PROPS_STANDARD = [
#'SceneryMatch',
#'Photobomb',
#'Hard',
#'NonDistinct',
]
ANNOTMATCH_PROPS_OTHER = [
'SceneryMatch',
'Photobomb',
'Hard',
'NonDistinct',
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:tag_funcs.py
示例7: oracle_method1
# -*- coding: utf-8 -*-
"""
module for making the correct automatic decisions in incremental tests
"""
from __future__ import absolute_import, division, print_function
import numpy as np
import utool as ut
print, rrr, profile = ut.inject2(__name__, '[incoracle]')
@profile
def oracle_method1(ibs_gt, ibs, qnid1, aid_list2, aid2_to_aid1, sorted_nids, MAX_LOOK):
""" METHOD 1: MAKE BEST DECISION FROM GIVEN INFORMATION """
# Map annotations to ibs_gt annotation rowids
sorted_nids = np.array(sorted_nids)
aid_list1 = ut.dict_take_list(aid2_to_aid1, aid_list2)
nid_list1 = np.array(ibs_gt.get_annot_name_rowids(aid_list1))
# Using ibs_gt nameids find the correct index in returned results
correct_rank = np.where(nid_list1 == qnid1)[0]
correct_rank = correct_rank[correct_rank < MAX_LOOK]
# Return a list of any number of correct names or empty if it is a new name
nid_list2 = sorted_nids[correct_rank]
chosen_names = ibs.get_name_texts(nid_list2)
return chosen_names
@profile
def oracle_method2(ibs_gt, qnid1):
""" METHOD 2: MAKE THE ABSOLUTE CORRECT DECISION REGARDLESS OF RESULT """
# use the name from the groundruth database
name2 = ibs_gt.get_name_texts(qnid1)
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:automated_oracle.py
示例8: converter
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import utool
from ibeis.control import SQLDatabaseControl
from os.path import join
from functools import partial
print, rrr, profile = utool.inject2(__name__, '[TEST_SQL_CONTROL]')
import random
###########################
def converter(val):
return str(val) + '_str'
def get_rowid_from_text(db, text_list):
param_iter = ((text,) for text in text_list)
return db.get_rowid_from_superkey('test', param_iter, superkey_colnames=('test_text',))
def add_text(db, text_list):
param_iter = ((text,) for text in text_list)
func = partial(get_rowid_from_text, db)
return db.add_cleanly('test', ('test_text',), param_iter, func)
def get_text(db, tablename, rowid_list):
return db.get(tablename, ('test_text',), rowid_list)
开发者ID:Erotemic,项目名称:ibeis,代码行数:30,代码来源:test_sql_modify.py
示例9: compare_string_versions
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from os.path import split, splitext, join, exists
import datetime
import distutils
import utool as ut
(print, rrr, profile) = ut.inject2(__name__, '[sql-helpers]')
# =======================
# Helper Functions
# =======================
VERBOSE_SQL = ut.get_argflag(('--print-sql', '--verbose-sql', '--verb-sql', '--verbsql'))
#AUTODUMP = ut.get_argflag('--auto-dump')
NOT_QUIET = not (ut.QUIET or ut.get_argflag('--quiet-sql'))
def compare_string_versions(a, b):
"""
Example:
>>> # ENABLE_DOCTEST
>>> from ibeis.control._sql_helpers import * # NOQA
>>> a = '1.1.1'
>>> b = '1.0.0'
>>> result1 = compare_string_versions(a, b)
>>> result2 = compare_string_versions(b, a)
>>> result3 = compare_string_versions(a, a)
>>> result = ', '.join(map(str, [result1, result2, result3]))
>>> print(result)
1, -1, 0
"""
va = distutils.version.LooseVersion(a)
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:_sql_helpers.py
示例10: detect_gid_list
# -*- coding: utf-8 -*-
"""
Interface to pydarknet yolo object detection.
"""
from __future__ import absolute_import, division, print_function
import utool as ut
import vtool as vt
from six.moves import zip
(print, rrr, profile) = ut.inject2(__name__, '[yolo]')
if not ut.get_argflag('--no-pydarknet'):
try:
import pydarknet
except ImportError as ex:
if ut.SUPER_STRICT:
print('WARNING Failed to import pydarknet. '
'PyDarknet YOLO detection is unavailable')
raise
VERBOSE_DARK = ut.get_argflag('--verbdark') or ut.VERBOSE
# def train_gid_list(ibs, gid_list, trees_path=None, species=None, setup=True,
def detect_gid_list(ibs, gid_list, downsample=False, **kwargs):
"""
Args:
gid_list (list of int): the list of IBEIS image_rowids that need detection
downsample (bool, optional): a flag to indicate if the original image
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:yolo.py
示例11: reassign_submodule_attributes
# -*- coding: utf-8 -*-
# Autogenerated on 13:37:34 2015/12/30
# flake8: noqa
from __future__ import absolute_import, division, print_function, unicode_literals
from ibeis.algo import Config
from ibeis.algo import detect
from ibeis.algo import hots
from ibeis.algo import preproc
import utool
print, rrr, profile = utool.inject2(__name__, '[ibeis.algo]')
def reassign_submodule_attributes(verbose=True):
"""
why reloading all the modules doesnt do this I don't know
"""
import sys
if verbose and '--quiet' not in sys.argv:
print('dev reimport')
# Self import
import ibeis.algo
# Implicit reassignment.
seen_ = set([])
for tup in IMPORT_TUPLES:
if len(tup) > 2 and tup[2]:
continue # dont import package names
submodname, fromimports = tup[0:2]
submod = getattr(ibeis.algo, submodname)
for attr in dir(submod):
if attr.startswith('_'):
continue
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:__init__.py
示例12: get_ibeis_resource_dir
sysres.py == system_resources
Module for dealing with system resoureces in the context of IBEIS
but without the need for an actual IBEIS Controller
"""
from __future__ import absolute_import, division, print_function
import os
from os.path import exists, join, realpath
import utool as ut
from six.moves import input, zip, map
from utool import util_cache, util_list
from ibeis import constants as const
from ibeis import params
# Inject utool functions
(print, rrr, profile) = ut.inject2(__name__, '[sysres]')
WORKDIR_CACHEID = 'work_directory_cache_id'
DEFAULTDB_CAHCEID = 'cached_dbdir'
LOGDIR_CACHEID = ut.logdir_cacheid
__APPNAME__ = 'ibeis'
def get_ibeis_resource_dir():
return ut.ensure_app_resource_dir('ibeis')
def _ibeis_cache_dump():
util_cache.global_cache_dump(appname=__APPNAME__)
开发者ID:heroinlin,项目名称:ibeis,代码行数:29,代码来源:sysres.py
示例13: testdata_vocab
from __future__ import absolute_import, division, print_function, unicode_literals
# from six.moves import zip
import dtool
import utool as ut
import vtool as vt
import six
import pyflann
import numpy as np
# import cv2
from ibeis.control.controller_inject import register_preprocs, register_subprops
(print, rrr, profile) = ut.inject2(__name__, '[new_annots]')
derived_attribute = register_preprocs['annot']
register_subprop = register_subprops['annot']
# dtool.Config.register_func = derived_attribute
@ut.memoize
def testdata_vocab():
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 = compute_vocab(depc, fid_list, config)
return ibs, aid_list, vocab
@six.add_metaclass(ut.ReloadingMetaclass)
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:new_annots.py
示例14: reload_subs
# }
#}
#)
from ibeis.init import main_helpers
testdata_cm = main_helpers.testdata_cm
testdata_cmlist = main_helpers.testdata_cmlist
testdata_qreq_ = main_helpers.testdata_qreq_
testdata_pipecfg = main_helpers.testdata_pipecfg
testdata_filtcfg = main_helpers.testdata_filtcfg
testdata_expts = main_helpers.testdata_expts
testdata_expanded_aids = main_helpers.testdata_expanded_aids
testdata_aids = main_helpers.testdata_aids
# Utool generated init makeinit.py
print, rrr, profile = ut.inject2(__name__, '[ibeis]')
def reload_subs(verbose=True):
""" Reloads ibeis and submodules """
import_subs()
rrr(verbose=verbose)
getattr(constants, 'rrr', lambda verbose: None)(verbose=verbose)
getattr(ibsfuncs, 'rrr', lambda verbose: None)(verbose=verbose)
getattr(main_module, 'rrr', lambda verbose: None)(verbose=verbose)
getattr(params, 'rrr', lambda verbose: None)(verbose=verbose)
getattr(other, 'reload_subs', lambda verbose: None)(verbose=verbose)
getattr(dbio, 'reload_subs', lambda verbose: None)(verbose=verbose)
getattr(algo, 'reload_subs', lambda verbose: None)(verbose=verbose)
getattr(control, 'reload_subs', lambda verbose: None)(verbose=verbose)
getattr(viz, 'reload_subs', lambda: None)()
开发者ID:heroinlin,项目名称:ibeis,代码行数:30,代码来源:__init__.py
示例15: make_kpts_coverage_mask
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from six.moves import zip, range, map # NOQA
#import six
#from six import next
import cv2
import numpy as np
import utool as ut
from vtool import patch as ptool
from vtool import keypoint as ktool
print, rrr, profile = ut.inject2(__name__, '[cov]', DEBUG=False)
# TODO: integrate more
COVKPTS_DEFAULT = ut.ParamInfoList('coverage_kpts', [
ut.ParamInfo('cov_agg_mode' , 'max'),
ut.ParamInfo('cov_blur_ksize' , (5, 5)),
ut.ParamInfo('cov_blur_on' , True),
ut.ParamInfo('cov_blur_sigma' , 5.0),
ut.ParamInfo('cov_remove_scale' , True),
ut.ParamInfo('cov_remove_shape' , True),
ut.ParamInfo('cov_scale_factor' , .3),
ut.ParamInfo('cov_size_penalty_frac' , .1),
ut.ParamInfo('cov_size_penalty_on' , True),
ut.ParamInfo('cov_size_penalty_power' , .5),
])
@profile
#@ut.memprof
def make_kpts_coverage_mask(
开发者ID:Erotemic,项目名称:vtool,代码行数:31,代码来源:coverage_kpts.py
示例16:
# -*- coding: utf-8 -*-
"""
Runs functions in pipeline to get query reuslts and does some caching.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
import six # NOQA
from os.path import exists
#from ibeis.algo.hots import query_request
#from ibeis.algo.hots import hots_query_result
#from ibeis.algo.hots import exceptions as hsexcept
from ibeis.algo.hots import chip_match
from ibeis.algo.hots import pipeline
from ibeis.algo.hots import _pipeline_helpers as plh # NOQA
(print, rrr, profile) = ut.inject2(__name__, '[mc4]')
# TODO: Move to params
USE_HOTSPOTTER_CACHE = pipeline.USE_HOTSPOTTER_CACHE
USE_CACHE = not ut.get_argflag(('--nocache-query', '--noqcache')) and USE_HOTSPOTTER_CACHE
USE_BIGCACHE = not ut.get_argflag(('--nocache-big', '--no-bigcache-query', '--noqcache', '--nobigcache')) and ut.USE_CACHE
SAVE_CACHE = not ut.get_argflag('--nocache-save')
#MIN_BIGCACHE_BUNDLE = 20
#MIN_BIGCACHE_BUNDLE = 150
MIN_BIGCACHE_BUNDLE = 64
HOTS_BATCH_SIZE = ut.get_argval('--hots-batch-size', type_=int, default=None)
#----------------------
# Main Query Logic
#----------------------
开发者ID:heroinlin,项目名称:ibeis,代码行数:31,代码来源:match_chips4.py
示例17: fix_compname_configs
# -*- coding: utf-8 -*-
# developer convenience functions for ibs
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
from six.moves import zip
from ibeis import constants as const
(print, rrr, profile) = ut.inject2(__name__, '[duct_tape]')
def fix_compname_configs(ibs):
""" duct tape to keep version in check """
#ibs.MANUAL_CONFIG_SUFFIX = '_MANUAL_' #+ ut.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_'),
zip(configid_list, cfgsuffix_list)):
print("EVALUATING: %r, %r" % (rowid, suffix))
# Fix the tables with bad config_rowids
ibs.db.executeone(
'''
UPDATE {AL_RELATION_TABLE}
SET config_rowid=?
WHERE config_rowid=?
开发者ID:heroinlin,项目名称:ibeis,代码行数:31,代码来源:duct_tape.py
示例18: print_ascii_graph
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import networkx as netx
import six # NOQA
import utool as ut
import numpy as np
from six.moves import zip
print, rrr, profile = ut.inject2(__name__, '[pgmext]')
def print_ascii_graph(model_):
"""
pip install img2txt.py
python -c
"""
from PIL import Image
from six.moves import StringIO
#import networkx as netx
import copy
model = copy.deepcopy(model_)
assert model is not model_
# model.graph.setdefault('graph', {})['size'] = '".4,.4"'
model.graph.setdefault('graph', {})['size'] = '".3,.3"'
model.graph.setdefault('graph', {})['height'] = '".3,.3"'
pydot_graph = netx.to_pydot(model)
png_str = pydot_graph.create_png(prog='dot')
sio = StringIO()
sio.write(png_str)
sio.seek(0)
pil_img = Image.open(sio)
开发者ID:heroinlin,项目名称:ibeis,代码行数:31,代码来源:pgm_viz.py
示例19: testdata_annotmatch
autogen_time = 11:34:25 2016/01/05
autogen_key = annotmatch
ToRegenerate:
python -m ibeis.templates.template_generator --key annotmatch --Tcfg with_web_api=False with_api_cache=False with_deleters=True no_extern_deleters=True --diff
python -m ibeis.templates.template_generator --key annotmatch --Tcfg with_web_api=False with_api_cache=False with_deleters=True no_extern_deleters=True --write
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import functools # NOQA
import six # NOQA
from six.moves import map, range, zip # NOQA
from ibeis import constants as const
import utool as ut
from ibeis.control import controller_inject
from ibeis.control import accessor_decors # NOQA
print, rrr, profile = ut.inject2(__name__, '[autogen_annotmatch]')
# Create dectorator to inject functions in this module into the IBEISController
CLASS_INJECT_KEY, register_ibs_method = controller_inject.make_ibs_register_decorator(__name__)
register_api = controller_inject.get_ibeis_flask_api(__name__)
register_route = controller_inject.get_ibeis_flask_route(__name__)
def testdata_annotmatch(defaultdb='testdb1'):
import ibeis
ibs = ibeis.opendb(defaultdb=defaultdb)
config2_ = None # qreq_.qparams
#from ibeis.hots import query_config
#config2_ = query_config.QueryParams(cfgdict=dict())
开发者ID:Erotemic,项目名称:ibeis,代码行数:31,代码来源:_autogen_annotmatch_funcs.py
示例20: euler_tour_dfs
# -*- coding: utf-8 -*-
# UNFINISHED - do not use
from __future__ import print_function, division, absolute_import, unicode_literals
import collections # NOQA
import networkx as nx
import utool as ut
print, rrr, profile = ut.inject2(__name__)
# import bintrees
# import rbtree
def euler_tour_dfs(G, source=None):
""" adaptation of networkx dfs """
if source is None:
# produce edges for all components
nodes = G
else:
# produce edges for components with source
nodes = [source]
yielder = []
visited = set()
for start in nodes:
if start in visited:
continue
visited.add(start)
stack = [(start, iter(G[start]))]
while stack:
parent, children = stack[-1]
try:
child = next(children)
if child not in visited:
开发者ID:Erotemic,项目名称:utool,代码行数:31,代码来源:dynamic_connectivity.py
注:本文中的utool.inject2函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论