wbia.other package¶
Submodules¶
wbia.other.dbinfo module¶
get_dbinfo is probably the only usefull funciton in here # This is not the cleanest module
-
wbia.other.dbinfo.
get_dbinfo
(ibs, verbose=True, with_imgsize=True, with_bytes=True, with_contrib=True, with_agesex=True, with_header=True, with_reviews=True, with_ggr=False, with_ca=False, with_map=False, short=False, tag='dbinfo', aid_list=None, aids=None, gmt_offset=3.0)[source]¶ Returns dictionary of digestable database information Infostr is a string summary of all the stats. Prints infostr in addition to returning locals
Parameters: - ibs (IBEISController) –
- verbose (bool) –
- with_imgsize (bool) –
- with_bytes (bool) –
Returns: Return type: - SeeAlso:
- python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db PZ_PB_RF_TRAIN –use-hist=True –old=False –per_name_vpedge=False python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db PZ_PB_RF_TRAIN –all
- CommandLine:
python -m wbia.other.dbinfo –exec-get_dbinfo:0 python -m wbia.other.dbinfo –test-get_dbinfo:1 python -m wbia.other.dbinfo –test-get_dbinfo:0 –db NNP_Master3 python -m wbia.other.dbinfo –test-get_dbinfo:0 –db PZ_Master1 python -m wbia.other.dbinfo –test-get_dbinfo:0 –db GZ_ALL python -m wbia.other.dbinfo –exec-get_dbinfo:0 –db PZ_ViewPoints python -m wbia.other.dbinfo –exec-get_dbinfo:0 –db GZ_Master1
python -m wbia.other.dbinfo –exec-get_dbinfo:0 –db LF_Bajo_bonito -a default python -m wbia.other.dbinfo –exec-get_dbinfo:0 –db DETECT_SEATURTLES -a default –readonly
python -m wbia.other.dbinfo –exec-get_dbinfo:0 -a ctrl python -m wbia.other.dbinfo –exec-get_dbinfo:0 -a default:minqual=ok,require_timestamp=True –dbdir ~/lev/media/danger/LEWA python -m wbia.other.dbinfo –exec-get_dbinfo:0 -a default:minqual=ok,require_timestamp=True –dbdir ~/lev/media/danger/LEWA –loadbackup=0
python -m wbia.other.dbinfo –exec-get_dbinfo:0 -a default: –dbdir ~/lev/media/danger/LEWA python -m wbia.other.dbinfo –exec-get_dbinfo:0 -a default: –dbdir ~/lev/media/danger/LEWA –loadbackup=0
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.dbinfo import * # NOQA >>> import wbia >>> defaultdb = 'testdb1' >>> ibs, aid_list = wbia.testdata_aids(defaultdb, a='default:minqual=ok,view=primary,view_ext1=1') >>> kwargs = ut.get_kwdefaults(get_dbinfo) >>> kwargs['verbose'] = False >>> kwargs['aid_list'] = aid_list >>> kwargs = ut.parse_dict_from_argv(kwargs) >>> output = get_dbinfo(ibs, **kwargs) >>> result = (output['info_str']) >>> print(result) >>> #ibs = wbia.opendb(defaultdb='testdb1') >>> # <HACK FOR FILTERING> >>> #from wbia.expt import cfghelpers >>> #from wbia.expt import annotation_configs >>> #from wbia.init import filter_annots >>> #named_defaults_dict = ut.dict_take(annotation_configs.__dict__, >>> # annotation_configs.TEST_NAMES) >>> #named_qcfg_defaults = dict(zip(annotation_configs.TEST_NAMES, >>> # ut.get_list_column(named_defaults_dict, 'qcfg'))) >>> #acfg = cfghelpers.parse_argv_cfg(('--annot-filter', '-a'), named_defaults_dict=named_qcfg_defaults, default=None)[0] >>> #aid_list = ibs.get_valid_aids() >>> # </HACK FOR FILTERING>
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.dbinfo import * # NOQA >>> import wbia >>> verbose = True >>> short = True >>> #ibs = wbia.opendb(db='GZ_ALL') >>> #ibs = wbia.opendb(db='PZ_Master0') >>> ibs = wbia.opendb('testdb1') >>> assert ibs.get_dbname() == 'testdb1', 'DO NOT DELETE CONTRIBUTORS OF OTHER DBS' >>> ibs.delete_contributors(ibs.get_valid_contributor_rowids()) >>> ibs.delete_empty_nids() >>> #ibs = wbia.opendb(db='PZ_MTEST') >>> output = get_dbinfo(ibs, with_contrib=False, verbose=False, short=True) >>> result = (output['info_str']) >>> print(result) +============================ DB Info: testdb1 DB Notes: None DB NumContrib: 0 ---------- # Names = 7 # Names (unassociated) = 0 # Names (singleton) = 5 # Names (multiton) = 2 ---------- # Annots = 13 # Annots (unknown) = 4 # Annots (singleton) = 5 # Annots (multiton) = 4 ---------- # Img = 13 L============================
-
wbia.other.dbinfo.
get_short_infostr
(ibs)[source]¶ Returns printable database information
Parameters: ibs (IBEISController) – wbia controller object Returns: infostr Return type: str - CommandLine:
- python -m wbia.other.dbinfo –test-get_short_infostr
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.dbinfo import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> infostr = get_short_infostr(ibs) >>> result = str(infostr) >>> print(result) dbname = 'testdb1' num_images = 13 num_annotations = 13 num_names = 7
-
wbia.other.dbinfo.
hackshow_names
(ibs, aid_list, fnum=None)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- aid_list (list) –
- CommandLine:
- python -m wbia.other.dbinfo –exec-hackshow_names –show python -m wbia.other.dbinfo –exec-hackshow_names –show –db PZ_Master1
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.dbinfo import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='PZ_MTEST') >>> aid_list = ibs.get_valid_aids() >>> result = hackshow_names(ibs, aid_list) >>> print(result) >>> ut.show_if_requested()
-
wbia.other.dbinfo.
latex_dbstats
(ibs_list, **kwargs)[source]¶ Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.dbinfo –exec-latex_dbstats –dblist testdb1 python -m wbia.other.dbinfo –exec-latex_dbstats –dblist testdb1 –show python -m wbia.other.dbinfo –exec-latex_dbstats –dblist PZ_Master0 testdb1 –show python -m wbia.other.dbinfo –exec-latex_dbstats –dblist PZ_Master0 PZ_MTEST GZ_ALL –show python -m wbia.other.dbinfo –test-latex_dbstats –dblist GZ_ALL NNP_MasterGIRM_core –show
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.dbinfo import * # NOQA >>> import wbia >>> db_list = ut.get_argval('--dblist', type_=list, default=['testdb1']) >>> ibs_list = [wbia.opendb(db=db) for db in db_list] >>> tabular_str = latex_dbstats(ibs_list) >>> tabular_cmd = ut.latex_newcommand(ut.latex_sanitize_command_name('DatabaseInfo'), tabular_str) >>> ut.copy_text_to_clipboard(tabular_cmd) >>> write_fpath = ut.get_argval('--write', type_=str, default=None) >>> if write_fpath is not None: >>> fpath = ut.truepath(write_fpath) >>> text = ut.readfrom(fpath) >>> new_text = ut.replace_between_tags(text, tabular_cmd, '% <DBINFO>', '% </DBINFO>') >>> ut.writeto(fpath, new_text) >>> ut.print_code(tabular_cmd, 'latex') >>> ut.quit_if_noshow() >>> ut.render_latex_text('\\noindent \n' + tabular_str)
-
wbia.other.dbinfo.
print_qd_info
(ibs, qaid_list, daid_list, verbose=False)[source]¶ - SeeAlso:
- ibs.print_annotconfig_stats(qaid_list, daid_list)
information for a query/database aid configuration
-
wbia.other.dbinfo.
show_image_time_distributions
(ibs, gid_list)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- gid_list (list) –
- CommandLine:
- python -m wbia.other.dbinfo show_image_time_distributions –show python -m wbia.other.dbinfo show_image_time_distributions –show –db lynx
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.dbinfo import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aids = wbia.testdata_aids(ibs=ibs) >>> gid_list = ut.unique_unordered(ibs.get_annot_gids(aids)) >>> result = show_image_time_distributions(ibs, gid_list) >>> print(result) >>> ut.show_if_requested()
-
wbia.other.dbinfo.
sight_resight_count
(nvisit1, nvisit2, resight)[source]¶ Lincoln Petersen Index
The Lincoln-Peterson index is a method used to estimate the total number of individuals in a population given two independent sets observations. The likelihood of a population size is a hypergeometric distribution given by assuming a uniform sampling distribution.
Parameters: Returns: (pl_index, pl_error)
Return type: - LaTeX:
- begin{equation}label{eqn:lpifull}
L(poptotal given nvisit_1, nvisit_2, resight) = frac{
binom{nvisit_1}{resight} binom{poptotal - nvisit_1}{nvisit_2 - resight}- }{
- binom{poptotal}{nvisit_2}
}
end{equation} Assuming that $T$ has a uniform prior distribution, the maximum
likelihood estimation of population size given two visits to a location is:- begin{equation}label{eqn:lpi}
- poptotal approx frac{nvisit_1 nvisit_2}{resight} pm 1.96 sqrt{frac{{(nvisit_1)}^2 (nvisit_2) (nvisit_2 - resight)}{resight^3}}
end{equation}
References
https://en.wikipedia.org/wiki/Mark_and_recapture https://en.wikipedia.org/wiki/Talk:Mark_and_recapture#Statistical_treatment https://mail.google.com/mail/u/0/#search/lincoln+peterse+n/14c6b50227f5209f https://probabilityandstats.wordpress.com/tag/maximum-likelihood-estimate/ http://math.arizona.edu/~jwatkins/o-mle.pdf
- CommandLine:
- python -m wbia.other.dbinfo sight_resight_count –show
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.dbinfo import * # NOQA >>> nvisit1 = 100 >>> nvisit2 = 20 >>> resight = 10 >>> (pl_index, pl_error) = sight_resight_count(nvisit1, nvisit2, resight) >>> result = '(pl_index, pl_error) = %s' % ut.repr2((pl_index, pl_error)) >>> pl_low = max(pl_index - pl_error, 1) >>> pl_high = pl_index + pl_error >>> print('pl_low = %r' % (pl_low,)) >>> print('pl_high = %r' % (pl_high,)) >>> print(result) >>> ut.quit_if_noshow() >>> import wbia.plottool as pt >>> import scipy, scipy.stats >>> x = pl_index # np.array([10, 11, 12]) >>> k, N, K, n = resight, x, nvisit1, nvisit2 >>> #k, M, n, N = k, N, k, n # Wiki to SciPy notation >>> #prob = scipy.stats.hypergeom.cdf(k, N, K, n) >>> fig = pt.figure(1) >>> fig.clf() >>> N_range = np.arange(1, pl_high * 2) >>> # Something seems to be off >>> probs = sight_resight_prob(N_range, nvisit1, nvisit2, resight) >>> pl_prob = sight_resight_prob([pl_index], nvisit1, nvisit2, resight)[0] >>> pt.plot(N_range, probs, 'b-', label='probability of population size') >>> pt.plt.title('nvisit1=%r, nvisit2=%r, resight=%r' % ( >>> nvisit1, nvisit2, resight)) >>> pt.plot(pl_index, pl_prob, 'rx', label='Lincoln Peterson Estimate') >>> pt.plot([pl_low, pl_high], [pl_prob, pl_prob], 'gx-', >>> label='Lincoln Peterson Error Bar') >>> pt.legend() >>> ut.show_if_requested()
wbia.other.detectcore module¶
Developer convenience functions for ibs (detections).
- TODO: need to split up into sub modules:
consistency_checks feasibility_fixes move the export stuff to dbio
then there are also convineience functions that need to be ordered at least within this file
-
wbia.other.detectcore.
classifier_visualize_training_localizations
(ibs, classifier_weight_filepath, species_list=['zebra'], scheme=2, output_path=None, values=None, **kwargs)[source]¶
-
wbia.other.detectcore.
export_to_coco
(ibs, species_list, species_mapping={}, viewpoint_mapping={}, target_size=2400, use_maximum_linear_dimension=True, use_existing_train_test=True, include_parts=False, gid_list=None, include_reviews=False, require_image_reviewed=False, require_named=False, output_images=True, use_global_train_set=False, **kwargs)[source]¶ Create training COCO dataset for training models.
-
wbia.other.detectcore.
export_to_xml
(ibs, species_list, species_mapping=None, offset='auto', enforce_viewpoint=False, target_size=900, purge=False, use_maximum_linear_dimension=True, use_existing_train_test=True, include_parts=False, gid_list=None, output_path=None, allow_empty_images=False, min_annot_size=5, **kwargs)[source]¶ Create training XML for training models.
-
wbia.other.detectcore.
imageset_train_test_split
(ibs, train_split=0.8, is_tile=False, gid_list=None, **kwargs)[source]¶
-
wbia.other.detectcore.
redownload_detection_models
(ibs)[source]¶ Re-download detection models.
Parameters: ibs (IBEISController) – - CommandLine:
- python -c “from wbia.algo.detect import grabmodels; grabmodels.redownload_models()” python -c “import utool, wbia.algo; utool.view_directory(wbia.algo.detect.grabmodels._expand_modeldir())”
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.detectcore import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> result = redownload_detection_models(ibs) >>> print(result)
-
wbia.other.detectcore.
visualize_bounding_boxes
(ibs, config, version, gid_list=None, randomize=False, num_images=10, t_width=500, output_path=None)[source]¶
-
wbia.other.detectcore.
visualize_pascal_voc_dataset
(ibs, dataset_path, num_examples=30, randomize=False, write=True, write_path=None)[source]¶ Visualize the PASCAL VOC dataset.
Parameters: - ibs (IBEISController) –
- dataset_path (str) – the dataset path in the PASCAL VOC format
- num_examples (int, optional) – the number of examples to draw
- randomize (bool, optional) – if to randomize the visualization
- write (bool, optional) – if to display or write the files
- CommandLine:
- python -m wbia.other.detectcore –test-visualize_pascal_voc_dataset
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.detectcore import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> dataset_path = '/Users/jason.parham/Downloads/wilddog_data/data/VOCdevkit/VOC2020/' >>> # dataset_path = '/Users/jason.parham/Downloads/LearningData/' >>> # dataset_path = '/Users/jason.parham/Downloads/VOCdevkit/VOC2018/' >>> ibs.visualize_pascal_voc_dataset(dataset_path, randomize=True)
wbia.other.detectexport module¶
-
wbia.other.detectexport.
get_cnn_classifier_cameratrap_binary_training_images_pytorch
(ibs, positive_imageset_id, negative_imageset_id, dest_path=None, valid_rate=0.2, image_size=224, purge=True, skip_rate=0.0, skip_rate_pos=0.0, skip_rate_neg=0.0)[source]¶
-
wbia.other.detectexport.
get_cnn_classifier_canonical_training_images_pytorch
(ibs, species, dest_path=None, valid_rate=0.2, image_size=224, purge=True, skip_rate=0.0, skip_rate_pos=0.0, skip_rate_neg=0.0)[source]¶
-
wbia.other.detectexport.
get_cnn_classifier_multiclass_training_images_pytorch
(ibs, gid_list, label_list, dest_path=None, valid_rate=0.2, image_size=224, purge=True, skip_rate=0.0)[source]¶
-
wbia.other.detectexport.
get_cnn_labeler_training_images_pytorch
(ibs, dest_path=None, image_size=224, category_list=None, min_examples=10, category_mapping=None, viewpoint_mapping=None, flip_mapping=None, purge=True, strict=True, skip_rate=0.0, valid_rate=0.2, use_axis_aligned_chips=False, train_gid_set=None)[source]¶
wbia.other.detectfuncs module¶
Developer convenience functions for ibs (detections).
- TODO: need to split up into sub modules:
consistency_checks feasibility_fixes move the export stuff to dbio
then there are also convineience functions that need to be ordered at least within this file
-
wbia.other.detectfuncs.
aoi2_confusion_matrix_algo_plot
(ibs, label, color, conf, output_cases=False, category_list=None, test_gid_set_=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
aoi2_precision_recall_algo
(ibs, category_list=None, test_gid_set_=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
aoi2_precision_recall_algo_display
(ibs, test_gid_list=None, output_cases=False, figsize=(20, 20))[source]¶
-
wbia.other.detectfuncs.
background_accuracy_display
(ibs, category_list, test_gid_set=None, output_path=None)[source]¶
-
wbia.other.detectfuncs.
canonical_confusion_matrix_algo_plot
(ibs, label, color, conf, species, output_cases=False, **kwargs)[source]¶
-
wbia.other.detectfuncs.
canonical_localization_deviation_plot
(ibs, attribute, color, index, label=None, species=None, marker='o', **kwargs)[source]¶
-
wbia.other.detectfuncs.
canonical_localization_iou_plot
(ibs, color, index, label=None, species=None, marker='o', threshold=0.75, **kwargs)[source]¶
-
wbia.other.detectfuncs.
canonical_localization_iou_visualize
(ibs, index, test_aid_set, test_bbox_set, prediction_list, overlap_list, color_list, label=None, species=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
canonical_localization_precision_recall_algo_display
(ibs, figsize=(20, 40))[source]¶
-
wbia.other.detectfuncs.
classifier2_precision_recall_algo
(ibs, category, species_mapping={}, output_path=None, test_gid_list=None, test_label_list=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
classifier2_precision_recall_algo_display
(ibs, species_list=None, species_mapping={}, nice_mapping={}, test_gid_list=None, test_label_list=None, figsize=(20, 9), **kwargs)[source]¶
-
wbia.other.detectfuncs.
classifier_cameratrap_confusion_matrix_algo_plot
(ibs, label, color, conf, positive_imageset_id, negative_imageset_id, output_cases=False, **kwargs)[source]¶
-
wbia.other.detectfuncs.
classifier_cameratrap_precision_recall_algo
(ibs, positive_imageset_id, negative_imageset_id, **kwargs)[source]¶
-
wbia.other.detectfuncs.
classifier_cameratrap_precision_recall_algo_display
(ibs, positive_imageset_id, negative_imageset_id, config_list=None, figsize=(20, 20))[source]¶
-
wbia.other.detectfuncs.
general_area_best_conf
(conf_list, x_list, y_list, label='Unknown', color='b', marker='o', plot_point=True, interpolate=True, target=(1.0, 1.0), target_recall=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
general_confusion_matrix_algo
(label_correct_list, label_predict_list, category_list, category_mapping, fig_, axes_, fuzzy_dict=None, conf=None, conf_list=None, size=10, **kwargs)[source]¶
-
wbia.other.detectfuncs.
general_get_imageset_gids
(ibs, imageset_text, unique=True, **kwargs)[source]¶
-
wbia.other.detectfuncs.
general_identify_operating_point
(conf_list, x_list, y_list, target=(1.0, 1.0))[source]¶
-
wbia.other.detectfuncs.
general_parse_gt_annots
(ibs, aid_list, include_parts=True, species_mapping={}, gt_species_mapping={}, **kwargs)[source]¶
-
wbia.other.detectfuncs.
general_precision_recall_algo
(ibs, label_list, confidence_list, category='positive', samples=1000, **kwargs)[source]¶
-
wbia.other.detectfuncs.
labeler_confusion_matrix_algo_plot
(ibs, category_list, species_mapping={}, viewpoint_mapping={}, category_mapping=None, test_gid_set=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
labeler_precision_recall_algo
(ibs, category_list, label_dict, **kwargs)[source]¶
-
wbia.other.detectfuncs.
labeler_precision_recall_algo_display
(ibs, category_list=None, species_mapping={}, viewpoint_mapping={}, category_mapping=None, fuzzy_dict=None, figsize=(30, 9), test_gid_set=None, use_axis_aligned_chips=False, labeler_weight_filepath=None, config_list=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
labeler_tp_tn_fp_fn
(ibs, category_list, species_mapping={}, viewpoint_mapping={}, samples=1000, test_gid_set=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
localizer_assignments
(pred_list, gt_list, gt_list_=[], min_overlap=0.5)[source]¶
-
wbia.other.detectfuncs.
localizer_confusion_matrix_algo_plot
(ibs, label=None, target_conf=None, test_gid_list=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
localizer_iou_recall_algo
(ibs, samples=100, test_gid_list=None, ignore_filter_func=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
localizer_parse_pred
(ibs, test_gid_list=None, species_mapping={}, pred_species_mapping={}, **kwargs)[source]¶
-
wbia.other.detectfuncs.
localizer_parse_pred_dirty
(ibs, test_gid_list, species_mapping_, **kwargs)[source]¶
-
wbia.other.detectfuncs.
localizer_precision_recall
(ibs, config_dict=None, output_path=None, test_gid_list=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
localizer_precision_recall_algo
(ibs, samples=1000, test_gid_list=None, **kwargs)[source]¶
-
wbia.other.detectfuncs.
localizer_precision_recall_algo_display
(ibs, config_list, config_tag='', min_overlap=0.5, figsize=(40, 9), target_recall=0.8, BEST_INDEX=None, offset_color=0, write_images=False, plot_point=True, output_path=None, plot_iou_recall=True, **kwargs)[source]¶
-
wbia.other.detectfuncs.
localizer_precision_recall_algo_display_animate
(ibs, config_list, **kwargs)[source]¶
wbia.other.detectgrave module¶
Developer convenience functions for ibs (detections).
- TODO: need to split up into sub modules:
consistency_checks feasibility_fixes move the export stuff to dbio
then there are also convineience functions that need to be ordered at least within this file
-
wbia.other.detectgrave.
bootstrap
(ibs, species_list=['zebra'], N=10, rounds=20, scheme=2, ensemble=9, output_path=None, precompute=True, precompute_test=True, recompute=False, visualize=True, C=1.0, kernel='rbf', **kwargs)[source]¶
-
wbia.other.detectgrave.
bootstrap2
(ibs, species_list=['zebra'], alpha=10, gamma=16, epsilon=0.3, rounds=20, ensemble=3, dims=64, pca_limit=1000000, nms_thresh_pos=0.5, nms_thresh_neg=0.9, C=1.0, kernel='rbf', theta=1.0, output_path=None, precompute=True, precompute_test=True, recompute=False, recompute_classifications=True, overlap_thresh_cat_1=0.75, overlap_thresh_cat_2=0.25, overlap_thresh_cat_3=0.0, **kwargs)[source]¶
-
wbia.other.detectgrave.
bootstrap_pca_test
(ibs, dims=64, pca_limit=500000, ann_batch=50, model_path=None, output_path=None, neighbors=1000, nms_thresh=0.5, min_confidence=0.3, **kwargs)[source]¶
-
wbia.other.detectgrave.
bootstrap_pca_train
(ibs, dims=64, pca_limit=500000, ann_batch=50, output_path=None, **kwargs)[source]¶
-
wbia.other.detectgrave.
classifier2_train_image_rf
(ibs, species_list, output_path=None, dryrun=False, n_estimators=100)[source]¶
-
wbia.other.detectgrave.
classifier2_train_image_rf_sweep
(ibs, species_list, precompute=True, **kwargs)[source]¶
-
wbia.other.detectgrave.
classifier_train_image_svm
(ibs, species_list, output_path=None, dryrun=False, C=1.0, kernel='rbf')[source]¶
wbia.other.detecttrain module¶
Developer convenience functions for ibs (detections).
- TODO: need to split up into sub modules:
consistency_checks feasibility_fixes move the export stuff to dbio
then there are also convineience functions that need to be ordered at least within this file
-
wbia.other.detecttrain.
aoi2_train
(ibs, species_list=None, train_gid_list=None, purge=True, cache=False)[source]¶
-
wbia.other.detecttrain.
background_train
(ibs, species, train_gid_set=None, global_limit=500000, **kwargs)[source]¶ Example: >>> values = output_path, X_file, y_file >>> print(values) >>> output_path, X_file, y_file = values >>> from wbia_cnn.models.background import train_background >>> values = ( >>> ‘/data/ibeis/IMS_Master/_ibsdb/_ibeis_cache/training/background’, >>> ‘/data/ibeis/IMS_Master/_ibsdb/_ibeis_cache/extracted/background/raw/X.npy’, >>> ‘/data/ibeis/IMS_Master/_ibsdb/_ibeis_cache/extracted/background/labels/y.npy’ >>> ) >>> output_path, X_file, y_file = values
-
wbia.other.detecttrain.
canonical_classifier_train
(ibs, species, ensembles=3, extracted_path=None, **kwargs)[source]¶
-
wbia.other.detecttrain.
classifier2_train
(ibs, species_list=None, species_mapping={}, train_gid_set=None, **kwargs)[source]¶
-
wbia.other.detecttrain.
classifier_cameratrap_densenet_train
(ibs, positive_imageset_id, negative_imageset_id, ensembles=3, **kwargs)[source]¶
-
wbia.other.detecttrain.
classifier_cameratrap_train
(ibs, positive_imageset_id, negative_imageset_id, **kwargs)[source]¶
-
wbia.other.detecttrain.
classifier_multiclass_densenet_train
(ibs, gid_list, label_list, ensembles=3, **kwargs)[source]¶ >>> import uuid >>> manifest_filepath = join(ibs.dbdir, 'flukebook_groundtruth.csv') >>> with open(manifest_filepath, 'r') as manifest_file: >>> line_list = manifest_file.readlines() >>> >>> label_dict = { >>> 'Left Dorsal Fin' : 'left_dorsal_fin', >>> 'Right Dorsal Fin' : 'right_dorsal_fin', >>> 'Tail Fluke' : 'tail_fluke', >>> } >>> >>> uuid_list = [] >>> label_list = [] >>> for line in line_list: >>> line = line.strip().split(',') >>> assert len(line) == 2 >>> uuid_, label_ = line >>> uuid_ = uuid.UUID(uuid_) >>> label_ = label_.strip() >>> print(uuid_, label_) >>> uuid_list.append(uuid_) >>> label_ = label_dict.get(label_, None) >>> assert label_ is not None >>> label_list.append(label_) >>> >>> gid_list = ibs.get_image_gids_from_uuid(uuid_list) >>> assert None not in gid_list >>> # archive_path = ibs.classifier_multiclass_densenet_train(gid_list, label_list) >>> ibs.classifier2_precision_recall_algo_display(test_gid_list=gid_list, test_label_list=label_list)
-
wbia.other.detecttrain.
labeler_train
(ibs, species_list=None, species_mapping=None, viewpoint_mapping=None, ensembles=3, **kwargs)[source]¶
-
wbia.other.detecttrain.
labeler_train_wbia_cnn
(ibs, species_list=None, species_mapping=None, viewpoint_mapping=None, **kwargs)[source]¶
wbia.other.duct_tape module¶
-
wbia.other.duct_tape.
remove_database_slag
(ibs, delete_empty_names=False, delete_empty_imagesets=False, delete_annotations_for_missing_images=False, delete_image_labels_for_missing_types=False, delete_annot_labels_for_missing_types=False, delete_chips_for_missing_annotations=False, delete_features_for_missing_annotations=False, delete_invalid_eg_relations=False, delete_invalid_gl_relations=False, delete_invalid_al_relations=True)[source]¶
wbia.other.ibsfuncs module¶
developer convenience functions for ibs
- TODO: need to split up into sub modules:
consistency_checks feasibility_fixes move the export stuff to dbio
python -m utool.util_inspect check_module_usage –pat=”ibsfuncs.py”
then there are also convineience functions that need to be ordered at least within this file
-
wbia.other.ibsfuncs.
assert_lblannot_rowids_are_type
(ibs, lblannot_rowid_list, valid_lbltype_rowid)[source]¶
-
wbia.other.ibsfuncs.
assert_valid_aids
(ibs, aid_list, verbose=False, veryverbose=False, msg='', auuid_list=None)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- aid_list (int) – list of annotation ids
- verbose (bool) – verbosity flag(default = False)
- veryverbose (bool) – (default = False)
- CommandLine:
- python -m wbia.other.ibsfuncs –test-assert_valid_aids
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aid_list = ibs.get_valid_aids() >>> verbose = False >>> veryverbose = False >>> print('Asserting multiple') >>> result = assert_valid_aids(ibs, aid_list, verbose, veryverbose) >>> print('Asserting single') >>> result = assert_valid_aids(ibs, aid_list[0:1], verbose, veryverbose) >>> print('Asserting multiple incorrect') >>> auuid_list = ibs.get_annot_uuids(aid_list) + [None] >>> try: >>> result = assert_valid_aids(ibs, aid_list + [0], verbose, veryverbose, auuid_list=auuid_list) >>> except AssertionError: >>> print('Correctly got assertion') >>> else: >>> assert False, 'should have failed' >>> print('Asserting single incorrect') >>> try: >>> result = assert_valid_aids(ibs, [0], verbose, veryverbose) >>> except AssertionError: >>> print('Correctly got assertion') >>> else: >>> assert False, 'should have failed' >>> print(result) >>> print(result)
-
wbia.other.ibsfuncs.
assert_valid_names
(name_list)[source]¶ Asserts that user specified names do not conflict with the standard unknown name
-
wbia.other.ibsfuncs.
batch_rename_consecutive_via_species
(ibs, imgsetid=None, location_text=None, notify_wildbook=True, assert_wildbook=True)[source]¶
-
wbia.other.ibsfuncs.
bytes2human
(n, format='%(value).02f%(symbol)s', symbols='customary')[source]¶ -
Convert n bytes into a human readable string based on format. symbols can be either “customary”, “customary_ext”, “iec” or “iec_ext”, see: https://en.wikipedia.org/wiki/Binary_prefix#Specific_units_of_IEC_60027-2_A.2_and_ISO.2FIEC_80000
>>> bytes2human(0) '0.0 B' >>> bytes2human(0.9) '0.0 B' >>> bytes2human(1) '1.0 B' >>> bytes2human(1.9) '1.0 B' >>> bytes2human(1024) '1.0 K' >>> bytes2human(1048576) '1.0 M' >>> bytes2human(1099511627776127398123789121) '909.5 Y'
>>> bytes2human(9856, symbols="customary") '9.6 K' >>> bytes2human(9856, symbols="customary_ext") '9.6 kilo' >>> bytes2human(9856, symbols="iec") '9.6 Ki' >>> bytes2human(9856, symbols="iec_ext") '9.6 kibi'
>>> bytes2human(10000, "%(value).1f %(symbol)s/sec") '9.8 K/sec'
>>> # precision can be adjusted by playing with %f operator >>> bytes2human(10000, format="%(value).5f %(symbol)s") '9.76562 K'
-
wbia.other.ibsfuncs.
check_annot_consistency
(ibs, aid_list=None)[source]¶ Parameters: - ibs (IBEISController) –
- aid_list (list) –
- CommandLine:
- python -m wbia.other.ibsfuncs –test-check_annot_consistency
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> aid_list = ibs.get_valid_aids() >>> result = check_annot_consistency(ibs, aid_list) >>> print(result)
-
wbia.other.ibsfuncs.
check_annot_corrupt_uuids
(ibs, aid_list=None)[source]¶ >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('PZ_MTEST') >>> aid_list = ibs.get_valid_aids() >>> check_annot_corrupt_uuids(ibs, aid_list)
-
wbia.other.ibsfuncs.
check_cache_purge
(ibs, ttl_days=90, dryrun=True, squeeze=True)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- gid_list (list) – (default = None)
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-check_cache_purge
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> result = check_cache_purge(ibs) >>> print(result)
-
wbia.other.ibsfuncs.
check_ggr_valid_aids
(ibs, aid_list, species='zebra_grevys', threshold=0.75, enable_grid=True, verbose=True)[source]¶
-
wbia.other.ibsfuncs.
check_image_consistency
(ibs, gid_list=None)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- gid_list (list) – (default = None)
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-check_image_consistency –db=GZ_Master1
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> gid_list = None >>> result = check_image_consistency(ibs, gid_list) >>> print(result)
-
wbia.other.ibsfuncs.
check_image_uuid_consistency
(ibs, gid_list=None)[source]¶ Checks to make sure image uuids are computed detemenistically by recomputing all guuids and checking that they are equal to what is already there.
VERY SLOW
- CommandLine:
- python -m wbia.other.ibsfuncs –test-check_image_uuid_consistency –db=PZ_Master0 python -m wbia.other.ibsfuncs –test-check_image_uuid_consistency –db=GZ_Master1 python -m wbia.other.ibsfuncs –test-check_image_uuid_consistency python -m wbia.other.ibsfuncs –test-check_image_uuid_consistency –db lynx
Example
>>> # SCRIPT >>> import wbia >>> import utool as ut >>> ibs = wbia.opendb(defaultdb='PZ_MTEST') >>> images = ibs.images() >>> # Check only very the largest files >>> #bytes_list_ = [ >>> # ut.get_file_nBytes(path) >>> # for path in ut.ProgIter(images.paths, lbl='reading nbytes')] >>> #sortx = ut.list_argsort(bytes_list_, reverse=True)[0:10] >>> #images = images.take(sortx) >>> gid_list = list(images) >>> wbia.other.ibsfuncs.check_image_uuid_consistency(ibs, gid_list)
-
wbia.other.ibsfuncs.
check_name_consistency
(ibs, nid_list)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- nid_list (list) –
- CommandLine:
- python -m wbia.other.ibsfuncs –test-check_name_consistency
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> nid_list = ibs._get_all_known_nids() >>> result = check_name_consistency(ibs, nid_list) >>> print(result)
-
wbia.other.ibsfuncs.
check_name_mapping_consistency
(ibs, nx2_aids)[source]¶ checks that all the aids grouped in a name ahave the same name
-
wbia.other.ibsfuncs.
compare_nested_props
(ibs, aids1_list, aids2_list, getter_func, cmp_func)[source]¶ Compares properties of query vs database annotations
grouped_qaids = aids1_list grouped_groundtruth_list = aids2_list
getter_func = ibs.get_annot_yaws cmp_func = vt.ori_distance
getter_func = ibs.get_annot_image_unixtimes_asfloat cmp_func = ut.unixtime_hourdiff
- ExpandNestedComparisions:
- import itertools list(map(list, itertools.starmap(ut.iprod, zip(aids1_list, aids2_list))))
Parameters: - ibs (IBEISController) – wbia controller object
- aids1_list (list) –
- aids2_list (list) –
- getter_func –
- cmp_func –
Returns: Return type: list of ndarrays
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-compare_nested_props –show
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='PZ_MTEST') >>> aids1_list = [ibs.get_valid_aids()[8:11]] >>> aids2_list = [ibs.get_valid_aids()[8:11]] >>> getter_func = ibs.get_annot_image_unixtimes_asfloat >>> cmp_func = ut.unixtime_hourdiff >>> result = compare_nested_props(ibs, aids1_list, aids2_list, getter_func, cmp_func) >>> print(result) >>> ut.quit_if_noshow() >>> import wbia.plottool as pt >>> ut.show_if_requested()
-
wbia.other.ibsfuncs.
compute_all_chips
(ibs, aid_list=None, **kwargs)[source]¶ Executes lazy evaluation of all chips
-
wbia.other.ibsfuncs.
compute_ggr_fix_gps_contributors_aids
(ibs, min_diff=600, individual=False)[source]¶
-
wbia.other.ibsfuncs.
compute_ggr_fix_gps_contributors_gids
(ibs, min_diff=600, individual=False)[source]¶
-
wbia.other.ibsfuncs.
compute_ggr_imagesets
(ibs, gid_list=None, min_diff=86400, individual=False, purge_all_old=False)[source]¶
-
wbia.other.ibsfuncs.
compute_occurrences
(ibs, config=None)[source]¶ Clusters ungrouped images into imagesets representing occurrences
- CommandLine:
- python -m wbia.control.IBEISControl –test-compute_occurrences
Example
>>> # ENABLE_DOCTEST >>> from wbia.control.IBEISControl import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> ibs.compute_occurrences(config={'use_gps': False, 'seconds_thresh': 600}) >>> ibs.update_special_imagesets() >>> # Remove some images from a non-special imageset >>> nonspecial_imgsetids = [i for i in ibs.get_valid_imgsetids() if i not in ibs.get_special_imgsetids()] >>> images_to_remove = ibs.get_imageset_gids(nonspecial_imgsetids[0:1])[0][0:1] >>> ibs.unrelate_images_and_imagesets(images_to_remove,nonspecial_imgsetids[0:1] * len(images_to_remove)) >>> ibs.update_special_imagesets() >>> ungr_imgsetid = ibs.get_imageset_imgsetids_from_text(const.UNGROUPED_IMAGES_IMAGESETTEXT) >>> ungr_gids = ibs.get_imageset_gids([ungr_imgsetid])[0] >>> #Now let's make sure that when we recompute imagesets, our non-special imgsetid remains the same >>> print('PRE COMPUTE: ImageSets are %r' % ibs.get_valid_imgsetids()) >>> print('Containing: %r' % ibs.get_imageset_gids(ibs.get_valid_imgsetids())) >>> ibs.compute_occurrences(config={'use_gps': False, 'seconds_thresh': 600}) >>> print('COMPUTE: New imagesets are %r' % ibs.get_valid_imgsetids()) >>> print('Containing: %r' % ibs.get_imageset_gids(ibs.get_valid_imgsetids())) >>> ibs.update_special_imagesets() >>> print('UPDATE SPECIAL: New imagesets are %r' % ibs.get_valid_imgsetids()) >>> print('Containing: %r' % ibs.get_imageset_gids(ibs.get_valid_imgsetids())) >>> assert(images_to_remove[0] not in ibs.get_imageset_gids(nonspecial_imgsetids[0:1])[0])
-
wbia.other.ibsfuncs.
compute_occurrences_smart
(ibs, gid_list, smart_xml_fpath)[source]¶ Function to load and process a SMART patrol XML file
-
wbia.other.ibsfuncs.
convert_empty_images_to_annotations
(ibs)[source]¶ images without chips are given an ANNOTATION over the entire image
-
wbia.other.ibsfuncs.
copy_imagesets
(ibs, imgsetid_list)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- imgsetid_list (list) –
Returns: new_imgsetid_list
Return type: - CommandLine:
- python -m wbia.other.ibsfuncs –test-copy_imagesets
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> ibs.delete_all_imagesets() >>> ibs.compute_occurrences(config={'use_gps': False, 'seconds_thresh': 600}) >>> imgsetid_list = ibs.get_valid_imgsetids() >>> new_imgsetid_list = copy_imagesets(ibs, imgsetid_list) >>> result = str(ibs.get_imageset_text(new_imgsetid_list)) >>> assert [2] == list(set(map(len, ibs.get_image_imgsetids(ibs.get_valid_gids())))) >>> print(result) >>> ibs.delete_all_imagesets() >>> ibs.compute_occurrences(config={'use_gps': False, 'seconds_thresh': 600})
-
wbia.other.ibsfuncs.
create_ggr_match_leaves_recursive
(ibs, tag, imageset_rowid_list, k, level=0, index=0)[source]¶
-
wbia.other.ibsfuncs.
create_ggr_match_trees
(ibs)[source]¶ - CommandLine:
- python -m wbia.other.ibsfuncs create_ggr_match_trees
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> from os.path import expanduser >>> import wbia # NOQA >>> default_dbdir = join('/', 'data', 'wbia', 'GGR2-IBEIS') >>> # default_dbdir = expanduser(join('~', 'data', 'GGR2-IBEIS')) >>> dbdir = ut.get_argval('--dbdir', type_=str, default=default_dbdir) >>> ibs = wbia.opendb(dbdir=dbdir) >>> imageset_rowid_list = ibs.create_ggr_match_trees()
-
wbia.other.ibsfuncs.
create_new_imageset_from_images
(ibs, gid_list, new_imgsetid=None)[source]¶ Parameters: gid_list (list) – - CommandLine:
- python -m wbia.other.ibsfuncs –test-create_new_imageset_from_images
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> gid_list = ibs.get_valid_gids()[::2] >>> new_imgsetid = create_new_imageset_from_images(ibs, gid_list) >>> result = new_imgsetid >>> print(result)
-
wbia.other.ibsfuncs.
create_new_imageset_from_names
(ibs, nid_list)[source]¶ Parameters: nid_list (list) – - CommandLine:
- python -m wbia.other.ibsfuncs –test-create_new_imageset_from_names
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> nid_list = ibs._get_all_known_nids()[0:2] >>> new_imgsetid = ibs.create_new_imageset_from_names(nid_list) >>> # clean up >>> ibs.delete_imagesets(new_imgsetid) >>> result = new_imgsetid >>> print(result)
-
wbia.other.ibsfuncs.
delete_all_annotations
(ibs)[source]¶ Carefull with this function. Annotations are not recomputable
-
wbia.other.ibsfuncs.
delete_all_recomputable_data
(ibs)[source]¶ Delete all cached data including chips and imagesets
-
wbia.other.ibsfuncs.
delete_cache
(ibs, delete_imagesets=False)[source]¶ Deletes the cache directory in the database directory. Can specify to delete encoutners as well.
- CommandLine:
- python -m wbia delete_cache –db testdb1
Example
>>> # SCRIPT >>> import wbia >>> ibs = wbia.opendb() >>> result = ibs.delete_cache()
-
wbia.other.ibsfuncs.
delete_cachedir
(ibs)[source]¶ Deletes the cache directory in the database directory.
- CommandLine:
- python -m wbia.other.ibsfuncs delete_cachedir python -m wbia delete_cachedir –db testdb1
Example
>>> # SCRIPT >>> import wbia >>> ibs = wbia.opendb() >>> result = ibs.delete_cachedir()
-
wbia.other.ibsfuncs.
delete_qres_cache
(ibs)[source]¶ Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia –tf delete_qres_cache python -m wbia –tf delete_qres_cache –db PZ_MTEST python -m wbia –tf delete_qres_cache –db PZ_Master1
Example
>>> # SCRIPT >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> result = delete_qres_cache(ibs) >>> print(result)
-
wbia.other.ibsfuncs.
ensure_annotation_data
(ibs, aid_list, chips=True, feats=True, featweights=False)[source]¶
-
wbia.other.ibsfuncs.
ensure_unix_gpaths
(gpath_list)[source]¶ Asserts that all paths are given with forward slashes. If not it fixes them
-
wbia.other.ibsfuncs.
filter_aids_to_quality
(ibs, aid_list, minqual, unknown_ok=True, speedhack=True)[source]¶ DEPRICATE
>>> import wbia >>> from wbia.other.ibsfuncs import * # NOQA >>> ibs = wbia.opendb(defaultdb='PZ_Master1') >>> aid_list = ibs.get_valid_aids() >>> minqual = 'good' >>> x1 = filter_aids_to_quality(ibs, aid_list, 'good', True, speedhack=True) >>> x2 = filter_aids_to_quality(ibs, aid_list, 'good', True, speedhack=False)
-
wbia.other.ibsfuncs.
filter_aids_to_species
(ibs, aid_list, species, speedhack=True)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- aid_list (int) – list of annotation ids
- species –
Returns: Return type: - CommandLine:
- python -m wbia.other.ibsfuncs –exec-filter_aids_to_species
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aid_list = ibs.get_valid_aids() >>> species = wbia.const.TEST_SPECIES.ZEB_GREVY >>> aid_list_ = filter_aids_to_species(ibs, aid_list, species) >>> result = 'aid_list_ = %r' % (aid_list_,) >>> print(result) aid_list_ = [9, 10]
-
wbia.other.ibsfuncs.
filter_aids_to_viewpoint
(ibs, aid_list, valid_yaws, unknown_ok=True)[source]¶ Removes aids that do not have a valid yaw
TODO: rename to valid_viewpoint because this func uses category labels
valid_yaws = [‘primary’, ‘primary1’, ‘primary-1’]
-
wbia.other.ibsfuncs.
filter_aids_without_name
(ibs, aid_list, invert=False, speedhack=True)[source]¶ Remove aids without names
Example
>>> # ENABLE_DOCTEST >>> import wbia >>> from wbia.other.ibsfuncs import * # NOQA >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aid_list = ibs.get_valid_aids() >>> annots = ibs.annots(aid_list) >>> aid_list1_ = ibs.filter_aids_without_name(aid_list) >>> aid_list2_ = ibs.filter_aids_without_name(aid_list, invert=True) >>> annots1_ = ibs.annots(aid_list1_) >>> annots2_ = ibs.annots(aid_list2_) >>> assert len(annots1_) + len(annots2_) == len(annots) >>> assert np.all(np.array(annots1_.nids) > 0) >>> assert len(annots1_) == 9 >>> assert np.all(np.array(annots2_.nids) < 0) >>> assert len(annots2_) == 4
-
wbia.other.ibsfuncs.
filter_aids_without_timestamps
(ibs, aid_list, invert=False)[source]¶ Removes aids without timestamps aid_list = ibs.get_valid_aids()
-
wbia.other.ibsfuncs.
filter_annots_using_minimum_timedelta
(ibs, aid_list, min_timedelta)[source]¶ Uses a dynamic program to find the maximum number of annotations that are above the minimum timedelta requirement.
Parameters: - ibs (IBEISController) – wbia controller object
- aid_list –
- min_timedelta –
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-filter_annots_using_minimum_timedelta python -m wbia.other.ibsfuncs –exec-filter_annots_using_minimum_timedelta –db PZ_Master1
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='PZ_MTEST') >>> aid_list = ibs.get_valid_aids() >>> aid_list = ibs.filter_aids_without_timestamps(aid_list) >>> print('Before') >>> ibs.print_annot_stats(aid_list, min_name_hourdist=True) >>> min_timedelta = 60 * 60 * 24 >>> filtered_aids = filter_annots_using_minimum_timedelta(ibs, aid_list, min_timedelta) >>> print('After') >>> ibs.print_annot_stats(filtered_aids, min_name_hourdist=True) >>> ut.quit_if_noshow() >>> wbia.other.dbinfo.hackshow_names(ibs, aid_list) >>> wbia.other.dbinfo.hackshow_names(ibs, filtered_aids) >>> ut.show_if_requested()
-
wbia.other.ibsfuncs.
filter_junk_annotations
(ibs, aid_list)[source]¶ remove junk annotations from a list
Parameters: - ibs (IBEISController) – wbia controller object
- aid_list (int) – list of annotation ids
Returns: filtered_aid_list
Return type: Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> aid_list = ibs.get_valid_aids() >>> filtered_aid_list = filter_junk_annotations(ibs, aid_list) >>> result = str(filtered_aid_list) >>> print(result)
-
wbia.other.ibsfuncs.
find_unlabeled_name_members
(ibs, **kwargs)[source]¶ Find annots where some members of a name have information but others do not.
Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.ibsfuncs –exec-find_unlabeled_name_members –qual
Example
>>> # SCRIPT >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='PZ_Master1') >>> defaultdict = dict(ut.parse_func_kwarg_keys(find_unlabeled_name_members, with_vals=True)) >>> kwargs = ut.argparse_dict(defaultdict) >>> result = find_unlabeled_name_members(ibs, **kwargs) >>> print(result)
-
wbia.other.ibsfuncs.
fix_and_clean_database
(ibs)[source]¶ Function to run all database cleanup scripts
Rename to run_cleanup_scripts
- Break into two funcs:
- run_cleanup_scripts run_fixit_scripts
- CONSITENCY CHECKS TODO:
- check that annotmatches marked as False do not have the same name for similar viewpoints.
- check that photobombs are have different names
- warn if scenery matches have the same name
-
wbia.other.ibsfuncs.
fix_exif_data
(ibs, gid_list)[source]¶ TODO CALL SCRIPT
Parameters: - ibs (IBEISController) – wbia controller object
- gid_list (list) – list of image ids
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-fix_exif_data
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='lynx') >>> gid_list = ibs.get_valid_gids() >>> result = fix_exif_data(ibs, gid_list) >>> print(result)
-
wbia.other.ibsfuncs.
fix_invalid_name_texts
(ibs)[source]¶ Ensure that no name text is empty or ‘____’
Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.ibsfuncs –test-fix_invalid_names
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> result = fix_invalid_name_texts(ibs) >>> print(result)
ibs.set_name_texts(nid_list[3], ‘____’) ibs.set_name_texts(nid_list[2], ‘’)
-
wbia.other.ibsfuncs.
fix_invalid_nids
(ibs)[source]¶ Make sure that all rowids are greater than 0
We can only handle there being a name with rowid 0 if it is UNKNOWN. In this case we safely delete it, but anything more complicated needs to be handled anually
Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.ibsfuncs –test-fix_invalid_nids
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> result = fix_invalid_nids(ibs) >>> print(result)
-
wbia.other.ibsfuncs.
fix_remove_visual_dupliate_annotations
(ibs)[source]¶ depricate because duplicate visual_uuids are no longer allowed to be duplicates
Add to clean database?
removes visually duplicate annotations
Parameters: ibs (IBEISController) – Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('GZ_ALL') >>> fix_remove_visual_dupliate_annotations(ibs)
-
wbia.other.ibsfuncs.
fix_unknown_exemplars
(ibs)[source]¶ Goes through all of the annotations, and sets their exemplar flag to 0 if it is associated with an unknown annotation
-
wbia.other.ibsfuncs.
flag_aids_count
(ibs, aid_list)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- aid_list (int) – list of annotation ids
- pre_unixtime_sort (bool) –
Returns: Return type: - CommandLine:
- python -m wbia.other.ibsfuncs –test-flag_aids_count
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> aid_list = ibs.get_valid_aids() >>> gzc_flag_list = flag_aids_count(ibs, aid_list) >>> result = gzc_flag_list >>> print(result) [False, True, False, False, True, False, True, True, False, True, False, True, True]
-
wbia.other.ibsfuncs.
get_annot_been_adjusted
(ibs, aid_list)[source]¶ Returns if a bounding box has been adjusted from defaults set in use_images_as_annotations Very hacky very heurstic.
-
wbia.other.ibsfuncs.
get_annot_encounter_text
(ibs, aids)[source]¶ Encounter identifier for annotations
-
wbia.other.ibsfuncs.
get_annot_info
(ibs, aid_list, default=False, reference_aid=None, **kwargs)[source]¶ Parameters: Returns: infodict_list
Return type: - CommandLine:
- python -m wbia.other.ibsfuncs –exec-get_annot_info –tb
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aid_list = ibs.get_valid_aids()[0:2] >>> default = True >>> infodict_list = ibs.get_annot_info(1, default) >>> result = ('infodict_list = %s' % (ut.repr2(infodict_list, nl=4),)) >>> print(result)
-
wbia.other.ibsfuncs.
get_annot_intermediate_viewpoint_stats
(ibs, aids, size=2)[source]¶ >>> from wbia.other.ibsfuncs import * # NOQA >>> aids = available_aids
-
wbia.other.ibsfuncs.
get_annot_lazy_dict
(ibs, aid, config2_=None)[source]¶ Parameters: Returns: metadata
Return type: ut.LazyDict
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-get_annot_lazy_dict –show
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aid = 1 >>> config2_ = None >>> metadata = get_annot_lazy_dict(ibs, aid, config2_) >>> result = ('metadata = %s' % (ut.repr3(metadata),)) >>> print(result)
-
wbia.other.ibsfuncs.
get_annot_lazy_dict2
(ibs, aid, config=None)[source]¶ DEPRICATE FOR ibs.annots
Parameters: Returns: metadata
Return type: ut.LazyDict
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-get_annot_lazy_dict2 –show
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aid = 1 >>> config = {'dim_size': 450} >>> metadata = get_annot_lazy_dict2(ibs, aid, config) >>> result = ('metadata = %s' % (ut.repr3(metadata),)) >>> print(result)
-
wbia.other.ibsfuncs.
get_annot_occurrence_text
(ibs, aids)[source]¶ Occurrence identifier for annotations
Parameters: - ibs (wbia.IBEISController) – image analysis api
- aids (list) – list of annotation rowids
Returns: occur_texts
Return type: - CommandLine:
- python -m wbia.other.ibsfuncs get_annot_occurrence_text –show
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aids = ibs.get_valid_aids() >>> occur_texts = get_annot_occurrence_text(ibs, aids) >>> result = ('occur_texts = %s' % (ut.repr2(occur_texts),)) >>> print(result)
-
wbia.other.ibsfuncs.
get_annot_pair_lazy_dict
(ibs, qaid, daid, qconfig2_=None, dconfig2_=None)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- qaid (int) – query annotation id
- daid –
- qconfig2 (dict) – (default = None)
- dconfig2 (dict) – (default = None)
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-get_annot_pair_lazy_dict
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> qaid, daid = ibs.get_valid_aids()[0:2] >>> qconfig2_ = None >>> dconfig2_ = None >>> result = get_annot_pair_lazy_dict(ibs, qaid, daid, qconfig2_, dconfig2_) >>> print(result)
-
wbia.other.ibsfuncs.
get_annot_quality_viewpoint_subset
(ibs, aid_list=None, annots_per_view=2, max_annots=None, verbose=False, prog_hook=None, allow_unknown=False)[source]¶ - CommandLine:
- python -m wbia.other.ibsfuncs –exec-get_annot_quality_viewpoint_subset –show
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ut.exec_funckw(get_annot_quality_viewpoint_subset, globals()) >>> ibs = wbia.opendb('testdb2') >>> new_flag_list = get_annot_quality_viewpoint_subset(ibs) >>> result = sum(new_flag_list) >>> print(result) 38
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ut.exec_funckw(get_annot_quality_viewpoint_subset, globals()) >>> ibs = wbia.opendb('testdb1') >>> aid_list = [1] >>> new_flag_list = get_annot_quality_viewpoint_subset(ibs, aid_list, allow_unknown=True) >>> result = sum(new_flag_list) >>> print(result) 1
-
wbia.other.ibsfuncs.
get_annot_stats_dict
(ibs, aids, prefix='', forceall=False, old=True, use_hist=False, **kwargs)[source]¶ stats for a set of annots
Parameters: - Kwargs:
- hashid, per_name, per_qual, per_vp, per_name_vpedge, per_image, min_name_hourdist
Returns: aid_stats_dict Return type: dict - CommandLine:
python -m wbia get_annot_stats_dict –db WWF_Lynx –all python -m wbia get_annot_stats_dict –db EWT_Cheetahs –all python -m wbia get_annot_stats_dict –db PZ_PB_RF_TRAIN –all python -m wbia get_annot_stats_dict –db PZ_Master1 –all
python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db PZ_PB_RF_TRAIN –use-hist=True –old=False –per_name_vpedge=False python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db PZ_PB_RF_TRAIN –use-hist=False –old=False –per_name_vpedge=False
python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db PZ_MTEST –use-hist –per_name_vpedge=False python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db PZ_MTEST –use-hist –per_name_vpedge=False
python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db PZ_Master1 –per_name_vpedge=True python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db PZ_Master1 –min_name_hourdist=True python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db GZ_ALL –min_name_hourdist=True –all python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db GZ_Master1 –all python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db PZ_Master1 –min_name_hourdist=True –all python -m wbia.other.ibsfuncs –exec-get_annot_stats_dict –db NNP_MasterGIRM_core –min_name_hourdist=True –all
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aids = ibs.annots().aids >>> stats = ibs.get_annot_stats_dict(aids) >>> import ubelt as ub >>> print('annot_stats = {}'.format(ub.repr2(stats, nl=1)))
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aids = wbia.testdata_aids(ibs=ibs) >>> prefix = '' >>> kwkeys = ut.parse_func_kwarg_keys(get_annot_stats_dict) >>> #default = True if ut.get_argflag('--all') else None >>> default = None if ut.get_argflag('--notall') else True >>> kwargs = ut.argparse_dict(dict(zip(kwkeys, [default] * len(kwkeys)))) >>> #ut.argparse_funckw(ibs.get_annot_stats_dict) >>> print('kwargs = %r' % (kwargs,)) >>> old = ut.get_argval('--old', default=True) >>> use_hist = ut.get_argval('--use_hist', default=True) >>> aid_stats_dict = get_annot_stats_dict(ibs, aids, prefix, use_hist=use_hist, old=old, **kwargs) >>> result = ('aid_stats_dict = %s' % (ub.repr2(aid_stats_dict, strkeys=True, strvals=True, nl=2, precision=2),)) >>> print(result)
-
wbia.other.ibsfuncs.
get_annotconfig_stats
(ibs, qaids, daids, verbose=False, combined=False, combo_gt_info=True, combo_enc_info=False, combo_dists=True, split_matchable_data=True, **kwargs)[source]¶ Gets statistics about a query / database set of annotations
USEFUL DEVELOPER FUNCTION
TODO: this function should return non-string values in dictionaries. The print function should do string conversions
Parameters: - ibs (IBEISController) – wbia controller object
- qaids (list) – query annotation ids
- daids (list) – database annotation ids
- SeeAlso:
- wbia.dbinfo.print_qd_info ibs.get_annot_stats_dict ibs.print_annotconfig_stats(qaid_list, daid_list)
- CommandLine:
- python -m wbia.other.ibsfuncs get_annotconfig_stats –db PZ_MTEST -a default python -m wbia.other.ibsfuncs get_annotconfig_stats –db testdb1 -a default python -m wbia.other.ibsfuncs get_annotconfig_stats –db PZ_MTEST -a controlled python -m wbia.other.ibsfuncs get_annotconfig_stats –db PZ_FlankHack -a default:qaids=allgt python -m wbia.other.ibsfuncs get_annotconfig_stats –db PZ_MTEST -a controlled:per_name=2,min_gt=4
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> from wbia.init import main_helpers >>> kwargs = {'per_enc': True, 'enc_per_name': True} >>> ibs, qaids, daids = main_helpers.testdata_expanded_aids( ... defaultdb='testdb1', a='default:qsize=3') >>> stat_dict = get_annotconfig_stats(ibs, qaids, daids, **kwargs) >>> stats_str2 = ut.repr2(stat_dict, si=True, nl=True, nobr=False) >>> print(stats_str2)
-
wbia.other.ibsfuncs.
get_consecutive_newname_list_via_species
(ibs, imgsetid=None, location_text=None, wildbook_existing_name_list=[])[source]¶ Just creates the nams, but does not set them
Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.ibsfuncs –test-get_consecutive_newname_list_via_species
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> ibs._clean_species() >>> imgsetid = None >>> new_nid_list, new_name_list = get_consecutive_newname_list_via_species(ibs, imgsetid=imgsetid) >>> result = ut.repr2((new_nid_list, new_name_list), nl=1) >>> print(result) ( [1, 2, 3, 4, 5, 6, 7], ['IBEIS_PZ_0001', 'IBEIS_PZ_0002', 'IBEIS_UNKNOWN_0001', 'IBEIS_UNKNOWN_0002', 'IBEIS_GZ_0001', 'IBEIS_PB_0001', 'IBEIS_UNKNOWN_0003'], )
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> ibs._clean_species() >>> ibs.delete_all_imagesets() >>> ibs.compute_occurrences(config={'use_gps': False, 'seconds_thresh': 600}) >>> imgsetid = ibs.get_valid_imgsetids()[1] >>> new_nid_list, new_name_list = get_consecutive_newname_list_via_species(ibs, imgsetid=imgsetid) >>> result = ut.repr2((new_nid_list, new_name_list), nl=1) >>> print(result) ( [4, 5, 6, 7], ['IBEIS_UNKNOWN_Occurrence_1_0001', 'IBEIS_GZ_Occurrence_1_0001', 'IBEIS_PB_Occurrence_1_0001', 'IBEIS_UNKNOWN_Occurrence_1_0002'], )
-
wbia.other.ibsfuncs.
get_database_species
(ibs, aid_list=None)[source]¶ - CommandLine:
- python -m wbia.other.ibsfuncs –test-get_database_species
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> result = ut.repr2(ibs.get_database_species(), nl=False) >>> print(result) ['____', 'bear_polar', 'zebra_grevys', 'zebra_plains']
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('PZ_MTEST') >>> result = ut.repr2(ibs.get_database_species(), nl=False) >>> print(result) ['zebra_plains']
-
wbia.other.ibsfuncs.
get_database_species_count
(ibs, aid_list=None, BATCH_SIZE=25000)[source]¶ - CommandLine:
- python -m wbia.other.ibsfuncs –test-get_database_species_count
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> #print(ut.repr2(wbia.opendb('PZ_Master0').get_database_species_count())) >>> ibs = wbia.opendb('testdb1') >>> result = ut.repr2(ibs.get_database_species_count(BATCH_SIZE=2), nl=False) >>> print(result) {'zebra_plains': 6, '____': 3, 'zebra_grevys': 2, 'bear_polar': 2}
-
wbia.other.ibsfuncs.
get_dominant_species
(ibs, aid_list)[source]¶ Parameters: aid_list (int) – list of annotation ids - CommandLine:
- python -m wbia.other.ibsfuncs –test-get_dominant_species
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> aid_list = ibs.get_valid_aids() >>> result = get_dominant_species(ibs, aid_list) >>> print(result) zebra_plains
-
wbia.other.ibsfuncs.
get_extended_viewpoints
(base_yaw_text, towards='front', num1=0, num2=None, include_base=True)[source]¶ Given a viewpoint returns the acceptable viewpoints around it
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> yaw_text_list = ['left', 'right', 'back', 'front'] >>> towards = 'front' >>> num1 = 1 >>> num2 = 0 >>> include_base = False >>> extended_yaws_list = [get_extended_viewpoints(base_yaw_text, towards, num1, num2, include_base) >>> for base_yaw_text in yaw_text_list] >>> result = ('extended_yaws_list = %s' % (ut.repr2(extended_yaws_list),)) >>> print(result) extended_yaws_list = [['frontleft'], ['frontright'], ['backleft'], ['frontleft']]
-
wbia.other.ibsfuncs.
get_image_lazydict
(ibs, gid, config=None)[source]¶ Parameters: Returns: metadata
Return type: ut.LazyDict
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-get_annot_lazy_dict2 –show
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> gid = 1
-
wbia.other.ibsfuncs.
get_infostr
(ibs)[source]¶ Returns sort printable database information
Parameters: ibs (IBEISController) – wbia controller object Returns: infostr Return type: str
-
wbia.other.ibsfuncs.
get_missing_gids
(ibs, gid_list=None)[source]¶ Finds gids with broken links to the original data.
Parameters: - ibs (IBEISController) – wbia controller object
- gid_list (list) – (default = None)
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-get_missing_gids –db GZ_Master1
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> #ibs = wbia.opendb('GZ_Master1') >>> gid_list = ibs.get_valid_gids() >>> bad_gids = ibs.get_missing_gids(gid_list) >>> print('#bad_gids = %r / %r' % (len(bad_gids), len(gid_list)))
-
wbia.other.ibsfuncs.
get_num_annots_per_name
(ibs, aid_list)[source]¶ Returns the number of annots per name (IN THIS LIST)
Parameters: - ibs (IBEISController) – wbia controller object
- aid_list (int) – list of annotation ids
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-get_num_annots_per_name python -m wbia.other.ibsfuncs –exec-get_num_annots_per_name –db PZ_Master1
Example
>>> # UNSTABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aid_list = ibs.get_valid_aids(is_known=True) >>> num_annots_per_name, unique_nids = get_num_annots_per_name(ibs, aid_list) >>> per_name_hist = ut.dict_hist(num_annots_per_name) >>> items = per_name_hist.items() >>> items = sorted(items)[::-1] >>> key_list = ut.get_list_column(items, 0) >>> val_list = ut.get_list_column(items, 1) >>> min_per_name = dict(zip(key_list, np.cumsum(val_list))) >>> result = ('per_name_hist = %s' % (ut.repr2(per_name_hist),)) >>> print(result) >>> print('min_per_name = %s' % (ut.repr2(min_per_name),)) per_name_hist = { 1: 5, 2: 2, }
-
wbia.other.ibsfuncs.
get_primary_database_species
(ibs, aid_list=None, speedhack=True)[source]¶ Parameters: aid_list (list) – list of annotation ids (default = None) - CommandLine:
- python -m wbia.other.ibsfuncs –test-get_primary_database_species
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aid_list = None >>> primary_species = get_primary_database_species(ibs, aid_list) >>> result = primary_species >>> print('primary_species = %r' % (primary_species,)) >>> print(result) zebra_plains
-
wbia.other.ibsfuncs.
get_primary_species_viewpoint
(species, plus=0)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- species –
Returns: primary_viewpoint
Return type: - CommandLine:
- python -m wbia.other.ibsfuncs –exec-get_primary_species_viewpoint
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> species = wbia.const.TEST_SPECIES.ZEB_PLAIN >>> aid_subset = get_primary_species_viewpoint(species, 0) >>> result = ('aid_subset = %s' % (str(aid_subset),)) >>> print(result) aid_subset = left
-
wbia.other.ibsfuncs.
get_quality_filterflags
(ibs, aid_list, minqual, unknown_ok=True)[source]¶ DEPRICATE
Parameters: - ibs (IBEISController) – wbia controller object
- aid_list (int) – list of annotation ids
- minqual (str) – qualtext
- unknown_ok (bool) – (default = False)
Returns: qual_flags
Return type: iter
- CommandLine:
- python -m wbia.other.ibsfuncs –exec-get_quality_filterflags
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aid_list = ibs.get_valid_aids()[0:20] >>> minqual = 'junk' >>> unknown_ok = False >>> qual_flags = list(get_quality_filterflags(ibs, aid_list, minqual, unknown_ok)) >>> result = ('qual_flags = %s' % (str(qual_flags),)) >>> print(result)
-
wbia.other.ibsfuncs.
get_two_annots_per_name_and_singletons
(ibs, onlygt=False)[source]¶ makes controlled subset of data
DEPRICATE
CONTROLLED TEST DATA
Build data for experiment that tries to rule out as much bad data as possible
- Returns a controlled set of annotations that conforms to
- number of annots per name
- uniform species
- viewpoint restrictions
- quality restrictions
- time delta restrictions
- CommandLine:
- python -m wbia.other.ibsfuncs –test-get_two_annots_per_name_and_singletons python -m wbia.other.ibsfuncs –test-get_two_annots_per_name_and_singletons –db GZ_ALL python -m wbia.other.ibsfuncs –test-get_two_annots_per_name_and_singletons –db PZ_Master0 –onlygt
- Ignore:
- sys.argv.extend([’–db’, ‘PZ_MTEST’])
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='PZ_Master0') >>> aid_subset = get_two_annots_per_name_and_singletons(ibs, onlygt=ut.get_argflag('--onlygt')) >>> wbia.other.dbinfo.get_dbinfo(ibs, aid_list=aid_subset, with_contrib=False) >>> result = str(aid_subset) >>> print(result)
-
wbia.other.ibsfuncs.
get_unflat_am_aidpairs
(ibs, aids_list)[source]¶ Gets only aid pairs that have some reviewed/matched status
-
wbia.other.ibsfuncs.
get_unflat_annots_hourdists_list
(ibs, aids_list)[source]¶ Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> ibs = testdata_ibs('testdb1') >>> nid_list = get_valid_multiton_nids_custom(ibs) >>> aids_list_ = ibs.get_name_aids(nid_list) >>> aids_list = [(aids) for aids in aids_list_] >>> ibs.get_unflat_annots_hourdists_list(aids_list)
-
wbia.other.ibsfuncs.
get_unflat_annots_speeds_list2
(ibs, aids_list)[source]¶ much faster than original version
_ = ibs.get_unflat_annots_speeds_list2(aids_list)
%timeit ibs.get_unflat_annots_speeds_list(aids_list) 3.44 s per loop
%timeit ibs.get_unflat_annots_speeds_list2(aids_list) 665 ms per loop
%timeit ibs.get_unflat_annots_speeds_list(aids_list[0:1]) 12.8 ms %timeit ibs.get_unflat_annots_speeds_list2(aids_list[0:1]) 6.51 ms
assert ibs.get_unflat_annots_speeds_list([]) == ibs.get_unflat_annots_speeds_list2([])
ibs.get_unflat_annots_speeds_list([[]]) ibs.get_unflat_annots_speeds_list2([[]])
-
wbia.other.ibsfuncs.
get_unflat_annots_timedelta_list
(ibs, aids_list)[source]¶ Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> ibs = testdata_ibs('NNP_Master3') >>> nid_list = get_valid_multiton_nids_custom(ibs) >>> aids_list_ = ibs.get_name_aids(nid_list) >>> aids_list = [(aids) for aids in aids_list_]
Gets only aid pairs that have some reviewed/matched status
-
wbia.other.ibsfuncs.
get_ungrouped_gids
(ibs)[source]¶ - CommandLine:
- python -m wbia.other.ibsfuncs –test-get_ungrouped_gids
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> ibs.delete_all_imagesets() >>> ibs.compute_occurrences(config={'use_gps': False, 'seconds_thresh': 600}) >>> ibs.update_special_imagesets() >>> # Now we want to remove some images from a non-special imageset >>> nonspecial_imgsetids = [i for i in ibs.get_valid_imgsetids() if i not in ibs.get_special_imgsetids()] >>> print("Nonspecial EIDs %r" % nonspecial_imgsetids) >>> images_to_remove = ibs.get_imageset_gids(nonspecial_imgsetids[0:1])[0][0:1] >>> print("Removing %r" % images_to_remove) >>> ibs.unrelate_images_and_imagesets(images_to_remove,nonspecial_imgsetids[0:1] * len(images_to_remove)) >>> ibs.update_special_imagesets() >>> ungr_imgsetid = ibs.get_imageset_imgsetids_from_text(const.UNGROUPED_IMAGES_IMAGESETTEXT) >>> print("Ungrouped gids %r" % ibs.get_ungrouped_gids()) >>> print("Ungrouped imgsetid %d contains %r" % (ungr_imgsetid, ibs.get_imageset_gids([ungr_imgsetid]))) >>> ungr_gids = ibs.get_imageset_gids([ungr_imgsetid])[0] >>> assert(sorted(images_to_remove) == sorted(ungr_gids))
-
wbia.other.ibsfuncs.
get_viewpoint_filterflags
(ibs, aid_list, valid_yaws, unknown_ok=True, assume_unique=False)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- aid_list (int) – list of annotation ids
- valid_yaws –
- unknown_ok (bool) – (default = True)
Returns: aid_list - list of annotation ids
Return type: - CommandLine:
- python -m wbia.other.ibsfuncs –exec-get_viewpoint_filterflags python -m wbia.other.ibsfuncs –exec-get_viewpoint_filterflags –db NNP_Master3
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='Spotted_Dolfin_Master') >>> aid_list = ibs.get_valid_aids()[0:20] >>> valid_yaws = ['left'] >>> unknown_ok = False >>> yaw_flags = list(get_viewpoint_filterflags(ibs, aid_list, valid_yaws, unknown_ok)) >>> result = ('yaw_flags = %s' % (str(yaw_flags),)) >>> print(result)
-
wbia.other.ibsfuncs.
get_yaw_viewtexts
(yaw_list)[source]¶ Parameters: yaw_list (list of angles) – - CommandLine:
- python -m wbia.other.ibsfuncs –test-get_yaw_viewtexts
Todo
rhombicubeoctehedron
https://en.wikipedia.org/wiki/Rhombicuboctahedron
up, down, front, left, back, right, front-left, back-left, back-right, front-right, up-front, up-left, up-back, up-right, up-front-left, up-back-left, up-back-right, up-front-right, down-front, down-left, down-back, down-right, down-front-left, down-back-left, down-back-right, down-front-right,
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import numpy as np >>> yaw_list = [0.0, np.pi / 2, np.pi / 4, np.pi, 3.15, -.4, -8, .2, 4, 7, 20, None] >>> text_list = get_yaw_viewtexts(yaw_list) >>> result = ut.repr2(text_list, nl=False) >>> print(result) ['right', 'front', 'frontright', 'left', 'left', 'backright', 'back', 'right', 'backleft', 'frontright', 'frontright', None]
-
wbia.other.ibsfuncs.
group_annots_by_known_names
(ibs, aid_list, checks=True)[source]¶ FIXME; rectify this #>>> import wbia # NOQA
- CommandLine:
- python -m wbia.other.ibsfuncs –test-group_annots_by_known_names
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(db='testdb1') >>> aid_list = ibs.get_valid_aids() >>> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] >>> known_aids_list, unknown_aids = group_annots_by_known_names(ibs, aid_list) >>> result = ut.repr2(sorted(known_aids_list)) + '\n' >>> result += ut.repr2(unknown_aids) >>> print(result) [[2, 3], [5, 6], [7], [8], [10], [12], [13]] [11, 9, 4, 1]
-
wbia.other.ibsfuncs.
group_annots_by_multi_prop
(ibs, aids, getter_list)[source]¶ Performs heirachical grouping of annotations based on properties
Parameters: - ibs (IBEISController) – wbia controller object
- aids (list) – list of annotation rowids
- getter_list (list) –
Returns: multiprop2_aids
Return type: - CommandLine:
- python -m wbia.other.ibsfuncs –exec-group_annots_by_multi_prop –db PZ_Master1 –props=viewpoint_code,name_rowids –keys1 frontleft python -m wbia.other.ibsfuncs –exec-group_annots_by_multi_prop
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aids = ibs.get_valid_aids(is_known=True) >>> #getter_list = [ibs.get_annot_name_rowids, ibs.get_annot_viewpoints] >>> props = ut.get_argval('--props', type_=list, default=['viewpoint_code', 'name_rowids']) >>> getter_list = [getattr(ibs, 'get_annot_' + prop) for prop in props] >>> print('getter_list = %r' % (getter_list,)) >>> #getter_list = [ibs.get_annot_viewpoints, ibs.get_annot_name_rowids] >>> multiprop2_aids = group_annots_by_multi_prop(ibs, aids, getter_list) >>> get_dict_values = lambda x: list(x.values()) >>> # a bit convoluted >>> keys1 = ut.get_argval('--keys1', type_=list, default=list(multiprop2_aids.keys())) >>> multiprop2_num_aids = ut.hmap_vals(len, multiprop2_aids) >>> prop2_num_aids = ut.hmap_vals(get_dict_values, multiprop2_num_aids, max_depth=len(props) - 2) >>> #prop2_num_aids_stats = ut.hmap_vals(ut.get_stats, prop2_num_aids) >>> prop2_num_aids_hist = ut.hmap_vals(ut.dict_hist, prop2_num_aids) >>> prop2_num_aids_cumhist = ut.map_dict_vals(ut.dict_hist_cumsum, prop2_num_aids_hist) >>> print('prop2_num_aids_hist[%s] = %s' % (keys1, ut.repr2(ut.dict_subset(prop2_num_aids_hist, keys1)))) >>> print('prop2_num_aids_cumhist[%s] = %s' % (keys1, ut.repr2(ut.dict_subset(prop2_num_aids_cumhist, keys1))))
-
wbia.other.ibsfuncs.
group_annots_by_name
(ibs, aid_list, distinguish_unknowns=True, assume_unique=False)[source]¶ This function is probably the fastest of its siblings
Parameters: - ibs (IBEISController) – wbia controller object
- aid_list (list) –
- distinguish_unknowns (bool) –
Returns: grouped_aids, unique_nids
Return type: - CommandLine:
- python -m wbia.other.ibsfuncs –test-group_annots_by_name
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> aid_list = ibs.get_valid_aids() >>> distinguish_unknowns = True >>> grouped_aids, unique_nids = group_annots_by_name(ibs, aid_list, distinguish_unknowns) >>> result = str([aids.tolist() for aids in grouped_aids]) >>> result += '\n' + str(unique_nids.tolist()) >>> print(result) [[11], [9], [4], [1], [2, 3], [5, 6], [7], [8], [10], [12], [13]] [-11, -9, -4, -1, 1, 2, 3, 4, 5, 6, 7]
-
wbia.other.ibsfuncs.
group_prop_edges
(prop2_nid2_aids, prop_basis, size=2, wrap=True)[source]¶ from wbia.other.ibsfuncs import * # NOQA getter_func = ibs.get_annot_viewpoints prop_basis = list(const.VIEWTEXT_TO_YAW_RADIANS.keys()) size = 2 wrap = True
-
wbia.other.ibsfuncs.
inspect_ggr_qr_codes
(ibs, *args, **kwargs)[source]¶ Inspect QR codes in each imageset.
Parameters: - ibs (IBEISController) – wbia controller object
- imageset_rowid_list (list) – imageset rowid list
- CommandLine:
- python -m wbia.other.ibsfuncs inspect_ggr_qr_codes
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> default_dbdir = join('/', 'data', 'wbia', 'GGR2-IBEIS') >>> dbdir = ut.get_argval('--dbdir', type_=str, default=default_dbdir) >>> ibs = wbia.opendb(dbdir=dbdir) >>> ibs.inspect_ggr_qr_codes()
-
wbia.other.ibsfuncs.
inspect_nonzero_yaws
(ibs)[source]¶ python dev.py –dbdir /raid/work2/PZ_Master –cmd –show
-
wbia.other.ibsfuncs.
is_aid_unknown
(ibs, aid_list)[source]¶ Returns if an annotation has been given a name (even if that name is temporary)
-
wbia.other.ibsfuncs.
lookup_annot_vecs_subset
(ibs, unflat_aids, unflat_fxs, annots=None, config2_=None)[source]¶ unflat_aids = naids_list unflat_fxs = nfxs_list annots = data_annots config2_ = data_config2_
unflat_aids = cm.filtnorm_aids[0] unflat_fxs = cm.filtnorm_fxs[0]
-
wbia.other.ibsfuncs.
make_next_imageset_text
(ibs)[source]¶ Creates what the next imageset name would be but does not add it to the database
Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.ibsfuncs –test-make_next_imageset_text
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> new_imagesettext = make_next_imageset_text(ibs) >>> result = new_imagesettext >>> print(result) New ImageSet 0
-
wbia.other.ibsfuncs.
make_next_name
(ibs, num=None, str_format=2, species_text=None, location_text=None)[source]¶ Creates a number of names which are not in the database, but does not add them
Parameters: - ibs (IBEISController) – wbia controller object
- num (None) –
- str_format (int) – either 1 or 2
Returns: next_name
Return type: - CommandLine:
- python -m wbia.other.ibsfuncs –test-make_next_name
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs1 = wbia.opendb('testdb1') >>> ibs2 = wbia.opendb('PZ_MTEST') >>> ibs3 = wbia.opendb('NAUT_test') >>> ibs1._clean_species() >>> ibs2._clean_species() >>> ibs3._clean_species() >>> num = None >>> str_format = 2 >>> next_name1 = make_next_name(ibs1, num, str_format) >>> next_name2 = make_next_name(ibs2, num, str_format) >>> next_name3 = make_next_name(ibs3, num, str_format) >>> next_name4 = make_next_name(ibs1, num, str_format, const.TEST_SPECIES.ZEB_GREVY) >>> name_list = [next_name1, next_name2, next_name3, next_name4] >>> next_name_list1 = make_next_name(ibs2, 5, str_format) >>> temp_nids = ibs2.add_names(['WBIA_PZ_0045', 'WBIA_PZ_0048']) >>> next_name_list2 = make_next_name(ibs2, 5, str_format) >>> ibs2.delete_names(temp_nids) >>> next_name_list3 = make_next_name(ibs2, 5, str_format) >>> # FIXME: nautiluses are not working right >>> names = (name_list, next_name_list1, next_name_list2, next_name_list3) >>> result = ut.repr4(names) >>> print(result) ( ['IBEIS_UNKNOWN_0008', 'IBEIS_UNKNOWN_0042', 'IBEIS_UNKNOWN_0004', 'IBEIS_GZ_0008'], ['IBEIS_UNKNOWN_0042', 'IBEIS_UNKNOWN_0043', 'IBEIS_UNKNOWN_0044', 'IBEIS_UNKNOWN_0045', 'IBEIS_UNKNOWN_0046'], ['IBEIS_UNKNOWN_0044', 'IBEIS_UNKNOWN_0045', 'IBEIS_UNKNOWN_0046', 'IBEIS_UNKNOWN_0047', 'IBEIS_UNKNOWN_0048'], ['IBEIS_UNKNOWN_0042', 'IBEIS_UNKNOWN_0043', 'IBEIS_UNKNOWN_0044', 'IBEIS_UNKNOWN_0045', 'IBEIS_UNKNOWN_0046'], )
-
wbia.other.ibsfuncs.
make_next_nids
(ibs, num=None, str_format=2, species_text=None, location_text=None)[source]¶ makes name and adds it to the database returning the newly added name rowid(s)
CAUTION; changes database state
- SeeAlso:
- make_next_name
-
wbia.other.ibsfuncs.
merge_ggr_staged_annots
(ibs, min_overlap=0.25, reviews_required=3, liberal_aoi=False)[source]¶ Merge the staged annotations into a single set of actual annotations (with AoI)
Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.ibsfuncs merge_ggr_staged_annots
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> from os.path import expanduser >>> import wbia # NOQA >>> # default_dbdir = join('/', 'data', 'wbia', 'GGR2-IBEIS') >>> default_dbdir = expanduser(join('~', 'data', 'GGR2-IBEIS')) >>> dbdir = ut.get_argval('--dbdir', type_=str, default=default_dbdir) >>> ibs = wbia.opendb(dbdir=dbdir) >>> new_aid_list, broken_gid_list = ibs.merge_ggr_staged_annots() >>> print('Encountered %d invalid gids: %r' % (len(broken_gid_list), broken_gid_list, ))
-
wbia.other.ibsfuncs.
merge_ggr_staged_annots_cluster
(ibs, user_id_list, user_dict, aid_list, index_list, min_overlap=0.25)[source]¶
-
wbia.other.ibsfuncs.
merge_ggr_staged_annots_marriage
(ibs, user_id_list, user_dict, aid_list, index_list, min_overlap=0.1)[source]¶
-
wbia.other.ibsfuncs.
merge_names
(ibs, merge_name, other_names)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- merge_name (str) –
- other_names (list) –
- CommandLine:
- python -m wbia.other.ibsfuncs –test-merge_names
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> merge_name = 'zebra' >>> other_names = ['occl', 'jeff'] >>> result = merge_names(ibs, merge_name, other_names) >>> print(result) >>> ibs.print_names_table()
-
wbia.other.ibsfuncs.
new_imagesets_from_images
(ibs, gids_list)[source]¶ Parameters: gids_list (list) –
-
wbia.other.ibsfuncs.
nms_boxes
(ibs, indices, bboxes, thetas, confs, classes, nms_thresh=0.2, nms_aware=None, verbose=False, **kwargs)[source]¶
-
wbia.other.ibsfuncs.
overwrite_ggr_unixtimes_from_gps
(ibs, gmt_offset=3.0, *args, **kwargs)[source]¶ Sync image time offsets using QR codes sync data
Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.ibsfuncs overwrite_ggr_unixtimes_from_gps
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> default_dbdir = join('/', 'data', 'wbia', 'GGR2-IBEIS') >>> dbdir = ut.get_argval('--dbdir', type_=str, default=default_dbdir) >>> ibs = wbia.opendb(dbdir=dbdir) >>> ibs.overwrite_ggr_unixtimes_from_gps()
-
wbia.other.ibsfuncs.
overwrite_unixtimes_from_gps
(ibs, gid_list, gmt_offset=3.0)[source]¶ Sync image time offsets using QR codes sync data
Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.ibsfuncs overwrite_unixtimes_from_gps
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> default_dbdir = join('/', 'data', 'wbia', 'GGR2-IBEIS') >>> dbdir = ut.get_argval('--dbdir', type_=str, default=default_dbdir) >>> ibs = wbia.opendb(dbdir=dbdir) >>> ibs.overwrite_unixtimes_from_gps()
-
wbia.other.ibsfuncs.
parse_ggr_name
(ibs, imageset_text, verbose=False, allow_short=False, require_short=False)[source]¶
-
wbia.other.ibsfuncs.
partition_annots_into_corresponding_groups
(ibs, aid_list1, aid_list2)[source]¶ Used for grouping one-vs-one training pairs and corerspondence filtering
Parameters: - ibs (wbia.control.IBEISControl.IBEISController) – wbia controller object
- aid_list1 (int) – list of annotation ids
- aid_list2 (int) – list of annotation ids
Returns: - 4 lists of lists. In the first two each list is a list of aids
grouped by names and the names correspond with each other. In the last two are the annots that did not correspond with anything in the other list.
Return type: - CommandLine:
- python -m wbia.other.ibsfuncs –exec-partition_annots_into_corresponding_groups
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='PZ_MTEST') >>> grouped_aids = list(map(list, ibs.group_annots_by_name(ibs.get_valid_aids())[0])) >>> grouped_aids = [aids for aids in grouped_aids if len(aids) > 3] >>> # Get some overlapping groups >>> import copy >>> aids_group1 = copy.deepcopy((ut.get_list_column_slice(grouped_aids[0:5], slice(0, 2)))) >>> aids_group2 = copy.deepcopy((ut.get_list_column_slice(grouped_aids[2:7], slice(2, None)))) >>> # Ensure there is a singleton in each >>> ut.delete_items_by_index(aids_group1[0], [0]) >>> ut.delete_items_by_index(aids_group2[-1], [0]) >>> aid_list1 = ut.flatten(aids_group1) >>> aid_list2 = ut.flatten(aids_group2) >>> #aid_list1 = [1, 2, 8, 9, 60] >>> #aid_list2 = [3, 7, 20] >>> groups = partition_annots_into_corresponding_groups(ibs, aid_list1, aid_list2) >>> result = ut.repr2(groups) >>> print(result) [[10, 11], [17, 18], [22, 23]] [[12, 13, 14, 15], [19, 20, 21], [24, 25, 26]] [[2], [5, 6]] [[29, 30, 31, 32], [49]]
-
wbia.other.ibsfuncs.
partition_annots_into_singleton_multiton
(ibs, aid_list)[source]¶ aid_list = aid_list_
-
wbia.other.ibsfuncs.
partition_ordered_list_equal_sum
(a, k)[source]¶ Partition a sorted list a into k partitions
- Reference:
- https://stackoverflow.com/a/35518205 https://gist.github.com/laowantong/ee675108eee64640e5f94f00d8edbcb4
- CommandLine:
- python -m wbia.other.ibsfuncs partition_ordered_list_equal_sum
Example
>>> # DISABLE_DOCTEST >>> import random >>> from wbia.other.ibsfuncs import * # NOQA >>> a = [random.randint(0,20) for x in range(50)] >>> k = 10 >>> print('Partitioning {0} into {1} partitions'.format(a, k)) >>> b = partition_ordered_list_equal_sum(a, k) >>> print('The best partitioning is {0}\n With heights {1}\n'.format(b, list(map(sum, b))))
-
wbia.other.ibsfuncs.
postinject_func
(ibs)[source]¶ Parameters: ibs (IBEISController) – - CommandLine:
- python -m wbia.other.ibsfuncs –test-postinject_func
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> ibs.delete_empty_nids() # a test run before this forgot to do this >>> aids_list = ibs.get_name_aids(ibs.get_valid_nids()) >>> # indirectly test postinject_func >>> thetas_list = ibs.get_unflat_annot_thetas(aids_list) >>> result = str(thetas_list) >>> print(result) [[0.0, 0.0], [0.0, 0.0], [0.0], [0.0], [0.0], [0.0], [0.0]]
-
wbia.other.ibsfuncs.
prepare_annotgroup_review
(ibs, aid_list)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- aid_list (int) – list of annotation ids
Returns: (src_ag_rowid, dst_ag_rowid) - source and dest annot groups
Return type: - CommandLine:
- python -m wbia.other.ibsfuncs –test-prepare_annotgroup_review
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> aid_list = ibs.get_valid_aids() >>> result = prepare_annotgroup_review(ibs, aid_list) >>> print(result)
-
wbia.other.ibsfuncs.
princeton_cameratrap_ocr_bottom_bar_accuracy
(ibs, offset=61200, **kwargs)[source]¶
-
wbia.other.ibsfuncs.
princeton_cameratrap_ocr_bottom_bar_csv
(ibs, prefix='/data/raw/unprocessed/horses/', threshold=0.39)[source]¶
-
wbia.other.ibsfuncs.
princeton_process_encounters
(ibs, input_file_path, assert_valid=True, **kwargs)[source]¶
-
wbia.other.ibsfuncs.
print_annotation_table
(ibs, verbosity=1, exclude_columns=[], include_columns=[])[source]¶ Dumps annotation table to stdout
Parameters: - ibs (IBEISController) –
- verbosity (int) –
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> verbosity = 1 >>> print_annotation_table(ibs, verbosity)
-
wbia.other.ibsfuncs.
print_annotconfig_stats
(ibs, qaids, daids, **kwargs)[source]¶ - SeeAlso:
- ibs.get_annotconfig_stats
-
wbia.other.ibsfuncs.
print_annotmatch_table
(ibs)[source]¶ Dumps annotation match table to stdout
Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.ibsfuncs –exec-print_annotmatch_table python -m wbia.other.ibsfuncs –exec-print_annotmatch_table –db PZ_Master1
Example
>>> # SCRIPT >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> result = print_annotmatch_table(ibs) >>> print(result)
-
wbia.other.ibsfuncs.
print_contributor_table
(ibs, verbosity=1, exclude_columns=[])[source]¶ Dumps annotation table to stdout
Parameters: - ibs (IBEISController) –
- verbosity (int) –
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> verbosity = 1 >>> print_contributor_table(ibs, verbosity)
-
wbia.other.ibsfuncs.
print_imageset_table
(ibs, **kwargs)[source]¶ Dumps imageset table to stdout
- Kwargs:
- exclude_columns (list):
-
wbia.other.ibsfuncs.
query_ggr_gids_between_dates
(ibs, gid_list=None, date1=(2018, 1, 27), date2=(2018, 1, 29), local_offset=-8.0, gmt_offset=3.0)[source]¶
-
wbia.other.ibsfuncs.
remove_aids_of_viewpoint
(ibs, aid_list, invalid_yaws)[source]¶ Removes aids that do not have a valid yaw
TODO; rename to valid_viewpoint because this func uses category labels
-
wbia.other.ibsfuncs.
remove_groundtrue_aids
(ibs, aid_list, ref_aid_list)[source]¶ removes any aids that are known to match
-
wbia.other.ibsfuncs.
report_sightings
(ibs, complete=True, include_images=False, kaia=False, **kwargs)[source]¶
-
wbia.other.ibsfuncs.
run_integrity_checks
(ibs)[source]¶ Function to run all database consistency checks
-
wbia.other.ibsfuncs.
search_annot_notes
(ibs, pattern, aid_list=None)[source]¶ Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('PZ_Master0') >>> pattern = ['gash', 'injury', 'scar', 'wound'] >>> valid_aid_list = ibs.search_annot_notes(pattern) >>> print(valid_aid_list) >>> print(ibs.get_annot_notes(valid_aid_list))
-
wbia.other.ibsfuncs.
search_ggr_qr_codes
(ibs, imageset_rowid_list=None, timeout=None, **kwargs)[source]¶ Search for QR codes in each imageset.
Parameters: - ibs (IBEISController) – wbia controller object
- imageset_rowid_list (list) – imageset rowid list
- CommandLine:
- python -m wbia.other.ibsfuncs search_ggr_qr_codes
- Reference:
https://www.learnopencv.com/barcode-and-qr-code-scanner-using-zbar-and-opencv/
- macOS:
brew install zbar
or
curl -O https://ayera.dl.sourceforge.net/project/zbar/zbar/0.10/zbar-0.10.tar.bz2 tar -xvjf zbar-0.10.tar.bz2 cd zbar-0.10/ CPPFLAGS=”-I/opt/local/include” LDFLAGS=”-L/opt/local/lib” ./configure –disable-video –without-qt –without-python –without-gtk –with-libiconv-prefix=/opt/local –with-jpeg=yes –prefix=$VIRTUAL_ENV make make install sudo ln $VIRTUAL_ENV/lib/libzbar.dylib /opt/local/lib/libzbar.dylib sudo ln $VIRTUAL_ENV/include/zbar.h /opt/local/include/zbar.h
- Ubuntu:
- sudo apt-get install libzbar-dev libzbar0
pip install pyzbar
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> default_dbdir = join('/', 'data', 'wbia', 'GGR2-IBEIS') >>> dbdir = ut.get_argval('--dbdir', type_=str, default=default_dbdir) >>> ibs = wbia.opendb(dbdir=dbdir) >>> ibs.search_ggr_qr_codes()
-
wbia.other.ibsfuncs.
search_ggr_qr_codes_worker
(imageset_rowid, imageset_text, values, gid_list, filepath_list, note_list, timeout)[source]¶
-
wbia.other.ibsfuncs.
set_exemplars_from_quality_and_viewpoint
(ibs, aid_list=None, exemplars_per_view=None, imgsetid=None, dry_run=False, verbose=True, prog_hook=None)[source]¶ Automatic exemplar selection algorithm based on viewpoint and quality
References
# implement maximum diversity approximation instead http://www.csbio.unc.edu/mcmillan/pubs/ICDM07_Pan.pdf
- CommandLine:
- python -m wbia.other.ibsfuncs –test-set_exemplars_from_quality_and_viewpoint python -m wbia.other.ibsfuncs –test-set_exemplars_from_quality_and_viewpoint:1
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> #ibs = wbia.opendb('PZ_MUGU_19') >>> ibs = wbia.opendb('PZ_MTEST') >>> dry_run = True >>> verbose = False >>> old_sum = sum(ibs.get_annot_exemplar_flags(ibs.get_valid_aids())) >>> new_flag_list = ibs.set_exemplars_from_quality_and_viewpoint(dry_run=dry_run) >>> new_sum = sum(new_flag_list) >>> print('old_sum = %r' % (old_sum,)) >>> print('new_sum = %r' % (new_sum,)) >>> zero_flag_list = ibs.set_exemplars_from_quality_and_viewpoint(exemplars_per_view=0, dry_run=dry_run) >>> assert sum(zero_flag_list) == 0 >>> result = new_sum
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> dry_run = True >>> verbose = False >>> old_sum = sum(ibs.get_annot_exemplar_flags(ibs.get_valid_aids())) >>> new_flag_list = ibs.set_exemplars_from_quality_and_viewpoint(dry_run=dry_run) >>> # 2 of the 11 annots are unknown and should not be exemplars >>> ut.assert_eq(sum(new_flag_list), 9)
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb2') >>> dry_run = True >>> verbose = False >>> imgsetid = None >>> aid_list = ibs.get_valid_aids(imgsetid=imgsetid) >>> new_flag_list = ibs.set_exemplars_from_quality_and_viewpoint(aid_list, dry_run=dry_run) >>> old_flag_list = ibs.get_annot_exemplar_flags(aid_list) >>> new_exemplar_aids = ut.compress(aid_list, new_flag_list) >>> new_exemplar_qualtexts = ibs.get_annot_quality_texts(new_exemplar_aids) >>> assert 'junk' not in new_exemplar_qualtexts, 'should not have junk exemplars' >>> assert 'poor' not in new_exemplar_qualtexts, 'should not have poor exemplars' >>> #assert len(new_aid_list) == len(new_flag_list) >>> # 2 of the 11 annots are unknown and should not be exemplars >>> #ut.assert_eq(len(new_aid_list), 9)
-
wbia.other.ibsfuncs.
sync_ggr_with_qr_codes
(ibs, local_offset=-8.0, gmt_offset=3.0, *args, **kwargs)[source]¶ Sync image time offsets using QR codes sync data
Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.ibsfuncs sync_ggr_with_qr_codes
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> default_dbdir = join('/', 'data', 'wbia', 'GGR2-IBEIS') >>> dbdir = ut.get_argval('--dbdir', type_=str, default=default_dbdir) >>> ibs = wbia.opendb(dbdir=dbdir) >>> ibs.sync_ggr_with_qr_codes()
-
wbia.other.ibsfuncs.
unflat_map
(method, unflat_rowids, **kwargs)[source]¶ Uses an wbia lookup function with a non-flat rowid list. In essence this is equivilent to map(method, unflat_rowids). The utility of this function is that it only calls method once. This is more efficient for calls that can take a list of inputs
Parameters: - method (method) – wbia controller method
- unflat_rowids (list) – list of rowid lists
Returns: unflat_vals
Return type: list of values
- CommandLine:
- python -m wbia.other.ibsfuncs –test-unflat_map
Example
>>> # ENABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb1') >>> method = ibs.get_annot_name_rowids >>> unflat_rowids = ibs.get_name_aids(ibs.get_valid_nids()) >>> unflat_vals = unflat_map(method, unflat_rowids) >>> result = str(unflat_vals) >>> print(result) [[1, 1], [2, 2], [3], [4], [5], [6], [7]]
-
wbia.other.ibsfuncs.
update_reviewed_unreviewed_image_special_imageset
(ibs, reviewed=True, unreviewed=True)[source]¶ Creates imageset of images that have not been reviewed and that have been reviewed (wrt detection)
-
wbia.other.ibsfuncs.
update_ungrouped_special_imageset
(ibs)[source]¶ Parameters: ibs (IBEISController) – wbia controller object - CommandLine:
- python -m wbia.other.ibsfuncs –test-update_ungrouped_special_imageset
Example
>>> # DISABLE_DOCTEST >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia # NOQA >>> ibs = wbia.opendb('testdb9') >>> result = update_ungrouped_special_imageset(ibs) >>> print(result)
Module contents¶
-
wbia.other.
IMPORT_TUPLES
= [('dbinfo', None), ('duct_tape', None), ('detectfuncs', None), ('detectexport', None), ('detectcore', None), ('detectgrave', None), ('detecttrain', None), ('ibsfuncs', None)]¶ cd /home/joncrall/code/wbia/wbia/other makeinit.py –modname=wbia.other
Type: Regen Command
-
wbia.other.
reassign_submodule_attributes
(verbose=True)[source]¶ why reloading all the modules doesnt do this I don’t know
-
wbia.other.
rrrr
(verbose=True)¶ Reloads wbia.other and submodules