Пример #1
0
def export_ibeis_to_hotspotter(ibs):
    print('export to hsdb')
    ibs.inject_func(get_hsdb_image_gpaths)
    hsdb_dir = ibs.get_dbdir()
    internal_hsdb = join(hsdb_dir, '_hsdb')
    utool.ensuredir(internal_hsdb)

    # Build Image Table
    gid_list        = ibs.get_valid_gids()
    gpath_list      = ibs.get_hsdb_image_gpaths(gid_list)
    reviewed_list        = ibs.get_image_reviewed(gid_list)
    # aif in hotspotter is equivilant to reviewed in IBEIS
    image_table_csv = utool.make_csv_table(
        [gid_list, gpath_list, reviewed_list],
        ['gid', 'gname', 'aif'],
        '# image table')

    # Build Name Table
    nid_list       =  ibs.get_valid_nids()
    name_list      = ibs.get_name_text(nid_list)
    name_table_csv = utool.make_csv_table(
        [nid_list, name_list],
        ['nid', 'name'],
        '# name table')

    # Build Chip Table
    aid_list        = ibs.get_valid_aids()
    annotationgid_list     = ibs.get_annot_gids(aid_list)
    annotationnid_list     = ibs.get_annot_nids(aid_list)
    bbox_list       = map(list, ibs.get_annot_bboxes(aid_list))
    theta_list      = ibs.get_annot_thetas(aid_list)
    notes_list      = ibs.get_annot_notes(aid_list)

    chip_column_list = [aid_list, annotationgid_list, annotationnid_list, bbox_list, theta_list, notes_list]
    chip_column_lbls = ['cid', 'gid', 'nid', '[tlx tly w h]', 'theta', 'notes']
    chip_column_types = [int, int, int, list, float, str]
    chip_table_csv = utool.make_csv_table(
        chip_column_list,
        chip_column_lbls,
        '# chip table', chip_column_types)

    if utool.VERBOSE:
        if len(aid_list) < 87:
            print(chip_table_csv)
        if len(nid_list) < 87:
            print(name_table_csv)
        if len(gid_list) < 87:
            print(image_table_csv)

    # Write Tables
    with open(join(internal_hsdb, 'HSDB_image_table.csv'), 'wb') as imgtbl_file:
        imgtbl_file.write(image_table_csv)
    with open(join(internal_hsdb, 'HSDB_name_table.csv'), 'wb') as nametbl_file:
        nametbl_file.write(name_table_csv)
    with open(join(internal_hsdb, 'HSDB_chip_table.csv'), 'wb') as chiptbl_file:
        chiptbl_file.write(chip_table_csv)
Пример #2
0
def get_flat_table(ibs):
    """ Dumps hotspotter flat tables """
    aid_list = ibs.get_valid_aids()
    column_tups = [
        (int,   'aids',   aid_list,),
        (str,   'names',  ibs.get_annot_names(aid_list),),
        (list,  'bbox',   map(list, ibs.get_annot_bboxes(aid_list),)),
        (float, 'theta',  ibs.get_annot_thetas(aid_list),),
        (str,   'gpaths', ibs.get_annot_gpaths(aid_list),),
        (str,   'notes',  ibs.get_annot_notes(aid_list),),
        (str,   'uuids',  ibs.get_annot_uuids(aid_list),),
    ]
    column_type   = [tup[0] for tup in column_tups]
    column_lbls = [tup[1] for tup in column_tups]
    column_list   = [tup[2] for tup in column_tups]
    header = '\n'.join([
        '# Roi Flat Table',
        '# aid   - internal annotation index (not gaurenteed unique)',
        '# name  - animal identity',
        '# bbox  - bounding box [tlx tly w h] in image',
        '# theta - bounding box orientation',
        '# gpath - image filepath',
        '# notes - user defined notes',
        '# uuids - unique universal ids (gaurenteed unique)',
    ])
    flat_table_str = utool.make_csv_table(column_list, column_lbls, header,
                                          column_type)
    return flat_table_str
Пример #3
0
 def print_next_rankmat():
     # Prints nextbest ranks
     print('-------------')
     print('NextRankMat: %s' % testnameid)
     header = (' top false rank matrix: rows=queries, cols=cfgs:')
     print('\n'.join(cfgx2_lbl))
     column_list = cfgx2_nextbestranks
     print(ut.make_csv_table(column_list, row_lbls=testres.qaids,
                             column_lbls=column_lbls, header=header,
                             transpose=False,
                             use_lbl_width=len(cfgx2_lbl) < 5))
Пример #4
0
 def print_next_rankmat():
     # Prints nextbest ranks
     print('-------------')
     print('NextRankMat: %s' % testnameid)
     header = (' top false rank matrix: rows=queries, cols=cfgs:')
     print('\n'.join(cfgx2_lbl))
     column_list = cfgx2_nextbestranks
     print(
         ut.make_csv_table(column_list,
                           row_lbls=testres.qaids,
                           column_lbls=column_lbls,
                           header=header,
                           transpose=False,
                           use_lbl_width=len(cfgx2_lbl) < 5))
Пример #5
0
 def print_scorediff_mat():
     # Prints nextbest ranks
     print('-------------')
     print('ScoreDiffMat: %s' % testnameid)
     header = (' score difference between top true and top false: rows=queries, cols=cfgs:')
     print('\n'.join(cfgx2_lbl))
     column_list = cfgx2_scorediffs
     column_type = [float] * len(column_list)
     print(ut.make_csv_table(column_list, row_lbls=testres.qaids,
                             column_lbls=column_lbls,
                             column_type=column_type,
                             header=header,
                             transpose=False,
                             use_lbl_width=len(cfgx2_lbl) < 5))
Пример #6
0
def get_hots_flat_table(ibs):
    """ Dumps hotspotter flat tables

    Args:
        ibs (IBEISController):  ibeis controller object

    Returns:
        str: flat_table_str

    CommandLine:
        python -m ibeis.dbio.export_hsdb --exec-get_hots_flat_table

    Example:
        >>> # ENABLE_DOCTEST
        >>> from ibeis.dbio.export_hsdb import *  # NOQA
        >>> import ibeis
        >>> ibs = ibeis.opendb(defaultdb='testdb1')
        >>> flat_table_str = get_hots_flat_table(ibs)
        >>> result = ('flat_table_str = %s' % (str(flat_table_str),))
        >>> print(result)
    """
    aid_list = ibs.get_valid_aids()
    column_tups = [
        (int, "aids", aid_list),
        (str, "names", ibs.get_annot_names(aid_list)),
        (list, "bbox", list(map(list, ibs.get_annot_bboxes(aid_list)))),
        (float, "theta", ibs.get_annot_thetas(aid_list)),
        (str, "gpaths", ibs.get_annot_image_paths(aid_list)),
        (str, "notes", ibs.get_annot_notes(aid_list)),
        (str, "uuids", ibs.get_annot_uuids(aid_list)),
    ]
    column_type = [tup[0] for tup in column_tups]
    column_lbls = [tup[1] for tup in column_tups]
    column_list = [tup[2] for tup in column_tups]
    header = "\n".join(
        [
            "# Roi Flat Table",
            "# aid   - internal annotation index (not gaurenteed unique)",
            "# name  - animal identity",
            "# bbox  - bounding box [tlx tly w h] in image",
            "# theta - bounding box orientation",
            "# gpath - image filepath",
            "# notes - user defined notes",
            "# uuids - unique universal ids (gaurenteed unique)",
        ]
    )
    flat_table_str = ut.make_csv_table(column_list, column_lbls, header, column_type)
    return flat_table_str
Пример #7
0
    def get_table_csv(db, tablename, exclude_columns=[]):
        """ Conveinience: Converts a tablename to csv format """
        column_nametypes = db.table_columns[tablename]
        column_names = [name for (name, type_) in column_nametypes]
        column_list = []
        column_lbls = []
        for name in column_names:
            if name in exclude_columns:
                continue
            column_vals = db.get_column(tablename, name)
            column_list.append(column_vals)
            column_lbls.append(name.replace(tablename[:-1] + '_', ''))
        # remove column prefix for more compact csvs

        #=None, column_list=[], header='', column_type=None
        header = db.get_table_csv_header(tablename)
        csv_table = utool.make_csv_table(column_list, column_lbls, header)
        return csv_table
Пример #8
0
def test_language_modulus():
    """
    References:
        http://en.wikipedia.org/wiki/Modulo_operation
    """
    import math
    import utool as ut
    TAU = math.pi * 2
    num_list = [-8, -1, 0, 1, 2, 6, 7, 29]
    modop_result_list = []
    fmod_result_list = []
    for num in num_list:
        num = float(num)
        modop_result_list.append(num % TAU)
        fmod_result_list.append(math.fmod(num, TAU))
    table = ut.make_csv_table([num_list, modop_result_list, fmod_result_list],
                              ['num',  'modop', 'fmod'], 'mods', [float, float, float] )
    print(table)
Пример #9
0
 def print_scorediff_mat():
     # Prints nextbest ranks
     print('-------------')
     print('ScoreDiffMat: %s' % testnameid)
     header = (
         ' score difference between top true and top false: rows=queries, cols=cfgs:'
     )
     print('\n'.join(cfgx2_lbl))
     column_list = cfgx2_scorediffs
     column_type = [float] * len(column_list)
     print(
         ut.make_csv_table(column_list,
                           row_lbls=testres.qaids,
                           column_lbls=column_lbls,
                           column_type=column_type,
                           header=header,
                           transpose=False,
                           use_lbl_width=len(cfgx2_lbl) < 5))
Пример #10
0
def test_language_modulus():
    """
    References:
        http://en.wikipedia.org/wiki/Modulo_operation
    """
    import math
    import utool as ut
    TAU = math.pi * 2
    num_list = [-8, -1, 0, 1, 2, 6, 7, 29]
    modop_result_list = []
    fmod_result_list = []
    for num in num_list:
        num = float(num)
        modop_result_list.append(num % TAU)
        fmod_result_list.append(math.fmod(num, TAU))
    table = ut.make_csv_table([num_list, modop_result_list, fmod_result_list],
                              ['num', 'modop', 'fmod'], 'mods',
                              [float, float, float])
    print(table)
Пример #11
0
def get_table_csv(cur, tablename, exclude_columns=[]):
    """ Conveinience: Converts a tablename to csv format

    Args:
        tablename (str):
        exclude_columns (list):

    Returns:
        str: csv_table

    CommandLine:
        python -m ibeis.control.SQLDatabaseControl --test-get_table_csv

    Example:
        >>> # ENABLE_DOCTEST
        >>> from ibeis.control.SQLDatabaseControl import *  # NOQA
        >>> # build test data
        >>> import ibeis
        >>> ibs = ibeis.opendb('testdb1')
        >>> db = ibs.db
        >>> tablename = ibeis.const.NAME_TABLE
        >>> exclude_columns = []
        >>> # execute function
        >>> csv_table = db.get_table_csv(tablename, exclude_columns)
        >>> # verify results
        >>> result = str(csv_table)
        >>> print(result)
    """
    import utool as ut
    colnames_ = ut.get_table_columnname_list(cur, tablename)
    colnames = tuple([colname for colname in colnames_ if colname not in exclude_columns])
    row_list = ut.get_table_rows(cur, tablename, colnames, unpack=False)
    column_list = zip(*row_list)
    #=None, column_list=[], header='', column_type=None
    #import utool as ut
    #column_list, column_names = db.get_table_column_data(tablename, exclude_columns)
    # remove column prefix for more compact csvs
    column_lbls = [name.replace(tablename[:-1] + '_', '') for name in colnames]
    #header = db.get_table_csv_header(tablename)
    header = ''
    csv_table = ut.make_csv_table(column_list, column_lbls, header)
    return csv_table
Пример #12
0
def get_table_csv(cur, tablename, exclude_columns=[]):
    """ Conveinience: Converts a tablename to csv format

    Args:
        tablename (str):
        exclude_columns (list):

    Returns:
        str: csv_table

    CommandLine:
        python -m ibeis.control.SQLDatabaseControl --test-get_table_csv

    Example:
        >>> # ENABLE_DOCTEST
        >>> from ibeis.control.SQLDatabaseControl import *  # NOQA
        >>> # build test data
        >>> import ibeis
        >>> ibs = ibeis.opendb('testdb1')
        >>> db = ibs.db
        >>> tablename = ibeis.const.NAME_TABLE
        >>> exclude_columns = []
        >>> # execute function
        >>> csv_table = db.get_table_csv(tablename, exclude_columns)
        >>> # verify results
        >>> result = str(csv_table)
        >>> print(result)
    """
    import utool as ut
    colnames_ = ut.get_table_columnname_list(cur, tablename)
    colnames = tuple([colname for colname in colnames_ if colname not in exclude_columns])
    row_list = ut.get_table_rows(cur, tablename, colnames, unpack=False)
    column_list = zip(*row_list)
    #=None, column_list=[], header='', column_type=None
    #import utool as ut
    #column_list, column_names = db.get_table_column_data(tablename, exclude_columns)
    # remove column prefix for more compact csvs
    column_lbls = [name.replace(tablename[:-1] + '_', '') for name in colnames]
    #header = db.get_table_csv_header(tablename)
    header = ''
    csv_table = ut.make_csv_table(column_list, column_lbls, header)
    return csv_table
Пример #13
0
 def nice_table(self):
     import utool as ut
     return ut.make_csv_table(ut.listT(self.row_data), raw=True)
Пример #14
0
def get_hots_table_strings(ibs):
    r"""
    Args:
        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/a9b70278-a936-c1dd-8a3b-bc1e9a998bf0.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,                                             #
    """
    logger.info('export to hsdb')
    # ibs.inject_func(get_hsdb_image_gpaths)

    # Build Image Table
    gid_list = ibs.get_valid_gids()
    gpath_list = get_hsdb_image_gpaths(ibs, gid_list)
    reviewed_list = ibs.get_image_reviewed(gid_list)
    # aif in hotspotter is equivilant to reviewed in IBEIS
    image_table_csv = ut.make_csv_table([gid_list, gpath_list, reviewed_list],
                                        ['gid', 'gname', 'aif'],
                                        '# image table')

    # Build Name Table
    nid_list = ibs.get_valid_nids()
    name_list = ibs.get_name_texts(nid_list)
    name_table_csv = ut.make_csv_table([nid_list, name_list], ['nid', 'name'],
                                       '# name table')

    # Build Chip Table
    aid_list = ibs.get_valid_aids()
    annotationgid_list = ibs.get_annot_gids(aid_list)
    annotationnid_list = ibs.get_annot_name_rowids(aid_list)
    bbox_list = list(map(list, ibs.get_annot_bboxes(aid_list)))
    theta_list = ibs.get_annot_thetas(aid_list)
    notes_list = ibs.get_annot_notes(aid_list)

    chip_column_list = [
        aid_list,
        annotationgid_list,
        annotationnid_list,
        bbox_list,
        theta_list,
        notes_list,
    ]
    chip_column_lbls = ['cid', 'gid', 'nid', '[tlx tly w h]', 'theta', 'notes']
    chip_column_types = [int, int, int, list, float, str]
    chip_table_csv = ut.make_csv_table(chip_column_list, chip_column_lbls,
                                       '# chip table', chip_column_types)

    if ut.VERBOSE:
        if len(aid_list) < 87:
            logger.info(chip_table_csv)
        if len(nid_list) < 87:
            logger.info(name_table_csv)
        if len(gid_list) < 87:
            logger.info(image_table_csv)
    return image_table_csv, name_table_csv, chip_table_csv
Пример #15
0
def get_hots_flat_table(ibs):
    """ Dumps hotspotter flat tables

    Args:
        ibs (IBEISController):  wbia controller object

    Returns:
        str: flat_table_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)
    """
    aid_list = ibs.get_valid_aids()
    column_tups = [
        (
            int,
            'aids',
            aid_list,
        ),
        (
            str,
            'names',
            ibs.get_annot_names(aid_list),
        ),
        (list, 'bbox', list(map(
            list,
            ibs.get_annot_bboxes(aid_list),
        ))),
        (
            float,
            'theta',
            ibs.get_annot_thetas(aid_list),
        ),
        (
            str,
            'gpaths',
            ibs.get_annot_image_paths(aid_list),
        ),
        (
            str,
            'notes',
            ibs.get_annot_notes(aid_list),
        ),
        (
            str,
            'uuids',
            ibs.get_annot_uuids(aid_list),
        ),
    ]
    column_type = [tup[0] for tup in column_tups]
    column_lbls = [tup[1] for tup in column_tups]
    column_list = [tup[2] for tup in column_tups]
    header = '\n'.join([
        '# Roi Flat Table',
        '# aid   - internal annotation index (not gaurenteed unique)',
        '# name  - animal identity',
        '# bbox  - bounding box [tlx tly w h] in image',
        '# theta - bounding box orientation',
        '# gpath - image filepath',
        '# notes - user defined notes',
        '# uuids - unique universal ids (gaurenteed unique)',
    ])
    flat_table_str = ut.make_csv_table(column_list, column_lbls, header,
                                       column_type)
    return flat_table_str
Пример #16
0
 def printme3(self):
     column_list = [self.qaids, self.aids, self.scores, self.ranks]
     column_lbls = ['qaids', 'aids', 'scores', 'ranks']
     header = 'Orgres %s' % (self.orgtype)
     print(utool.make_csv_table(column_list, column_lbls, header, column_type=None))
Пример #17
0
def get_hots_table_strings(ibs):
    r"""
    Args:
        ibs (IBEISController):  ibeis controller object

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

    Example:
        >>> # ENABLE_DOCTEST
        >>> from ibeis.dbio.export_hsdb import *  # NOQA
        >>> import ibeis
        >>> # build test data
        >>> ibs = ibeis.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/a9b70278-a936-c1dd-8a3b-bc1e9a998bf0.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,                                             #
    """
    print("export to hsdb")
    # ibs.inject_func(get_hsdb_image_gpaths)

    # Build Image Table
    gid_list = ibs.get_valid_gids()
    gpath_list = get_hsdb_image_gpaths(ibs, gid_list)
    reviewed_list = ibs.get_image_reviewed(gid_list)
    # aif in hotspotter is equivilant to reviewed in IBEIS
    image_table_csv = ut.make_csv_table([gid_list, gpath_list, reviewed_list], ["gid", "gname", "aif"], "# image table")

    # Build Name Table
    nid_list = ibs.get_valid_nids()
    name_list = ibs.get_name_texts(nid_list)
    name_table_csv = ut.make_csv_table([nid_list, name_list], ["nid", "name"], "# name table")

    # Build Chip Table
    aid_list = ibs.get_valid_aids()
    annotationgid_list = ibs.get_annot_gids(aid_list)
    annotationnid_list = ibs.get_annot_name_rowids(aid_list)
    bbox_list = list(map(list, ibs.get_annot_bboxes(aid_list)))
    theta_list = ibs.get_annot_thetas(aid_list)
    notes_list = ibs.get_annot_notes(aid_list)

    chip_column_list = [aid_list, annotationgid_list, annotationnid_list, bbox_list, theta_list, notes_list]
    chip_column_lbls = ["cid", "gid", "nid", "[tlx tly w h]", "theta", "notes"]
    chip_column_types = [int, int, int, list, float, str]
    chip_table_csv = ut.make_csv_table(chip_column_list, chip_column_lbls, "# chip table", chip_column_types)

    if ut.VERBOSE:
        if len(aid_list) < 87:
            print(chip_table_csv)
        if len(nid_list) < 87:
            print(name_table_csv)
        if len(gid_list) < 87:
            print(image_table_csv)
    return image_table_csv, name_table_csv, chip_table_csv
Пример #18
0
 def nice_table(self):
     import utool as ut
     return ut.make_csv_table(ut.listT(self.row_data), raw=True)