wbia.web package¶
Submodules¶
wbia.web.apis module¶
Dependencies: flask, tornado
-
wbia.web.apis.
annot_src_api
(rowid=None, fresh=False, **kwargs)[source]¶ Returns the image file of annot <aid>
Example
>>> # xdoctest: +REQUIRES(--slow) >>> # xdoctest: +REQUIRES(--web-tests) >>> from wbia.web.app import * # NOQA >>> import wbia >>> with wbia.opendb_with_web('testdb1') as (ibs, client): ... resp = client.get('/api/annot/src/1/') >>> print(resp.data) b'\xff\xd8\xff\xe0\x00\x10JFIF...
- RESTful:
- Method: GET URL: /api/annot/src/<rowid>/
-
wbia.web.apis.
background_src_api
(rowid=None, fresh=False, **kwargs)[source]¶ Returns the image file of annot <aid>
Example
>>> # xdoctest: +REQUIRES(--slow) >>> # xdoctest: +REQUIRES(--web-tests) >>> # xdoctest: +REQUIRES(module:wbia_cnn) >>> from wbia.web.app import * # NOQA >>> import wbia >>> with wbia.opendb_with_web('testdb1') as (ibs, client): ... resp = client.get('/api/background/src/1/') >>> print(resp.data) b'\xff\xd8\xff\xe0\x00\x10JFIF...
- RESTful:
- Method: GET URL: /api/annot/src/<rowid>/
-
wbia.web.apis.
hello_world
(*args, **kwargs)[source]¶ Example
>>> # xdoctest: +REQUIRES(--web-tests) >>> from wbia.web.app import * # NOQA >>> import wbia >>> import requests >>> import wbia >>> with wbia.opendb_with_web('testdb1') as (ibs, client): ... resp = client.get('/api/test/helloworld/?test0=0') ... payload = { ... 'test1' : 'test1', ... 'test2' : None, # NOTICE test2 DOES NOT SHOW UP ... } ... resp = client.post('/api/test/helloworld/', data=payload)
-
wbia.web.apis.
image_conv_feature_api
(rowid=None, model='resnet50', **kwargs)[source]¶ - RESTful:
- Method: GET URL: /api/image/feature/json/<uuid>/
-
wbia.web.apis.
image_conv_feature_api_json
(uuid=None, model='resnet50', **kwargs)[source]¶ - RESTful:
- Method: GET URL: /api/image/feature/json/<uuid>/
-
wbia.web.apis.
image_src_api
(rowid=None, thumbnail=False, fresh=False, **kwargs)[source]¶ Returns the image file of image <gid>
Example
>>> from wbia.web.app import * # NOQA >>> import wbia >>> with wbia.opendb_with_web('testdb1') as (ibs, client): ... resp = client.get('/api/image/src/1/') >>> print(resp.data) b'\xff\xd8\xff\xe0\x00\x10JFIF...
- RESTful:
- Method: GET URL: /api/image/src/<rowid>/
-
wbia.web.apis.
image_src_api_json
(uuid=None, **kwargs)[source]¶ Returns the image file of image <gid>
Example
>>> # xdoctest: +REQUIRES(--web-tests) >>> from wbia.web.app import * # NOQA >>> import wbia >>> with wbia.opendb_with_web('testdb1') as (ibs, client): ... resp = client.get('/api/image/src/json/0a9bc03d-a75e-8d14-0153-e2949502aba7/') >>> print(resp.data) b'\xff\xd8\xff\xe0\x00\x10JFIF...
- RESTful:
- Method: GET URL: /api/image/src/<gid>/
-
wbia.web.apis.
image_upload
(cleanup=True, **kwargs)[source]¶ Returns the gid for an uploaded image.
Parameters: - image (image binary) – the POST variable containing the binary (multi-form) image data
- **kwargs – Arbitrary keyword arguments; the kwargs are passed down to the add_images function
Returns: - gid corresponding to the image submitted.
lexigraphical order.
Return type: gid (rowids)
- RESTful:
- Method: POST URL: /api/upload/image/
-
wbia.web.apis.
image_upload_zip
(**kwargs)[source]¶ Returns the gid_list for image files submitted in a ZIP archive. The image archive should be flat (no folders will be scanned for images) and must be smaller than 100 MB. The archive can submit multiple images, ideally in JPEG format to save space. Duplicate image uploads will result in the duplicate images receiving the same gid based on the hashed pixel values.
Parameters: - image_zip_archive (binary) – the POST variable containing the binary (multi-form) image archive data
- **kwargs – Arbitrary keyword arguments; the kwargs are passed down to the add_images function
Returns: - the list of gids corresponding to the images
submitted. The gids correspond to the image names sorted in lexigraphical order.
Return type: gid_list (list if rowids)
- RESTful:
- Method: POST URL: /api/image/zip
wbia.web.apis_detect module¶
Dependencies: flask, tornado.
-
wbia.web.apis_detect.
aoi_cnn
(ibs, aid_list, testing=False, model_tag='candidacy', **kwargs)[source]¶
-
wbia.web.apis_detect.
commit_detection_results
(ibs, gid_list, results_list, note=None, update_json_log=True)[source]¶
-
wbia.web.apis_detect.
commit_detection_results_filtered
(ibs, gid_list, filter_species_list=None, filter_viewpoint_list=None, note=None, update_json_log=True)[source]¶
-
wbia.web.apis_detect.
commit_localization_results
(ibs, gid_list, results_list, note=None, labeler_algo='pipeline', labeler_model_tag=None, viewpoint_model_tag=None, use_labeler_species=False, orienter_algo=None, orienter_model_tag=None, assigner_algo=None, assigner_model_tag=None, update_json_log=True, apply_nms_post_use_labeler_species=True, **kwargs)[source]¶
-
wbia.web.apis_detect.
detect_cnn_json
(ibs, gid_list, detect_func, config={}, **kwargs)[source]¶ Run animal detection in each image and returns json-ready formatted results, does not return annotations.
Parameters: gid_list (list) – list of image ids to run detection on Returns: dict of detection results (not annotations) Return type: results_dict (list) - CommandLine:
- python -m wbia.web.apis_detect –test-detect_cnn_yolo_json
Example
>>> # DISABLE_DOCTEST >>> from wbia.web.apis_detect import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') >>> gid_list = ibs.get_valid_gids()[0:2] >>> results_dict = ibs.detect_cnn_yolo_json(gid_list) >>> print(results_dict)
-
wbia.web.apis_detect.
detect_cnn_json_wrapper
(ibs, image_uuid_list, detect_func, **kwargs)[source]¶ Detect with CNN (general).
- REST:
- Method: GET URL: /api/detect/cnn/yolo/json/
Parameters: image_uuid_list (list) – list of image uuids to detect on.
-
wbia.web.apis_detect.
detect_cnn_lightnet
(ibs, gid_list, model_tag=None, commit=True, testing=False, **kwargs)[source]¶ Run animal detection in each image. Adds annotations to the database as they are found.
Parameters: gid_list (list) – list of image ids to run detection on Returns: - list of lists of annotation ids detected in each
- image
Return type: aids_list (list) - CommandLine:
- python -m wbia.web.apis_detect –test-detect_cnn_lightnet –show
- RESTful:
- Method: PUT, GET URL: /api/detect/cnn/lightnet/
Example
>>> # DISABLE_DOCTEST >>> from wbia.web.apis_detect import * # NOQA >>> import wbia >>> ibs = wbia.opendb('PZ_MTEST') >>> gid_list = ibs.get_valid_gids()[:5] >>> aids_list = ibs.detect_cnn_lightnet(gid_list) >>> if ut.show_was_requested(): >>> import wbia.plottool as pt >>> from wbia.viz import viz_image >>> for fnum, gid in enumerate(gid_list): >>> viz_image.show_image(ibs, gid, fnum=fnum) >>> pt.show_if_requested() >>> # Remove newly detected annotations >>> ibs.delete_annots(ut.flatten(aids_list))
-
wbia.web.apis_detect.
detect_cnn_lightnet_image_uris_json
(ibs, image_uris, config={}, **kwargs)[source]¶
-
wbia.web.apis_detect.
detect_cnn_yolo
(ibs, gid_list, model_tag=None, commit=True, testing=False, **kwargs)[source]¶ Run animal detection in each image. Adds annotations to the database as they are found.
Parameters: gid_list (list) – list of image ids to run detection on Returns: - list of lists of annotation ids detected in each
- image
Return type: aids_list (list) - CommandLine:
- python -m wbia.web.apis_detect –test-detect_cnn_yolo –show
- RESTful:
- Method: PUT, GET URL: /api/detect/cnn/yolo/
Example
>>> # DISABLE_DOCTEST >>> from wbia.web.apis_detect import * # NOQA >>> import wbia >>> ibs = wbia.opendb('PZ_MTEST') >>> gid_list = ibs.get_valid_gids()[:5] >>> aids_list = ibs.detect_cnn_yolo(gid_list) >>> if ut.show_was_requested(): >>> import wbia.plottool as pt >>> from wbia.viz import viz_image >>> for fnum, gid in enumerate(gid_list): >>> viz_image.show_image(ibs, gid, fnum=fnum) >>> pt.show_if_requested() >>> # Remove newly detected annotations >>> ibs.delete_annots(ut.flatten(aids_list))
-
wbia.web.apis_detect.
detect_cnn_yolo_exists
(ibs, gid_list, testing=False)[source]¶ Check to see if a detection has been completed.
Parameters: gid_list (list) – list of image ids to run detection on Returns: - list of flags for if the detection has been run on
- the image
Return type: flag_list (list) - CommandLine:
- python -m wbia.web.apis_detect –test-detect_cnn_yolo_exists
- RESTful:
- Method: GET URL: /api/detect/cnn/yolo/exists/
Example
>>> # DISABLE_DOCTEST >>> from wbia.web.apis_detect import * # NOQA >>> import wbia >>> ibs = wbia.opendb('PZ_MTEST') >>> gid_list = ibs.get_valid_gids() >>> depc = ibs.depc_image >>> aids_list = ibs.detect_cnn_yolo(gid_list[:3], testing=True) >>> result = ibs.detect_cnn_yolo_exists(gid_list[:5]) >>> ibs.delete_annots(ut.flatten(aids_list)) >>> print(result) [True, True, True, False, False]
-
wbia.web.apis_detect.
detect_ws_injury
(ibs, gid_list)[source]¶ Classify if a whale shark is injured.
Parameters: gid_list (list) – list of image ids to run classification on Returns: - predictions is list of strings representing a possible tag.
- confidences is a list of floats of correspoinding cofidence to the prediction
Return type: result_list (dictionary)
-
wbia.web.apis_detect.
get_species_with_detectors
(ibs)[source]¶ Get valid species for detection.
- RESTful:
- Method: GET URL: /api/detect/species/
-
wbia.web.apis_detect.
get_working_species
(ibs)[source]¶ Get working species for detection.
- RESTful:
- Method: GET URL: /api/detect/species/working/
-
wbia.web.apis_detect.
has_species_detector
(ibs, species_text)[source]¶ TODO: extend to use non-constant species.
- RESTful:
- Method: GET URL: /api/detect/species/enabled/
-
wbia.web.apis_detect.
labeler_cnn
(ibs, aid_list, testing=False, algo='pipeline', model_tag='candidacy', **kwargs)[source]¶
-
wbia.web.apis_detect.
models_cnn
(ibs, config_dict, parse_classes_func, parse_line_func, check_hash=False, hidden_models=[], **kwargs)[source]¶
-
wbia.web.apis_detect.
models_cnn_lightnet
(ibs, **kwargs)[source]¶ Return the models (and their labels) for the YOLO CNN detector
- RESTful:
- Method: PUT, GET URL: /api/labels/cnn/lightnet/
-
wbia.web.apis_detect.
models_cnn_yolo
(ibs, **kwargs)[source]¶ Return the models (and their labels) for the YOLO CNN detector
- RESTful:
- Method: PUT, GET URL: /api/labels/cnn/yolo/
-
wbia.web.apis_detect.
process_detection_html
(ibs, **kwargs)[source]¶ Process the return from the detection review interface. Pass the POST result from the detection review form directly to this function unmodified.
Returns: Same format as func:start_detect_image Return type: detection results (dict) - RESTful:
- Method: POST URL: /api/review/detect/cnn/yolo/
-
wbia.web.apis_detect.
review_detection_html
(ibs, image_uuid, result_list, callback_url, callback_method='POST', include_jquery=False, config=None)[source]¶ Return the detection review interface for a particular image UUID and a list of results for that image.
Parameters: - image_uuid (UUID) – the UUID of the image you want to review detections for
- result_list (list of dict) – list of detection results returned by the detector
- callback_url (str) – URL that the review form will submit to (action) when the user is complete with their review
- callback_method (str) – HTTP method the review form will submit to (method). Defaults to ‘POST’
Returns: json response with the detection web interface in html
Return type: template (html)
- RESTful:
- Method: GET URL: /api/review/detect/cnn/yolo/
-
wbia.web.apis_detect.
review_detection_test
(image_uuid=None, result_list=None, callback_url=None, callback_method='POST', callback_detailed=False, **kwargs)[source]¶
wbia.web.apis_engine module¶
-
wbia.web.apis_engine.
ensure_simple_server
(port=5832)[source]¶ - CommandLine:
- python -m wbia.web.apis_engine –exec-ensure_simple_server python -m utool.util_web –exec-start_simple_webserver
Example
>>> # DISABLE_DOCTEST >>> from wbia.web.apis_engine import * # NOQA >>> result = ensure_simple_server() >>> print(result)
-
wbia.web.apis_engine.
start_add_images
(ibs, image_uri_list, callback_url=None, callback_method=None, callback_detailed=False, lane='fast', jobid=None, **kwargs)[source]¶ - REST:
- Method: GET/api/engine/image/json/ URL:
Parameters: - image_uri_list (list) – list of image urls to import.
- callback_url (url) – url that will be called when detection succeeds or fails
-
wbia.web.apis_engine.
start_detect_image_lightnet
(ibs, image_uuid_list, callback_url=None, callback_method=None, callback_detailed=False, lane='fast', jobid=None, **kwargs)[source]¶ - REST:
- Method: GET/api/engine/detect/cnn/lightnet/ URL:
Parameters: - image_uuid_list (list) – list of image uuids or urls to detect on.
- callback_url (url) – url that will be called when detection succeeds or fails
-
wbia.web.apis_engine.
start_detect_image_yolo
(ibs, image_uuid_list, callback_url=None, callback_method=None, callback_detailed=False, lane='fast', jobid=None, **kwargs)[source]¶ - REST:
- Method: GET URL: /api/engine/detect/cnn/yolo/
Parameters: - image_uuid_list (list) – list of image uuids to detect on.
- callback_url (url) – url that will be called when detection succeeds or fails
-
wbia.web.apis_engine.
start_identify_annots
(ibs, qannot_uuid_list, dannot_uuid_list=None, pipecfg={}, callback_url=None, callback_method=None, callback_detailed=False, lane='slow', jobid=None)[source]¶ - REST:
- Method: GET URL: /api/engine/query/annot/rowid/
Parameters: - qannot_uuid_list (list) – specifies the query annotations to identify.
- dannot_uuid_list (list) – specifies the annotations that the algorithm is allowed to use for identification. If not specified all annotations are used. (default=None)
- pipecfg (dict) – dictionary of pipeline configuration arguments (default=None)
- CommandLine:
# Run as main process python -m wbia.web.apis_engine –exec-start_identify_annots:0 # Run using server process python -m wbia.web.apis_engine –exec-start_identify_annots:1
# Split into multiple processes python -m wbia.web.apis_engine –main –bg python -m wbia.web.apis_engine –exec-start_identify_annots:1 –fg
python -m wbia.web.apis_engine –exec-start_identify_annots:1 –domain http://52.33.105.88
python -m wbia.web.apis_engine –exec-start_identify_annots:1 –duuids=[] python -m wbia.web.apis_engine –exec-start_identify_annots:1 –domain http://52.33.105.88 –duuids=03a17411-c226-c960-d180-9fafef88c880
Example
>>> # DISABLE_DOCTEST >>> from wbia.web.apis_engine import * # NOQA >>> from wbia.web import apis_engine >>> import wbia >>> ibs, qaids, daids = wbia.testdata_expanded_aids( >>> defaultdb='PZ_MTEST', a=['default:qsize=2,dsize=10']) >>> qannot_uuid_list = ibs.get_annot_uuids(qaids) >>> dannot_uuid_list = ibs.get_annot_uuids(daids) >>> pipecfg = {} >>> ibs.initialize_job_manager() >>> jobid = ibs.start_identify_annots(qannot_uuid_list, dannot_uuid_list, pipecfg) >>> result = ibs.wait_for_job_result(jobid, timeout=None, freq=2) >>> print(result) >>> import utool as ut >>> #print(ut.to_json(result)) >>> ibs.close_job_manager()
Example
>>> # DISABLE_DOCTEST >>> from wbia.web.apis_engine import * # NOQA >>> import wbia >>> ibs = wbia.opendb('testdb1') # , domain='http://52.33.105.88') >>> aids = ibs.get_valid_aids()[0:2] >>> qaids = aids[0:1] >>> daids = aids >>> query_config_dict = { >>> #'pipeline_root' : 'BC_DTW' >>> } >>> qreq_ = ibs.new_query_request(qaids, daids, cfgdict=query_config_dict) >>> cm_list = qreq_.execute()
Example
>>> # xdoctest: +REQUIRES(--web-tests) >>> # xdoctest: +REQUIRES(--job-engine-tests) >>> from wbia.web.apis_engine import * # NOQA >>> import wbia >>> with wbia.opendb_bg_web('testdb1', managed=True) as web_ibs: # , domain='http://52.33.105.88') ... aids = web_ibs.send_wbia_request('/api/annot/', 'get')[0:2] ... uuid_list = web_ibs.send_wbia_request('/api/annot/uuid/', type_='get', aid_list=aids) ... quuid_list = ut.get_argval('--quuids', type_=list, default=uuid_list) ... duuid_list = ut.get_argval('--duuids', type_=list, default=uuid_list) ... data = dict( ... qannot_uuid_list=quuid_list, dannot_uuid_list=duuid_list, ... pipecfg={}, ... callback_url='http://127.0.1.1:5832' ... ) ... # Start callback server ... bgserver = ensure_simple_server() ... # -- ... jobid = web_ibs.send_wbia_request('/api/engine/query/annot/rowid/', **data) ... status_response = web_ibs.wait_for_results(jobid, delays=[1, 5, 30]) ... print('status_response = %s' % (status_response,)) ... result_response = web_ibs.read_engine_results(jobid) ... print('result_response = %s' % (result_response,)) ... cm_dict = result_response['json_result'][0] ... print('Finished test') ... bgserver.terminate2() Waiting for server to be up. count=0 ... status_response = {'status': 'ok', 'jobid': '...', 'jobstatus': 'completed'} result_response = ... Finished test
- Ignore:
- qaids = daids = ibs.get_valid_aids() jobid = ibs.start_identify_annots(**payload)
-
wbia.web.apis_engine.
start_identify_annots_query
(ibs, query_annot_uuid_list=None, query_annot_name_list=None, database_annot_uuid_list=None, database_annot_name_list=None, database_imgsetid=None, matching_state_list=[], query_config_dict={}, echo_query_params=True, include_qaid_in_daids=True, callback_url=None, callback_method=None, callback_detailed=False, lane='slow', jobid=None)[source]¶ - REST:
- Method: GET URL: /api/engine/query/graph/
Parameters: - query_annot_uuid_list (list) – specifies the query annotations to identify.
- query_annot_name_list (list) – specifies the query annotation names
- database_annot_uuid_list (list) – specifies the annotations that the algorithm is allowed to use for identification. If not specified all annotations are used. (default=None)
- database_annot_name_list (list) – specifies the database annotation names (default=None)
- matching_state_list (list of tuple) – the list of matching state 3-tuples corresponding to the query_annot_uuid_list (default=None)
- query_config_dict (dict) – dictionary of algorithmic configuration arguments. (default=None)
- echo_query_params (bool) – flag for if to return the original query parameters with the result
- CommandLine:
- # Normal mode python -m wbia.web.apis_engine start_identify_annots_query # Split mode wbia –web python -m wbia.web.apis_engine start_identify_annots_query –show –domain=localhost
Example
>>> # DISABLE_DOCTEST >>> # xdoctest: +REQUIRES(--job-engine-tests) >>> from wbia.web.apis_engine import * # NOQA >>> import wbia >>> #domain = 'localhost' >>> domain = None >>> with wbia.opendb_bg_web('testdb1', domain=domain, managed=True) as web_ibs: # , domain='http://52.33.105.88') ... aids = web_ibs.send_wbia_request('/api/annot/', 'get')[0:3] ... uuid_list = web_ibs.send_wbia_request('/api/annot/uuid/', type_='get', aid_list=aids) ... quuid_list = ut.get_argval('--quuids', type_=list, default=uuid_list)[0:1] ... duuid_list = ut.get_argval('--duuids', type_=list, default=uuid_list) ... query_config_dict = { ... #'pipeline_root' : 'BC_DTW' ... } ... data = dict( ... query_annot_uuid_list=quuid_list, database_annot_uuid_list=duuid_list, ... query_config_dict=query_config_dict, ... ) ... jobid = web_ibs.send_wbia_request('/api/engine/query/graph/', **data) ... print('jobid = %r' % (jobid,)) ... status_response = web_ibs.wait_for_results(jobid) ... result_response = web_ibs.read_engine_results(jobid) ... print('result_response = %s' % (ut.repr3(result_response),)) ... inference_result = result_response['json_result'] ... if isinstance(inference_result, str): ... print(inference_result) ... cm_dict = inference_result['cm_dict'] ... quuid = quuid_list[0] ... cm = cm_dict[str(quuid)]
-
wbia.web.apis_engine.
start_identify_annots_query_complete
(ibs, annot_uuid_list=None, annot_name_list=None, matching_state_list=[], query_config_dict={}, k=5, echo_query_params=True, callback_url=None, callback_method=None, callback_detailed=False, lane='slow', jobid=None)[source]¶ - REST:
- Method: GET URL: /api/engine/query/complete/
Parameters: - annot_uuid_list (list) – specifies the query annotations to identify.
- annot_name_list (list) – specifies the query annotation names
- matching_state_list (list of tuple) – the list of matching state 3-tuples corresponding to the query_annot_uuid_list (default=None)
- query_config_dict (dict) – dictionary of algorithmic configuration arguments. (default=None)
- echo_query_params (bool) – flag for if to return the original query parameters with the result
-
wbia.web.apis_engine.
start_labeler_cnn
(ibs, annot_uuid_list, callback_url=None, callback_method=None, callback_detailed=False, lane='fast', jobid=None, **kwargs)[source]¶
-
wbia.web.apis_engine.
start_predict_ws_injury_interim_svm
(ibs, annot_uuid_list, callback_url=None, callback_method=None, callback_detailed=False, lane='fast', jobid=None, **kwargs)[source]¶ - REST:
- Method: POST URL: /api/engine/classify/whaleshark/injury/
Parameters: - annot_uuid_list (list) – list of annot uuids to detect on.
- callback_url (url) – url that will be called when detection succeeds or fails
- CommandLine:
- python -m wbia.web.apis_engine start_predict_ws_injury_interim_svm
Example
>>> # DISABLE_DOCTEST >>> from wbia.web.apis_engine import * # NOQA >>> from wbia.web import apis_engine >>> import wbia >>> ibs, qaids, daids = wbia.testdata_expanded_aids( >>> defaultdb='WS_ALL', a=['default:qsize=2,dsize=10']) >>> annot_uuid_list = ibs.get_annot_uuids(qaids) >>> ibs.initialize_job_manager() >>> jobid = ibs.start_predict_ws_injury_interim_svm(annot_uuid_list) >>> result = ibs.wait_for_job_result(jobid, timeout=None, freq=2) >>> print(result) >>> import utool as ut >>> #print(ut.to_json(result)) >>> ibs.close_job_manager()
-
wbia.web.apis_engine.
start_review_query_chips_best
(ibs, annot_uuid, database_imgsetid=None, callback_url=None, callback_method=None, callback_detailed=False, lane='slow', jobid=None, **kwargs)[source]¶
-
wbia.web.apis_engine.
start_web_query_all
(ibs)[source]¶ - REST:
- Method: GET URL: /api/engine/query/web/
-
wbia.web.apis_engine.
start_wic_image
(ibs, image_uuid_list, callback_url=None, callback_method=None, callback_detailed=False, lane='fast', jobid=None, **kwargs)[source]¶ - REST:
- Method: GET URL: /api/engine/wic/cnn/
Parameters: - image_uuid_list (list) – list of image uuids to detect on.
- callback_url (url) – url that will be called when detection succeeds or fails
-
wbia.web.apis_engine.
start_wildbook_sync
(ibs, **kwargs)[source]¶ - REST:
- Method: GET URL: /api/engine/wildbook/sync/
-
wbia.web.apis_engine.
web_check_uuids
(ibs, image_uuid_list=[], qannot_uuid_list=[], dannot_uuid_list=[])[source]¶ Parameters: - CommandLine:
- python -m wbia.web.apis_engine –exec-web_check_uuids –show
Example
>>> # DISABLE_DOCTEST >>> from wbia.web.apis_engine import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> image_uuid_list = [] >>> qannot_uuid_list = ibs.get_annot_uuids([1, 1, 2, 3, 2, 4]) >>> dannot_uuid_list = ibs.get_annot_uuids([1, 2, 3]) >>> try: >>> web_check_uuids(ibs, image_uuid_list, qannot_uuid_list, >>> dannot_uuid_list) >>> except controller_inject.WebDuplicateUUIDException: >>> pass >>> else: >>> raise AssertionError('Should have gotten WebDuplicateUUIDException') >>> try: >>> web_check_uuids(ibs, [1, 2, 3], qannot_uuid_list, >>> dannot_uuid_list) >>> except controller_inject.WebMissingUUIDException as ex: >>> pass >>> else: >>> raise AssertionError('Should have gotten WebMissingUUIDException') >>> print('Successfully reported errors')
wbia.web.apis_json module¶
Dependencies: flask, tornado
-
wbia.web.apis_json.
add_annotmatch_json
(ibs, match_annot_uuid1_list, match_annot_uuid2_list, match_evidence_decision_list=None, match_meta_decision_list=None, match_confidence_list=None, match_user_list=None, match_tag_list=None, match_modified_list=None, match_count_list=None)[source]¶
-
wbia.web.apis_json.
add_annots_json
(ibs, image_uuid_list, annot_bbox_list, annot_theta_list, annot_viewpoint_list=None, annot_quality_list=None, annot_species_list=None, annot_multiple_list=None, annot_interest_list=None, annot_name_list=None, **kwargs)[source]¶ - REST:
- Method: POST URL: /api/annot/json/
- Ignore:
- sudo pip install boto
Parameters: - image_uuid_list (list of str) – list of image UUIDs to be used in IBEIS IA
- annot_bbox_list (list of 4-tuple) – list of bounding box coordinates encoded as a 4-tuple of the values (xtl, ytl, width, height) where xtl is the ‘top left corner, x value’ and ytl is the ‘top left corner, y value’.
- annot_theta_list (list of float) – list of radian rotation around center. Defaults to 0.0 (no rotation).
- annot_species_list (list of str) – list of species for the annotation, if known. If the list is partially known, use None (null in JSON) for unknown entries.
- annot_name_list (list of str) – list of names for the annotation, if known. If the list is partially known, use None (null in JSON) for unknown entries.
- **kwargs – key-value pairs passed to the ibs.add_annots() function.
- CommandLine:
- python -m wbia.web.app –test-add_annots_json
Example
>>> # DISABLE_DOCTEST >>> import wbia >>> from wbia.control.IBEISControl import * # NOQA >>> web_instance = wbia.opendb(db='testdb1') >>> _payload = { >>> 'image_uuid_list': [ >>> uuid.UUID('7fea8101-7dec-44e3-bf5d-b8287fd231e2'), >>> uuid.UUID('c081119a-e08e-4863-a710-3210171d27d6'), >>> ], >>> 'annot_uuid_list': [ >>> uuid.UUID('fe1547c5-1425-4757-9b8f-b2b4a47f552d'), >>> uuid.UUID('86d3959f-7167-4822-b99f-42d453a50745'), >>> ], >>> 'annot_bbox_list': [ >>> [0, 0, 1992, 1328], >>> [0, 0, 1194, 401], >>> ], >>> } >>> aid_list = wbia.web.app.add_annots_json(web_instance, **_payload) >>> print(aid_list) >>> print(web_instance.get_annot_image_uuids(aid_list)) >>> print(web_instance.get_annot_uuids(aid_list)) >>> print(web_instance.get_annot_bboxes(aid_list))
-
wbia.web.apis_json.
add_images_json
(ibs, image_uri_list, image_unixtime_list=None, image_gps_lat_list=None, image_gps_lon_list=None, **kwargs)[source]¶ - REST:
- Method: POST URL: /api/image/json/
- Ignore:
- sudo pip install boto
Parameters: - image_uri_list (list) –
list of string image uris, most likely HTTP(S) or S3 encoded URLs. Alternatively, this can be a list of dictionaries (JSON objects) that specify AWS S3 stored assets. An example below:
- image_uri_list = [
- ’http://domain.com/example/asset1.png’,
‘/home/example/Desktop/example/asset2.jpg’,
‘s3://s3.amazon.com/example-bucket-2/asset1-in-bucket-2.tif’,
{’bucket’ : ‘example-bucket-1’, ‘key’ : ‘example/asset1.png’, ‘auth_domain’ : None, # Uses 127.0.0.1 ‘auth_access_id’ : None, # Uses system default ‘auth_secret_key’ : None, # Uses system default
}, {
’bucket’ : ‘example-bucket-1’, ‘key’ : ‘example/asset2.jpg’, # if unspecified, auth uses 127.0.0.1 and system defaults}, {
’bucket’ : ‘example-bucket-2’, ‘key’ : ‘example/asset1-in-bucket-2.tif’, ‘auth_domain’ : ‘s3.amazon.com’, ‘auth_access_id’ : ‘____________________’, ‘auth_secret_key’ : ‘________________________________________’,},
]
Note that you cannot specify AWS authentication access ids or secret keys using string uri’s. For specific authentication methods, please use the latter list of dictionaries.
- image_time_posix_list (list of int) – list of image’s POSIX timestamps
- image_gps_lat_list (list of float) – list of image’s GPS latitude values
- image_gps_lon_list (list of float) – list of image’s GPS longitude values
- **kwargs – key-value pairs passed to the ibs.add_images() function.
- CommandLine:
python -m wbia.web.apis_json –test-add_images_json
,”bucket”:”flukebook-prod-asset-store”,”key”:””
Example
>>> # FIXME failing-test (03-Aug-2020) boto.exception.NoAuthHandlerFound: No handler was ready to authenticate >>> # xdoctest: +SKIP >>> from wbia.control.IBEISControl import * # NOQA >>> import wbia >>> import uuid >>> web_instance = wbia.opendb(db='testdb1') >>> _payload = { >>> 'image_uri_list': [ >>> 'https://upload.wikimedia.org/wikipedia/commons/4/49/Zebra_running_Ngorongoro.jpg', >>> { >>> 'bucket' : 'test-asset-store', >>> 'key' : 'caribwhale/20130903-JAC-0002.JPG', >>> }, >>> { >>> 'bucket' : 'flukebook-prod-asset-store', >>> 'key' : '3/a/3a76b0e8-1c64-403d-ace1-679cf2f081c0/f2.jpg', >>> }, >>> ], >>> } >>> gid_list = wbia.web.apis_json.add_images_json(web_instance, **_payload) >>> print(gid_list) >>> print(web_instance.get_image_uuids(gid_list)) >>> print(web_instance.get_image_uris(gid_list)) >>> print(web_instance.get_image_paths(gid_list)) >>> print(web_instance.get_image_uris_original(gid_list))
-
wbia.web.apis_json.
add_imagesets_json
(ibs, imageset_text_list, imageset_uuid_list=None, config_rowid_list=None, imageset_notes_list=None, imageset_occurence_flag_list=None)[source]¶ Adds a list of imagesets.
Parameters: Returns: added imageset uuids
Return type: imageset_uuid_list (list)
- RESTful:
- Method: POST URL: /api/imageset/json/
-
wbia.web.apis_json.
add_names_json
(ibs, name_text_list, name_uuid_list=None, name_note_list=None)[source]¶
-
wbia.web.apis_json.
add_parts_json
(ibs, annot_uuid_list, part_bbox_list, part_theta_list, **kwargs)[source]¶ - REST:
- Method: POST URL: /api/part/json/
- Ignore:
- sudo pip install boto
Parameters: - annot_uuid_list (list of str) – list of annot UUIDs to be used in IBEIS IA
- part_uuid_list (list of str) – list of annotations UUIDs to be used in IBEIS IA
- part_bbox_list (list of 4-tuple) – list of bounding box coordinates encoded as a 4-tuple of the values (xtl, ytl, width, height) where xtl is the ‘top left corner, x value’ and ytl is the ‘top left corner, y value’.
- part_theta_list (list of float) – list of radian rotation around center. Defaults to 0.0 (no rotation).
- **kwargs – key-value pairs passed to the ibs.add_annots() function.
-
wbia.web.apis_json.
add_review_json
(ibs, review_annot_uuid1_list, review_annot_uuid2_list, review_evidence_decision_list, review_meta_decision_list=None, review_uuid_list=None, review_user_list=None, review_user_confidence_list=None, review_tags_list=None, review_client_start_time_posix=None, review_client_end_time_posix=None, review_server_start_time_posix=None, review_server_end_time_posix=None)[source]¶
-
wbia.web.apis_json.
add_species_json
(ibs, species_nice_list, species_text_list=None, species_code_list=None, species_uuid_list=None, species_note_list=None, skip_cleaning=False)[source]¶
-
wbia.web.apis_json.
chaos_imageset
(ibs)[source]¶ - REST:
- Method: POST URL: /api/image/json/
Parameters: image_uuid_list (list of str) – list of image UUIDs to be delete from IBEIS
-
wbia.web.apis_json.
delete_annots_json
(ibs, annot_uuid_list)[source]¶ - REST:
- Method: DELETE URL: /api/annot/json/
Parameters: annot_uuid_list (list of str) – list of annot UUIDs to be delete from IBEIS
-
wbia.web.apis_json.
delete_images_json
(ibs, image_uuid_list)[source]¶ - REST:
- Method: DELETE URL: /api/image/json/
Parameters: image_uuid_list (list of str) – list of image UUIDs to be delete from IBEIS
-
wbia.web.apis_json.
delete_imageset_json
(ibs, imageset_uuid_list)[source]¶ - REST:
- Method: DELETE URL: /api/imageset/json/
Parameters: imageset_uuid_list (list of str) – list of imageset UUIDs to be delete from IBEIS
-
wbia.web.apis_json.
delete_name_json
(ibs, name_uuid_list)[source]¶ - REST:
- Method: DELETE URL: /api/name/json/
Parameters: name_uuid_list (list of str) – list of name UUIDs to be delete from IBEIS
-
wbia.web.apis_json.
delete_species_json
(ibs, species_uuid_list)[source]¶ - REST:
- Method: DELETE URL: /api/species/json/
Parameters: species_uuid_list (list of str) – list of species UUIDs to be delete from IBEIS
-
wbia.web.apis_json.
get_imageset_imgsetids_from_text_json
(ibs, imageset_text_list, **kwargs)[source]¶
-
wbia.web.apis_json.
image_base64_api_json
(ibs, uuid=None, thumbnail=False, fresh=False, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annot_name_texts_json
(ibs, annot_uuid_list, name_text_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annot_quality_texts_json
(ibs, annot_uuid_list, quality_text_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annot_species_json
(ibs, annot_uuid_list, species_text_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annot_tag_text_json
(ibs, annot_uuid_list, annot_tags_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annot_viewpoints_json
(ibs, annot_uuid_list, viewpoint_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annotmatch_confidence_json
(ibs, match_annot_uuid1_list, match_annot_uuid2_list, match_confidence_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annotmatch_count_json
(ibs, match_annot_uuid1_list, match_annot_uuid2_list, match_count_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annotmatch_evidence_decision_json
(ibs, match_annot_uuid1_list, match_annot_uuid2_list, match_decision_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annotmatch_meat_decision_json
(ibs, match_annot_uuid1_list, match_annot_uuid2_list, match_decision_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annotmatch_posixtime_modified_json
(ibs, match_annot_uuid1_list, match_annot_uuid2_list, match_modified_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annotmatch_reviewer_json
(ibs, match_annot_uuid1_list, match_annot_uuid2_list, match_user_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_annotmatch_tag_text_json
(ibs, match_annot_uuid1_list, match_annot_uuid2_list, match_tags_list, **kwargs)[source]¶
-
wbia.web.apis_json.
set_exemplars_from_quality_and_viewpoint_json
(ibs, annot_uuid_list, annot_name_list, **kwargs)[source]¶
wbia.web.apis_query module¶
Dependencies: flask, tornado
- SeeAlso:
- routes.review_identification
-
wbia.web.apis_query.
ensure_review_image
(ibs, aid, cm, qreq_, view_orientation='vertical', draw_matches=True, draw_heatmask=False, verbose=False)[source]¶ ” Create the review image for a pair of annotations
- CommandLine:
- python -m wbia.web.apis_query ensure_review_image –show
Example
>>> # SCRIPT >>> from wbia.web.apis_query import * # NOQA >>> import wbia >>> cm, qreq_ = wbia.testdata_cm('PZ_MTEST', a='default:dindex=0:10,qindex=0:1') >>> ibs = qreq_.ibs >>> aid = cm.get_top_aids()[0] >>> tt = ut.tic('make image') >>> image, _ = ensure_review_image(ibs, aid, cm, qreq_) >>> ut.toc(tt) >>> ut.quit_if_noshow() >>> print('image.shape = %r' % (image.shape,)) >>> print('image.dtype = %r' % (image.dtype,)) >>> ut.print_object_size(image) >>> import wbia.plottool as pt >>> pt.imshow(image) >>> ut.show_if_requested()
-
wbia.web.apis_query.
ensure_review_image_v2
(ibs, match, draw_matches=False, draw_heatmask=False, view_orientation='vertical', overlay=True)[source]¶
-
wbia.web.apis_query.
get_recognition_query_aids
(ibs, is_known, species=None)[source]¶ DEPCIRATE
- RESTful:
- Method: GET URL: /api/query/annot/rowid/
-
wbia.web.apis_query.
process_graph_match_html
(ibs, **kwargs)[source]¶ - RESTful:
- Method: POST URL: /api/review/query/graph/
-
wbia.web.apis_query.
query_chips
(ibs, qaid_list=None, daid_list=None, cfgdict=None, use_cache=None, use_bigcache=None, qreq_=None, return_request=False, verbose=False, save_qcache=None, prog_hook=None, return_cm_dict=False, return_cm_simple_dict=False)[source]¶ Submits a query request to the hotspotter recognition pipeline. Returns a list of QueryResult objects.
Parameters: - qaid_list (list) – a list of annotation ids to be submitted as queries
- daid_list (list) – a list of annotation ids used as the database that will be searched
- cfgdict (dict) – dictionary of configuration options used to create a new QueryRequest if not already specified
- use_cache (bool) – turns on/off chip match cache (default: True)
- use_bigcache (bool) – turns one/off chunked chip match cache (default: True)
- qreq_ (QueryRequest) – optional, a QueryRequest object that overrides all previous settings
- return_request (bool) – returns the request which will be created if one is not already specified
- verbose (bool) – default=False, turns on verbose printing
Returns: - a list of ChipMatch objects containing the matching
annotations, scores, and feature matches
Return type: - Returns(2):
- tuple: (cm_list, qreq_) - a list of query results and optionally the
- QueryRequest object used
- RESTful:
- Method: PUT URL: /api/query/chip/
- CommandLine:
python -m wbia.web.apis_query –test-query_chips
# Test speed of single query python -m wbia –tf IBEISController.query_chips –db PZ_Master1 -a default:qindex=0:1,dindex=0:500 –nocache-hs
python -m wbia –tf IBEISController.query_chips –db PZ_Master1 -a default:qindex=0:1,dindex=0:3000 –nocache-hs
python -m wbia.web.apis_query –test-query_chips:1 –show python -m wbia.web.apis_query –test-query_chips:2 –show
Example
>>> # SLOW_DOCTEST >>> # xdoctest: +SKIP >>> from wbia.control.IBEISControl import * # NOQA >>> import wbia >>> qreq_ = wbia.testdata_qreq_() >>> ibs = qreq_.ibs >>> cm_list = qreq_.execute() >>> cm = cm_list[0] >>> ut.quit_if_noshow() >>> cm.ishow_analysis(qreq_) >>> ut.show_if_requested()
Example
>>> # SLOW_DOCTEST >>> # xdoctest: +SKIP >>> import wbia >>> from wbia.control.IBEISControl import * # NOQA >>> qaid_list = [1] >>> daid_list = [1, 2, 3, 4, 5] >>> ibs = wbia.opendb_test(db='testdb1') >>> qreq_ = ibs.new_query_request(qaid_list, daid_list) >>> cm = ibs.query_chips(qaid_list, daid_list, use_cache=False, qreq_=qreq_)[0] >>> ut.quit_if_noshow() >>> cm.ishow_analysis(qreq_) >>> ut.show_if_requested()
Example
>>> # SLOW_DOCTEST >>> # xdoctest: +SKIP >>> import wbia >>> from wbia.control.IBEISControl import * # NOQA >>> qaid_list = [1] >>> daid_list = [1, 2, 3, 4, 5] >>> ibs = wbia.opendb_test(db='testdb1') >>> cfgdict = {'pipeline_root':'BC_DTW'} >>> qreq_ = ibs.new_query_request(qaid_list, daid_list, cfgdict=cfgdict, verbose=True) >>> cm = ibs.query_chips(qreq_=qreq_)[0] >>> ut.quit_if_noshow() >>> cm.ishow_analysis(qreq_) >>> ut.show_if_requested()
-
wbia.web.apis_query.
query_chips_dict
(ibs, *args, **kwargs)[source]¶ Runs query_chips, but returns a json compatible dictionary
- RESTful:
- Method: GET URL: /api/query/chip/dict/
-
wbia.web.apis_query.
query_chips_graph
(ibs, qaid_list, daid_list, user_feedback=None, query_config_dict={}, echo_query_params=True, cache_images=True, n=20, view_orientation='horizontal', return_summary=True, **kwargs)[source]¶
-
wbia.web.apis_query.
query_chips_graph_complete
(ibs, aid_list, query_config_dict={}, k=5, **kwargs)[source]¶
-
wbia.web.apis_query.
query_chips_graph_match_thumb
(extern_reference, query_annot_uuid, database_annot_uuid, version)[source]¶
-
wbia.web.apis_query.
query_chips_graph_v2
(ibs, annot_uuid_list=None, query_config_dict={}, review_callback_url=None, review_callback_method='POST', finished_callback_url=None, finished_callback_method='POST', creation_imageset_rowid_list=None, backend='graph_algorithm', **kwargs)[source]¶ - CommandLine:
python -m wbia.web.apis_query –test-query_chips_graph_v2:0
python -m wbia reset_mtest_graph
python -m wbia –db PZ_MTEST –web –browser –url=/review/identification/hardcase/ python -m wbia –db PZ_MTEST –web –browser –url=/review/identification/graph/
Example
>>> # xdoctest: +REQUIRES(--web-tests) >>> from wbia.web.apis_query import * >>> import wbia >>> # Open local instance >>> ibs = wbia.opendb('PZ_MTEST') >>> uuid_list = ibs.annots().uuids[0:10] >>> data = dict(annot_uuid_list=uuid_list) >>> # Start up the web instance >>> with wbia.opendb_with_web(db='PZ_MTEST') as (ibs, client): ... resp = client.post('/api/query/graph/v2/', data=data) >>> resp.json {'status': {'success': False, 'code': 608, 'message': 'Invalid image and/or annotation UUIDs (0, 1)', 'cache': -1}, 'response': {'invalid_image_uuid_list': [], 'invalid_annot_uuid_list': [[0, '...']]}}
Example
>>> # DEBUG_SCRIPT >>> from wbia.web.apis_query import * >>> # Hack a flask context >>> current_app = ut.DynStruct() >>> current_app.GRAPH_CLIENT_DICT = {} >>> old = query_chips_graph_v2.__globals__.get('current_app', None) >>> query_chips_graph_v2.__globals__['current_app'] = current_app >>> import wbia >>> ibs = wbia.opendb('PZ_MTEST') >>> #ut.exec_funckw(query_chips_graph_v2, globals()) >>> # Run function in main process >>> query_chips_graph_v2(ibs) >>> # Reset context >>> query_chips_graph_v2.__globals__['current_app'] = old
-
wbia.web.apis_query.
query_chips_simple_dict
(ibs, *args, **kwargs)[source]¶ Runs query_chips, but returns a json compatible dictionary
Parameters: as query_chips (same) – - RESTful:
- Method: GET URL: /api/query/chip/dict/simple/
- SeeAlso:
- query_chips
- CommandLine:
python -m wbia.web.apis_query –test-query_chips_simple_dict:0 python -m wbia.web.apis_query –test-query_chips_simple_dict:1
python -m wbia.web.apis_query –test-query_chips_simple_dict:0 –humpbacks
Example
>>> # xdoctest: +REQUIRES(--web-tests) >>> from wbia.control.IBEISControl import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> #qaid = ibs.get_valid_aids()[0:3] >>> qaids = ibs.get_valid_aids() >>> daids = ibs.get_valid_aids() >>> dict_list = ibs.query_chips_simple_dict(qaids, daids) >>> qgids = ibs.get_annot_image_rowids(qaids) >>> qnids = ibs.get_annot_name_rowids(qaids) >>> for dict_, qgid, qnid in list(zip(dict_list, qgids, qnids)): >>> dict_['qgid'] = qgid >>> dict_['qnid'] = qnid >>> dict_['dgid_list'] = ibs.get_annot_image_rowids(dict_['daid_list']) >>> dict_['dnid_list'] = ibs.get_annot_name_rowids(dict_['daid_list']) >>> dict_['dgname_list'] = ibs.get_image_gnames(dict_['dgid_list']) >>> dict_['qgname'] = ibs.get_image_gnames(dict_['qgid']) >>> result = ut.repr2(dict_list, nl=2, precision=2, hack_liststr=True) >>> result = result.replace('u\'', '"').replace('\'', '"') >>> print(result)
Example
>>> # xdoctest: +SKIP >>> # FIXME failing-test (04-Aug-2020) This test hangs when running together with the test above >>> from wbia.control.IBEISControl import * # NOQA >>> import wbia >>> # Start up the web instance >>> with wbia.opendb_bg_web(db='testdb1', managed=True) as web_ibs: ... cmdict_list = web_ibs.send_wbia_request('/api/query/chip/dict/simple/', type_='get', qaid_list=[1], daid_list=[1, 2, 3]) >>> print(cmdict_list) >>> assert 'score_list' in cmdict_list[0]
-
wbia.web.apis_query.
query_chips_test
(ibs, aid=None, limited=False, census_annotations=True, **kwargs)[source]¶ - CommandLine:
- python -m wbia.web.apis_query query_chips_test
Example
>>> # SLOW_DOCTEST >>> # xdoctest: +SKIP >>> from wbia.control.IBEISControl import * # NOQA >>> import wbia >>> qreq_ = wbia.testdata_qreq_(defaultdb='testdb1') >>> ibs = qreq_.ibs >>> result_dict = ibs.query_chips_test() >>> print(result_dict)
-
wbia.web.apis_query.
review_graph_match_config_v2
(ibs, graph_uuid, aid1=None, aid2=None, view_orientation='vertical', view_version=1)[source]¶
-
wbia.web.apis_query.
review_graph_match_html
(ibs, review_pair, cm_dict, query_config_dict, _internal_state, callback_url, callback_method='POST', view_orientation='vertical', include_jquery=False)[source]¶ Parameters: - ibs (wbia.IBEISController) – image analysis api
- review_pair (dict) – pair of annot uuids
- cm_dict (dict) –
- query_config_dict (dict) –
- _internal_state –
- callback_url (str) –
- callback_method (unicode) – (default = u’POST’)
- view_orientation (unicode) – (default = u’vertical’)
- include_jquery (bool) – (default = False)
- CommandLine:
python -m wbia.web.apis_query review_graph_match_html –show
wbia –web python -m wbia.web.apis_query review_graph_match_html –show –domain=localhost
Example
>>> # xdoctest: +REQUIRES(--web-tests) >>> # xdoctest: +REQUIRES(--job-engine-tests) >>> # DISABLE_DOCTEST >>> # Disabled because this test uses opendb_bg_web, which hangs the test runner and leaves zombie processes >>> from wbia.web.apis_query import * # NOQA >>> import wbia >>> web_ibs = wbia.opendb_bg_web('testdb1') # , domain='http://52.33.105.88') >>> aids = web_ibs.send_wbia_request('/api/annot/', 'get')[0:2] >>> uuid_list = web_ibs.send_wbia_request('/api/annot/uuid/', type_='get', aid_list=aids) >>> quuid_list = uuid_list[0:1] >>> duuid_list = uuid_list >>> query_config_dict = { >>> # 'pipeline_root' : 'BC_DTW' >>> } >>> data = dict( >>> query_annot_uuid_list=quuid_list, database_annot_uuid_list=duuid_list, >>> query_config_dict=query_config_dict, >>> ) >>> jobid = web_ibs.send_wbia_request('/api/engine/query/graph/', **data) >>> print('jobid = %r' % (jobid,)) >>> status_response = web_ibs.wait_for_results(jobid) >>> result_response = web_ibs.read_engine_results(jobid) >>> inference_result = result_response['json_result'] >>> print('inference_result = %r' % (inference_result,)) >>> auuid2_cm = inference_result['cm_dict'] >>> quuid = quuid_list[0] >>> class_dict = auuid2_cm[str(quuid)] >>> # Get information in frontend >>> #ibs = wbia.opendb('testdb1') >>> #cm = match_obj = wbia.ChipMatch.from_dict(class_dict, ibs=ibs) >>> #match_obj.print_rawinfostr() >>> # Make the dictionary a bit more managable >>> #match_obj.compress_top_feature_matches(num=2) >>> #class_dict = match_obj.to_dict(ibs=ibs) >>> cm_dict = class_dict >>> # Package for review >>> review_pair = {'annot_uuid_1': quuid, 'annot_uuid_2': duuid_list[1]} >>> callback_method = u'POST' >>> view_orientation = u'vertical' >>> include_jquery = False >>> kw = dict( >>> review_pair=review_pair, >>> cm_dict=cm_dict, >>> query_config_dict=query_config_dict, >>> _internal_state=None, >>> callback_url = None, >>> ) >>> html_str = web_ibs.send_wbia_request('/api/review/query/graph/', type_='get', **kw) >>> web_ibs.terminate2() >>> ut.quit_if_noshow() >>> import wbia.plottool as pt >>> ut.render_html(html_str) >>> ut.show_if_requested()
Example
>>> # DISABLE_DOCTEST >>> # xdoctest: +REQUIRES(--job-engine-tests) >>> # This starts off using web to get information, but finishes the rest in python >>> from wbia.web.apis_query import * # NOQA >>> import wbia >>> ut.exec_funckw(review_graph_match_html, globals()) >>> web_ibs = wbia.opendb_bg_web('testdb1') # , domain='http://52.33.105.88') >>> aids = web_ibs.send_wbia_request('/api/annot/', 'get')[0:2] >>> uuid_list = web_ibs.send_wbia_request('/api/annot/uuid/', type_='get', aid_list=aids) >>> quuid_list = uuid_list[0:1] >>> duuid_list = uuid_list >>> query_config_dict = { >>> # 'pipeline_root' : 'BC_DTW' >>> } >>> data = dict( >>> query_annot_uuid_list=quuid_list, database_annot_uuid_list=duuid_list, >>> query_config_dict=query_config_dict, >>> ) >>> jobid = web_ibs.send_wbia_request('/api/engine/query/graph/', **data) >>> status_response = web_ibs.wait_for_results(jobid) >>> result_response = web_ibs.read_engine_results(jobid) >>> web_ibs.terminate2() >>> # NOW WORK IN THE FRONTEND >>> inference_result = result_response['json_result'] >>> auuid2_cm = inference_result['cm_dict'] >>> quuid = quuid_list[0] >>> class_dict = auuid2_cm[str(quuid)] >>> # Get information in frontend >>> ibs = wbia.opendb('testdb1') >>> cm = wbia.ChipMatch.from_dict(class_dict, ibs=ibs) >>> cm.print_rawinfostr() >>> # Make the dictionary a bit more managable >>> cm.compress_top_feature_matches(num=1) >>> cm.print_rawinfostr() >>> class_dict = cm.to_dict(ibs=ibs) >>> cm_dict = class_dict >>> # Package for review ( CANT CALL DIRECTLY BECAUSE OF OUT OF CONTEXT ) >>> review_pair = {'annot_uuid_1': quuid, 'annot_uuid_2': duuid_list[1]} >>> x = review_graph_match_html(ibs, review_pair, cm_dict, >>> query_config_dict, _internal_state=None, >>> callback_url=None) >>> ut.quit_if_noshow() >>> import wbia.plottool as pt >>> ut.render_html(html_str) >>> ut.show_if_requested()
wbia.web.apis_sync module¶
Dependencies: flask, tornado
- SeeAlso:
- routes.review_identification
wbia.web.app module¶
Dependencies: flask, tornado
-
class
wbia.web.app.
TimedWSGIContainer
(wsgi_application: WSGIAppType)[source]¶ Bases:
tornado.wsgi.WSGIContainer
-
wbia.web.app.
start_from_wbia
(ibs, port=None, browser=None, precache=None, url_suffix=None, start_job_queue=None, start_web_loop=True)[source]¶ Parse command line options and start the server.
- CommandLine:
- python -m wbia –db PZ_MTEST –web python -m wbia –db PZ_MTEST –web –browser
-
wbia.web.app.
start_tornado
(ibs, port=None, browser=None, url_suffix=None, start_web_loop=True, fallback=True)[source]¶ Initialize the web server
-
wbia.web.app.
start_web_annot_groupreview
(ibs, aid_list)[source]¶ Parameters: - ibs (IBEISController) – wbia controller object
- aid_list (list) – list of annotation rowids
- CommandLine:
- python -m wbia.tag_funcs –exec-start_web_annot_groupreview –db PZ_Master1 python -m wbia.tag_funcs –exec-start_web_annot_groupreview –db GZ_Master1 python -m wbia.tag_funcs –exec-start_web_annot_groupreview –db GIRM_Master1
Example
>>> # SCRIPT >>> from wbia.tag_funcs import * # NOQA >>> import wbia >>> #ibs = wbia.opendb(defaultdb='PZ_Master1') >>> ibs = wbia.opendb(defaultdb='GZ_Master1') >>> #aid_list = ibs.get_valid_aids() >>> # ----- >>> any_tags = ut.get_argval('--tags', type_=list, default=['Viewpoint']) >>> min_num = ut.get_argval('--min_num', type_=int, default=1) >>> prop = any_tags[0] >>> filtered_annotmatch_rowids = filter_annotmatch_by_tags(ibs, None, any_tags=any_tags, min_num=min_num) >>> aid1_list = (ibs.get_annotmatch_aid1(filtered_annotmatch_rowids)) >>> aid2_list = (ibs.get_annotmatch_aid2(filtered_annotmatch_rowids)) >>> aid_list = list(set(ut.flatten([aid2_list, aid1_list]))) >>> result = start_web_annot_groupreview(ibs, aid_list) >>> print(result)
wbia.web.appfuncs module¶
Bases:
object
-
wbia.web.appfuncs.
embed_image_html
(imgBGR, target_width=1200.0, target_height=800.0)[source]¶ Creates an image embedded in HTML base64 format.
-
wbia.web.appfuncs.
get_review_annot_args
(is_reviewed_func, speed_hack=False)[source]¶ Helper to return aids in an imageset or a group review
-
wbia.web.appfuncs.
get_review_image_args
(is_reviewed_func)[source]¶ Helper to return gids in an imageset or a group review
-
wbia.web.appfuncs.
imageset_annot_canonical
(ibs, aid_list, canonical_part_type='__CANONICAL__')[source]¶
-
wbia.web.appfuncs.
imageset_image_processed
(ibs, gid_list, is_staged=False, reviews_required=3)[source]¶
-
wbia.web.appfuncs.
imageset_part_contour_processed
(ibs, part_rowid_list, reviewed_flag_progress=True)[source]¶
wbia.web.graph_server module¶
-
class
wbia.web.graph_server.
Actor
[source]¶ Bases:
object
-
wbia.web.graph_server.
GRAPH_ACTOR_CLASS
¶ alias of
wbia.web.graph_server.ThreadActor
-
class
wbia.web.graph_server.
GraphActor
(*args, **kwargs)[source]¶
-
class
wbia.web.graph_server.
GraphAlgorithmActor
(*args, **kwargs)[source]¶ Bases:
wbia.web.graph_server.GraphActor
- CommandLine:
- python -m wbia.web.graph_server GraphAlgorithmActor
- Doctest:
>>> from wbia.web.graph_server import * >>> actor = GraphAlgorithmActor() >>> payload = testdata_start_payload() >>> # Start the process >>> start_resp = actor.handle(payload) >>> print('start_resp = {!r}'.format(start_resp)) >>> # Respond with a user decision >>> user_request = actor.handle({'action': 'resume'}) >>> # Wait for a response and the GraphAlgorithmActor in another proc >>> edge, priority, edge_data = user_request[0] >>> user_resp_payload = _testdata_feedback_payload(edge, 'match') >>> content = actor.handle(user_resp_payload) >>> actor.infr.dump_logs()
- Doctest:
>>> # xdoctest: +REQUIRES(module:wbia_cnn, --slow) >>> from wbia.web.graph_server import * >>> import wbia >>> actor = GraphAlgorithmActor() >>> config = { >>> 'manual.n_peek' : 1, >>> 'manual.autosave' : False, >>> 'ranking.enabled' : False, >>> 'autoreview.enabled' : False, >>> 'redun.enabled' : False, >>> 'redun.enabled' : False, >>> 'queue.conf.thresh' : 'absolutely_sure', >>> 'algo.hardcase' : True, >>> } >>> # Start the process >>> dbdir = wbia.sysres.db_to_dbdir('PZ_MTEST') >>> payload = {'action': 'start', 'dbdir': dbdir, 'aids': 'all', >>> 'config': config, 'init': 'annotmatch'} >>> start_resp = actor.handle(payload) >>> print('start_resp = {!r}'.format(start_resp)) >>> # Respond with a user decision >>> user_request = actor.handle({'action': 'resume'}) >>> print('user_request = {!r}'.format(user_request)) >>> # Wait for a response and the GraphAlgorithmActor in another proc >>> edge, priority, edge_data = user_request[0] >>> user_resp_payload = _testdata_feedback_payload(edge, 'match') >>> content = actor.handle(user_resp_payload) >>> actor.infr.dump_logs() >>> actor.infr.status()
-
class
wbia.web.graph_server.
GraphAlgorithmClient
(aids, actor_config={}, imagesets=None, graph_uuid=None, callbacks={}, autoinit=False)[source]¶ Bases:
wbia.web.graph_server.GraphClient
- CommandLine:
- python -m wbia.web.graph_server GraphAlgorithmClient
Example
>>> # ENABLE_DOCTEST >>> from wbia.web.graph_server import * >>> import wbia >>> client = GraphAlgorithmClient(aids='all', autoinit=True) >>> # Start the GraphAlgorithmActor in another proc >>> payload = testdata_start_payload() >>> client.post(payload).result() >>> future = client.post({'action': 'resume'}) >>> future.add_done_callback(_test_foo) >>> user_request = future.result() >>> # Wait for a response and the GraphAlgorithmActor in another proc >>> edge, priority, edge_data = user_request[0] >>> user_resp_payload = _testdata_feedback_payload(edge, 'match') >>> future = client.post(user_resp_payload) >>> future.result() >>> # Debug by getting the actor over a mp.Pipe >>> future = client.post({'action': 'debug'}) >>> actor = future.result() >>> actor.infr.dump_logs() >>> #print(client.post({'action': 'logs'}).result())
# Ignore: # >>> from wbia.web.graph_server import * # >>> import wbia # >>> client = GraphAlgorithmClient(autoinit=True) # >>> # Start the GraphAlgorithmActor in another proc # >>> client.post(testdata_start_payload(list(range(1, 10)))).result() # >>> # # >>> future = client.post({‘action’: ‘resume’}) # >>> user_request = future.result() # >>> # The infr algorithm needs a review # >>> edge, priority, edge_data = user_request[0] # >>> # # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘resume’}) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘resume’}) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘wait’, ‘num’: float(30)}) # >>> client.post({‘action’: ‘resume’}) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘resume’}) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘resume’}) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘resume’}) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘resume’}) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘resume’}) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘resume’}) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘resume’}) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘resume’}) # >>> client.post(_testdata_feedback_payload(edge, ‘match’)) # >>> client.post({‘action’: ‘resume’})
-
actor_cls
¶ alias of
GraphAlgorithmActor
-
rrr
(verbose=True, reload_module=True)¶ special class reloading function This function is often injected as rrr of classes
-
class
wbia.web.graph_server.
GraphClient
(aids, actor_config={}, imagesets=None, graph_uuid=None, callbacks={}, autoinit=False)[source]¶ Bases:
object
-
actor_cls
¶ alias of
GraphActor
-
rrr
(verbose=True, reload_module=True)¶ special class reloading function This function is often injected as rrr of classes
-
-
class
wbia.web.graph_server.
ProcessActor
[source]¶ Bases:
wbia.web.graph_server.Actor
-
class
wbia.web.graph_server.
ProcessActorExecutor
(actor_class, *args, **kwargs)[source]¶ Bases:
concurrent.futures.process.ProcessPoolExecutor
-
class
wbia.web.graph_server.
ThreadActor
[source]¶ Bases:
wbia.web.graph_server.Actor
wbia.web.job_engine module¶
Accepts and handles requests for tasks.
Each of the following runs in its own Thread/Process.
BASICALLY DO A CLIENT/SERVER TO SPAWN PROCESSES AND THEN A PUBLISH SUBSCRIBE TO RETURN DATA
- Accepter:
- Receives tasks and requests Delegates tasks and responds to requests Tasks are delgated to an engine
- Engine:
- the engine accepts requests. the engine immediately responds WHERE it will be ready. the engine sends a message to the collector saying that something will be ready. the engine then executes a task. The engine is given direct access to the data.
- Collector:
- The collector accepts requests The collector can respond: * <ResultContent> * Results are ready. * Results are not ready. * Unknown jobid. * Error computing results. * Progress percent.
References
Simple task farm, with routed replies in pyzmq http://stackoverflow.com/questions/7809200/implementing-task-farm-messaging-pattern-with-zeromq https://gist.github.com/minrk/1358832
Notes
We are essentially goint to be spawning two processes. We can test these simultaniously using
python -m wbia.web.job_engine job_engine_tester
We can test these separately by first starting the background server python -m wbia.web.job_engine job_engine_tester –bg
Alternative: python -m wbia.web.job_engine job_engine_tester –bg –no-engine python -m wbia.web.job_engine job_engine_tester –bg –only-engine –fg-engine
And then running the forground process python -m wbia.web.job_engine job_engine_tester –fg
-
class
wbia.web.job_engine.
JobInterface
(id_, port_dict, ibs=None)[source]¶ Bases:
object
-
initialize_client_thread
()[source]¶ Creates a ZMQ object in this thread. This talks to background processes.
-
queue_job
(action, callback_url=None, callback_method=None, callback_detailed=False, lane='slow', jobid=None, args=None, kwargs=None)[source]¶ - IBEIS:
- This is just a function that lives in the main thread and ships off a job.
- FIXME: I do not like having callback_url and callback_method specified
- like this with args and kwargs. If these must be there then they should be specified first, or THE PREFERED OPTION IS args and kwargs should not be specified without the * syntax
The client - sends messages, and receives replies after they have been processed by the
-
-
wbia.web.job_engine.
collector_loop
(port_dict, dbdir, containerized)[source]¶ Service that stores completed algorithm results
-
wbia.web.job_engine.
engine_loop
(id_, port_dict, dbdir, containerized, lane)[source]¶ - IBEIS:
This will be part of a worker process with its own IBEISController instance.
Needs to send where the results will go and then publish the results there.
The engine_loop - receives messages, performs some action, and sends a reply, preserving the leading two message parts as routing identities
-
wbia.web.job_engine.
get_job_id_list
(ibs)[source]¶ Web call that returns the list of job ids
- CommandLine:
# Run Everything together python -m wbia.web.job_engine –exec-get_job_status
# Start job queue in its own process python -m wbia.web.job_engine job_engine_tester –bg # Start web server in its own process ./main.py –web –fg pass # Run foreground process python -m wbia.web.job_engine –exec-get_job_status:0 –fg
Example
>>> # xdoctest: +REQUIRES(--web-tests) >>> # xdoctest: +REQUIRES(--job-engine-tests) >>> from wbia.web.job_engine import * # NOQA >>> import wbia >>> with wbia.opendb_bg_web('testdb1', managed=True) as web_ibs: # , domain='http://52.33.105.88') ... # Test get status of a job id that does not exist ... response = web_ibs.send_wbia_request('/api/engine/job/', jobid='badjob')
-
wbia.web.job_engine.
get_job_metadata
(ibs, jobid)[source]¶ Web call that returns the metadata of a job
- CommandLine:
# Run Everything together python -m wbia.web.job_engine –exec-get_job_metadata
# Start job queue in its own process python -m wbia.web.job_engine job_engine_tester –bg # Start web server in its own process ./main.py –web –fg pass # Run foreground process python -m wbia.web.job_engine –exec-get_job_metadata:0 –fg
Example
>>> # xdoctest: +REQUIRES(--web-tests) >>> # xdoctest: +REQUIRES(--slow) >>> # xdoctest: +REQUIRES(--job-engine-tests) >>> # xdoctest: +REQUIRES(--web-tests) >>> from wbia.web.job_engine import * # NOQA >>> import wbia >>> with wbia.opendb_bg_web('testdb1', managed=True) as web_ibs: # , domain='http://52.33.105.88') ... # Test get metadata of a job id that does not exist ... response = web_ibs.send_wbia_request('/api/engine/job/metadata/', jobid='badjob')
-
wbia.web.job_engine.
get_job_status
(ibs, jobid=None)[source]¶ Web call that returns the status of a job
- Returns one of:
- received - job has been received, but not ingested yet accepted - job has been accepted (validated) queued - job has been transferred to the engine queue working - job is being worked on by the engine publishing - job is done on the engine, pushing results to collector completed | exception - job is complete or has an error
- CommandLine:
# Run Everything together python -m wbia.web.job_engine –exec-get_job_status
# Start job queue in its own process python -m wbia.web.job_engine job_engine_tester –bg # Start web server in its own process ./main.py –web –fg pass # Run foreground process python -m wbia.web.job_engine –exec-get_job_status:0 –fg
Example
>>> # xdoctest: +REQUIRES(--web-tests) >>> # xdoctest: +REQUIRES(--job-engine-tests) >>> from wbia.web.job_engine import * # NOQA >>> import wbia >>> with wbia.opendb_bg_web('testdb1', managed=True) as web_ibs: # , domain='http://52.33.105.88') ... # Test get status of a job id that does not exist ... response = web_ibs.send_wbia_request('/api/engine/job/status/', jobid='badjob')
-
wbia.web.job_engine.
initialize_job_manager
(ibs)[source]¶ Starts a background zmq job engine. Initializes a zmq object in this thread that can talk to the background processes.
Run from the webserver
- CommandLine:
- python -m wbia.web.job_engine –exec-initialize_job_manager:0
Example
>>> # DISABLE_DOCTEST >>> # xdoctest: +REQUIRES(--job-engine-tests) >>> from wbia.web.job_engine import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> from wbia.web import apis_engine >>> from wbia.web import job_engine >>> ibs.load_plugin_module(job_engine) >>> ibs.load_plugin_module(apis_engine) >>> ibs.initialize_job_manager() >>> print('Initializqation success. Now closing') >>> ibs.close_job_manager() >>> print('Closing success.')
-
wbia.web.job_engine.
initialize_process_record
(record_filepath, shelve_input_filepath, shelve_output_filepath, shelve_path, shelve_archive_path, jobiface_id)[source]¶
-
wbia.web.job_engine.
job_engine_tester
()[source]¶ - CommandLine:
python -m wbia.web.job_engine –exec-job_engine_tester python -b -m wbia.web.job_engine –exec-job_engine_tester
python -m wbia.web.job_engine job_engine_tester python -m wbia.web.job_engine job_engine_tester –bg python -m wbia.web.job_engine job_engine_tester –fg
Example
>>> # SCRIPT >>> from wbia.web.job_engine import * # NOQA >>> job_engine_tester()
-
wbia.web.job_engine.
on_collect_request
(ibs, collect_request, collector_data, shelve_path, containerized=False)[source]¶ Run whenever the collector recieves a message
-
wbia.web.job_engine.
on_engine_request
(ibs, jobid, action, args, kwargs, attempts=3, retry_delay_min=1, retry_delay_max=60)[source]¶ Run whenever the engine recieves a message
wbia.web.prometheus module¶
wbia.web.routes module¶
Dependencies: flask, tornado
-
wbia.web.routes.
commit_current_query_object_names
(query_object, ibs)[source]¶ Parameters: - query_object (wbia.AnnotInference) –
- ibs (wbia.IBEISController) – image analysis api
-
wbia.web.routes.
image_view_api
(gid=None, thumbnail=False, fresh=False, **kwargs)[source]¶ Returns the base64 encoded image of image <gid>
- RESTful:
- Method: GET URL: /image/view/<gid>/
-
wbia.web.routes.
load_identification_query_object
(autoinit=False, global_feedback_limit=50, **kwargs)[source]¶
-
wbia.web.routes.
precompute_current_review_match_images
(ibs, query_object, global_feedback_limit=50, view_orientation='vertical')[source]¶
-
wbia.web.routes.
review_annotation
(**kwargs)[source]¶ - CommandLine:
- python -m wbia.web.app –exec-review_annotation –db PZ_Master1
Example
>>> # SCRIPT >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='PZ_Master1') >>> aid_list_ = ibs.find_unlabeled_name_members(suspect_yaws=True) >>> aid_list = ibs.filter_aids_to_quality(aid_list_, 'good', unknown_ok=False) >>> ibs.start_web_annot_groupreview(aid_list)
-
wbia.web.routes.
review_annotation_canonical
(imgsetid=None, samples=200, species=None, version=1, **kwargs)[source]¶
-
wbia.web.routes.
review_detection
(gid=None, only_aid=None, refer_aid=None, imgsetid=None, previous=None, previous_only_aid=None, staged_super=False, progress=None, **kwargs)[source]¶
-
wbia.web.routes.
review_detection_canonical
(aid=None, imgsetid=None, previous=None, previous_only_aid=None, **kwargs)[source]¶
-
wbia.web.routes.
review_identification
(aid1=None, aid2=None, use_engine=False, global_feedback_limit=50, **kwargs)[source]¶ - CommandLine:
- python -m wbia.web.routes review_identification –db PZ_Master1 python -m wbia.web.routes review_identification –db PZ_MTEST python -m wbia.web.routes review_identification –db testdb1 –show
Example
>>> # SCRIPT >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> with wbia.opendb_with_web('testdb1') as (ibs, client): ... resp = client.get('/review/identification/lnbnn/') >>> ut.quit_if_noshow() >>> import wbia.plottool as pt >>> ut.render_html(resp.data.decode('utf8')) >>> ut.show_if_requested()
-
wbia.web.routes.
review_identification_graph
(graph_uuid=None, aid1=None, aid2=None, annot_uuid_list=None, hardcase=None, view_orientation='vertical', view_version=1, hogwild=False, hogwild_species=None, creation_imageset_rowid_list=None, kaia=False, census=False, backend='graph_algorithm', **kwargs)[source]¶ - CommandLine:
python -m wbia.web.routes review_identification_graph –db PZ_Master1 python -m wbia.web.routes review_identification_graph –db PZ_MTEST python -m wbia.web.routes review_identification_graph –db testdb1 –show
python -m wbia –db PZ_MTEST –web –browser –url=/review/identification/graph/ –noengine
Example
>>> # SCRIPT >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> with wbia.opendb_with_web('testdb1') as (ibs, client): ... resp = client.get('/review/identification/graph/') >>> ut.quit_if_noshow() >>> import wbia.plottool as pt >>> ut.render_html(resp.data.decode('utf8')) >>> ut.show_if_requested()
-
wbia.web.routes.
review_identification_graph_refer
(imgsetid, species=None, tier=1, year=2019, option=None, backend='graph_algorithm', **kwargs)[source]¶
-
wbia.web.routes.
review_identification_hardcase
(*args, **kwargs)[source]¶ - CommandLine:
python -m wbia –db PZ_MTEST –web –browser –url=/review/identification/hardcase/ python -m wbia –db PZ_MTEST –web –browser –url=/review/identification/graph/
>>> # SCRIPT >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> with wbia.opendb_with_web('PZ_Master1') as (ibs, client): ... resp = client.get('/review/identification/hardcase/')
- Ignore:
import wbia ibs, aids = wbia.testdata_aids(‘PZ_Master1’, a=’:species=zebra_plains’) logger.info(len(aids)) infr = wbia.AnnotInference(ibs, aids=aids, autoinit=’staging’) infr.load_published() logger.info(ut.repr4(infr.status())) infr.qt_review_loop()
verifiers = infr.learn_evaluation_verifiers()
verif = verifiers[‘match_state’] edges = list(infr.edges()) real = list(infr.edge_decision_from(edges)) hardness = 1 - verif.easiness(edges, real)
-
wbia.web.routes.
review_part_types
(part_rowid=None, imgsetid=None, previous=None, hotkeys=8, refresh=False, previous_part_types=None, **kwargs)[source]¶
-
wbia.web.routes.
review_quality
(**kwargs)[source]¶ - PZ Needs Tags:
- 17242 14468 14427 15946 14771 14084 4102 6074 3409
GZ Needs Tags; 1302
- CommandLine:
- python -m wbia.web.app –exec-review_quality –db PZ_Master1 python -m wbia.web.app –exec-review_quality –db GZ_Master1 python -m wbia.web.app –exec-review_quality –db GIRM_Master1
Example
>>> # SCRIPT >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='testdb1') >>> aid_list_ = ibs.find_unlabeled_name_members(qual=True) >>> valid_views = ['primary', 'primary1', 'primary-1'] >>> aid_list = ibs.filter_aids_to_viewpoint(aid_list_, valid_views, unknown_ok=False) >>> ibs.start_web_annot_groupreview(aid_list)
-
wbia.web.routes.
review_species
(hotkeys=8, refresh=False, previous_species_rowids=None, **kwargs)[source]¶
-
wbia.web.routes.
review_viewpoint
(**kwargs)[source]¶ - CommandLine:
- python -m wbia.web.app –exec-review_viewpoint –db PZ_Master1
Example
>>> # SCRIPT >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='PZ_Master1') >>> aid_list_ = ibs.find_unlabeled_name_members(suspect_yaws=True) >>> aid_list = ibs.filter_aids_to_quality(aid_list_, 'good', unknown_ok=False) >>> ibs.start_web_annot_groupreview(aid_list)
-
wbia.web.routes.
review_viewpoint2
(**kwargs)[source]¶ - CommandLine:
- python -m wbia.web.app –exec-review_viewpoint –db PZ_Master1
Example
>>> # SCRIPT >>> from wbia.other.ibsfuncs import * # NOQA >>> import wbia >>> ibs = wbia.opendb(defaultdb='PZ_Master1') >>> aid_list_ = ibs.find_unlabeled_name_members(suspect_yaws=True) >>> aid_list = ibs.filter_aids_to_quality(aid_list_, 'good', unknown_ok=False) >>> ibs.start_web_annot_groupreview(aid_list)
-
wbia.web.routes.
sightings
(html_encode=True, complete=True, include_images=False, kaia=False, **kwargs)[source]¶
wbia.web.routes_csv module¶
Dependencies: flask, tornado
wbia.web.routes_demo module¶
Dependencies: flask, tornado
wbia.web.routes_experiments module¶
Dependencies: flask, tornado
-
wbia.web.routes_experiments.
experiments_interest
(dbtag1='demo-jasonp', dbtag2='demo-chuck', **kwargs)[source]¶
wbia.web.routes_submit module¶
Dependencies: flask, tornado
-
wbia.web.routes_submit.
group_review_submit
(**kwargs)[source]¶ - CommandLine:
- python -m wbia.web.app –exec-group_review_submit
Example
>>> # UNSTABLE_DOCTEST >>> from wbia.web.app import * # NOQA >>> import wbia >>> import wbia.web >>> ibs = wbia.opendb('testdb1') >>> aid_list = ibs.get_valid_aids()[::2] >>> ibs.start_web_annot_groupreview(aid_list)
wbia.web.test_api module¶
This is a proof of concept for connecting to an authenticated Qubica Server
-
wbia.web.test_api.
get_api_result
(uri, user_email=None, user_enc_pass=None, **kwargs)[source]¶ Make a GET API request to the server
-
wbia.web.test_api.
post_api_result
(uri, user_email=None, user_enc_pass=None, **kwargs)[source]¶ Make a GET API request to the server
-
wbia.web.test_api.
run_test_api
()[source]¶ - CommandLine:
- python -m wbia.web.test_api –test-run_test_api
Example
>>> # DISABLE_DOCTEST >>> from wbia.web.test_api import * # NOQA >>> response = run_test_api() >>> print('Server response: %r' % (response, )) >>> result = response (200, u'{"status": {"cache": -1, "message": "", "code": 200, "success": true}, "response": "testdb1"}', <bound method Response.json of <Response [200]>>)