wbia.dbio package

Submodules

wbia.dbio.export_hsdb module

Converts an IBEIS database to a hotspotter db

wbia.dbio.export_hsdb.dump_hots_flat_table(ibs)[source]
wbia.dbio.export_hsdb.dump_hots_tables(ibs)[source]

Dumps hotspotter like tables to disk

wbia.dbio.export_hsdb.export_wbia_to_hotspotter(ibs)[source]
wbia.dbio.export_hsdb.get_hots_flat_table(ibs)[source]

Dumps hotspotter flat tables

Parameters:ibs (IBEISController) – wbia controller object
Returns:flat_table_str
Return type:str
CommandLine:
python -m wbia.dbio.export_hsdb –exec-get_hots_flat_table

Example

>>> # ENABLE_DOCTEST
>>> from wbia.dbio.export_hsdb import *  # NOQA
>>> import wbia
>>> ibs = wbia.opendb(defaultdb='testdb1')
>>> flat_table_str = get_hots_flat_table(ibs)
>>> result = ('flat_table_str = %s' % (str(flat_table_str),))
>>> print(result)
wbia.dbio.export_hsdb.get_hots_table_strings(ibs)[source]
Parameters:ibs (IBEISController) – wbia controller object
CommandLine:
python -m wbia.dbio.export_hsdb –test-get_hots_table_strings

Example

>>> # ENABLE_DOCTEST
>>> from wbia.dbio.export_hsdb import *  # NOQA
>>> import wbia
>>> # build test data
>>> ibs = wbia.opendb('testdb1')
>>> ibs.delete_empty_nids()
>>> # execute function
>>> csvtup = get_hots_table_strings(ibs)
>>> # hack so hashtag is at the end of each line
>>> result = '\n'.join(csvtup).replace('\n', '#\n') + '#'
>>> # verify results
>>> print(result)
# image table#
# num_rows=13#
#   gid,                                                      gname,  aif#
      1,  ../_ibsdb/images/66ec193a-1619-b3b6-216d-1784b4833b61.jpg,    0#
      2,  ../_ibsdb/images/d8903434-942f-e0f5-d6c2-0dcbe3137bf7.jpg,    0#
      3,  ../_ibsdb/images/b73b72f4-4acb-c445-e72c-05ce02719d3d.jpg,    0#
      4,  ../_ibsdb/images/0cd05978-3d83-b2ee-2ac9-798dd571c3b3.jpg,    0#
      5,  ../_ibsdb/images/0a9bc03d-a75e-8d14-0153-e2949502aba7.jpg,    0#
      6,  ../_ibsdb/images/2deeff06-5546-c752-15dc-2bd0fdb1198a.jpg,    0#
      7,  ../_ibsdb/images/68ca272d-26f7-1dbb-76e9-08d192c1a4a7.png,    0#
      8,  ../_ibsdb/images/42fdad98-369a-2cbc-67b1-983d6d6a3a60.jpg,    0#
      9,  ../_ibsdb/images/c459d381-fd74-1d99-6215-e42e3f432ea9.jpg,    0#
     10,  ../_ibsdb/images/33fd9813-3a2b-774b-3fcc-4360d1ae151b.jpg,    0#
     11,  ../_ibsdb/images/97e8ea74-873f-2092-b372-f928a7be30fa.jpg,    0#
     12,  ../_ibsdb/images/588bc218-83a5-d400-21aa-d499832632b0.jpg,    0#
     13,  ../_ibsdb/images/163a890c-36f2-981e-3529-c552b6d668a3.jpg,    0#
# name table#
# num_rows=7#
#   nid,   name#
      1,   easy#
      2,   hard#
      3,   jeff#
      4,   lena#
      5,   occl#
      6,  polar#
      7,  zebra#
# chip table#
# num_rows=13#
#   cid,  gid,  nid,      [tlx tly w h],  theta,                                        notes#
      1,    1,   -1,  [0  0  1047  715],   0.00,              aid 1 and 2 are correct matches#
      2,    2,    1,  [0  0  1035  576],   0.00,                                             #
      3,    3,    1,  [0  0  1072  804],   0.00,                                             #
      4,    4,   -4,  [0  0  1072  804],   0.00,                                             #
      5,    5,    2,  [0  0  1072  804],   0.00,                                             #
      6,    6,    2,   [0  0  450  301],   0.00,                                             #
      7,    7,    3,   [0  0  400  400],   0.00,  very simple image to debug feature detector#
      8,    8,    4,   [0  0  220  220],   0.00,                          standard test image#
      9,    9,   -9,   [0  0  450  284],   0.00,              this is actually a plains zebra#
     10,   10,    5,   [0  0  450  341],   0.00,              this is actually a plains zebra#
     11,   11,  -11,   [0  0  741  734],   0.00,                                             #
     12,   12,    6,   [0  0  673  634],   0.00,                                             #
     13,   13,    7,  [0  0  1114  545],   0.00,                                             #
wbia.dbio.export_hsdb.get_hsdb_image_gpaths(ibs, gid_list)[source]
Parameters:
Returns:

gpath_list

Return type:

list

CommandLine:
python -m wbia.dbio.export_hsdb –test-get_hsdb_image_gpaths

Example

>>> # ENABLE_DOCTEST
>>> from wbia.dbio.export_hsdb import *  # NOQA
>>> import wbia
>>> # build test data
>>> ibs = wbia.opendb('testdb1')
>>> gid_list = ibs.get_valid_gids()[0:2]
>>> # execute function
>>> gpath_list = get_hsdb_image_gpaths(ibs, gid_list)
>>> # verify results
>>> result = ut.repr2(gpath_list, nl=1)
>>> print(result)
[
    '../_ibsdb/images/66ec193a-1619-b3b6-216d-1784b4833b61.jpg',
    '../_ibsdb/images/d8903434-942f-e0f5-d6c2-0dcbe3137bf7.jpg',
]

wbia.dbio.export_subset module

Exports subset of an IBEIS database to a new IBEIS database

wbia.dbio.export_subset.check_database_overlap(ibs1, ibs2)[source]
CommandLine:
python -m wbia.other.dbinfo –test-get_dbinfo:1 –db PZ_MTEST dev.py -t listdbs python -m wbia.dbio.export_subset check_database_overlap –db PZ_MTEST –db2 PZ_MOTHERS
CommandLine:

python -m wbia.dbio.export_subset check_database_overlap

python -m wbia.dbio.export_subset check_database_overlap –db1=PZ_MTEST –db2=PZ_Master0 # NOQA python -m wbia.dbio.export_subset check_database_overlap –db1=NNP_Master3 –db2=PZ_Master0 # NOQA

python -m wbia.dbio.export_subset check_database_overlap –db1=GZ_Master0 –db2=GZ_ALL python -m wbia.dbio.export_subset check_database_overlap –db1=GZ_ALL –db2=lewa_grevys

python -m wbia.dbio.export_subset check_database_overlap –db1=PZ_FlankHack –db2=PZ_Master1 python -m wbia.dbio.export_subset check_database_overlap –db1=PZ_PB_RF_TRAIN –db2=PZ_Master1

Example

>>> # SCRIPT
>>> from wbia.dbio.export_subset import *  # NOQA
>>> import wbia
>>> import utool as ut
>>> #ibs1 = wbia.opendb(db='PZ_Master0')
>>> #ibs2 = wbia.opendb(dbdir='/raid/work2/PZ_Master')
>>> db1 = ut.get_argval('--db1', str, default='PZ_MTEST')
>>> db2 = ut.get_argval('--db2', str, default='testdb1')
>>> dbdir1 = ut.get_argval('--dbdir1', str, default=None)
>>> dbdir2 = ut.get_argval('--dbdir2', str, default=None)
>>> ibs1 = wbia.opendb(db=db1, dbdir=dbdir1)
>>> ibs2 = wbia.opendb(db=db2, dbdir=dbdir2)
>>> check_database_overlap(ibs1, ibs2)
wbia.dbio.export_subset.check_merge(ibs_src, ibs_dst)[source]
wbia.dbio.export_subset.export_annots(ibs, aid_list, new_dbpath=None)[source]

exports a subset of annotations and other required info

Todo

PZ_Master1 needs to backproject information back on to NNP_Master3 and PZ_Master0

Parameters:
  • ibs (IBEISController) – wbia controller object
  • aid_list (list) – list of annotation rowids
  • new_dbpath (None) – (default = None)
Returns:

new_dbpath

Return type:

str

CommandLine:

python -m wbia.dbio.export_subset export_annots python -m wbia.dbio.export_subset export_annots –db NNP_Master3

-a viewpoint_compare –nocache-aid –verbtd –new_dbpath=PZ_ViewPoints
python -m wbia.expt.experiment_helpers get_annotcfg_list:0
–db NNP_Master3 -a viewpoint_compare –nocache-aid –verbtd
python -m wbia.expt.experiment_helpers get_annotcfg_list:0 –db NNP_Master3
-a viewpoint_compare –nocache-aid –verbtd
python -m wbia.expt.experiment_helpers get_annotcfg_list:0 –db NNP_Master3
-a default:aids=all,is_known=True,view_pername=#primary>0&#primary1>0,per_name=4,size=200
python -m wbia.expt.experiment_helpers get_annotcfg_list:0 –db NNP_Master3
-a default:aids=all,is_known=True,view_pername=’#primary>0&#primary1>0’,per_name=4,size=200 –acfginfo
python -m wbia.expt.experiment_helpers get_annotcfg_list:0 –db PZ_Master1
-a default:has_any=photobomb –acfginfo

Example

>>> # SCRIPT
>>> from wbia.dbio.export_subset import *  # NOQA
>>> import wbia
>>> from wbia.expt import experiment_helpers
>>> ibs = wbia.opendb(defaultdb='NNP_Master3')
>>> acfg_name_list = ut.get_argval(('--aidcfg', '--acfg', '-a'), type_=list, default=[''])
>>> acfg_list, expanded_aids_list = experiment_helpers.get_annotcfg_list(ibs, acfg_name_list)
>>> aid_list = expanded_aids_list[0][0]
>>> ibs.print_annot_stats(aid_list, viewcode_isect=True, per_image=True)
>>> # Expand to get all annots in each chosen image
>>> gid_list = ut.unique_ordered(ibs.get_annot_gids(aid_list))
>>> aid_list = ut.flatten(ibs.get_image_aids(gid_list))
>>> ibs.print_annot_stats(aid_list, viewcode_isect=True, per_image=True)
>>> new_dbpath = ut.get_argval('--new-dbpath', default='PZ_ViewPoints')
>>> new_dbpath = export_annots(ibs, aid_list, new_dbpath)
>>> result = ('new_dbpath = %s' % (str(new_dbpath),))
>>> print(result)
wbia.dbio.export_subset.export_data(ibs, gid_list, aid_list, nid_list, new_dbpath=None)[source]

exports a subset of data and other required info

Parameters:
  • ibs (IBEISController) – wbia controller object
  • gid_list (list) – list of image rowids
  • aid_list (list) – list of annotation rowids
  • nid_list (list) – list of name rowids
  • imgsetid_list (list) – list of imageset rowids
  • gsgrid_list (list) – list of imageset-image pairs rowids
  • new_dbpath (None) – (default = None)
Returns:

new_dbpath

Return type:

str

wbia.dbio.export_subset.export_images(ibs, gid_list, new_dbpath=None)[source]

exports a subset of images and other required info

Todo

PZ_Master1 needs to backproject information back on to NNP_Master3 and PZ_Master0

Parameters:
  • ibs (IBEISController) – wbia controller object
  • gid_list (list) – list of annotation rowids
  • new_dbpath (None) – (default = None)
Returns:

new_dbpath

Return type:

str

wbia.dbio.export_subset.export_names(ibs, nid_list, new_dbpath=None)[source]

exports a subset of names and other required info

Parameters:
CommandLine:
python -m wbia.dbio.export_subset –test-export_names

Example

>>> # DISABLE_DOCTEST
>>> from wbia.dbio.export_subset import *  # NOQA
>>> import wbia
>>> # build test data
>>> ibs = wbia.opendb('testdb2')
>>> ibs.delete_empty_nids()
>>> nid_list = ibs._get_all_known_nids()[0:2]
>>> # execute function
>>> result = export_names(ibs, nid_list)
>>> # verify results
>>> print(result)
wbia.dbio.export_subset.find_gid_list(ibs, min_count=500, ensure_annots=False)[source]
wbia.dbio.export_subset.find_overlap_annots(ibs1, ibs2, method='annots')[source]

Finds the aids of annotations in ibs1 that are also in ibs2

ibs1 = wbia.opendb(‘PZ_Master1’) ibs2 = wbia.opendb(‘PZ_MTEST’)

wbia.dbio.export_subset.fix_annotmatch_pzmaster1()[source]

PZ_Master1 had annotmatch rowids that did not agree with the current name labeling. Looking at the inconsistencies in the graph interface was too cumbersome, because over 3000 annots were incorrectly grouped together.

This function deletes any annotmatch rowid that is not consistent with the current labeling so we can go forward with using the new AnnotInference object

wbia.dbio.export_subset.fix_bidirectional_annotmatch(ibs)[source]
wbia.dbio.export_subset.make_new_dbpath(ibs, id_label, id_list)[source]

Creates a new database path unique to the exported subset of ids.

wbia.dbio.export_subset.merge_databases(ibs_src, ibs_dst, rowid_subsets=None, localize_images=True)[source]

New way of merging using the non-hacky sql table merge. However, its only workings due to major hacks.

FIXME: annotmatch table

CommandLine:

python -m wbia –test-merge_databases

python -m wbia merge_databases:0 –db1 LF_OPTIMIZADAS_NI_V_E –db2 LF_ALL python -m wbia merge_databases:0 –db1 LF_WEST_POINT_OPTIMIZADAS –db2 LF_ALL

python -m wbia merge_databases:0 –db1 PZ_Master0 –db2 PZ_Master1 python -m wbia merge_databases:0 –db1 NNP_Master3 –db2 PZ_Master1

python -m wbia merge_databases:0 –db1 GZ_ALL –db2 GZ_Master1 python -m wbia merge_databases:0 –db1 lewa_grevys –db2 GZ_Master1

Example

>>> # ENABLE_DOCTEST
>>> from wbia.dbio.export_subset import *  # NOQA
>>> from wbia.init.sysres import get_workdir
>>> import wbia
>>> db1 = ut.get_argval('--db1', str, default=None)
>>> db2 = ut.get_argval('--db2', str, default=None)
>>> dbdir1 = ut.get_argval('--dbdir1', str, default=None)
>>> dbdir2 = ut.get_argval('--dbdir2', str, default=None)
>>> delete_ibsdir = False
>>> # Check for test mode instead of script mode
>>> if db1 is None and db2 is None and dbdir1 is None and dbdir2 is None:
...     dbdir1 = '/'.join([get_workdir(), 'testdb1'])
...     dbdir2 = '/'.join([get_workdir(), 'testdb_dst'])
...     delete_ibsdir = True
>>> # Open the source and destination database
>>> assert db1 is not None or dbdir1 is not None
>>> assert db2 is not None or dbdir2 is not None
>>> ibs_src = wbia.opendb(db=db1, dbdir=dbdir1)
>>> ibs_dst = wbia.opendb(db=db2, dbdir=dbdir2, allow_newdir=True,
...                       delete_ibsdir=delete_ibsdir)
>>> merge_databases(ibs_src, ibs_dst)
>>> check_merge(ibs_src, ibs_dst)
>>> # ibs_dst.print_dbinfo()
wbia.dbio.export_subset.remerge_subset()[source]

Assumes ibs1 is an updated subset of ibs2. Re-merges ibs1 back into ibs2.

TODO: annotmatch table must have non-directional edges for this to work. I.e. u < v

Ignore:

# Ensure annotmatch and names are up to date with staging

# Load graph import ibei ibs = wbia.opendb(‘PZ_PB_RF_TRAIN’) infr = wbia.AnnotInference(aids=’all’, ibs=ibs, verbose=3) infr.reset_feedback(‘staging’, apply=True) infr.relabel_using_reviews()

# Check deltas infr.wbia_name_group_delta_info() infr.wbia_delta_info()

# Write if it looks good infr.write_wbia_annotmatch_feedback() infr.write_wbia_name_assignment()

Ignore:
import wbia ibs = wbia.opendb(‘PZ_Master1’) infr = wbia.AnnotInference(ibs, ‘all’) infr.reset_feedback(‘annotmatch’, apply=True)
CommandLine:
python -m wbia.dbio.export_subset remerge_subset
wbia.dbio.export_subset.slow_merge_test()[source]
CommandLine:
python -m wbia.dbio.export_subset –test-slow_merge_test

Example

>>> # SLOW_DOCTEST
>>> from wbia.dbio.export_subset import *  # NOQA
>>> result = slow_merge_test()
>>> print(result)

wbia.dbio.ingest_database module

This module lists known raw databases and how to ingest them.

Specify arguments and run the following command to ingest a database

python -m wbia –tf ingest_rawdata –db seaturtles –imgdir “~/turtles/Turtles from Jill” –ingest-type=named_folders –species=turtles python -m wbia –tf ingest_rawdata –db PZ_OlPej2016 –imgdir /raid/raw/OlPejPZ_June_2016 –ingest-type=named_folders –species=zebra_plains

# — GET DATA — rsync -avhzP <user>@<host>:<remotedir> <path-to-raw-imgs> # — RUN INGEST SCRIPT — python -m wbia –tf ingest_rawdata –db <new-wbia-db-name> –imgdir <path-to-raw-imgs> –ingest-type=named_folders –species=<optional> –fmtkey=<optional>

Example

>>> # xdoctest: +SKIP
>>> # The scripts in this file essentiall do this:
>>> dbdir = '<your new database directory>'
>>> gpath_list = '<path to your images>'
>>> ibs = wbia.opendb(dbdir=dbdir, allow_newdir=True)
>>> gid_list_ = ibs.add_images(gpath_list, auto_localize=False)  # NOQA
>>> # use whole images as annotations
>>> aid_list = ibs.use_images_as_annotations(gid_list_, adjust_percent=0)
>>> # Extra stuff
>>> name_list = '<names that correspond to your annots>'
>>> ibs.set_annot_names(aid_list, name_list)
>>> occur_text_list = '<occurrence that images belongs to>'
>>> ibs.set_image_imagesettext(gid_list_, occur_text_list)
>>> ibs.append_annot_case_tags(aid_list, '<annotation tags>')
class wbia.dbio.ingest_database.FMT_KEYS[source]

Bases: object

elephant_fmt = '{prefix?}{name}_{view}_{id?}.{ext}'
giraffe1_fmt = '{name:*}_{id:d}.{ext}'
name_fmt = '{name:*}[id:d].{ext}'
seal2_fmt = '{name:Phsd*}{id:[A-Z]}.{ext}'
snails_fmt = '{name:*dd}{id:dd}.{ext}'
class wbia.dbio.ingest_database.Ingestable(dbname, img_dir=None, ingest_type=None, fmtkey=None, adjust_percent=0.0, postingest_func=None, zipfile=None, species=None, images_as_annots=False)[source]

Bases: object

Temporary structure representing how to ingest a databases

ensure_feasibility()[source]
class wbia.dbio.ingest_database.Ingestable2(dbdir, imgpath_list=None, imgdir_list=None, zipfile_list=None, postingest_func=None, ingest_config={}, **kwargs)[source]

Bases: object

execute(ibs=None)[source]
wbia.dbio.ingest_database.get_name_texts_from_gnames(gpath_list, img_dir, fmtkey='{name:*}[aid:d].{ext}')[source]
Parameters:
  • gpath_list (list) – list of image paths
  • img_dir (str) – path to image directory
  • fmtkey (str) – pattern string to parse names from (default = ‘{name:*}[aid:d].{ext}’)
Returns:

name_list - based on the parent folder of each image

Return type:

list

CommandLine:
python -m wbia.dbio.ingest_database –test-get_name_texts_from_gnames

Example

>>> # DISABLE_DOCTEST
>>> from wbia.dbio.ingest_database import *  # NOQA
>>> gpath_list = ['e_f0273_f.jpg', 'f0001_f.jpg', 'f0259_l_3.jpg', 'f0259_f_1.jpg',  'f0259_f (1).jpg', 'f0058_u16_f.jpg']
>>> img_dir = ''
>>> fmtkey = FMT_KEYS.elephant_fmt
>>> result = get_name_texts_from_gnames(gpath_list, img_dir, fmtkey)
>>> print(result)
wbia.dbio.ingest_database.get_name_texts_from_parent_folder(gpath_list, img_dir, fmtkey=None)[source]

Input: gpath_list Output: names based on the parent folder of each image

wbia.dbio.ingest_database.get_standard_ingestable(dbname)[source]
wbia.dbio.ingest_database.ingest_Elephants_drop1(dbname)[source]
wbia.dbio.ingest_database.ingest_Giraffes1(dbname)[source]
wbia.dbio.ingest_database.ingest_JAG_Kieryn(dbname)[source]
wbia.dbio.ingest_database.ingest_coco_style_db(dbdir, dryrun=False)[source]

Ingest a PASCAL VOC formatted datbase

Parameters:dbdir (str) –
CommandLine:
python -m wbia.dbio.ingest_database –exec-ingest_coco_style_db –show

Example

>>> # DISABLE_DOCTEST
>>> from wbia.dbio.ingest_database import *  # NOQA
>>> dbdir = '/Datasets/coco'
>>> dryrun = True
>>> ingest_coco_style_db(dbdir)
>>> ut.quit_if_noshow()
>>> import wbia.plottool as pt
>>> ut.show_if_requested()
wbia.dbio.ingest_database.ingest_humpbacks(dbname)[source]
wbia.dbio.ingest_database.ingest_lynx(dbname)[source]
CommandLine:
python -m wbia.dbio.ingest_database –exec-injest_main –db lynx
wbia.dbio.ingest_database.ingest_oxford_style_db(dbdir, dryrun=False)[source]

Ingest either oxford or paris

Parameters:dbdir (str) –
CommandLine:
python -m wbia.dbio.ingest_database –exec-ingest_oxford_style_db –show

Example

>>> # DISABLE_DOCTEST
>>> from wbia.dbio.ingest_database import *  # NOQA
>>> dbdir = '/raid/work/Oxford'
>>> dryrun = True
>>> ingest_oxford_style_db(dbdir)
>>> ut.quit_if_noshow()
>>> import wbia.plottool as pt
>>> ut.show_if_requested()
Ignore:
>>> from wbia.dbio.ingest_database import *  # NOQA
>>> import wbia
>>> dbdir = '/raid/work/Oxford'
>>> dbdir = '/raid/work/Paris'
>>>
#>>> wbia.dbio.convert_db.ingest_oxford_style_db(dbdir)
wbia.dbio.ingest_database.ingest_polar_bears(dbname)[source]
wbia.dbio.ingest_database.ingest_rawdata(ibs, ingestable, localize=False)[source]

Ingests rawdata into an wbia database.

Parameters:
  • ibs (wbia.IBEISController) – wbia controller object
  • ingestable (Ingestable) –
  • localize (bool) – (default = False)
Returns:

aid_list - list of annotation rowids

Return type:

list

Notes

if ingest_type == ‘named_folders’:
Converts folder structure where folders = name, to ibsdb
if ingest_type == ‘named_images’:
Converts imgname structure where imgnames = name_id.ext, to ibsdb
CommandLine:

python wbia/dbio/ingest_database.py –db seals_drop2 python -m wbia.dbio.ingest_database –exec-ingest_rawdata python -m wbia.dbio.ingest_database –exec-ingest_rawdata –db snow-leopards –imgdir /raid/raw_rsync/snow-leopards

python -m wbia –tf ingest_rawdata –db wd_peter2 –imgdir /raid/raw_rsync/african-dogs –ingest-type=named_folders –species=wild_dog –fmtkey=’African Wild Dog: {name}’ –force-delete python -m wbia –tf ingest_rawdata –db <newdbname> –imgdir <path-to-images> –ingest-type=named_folders –species=humpback

Example

>>> # SCRIPT
>>> # General ingest script
>>> from wbia.dbio.ingest_database import *  # NOQA
>>> import wbia
>>> dbname = ut.get_argval('--db', str, None)  # 'snow-leopards')
>>> force_delete = ut.get_argflag(('--force_delete', '--force-delete'))
>>> img_dir = ut.get_argval('--imgdir', type_=str, default=None)
>>> ingest_type = ut.get_argval('--ingest-type', type_=str, default='unknown')
>>> fmtkey = ut.get_argval('--fmtkey', type_=str, default=None)
>>> species = ut.get_argval('--species', type_=str, default=None)
>>> images_as_annots = ut.get_argval('--images-as-annots', type_=bool, default=None)
>>> if images_as_annots is None:
>>>     images_as_annots = ingest_type != 'unknown'
>>> assert img_dir is not None, 'specify img dir'
>>> assert dbname is not None, 'specify dbname'
>>> ingestable = Ingestable(
>>>     dbname, img_dir=img_dir, ingest_type=ingest_type,
>>>     fmtkey=fmtkey, species=species, images_as_annots=images_as_annots,
>>>     adjust_percent=0.00)
>>> from wbia.control import IBEISControl
>>> dbdir = wbia.sysres.db_to_dbdir(dbname, allow_newdir=True)
>>> ut.ensuredir(dbdir, verbose=True)
>>> if force_delete:
>>>     ibsfuncs.delete_wbia_database(dbdir)
>>> ibs = IBEISControl.request_IBEISController(dbdir)
>>> localize = False
>>> gid_list = ingest_rawdata(ibs, ingestable, localize)
>>> result = ('gid_list = %s' % (str(gid_list),))
>>> print(result)
wbia.dbio.ingest_database.ingest_seals_drop2(dbname)[source]
wbia.dbio.ingest_database.ingest_serengeti_mamal_cameratrap(species)[source]

Downloads data from Serengeti dryad server

References

http://datadryad.org/resource/doi:10.5061/dryad.5pt92 Swanson AB, Kosmala M, Lintott CJ, Simpson RJ, Smith A, Packer C (2015) Snapshot Serengeti, high-frequency annotated camera trap images of 40 mammalian species in an African savanna. Scientific Data 2: 150026. http://dx.doi.org/10.1038/sdata.2015.26 Swanson AB, Kosmala M, Lintott CJ, Simpson RJ, Smith A, Packer C (2015) Data from: Snapshot Serengeti, high-frequency annotated camera trap images of 40 mammalian species in an African savanna. Dryad Digital Repository. http://dx.doi.org/10.5061/dryad.5pt92

Parameters:species
CommandLine:
python -m wbia.dbio.ingest_database –test-ingest_serengeti_mamal_cameratrap –species zebra_plains python -m wbia.dbio.ingest_database –test-ingest_serengeti_mamal_cameratrap –species cheetah

Example

>>> # SCRIPT
>>> from wbia.dbio.ingest_database import *  # NOQA
>>> import wbia
>>> species = ut.get_argval('--species', type_=str, default=wbia.const.TEST_SPECIES.ZEB_PLAIN)
>>> # species = ut.get_argval('--species', type_=str, default='cheetah')
>>> result = ingest_serengeti_mamal_cameratrap(species)
>>> print(result)
wbia.dbio.ingest_database.ingest_snails_drop1(dbname)[source]
wbia.dbio.ingest_database.ingest_standard_database(dbname, force_delete=False)[source]
Parameters:
  • dbname (str) – database name
  • force_delete (bool) –
Ignore:
>>> from wbia.dbio.ingest_database import *  # NOQA
>>> dbname = 'testdb1'
>>> force_delete = False
>>> result = ingest_standard_database(dbname, force_delete)
>>> print(result)
wbia.dbio.ingest_database.ingest_testdb1(dbname)[source]

Example

>>> # DISABLE_DOCTEST
>>> from wbia.dbio.ingest_database import *  # NOQA
>>> import utool as ut
>>> from wbia import demodata
>>> import wbia
>>> demodata.ensure_testdata()
>>> # DELETE TESTDB1
>>> TESTDB1 = ut.unixjoin(wbia.sysres.get_workdir(), 'testdb1')
>>> ut.delete(TESTDB1, ignore_errors=False)
>>> result = ingest_testdb1(dbname)
wbia.dbio.ingest_database.ingest_whale_sharks(dbname)[source]
CommandLine:
python -m wbia.dbio.ingest_database –exec-injest_main –db WS_ALL
wbia.dbio.ingest_database.ingest_wilddog_peter(dbname)[source]
CommandLine:
python -m wbia.dbio.ingest_database –exec-injest_main –db wd_peter_blinston
wbia.dbio.ingest_database.injest_main()[source]
CommandLine:
python -m wbia.dbio.ingest_database –test-injest_main python -m wbia.dbio.ingest_database –test-injest_main –db snow-leopards

Example

>>> # DISABLE_DOCTEST
>>> from wbia.dbio.ingest_database import *  # NOQA
>>> injest_main()
wbia.dbio.ingest_database.logger = <Logger wbia (INFO)>

New Lynx

python -m wbia –tf ingest_rawdata –db lynx2 –imgdir “/media/raid/raw/WildME-WWF-lynx-Sept-2016/CARPETAS CATALOGO INDIVIDUOS” –ingest-type=named_folders –species=lynx –dry

wbia.dbio.ingest_database.normalize_name(name)[source]

Maps unknonwn names to the standard ____

wbia.dbio.ingest_database.resolve_name_conflicts(gid_list, name_list)[source]

wbia.dbio.ingest_ggr module

Converts a GGR-style raw data to IBEIS database.

wbia.dbio.ingest_ggr.convert_ggr2018_to_wbia(ggr_path, dbdir=None, purge=True, dry_run=False, apply_updates=True, **kwargs)[source]

Convert the raw GGR2 (2018) data to an wbia database.

Args
ggr_path (str): Directory to folder containing raw GGR 2018 data dbdir (str): Output directory
CommandLine:
python -m wbia convert_ggr2018_to_wbia

Example

>>> # SCRIPT
>>> from wbia.dbio.ingest_ggr import *  # NOQA
>>> default_ggr_path = join('/', 'data', 'wbia', 'GGR2', 'GGR2018data')
>>> default_dbdir = join('/', 'data', 'wbia', 'GGR2-IBEIS')
>>> dbdir = ut.get_argval('--dbdir', type_=str, default=default_dbdir)
>>> ggr_path = ut.get_argval('--ggr', type_=str, default=default_ggr_path)
>>> result = convert_ggr2018_to_wbia(ggr_path, dbdir=dbdir, purge=False, dry_run=True, apply_updates=False)
>>> print(result)

wbia.dbio.ingest_hsdb module

Converts a hotspostter database to IBEIS

wbia.dbio.ingest_hsdb.check_unconverted_hsdb(dbdir)[source]

Returns if a directory is an unconverted hotspotter database

wbia.dbio.ingest_hsdb.convert_hsdb_to_wbia(hsdir, dbdir=None, **kwargs)[source]
Args
hsdir (str): Directory to folder containing _hsdb dbdir (str): Output directory (defaults to same as hsdb)
CommandLine:
python -m wbia convert_hsdb_to_wbia –dbdir ~/work/Frogs python -m wbia convert_hsdb_to_wbia –hsdir “/raid/raw/RotanTurtles/Roatan HotSpotter Nov_21_2016”
Ignore:
from wbia.dbio.ingest_hsdb import * # NOQA hsdir = “/raid/raw/RotanTurtles/Roatan HotSpotter Nov_21_2016” dbdir = “~/work/RotanTurtles”

Example

>>> # SCRIPT
>>> from wbia.dbio.ingest_hsdb import *  # NOQA
>>> dbdir = ut.get_argval('--dbdir', type_=str, default=None)
>>> hsdir = ut.get_argval('--hsdir', type_=str, default=dbdir)
>>> result = convert_hsdb_to_wbia(hsdir)
>>> print(result)
wbia.dbio.ingest_hsdb.get_hsinternal(hsdb_dir)[source]
wbia.dbio.ingest_hsdb.get_unconverted_hsdbs(workdir=None)[source]
Parameters:workdir (None) – (default = None)
CommandLine:
python -m wbia.dbio.ingest_hsdb –test-get_unconverted_hsdbs

Example

>>> # SCRIPT
>>> from wbia.dbio.ingest_hsdb import *  # NOQA
>>> workdir = None
>>> result = get_unconverted_hsdbs(workdir)
>>> print(result)
wbia.dbio.ingest_hsdb.ingest_unconverted_hsdbs_in_workdir()[source]
wbia.dbio.ingest_hsdb.is_hsdb(dbdir)[source]
wbia.dbio.ingest_hsdb.is_hsdbv3(dbdir)[source]
wbia.dbio.ingest_hsdb.is_hsdbv4(dbdir)[source]
wbia.dbio.ingest_hsdb.is_hsinternal(dbdir)[source]
wbia.dbio.ingest_hsdb.is_succesful_convert(dbdir)[source]

the sucess flag is only written if the _ibsdb was properly generated

wbia.dbio.ingest_hsdb.testdata_ensure_unconverted_hsdb()[source]

Makes an unconverted test datapath

CommandLine:
python -m wbia.dbio.ingest_hsdb –test-testdata_ensure_unconverted_hsdb

Example

>>> # SCRIPT
>>> from wbia.dbio.ingest_hsdb import *  # NOQA
>>> result = testdata_ensure_unconverted_hsdb()
>>> print(result)

wbia.dbio.ingest_mdb module

wbia.dbio.ingest_my_hotspotter_dbs module

Module contents

this module handles importing and exporting. the best word i can think of is io. maybe marshall?