diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..41f18562f89 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "demos/thirdparty/gflags"] + path = demos/thirdparty/gflags + url = https://github.com/gflags/gflags/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 927dd2e5f51..9257885f58f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,7 +13,7 @@ Open Model Zoo also supports models already in the ONNX format. ## Pull Request Requirements -To contribute to OMZ, create a pull request (PR) in this repository using the `develop` branch. +To contribute to OMZ, create a pull request (PR) in this repository using the `master` branch. Pull requests are strictly formalized and are reviewed by the OMZ maintainers for consistence and legal compliance. Each PR contributing a model must contain: @@ -86,10 +86,10 @@ Downloadable files. Each file is described by: * `name` - sets a file name after downloading * `size` - sets a file size -* `sha256` - sets a file hash sum +* `sha384` - sets a file hash sum * `source` - sets a direct link to a file *OR* describes a file access parameters -> **TIP**: You can obtain a hash sum using the `sha256sum ` command on Linux\*. +> **TIP**: You can obtain a hash sum using the `sha384sum ` command on Linux\*. If file is located on Google Drive\*, the `source` section must contain: - `$type: google_drive` @@ -155,7 +155,7 @@ task_type: classification files: - name: tf-densenet121.tar.gz size: 30597420 - sha256: b31ec840358f1d20e1c6364d05ce463cb0bc0480042e663ad54547189501852d + sha384: dcd6d36f6b07e0843ee35b1dce2c587204c8816d6ba25b7e1dbf2dc25fe2b51f49a2b9327579ce07904575f9325be8b6 source: $type: google_drive id: 0B_fUSpodN0t0eW1sVk1aeWREaDA diff --git a/ci/documentation_updater/documentation_updater.py b/ci/documentation_updater/documentation_updater.py index b666919c9e7..472c300ff24 100755 --- a/ci/documentation_updater/documentation_updater.py +++ b/ci/documentation_updater/documentation_updater.py @@ -113,7 +113,7 @@ def get_models_from_configs(directory): model_configs = directory.glob('**/model.yml') for model in model_configs: with model.open("r", encoding="utf-8") as file: - models[model.parent.name] = (model, yaml.load(file)) + models[model.parent.name] = (model, yaml.safe_load(file)) if not models[model.parent.name][1]: logging.error("File {} is empty. It will be ignored.".format(model)) del models[model.parent.name] diff --git a/ci/prepare-openvino-content.py b/ci/prepare-openvino-content.py index 9ddeeb8bfa3..40aa8866cd6 100755 --- a/ci/prepare-openvino-content.py +++ b/ci/prepare-openvino-content.py @@ -93,7 +93,7 @@ def file_is_in_current_package(path): # copy appropriate files to each component for component_name, component_files in files_per_component.items(): - component_output_dir = args.output_dir / component_name / 'deployment_tools/open_model_zoo' + component_output_dir = args.output_dir / component_name / 'extras/open_model_zoo' component_output_dir.mkdir(parents=True, exist_ok=True) subprocess.run( @@ -109,7 +109,7 @@ def file_is_in_current_package(path): ['git', '-C', str(OMZ_ROOT), 'rev-parse', 'HEAD']) omz_commit = rev_parse_output.decode().rstrip('\n') - version_txt_path = args.output_dir / 'tools/deployment_tools/open_model_zoo/version.txt' + version_txt_path = args.output_dir / 'tools/extras/open_model_zoo/version.txt' with open(version_txt_path, 'w', newline=eol_chars) as version_txt_file: print(omz_commit, file=version_txt_file) @@ -117,10 +117,10 @@ def file_is_in_current_package(path): # create compatibility symlinks compat_symlinks = [ - ('deployment_tools/intel_models', 'open_model_zoo/models/intel'), - ('deployment_tools/open_model_zoo/intel_models', 'models/intel'), - ('deployment_tools/tools/model_downloader', '../open_model_zoo/tools/model_tools'), - ('deployment_tools/inference_engine/demos', '../open_model_zoo/demos'), + ('extras/intel_models', 'open_model_zoo/models/intel'), + ('extras/open_model_zoo/intel_models', 'models/intel'), + ('extras/tools/model_downloader', '../open_model_zoo/tools/model_tools'), + ('extras/inference_engine/demos', '../open_model_zoo/demos'), ] for link_source, link_target in compat_symlinks: diff --git a/ci/requirements-downloader.txt b/ci/requirements-downloader.txt index 1c1a140f5dd..4f446ec32ef 100644 --- a/ci/requirements-downloader.txt +++ b/ci/requirements-downloader.txt @@ -6,6 +6,8 @@ charset-normalizer==2.0.4 # via requests idna==3.2 # via requests +pyrx==0.3.0 + # via -r tools/model_tools/requirements.in pyyaml==5.4.1 # via -r tools/model_tools/requirements.in requests==2.26.0 diff --git a/data/dataset_definitions.yml b/data/dataset_definitions.yml index 350b84370de..3195ccc1f27 100644 --- a/data/dataset_definitions.yml +++ b/data/dataset_definitions.yml @@ -2,7 +2,7 @@ datasets: - name: ms_coco_mask_rcnn annotation_conversion: converter: mscoco_mask_rcnn - annotation_file: instances_val2017.json + annotation_file: annotations/instances_val2017.json has_background: True sort_annotations: True annotation: mscoco_mask_rcnn.pickle @@ -12,7 +12,7 @@ datasets: - name: ms_coco_mask_rcnn_short_80_classes annotation_conversion: converter: mscoco_mask_rcnn - annotation_file: instances_val2017_short.json + annotation_file: annotations/instances_val2017_short.json has_background: True sort_annotations: True annotation: mscoco_mask_rcnn_short_80.pickle @@ -22,7 +22,7 @@ datasets: - name: ms_coco_mask_rcnn_short_80_classes_without_background annotation_conversion: converter: mscoco_mask_rcnn - annotation_file: instances_val2017.json + annotation_file: annotations/instances_val2017.json has_background: False sort_annotations: True annotation: mscoco_mask_rcnn_short_80_without_bkgr.pickle @@ -32,7 +32,7 @@ datasets: - name: ms_coco_mask_rcnn_short_91_classes annotation_conversion: converter: mscoco_mask_rcnn - annotation_file: instances_val2017_short.json + annotation_file: annotations/instances_val2017_short.json has_background: True sort_annotations: True use_full_label_map: True @@ -57,7 +57,7 @@ datasets: - name: ms_coco_detection_91_classes annotation_conversion: converter: mscoco_detection - annotation_file: instances_val2017.json + annotation_file: annotations/instances_val2017.json has_background: True sort_annotations: True use_full_label_map: True @@ -83,7 +83,7 @@ datasets: data_source: val2017 annotation_conversion: converter: mscoco_detection - annotation_file: instances_val2017.json + annotation_file: annotations/instances_val2017.json has_background: False sort_annotations: True use_full_label_map: False @@ -94,7 +94,7 @@ datasets: data_source: val2017 annotation_conversion: converter: mscoco_detection - annotation_file: instances_val2017.json + annotation_file: annotations/instances_val2017.json has_background: True sort_annotations: True use_full_label_map: False @@ -102,10 +102,10 @@ datasets: dataset_meta: mscoco_det_80_bkgr.json - name: ms_coco_detection_90_class_without_background - data_source: MSCOCO/val2017 + data_source: val2017 annotation_conversion: converter: mscoco_detection - annotation_file: MSCOCO/annotations/instances_val2017.json + annotation_file: annotations/instances_val2017.json has_background: False sort_annotations: True use_full_label_map: True @@ -116,7 +116,7 @@ datasets: data_source: val2017 annotation_conversion: converter: mscoco_keypoints - annotation_file: person_keypoints_val2017.json + annotation_file: annotations/person_keypoints_val2017.json sort_key: image_size annotation: mscoco_keypoints.pickle dataset_meta: mscoco_keypoints.json @@ -129,7 +129,7 @@ datasets: data_source: val2017 annotation_conversion: converter: mscoco_keypoints - annotation_file: person_keypoints_val2017.json + annotation_file: annotations/person_keypoints_val2017.json remove_empty_images: True sort_annotations: True sort_key: image_size @@ -144,7 +144,7 @@ datasets: data_source: val2017 annotation_conversion: converter: mscoco_keypoints - annotation_file: person_keypoints_val2017.json + annotation_file: annotations/person_keypoints_val2017.json remove_empty_images: False sort_annotations: True sort_key: image_size @@ -289,6 +289,17 @@ datasets: postprocessing: - type: normalize_landmarks_points + - name: facial_landmarks_98_db + data_source: 98_landmarks + annotation_conversion: + converter: coco_facial_landmarks + annotation_file: 98_landmarks/lms_test.json + preprocessing: + - type: resize + size: 64 + postprocessing: + - type: normalize_landmarks_points + - name: emotions_recognition data_source: VOCdevkit/VOC2012/JPEGImages annotation_conversion: @@ -388,7 +399,7 @@ datasets: data_source: val2017 annotation_conversion: converter: mscoco_detection - annotation_file: person_keypoints_val2017.json + annotation_file: annotations/person_keypoints_val2017.json has_background: True sort_annotations: True use_full_label_map: True @@ -399,7 +410,7 @@ datasets: data_source: val2017 annotation_conversion: converter: mscoco_detection - annotation_file: person_keypoints_val2017.json + annotation_file: annotations/person_keypoints_val2017.json has_background: True sort_annotations: True use_full_label_map: True @@ -946,7 +957,7 @@ datasets: data_source: val2017 annotation_conversion: converter: mscoco_single_keypoints - annotation_file: person_keypoints_val2017.json + annotation_file: annotations/person_keypoints_val2017.json annotation: mscoco_single_keypoints.pickle dataset_meta: mscoco_single_keypoints.json metrics: @@ -1399,3 +1410,11 @@ datasets: data_dir: wavernn_io/rnn input_suffix: in reference_suffix: out + + - name: LIVE_1 + data_source: LIVE_1 + annotation_conversion: + converter: image_processing + data_dir: LIVE_1 + input_suffix: .bmp + target_suffix: .bmp diff --git a/data/datasets.md b/data/datasets.md index 22c58acf1fe..7d520b99b51 100644 --- a/data/datasets.md +++ b/data/datasets.md @@ -56,8 +56,9 @@ To download COCO dataset, you need to follow the steps below: To use this dataset with OMZ tools, make sure `` contains the following: * `val2017` - directory containing the COCO 2017 validation images -* `instances_val2017.json` - annotation file which used for object detection and instance segmentation tasks -* `person_keypoints_val2017.json` - annotation file which used for human pose estimation tasks +* `annotations` - directory containing the COCO 2017 annotation files + * `instances_val2017.json` - annotation file which used for object detection and instance segmentation tasks + * `person_keypoints_val2017.json` - annotation file which used for human pose estimation tasks ### Datasets in dataset_definitions.yml * `ms_coco_mask_rcnn` used for evaluation models trained on COCO dataset for object detection and instance segmentation tasks. Background label + label map with 80 public available object categories are used. Annotations are saved in order of ascending image ID. diff --git a/demos/3d_segmentation_demo/python/README.md b/demos/3d_segmentation_demo/python/README.md index 38e99c7ab8c..adf6c05bb22 100644 --- a/demos/3d_segmentation_demo/python/README.md +++ b/demos/3d_segmentation_demo/python/README.md @@ -6,7 +6,7 @@ This topic demonstrates how to run the 3D Segmentation Demo, which segments 3D i On startup, the demo reads command-line parameters and loads a network and images to the Inference Engine plugin. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt index a8d086e715f..8c574a13ad4 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -73,15 +73,15 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -function(add_samples_to_build) - # check each passed sample subdirectory +function(add_demos_to_build) + # check each passed demo subdirectory foreach(dir ${ARGN}) if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${dir}) # check if a subdirectory contains CMakeLists.txt. In this case we can build it. file(GLOB sub_dirs ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*) foreach(sub_dir ${sub_dirs}) if(EXISTS "${sub_dir}/CMakeLists.txt") - # check if specified sample/demo is found. + # check if specified demo is found. if(BUILD_SAMPLE_NAME) list(FIND BUILD_SAMPLE_NAME ${dir} index) endif() @@ -103,36 +103,42 @@ include(CMakeParseArguments) # SOURCES # [HEADERS
] # [INCLUDE_DIRECTORIES ] +# [OPENCV_VERSION_REQUIRED ] # [DEPENDENCIES ]) macro(add_demo) - set(oneValueArgs NAME) + set(oneValueArgs NAME OPENCV_VERSION_REQUIRED) set(multiValueArgs SOURCES HEADERS DEPENDENCIES INCLUDE_DIRECTORIES) - cmake_parse_arguments(IE_SAMPLE "${options}" "${oneValueArgs}" + cmake_parse_arguments(OMZ_DEMO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if(OMZ_DEMO_OPENCV_VERSION_REQUIRED AND OpenCV_VERSION VERSION_LESS OMZ_DEMO_OPENCV_VERSION_REQUIRED) + message(WARNING "${OMZ_DEMO_NAME} is disabled; required OpenCV version ${OMZ_DEMO_OPENCV_VERSION_REQUIRED}, provided ${OpenCV_VERSION}") + return() + endif() + # Create named folders for the sources within the .vcproj # Empty name lists them directly under the .vcproj - source_group("src" FILES ${IE_SAMPLE_SOURCES}) - if(IE_SAMPLE_HEADERS) - source_group("include" FILES ${IE_SAMPLE_HEADERS}) + source_group("src" FILES ${OMZ_DEMO_SOURCES}) + if(OMZ_DEMO_HEADERS) + source_group("include" FILES ${OMZ_DEMO_HEADERS}) endif() # Create executable file from sources - add_executable(${IE_SAMPLE_NAME} ${IE_SAMPLE_SOURCES} ${IE_SAMPLE_HEADERS}) + add_executable(${OMZ_DEMO_NAME} ${OMZ_DEMO_SOURCES} ${OMZ_DEMO_HEADERS}) if(WIN32) - set_target_properties(${IE_SAMPLE_NAME} PROPERTIES COMPILE_PDB_NAME ${IE_SAMPLE_NAME}) + set_target_properties(${OMZ_DEMO_NAME} PROPERTIES COMPILE_PDB_NAME ${OMZ_DEMO_NAME}) endif() - if(IE_SAMPLE_INCLUDE_DIRECTORIES) - target_include_directories(${IE_SAMPLE_NAME} PRIVATE ${IE_SAMPLE_INCLUDE_DIRECTORIES}) + if(OMZ_DEMO_INCLUDE_DIRECTORIES) + target_include_directories(${OMZ_DEMO_NAME} PRIVATE ${OMZ_DEMO_INCLUDE_DIRECTORIES}) endif() - target_link_libraries(${IE_SAMPLE_NAME} PRIVATE ${OpenCV_LIBRARIES} ${InferenceEngine_LIBRARIES} - ${IE_SAMPLE_DEPENDENCIES} ngraph::ngraph utils gflags) + target_link_libraries(${OMZ_DEMO_NAME} PRIVATE ${OpenCV_LIBRARIES} ${InferenceEngine_LIBRARIES} + ${OMZ_DEMO_DEPENDENCIES} ngraph::ngraph utils gflags) if(UNIX) - target_link_libraries(${IE_SAMPLE_NAME} PRIVATE pthread) + target_link_libraries(${OMZ_DEMO_NAME} PRIVATE pthread) endif() endmacro() @@ -142,13 +148,14 @@ find_package(ngraph REQUIRED) add_subdirectory(thirdparty/gflags) add_subdirectory(common/cpp) +add_subdirectory(common/cpp_gapi) add_subdirectory(multi_channel_common/cpp) # collect all samples subdirectories file(GLOB samples_dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *) # skip building of unnecessary subdirectories list(REMOVE_ITEM samples_dirs common thirdparty multi_channel_common) -add_samples_to_build(${samples_dirs}) +add_demos_to_build(${samples_dirs}) if(ENABLE_PYTHON) find_package(PythonInterp 3.6 REQUIRED) diff --git a/demos/README.md b/demos/README.md index e35bacdcd9d..a4cf86773f3 100644 --- a/demos/README.md +++ b/demos/README.md @@ -19,11 +19,13 @@ The Open Model Zoo includes the following demos: - [Crossroad Camera C++ Demo](./crossroad_camera_demo/cpp/README.md) - Person Detection followed by the Person Attributes Recognition and Person Reidentification Retail, supports images/video and camera inputs. - [Deblurring Python\* Demo](./deblurring_demo/python/README.md) - Demo for deblurring the input images. - [Face Detection MTCNN Python\* Demo](./face_detection_mtcnn_demo/python/README.md) - The demo demonstrates how to run MTCNN face detection model to detect faces on images. +- [Face Detection MTCNN C++ G-API\* Demo](./face_detection_mtcnn_demo/cpp_gapi/README.md) - The demo demonstrates how to run MTCNN face detection model to detect faces on images. G-API version. - [Face Recognition Python\* Demo](./face_recognition_demo/python/README.md) - The interactive face recognition demo. - [Formula Recognition Python\* Demo](./formula_recognition_demo/python/README.md) - The demo demonstrates how to run Im2latex formula recognition models and recognize latex formulas. - [Gaze Estimation C++ Demo](./gaze_estimation_demo/cpp/README.md) - Face detection followed by gaze estimation, head pose estimation and facial landmarks regression. -- [Gaze Estimation C++ G-API Demo](./gaze_estimation_demo/cpp_gapi/README.md) - Face detection followed by gaze estimation, head pose estimation and facial landmarks regression. G-API version. +- [Gaze Estimation C++ G-API\* Demo](./gaze_estimation_demo/cpp_gapi/README.md) - Face detection followed by gaze estimation, head pose estimation and facial landmarks regression. G-API version. - [Gesture Recognition Python\* Demo](./gesture_recognition_demo/python/README.md) - Demo application for Gesture Recognition algorithm (e.g. American Sign Language gestures), which classifies gesture actions that are being performed on input video. +- [Gesture Recognition C++ G-API\* Demo](./gesture_recognition_demo/cpp_gapi/README.md) - Demo application for Gesture Recognition algorithm (e.g. American Sign Language gestures), which classifies gesture actions that are being performed on input video. G-API version. - [GPT-2 Text Prediction Python\* Demo](./gpt2_text_prediction_demo/python/README.md) - GPT-2 text prediction demo. - [Handwritten Text Recognition Python\* Demo](./handwritten_text_recognition_demo/python/README.md) - The demo demonstrates how to run Handwritten Japanese Recognition models and Handwritten Simplified Chinese Recognition models. - [Human Pose Estimation C++ Demo](./human_pose_estimation_demo/cpp/README.md) - Human pose estimation demo. @@ -36,7 +38,7 @@ The Open Model Zoo includes the following demos: - [Image Translation Python\* Demo](./image_translation_demo/python/README.md) - Demo application to synthesize a photo-realistic image based on exemplar image. - [Instance Segmentation Python\* Demo](./instance_segmentation_demo/python/README.md) - Inference of instance segmentation networks trained in `Detectron` or `maskrcnn-benchmark`. - [Interactive Face Detection C++ Demo](./interactive_face_detection_demo/cpp/README.md) - Face Detection coupled with Age/Gender, Head-Pose, Emotion, and Facial Landmarks detectors. Supports video and camera inputs. -- [Interactive Face Detection G-API Demo](./interactive_face_detection_demo/cpp_gapi/README.md) - G-API based Face Detection coupled with Age/Gender, Head-Pose, Emotion, and Facial Landmarks detectors. Supports video and camera inputs. +- [Interactive Face Detection G-API\* Demo](./interactive_face_detection_demo/cpp_gapi/README.md) - G-API based Face Detection coupled with Age/Gender, Head-Pose, Emotion, and Facial Landmarks detectors. Supports video and camera inputs. - [Machine Translation Python\* Demo](./machine_translation_demo/python/README.md) - The demo demonstrates how to run non-autoregressive machine translation models. - [Mask R-CNN C++ Demo for TensorFlow\* Object Detection API](./mask_rcnn_demo/cpp/README.md) - Inference of instance segmentation networks created with TensorFlow\* Object Detection API. - [Monodepth Python\* Demo](./monodepth_demo/python/README.md) - The demo demonstrates how to run monocular depth estimation models. @@ -231,6 +233,8 @@ For example: cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=ON /demos ``` +Once the modules are built, add the demo build folder to the `PYTHONPATH` environment variable. + ### Build Specific Demos To build specific demos, follow the instructions for building the demo applications above, diff --git a/demos/action_recognition_demo/python/README.md b/demos/action_recognition_demo/python/README.md index a249327f3c0..fcefed5df3f 100644 --- a/demos/action_recognition_demo/python/README.md +++ b/demos/action_recognition_demo/python/README.md @@ -32,7 +32,7 @@ that uses Inference Engine async API by scheduling infer requests in cyclical or You can change the value of `num_requests` in `action_recognition_demo.py` to find an optimal number of parallel working infer requests for your inference accelerators (Intel(R) Neural Compute Stick devices and GPUs benefit from higher number of infer requests). -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/action_recognition_demo/python/action_recognition.gif b/demos/action_recognition_demo/python/action_recognition.gif index 60240faa9c5..8f3772249a1 100644 Binary files a/demos/action_recognition_demo/python/action_recognition.gif and b/demos/action_recognition_demo/python/action_recognition.gif differ diff --git a/demos/bert_named_entity_recognition_demo/python/bert_named_entity_recognition_demo.py b/demos/bert_named_entity_recognition_demo/python/bert_named_entity_recognition_demo.py index e85810d0f10..ee88aa6a94e 100755 --- a/demos/bert_named_entity_recognition_demo/python/bert_named_entity_recognition_demo.py +++ b/demos/bert_named_entity_recognition_demo/python/bert_named_entity_recognition_demo.py @@ -23,17 +23,15 @@ from pathlib import Path from time import perf_counter -from openvino.inference_engine import IECore, get_version - sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python')) sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python/openvino/model_zoo')) from html_reader import get_paragraphs -from helpers import log_runtime_settings from model_api.models import BertNamedEntityRecognition from model_api.models.tokens_bert import text_to_tokens, load_vocab_file -from model_api.pipelines import get_user_config, parse_devices, AsyncPipeline +from model_api.pipelines import get_user_config, AsyncPipeline +from model_api.adapters import create_core, OpenvinoAdapter, RemoteAdapter log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.DEBUG, stream=sys.stdout) @@ -52,6 +50,8 @@ def build_argparser(): args.add_argument("-i", "--input", help="Required. URL to a page with context", action='append', required=True, type=str) + args.add_argument('--adapter', help='Optional. Specify the model adapter. Default is openvino.', + default='openvino', type=str, choices=('openvino', 'remote')) args.add_argument("--input_names", help="Optional. Inputs names for the network. " "Default values are \"input_ids,attention_mask,token_type_ids\" ", @@ -105,21 +105,21 @@ def main(): preprocessing_total_time = (perf_counter() - preprocessing_start_time) * 1e3 source = tuple(zip(sentences, preprocessed_sentences)) - log.info('OpenVINO Inference Engine') - log.info('\tbuild: {}'.format(get_version())) - ie = IECore() - - plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) + if args.adapter == 'openvino': + plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) + model_adapter = OpenvinoAdapter(create_core(), args.model, device=args.device, plugin_config=plugin_config, + max_num_requests=args.num_infer_requests) + elif args.adapter == 'remote': + log.info('Reading model {}'.format(args.model)) + serving_config = {"address": "localhost", "port": 9000} + model_adapter = RemoteAdapter(args.model, serving_config) - log.info('Reading model {}'.format(args.model)) - model = BertNamedEntityRecognition(ie, args.model, vocab, args.input_names) + model = BertNamedEntityRecognition(model_adapter, vocab, args.input_names) if max_sentence_length > model.max_length: model.reshape(max_sentence_length) + model.log_layers_info() - pipeline = AsyncPipeline(ie, model, plugin_config, - device=args.device, max_num_requests=args.num_infer_requests) - log.info('The model {} is loaded to {}'.format(args.model, args.device)) - log_runtime_settings(pipeline.exec_net, set(parse_devices(args.device))) + pipeline = AsyncPipeline(model) next_sentence_id = 0 next_sentence_id_to_show = 0 diff --git a/demos/bert_question_answering_demo/python/bert_question_answering_demo.py b/demos/bert_question_answering_demo/python/bert_question_answering_demo.py index cf5f22b4cda..80ec85e1e8e 100755 --- a/demos/bert_question_answering_demo/python/bert_question_answering_demo.py +++ b/demos/bert_question_answering_demo/python/bert_question_answering_demo.py @@ -23,17 +23,16 @@ from time import perf_counter import numpy as np -from openvino.inference_engine import IECore, get_version sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python')) sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python/openvino/model_zoo')) from html_reader import get_paragraphs -from helpers import log_runtime_settings from model_api.models import BertQuestionAnswering from model_api.models.tokens_bert import text_to_tokens, load_vocab_file, ContextWindow -from model_api.pipelines import get_user_config, parse_devices, AsyncPipeline +from model_api.pipelines import get_user_config, AsyncPipeline +from model_api.adapters import create_core, OpenvinoAdapter, RemoteAdapter log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.DEBUG, stream=sys.stdout) @@ -49,6 +48,8 @@ def build_argparser(): args.add_argument("-i", "--input", help="Required. URL to a page with context", action='append', required=True, type=str) + args.add_argument('--adapter', help='Optional. Specify the model adapter. Default is openvino.', + default='openvino', type=str, choices=('openvino', 'remote')) args.add_argument("--questions", type=str, nargs='+', metavar='QUESTION', help="Optional. Prepared questions") args.add_argument("--input_names", help="Optional. Inputs names for the network. " @@ -162,14 +163,16 @@ def main(): c_tokens = text_to_tokens(context.lower(), vocab) total_latency = (perf_counter() - preprocessing_start_time) * 1e3 - log.info('OpenVINO Inference Engine') - log.info('\tbuild: {}'.format(get_version())) - ie = IECore() + if args.adapter == 'openvino': + plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) + model_adapter = OpenvinoAdapter(create_core(), args.model, device=args.device, plugin_config=plugin_config, + max_num_requests=args.num_infer_requests) + elif args.adapter == 'remote': + log.info('Reading model {}'.format(args.model)) + serving_config = {"address": "localhost", "port": 9000} + model_adapter = RemoteAdapter(args.model, serving_config) - plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) - - log.info('Reading model {}'.format(args.model)) - model = BertQuestionAnswering(ie, args.model, vocab, args.input_names, args.output_names, + model = BertQuestionAnswering(model_adapter, vocab, args.input_names, args.output_names, args.max_answer_token_num, args.model_squad_ver) if args.reshape: # find the closest multiple of 64, if it is smaller than current network's sequence length, do reshape @@ -183,11 +186,9 @@ def main(): else: log.debug("\tSkipping network reshaping," " as (context length + max question length) exceeds the current (input) network sequence length") + model.log_layers_info() - pipeline = AsyncPipeline(ie, model, plugin_config, - device=args.device, max_num_requests=args.num_infer_requests) - log.info('The model {} is loaded to {}'.format(args.model, args.device)) - log_runtime_settings(pipeline.exec_net, set(parse_devices(args.device))) + pipeline = AsyncPipeline(model) if args.questions: def questions(): diff --git a/demos/bert_question_answering_embedding_demo/python/bert_question_answering_embedding_demo.py b/demos/bert_question_answering_embedding_demo/python/bert_question_answering_embedding_demo.py index 8a3b914a268..32909e1d114 100755 --- a/demos/bert_question_answering_embedding_demo/python/bert_question_answering_embedding_demo.py +++ b/demos/bert_question_answering_embedding_demo/python/bert_question_answering_embedding_demo.py @@ -23,17 +23,16 @@ from time import perf_counter import numpy as np -from openvino.inference_engine import IECore, get_version sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python')) sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python/openvino/model_zoo')) from html_reader import get_paragraphs -from helpers import log_runtime_settings from model_api.models import BertEmbedding, BertQuestionAnswering from model_api.models.tokens_bert import text_to_tokens, load_vocab_file, ContextWindow -from model_api.pipelines import get_user_config, parse_devices, AsyncPipeline +from model_api.pipelines import get_user_config, AsyncPipeline +from model_api.adapters import create_core, OpenvinoAdapter log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.DEBUG, stream=sys.stdout) @@ -169,14 +168,12 @@ def main(): visualizer = Visualizer(args.colors) total_latency = (perf_counter() - vocab_start_time) * 1e3 - log.info('OpenVINO Inference Engine') - log.info('\tbuild: {}'.format(get_version())) - ie = IECore() - + ie = create_core() plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) - - log.info('Reading Bert Embedding model {}'.format(args.model_emb)) - model_emb = BertEmbedding(ie, args.model_emb, vocab, args.input_names_emb) + model_emb_adapter = OpenvinoAdapter(ie, args.model_emb, device=args.device, plugin_config=plugin_config, + max_num_requests=args.num_infer_requests) + model_emb = BertEmbedding(model_emb_adapter, vocab, args.input_names_emb) + model_emb.log_layers_info() # reshape BertEmbedding model to infer short questions and long contexts max_len_context = 384 @@ -185,21 +182,17 @@ def main(): for new_length in [max_len_question, max_len_context]: model_emb.reshape(new_length) if new_length == max_len_question: - emb_exec_net = ie.load_network(model_emb.net, args.device) + emb_exec_net = ie.load_network(model_emb_adapter.net, args.device) else: - emb_pipeline = AsyncPipeline( - ie, model_emb, plugin_config, device=args.device, max_num_requests=args.num_infer_requests - ) - log.info('The Bert Embedding model {} is loaded to {}'.format(args.model_emb, args.device)) - log_runtime_settings(emb_pipeline.exec_net, set(parse_devices(args.device))) + emb_pipeline = AsyncPipeline(model_emb) if args.model_qa: - log.info('Reading Question Answering model {}'.format(args.model_qa)) - model_qa = BertQuestionAnswering(ie, args.model_qa, vocab, args.input_names_qa, args.output_names_qa, + model_qa_adapter = OpenvinoAdapter(ie, args.model_qa, device=args.device, plugin_config=plugin_config, + max_num_requests=args.num_infer_requests) + model_qa = BertQuestionAnswering(model_qa_adapter, vocab, args.input_names_qa, args.output_names_qa, args.max_answer_token_num, args.model_qa_squad_ver) - qa_pipeline = AsyncPipeline(ie, model_qa, plugin_config, device=args.device, max_num_requests=args.num_infer_requests) - log_runtime_settings(qa_pipeline.exec_net, set(parse_devices(args.device))) - log.info('The Question Answering model {} is loaded to {}'.format(args.model_qa, args.device)) + model_qa.log_layers_info() + qa_pipeline = AsyncPipeline(model_qa) log.info("\t\tStage 1 (Calc embeddings for the context)") contexts_all = [] diff --git a/demos/build_demos.sh b/demos/build_demos.sh index bb6338aec81..80ff85a6117 100755 --- a/demos/build_demos.sh +++ b/demos/build_demos.sh @@ -25,11 +25,30 @@ error() { } trap 'error ${LINENO}' ERR +usage() { + echo "Build inference engine demos" + echo + echo "Options:" + echo " -h, --help Print the help message" + echo " -b=DEMOS_BUILD_DIR, --build_dir=DEMOS_BUILD_DIR Specify the demo build directory" + echo " -DENABLE_PYTHON=y Whether to build extension modules for Python demos" + echo ' --target=TARGETS A space sepparated list of demos to build. To build more than one specific demo use quotation marks ex. --target="classification_demo segmentation_demo"' + echo + exit 1 +} + +build_dir=$HOME/omz_demos_build extra_cmake_opts=() build_targets=() for opt in "$@"; do case "$opt" in + -h | --help) + usage + ;; + -b=* | --build_dir=*) + build_dir=("${opt#*=}") + ;; -DENABLE_PYTHON=*) extra_cmake_opts+=("$opt") ;; @@ -38,7 +57,7 @@ for opt in "$@"; do ;; *) printf "Unknown option: %q\n" "$opt" - exit 1 + usage ;; esac done @@ -70,8 +89,6 @@ if ! command -v cmake &>/dev/null; then exit 1 fi -build_dir=$HOME/omz_demos_build - OS_PATH=$(uname -m) NUM_THREADS="-j2" diff --git a/demos/build_demos_msvc.bat b/demos/build_demos_msvc.bat index ee7cb681635..9e2409b924d 100644 --- a/demos/build_demos_msvc.bat +++ b/demos/build_demos_msvc.bat @@ -18,7 +18,7 @@ setlocal EnableDelayedExpansion set "ROOT_DIR=%~dp0" -set "SOLUTION_DIR64=%USERPROFILE%\Documents\Intel\OpenVINO\omz_demos_build" +set "BUILD_DIR=%USERPROFILE%\Documents\Intel\OpenVINO\omz_demos_build" set SUPPORTED_VS_VERSIONS=VS2015 VS2017 VS2019 @@ -28,6 +28,14 @@ set BUILD_TARGETS= :argParse if not "%1" == "" ( + if "%1" == "-h" ( + goto usage + ) + if "%1"=="-b" ( + set BUILD_DIR=%2 + shift & shift + goto argParse + ) rem cmd.exe mangles -DENABLE_PYTHON=YES into -DENABLE_PYTHON YES, rem so it gets split into two arguments if "%1" == "-DENABLE_PYTHON" ( @@ -46,7 +54,7 @@ if not "%1" == "" ( if not "%VS_VERSION%" == "" ( echo Unexpected argument: "%1" - goto errorHandling + goto usage ) if "%1"=="VS2015" ( @@ -122,23 +130,34 @@ if "%VS_VERSION%" == "" ( ) ) -if exist "%SOLUTION_DIR64%\CMakeCache.txt" del "%SOLUTION_DIR64%\CMakeCache.txt" +if exist "%BUILD_DIR%\CMakeCache.txt" del "%BUILD_DIR%\CMakeCache.txt" -echo Creating Visual Studio %VS_VERSION% %PLATFORM% files in %SOLUTION_DIR64%... -cd "%ROOT_DIR%" && cmake -E make_directory "%SOLUTION_DIR64%" +echo Creating Visual Studio %VS_VERSION% %PLATFORM% files in %BUILD_DIR%... +cd "%ROOT_DIR%" && cmake -E make_directory "%BUILD_DIR%" -cd "%SOLUTION_DIR64%" && cmake -G "Visual Studio !VS_VERSION!" -A %PLATFORM% %EXTRA_CMAKE_OPTS% "%ROOT_DIR%" +cd "%BUILD_DIR%" && cmake -G "Visual Studio !VS_VERSION!" -A %PLATFORM% %EXTRA_CMAKE_OPTS% "%ROOT_DIR%" echo. echo ###############^|^| Build Open Model Zoo Demos using MS Visual Studio ^|^|############### echo. echo cmake --build . --config Release %BUILD_TARGETS% -cmake --build . --config Release %BUILD_TARGETS% +cmake --build . --config Release -j 4 %BUILD_TARGETS% if ERRORLEVEL 1 goto errorHandling echo Done. -goto :eof +exit /b + +:usage +echo Build inference engine demos +echo. +echo Options: +echo -h Print the help message +echo -b=DEMOS_BUILD_DIR Specify the demo build directory +echo -DENABLE_PYTHON=y Whether to build extension modules for Python demos +echo --target=TARGETS A space sepparated list of demos to build. To build more than one specific demo use quotation marks ex. --target="classification_demo segmentation_demo" +echo VS_VERSION The preferred Microsoft Visual Studio version +exit /B 1 :errorHandling echo Error diff --git a/demos/classification_demo/cpp/README.md b/demos/classification_demo/cpp/README.md index 6f763a63a99..84c3a022520 100644 --- a/demos/classification_demo/cpp/README.md +++ b/demos/classification_demo/cpp/README.md @@ -12,7 +12,7 @@ When "ground truth" data applied, the color coding for the text, drawn above eac You can stop the demo by pressing "Esc" or "Q" button. After that, the average metrics values will be printed to the console. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/common/cpp/models/include/models/detection_model_yolo.h b/demos/common/cpp/models/include/models/detection_model_yolo.h index 2ba6e363444..742386ca919 100644 --- a/demos/common/cpp/models/include/models/detection_model_yolo.h +++ b/demos/common/cpp/models/include/models/detection_model_yolo.h @@ -15,17 +15,9 @@ */ #pragma once +#include #include "detection_model.h" -namespace ngraph { - namespace op { - namespace v0 { - class RegionYolo; - } - using v0::RegionYolo; - } -} - class ModelYolo : public DetectionModel { protected: class Region { diff --git a/demos/common/cpp/models/include/models/jpeg_restoration_model.h b/demos/common/cpp/models/include/models/jpeg_restoration_model.h new file mode 100644 index 00000000000..544c7e21ece --- /dev/null +++ b/demos/common/cpp/models/include/models/jpeg_restoration_model.h @@ -0,0 +1,39 @@ +/* +// Copyright (C) 2021 Intel Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writingb software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +*/ + +#pragma once + +#include "image_model.h" + +class JPEGRestorationModel : public ImageModel { +public: + /// Constructor + /// @param modelFileName name of model to load + /// @param inputImgSize size of image to set model input shape + /// @param jpegCompression flag allows to perform compression before the inference + JPEGRestorationModel(const std::string& modelFileName, const cv::Size& inputImgSize, bool jpegCompression); + + std::shared_ptr preprocess( + const InputData& inputData, InferenceEngine::InferRequest::Ptr& request) override; + std::unique_ptr postprocess(InferenceResult& infResult) override; + +protected: + void prepareInputsOutputs(InferenceEngine::CNNNetwork & cnnNetwork) override; + void changeInputSize(InferenceEngine::CNNNetwork& cnnNetwork); + + static const size_t stride = 8; + bool jpegCompression = false; +}; diff --git a/demos/common/cpp/models/src/jpeg_restoration.cpp b/demos/common/cpp/models/src/jpeg_restoration.cpp new file mode 100644 index 00000000000..72c663b81f4 --- /dev/null +++ b/demos/common/cpp/models/src/jpeg_restoration.cpp @@ -0,0 +1,134 @@ +/* +// Copyright (C) 2021 Intel Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +*/ + +#include "models/jpeg_restoration_model.h" +#include "utils/ocv_common.hpp" +#include +#include +#include + +JPEGRestorationModel::JPEGRestorationModel(const std::string& modelFileName, const cv::Size& inputImgSize, bool _jpegCompression) : + ImageModel(modelFileName, false) { + netInputHeight = inputImgSize.height; + netInputWidth = inputImgSize.width; + jpegCompression = _jpegCompression; + +} + +void JPEGRestorationModel::prepareInputsOutputs(InferenceEngine::CNNNetwork& cnnNetwork) { + // --------------------------- Configure input & output ------------------------------------------------- + // --------------------------- Prepare input blobs ------------------------------------------------------ + + InferenceEngine::ICNNNetwork::InputShapes inputShapes = cnnNetwork.getInputShapes(); + if (inputShapes.size() != 1) + throw std::runtime_error("The JPEG Restoration model wrapper supports topologies only with 1 input"); + inputsNames.push_back(inputShapes.begin()->first); + InferenceEngine::SizeVector& inSizeVector = inputShapes.begin()->second; + if (inSizeVector.size() != 4 || inSizeVector[0] != 1 || inSizeVector[1] != 3) + throw std::runtime_error("3-channel 4-dimensional model's input is expected"); + + // --------------------------- Prepare output blobs ----------------------------------------------------- + const InferenceEngine::OutputsDataMap& outputInfo = cnnNetwork.getOutputsInfo(); + if (outputInfo.size() != 1) + throw std::runtime_error("The JPEG Restoration model wrapper supports topologies only with 1 output"); + + outputsNames.push_back(outputInfo.begin()->first); + InferenceEngine::Data& data = *outputInfo.begin()->second; + data.setPrecision(InferenceEngine::Precision::FP32); + const InferenceEngine::SizeVector& outSizeVector = data.getTensorDesc().getDims(); + if (outSizeVector.size() != 4 || outSizeVector[0] != 1 || outSizeVector[1] != 3) + throw std::runtime_error("3-channel 4-dimensional model's output is expected"); + + changeInputSize(cnnNetwork); +} + +void JPEGRestorationModel::changeInputSize(InferenceEngine::CNNNetwork& cnnNetwork) { + InferenceEngine::ICNNNetwork::InputShapes inputShapes = cnnNetwork.getInputShapes(); + InferenceEngine::SizeVector& inputDims = inputShapes.begin()->second; + + if (inputDims[2] % stride || inputDims[3] % stride) + throw std::runtime_error("The shape of the model input must be divisible by stride"); + + netInputHeight = static_cast((netInputHeight + stride - 1) / stride) * stride; + netInputWidth = static_cast((netInputWidth + stride - 1) / stride) * stride; + + inputDims[0] = 1; + inputDims[2] = netInputHeight; + inputDims[3] = netInputWidth; + + cnnNetwork.reshape(inputShapes); +} + +std::shared_ptr JPEGRestorationModel::preprocess(const InputData& inputData, InferenceEngine::InferRequest::Ptr& request) { + cv::Mat image = inputData.asRef().inputImage; + size_t h = image.rows; + size_t w = image.cols; + cv::Mat resizedImage; + if (jpegCompression) { + std::vector encimg; + std::vector params{cv::IMWRITE_JPEG_QUALITY, 40}; + cv::imencode(".jpg", image, encimg, params); + image = cv::imdecode(cv::Mat(encimg), 3); + } + + if (netInputHeight - stride < h && h <= netInputHeight + && netInputWidth - stride < w && w <= netInputWidth) { + int bottom = netInputHeight - h; + int right = netInputWidth - w; + cv::copyMakeBorder(image, resizedImage, 0, bottom, 0, right, + cv::BORDER_CONSTANT, 0); + } else { + slog::warn << "\tChosen model aspect ratio doesn't match image aspect ratio" << slog::endl; + cv::resize(image, resizedImage, cv::Size(netInputWidth, netInputHeight)); + } + InferenceEngine::Blob::Ptr frameBlob = request->GetBlob(inputsNames[0]); + matToBlob(resizedImage, frameBlob); + + return std::make_shared(image.cols, image.rows); +} + +std::unique_ptr JPEGRestorationModel::postprocess(InferenceResult& infResult) { + ImageResult* result = new ImageResult; + *static_cast(result) = static_cast(infResult); + + const auto& inputImgSize = infResult.internalModelData->asRef(); + + InferenceEngine::LockedMemory outMapped = infResult.getFirstOutputBlob()->rmap(); + const auto outputData = outMapped.as(); + + std::vector imgPlanes; + const InferenceEngine::SizeVector& outSizeVector = infResult.getFirstOutputBlob()->getTensorDesc().getDims(); + size_t outHeight = (int)(outSizeVector[2]); + size_t outWidth = (int)(outSizeVector[3]); + size_t numOfPixels = outWidth * outHeight; + imgPlanes = std::vector{ + cv::Mat(outHeight, outWidth, CV_32FC1, &(outputData[0])), + cv::Mat(outHeight, outWidth, CV_32FC1, &(outputData[numOfPixels])), + cv::Mat(outHeight, outWidth, CV_32FC1, &(outputData[numOfPixels * 2]))}; + cv::Mat resultImg; + cv::merge(imgPlanes, resultImg); + + if (netInputHeight - stride < static_cast(inputImgSize.inputImgHeight) && static_cast(inputImgSize.inputImgHeight) <= netInputHeight + && netInputWidth - stride < static_cast(inputImgSize.inputImgWidth) && static_cast(inputImgSize.inputImgWidth) <= netInputWidth) { + result->resultImage = resultImg(cv::Rect(0, 0, inputImgSize.inputImgWidth, inputImgSize.inputImgHeight)); + } else { + cv::resize(resultImg, result->resultImage, cv::Size(inputImgSize.inputImgWidth, inputImgSize.inputImgHeight)); + } + + result->resultImage.convertTo(result->resultImage, CV_8UC3, 255); + + return std::unique_ptr(result); +} diff --git a/demos/common/cpp_gapi/CMakeLists.txt b/demos/common/cpp_gapi/CMakeLists.txt new file mode 100644 index 00000000000..56b02f34bbf --- /dev/null +++ b/demos/common/cpp_gapi/CMakeLists.txt @@ -0,0 +1,5 @@ +# Copyright (C) 2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +add_subdirectory(utils_gapi) diff --git a/demos/common/cpp_gapi/utils_gapi/CMakeLists.txt b/demos/common/cpp_gapi/utils_gapi/CMakeLists.txt new file mode 100644 index 00000000000..3b7c138bc9e --- /dev/null +++ b/demos/common/cpp_gapi/utils_gapi/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +file(GLOB_RECURSE HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*") +file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*") + +source_group("src" FILES ${SOURCES}) +source_group("include" FILES ${HEADERS}) + +add_library(utils_gapi STATIC ${HEADERS} ${SOURCES}) +target_include_directories(utils_gapi PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") +target_link_libraries(utils_gapi PRIVATE gflags ${InferenceEngine_LIBRARIES} opencv_core utils) diff --git a/demos/common/cpp_gapi/utils_gapi/include/utils_gapi/stream_source.hpp b/demos/common/cpp_gapi/utils_gapi/include/utils_gapi/stream_source.hpp new file mode 100644 index 00000000000..8eb66619845 --- /dev/null +++ b/demos/common/cpp_gapi/utils_gapi/include/utils_gapi/stream_source.hpp @@ -0,0 +1,26 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include + +namespace custom { +class CommonCapSrc : public cv::gapi::wip::IStreamSource +{ +public: + explicit CommonCapSrc(std::shared_ptr& cap); + +protected: + std::shared_ptr cap; + cv::Mat first; + bool first_pulled = false; + + void preparation(); + virtual bool pull(cv::gapi::wip::Data &data) override; + virtual cv::GMetaArg descr_of() const override; +}; + +} // namespace custom diff --git a/demos/common/cpp_gapi/utils_gapi/src/stream_source.cpp b/demos/common/cpp_gapi/utils_gapi/src/stream_source.cpp new file mode 100644 index 00000000000..9e1862037b6 --- /dev/null +++ b/demos/common/cpp_gapi/utils_gapi/src/stream_source.cpp @@ -0,0 +1,41 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +namespace custom { +CommonCapSrc::CommonCapSrc(std::shared_ptr& imagesCapture) + : cap(imagesCapture) { + preparation(); +} + +void CommonCapSrc::preparation() { + GAPI_Assert(first.empty()); + cv::Mat tmp = cap->read(); + if (!tmp.data) { + GAPI_Assert(false && "Couldn't grab the first frame"); + } + first = tmp.clone(); +} + +bool CommonCapSrc::pull(cv::gapi::wip::Data &data) { + if (!first_pulled) { + GAPI_Assert(!first.empty()); + first_pulled = true; + data = first; + return true; + } + cv::Mat frame = cap->read(); + if (!frame.data) { + return false; + } + data = frame.clone(); + return true; +} + +cv::GMetaArg CommonCapSrc::descr_of() const { + GAPI_Assert(!first.empty()); + return cv::GMetaArg{ cv::descr_of(first) }; +} +} // namespace custom diff --git a/demos/common/python/helpers.py b/demos/common/python/helpers.py index d117da5469c..3e79574d182 100644 --- a/demos/common/python/helpers.py +++ b/demos/common/python/helpers.py @@ -26,26 +26,6 @@ def resolution(value): raise RuntimeError('Сorrect format of --output_resolution parameter is "width"x"height".') return result -def log_blobs_info(model): - for name, layer in model.net.input_info.items(): - log.info('\tInput blob: {}, shape: {}, precision: {}'.format(name, layer.input_data.shape, layer.precision)) - for name, layer in model.net.outputs.items(): - log.info('\tOutput blob: {}, shape: {}, precision: {}'.format(name, layer.shape, layer.precision)) - -def log_runtime_settings(exec_net, devices): - if 'AUTO' not in devices: - for device in devices: - try: - nstreams = exec_net.get_config(device + '_THROUGHPUT_STREAMS') - log.info('\tDevice: {}'.format(device)) - log.info('\t\tNumber of streams: {}'.format(nstreams)) - if device == 'CPU': - nthreads = exec_net.get_config('CPU_THREADS_NUM') - log.info('\t\tNumber of threads: {}'.format(nthreads if int(nthreads) else 'AUTO')) - except RuntimeError: - pass - log.info('\tNumber of network infer requests: {}'.format(len(exec_net.requests))) - def log_latency_per_stage(*pipeline_metrics): stages = ('Decoding', 'Preprocessing', 'Inference', 'Postprocessing', 'Rendering') for stage, latency in zip(stages, pipeline_metrics): diff --git a/demos/common/python/openvino/model_zoo/model_api/adapters/__init__.py b/demos/common/python/openvino/model_zoo/model_api/adapters/__init__.py new file mode 100644 index 00000000000..789d8211e74 --- /dev/null +++ b/demos/common/python/openvino/model_zoo/model_api/adapters/__init__.py @@ -0,0 +1,25 @@ +""" + Copyright (C) 2021 Intel Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +""" + + +from .openvino_adapter import create_core, OpenvinoAdapter +from .remote_adapter import RemoteAdapter + +__all__ = [ + 'create_core', + 'OpenvinoAdapter', + 'RemoteAdapter', +] diff --git a/demos/common/python/openvino/model_zoo/model_api/adapters/model_adapter.py b/demos/common/python/openvino/model_zoo/model_api/adapters/model_adapter.py new file mode 100644 index 00000000000..74b339d2d49 --- /dev/null +++ b/demos/common/python/openvino/model_zoo/model_api/adapters/model_adapter.py @@ -0,0 +1,155 @@ +""" + Copyright (c) 2021 Intel Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +""" + +import abc +from dataclasses import dataclass, field +from typing import Dict, List + + +@dataclass +class Metadata: + shape: List[int] = field(default_factory=list) + precision: str = '' + type: str = '' + meta: Dict = field(default_factory=dict) + + +class ModelAdapter(metaclass=abc.ABCMeta): + ''' + An abstract Model Adapter with the following interface: + + - Reading the model from disk or other place + - Loading the model to the device + - Accessing the information about input/output layers + - The model reshaping + - Synchronous model inference + - Asynchronous model inference + ''' + precisions = ('FP32', 'I32', 'FP16', 'I16', 'I8', 'U8') + + @abc.abstractmethod + def __init__(self): + ''' + An abstract Model Adapter constructor. + Reads the model from disk or other place. + ''' + + @abc.abstractmethod + def load_model(self): + ''' + Loads the model on the device. + ''' + + @abc.abstractmethod + def get_input_layers(self): + ''' + Gets the names of model input layers and for each layer creates the Metadata structure, + which contains the information about the layer shape, blob precision in OpenVINO format, meta (optional) + + Returns: + - the dict containing Metadata for all input layers + ''' + + @abc.abstractmethod + def get_output_layers(self): + ''' + Gets the names of model output layers and for each layer creates the Metadata structure, + which contains the information about the layer shape, blob precision in OpenVINO format, meta (optional) + + Returns: + - the dict containing Metadata for all output layers + ''' + + @abc.abstractmethod + def reshape_model(self, new_shape): + ''' + Reshapes the model input layers to fit the new input shape. + + Args: + - new_shape(dict): the dictionary with input layers as keys and + list of new shape as values in the following format: + { + 'input_layer_1': [1, 128, 128, 3], + 'input_layer_2': [1, 128, 128, 3], + ... + } + ''' + + @abc.abstractmethod + def infer_sync(self, dict_data): + ''' + Performs the synchronous model inference. The infer is a blocking method. + + Args: + - dict_data: it's submitted to the model for inference and has the following format: + { + 'input_layer_1': data_1, + 'input_layer_2': data_2, + ... + } + + Returns: + - raw result(dict) - model raw output in the following format: + { + 'output_layer_1': raw_result_1, + 'output_layer_2': raw_result_2, + ... + } + ''' + + @abc.abstractmethod + def infer_async(self, dict_data, callback_fn, callback_data): + ''' + Performs the asynchronous model inference and sets + the callback for inference completion. Also, it should + define get_raw_result() function, which handles the result + of inference from the model. + + Args: + - dict_data: it's submitted to the model for inference and has the following format: + { + 'input_layer_1': data_1, + 'input_layer_2': data_2, + ... + } + - callback_fn: the callback function, which is defined outside the adapter + - callback_data: the data for callback, that will be taken after the model inference is ended + ''' + + @abc.abstractmethod + def is_ready(self): + ''' + In case of asynchronous execution checks if one can submit input data + to the model for inference, or all infer requests are busy. + + Returns: + - the boolean flag whether the input data can be + submitted to the model for inference or not + ''' + + @abc.abstractmethod + def await_all(self): + ''' + In case of asynchronous execution waits the completion of all + busy infer requests. + ''' + + @abc.abstractmethod + def await_any(self): + ''' + In case of asynchronous execution waits the completion of any + busy infer request until it becomes available for the data submission. + ''' diff --git a/demos/common/python/openvino/model_zoo/model_api/adapters/openvino_adapter.py b/demos/common/python/openvino/model_zoo/model_api/adapters/openvino_adapter.py new file mode 100644 index 00000000000..0cacd0364e6 --- /dev/null +++ b/demos/common/python/openvino/model_zoo/model_api/adapters/openvino_adapter.py @@ -0,0 +1,149 @@ +""" + Copyright (c) 2021 Intel Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +""" + +import logging as log +from collections import deque +from pathlib import Path + +try: + from openvino.inference_engine import IECore, get_version + import ngraph + openvino_absent = False +except ImportError: + openvino_absent = True + +from .model_adapter import ModelAdapter, Metadata +from ..pipelines import parse_devices + + +def create_core(): + if openvino_absent: + raise ImportError('The OpenVINO package is not installed') + + log.info('OpenVINO Inference Engine') + log.info('\tbuild: {}'.format(get_version())) + return IECore() + + +class OpenvinoAdapter(ModelAdapter): + """ + Class that allows working with Inference Engine model, its input and output blobs + """ + + def __init__(self, ie, model_path, weights_path=None, device='CPU', plugin_config=None, max_num_requests=1): + self.ie = ie + self.model_path = model_path + self.device = device + self.plugin_config = plugin_config + self.max_num_requests = max_num_requests + + if isinstance(model_path, (str, Path)): + model_path_suffix = Path(model_path).suffix + if model_path_suffix == ".onnx": + if weights_path: + log.warning('For model in ONNX format should set only "model_path" parameter.' + 'The "weights_path" will be omitted') + weights_path = None + elif model_path_suffix == ".xml": + weights_path_suffix = Path(weights_path).suffix if weights_path else None + if weights_path_suffix and weights_path_suffix != ".bin": + raise ValueError(f"Unsupported weights file extension: {weights_path_suffix}") + else: + raise ValueError(f"Unsupported model file extension: {model_path_suffix}") + + self.model_from_buffer = isinstance(model_path, bytes) and isinstance(weights_path, bytes) + log.info('Reading model {}'.format('from buffer' if self.model_from_buffer else model_path)) + self.net = ie.read_network(model_path, weights_path, self.model_from_buffer) + + def load_model(self): + self.exec_net = self.ie.load_network(self.net, self.device, + self.plugin_config, self.max_num_requests) + if self.max_num_requests == 0: + # ExecutableNetwork doesn't allow creation of additional InferRequests. Reload ExecutableNetwork + # +1 to use it as a buffer of the pipeline + self.exec_net = self.ie.load_network(self.net, self.device, + self.plugin_config, len(self.exec_net.requests) + 1) + + log.info('The model {} is loaded to {}'.format("from buffer" if self.model_from_buffer else self.model_path, self.device)) + self.empty_requests = deque(self.exec_net.requests) + self.log_runtime_settings() + + def log_runtime_settings(self): + devices = set(parse_devices(self.device)) + if 'AUTO' not in devices: + for device in devices: + try: + nstreams = self.exec_net.get_config(device + '_THROUGHPUT_STREAMS') + log.info('\tDevice: {}'.format(device)) + log.info('\t\tNumber of streams: {}'.format(nstreams)) + if device == 'CPU': + nthreads = self.exec_net.get_config('CPU_THREADS_NUM') + log.info('\t\tNumber of threads: {}'.format(nthreads if int(nthreads) else 'AUTO')) + except RuntimeError: + pass + log.info('\tNumber of network infer requests: {}'.format(len(self.exec_net.requests))) + + def get_input_layers(self): + inputs = {} + for name, layer in self.net.input_info.items(): + inputs[name] = Metadata(layer.input_data.shape, layer.input_data.precision) + inputs = self._get_meta_from_ngraph(inputs) + return inputs + + def get_output_layers(self): + outputs = {} + for name, layer in self.net.outputs.items(): + outputs[name] = Metadata(layer.shape, layer.precision) + outputs = self._get_meta_from_ngraph(outputs) + return outputs + + def reshape_model(self, new_shape): + self.net.reshape(new_shape) + + def infer_sync(self, dict_data): + return self.exec_net.infer(dict_data) + + def infer_async(self, dict_data, callback_fn, callback_data): + + def get_raw_result(request): + raw_result = {key: blob.buffer for key, blob in request.output_blobs.items()} + self.empty_requests.append(request) + return raw_result + + request = self.empty_requests.popleft() + request.set_completion_callback(py_callback=callback_fn, + py_data=(get_raw_result, request, callback_data)) + request.async_infer(dict_data) + + def is_ready(self): + return len(self.empty_requests) != 0 + + def await_all(self): + for request in self.exec_net.requests: + request.wait() + + def await_any(self): + self.exec_net.wait(num_requests=1) + + def _get_meta_from_ngraph(self, layers_info): + ng_func = ngraph.function_from_cnn(self.net) + for node in ng_func.get_ordered_ops(): + layer_name = node.get_friendly_name() + if layer_name not in layers_info.keys(): + continue + layers_info[layer_name].meta = node._get_attributes() + layers_info[layer_name].type = node.get_type_name() + return layers_info diff --git a/demos/common/python/openvino/model_zoo/model_api/adapters/remote_adapter.py b/demos/common/python/openvino/model_zoo/model_api/adapters/remote_adapter.py new file mode 100644 index 00000000000..23c55dec072 --- /dev/null +++ b/demos/common/python/openvino/model_zoo/model_api/adapters/remote_adapter.py @@ -0,0 +1,86 @@ +""" + Copyright (c) 2021 Intel Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +""" + +try: + import ovmsclient + ovmsclient_absent = False +except ImportError: + ovmsclient_absent = True + +from .model_adapter import ModelAdapter, Metadata + + +class RemoteAdapter(ModelAdapter): + """ + Class that allows working with Remote OpenVino Model Server model + """ + + precisions = { + 'DT_FLOAT': 'FP32', + 'DT_INT32': 'I32', + 'DT_HALF' : 'FP16', + 'DT_INT16': 'I16', + 'DT_INT8' : 'I8', + 'DT_UINT8': 'U8', + } + + def __init__(self, model_name, config): + if ovmsclient_absent: + raise ImportError('The OVMSclient package is not installed') + + self.model_name = model_name + self.client = ovmsclient.make_grpc_client(config=config) + # ensure the model can be loaded + ovmsclient.make_grpc_status_request(model_name=self.model_name) + + metadata_request = ovmsclient.make_grpc_metadata_request(model_name=self.model_name) + self.metadata = self.client.get_model_metadata(metadata_request).to_dict()[1] + + def load_model(self): + pass + + def get_input_layers(self): + inputs = {} + for name, meta in self.metadata['inputs'].items(): + inputs[name] = Metadata(meta['shape'], self.precisions.get(meta['dtype'], meta['dtype'])) + return inputs + + def get_output_layers(self): + outputs = {} + for name, meta in self.metadata['outputs'].items(): + outputs[name] = Metadata(meta['shape'], self.precisions.get(meta['dtype'], meta['dtype'])) + return outputs + + def reshape_model(self, new_shape): + pass + + def infer_sync(self, dict_data): + predict_request = ovmsclient.make_grpc_predict_request( + dict_data, model_name=self.model_name) + return self.client.predict(predict_request).to_dict() + + def infer_async(self, dict_data, callback_fn, callback_data): + raw_result = self.infer_sync(dict_data) + callback_fn(0, (lambda x: x, raw_result, callback_data)) + + def is_ready(self): + return True + + def await_all(self): + pass + + def await_any(self): + pass diff --git a/demos/common/python/openvino/model_zoo/model_api/models/__init__.py b/demos/common/python/openvino/model_zoo/model_api/models/__init__.py index 614e2b87c00..948cfeb249f 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/__init__.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/__init__.py @@ -22,13 +22,14 @@ from .ctpn import CTPN from .faceboxes import FaceBoxes from .hpe_associative_embedding import HpeAssociativeEmbedding +from .monodepth import MonoDepthModel from .open_pose import OpenPose from .retinaface import RetinaFace, RetinaFacePyTorch from .segmentation import SegmentationModel, SalientObjectDetectionModel from .ssd import SSD from .ultra_lightweight_face_detection import UltraLightweightFaceDetection from .utils import DetectionWithLandmarks, InputTransform, OutputTransform, RESIZE_TYPES -from .yolo import YOLO, YoloV4, YOLOF, YOLOX +from .yolo import YOLO, YoloV3ONNX, YoloV4, YOLOF, YOLOX __all__ = [ 'BertEmbedding', @@ -42,6 +43,7 @@ 'FaceBoxes', 'HpeAssociativeEmbedding', 'InputTransform', + 'MonoDepthModel', 'OpenPose', 'OutputTransform', 'RESIZE_TYPES', @@ -52,6 +54,7 @@ 'SSD', 'UltraLightweightFaceDetection', 'YOLO', + 'YoloV3ONNX', 'YoloV4', 'YOLOF', 'YOLOX', diff --git a/demos/common/python/openvino/model_zoo/model_api/models/bert.py b/demos/common/python/openvino/model_zoo/model_api/models/bert.py index 4c92e99e2ed..0c947fa9aca 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/bert.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/bert.py @@ -17,16 +17,16 @@ class Bert(Model): - def __init__(self, ie, model_path, vocab, input_names): - super().__init__(ie, model_path) + def __init__(self, model_adapter, vocab, input_names): + super().__init__(model_adapter) self.token_cls = [vocab['[CLS]']] self.token_sep = [vocab['[SEP]']] self.token_pad = [vocab['[PAD]']] self.input_names = [i.strip() for i in input_names.split(',')] - if self.net.input_info.keys() != set(self.input_names): + if self.inputs.keys() != set(self.input_names): raise RuntimeError('The Bert model expects input names: {}, actual network input names: {}'.format( - self.input_names, list(self.net.input_info.keys()))) - self.max_length = self.net.input_info[self.input_names[0]].input_data.shape[1] + self.input_names, list(self.inputs.keys()))) + self.max_length = self.inputs[self.input_names[0]].shape[1] def preprocess(self, inputs): input_ids, attention_mask, token_type_ids = self.form_request(inputs) @@ -62,19 +62,19 @@ def create_input_dict(self, input_ids, attention_mask, token_type_ids): def reshape(self, new_length): new_shapes = {} - for input_name, input_info in self.net.input_info.items(): + for input_name, input_info in self.inputs.items(): new_shapes[input_name] = [1, new_length] - default_input_shape = input_info.input_data.shape - self.net.reshape(new_shapes) + default_input_shape = input_info.shape + super().reshape(new_shapes) self.logger.debug("\tReshape model from {} to {}".format(default_input_shape, new_shapes[input_name])) self.max_length = new_length class BertNamedEntityRecognition(Bert): - def __init__(self, ie, model_path, vocab, input_names): - super().__init__(ie, model_path, vocab, input_names) + def __init__(self, model_adapter, vocab, input_names): + super().__init__(model_adapter, vocab, input_names) - self.output_names = list(self.net.outputs) + self.output_names = list(self.outputs) if len(self.output_names) != 1: raise RuntimeError("The BertNamedEntityRecognition model wrapper supports only 1 output") @@ -99,10 +99,10 @@ def postprocess(self, outputs, meta): class BertEmbedding(Bert): - def __init__(self, ie, model_path, vocab, input_names): - super().__init__(ie, model_path, vocab, input_names) + def __init__(self, model_adapter, vocab, input_names): + super().__init__(model_adapter, vocab, input_names) - self.output_names = list(self.net.outputs) + self.output_names = list(self.outputs) if len(self.output_names) != 1: raise RuntimeError("The BertEmbedding model wrapper supports only 1 output") @@ -119,16 +119,16 @@ def postprocess(self, outputs, meta): class BertQuestionAnswering(Bert): - def __init__(self, ie, model_path, vocab, input_names, output_names, + def __init__(self, model_adapter, vocab, input_names, output_names, max_answer_token_num, squad_ver): - super().__init__(ie, model_path, vocab, input_names) + super().__init__(model_adapter, vocab, input_names) self.max_answer_token_num = max_answer_token_num self.squad_ver = squad_ver self.output_names = [o.strip() for o in output_names.split(',')] - if self.net.outputs.keys() != set(self.output_names): + if self.outputs.keys() != set(self.output_names): raise RuntimeError('The BertQuestionAnswering model output names: {}, actual network output names: {}'.format( - self.output_names, list(self.net.outputs.keys()))) + self.output_names, list(self.outputs.keys()))) def form_request(self, inputs): c_data, q_tokens_id = inputs diff --git a/demos/common/python/openvino/model_zoo/model_api/models/centernet.py b/demos/common/python/openvino/model_zoo/model_api/models/centernet.py index bc43be0318e..b1794a2c70a 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/centernet.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/centernet.py @@ -23,14 +23,14 @@ class CenterNet(DetectionModel): - def __init__(self, ie, model_path, resize_type=None, + def __init__(self, model_adapter, resize_type=None, labels=None, threshold=0.5, iou_threshold=0.5): if not resize_type: resize_type = 'standard' - super().__init__(ie, model_path, resize_type=resize_type, + super().__init__(model_adapter, resize_type=resize_type, labels=labels, threshold=threshold, iou_threshold=iou_threshold) self._check_io_number(1, 3) - self._output_layer_names = sorted(self.net.outputs) + self._output_layer_names = sorted(self.outputs) def postprocess(self, outputs, meta): heat = outputs[self._output_layer_names[0]][0] diff --git a/demos/common/python/openvino/model_zoo/model_api/models/ctpn.py b/demos/common/python/openvino/model_zoo/model_api/models/ctpn.py index 3e84515422b..6537e3232c1 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/ctpn.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/ctpn.py @@ -17,22 +17,17 @@ import cv2 import numpy as np -from .model import Model +from .detection_model import DetectionModel from .utils import Detection, nms, clip_detections -class CTPN(Model): - def __init__(self, ie, model_path, input_size, threshold=0.9): - super().__init__(ie, model_path) +class CTPN(DetectionModel): + def __init__(self, model_adapter, input_size, threshold=0.9, iou_threshold=0.5): + super().__init__(model_adapter, labels=['Text'], + threshold=threshold, iou_threshold=iou_threshold) self._check_io_number(1, 2) + self.bboxes_blob_name, self.scores_blob_name = self._get_outputs() - self.image_blob_name = self.prepare_inputs() - self.bboxes_blob_name, self.scores_blob_name = self.prepare_outputs() - - self.labels = ['Text'] - - self.boxes_threshold = threshold - self.nms_threshold = 0.5 self.min_size = 8 self.min_ratio = 0.5 self.min_width = 32 @@ -55,22 +50,13 @@ def __init__(self, ie, model_path, input_size, threshold=0.9): self.h1, self.w1 = self.ctpn_keep_aspect_ratio(1200, 600, input_size[1], input_size[0]) self.h2, self.w2 = self.ctpn_keep_aspect_ratio(600, 600, self.w1, self.h1) - default_input_shape = self.net.input_info[self.image_blob_name].input_data.shape + default_input_shape = self.inputs[self.image_blob_name].shape input_shape = {self.image_blob_name: (default_input_shape[:-2] + [self.h2, self.w2])} self.logger.debug('\tReshape model from {} to {}'.format(default_input_shape, input_shape[self.image_blob_name])) - self.net.reshape(input_shape) - - def prepare_inputs(self): - image_blob_name = next(iter(self.net.input_info)) - input_size = self.net.input_info[image_blob_name].input_data.shape - - if len(input_size) != 4 or input_size[1] != 3: - raise RuntimeError("3-channel 4-dimensional model's input is expected") - - return image_blob_name + self.reshape(input_shape) - def prepare_outputs(self): - (boxes_name, boxes_data_repr), (scores_name, scores_data_repr) = self.net.outputs.items() + def _get_outputs(self): + (boxes_name, boxes_data_repr), (scores_name, scores_data_repr) = self.outputs.items() if len(boxes_data_repr.shape) != 4 or len(scores_data_repr.shape) != 4: raise RuntimeError("Unexpected output blob shape. Only 4D output blobs are supported") @@ -187,7 +173,7 @@ def get_proposals(self, rpn_cls_prob_reshape, bbox_deltas, image_size, _feat_str # apply nms keep = nms(proposals[:, 0], proposals[:, 1], proposals[:, 2], proposals[:, 3], scores.reshape(-1), - self.nms_threshold, include_boundaries=True) + self.iou_threshold, include_boundaries=True) if self.post_nms_top_n > 0: keep = keep[:self.post_nms_top_n] proposals, scores = proposals[keep, :], scores[keep] @@ -205,7 +191,7 @@ def get_detections(self, text_proposals, scores, size): heights = (abs(text_recs[:, 5] - text_recs[:, 1]) + abs(text_recs[:, 7] - text_recs[:, 3])) / 2.0 + 1 widths = (abs(text_recs[:, 2] - text_recs[:, 0]) + abs(text_recs[:, 6] - text_recs[:, 4])) / 2.0 + 1 scores = text_recs[:, 8] - keep_inds = np.where((widths / heights > self.min_ratio) & (scores > self.boxes_threshold) & + keep_inds = np.where((widths / heights > self.min_ratio) & (scores > self.threshold) & (widths > self.min_width))[0] return text_recs[keep_inds] diff --git a/demos/common/python/openvino/model_zoo/model_api/models/deblurring.py b/demos/common/python/openvino/model_zoo/model_api/models/deblurring.py index 257c88fb4ff..bc1303f6efa 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/deblurring.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/deblurring.py @@ -15,55 +15,31 @@ import math import numpy as np -from .model import Model +from .image_model import ImageModel -class Deblurring(Model): - def __init__(self, ie, model_path, input_image_shape): - super().__init__(ie, model_path) + +class Deblurring(ImageModel): + def __init__(self, model_adapter, input_image_shape): + super().__init__(model_adapter) + self._check_io_number(1, 1) self.block_size = 32 self.reshape(input_image_shape) - self.input_blob_name = self.prepare_inputs() - self.output_blob_name = self.prepare_outputs() + self.output_blob_name = self._get_outputs() def reshape(self, base_shape): h, w, _ = base_shape new_height = math.ceil(h / self.block_size) * self.block_size new_width = math.ceil(w / self.block_size) * self.block_size - - input_layer = next(iter(self.net.input_info)) - input_shape = self.net.input_info[input_layer].input_data.shape - input_shape[2:] = (new_height, new_width) - self.net.reshape({input_layer: input_shape}) - - def prepare_inputs(self): - input_num = len(self.net.input_info) - if input_num != 1: - raise RuntimeError("Demo supports topologies only with 1 input") - - input_blob_name = next(iter(self.net.input_info)) - input_blob = self.net.input_info[input_blob_name] - input_blob.precision = "FP32" - - input_size = input_blob.input_data.shape - if len(input_size) == 4 and input_size[1] == 3: - self.n, self.c, self.h, self.w = input_size - else: - raise RuntimeError("3-channel 4-dimensional model's input is expected") - - return input_blob_name - - def prepare_outputs(self): - output_num = len(self.net.outputs) - if output_num != 1: - raise RuntimeError("Demo supports topologies only with 1 output") - - output_blob_name = next(iter(self.net.outputs)) - output_blob = self.net.outputs[output_blob_name] - output_blob.precision = "FP32" - - output_size = output_blob.shape + self.h, self.w = new_height, new_width + self.logger.debug("\tReshape model from {} to {}".format( + [self.n, self.c, h, w], [self.n, self.c, self.h, self.w])) + super().reshape({self.image_blob_name: [self.n, self.c, self.h, self.w]}) + + def _get_outputs(self): + output_blob_name = next(iter(self.outputs)) + output_size = self.outputs[output_blob_name].shape if len(output_size) != 4: - raise Exception("Unexpected output blob shape {}. Only 4D output blob is supported".format(output_size)) + raise RuntimeError("Unexpected output blob shape {}. Only 4D output blob is supported".format(output_size)) return output_blob_name @@ -77,13 +53,12 @@ def preprocess(self, inputs): } resized_image = np.pad(image, **pad_params) else: - self.logger.warn("\tChosen model size doesn't match image size. The image is resized") + self.logger.warning("\tChosen model size doesn't match image size. The image is resized") resized_image = cv2.resize(image, (self.w, self.h)) resized_image = resized_image.transpose((2, 0, 1)) resized_image = np.expand_dims(resized_image, 0) - - dict_inputs = {self.input_blob_name: resized_image} + dict_inputs = {self.image_blob_name: resized_image} return dict_inputs, image.shape[1::-1] def postprocess(self, outputs, dsize): diff --git a/demos/common/python/openvino/model_zoo/model_api/models/detection_model.py b/demos/common/python/openvino/model_zoo/model_api/models/detection_model.py index 932505d1f9f..ff92a193521 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/detection_model.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/detection_model.py @@ -29,7 +29,7 @@ class DetectionModel(ImageModel): iou_threshold(float): threshold for NMS detection filtering ''' - def __init__(self, ie, model_path, resize_type=None, + def __init__(self, model_adapter, resize_type=None, labels=None, threshold=None, iou_threshold=None): '''The Detection Model constructor @@ -43,7 +43,7 @@ def __init__(self, ie, model_path, resize_type=None, Raises: RuntimeError: If loaded model has more than one image inputs ''' - super().__init__(ie, model_path, resize_type=resize_type) + super().__init__(model_adapter, resize_type=resize_type) if not self.image_blob_name: raise RuntimeError("The DetectionModel wrappers supports only one image input, but {} found" diff --git a/demos/common/python/openvino/model_zoo/model_api/models/detr.py b/demos/common/python/openvino/model_zoo/model_api/models/detr.py index d6444b54fe3..8ddbc8af69b 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/detr.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/detr.py @@ -20,17 +20,17 @@ class DETR(DetectionModel): - def __init__(self, ie, model_path, resize_type='standard', + def __init__(self, model_adapter, resize_type='standard', labels=None, threshold=0.5, iou_threshold=0.5): if not resize_type: resize_type = 'standard' - super().__init__(ie, model_path, resize_type=resize_type, + super().__init__(model_adapter, resize_type=resize_type, labels=labels, threshold=threshold, iou_threshold=iou_threshold) self._check_io_number(1, 2) self.bboxes_blob_name, self.scores_blob_name = self._get_outputs() def _get_outputs(self): - (bboxes_blob_name, bboxes_layer), (scores_blob_name, scores_layer) = self.net.outputs.items() + (bboxes_blob_name, bboxes_layer), (scores_blob_name, scores_layer) = self.outputs.items() if bboxes_layer.shape[1] != scores_layer.shape[1]: raise RuntimeError("Expected the same second dimension for boxes and scores, but got {} and {}" @@ -42,7 +42,7 @@ def _get_outputs(self): return scores_blob_name, bboxes_blob_name else: raise RuntimeError("Expected shape [:,:,4] for bboxes output, but got {} and {}" - .format(*[output.shape for output in self.net.outputs])) + .format(bboxes_layer.shape, scores_layer.shape)) def postprocess(self, outputs, meta): detections = self._parse_outputs(outputs) diff --git a/demos/common/python/openvino/model_zoo/model_api/models/faceboxes.py b/demos/common/python/openvino/model_zoo/model_api/models/faceboxes.py index f63f0e276ef..25a7139992d 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/faceboxes.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/faceboxes.py @@ -22,12 +22,13 @@ class FaceBoxes(DetectionModel): - def __init__(self, ie, model_path, resize_type='standard', + def __init__(self, model_adapter, resize_type='standard', labels=None, threshold=0.5, iou_threshold=0.3): if not resize_type: resize_type = 'standard' - super().__init__(ie, model_path, resize_type=resize_type, + super().__init__(model_adapter, resize_type=resize_type, labels=labels, threshold=threshold, iou_threshold=iou_threshold) + self._check_io_number(1, 2) if not self.labels: self.labels = ['Face'] self.bboxes_blob_name, self.scores_blob_name = self._get_outputs() @@ -37,21 +38,19 @@ def __init__(self, ie, model_path, resize_type='standard', self.keep_top_k = 750 def _get_outputs(self): - bboxes_blob_name = None - scores_blob_name = None - for name, layer in self.net.outputs.items(): - if layer.shape[2] == 4: - bboxes_blob_name = name - elif layer.shape[2] == 2: - scores_blob_name = name - else: - raise RuntimeError("Expected shapes [:,:,4] and [:,:2] for outputs, but got {} and {}" - .format(*[output.shape for output in self.net.outputs])) - if self.net.outputs[bboxes_blob_name].shape[1] != self.net.outputs[scores_blob_name].shape[1]: + (bboxes_blob_name, bboxes_layer), (scores_blob_name, scores_layer) = self.outputs.items() + + if bboxes_layer.shape[1] != scores_layer.shape[1]: raise RuntimeError("Expected the same second dimension for boxes and scores, but got {} and {}" - .format(self.net.outputs[bboxes_blob_name].shape, - self.net.outputs[scores_blob_name].shape)) - return bboxes_blob_name, scores_blob_name + .format(bboxes_layer.shape, scores_layer.shape)) + + if bboxes_layer.shape[2] == 4: + return bboxes_blob_name, scores_blob_name + elif scores_layer.shape[2] == 4: + return scores_blob_name, bboxes_blob_name + else: + raise RuntimeError("Expected shape [:,:,4] for bboxes output, but got {} and {}" + .format(bboxes_layer.shape, scores_layer.shape)) def postprocess(self, outputs, meta): detections = self._parse_outputs(outputs, meta) diff --git a/demos/common/python/openvino/model_zoo/model_api/models/hpe_associative_embedding.py b/demos/common/python/openvino/model_zoo/model_api/models/hpe_associative_embedding.py index 9f2880ab20d..b999f5d624b 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/hpe_associative_embedding.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/hpe_associative_embedding.py @@ -17,25 +17,23 @@ import numpy as np from scipy.optimize import linear_sum_assignment -from .model import Model +from .image_model import ImageModel from .utils import resize_image -class HpeAssociativeEmbedding(Model): - def __init__(self, ie, model_path, target_size, aspect_ratio, prob_threshold, delta=0.0, size_divisor=32, padding_mode='right_bottom'): - super().__init__(ie, model_path) - self.image_blob_name = self._get_inputs(self.net) - self.heatmaps_blob_name = find_layer_by_name('heatmaps', self.net.outputs) +class HpeAssociativeEmbedding(ImageModel): + def __init__(self, model_adapter, target_size, aspect_ratio, prob_threshold, delta=0.0, size_divisor=32, padding_mode='right_bottom'): + super().__init__(model_adapter) + self.heatmaps_blob_name = find_layer_by_name('heatmaps', self.outputs) try: - self.nms_heatmaps_blob_name = find_layer_by_name('nms_heatmaps', self.net.outputs) + self.nms_heatmaps_blob_name = find_layer_by_name('nms_heatmaps', self.outputs) except ValueError: self.nms_heatmaps_blob_name = self.heatmaps_blob_name - self.embeddings_blob_name = find_layer_by_name('embeddings', self.net.outputs) - self.output_scale = self.net.input_info[self.image_blob_name].input_data.shape[-1] / self.net.outputs[self.heatmaps_blob_name].shape[-1] + self.embeddings_blob_name = find_layer_by_name('embeddings', self.outputs) + self.output_scale = self.w / self.outputs[self.heatmaps_blob_name].shape[-1] if target_size is None: - h, w = self.net.input_info[self.image_blob_name].input_data.shape[-2:] - target_size = min(h, w) + target_size = min(self.h, self.w) self.index_of_max_dimension = 0 if aspect_ratio >= 1.0: # img width >= height input_height, input_width = target_size, round(target_size * aspect_ratio) @@ -44,13 +42,13 @@ def __init__(self, ie, model_path, target_size, aspect_ratio, prob_threshold, de input_height, input_width = round(target_size / aspect_ratio), target_size self.h = (input_height + size_divisor - 1) // size_divisor * size_divisor self.w = (input_width + size_divisor - 1) // size_divisor * size_divisor - default_input_shape = self.net.input_info[self.image_blob_name].input_data.shape - input_shape = {self.image_blob_name: (default_input_shape[:-2] + [self.h, self.w])} + default_input_shape = self.inputs[self.image_blob_name].shape + input_shape = {self.image_blob_name: [self.n, self.c, self.h, self.w]} self.logger.debug('\tReshape model from {} to {}'.format(default_input_shape, input_shape[self.image_blob_name])) - self.net.reshape(input_shape) + super().reshape(input_shape) self.decoder = AssociativeEmbeddingDecoder( - num_joints=self.net.outputs[self.heatmaps_blob_name].shape[1], + num_joints=self.outputs[self.heatmaps_blob_name].shape[1], adjust=True, refine=True, delta=delta, @@ -64,24 +62,11 @@ def __init__(self, ie, model_path, target_size, aspect_ratio, prob_threshold, de self.size_divisor = size_divisor self.padding_mode = padding_mode - @staticmethod - def _get_inputs(net): - image_blob_name = None - for blob_name, blob in net.input_info.items(): - if len(blob.input_data.shape) == 4: - image_blob_name = blob_name - else: - raise RuntimeError('Unsupported {}D input layer "{}". Only 4D input layers are supported' - .format(len(blob.shape), blob_name)) - if image_blob_name is None: - raise RuntimeError('Failed to identify the input for the image.') - return image_blob_name - def preprocess(self, inputs): img = resize_image(inputs, (self.w, self.h), keep_aspect_ratio=True) h, w = img.shape[:2] if not (self.h - self.size_divisor < h <= self.h and self.w - self.size_divisor < w <= self.w): - self.logger.warn("\tChosen model aspect ratio doesn't match image aspect ratio") + self.logger.warning("\tChosen model aspect ratio doesn't match image aspect ratio") resize_img_scale = np.array((inputs.shape[1] / w, inputs.shape[0] / h), np.float32) if self.padding_mode == 'center': diff --git a/demos/common/python/openvino/model_zoo/model_api/models/image_model.py b/demos/common/python/openvino/model_zoo/model_api/models/image_model.py index e7636131ec6..29c0b51a8a8 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/image_model.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/image_model.py @@ -13,8 +13,9 @@ See the License for the specific language governing permissions and limitations under the License. """ + from .model import Model -from .utils import RESIZE_TYPES, pad_image +from .utils import RESIZE_TYPES, pad_image, InputTransform class ImageModel(Model): @@ -31,33 +32,39 @@ class ImageModel(Model): image_blob_name(str): name of image input (None, if they are many) ''' - def __init__(self, ie, model_path, resize_type=None): + def __init__(self, model_adapter, resize_type=None): '''Image model constructor Calls the `Model` constructor first Args: + model_adapter(ModelAdapter): allows working with the specified executor resize_type(str): sets the type for image resizing (see ``RESIZE_TYPE`` for info) ''' - super().__init__(ie, model_path) + super().__init__(model_adapter) self.image_blob_names, self.image_info_blob_names = self._get_inputs() self.image_blob_name = self.image_blob_names[0] if len(self.image_blob_names) == 1 else None if self.image_blob_name: - self.n, self.c, self.h, self.w = self.net.input_info[self.image_blob_name].input_data.shape + self.n, self.c, self.h, self.w = self.inputs[self.image_blob_name].shape + self.image_layout = 'NCHW' if not resize_type: - self.logger.warn('The resizer isn\'t set. The "standard" will be used') + self.logger.warning('The resizer isn\'t set. The "standard" will be used') resize_type = 'standard' self.resize_type = resize_type self.resize = RESIZE_TYPES[self.resize_type] + self.input_transform = InputTransform() + + def set_inputs_preprocessing(self, reverse_input_channels, mean_values, scale_values): + self.input_transform = InputTransform(reverse_input_channels, mean_values, scale_values) def _get_inputs(self): image_blob_names, image_info_blob_names = [], [] - for blob_name, blob in self.net.input_info.items(): - if len(blob.input_data.shape) == 4: - image_blob_names.append(blob_name) - elif len(blob.input_data.shape) == 2: - image_info_blob_names.append(blob_name) + for name, metadata in self.inputs.items(): + if len(metadata.shape) == 4: + image_blob_names.append(name) + elif len(metadata.shape) == 2: + image_info_blob_names.append(name) else: raise RuntimeError('Failed to identify the input for ImageModel: only 2D and 4D input layer supported') if not image_blob_names: @@ -83,7 +90,7 @@ def preprocess(self, inputs): inputs: single image as 3D array in HWC layout Returns: - - The dict with processed image data + - the dict with preprocessed image data - The dict with metadata ''' image = inputs diff --git a/demos/common/python/openvino/model_zoo/model_api/models/model.py b/demos/common/python/openvino/model_zoo/model_api/models/model.py index 098113093de..4ad9c1bf7fa 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/model.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/model.py @@ -15,7 +15,6 @@ """ import logging as log -from .utils import InputTransform class Model: @@ -25,25 +24,20 @@ class Model: The ``preprocess`` and ``postprocess`` method should be implemented in concrete class Attributes: - net(CNNNetwork): loaded network + model_adapter(ModelAdapter): allows working with the specified executor logger(Logger): instance of the logger ''' - def __init__(self, ie, model_path): + def __init__(self, model_adapter): '''Abstract model constructor Args: - ie(openvino.core): instance of Inference Engine core, needs for model loading - model_path(str, Path): path to model's *.xml or *.onnx file + model_adapter(ModelAdapter): allows working with the specified executor ''' self.logger = log.getLogger() - self.net = ie.read_network(model_path) - self.inputs = self.net.input_info - self.outputs = self.net.outputs - self.input_transform = InputTransform() - - def set_inputs_preprocessing(self, reverse_input_channels, mean_values, scale_values): - self.input_transform = InputTransform(reverse_input_channels, mean_values, scale_values) + self.model_adapter = model_adapter + self.inputs = self.model_adapter.get_input_layers() + self.outputs = self.model_adapter.get_output_layers() def preprocess(self, inputs): '''Interface for preprocess method @@ -78,23 +72,62 @@ def _check_io_number(self, number_of_inputs, number_of_outputs): if not isinstance(number_of_inputs, tuple): if len(self.inputs) != number_of_inputs and number_of_inputs != -1: raise RuntimeError("Expected {} input blob{}, but {} found: {}".format( - number_of_inputs, 's' if number_of_inputs !=1 else '', len(self.inputs), ', '.join(self.inputs) + number_of_inputs, 's' if number_of_inputs !=1 else '', + len(self.inputs), ', '.join(self.inputs) )) else: if not len(self.inputs) in number_of_inputs: raise RuntimeError("Expected {} or {} input blobs, but {} found: {}".format( - ', '.join(str(n) for n in number_of_inputs[:-1]), int(number_of_inputs[-1]), len(self.inputs), - ', '.join(self.inputs) + ', '.join(str(n) for n in number_of_inputs[:-1]), int(number_of_inputs[-1]), + len(self.inputs), ', '.join(self.inputs) )) if not isinstance(number_of_outputs, tuple): if len(self.outputs) != number_of_outputs and number_of_outputs != -1: raise RuntimeError("Expected {} output blob{}, but {} found: {}".format( - number_of_outputs, 's' if number_of_outputs !=1 else '', len(self.outputs), ', '.join(self.outputs) + number_of_outputs, 's' if number_of_outputs !=1 else '', + len(self.outputs), ', '.join(self.outputs) )) else: if not len(self.outputs) in number_of_outputs: raise RuntimeError("Expected {} or {} output blobs, but {} found: {}".format( - ', '.join(str(n) for n in number_of_outputs[:-1]), int(number_of_outputs[-1]), len(self.outputs), - ', '.join(self.outputs) + ', '.join(str(n) for n in number_of_outputs[:-1]), int(number_of_outputs[-1]), + len(self.outputs), ', '.join(self.outputs) )) + + def __call__(self, input_data): + ''' + Applies the preprocessing, synchronous inference and postprocessing method of model wrapper + ''' + dict_data, input_meta = self.preprocess(input_data) + raw_result = self.infer_sync(dict_data) + return self.postprocess(raw_result, input_meta) + + def load(self): + self.model_adapter.load_model() + + def reshape(self, new_shape): + self.model_adapter.reshape_model(new_shape) + self.inputs = self.model_adapter.get_input_layers() + self.outputs = self.model_adapter.get_output_layers() + + def infer_sync(self, dict_data): + return self.model_adapter.infer_sync(dict_data) + + def infer_async(self, dict_data, callback_fn, callback_data): + self.model_adapter.infer_async(dict_data, callback_fn, callback_data) + + def is_ready(self): + return self.model_adapter.is_ready() + + def await_all(self): + self.model_adapter.await_all() + + def await_any(self): + self.model_adapter.await_any() + + def log_layers_info(self): + for name, metadata in self.inputs.items(): + log.info('\tInput layer: {}, shape: {}, precision: {}'.format(name, metadata.shape, metadata.precision)) + for name, metadata in self.outputs.items(): + log.info('\tOutput layer: {}, shape: {}, precision: {}'.format(name, metadata.shape, metadata.precision)) diff --git a/demos/common/python/openvino/model_zoo/model_api/models/monodepth.py b/demos/common/python/openvino/model_zoo/model_api/models/monodepth.py new file mode 100644 index 00000000000..1da77d7d21a --- /dev/null +++ b/demos/common/python/openvino/model_zoo/model_api/models/monodepth.py @@ -0,0 +1,37 @@ +""" + Copyright (C) 2018-2021 Intel Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +""" + +import cv2 + +from .segmentation import SegmentationModel + + +class MonoDepthModel(SegmentationModel): + def postprocess(self, outputs, meta): + result = outputs[self.output_blob_name].squeeze() + input_image_height = meta['original_shape'][0] + input_image_width = meta['original_shape'][1] + + result = cv2.resize(result, (input_image_width, input_image_height), interpolation=cv2.INTER_CUBIC) + + disp_min = result.min() + disp_max = result.max() + if disp_max - disp_min > 1e-6: + result = (result - disp_min) / (disp_max - disp_min) + else: + result.fill(0.5) + + return result diff --git a/demos/common/python/openvino/model_zoo/model_api/models/open_pose.py b/demos/common/python/openvino/model_zoo/model_api/models/open_pose.py index 62476592e5f..ea3fee50454 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/open_pose.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/open_pose.py @@ -23,18 +23,17 @@ from numpy import clip from openvino.inference_engine import IENetwork -from .model import Model +from .image_model import ImageModel -class OpenPose(Model): - def __init__(self, ie, model_path, target_size, aspect_ratio, prob_threshold, size_divisor=8, upsample_ratio=1): - super().__init__(ie, model_path) - self.image_blob_name = self._get_inputs(self.net) +class OpenPose(ImageModel): + def __init__(self, model_adapter, target_size, aspect_ratio, prob_threshold, size_divisor=8, upsample_ratio=1): + super().__init__(model_adapter) self.pooled_heatmaps_blob_name = 'pooled_heatmaps' self.heatmaps_blob_name = 'heatmaps' self.pafs_blob_name = 'pafs' - function = ng.function_from_cnn(self.net) + function = ng.function_from_cnn(self.model_adapter.net) paf = function.get_output_op(0) paf_shape = paf.outputs()[0].get_shape() heatmap = function.get_output_op(1) @@ -65,37 +64,27 @@ def __init__(self, ie, model_path, target_size, aspect_ratio, prob_threshold, si ng.result(pooled_heatmap, name=self.pooled_heatmaps_blob_name), ng.result(paf, name=self.pafs_blob_name)], function.get_parameters(), 'hpe') - self.net = IENetwork(ng.impl.Function.to_capsule(f)) - self.output_scale = self.net.input_info[self.image_blob_name].input_data.shape[-2] / self.net.outputs[self.heatmaps_blob_name].shape[-2] + self.model_adapter.net = IENetwork(ng.impl.Function.to_capsule(f)) + self.inputs = self.model_adapter.get_input_layers() + self.outputs = self.model_adapter.get_output_layers() + + self.output_scale = self.inputs[self.image_blob_name].shape[-2] / self.outputs[self.heatmaps_blob_name].shape[-2] if target_size is None: - target_size = self.net.input_info[self.image_blob_name].input_data.shape[-2] + target_size = self.inputs[self.image_blob_name].shape[-2] self.h = (target_size + size_divisor - 1) // size_divisor * size_divisor input_width = round(target_size * aspect_ratio) self.w = (input_width + size_divisor - 1) // size_divisor * size_divisor - default_input_shape = self.net.input_info[self.image_blob_name].input_data.shape + default_input_shape = self.inputs[self.image_blob_name].shape input_shape = {self.image_blob_name: (default_input_shape[:-2] + [self.h, self.w])} self.logger.debug('\tReshape model from {} to {}'.format(default_input_shape, input_shape[self.image_blob_name])) - self.net.reshape(input_shape) + super().reshape(input_shape) - num_joints = self.net.outputs[self.heatmaps_blob_name].shape[1] - 1 # The last channel is for background + num_joints = self.outputs[self.heatmaps_blob_name].shape[1] - 1 # The last channel is for background self.decoder = OpenPoseDecoder(num_joints, score_threshold=prob_threshold) self.size_divisor = size_divisor - @staticmethod - def _get_inputs(net): - image_blob_name = None - for blob_name, blob in net.input_info.items(): - if len(blob.input_data.shape) == 4: - image_blob_name = blob_name - else: - raise RuntimeError('Unsupported {}D input layer "{}". Only 2D and 4D input layers are supported' - .format(len(blob.shape), blob_name)) - if image_blob_name is None: - raise RuntimeError('Failed to identify the input for the image.') - return image_blob_name - @staticmethod def heatmap_nms(heatmaps, pooled_heatmaps): return heatmaps * (heatmaps == pooled_heatmaps) @@ -112,7 +101,7 @@ def preprocess(self, inputs): if self.w < w: raise RuntimeError("The image aspect ratio doesn't fit current model shape") if not (self.w - self.size_divisor < w <= self.w): - self.logger.warn("\tChosen model aspect ratio doesn't match image aspect ratio") + self.logger.warning("\tChosen model aspect ratio doesn't match image aspect ratio") resize_img_scale = np.array((inputs.shape[1] / w, inputs.shape[0] / h), np.float32) img = np.pad(img, ((0, 0), (0, self.w - w), (0, 0)), diff --git a/demos/common/python/openvino/model_zoo/model_api/models/retinaface.py b/demos/common/python/openvino/model_zoo/model_api/models/retinaface.py index 0cbc2522f58..97aaf803012 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/retinaface.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/retinaface.py @@ -24,24 +24,22 @@ class RetinaFace(DetectionModel): - def __init__(self, ie, model_path, resize_type='standard', + def __init__(self, model_adapter, resize_type='standard', labels=None, threshold=0.5, iou_threshold=0.5): if not resize_type: resize_type = 'standard' - super().__init__(ie, model_path, resize_type=resize_type, + super().__init__(model_adapter, resize_type=resize_type, labels=labels, threshold=threshold, iou_threshold=iou_threshold) self._check_io_number(1, (6, 9, 12)) - self.detect_masks = len(self.net.outputs) == 12 - self.process_landmarks = len(self.net.outputs) > 6 + self.detect_masks = len(self.outputs) == 12 + self.process_landmarks = len(self.outputs) > 6 self.mask_threshold = 0.5 self.postprocessor = RetinaFacePostprocessor(detect_attributes=self.detect_masks, process_landmarks=self.process_landmarks) self.labels = ['Face'] if not self.detect_masks else ['Mask', 'No mask'] - self._output_layer_names = self.net.outputs - self.n, self.c, self.h, self.w = self.net.input_info[self.image_blob_name].input_data.shape def postprocess(self, outputs, meta): scale_x = meta['resized_shape'][1] / meta['original_shape'][1] @@ -52,22 +50,19 @@ def postprocess(self, outputs, meta): class RetinaFacePyTorch(DetectionModel): - def __init__(self, ie, model_path, resize_type='standard', + def __init__(self, model_adapter, resize_type='standard', labels=None, threshold=0.5, iou_threshold=0.5): if not resize_type: resize_type = 'standard' - super().__init__(ie, model_path, resize_type=resize_type, + super().__init__(model_adapter, resize_type=resize_type, labels=labels, threshold=threshold, iou_threshold=iou_threshold) self._check_io_number(1, (2, 3)) - self.process_landmarks = len(self.net.outputs) == 3 + self.process_landmarks = len(self.outputs) == 3 self.postprocessor = RetinaFacePyTorchPostprocessor(process_landmarks=self.process_landmarks) self.labels = ['Face'] - self._output_layer_names = self.net.outputs - self.n, self.c, self.h, self.w = self.net.input_info[self.image_blob_name].input_data.shape - def postprocess(self, outputs, meta): scale_x = meta['resized_shape'][1] / meta['original_shape'][1] scale_y = meta['resized_shape'][0] / meta['original_shape'][0] diff --git a/demos/common/python/openvino/model_zoo/model_api/models/segmentation.py b/demos/common/python/openvino/model_zoo/model_api/models/segmentation.py index 4fe9437f3a0..d9f5458a394 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/segmentation.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/segmentation.py @@ -22,9 +22,8 @@ class SegmentationModel(ImageModel): - def __init__(self, ie, model_path, resize_type='standard', - labels=None): - super().__init__(ie, model_path, resize_type=resize_type) + def __init__(self, model_adapter, resize_type='standard', labels=None): + super().__init__(model_adapter, resize_type=resize_type) self._check_io_number(1, 1) if isinstance(labels, (list, tuple)): self.labels = labels @@ -34,18 +33,17 @@ def __init__(self, ie, model_path, resize_type='standard', self.output_blob_name = self._get_outputs() def _get_outputs(self): - blob_name = next(iter(self.net.outputs)) - blob = self.net.outputs[blob_name] + layer_name = next(iter(self.outputs)) + layer_shape = self.outputs[layer_name].shape - out_size = blob.shape - if len(out_size) == 3: + if len(layer_shape) == 3: self.out_channels = 0 - elif len(out_size) == 4: - self.out_channels = out_size[1] + elif len(layer_shape) == 4: + self.out_channels = layer_shape[1] else: - raise Exception("Unexpected output blob shape {}. Only 4D and 3D output blobs are supported".format(out_size)) + raise Exception("Unexpected output layer shape {}. Only 4D and 3D output layers are supported".format(layer_shape)) - return blob_name + return layer_name def postprocess(self, outputs, meta): predictions = outputs[self.output_blob_name].squeeze() diff --git a/demos/common/python/openvino/model_zoo/model_api/models/ssd.py b/demos/common/python/openvino/model_zoo/model_api/models/ssd.py index 1ab06526f50..c88945a1c44 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/ssd.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/ssd.py @@ -20,17 +20,17 @@ class SSD(DetectionModel): - def __init__(self, ie, model_path, resize_type='standard', + def __init__(self, model_adapter, resize_type='standard', labels=None, threshold=0.5, iou_threshold=0.5): if not resize_type: resize_type = 'standard' - super().__init__(ie, model_path, resize_type=resize_type, + super().__init__(model_adapter, resize_type=resize_type, labels=labels, threshold=threshold, iou_threshold=iou_threshold) self.image_info_blob_name = self.image_info_blob_names[0] if len(self.image_info_blob_names) == 1 else None - self.output_parser = self._get_output_parser(self.net, self.image_blob_name) + self.output_parser = self._get_output_parser(self.image_blob_name) def preprocess(self, inputs): - dict_inputs, meta = super().preprocess(inputs) + dict_inputs, meta = super().preprocess(inputs) if self.image_info_blob_name: dict_inputs[self.image_info_blob_name] = [self.h, self.w, 1] return dict_inputs, meta @@ -40,23 +40,23 @@ def postprocess(self, outputs, meta): detections = self._resize_detections(detections, meta) return detections - def _get_output_parser(self, net, image_blob_name, bboxes='bboxes', labels='labels', scores='scores'): + def _get_output_parser(self, image_blob_name, bboxes='bboxes', labels='labels', scores='scores'): try: - parser = SingleOutputParser(net.outputs) + parser = SingleOutputParser(self.outputs) self.logger.debug('\tUsing SSD model with single output parser') return parser except ValueError: pass try: - parser = MultipleOutputParser(net.outputs, bboxes, scores, labels) + parser = MultipleOutputParser(self.outputs, bboxes, scores, labels) self.logger.debug('\tUsing SSD model with multiple output parser') return parser except ValueError: pass try: - parser = BoxesLabelsParser(net.outputs, net.input_info[image_blob_name].input_data.shape[2:][::-1]) + parser = BoxesLabelsParser(self.outputs, self.inputs[image_blob_name].shape[2:][::-1]) self.logger.debug('\tUsing SSD model with "boxes-labels" output parser') return parser except ValueError: @@ -87,7 +87,7 @@ def __init__(self, all_outputs): if len(all_outputs) != 1: raise ValueError('Network must have only one output.') self.output_name, output_data = next(iter(all_outputs.items())) - last_dim = np.shape(output_data)[-1] + last_dim = output_data.shape[-1] if last_dim != 7: raise ValueError('The last dimension of the output blob must be equal to 7, ' 'got {} instead.'.format(last_dim)) @@ -123,7 +123,7 @@ def __init__(self, layers, input_size, labels_layer='labels', default_label=0): @staticmethod def find_layer_bboxes_output(layers): - filter_outputs = [name for name, data in layers.items() if len(np.shape(data)) == 2 and np.shape(data)[-1] == 5] + filter_outputs = [name for name, data in layers.items() if len(data.shape) == 2 and data.shape[-1] == 5] if not filter_outputs: raise ValueError('Suitable output with bounding boxes is not found') if len(filter_outputs) > 1: diff --git a/demos/common/python/openvino/model_zoo/model_api/models/ultra_lightweight_face_detection.py b/demos/common/python/openvino/model_zoo/model_api/models/ultra_lightweight_face_detection.py index a8294b1c364..ca05c6d0451 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/ultra_lightweight_face_detection.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/ultra_lightweight_face_detection.py @@ -20,32 +20,30 @@ class UltraLightweightFaceDetection(DetectionModel): - def __init__(self, ie, model_path, resize_type='standard', + def __init__(self, model_adapter, resize_type='standard', labels=None, threshold=0.5, iou_threshold=0.5): if not resize_type: resize_type = 'standard' - super().__init__(ie, model_path, resize_type=resize_type, + super().__init__(model_adapter, resize_type=resize_type, labels=labels, threshold=threshold, iou_threshold=iou_threshold) self._check_io_number(1, 2) self.labels = ['Face'] self.bboxes_blob_name, self.scores_blob_name = self._get_outputs() def _get_outputs(self): - bboxes_blob_name = None - scores_blob_name = None - for name, layer in self.net.outputs.items(): - if layer.shape[2] == 4: - bboxes_blob_name = name - elif layer.shape[2] == 2: - scores_blob_name = name - else: - raise RuntimeError("Expected shapes [:,:,4] and [:,:2] for outputs, but got {} and {}" - .format(*[output.shape for output in self.net.outputs])) - if self.net.outputs[bboxes_blob_name].shape[1] != self.net.outputs[scores_blob_name].shape[1]: + (bboxes_blob_name, bboxes_layer), (scores_blob_name, scores_layer) = self.outputs.items() + + if bboxes_layer.shape[1] != scores_layer.shape[1]: raise RuntimeError("Expected the same second dimension for boxes and scores, but got {} and {}" - .format(self.net.outputs[bboxes_blob_name].shape, - self.net.outputs[scores_blob_name].shape)) - return bboxes_blob_name, scores_blob_name + .format(bboxes_layer.shape, scores_layer.shape)) + + if bboxes_layer.shape[2] == 4: + return bboxes_blob_name, scores_blob_name + elif scores_layer.shape[2] == 4: + return scores_blob_name, bboxes_blob_name + else: + raise RuntimeError("Expected shape [:,:,4] for bboxes output, but got {} and {}" + .format(bboxes_layer.shape, scores_layer.shape)) def postprocess(self, outputs, meta): detections = self._parse_outputs(outputs, meta) diff --git a/demos/common/python/openvino/model_zoo/model_api/models/utils.py b/demos/common/python/openvino/model_zoo/model_api/models/utils.py index 7458635f5aa..31ec67d5784 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/utils.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/utils.py @@ -103,18 +103,18 @@ def load_labels(label_file): return labels_map -def resize_image(image, size, keep_aspect_ratio=False): +def resize_image(image, size, keep_aspect_ratio=False, interpolation=cv2.INTER_LINEAR): if not keep_aspect_ratio: - resized_frame = cv2.resize(image, size) + resized_frame = cv2.resize(image, size, interpolation=interpolation) else: h, w = image.shape[:2] scale = min(size[1] / h, size[0] / w) - resized_frame = cv2.resize(image, None, fx=scale, fy=scale) + resized_frame = cv2.resize(image, None, fx=scale, fy=scale, interpolation=interpolation) return resized_frame -def resize_image_with_aspect(image, size): - return resize_image(image, size, keep_aspect_ratio=True) +def resize_image_with_aspect(image, size, interpolation=cv2.INTER_LINEAR): + return resize_image(image, size, keep_aspect_ratio=True, interpolation=interpolation) def pad_image(image, size): @@ -125,13 +125,13 @@ def pad_image(image, size): return image -def resize_image_letterbox(image, size): +def resize_image_letterbox(image, size, interpolation=cv2.INTER_LINEAR): ih, iw = image.shape[0:2] w, h = size scale = min(w / iw, h / ih) nw = int(iw * scale) nh = int(ih * scale) - image = cv2.resize(image, (nw, nh)) + image = cv2.resize(image, (nw, nh), interpolation=interpolation) dx = (w - nw) // 2 dy = (h - nh) // 2 resized_image = np.pad(image, ((dy, dy + (h - nh) % 2), (dx, dx + (w - nw) % 2), (0, 0)), @@ -146,6 +146,14 @@ def resize_image_letterbox(image, size): } +INTERPOLATION_TYPES = { + 'LINEAR': cv2.INTER_LINEAR, + 'CUBIC': cv2.INTER_CUBIC, + 'NEAREST': cv2.INTER_NEAREST, + 'AREA': cv2.INTER_AREA, +} + + def nms(x1, y1, x2, y2, scores, thresh, include_boundaries=False, keep_top_k=None): b = 1 if include_boundaries else 0 areas = (x2 - x1 + b) * (y2 - y1 + b) diff --git a/demos/common/python/openvino/model_zoo/model_api/models/yolo.py b/demos/common/python/openvino/model_zoo/model_api/models/yolo.py index d0da77b2485..0f4df160f6d 100644 --- a/demos/common/python/openvino/model_zoo/model_api/models/yolo.py +++ b/demos/common/python/openvino/model_zoo/model_api/models/yolo.py @@ -13,11 +13,9 @@ from collections import namedtuple import numpy as np -import ngraph -from .model import Model from .detection_model import DetectionModel -from .utils import Detection, clip_detections, load_labels, nms, resize_image +from .utils import Detection, clip_detections, nms, resize_image, INTERPOLATION_TYPES DetectionBox = namedtuple('DetectionBox', ["x", "y", "w", "h"]) @@ -73,37 +71,41 @@ def __init__(self, param, sides): self.use_input_size = True # Weak way to determine but the only one. - def __init__(self, ie, model_path, resize_type='fit_to_window_letterbox', + def __init__(self, model_adapter, resize_type='fit_to_window_letterbox', labels=None, threshold=0.5, iou_threshold=0.5): if not resize_type: resize_type = 'fit_to_window_letterbox' - super().__init__(ie, model_path, resize_type, + super().__init__(model_adapter, resize_type, labels=labels, threshold=threshold, iou_threshold=iou_threshold) - self.is_tiny = self.net.name.lower().find('tiny') != -1 # Weak way to distinguish between YOLOv4 and YOLOv4-tiny + self.is_tiny = len(self.outputs) == 2 # Weak way to distinguish between YOLOv4 and YOLOv4-tiny self._check_io_number(1, -1) - if self.net.input_info[self.image_blob_name].input_data.shape[1] == 3: - self.n, self.c, self.h, self.w = self.net.input_info[self.image_blob_name].input_data.shape + if self.inputs[self.image_blob_name].shape[1] == 3: + self.n, self.c, self.h, self.w = self.inputs[self.image_blob_name].shape self.image_layout = 'NCHW' else: - self.n, self.h, self.w, self.c = self.net.input_info[self.image_blob_name].input_data.shape + self.n, self.h, self.w, self.c = self.inputs[self.image_blob_name].shape self.image_layout = 'NHWС' self.yolo_layer_params = self._get_output_info() def _get_output_info(self): - def get_parent(node): - return node.inputs()[0].get_source_output().get_node() - ng_func = ngraph.function_from_cnn(self.net) output_info = {} - for node in ng_func.get_ordered_ops(): - layer_name = node.get_friendly_name() - if layer_name not in self.net.outputs: - continue - shape = list(get_parent(node).shape) - yolo_params = self.Params(node._get_attributes(), shape[2:4]) - output_info[layer_name] = (shape, yolo_params) + for name, info in self.outputs.items(): + shape = info.shape + if len(shape) == 2: + # we use 32x32 cell as default, cause 1D tensor is V2 specific + cx = self.w // 32 + cy = self.h // 32 + + bboxes = shape[1] // (cx*cy) + print(cx, cy, bboxes, self.w) + if self.w % 32 != 0 or self.h % 32 !=0 or shape[1] % (cx*cy) != 0: + raise RuntimeError('The Yolo wrapper cannot reshape 2D output') + shape = (shape[0], bboxes, cy, cx) + params = self.Params(info.meta, shape[2:4]) + output_info[name] = (shape, params) return output_info def postprocess(self, outputs, meta): @@ -230,12 +232,12 @@ def __init__(self, classes, num, sides, anchors, mask): self.anchors = masked_anchors self.use_input_size = True - def __init__(self, ie, model_path, resize_type='fit_to_window_letterbox', + def __init__(self, model_adapter, resize_type='fit_to_window_letterbox', labels=None, threshold=0.5, iou_threshold=0.5, anchors=None, masks=None): self.anchors = anchors self.masks = masks - super().__init__(ie, model_path, resize_type, + super().__init__(model_adapter, resize_type, labels=labels, threshold=threshold, iou_threshold=iou_threshold) def _get_output_info(self): @@ -244,7 +246,7 @@ def _get_output_info(self): if not self.masks: self.masks = [1, 2, 3, 3, 4, 5] if self.is_tiny else [0, 1, 2, 3, 4, 5, 6, 7, 8] - outputs = sorted(self.net.outputs.items(), key=lambda x: x[1].shape[2], reverse=True) + outputs = sorted(self.outputs.items(), key=lambda x: x[1].shape[2], reverse=True) output_info = {} num = 3 @@ -284,9 +286,9 @@ def __init__(self, classes, num, sides, anchors): self.anchors = anchors self.use_input_size = True - def __init__(self, ie, model_path, resize_type='standard', + def __init__(self, model_adapter, resize_type='standard', labels=None, threshold=0.5, iou_threshold=0.5): - super().__init__(ie, model_path, resize_type, + super().__init__(model_adapter, resize_type, labels=labels, threshold=threshold, iou_threshold=iou_threshold) def _get_output_info(self): @@ -294,7 +296,7 @@ def _get_output_info(self): output_info = {} num = 6 - for i, (name, layer) in enumerate(self.net.outputs.items()): + for i, (name, layer) in enumerate(self.outputs.items()): shape = layer.shape classes = shape[1] // num - 4 yolo_params = self.Params(classes, num, shape[2:4], anchors) @@ -317,23 +319,13 @@ def _get_absolute_det_box(box, row, col, anchors, coord_normalizer, size_normali return DetectionBox(x, y, width, height) -class YOLOX(Model): - def __init__(self, ie, model_path, labels=None, threshold=0.5): - super().__init__(ie, model_path) +class YOLOX(DetectionModel): + def __init__(self, model_adapter, labels=None, threshold=0.5, iou_threshold=0.65): + super().__init__(model_adapter, labels=labels, + threshold=threshold, iou_threshold=iou_threshold) self._check_io_number(1, 1) - self.image_blob_name = next(iter(self.net.input_info)) - self.output_blob_name = next(iter(self.net.outputs)) - - self.n, self.c, self.h, self.w = self.net.input_info[self.image_blob_name].input_data.shape - assert self.c == 3, "Expected 3-channel input" - - if isinstance(labels, (list, tuple)): - self.labels = labels - else: - self.labels = load_labels(labels) if labels else None + self.output_blob_name = next(iter(self.outputs)) - self.threshold = threshold - self.nms_threshold = 0.65 self.expanded_strides = [] self.grids = [] self.set_strides_grids() @@ -370,7 +362,7 @@ def postprocess(self, outputs, meta): x_mins, y_mins, x_maxs, y_maxs = boxes[i].T scores = valid_predictions[i, j + 5] - keep_nms = nms(x_mins, y_mins, x_maxs, y_maxs, scores, self.nms_threshold, include_boundaries=True) + keep_nms = nms(x_mins, y_mins, x_maxs, y_maxs, scores, self.iou_threshold, include_boundaries=True) detections = [Detection(*det) for det in zip(x_mins[keep_nms], y_mins[keep_nms], x_maxs[keep_nms], y_maxs[keep_nms], scores[keep_nms], j[keep_nms])] @@ -403,3 +395,82 @@ def xywh2xyxy(x): y[:, 2] = x[:, 0] + x[:, 2] / 2 y[:, 3] = x[:, 1] + x[:, 3] / 2 return y + + +class YoloV3ONNX(DetectionModel): + def __init__(self, model_adapter, resize_type='fit_to_window_letterbox', labels=None, threshold=0.5): + if not resize_type: + resize_type = 'fit_to_window_letterbox' + super().__init__(model_adapter, resize_type, labels=labels, threshold=threshold) + self.image_info_blob_name = self.image_info_blob_names[0] if len(self.image_info_blob_names) == 1 else None + self._check_io_number(2, 3) + self.classes = 80 + self.bboxes_blob_name, self.scores_blob_name, self.indices_blob_name = self._get_outputs() + + def _get_outputs(self): + bboxes_blob_name = None + scores_blob_name = None + indices_blob_name = None + for name, layer in self.outputs.items(): + if layer.shape[-1] == 3: + indices_blob_name = name + elif layer.shape[2] == 4: + bboxes_blob_name = name + elif layer.shape[1] == self.classes: + scores_blob_name = name + else: + raise RuntimeError("Expected shapes [:,:,4], [:,{},:] and [:,3] for outputs, but got {}, {} and {}" + .format(self.classes, *[output.shape for output in self.outputs.values()])) + if self.outputs[bboxes_blob_name].shape[1] != self.outputs[scores_blob_name].shape[2]: + raise RuntimeError("Expected the same dimension for boxes and scores, but got {} and {}".format( + self.outputs[bboxes_blob_name].shape[1], self.outputs[scores_blob_name].shape[2])) + return bboxes_blob_name, scores_blob_name, indices_blob_name + + def preprocess(self, inputs): + image = inputs + meta = {'original_shape': image.shape} + resized_image = self.resize(image, (self.w, self.h), interpolation=INTERPOLATION_TYPES['CUBIC']) + meta.update({'resized_shape': resized_image.shape}) + resized_image = self._change_layout(resized_image) + dict_inputs = { + self.image_blob_name: resized_image, + self.image_info_blob_name: [image.shape[0], image.shape[1]] + } + return dict_inputs, meta + + def postprocess(self, outputs, meta): + detections = self._parse_outputs(outputs) + detections = clip_detections(detections, meta['original_shape']) + return detections + + def _parse_outputs(self, outputs): + boxes = outputs[self.bboxes_blob_name][0] + scores = outputs[self.scores_blob_name][0] + indices = outputs[self.indices_blob_name] if len( + outputs[self.indices_blob_name].shape) == 2 else outputs[self.indices_blob_name][0] + + out_boxes, out_scores, out_classes = [], [], [] + for idx_ in indices: + if idx_[0] == -1: + break + out_classes.append(idx_[1]) + out_scores.append(scores[tuple(idx_[1:])]) + out_boxes.append(boxes[idx_[2]]) + transposed_boxes = np.array(out_boxes).T if out_boxes else ([], [], [], []) + mask = np.array(out_scores) > self.threshold + + if mask.size == 0: + return [] + + out_classes, out_scores, transposed_boxes = (np.array(out_classes)[mask], np.array(out_scores)[mask], + transposed_boxes[:, mask]) + + x_mins = transposed_boxes[1] + y_mins = transposed_boxes[0] + x_maxs = transposed_boxes[3] + y_maxs = transposed_boxes[2] + + detections = [Detection(*det) for det in zip(x_mins, y_mins, x_maxs, + y_maxs, out_scores, out_classes)] + + return detections diff --git a/demos/common/python/openvino/model_zoo/model_api/pipelines/async_pipeline.py b/demos/common/python/openvino/model_zoo/model_api/pipelines/async_pipeline.py index 7410c349017..13e87082118 100644 --- a/demos/common/python/openvino/model_zoo/model_api/pipelines/async_pipeline.py +++ b/demos/common/python/openvino/model_zoo/model_api/pipelines/async_pipeline.py @@ -15,8 +15,6 @@ """ from time import perf_counter -import threading -from collections import deque from typing import Dict, Set from ..performance_metrics import PerformanceMetrics @@ -83,75 +81,57 @@ def get_user_config(flags_d: str, flags_nstreams: str, flags_nthreads: int)-> Di class AsyncPipeline: - def __init__(self, ie, model, plugin_config, device='CPU', max_num_requests=1): + def __init__(self, model): self.model = model + self.model.load() - self.exec_net = ie.load_network(network=self.model.net, device_name=device, - config=plugin_config, num_requests=max_num_requests) - if max_num_requests == 0: - # ExecutableNetwork doesn't allow creation of additional InferRequests. Reload ExecutableNetwork - # +1 to use it as a buffer of the pipeline - self.exec_net = ie.load_network(network=self.model.net, device_name=device, - config=plugin_config, num_requests=len(self.exec_net.requests) + 1) + self.completed_results = {} + self.callback_exceptions = [] - self.empty_requests = deque(self.exec_net.requests) - self.completed_request_results = {} - self.callback_exceptions = {} - self.event = threading.Event() - - self.inference_metrics = PerformanceMetrics() self.preprocess_metrics = PerformanceMetrics() + self.inference_metrics = PerformanceMetrics() self.postprocess_metrics = PerformanceMetrics() - def inference_completion_callback(self, status, callback_args): + def callback(self, status, callback_args): try: - request, id, meta, preprocessing_meta, start_time = callback_args + get_result_fn, request, (id, meta, preprocessing_meta, start_time) = callback_args if status != 0: - raise RuntimeError('Infer Request has returned status code {}'.format(status)) - self.inference_metrics.update(start_time) - raw_outputs = {key: blob.buffer for key, blob in request.output_blobs.items()} - self.completed_request_results[id] = (raw_outputs, meta, preprocessing_meta) - self.empty_requests.append(request) + raise RuntimeError('Request has returned status code {}'.format(status)) + self.completed_results[id] = (get_result_fn(request), meta, preprocessing_meta, start_time) except Exception as e: self.callback_exceptions.append(e) - self.event.set() def submit_data(self, inputs, id, meta): - request = self.empty_requests.popleft() - if len(self.empty_requests) == 0: - self.event.clear() - start_time = perf_counter() + preprocessing_start_time = perf_counter() inputs, preprocessing_meta = self.model.preprocess(inputs) - self.preprocess_metrics.update(start_time) - request.set_completion_callback(py_callback=self.inference_completion_callback, - py_data=(request, id, meta, preprocessing_meta, perf_counter())) - request.async_infer(inputs=inputs) + self.preprocess_metrics.update(preprocessing_start_time) + + infer_start_time = perf_counter() + callback_data = id, meta, preprocessing_meta, infer_start_time + self.model.infer_async(inputs, self.callback, callback_data) def get_raw_result(self, id): - if id in self.completed_request_results: - return self.completed_request_results.pop(id) + if id in self.completed_results: + return self.completed_results.pop(id) return None def get_result(self, id): result = self.get_raw_result(id) if result: - raw_result, meta, preprocess_meta = result - start_time = perf_counter() + raw_result, meta, preprocess_meta, infer_start_time = result + self.inference_metrics.update(infer_start_time) + + postprocessing_start_time = perf_counter() result = self.model.postprocess(raw_result, preprocess_meta), meta - self.postprocess_metrics.update(start_time) + self.postprocess_metrics.update(postprocessing_start_time) return result return None def is_ready(self): - return len(self.empty_requests) != 0 - - def has_completed_request(self): - return len(self.completed_request_results) != 0 + return self.model.is_ready() def await_all(self): - for request in self.exec_net.requests: - request.wait() + self.model.await_all() def await_any(self): - if len(self.empty_requests) == 0: - self.event.wait() + self.model.await_any() diff --git a/demos/common/python/requirements.txt b/demos/common/python/requirements.txt index 53d75631a2a..881941aaf9e 100644 --- a/demos/common/python/requirements.txt +++ b/demos/common/python/requirements.txt @@ -1,2 +1,3 @@ numpy==1.19.5 opencv-python==4.5.* +scipy~=1.5.4 diff --git a/demos/crossroad_camera_demo/cpp/README.md b/demos/crossroad_camera_demo/cpp/README.md index b4d94aac678..340becd80fa 100644 --- a/demos/crossroad_camera_demo/cpp/README.md +++ b/demos/crossroad_camera_demo/cpp/README.md @@ -33,7 +33,7 @@ compared one-by-one with all previously detected persons vectors using cosine si is greater than the specified (or default) threshold value, it is concluded that the person was already detected and a known REID value is assigned. Otherwise, the vector is added to a global list, and new REID value is assigned. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/crossroad_camera_demo/cpp/crossroad_camera.gif b/demos/crossroad_camera_demo/cpp/crossroad_camera.gif index 7b82123177d..14ca378e9a9 100644 Binary files a/demos/crossroad_camera_demo/cpp/crossroad_camera.gif and b/demos/crossroad_camera_demo/cpp/crossroad_camera.gif differ diff --git a/demos/deblurring_demo/python/README.md b/demos/deblurring_demo/python/README.md index 31460cc2016..880e106a273 100644 --- a/demos/deblurring_demo/python/README.md +++ b/demos/deblurring_demo/python/README.md @@ -15,7 +15,7 @@ For each image demo performs the following steps: 3. Do postprocessing for output of model. 4. Display the resulting image together with source image. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/deblurring_demo/python/deblurring_demo.py b/demos/deblurring_demo/python/deblurring_demo.py index a1180688c4f..3a291f534c1 100644 --- a/demos/deblurring_demo/python/deblurring_demo.py +++ b/demos/deblurring_demo/python/deblurring_demo.py @@ -21,18 +21,18 @@ from time import perf_counter import cv2 -from openvino.inference_engine import IECore, get_version sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python')) sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python/openvino/model_zoo')) from model_api.models import Deblurring from model_api.performance_metrics import PerformanceMetrics -from model_api.pipelines import get_user_config, parse_devices, AsyncPipeline +from model_api.pipelines import get_user_config, AsyncPipeline +from model_api.adapters import create_core, OpenvinoAdapter, RemoteAdapter import monitors from images_capture import open_images_capture -from helpers import log_blobs_info, log_runtime_settings, log_latency_per_stage +from helpers import log_latency_per_stage log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.DEBUG, stream=sys.stdout) @@ -46,6 +46,8 @@ def build_argparser(): args.add_argument('-i', '--input', required=True, help='Required. An input to process. The input must be a single image, ' 'a folder of images or anything that cv2.VideoCapture can process.') + args.add_argument('--adapter', help='Optional. Specify the model adapter. Default is openvino.', + default='openvino', type=str, choices=('openvino', 'remote')) args.add_argument('-d', '--device', default='CPU', type=str, help='Optional. Specify the target device to infer on; CPU, GPU, HDDL or MYRIAD is ' 'acceptable. The demo will look for a suitable plugin for device specified. ' @@ -87,25 +89,24 @@ def main(): render_metrics = PerformanceMetrics() video_writer = cv2.VideoWriter() - log.info('OpenVINO Inference Engine') - log.info('\tbuild: {}'.format(get_version())) - ie = IECore() - - plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) + if args.adapter == 'openvino': + plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) + model_adapter = OpenvinoAdapter(create_core(), args.model, device=args.device, plugin_config=plugin_config, + max_num_requests=args.num_infer_requests) + elif args.adapter == 'remote': + log.info('Reading model {}'.format(args.model)) + serving_config = {"address": "localhost", "port": 9000} + model_adapter = RemoteAdapter(args.model, serving_config) start_time = perf_counter() frame = cap.read() if frame is None: raise RuntimeError("Can't read an image from the input") - log.info('Reading model {}'.format(args.model)) - model = Deblurring(ie, args.model, frame.shape) - log_blobs_info(model) - - pipeline = AsyncPipeline(ie, model, plugin_config, device=args.device, max_num_requests=args.num_infer_requests) + model = Deblurring(model_adapter, frame.shape) + model.log_layers_info() - log.info('The model {} is loaded to {}'.format(args.model, args.device)) - log_runtime_settings(pipeline.exec_net, set(parse_devices(args.device))) + pipeline = AsyncPipeline(model) pipeline.submit_data(frame, 0, {'frame': frame, 'start_time': start_time}) @@ -147,41 +148,43 @@ def main(): presenter.drawGraphs(final_image) metrics.update(start_time, final_image) + if video_writer.isOpened() and (args.output_limit <= 0 or next_frame_id_to_show <= args.output_limit-1): video_writer.write(final_image) + next_frame_id_to_show += 1 + if not args.no_show: cv2.imshow('Deblurring Results', final_image) key = cv2.waitKey(1) if key == 27 or key == 'q' or key == 'Q': break presenter.handleKey(key) - next_frame_id_to_show += 1 pipeline.await_all() # Process completed requests - while pipeline.has_completed_request(): + for next_frame_id_to_show in range(next_frame_id_to_show, next_frame_id): results = pipeline.get_result(next_frame_id_to_show) - if results: - result_frame, frame_meta = results - input_frame = frame_meta['frame'] - start_time = frame_meta['start_time'] - - rendering_start_time = perf_counter() - if input_frame.shape != result_frame.shape: - input_frame = cv2.resize(input_frame, (result_frame.shape[1], result_frame.shape[0])) - final_image = cv2.hconcat([input_frame, result_frame]) - render_metrics.update(rendering_start_time) - - presenter.drawGraphs(final_image) - metrics.update(start_time, final_image) - if video_writer.isOpened() and (args.output_limit <= 0 or next_frame_id_to_show <= args.output_limit-1): - video_writer.write(final_image) - if not args.no_show: - cv2.imshow('Deblurring Results', final_image) - key = cv2.waitKey(1) - next_frame_id_to_show += 1 - else: - break + while results is None: + results = pipeline.get_result(next_frame_id_to_show) + result_frame, frame_meta = results + input_frame = frame_meta['frame'] + start_time = frame_meta['start_time'] + + rendering_start_time = perf_counter() + if input_frame.shape != result_frame.shape: + input_frame = cv2.resize(input_frame, (result_frame.shape[1], result_frame.shape[0])) + final_image = cv2.hconcat([input_frame, result_frame]) + render_metrics.update(rendering_start_time) + + presenter.drawGraphs(final_image) + metrics.update(start_time, final_image) + + if video_writer.isOpened() and (args.output_limit <= 0 or next_frame_id_to_show <= args.output_limit-1): + video_writer.write(final_image) + + if not args.no_show: + cv2.imshow('Deblurring Results', final_image) + key = cv2.waitKey(1) metrics.log_total() log_latency_per_stage(cap.reader_metrics.get_latency(), diff --git a/demos/face_detection_mtcnn_demo/cpp_gapi/CMakeLists.txt b/demos/face_detection_mtcnn_demo/cpp_gapi/CMakeLists.txt new file mode 100644 index 00000000000..9f1c7c6db76 --- /dev/null +++ b/demos/face_detection_mtcnn_demo/cpp_gapi/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) + +add_demo(NAME face_detection_mtcnn_demo_gapi + SOURCES ${SOURCES} + HEADERS ${HEADERS} + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include" + DEPENDENCIES monitors utils_gapi + OPENCV_VERSION_REQUIRED 4.5.3) diff --git a/demos/face_detection_mtcnn_demo/cpp_gapi/README.md b/demos/face_detection_mtcnn_demo/cpp_gapi/README.md new file mode 100644 index 00000000000..71f9ac9d63d --- /dev/null +++ b/demos/face_detection_mtcnn_demo/cpp_gapi/README.md @@ -0,0 +1,112 @@ +# G-API Face Detection MTCNN Demo + +![example](../face_detection_mtcnn.gif) + +This demo demonstrates how to run `mtcnn` model using OpenVINO™. + +## How It Works + +On startup, the application reads command line parameters and loads the specified networks. +Upon getting a frame from the OpenCV VideoCapture, the application performs inference of Face Detection network and displays the face position and feature points. + +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). + +## Preparing to Run + +For demo input image or video files, refer to the section **Media Files Available for Demos** in the [Open Model Zoo Demos Overview](../../README.md). +The list of models supported by the demo is in `/demos/face_detection_mtcnn_demo/cpp_gapi/models.lst` file. +This file can be used as a parameter for [Model Downloader](../../../tools/model_tools/README.md) and Converter to download and, if necessary, convert models to OpenVINO Inference Engine format (\*.xml + \*.bin). + +An example of using the Model Downloader: + +```sh +python3 /tools/model_tools/downloader.py --list models.lst +``` + +An example of using the Model Converter: + +```sh +python3 /tools/model_tools/converter.py --list models.lst +``` + +### Supported Models + +* mtcnn-o +* mtcnn-p +* mtcnn-r + +> **NOTE**: Refer to the tables [Intel's Pre-Trained Models Device Support](../../../models/intel/device_support.md) and [Public Pre-Trained Models Device Support](../../../models/public/device_support.md) for the details on models inference support at different devices. + +## Running + +Running the application with the `-h` option yields the following usage message: + +``` +InferenceEngine: + API version ............ + Build .................. + +face_detection_mtcnn_demo_gapi [OPTION] +Options: + + -h, --help Show this help message and exit. + -i INPUT, --input INPUT + Required. Path to a test image file. + -m_p "", --model_pnet "" + Required. Path to an .xml file with a pnet model. + -m_r "", --model_rnet "" + Required. Path to an .xml file with a rnet model. + -m_o "", --model_onet "" + Required. Path to an .xml file with a onet model. + -th "", --threshold "" + Optional. The threshold to define the face is + recognized or not. + -d_p "", Optional. Target device for MTCNN P network. + The demo will look for a suitable plugin for a specified device.Default value is CPU. + -d_r "", Optional. Target device for MTCNN R network. + The demo will look for a suitable plugin for a specified device.Default value is CPU. + -d_o "", Optional. Target device for MTCNN O network. + The demo will look for a suitable plugin for a specified device.Default value is CPU. + -qc "", Optional. Streaming executor queue capacity. Calculated automaticaly if 0. + -hs, Optional. MTCNN P use half scale pyramid. + --loop Optional. Enable reading the input in a loop. + --no_show Optional. Don't show output + -o OUTPUT, --output OUTPUT + Optional. Name of the output file(s) to save. + -limit OUTPUT_LIMIT, --output_limit OUTPUT_LIMIT + Optional. Number of frames to store in output. If 0 is + set, all frames are stored. + -u UTILIZATION_MONITORS, --utilization_monitors UTILIZATION_MONITORS + Optional. List of monitors to show initially. +``` + +Running the application with an empty list of options yields an error message. + +For example, to do inference on a CPU, run the following command: + +```sh +./face_detection_mtcnn_demo_gapi -d_p CPU -i /input_video.mp4 -m_p mtcnn-p.xml -m_o mtcnn-o.xml -m_r mtcnn-r.xml +``` + +>**NOTE**: If you provide a single image as an input, the demo processes and renders it quickly, then exits. To continuously visualize inference results on the screen, apply the `-loop` option, which enforces processing a single image in a loop. + +You can save processed results to a Motion JPEG AVI file or separate JPEG or PNG files using the `-o` option: + +* To save processed results in an AVI file, specify the name of the output file with `avi` extension, for example: `-o output.avi`. +* To save processed results as images, specify the template name of the output image file with `jpg` or `png` extension, for example: `-o output_%03d.jpg`. The actual file names are constructed from the template at runtime by replacing regular expression `%03d` with the frame number, resulting in the following: `output_000.jpg`, `output_001.jpg`, and so on. +To avoid disk space overrun in case of continuous input stream, like camera, you can limit the amount of data stored in the output file(s) with the `limit` option. The default value is 1000. To change it, you can apply the `-limit N` option, where `N` is the number of frames to store. + +>**NOTE**: Windows\* systems may not have the Motion JPEG codec installed by default. If this is the case, you can download OpenCV FFMPEG back end using the PowerShell script provided with the OpenVINO ™ install package and located at `/opencv/ffmpeg-download.ps1`. The script should be run with administrative privileges if OpenVINO ™ is installed in a system protected folder (this is a typical case). Alternatively, you can save results as images. + +## Demo Output + +The application uses OpenCV to display found faces' boundary and feature points. +The demo reports + +* **FPS**: average rate of video frame processing (frames per second). + +## See Also + +* [Open Model Zoo Demos](../../README.md) +* [Model Optimizer](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html) +* [Model Downloader](../../../tools/model_tools/README.md) diff --git a/demos/face_detection_mtcnn_demo/cpp_gapi/face_detection_mtcnn_demo.hpp b/demos/face_detection_mtcnn_demo/cpp_gapi/face_detection_mtcnn_demo.hpp new file mode 100644 index 00000000000..bec0c3bef11 --- /dev/null +++ b/demos/face_detection_mtcnn_demo/cpp_gapi/face_detection_mtcnn_demo.hpp @@ -0,0 +1,72 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include +#include + +DEFINE_INPUT_FLAGS +DEFINE_OUTPUT_FLAGS + +static const char help_message[] = "Print a usage message."; +static const char camera_resolution_message[] = "Optional. Set camera resolution in format WxH."; +static const char mtcnn_p_model_message[] = "Required. Path to an .xml file with a trained OpenVINO MTCNN P (Proposal) detection model."; +static const char mtcnn_r_model_message[] = "Required. Path to an .xml file with a trained OpenVINO MTCNN R (Refinement) detection model."; +static const char mtcnn_o_model_message[] = "Required. Path to an .xml file with a trained OpenVINO MTCNN O (Output) detection model."; +static const char target_device_message_p[] = "Optional. Target device for MTCNN P network. " + "The demo will look for a suitable plugin for a specified device. Default value is \"CPU\"."; +static const char target_device_message_r[] = "Optional. Target device for MTCNN R network. " + "The demo will look for a suitable plugin for a specified device. Default value is \"CPU\"."; +static const char target_device_message_o[] = "Optional. Target device for MTCNN O network. " + "The demo will look for a suitable plugin for a specified device. Default value is \"CPU\"."; +static const char thresh_output_message[] = "Optional. MTCNN confidence threshold. The default value is 0.7."; +static const char queue_capacity_message[] = "Optional. Streaming executor queue capacity. Calculated automaticaly if 0."; +static const char half_scale_message[] = "Optional. MTCNN P use half scale pyramid."; +static const char no_show_message[] = "Optional. Don't show output."; +static const char utilization_monitors_message[] = "Optional. List of monitors to show initially."; + +DEFINE_bool(h, false, help_message); +DEFINE_string(res, "1280x720", camera_resolution_message); +DEFINE_string(m_p, "", mtcnn_p_model_message); +DEFINE_string(m_r, "", mtcnn_r_model_message); +DEFINE_string(m_o, "", mtcnn_o_model_message); +DEFINE_string(d_p, "CPU", target_device_message_p); +DEFINE_string(d_r, "CPU", target_device_message_r); +DEFINE_string(d_o, "CPU", target_device_message_o); +DEFINE_uint32(qc, 1, queue_capacity_message); +DEFINE_bool(hs, false, half_scale_message); +DEFINE_double(th, 0.7, thresh_output_message); +DEFINE_bool(no_show, false, no_show_message); +DEFINE_string(u, "", utilization_monitors_message); + +/** +* \brief This function shows a help message +*/ + +#include +static void showUsage() { + std::cout << std::endl; + std::cout << "gesture_recognition_demo_gapi [OPTION]" << std::endl; + std::cout << "Options:" << std::endl; + std::cout << std::endl; + std::cout << " -h " << help_message << std::endl; + std::cout << " -i " << input_message << std::endl; + std::cout << " -loop " << loop_message << std::endl; + std::cout << " -o \"\" " << output_message << std::endl; + std::cout << " -limit \"\" " << limit_message << std::endl; + std::cout << " -res \"\" " << camera_resolution_message << std::endl; + std::cout << " -m_p \"\" " << mtcnn_p_model_message << std::endl; + std::cout << " -m_r \"\" " << mtcnn_r_model_message << std::endl; + std::cout << " -m_o \"\" " << mtcnn_o_model_message << std::endl; + std::cout << " -d_p \"\" " << target_device_message_p << std::endl; + std::cout << " -d_r \"\" " << target_device_message_r << std::endl; + std::cout << " -d_o \"\" " << target_device_message_o << std::endl; + std::cout << " -qc " << queue_capacity_message << std::endl; + std::cout << " -hs " << half_scale_message << std::endl; + std::cout << " -no_show " << no_show_message << std::endl; + std::cout << " -th " << thresh_output_message << std::endl; + std::cout << " -u " << utilization_monitors_message << std::endl; +} diff --git a/demos/face_detection_mtcnn_demo/cpp_gapi/include/custom_kernels.hpp b/demos/face_detection_mtcnn_demo/cpp_gapi/include/custom_kernels.hpp new file mode 100644 index 00000000000..328d3ed5ce9 --- /dev/null +++ b/demos/face_detection_mtcnn_demo/cpp_gapi/include/custom_kernels.hpp @@ -0,0 +1,219 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include + +#define NUM_PTS 5 +#define NUM_REGRESSIONS 4 + +namespace custom { + + struct BBox { + int x1; + int y1; + int x2; + int y2; + + cv::Rect getRect() const { + return cv::Rect(x1, + y1, + x2 - x1, + y2 - y1); + } + + BBox getSquare() const { + BBox bbox; + const float bboxWidth = static_cast(x2 - x1); + const float bboxHeight = static_cast(y2 - y1); + const float side = std::max(bboxWidth, bboxHeight); + bbox.x1 = static_cast(static_cast(x1) + (bboxWidth - side) * 0.5f); + bbox.y1 = static_cast(static_cast(y1) + (bboxHeight - side) * 0.5f); + bbox.x2 = static_cast(static_cast(bbox.x1) + side); + bbox.y2 = static_cast(static_cast(bbox.y1) + side); + return bbox; + } + }; + + struct Face { + BBox bbox; + float score; + std::array regression; + std::array ptsCoords; + + static void applyRegression(std::vector& faces, bool addOne = false) { + for (auto& face : faces) { + const float bboxWidth = + face.bbox.x2 - face.bbox.x1 + static_cast(addOne); + const float bboxHeight = + face.bbox.y2 - face.bbox.y1 + static_cast(addOne); + face.bbox.x1 = static_cast(static_cast(face.bbox.x1) + (face.regression[1] * bboxWidth)); + face.bbox.y1 = static_cast(static_cast(face.bbox.y1) + (face.regression[0] * bboxHeight)); + face.bbox.x2 = static_cast(static_cast(face.bbox.x2) + (face.regression[3] * bboxWidth)); + face.bbox.y2 = static_cast(static_cast(face.bbox.y2) + (face.regression[2] * bboxHeight)); + } + } + + static void bboxes2Squares(std::vector& faces) { + for (auto& face : faces) { + face.bbox = face.bbox.getSquare(); + } + } + + static std::vector runNMS(std::vector& faces, const float threshold, + const bool useMin = false) { + std::vector facesNMS; + if (faces.empty()) { + return facesNMS; + } + + std::sort(faces.begin(), faces.end(), [](const Face& f1, const Face& f2) { + return f1.score > f2.score; + }); + + std::vector indices(faces.size()); + std::iota(indices.begin(), indices.end(), 0); + + while (indices.size() > 0) { + const int idx = indices[0]; + facesNMS.push_back(faces[idx]); + const std::vector tmpIndices = indices; + indices.clear(); + const float area1 = static_cast(faces[idx].bbox.x2 - faces[idx].bbox.x1 + 1) * + static_cast(faces[idx].bbox.y2 - faces[idx].bbox.y1 + 1); + for (size_t i = 1; i < tmpIndices.size(); ++i) { + const int tmpIdx = tmpIndices[i]; + const float interX1 = static_cast(std::max(faces[idx].bbox.x1, faces[tmpIdx].bbox.x1)); + const float interY1 = static_cast(std::max(faces[idx].bbox.y1, faces[tmpIdx].bbox.y1)); + const float interX2 = static_cast(std::min(faces[idx].bbox.x2, faces[tmpIdx].bbox.x2)); + const float interY2 = static_cast(std::min(faces[idx].bbox.y2, faces[tmpIdx].bbox.y2)); + + const float bboxWidth = std::max(0.0f, (interX2 - interX1 + 1)); + const float bboxHeight = std::max(0.0f, (interY2 - interY1 + 1)); + + const float interArea = bboxWidth * bboxHeight; + const float area2 = static_cast(faces[tmpIdx].bbox.x2 - faces[tmpIdx].bbox.x1 + 1) * + static_cast(faces[tmpIdx].bbox.y2 - faces[tmpIdx].bbox.y1 + 1); + float overlap = 0.0; + if (useMin) { + overlap = interArea / std::min(area1, area2); + } + else { + overlap = interArea / (area1 + area2 - interArea); + } + if (overlap <= threshold) { + indices.push_back(tmpIdx); + } + } + } + return facesNMS; + } + }; + + // Define networks for this sample + using GMat2 = std::tuple; + using GMat3 = std::tuple; + using GMats = cv::GArray; + using GRects = cv::GArray; + using GSize = cv::GOpaque; + using GPrims = cv::GArray; + using GFaces = cv::GArray; + G_API_OP(BuildFaces, + , + "custom.mtcnn.build_faces") { + static cv::GArrayDesc outMeta(const cv::GMatDesc&, + const cv::GMatDesc&, + const float, + const float) { + return cv::empty_array_desc(); + } + }; + + G_API_OP(RunNMS, + , + "custom.mtcnn.run_nms") { + static cv::GArrayDesc outMeta(const cv::GArrayDesc&, + const float, const bool) { + return cv::empty_array_desc(); + } + }; + + G_API_OP(AccumulatePyramidOutputs, + , + "custom.mtcnn.accumulate_pyramid_outputs") { + static cv::GArrayDesc outMeta(const cv::GArrayDesc&, + const cv::GArrayDesc&) { + return cv::empty_array_desc(); + } + }; + + G_API_OP(ApplyRegression, + , + "custom.mtcnn.apply_regression") { + static cv::GArrayDesc outMeta(const cv::GArrayDesc&, const bool) { + return cv::empty_array_desc(); + } + }; + + G_API_OP(BBoxesToSquares, + , + "custom.mtcnn.bboxes_to_squares") { + static cv::GArrayDesc outMeta(const cv::GArrayDesc&) { + return cv::empty_array_desc(); + } + }; + + G_API_OP(R_O_NetPreProcGetROIs, + , + "custom.mtcnn.bboxes_r_o_net_preproc_get_rois") { + static cv::GArrayDesc outMeta(const cv::GArrayDesc&, const cv::GOpaqueDesc&) { + return cv::empty_array_desc(); + } + }; + + G_API_OP(RNetPostProc, + , + "custom.mtcnn.rnet_postproc") { + static cv::GArrayDesc outMeta(const cv::GArrayDesc&, + const cv::GArrayDesc&, + const cv::GArrayDesc&, + const float) { + return cv::empty_array_desc(); + } + }; + + G_API_OP(ONetPostProc, + , + "custom.mtcnn.onet_postproc") { + static cv::GArrayDesc outMeta(const cv::GArrayDesc&, + const cv::GArrayDesc&, + const cv::GArrayDesc&, + const cv::GArrayDesc&, + const float) { + return cv::empty_array_desc(); + } + }; + + G_API_OP(SwapFaces, + , + "custom.mtcnn.swap_faces") { + static cv::GArrayDesc outMeta(const cv::GArrayDesc&) { + return cv::empty_array_desc(); + } + }; + + G_API_OP(BoxesAndMarks, + )>, + "custom.boxes_and_markss") { + static cv::GArrayDesc outMeta(const cv::GMatDesc&, + const cv::GArrayDesc&) { + return cv::empty_array_desc(); + } + }; + + cv::gapi::GKernelPackage kernels(); +} //namespace custom diff --git a/demos/face_detection_mtcnn_demo/cpp_gapi/include/utils.hpp b/demos/face_detection_mtcnn_demo/cpp_gapi/include/utils.hpp new file mode 100644 index 00000000000..8a8687f6bff --- /dev/null +++ b/demos/face_detection_mtcnn_demo/cpp_gapi/include/utils.hpp @@ -0,0 +1,84 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +//Infer helper function +namespace { +static inline std::tuple run_mtcnn_p(cv::GMat &in, const std::string &id) { + cv::GInferInputs inputs; + inputs["data"] = in; + auto outputs = cv::gapi::infer(id, inputs); + auto regressions = outputs.at("conv4-2"); + auto scores = outputs.at("prob1"); + return std::make_tuple(regressions, scores); +} + +static inline std::string get_pnet_level_name(const cv::Size &in_size) { + return "MTCNNProposal_" + std::to_string(in_size.width) + "x" + std::to_string(in_size.height); +} + +int calculate_scales(const cv::Size &input_size, std::vector &out_scales, std::vector &out_sizes ) { + //calculate multi - scale and limit the maxinum side to 1000 + //pr_scale: limit the maxinum side to 1000, < 1.0 + double pr_scale = 1.0; + double h = static_cast(input_size.height); + double w = static_cast(input_size.width); + if (std::min(w, h) > 1000) + { + pr_scale = 1000.0 / std::min(h, w); + w = w * pr_scale; + h = h * pr_scale; + } + else if (std::max(w, h) < 1000) + { + w = w * pr_scale; + h = h * pr_scale; + } + //multi - scale + out_scales.clear(); + out_sizes.clear(); + const double factor = 0.709; + int factor_count = 0; + double minl = std::min(h, w); + while (minl >= 12) + { + const double current_scale = pr_scale * std::pow(factor, factor_count); + cv::Size current_size(static_cast(static_cast(input_size.width) * current_scale), + static_cast(static_cast(input_size.height) * current_scale)); + out_scales.push_back(current_scale); + out_sizes.push_back(current_size); + minl *= factor; + factor_count += 1; + } + return factor_count; +} + +int calculate_half_scales(const cv::Size &input_size, std::vector& out_scales, std::vector& out_sizes) { + double pr_scale = 0.5; + const double h = static_cast(input_size.height); + const double w = static_cast(input_size.width); + //multi - scale + out_scales.clear(); + out_sizes.clear(); + const double factor = 0.5; + int factor_count = 0; + double minl = std::min(h, w); + while (minl >= 12.0*2.0) + { + const double current_scale = pr_scale; + cv::Size current_size(static_cast(static_cast(input_size.width) * current_scale), + static_cast(static_cast(input_size.height) * current_scale)); + out_scales.push_back(current_scale); + out_sizes.push_back(current_size); + minl *= factor; + factor_count += 1; + pr_scale *= 0.5; + } + return factor_count; +} + +} // anonymous namespace diff --git a/demos/face_detection_mtcnn_demo/cpp_gapi/main.cpp b/demos/face_detection_mtcnn_demo/cpp_gapi/main.cpp new file mode 100644 index 00000000000..28acbba534a --- /dev/null +++ b/demos/face_detection_mtcnn_demo/cpp_gapi/main.cpp @@ -0,0 +1,234 @@ +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "face_detection_mtcnn_demo.hpp" +#include "custom_kernels.hpp" +#include "utils.hpp" + +const int MAX_PYRAMID_LEVELS = 13; + +namespace util { +bool ParseAndCheckCommandLine(int argc, char *argv[]) { + /** ---------- Parsing and validating input arguments ----------**/ + gflags::ParseCommandLineNonHelpFlags(&argc, &argv, true); + if (FLAGS_h) { + showUsage(); + showAvailableDevices(); + return false; + } + if (FLAGS_i.empty()) + throw std::logic_error("Parameter -i is not set"); + if (FLAGS_m_p.empty()) + throw std::logic_error("Parameter -m_p is not set"); + if (FLAGS_m_r.empty()) + throw std::logic_error("Parameter -m_r is not set"); + if (FLAGS_m_o.empty()) + throw std::logic_error("Parameter -m_o is not set"); + return true; +} +} // namespace util + +namespace nets { +G_API_NET(MTCNNRefinement, , "custom.mtcnn_refinement"); +G_API_NET(MTCNNOutput, , "custom.mtcnn_output"); +} + +int main(int argc, char* argv[]) { + try { + PerformanceMetrics metrics; + /** Print info about Inference Engine **/ + slog::info << *InferenceEngine::GetInferenceEngineVersion() << slog::endl; + + if (!util::ParseAndCheckCommandLine(argc, argv)) { + return 0; + } + + /** Get information about frame **/ + std::shared_ptr cap = openImagesCapture(FLAGS_i, FLAGS_loop, 0, + std::numeric_limits::max(), stringToSize(FLAGS_res)); + const auto tmp = cap->read(); + cap.reset(); + if (!tmp.data) { + throw std::runtime_error("Couldn't grab first frame"); + } + cv::Size frame_size = cv::Size{tmp.cols, tmp.rows}; + cap = openImagesCapture(FLAGS_i, FLAGS_loop, 0, + std::numeric_limits::max(), stringToSize(FLAGS_res)); + + /** Calculate scales, number of pyramid levels and sizes for PNet pyramid **/ + std::vector level_size; + std::vector scales; + + const auto pyramid_levels = FLAGS_hs ? calculate_half_scales(frame_size, scales, level_size) : + calculate_scales(frame_size, scales, level_size); + CV_Assert(pyramid_levels <= MAX_PYRAMID_LEVELS); + + /** ---------------- Main graph of demo ---------------- **/ + /** Graph input + * Proposal part of MTCNN graph + * Preprocessing BGR2RGB + transpose (NCWH is expected instead of NCHW) + **/ + cv::GMat in_original; + cv::GMat in_originalRGB = cv::gapi::BGR2RGB(in_original); + cv::GMat in_transposedRGB = cv::gapi::transpose(in_originalRGB); + cv::GOpaque in_sz = cv::gapi::streaming::size(in_original); + cv::GMat regressions[MAX_PYRAMID_LEVELS]; + cv::GMat scores[MAX_PYRAMID_LEVELS]; + cv::GArray nms_p_faces[MAX_PYRAMID_LEVELS]; + cv::GArray total_faces[MAX_PYRAMID_LEVELS]; + + /** The very first PNet pyramid layer to init total_faces[0] **/ + std::tie(regressions[0], scores[0]) = run_mtcnn_p(in_transposedRGB, get_pnet_level_name(level_size[0])); + cv::GArray faces0 = custom::BuildFaces::on(scores[0], regressions[0], float(scales[0]), float(FLAGS_th)); + cv::GArray final_p_faces_for_bb2squares = custom::ApplyRegression::on(faces0, true); + cv::GArray final_faces_pnet0 = custom::BBoxesToSquares::on(final_p_faces_for_bb2squares); + total_faces[0] = custom::RunNMS::on(final_faces_pnet0, 0.5f, false); + + /** The rest PNet pyramid layers to accumlate all layers result in total_faces[PYRAMID_LEVELS - 1]] **/ + for (int i = 1; i < pyramid_levels; ++i) { + std::tie(regressions[i], scores[i]) = run_mtcnn_p(in_transposedRGB, get_pnet_level_name(level_size[i])); + cv::GArray faces = custom::BuildFaces::on(scores[i], regressions[i], float(scales[i]), float(FLAGS_th)); + cv::GArray final_p_faces_for_bb2squares_i = custom::ApplyRegression::on(faces, true); + cv::GArray final_faces_pnet_i = custom::BBoxesToSquares::on(final_p_faces_for_bb2squares_i); + nms_p_faces[i] = custom::RunNMS::on(final_faces_pnet_i, 0.5f, false); + total_faces[i] = custom::AccumulatePyramidOutputs::on(total_faces[i - 1], nms_p_faces[i]); + } + + /** Proposal post-processing **/ + cv::GArray final_faces_pnet = custom::RunNMS::on(total_faces[pyramid_levels - 1], 0.7f, true); + + /** Refinement part of MTCNN graph **/ + cv::GArray faces_roi_pnet = custom::R_O_NetPreProcGetROIs::on(final_faces_pnet, in_sz); + cv::GArray regressionsRNet, scoresRNet; + std::tie(regressionsRNet, scoresRNet) = cv::gapi::infer(faces_roi_pnet, in_transposedRGB); + + /** Refinement post-processing **/ + cv::GArray rnet_post_proc_faces = custom::RNetPostProc::on(final_faces_pnet, scoresRNet, regressionsRNet, float(FLAGS_th)); + cv::GArray nms07_r_faces_total = custom::RunNMS::on(rnet_post_proc_faces, 0.7f, false); + cv::GArray final_r_faces_for_bb2squares = custom::ApplyRegression::on(nms07_r_faces_total, true); + cv::GArray final_faces_rnet = custom::BBoxesToSquares::on(final_r_faces_for_bb2squares); + + /** Output part of MTCNN graph **/ + cv::GArray faces_roi_rnet = custom::R_O_NetPreProcGetROIs::on(final_faces_rnet, in_sz); + cv::GArray regressionsONet, scoresONet, landmarksONet; + std::tie(regressionsONet, landmarksONet, scoresONet) = cv::gapi::infer(faces_roi_rnet, in_transposedRGB); + + /** Output post-processing **/ + cv::GArray onet_post_proc_faces = custom::ONetPostProc::on(final_faces_rnet, scoresONet, regressionsONet, landmarksONet, float(FLAGS_th)); + cv::GArray final_o_faces_for_nms07 = custom::ApplyRegression::on(onet_post_proc_faces, true); + cv::GArray nms07_o_faces_total = custom::RunNMS::on(final_o_faces_for_nms07, 0.7f, true); + cv::GArray final_faces_onet = custom::SwapFaces::on(nms07_o_faces_total); + + /** Draw ROI and marks **/ + auto rendered = cv::gapi::wip::draw::render3ch(in_original, + custom::BoxesAndMarks::on(in_original, final_faces_onet)); + + cv::GComputation graph_mtcnn(cv::GIn(in_original), cv::GOut(rendered)); + /** ---------------- End of graph ---------------- **/ + /** Configure networks **/ + + // MTCNN Refinement detection network + auto mtcnnr_net = cv::gapi::ie::Params { + FLAGS_m_r, // path to topology IR + fileNameNoExt(FLAGS_m_r) + ".bin", // path to weights + FLAGS_d_r, // device specifier + }.cfgOutputLayers({ "conv5-2", "prob1" }).cfgInputLayers({ "data" }); + + // MTCNN Output detection network + auto mtcnno_net = cv::gapi::ie::Params { + FLAGS_m_o, // path to topology IR + fileNameNoExt(FLAGS_m_o) + ".bin", // path to weights + FLAGS_d_o, // device specifier + }.cfgOutputLayers({ "conv6-2", "conv6-3", "prob1" }).cfgInputLayers({ "data" }); + + auto networks_mtcnn = cv::gapi::networks(mtcnnr_net, mtcnno_net); + + // MTCNN Proposal detection network + for (int i = 0; i < pyramid_levels; ++i) { + std::string net_id = get_pnet_level_name(level_size[i]); + std::vector reshape_dims = { 1, 3, size_t(level_size[i].width), size_t(level_size[i].height) }; + cv::gapi::ie::Params mtcnnp_net { + net_id, // tag + FLAGS_m_p, // path to topology IR + fileNameNoExt(FLAGS_m_p) + ".bin", // path to weights + FLAGS_d_p, // device specifier + }; + mtcnnp_net.cfgInputReshape("data", reshape_dims); + networks_mtcnn += cv::gapi::networks(mtcnnp_net); + } + + /** Custom kernels **/ + auto kernels_mtcnn = custom::kernels(); + auto mtcnn_args = cv::compile_args(networks_mtcnn, kernels_mtcnn); + if (FLAGS_qc != 0) { + mtcnn_args += cv::compile_args(cv::gapi::streaming::queue_capacity{ FLAGS_qc }); + } + auto pipeline_mtcnn = graph_mtcnn.compileStreaming(std::move(mtcnn_args)); + + /** ---------------- The execution part ---------------- **/ + pipeline_mtcnn.setSource(cap); + + cv::Size graphSize{static_cast(frame_size.width / 4), 60}; + Presenter presenter(FLAGS_u, frame_size.height - graphSize.height - 10, graphSize); + + /** Save output result **/ + cv::VideoWriter videoWriter; + if (!FLAGS_o.empty() && !videoWriter.open(FLAGS_o, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'), + cap->fps(), frame_size)) { + throw std::runtime_error("Can't open video writer"); + } + + /** Output Mat for result **/ + cv::Mat out_image; + bool isStart = true; + const auto startTime = std::chrono::steady_clock::now(); + pipeline_mtcnn.start(); + while (pipeline_mtcnn.pull(cv::gout(out_image))) { + if (isStart) { + metrics.update(startTime, out_image, { 10, 22 }, cv::FONT_HERSHEY_COMPLEX, + 0.65, { 200, 10, 10 }, 2, PerformanceMetrics::MetricTypes::FPS); + isStart = false; + } + else { + metrics.update({}, out_image, { 10, 22 }, cv::FONT_HERSHEY_COMPLEX, + 0.65, { 200, 10, 10 }, 2, PerformanceMetrics::MetricTypes::FPS); + } + if (videoWriter.isOpened()) { + videoWriter.write(out_image); + } + if (!FLAGS_no_show) { + cv::imshow("Face detection mtcnn demo G-API", out_image); + int key = cv::waitKey(1); + /** Press 'Esc' or 'Q' to quit **/ + if (key == 27) + break; + if (key == 81) // Q + break; + else + presenter.handleKey(key); + } + } + + slog::info << "Metrics report:" << slog::endl; + slog::info << "\tFPS: " << std::fixed << std::setprecision(1) << metrics.getTotal().fps << slog::endl; + slog::info << presenter.reportMeans() << slog::endl; + } + catch (const std::exception& error) { + slog::err << error.what() << slog::endl; + return 1; + } + catch (...) { + slog::err << "Unknown/internal exception happened." << slog::endl; + return 1; + } + + return 0; +} diff --git a/demos/face_detection_mtcnn_demo/cpp_gapi/models.lst b/demos/face_detection_mtcnn_demo/cpp_gapi/models.lst new file mode 100644 index 00000000000..2480b526fbf --- /dev/null +++ b/demos/face_detection_mtcnn_demo/cpp_gapi/models.lst @@ -0,0 +1,2 @@ +# This file can be used with the --list option of the model downloader. +mtcnn* diff --git a/demos/face_detection_mtcnn_demo/cpp_gapi/src/custom_kernels.cpp b/demos/face_detection_mtcnn_demo/cpp_gapi/src/custom_kernels.cpp new file mode 100644 index 00000000000..acbe1e54831 --- /dev/null +++ b/demos/face_detection_mtcnn_demo/cpp_gapi/src/custom_kernels.cpp @@ -0,0 +1,248 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// +#include "custom_kernels.hpp" + +#include + +namespace { + const float P_NET_WINDOW_SIZE = 12.0f; + + std::vector buildFaces(const cv::Mat& scores, + const cv::Mat& regressions, + const float scaleFactor, + const float threshold) { + + const auto w = scores.size[3]; + const auto h = scores.size[2]; + const auto size = w * h; + + const float* scores_data = scores.ptr(); + scores_data += size; + + const float* reg_data = regressions.ptr(); + + const auto out_side = std::max(h, w); + const auto in_side = 2 * out_side + 11; + float stride = 0.0f; + if (out_side != 1) { + stride = static_cast(in_side - P_NET_WINDOW_SIZE) / static_cast(out_side - 1); + } + + std::vector boxes; + + for (int i = 0; i < size; i++) { + if (scores_data[i] >= (threshold)) { + const float y = static_cast(i / w); + const float x = static_cast(i - w * y); + + custom::Face faceInfo; + custom::BBox& faceBox = faceInfo.bbox; + + faceBox.x1 = std::max(0, static_cast((x * stride) / scaleFactor)); + faceBox.y1 = std::max(0, static_cast((y * stride) / scaleFactor)); + faceBox.x2 = static_cast((x * stride + P_NET_WINDOW_SIZE - 1.0f) / scaleFactor); + faceBox.y2 = static_cast((y * stride + P_NET_WINDOW_SIZE - 1.0f) / scaleFactor); + faceInfo.regression[0] = reg_data[i]; + faceInfo.regression[1] = reg_data[i + size]; + faceInfo.regression[2] = reg_data[i + 2 * size]; + faceInfo.regression[3] = reg_data[i + 3 * size]; + faceInfo.score = scores_data[i]; + boxes.push_back(faceInfo); + } + } + + return boxes; + } +} // anonymous namespace + +//Custom kernels implementation +GAPI_OCV_KERNEL(OCVBuildFaces, custom::BuildFaces) { + static void run(const cv::Mat & in_scores, + const cv::Mat & in_regresssions, + const float scaleFactor, + const float threshold, + std::vector &out_faces) { + out_faces = buildFaces(in_scores, in_regresssions, scaleFactor, threshold); + } +}; // GAPI_OCV_KERNEL(BuildFaces) + +GAPI_OCV_KERNEL(OCVRunNMS, custom::RunNMS) { + static void run(const std::vector &in_faces, + const float threshold, + const bool useMin, + std::vector &out_faces) { + std::vector in_faces_copy = in_faces; + out_faces = custom::Face::runNMS(in_faces_copy, threshold, useMin); + } +}; // GAPI_OCV_KERNEL(RunNMS) + +GAPI_OCV_KERNEL(OCVAccumulatePyramidOutputs, custom::AccumulatePyramidOutputs) { + static void run(const std::vector &total_faces, + const std::vector &in_faces, + std::vector &out_faces) { + out_faces = total_faces; + out_faces.insert(out_faces.end(), in_faces.begin(), in_faces.end()); + } +}; // GAPI_OCV_KERNEL(AccumulatePyramidOutputs) + +GAPI_OCV_KERNEL(OCVApplyRegression, custom::ApplyRegression) { + static void run(const std::vector &in_faces, + const bool addOne, + std::vector &out_faces) { + std::vector in_faces_copy = in_faces; + custom::Face::applyRegression(in_faces_copy, addOne); + out_faces.clear(); + out_faces.insert(out_faces.end(), in_faces_copy.begin(), in_faces_copy.end()); + } +}; // GAPI_OCV_KERNEL(ApplyRegression) + +GAPI_OCV_KERNEL(OCVBBoxesToSquares, custom::BBoxesToSquares) { + static void run(const std::vector &in_faces, + std::vector &out_faces) { + std::vector in_faces_copy = in_faces; + custom::Face::bboxes2Squares(in_faces_copy); + out_faces.clear(); + out_faces.insert(out_faces.end(), in_faces_copy.begin(), in_faces_copy.end()); + } +}; // GAPI_OCV_KERNEL(BBoxesToSquares) + +GAPI_OCV_KERNEL(OCVR_O_NetPreProcGetROIs, custom::R_O_NetPreProcGetROIs) { + static void run(const std::vector &in_faces, + const cv::Size & in_image_size, + std::vector &outs) { + outs.clear(); + for (const auto& face : in_faces) { + cv::Rect tmp_rect = face.bbox.getRect(); + //Compare to transposed sizes width<->height + tmp_rect &= cv::Rect(tmp_rect.x, tmp_rect.y, in_image_size.height - tmp_rect.x, in_image_size.width - tmp_rect.y) & + cv::Rect(0, 0, in_image_size.height, in_image_size.width); + outs.push_back(tmp_rect); + } + } +}; // GAPI_OCV_KERNEL(R_O_NetPreProcGetROIs) + +GAPI_OCV_KERNEL(OCVRNetPostProc, custom::RNetPostProc) { + static void run(const std::vector &in_faces, + const std::vector &in_scores, + const std::vector &in_regresssions, + const float threshold, + std::vector &out_faces) { + out_faces.clear(); + for (unsigned int k = 0; k < in_faces.size(); ++k) { + const float* scores_data = in_scores[k].ptr(); + const float* reg_data = in_regresssions[k].ptr(); + if (scores_data[1] >= threshold) { + custom::Face info = in_faces[k]; + info.score = scores_data[1]; + std::copy_n(reg_data, NUM_REGRESSIONS, info.regression.begin()); + out_faces.push_back(info); + } + } + } +}; // GAPI_OCV_KERNEL(RNetPostProc) + +GAPI_OCV_KERNEL(OCVONetPostProc, custom::ONetPostProc) { + static void run(const std::vector &in_faces, + const std::vector &in_scores, + const std::vector &in_regresssions, + const std::vector &in_landmarks, + const float threshold, + std::vector &out_faces) { + out_faces.clear(); + for (unsigned int k = 0; k < in_faces.size(); ++k) { + const float* scores_data = in_scores[k].ptr(); + const float* reg_data = in_regresssions[k].ptr(); + const float* landmark_data = in_landmarks[k].ptr(); + if (scores_data[1] >= threshold) { + custom::Face info = in_faces[k]; + info.score = scores_data[1]; + for (size_t i = 0; i < 4; ++i) { + info.regression[i] = reg_data[i]; + } + float w = info.bbox.x2 - info.bbox.x1 + 1.0f; + float h = info.bbox.y2 - info.bbox.y1 + 1.0f; + + for (size_t p = 0; p < NUM_PTS; ++p) { + info.ptsCoords[2 * p] = + info.bbox.x1 + static_cast(landmark_data[NUM_PTS + p]) * w - 1; + info.ptsCoords[2 * p + 1] = info.bbox.y1 + static_cast(landmark_data[p]) * h - 1; + } + + out_faces.push_back(info); + } + } + } +}; // GAPI_OCV_KERNEL(ONetPostProc) + +GAPI_OCV_KERNEL(OCVSwapFaces, custom::SwapFaces) { + static void run(const std::vector &in_faces, + std::vector &out_faces) { + std::vector in_faces_copy = in_faces; + out_faces.clear(); + if (!in_faces_copy.empty()) { + for (size_t i = 0; i < in_faces_copy.size(); ++i) { + std::swap(in_faces_copy[i].bbox.x1, in_faces_copy[i].bbox.y1); + std::swap(in_faces_copy[i].bbox.x2, in_faces_copy[i].bbox.y2); + for (size_t p = 0; p < NUM_PTS; ++p) { + std::swap(in_faces_copy[i].ptsCoords[2 * p], in_faces_copy[i].ptsCoords[2 * p + 1]); + } + } + out_faces = in_faces_copy; + } + } +}; // GAPI_OCV_KERNEL(SwapFaces) + +using rectPoints = std::pair>; + +GAPI_OCV_KERNEL(OCVBoxesAndMarks, custom::BoxesAndMarks) { + static void run(const cv::Mat & in, + const std::vector &in_faces, + std::vector&out_prims) { + out_prims.clear(); + const auto rct = [](const cv::Rect& rc) { + return cv::gapi::wip::draw::Rect(rc, cv::Scalar(255, 0, 0), 1); + }; + const auto txt = [](const std::string& ms, const cv::Rect& rc) { + return cv::gapi::wip::draw::Text(ms, rc.tl(), cv::FONT_HERSHEY_SIMPLEX, 0.6, cv::Scalar(0, 255, 0)); + }; + const auto crl = [](const cv::Point& point) { + return cv::gapi::wip::draw::Circle(point, 2, cv::Scalar(0, 255, 0)); + }; + std::vector data; + std::vector confidence; + // show the image with faces in it + for (const auto& out_face : in_faces) { + std::vector pts; + for (size_t p = 0; p < NUM_PTS; ++p) { + pts.push_back( + cv::Point(static_cast(out_face.ptsCoords[2 * p]), static_cast(out_face.ptsCoords[2 * p + 1]))); + } + const auto rect = out_face.bbox.getRect(); + const auto d = std::make_pair(rect, pts); + data.push_back(d); + confidence.push_back(out_face.score); + } + + for (size_t i = 0; i < data.size(); ++i) { + out_prims.emplace_back(rct(data.at(i).first)); + out_prims.emplace_back(txt(cv::format("confidence: %0.2f", confidence.at(i)), data.at(i).first)); + for (const auto& point : data.at(i).second) { + out_prims.emplace_back(crl(point)); + } + } + } +}; // GAPI_OCV_KERNEL(BoxesAndMarks) + +cv::gapi::GKernelPackage custom::kernels() { + return cv::gapi::kernels(); +} diff --git a/demos/face_detection_mtcnn_demo/face_detection_mtcnn.gif b/demos/face_detection_mtcnn_demo/face_detection_mtcnn.gif new file mode 100644 index 00000000000..d389a117733 Binary files /dev/null and b/demos/face_detection_mtcnn_demo/face_detection_mtcnn.gif differ diff --git a/demos/face_detection_mtcnn_demo/python/README.md b/demos/face_detection_mtcnn_demo/python/README.md index f7c1e80617c..bf9767c02a6 100644 --- a/demos/face_detection_mtcnn_demo/python/README.md +++ b/demos/face_detection_mtcnn_demo/python/README.md @@ -1,5 +1,7 @@ # Face Detection MTCNN Python* Demo +![example](../face_detection_mtcnn.gif) + This demo demonstrates how to run `mtcnn` model using OpenVINO™. ## How It Works @@ -7,7 +9,7 @@ This demo demonstrates how to run `mtcnn` model using OpenVINO™. On startup, the application reads command line parameters and loads the specified networks. Upon getting a frame from the OpenCV VideoCapture, the application performs inference of Face Detection network and displays the face position and feature points. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run @@ -107,8 +109,6 @@ The demo reports * **Latency**: average time required to process one frame (from reading the frame to displaying the results). You can use both of these metrics to measure application-level performance. -![example](./test.jpg) - ## See Also * [Open Model Zoo Demos](../../README.md) diff --git a/demos/face_detection_mtcnn_demo/python/test.jpg b/demos/face_detection_mtcnn_demo/python/test.jpg deleted file mode 100644 index 1b9101cd149..00000000000 Binary files a/demos/face_detection_mtcnn_demo/python/test.jpg and /dev/null differ diff --git a/demos/face_recognition_demo/python/README.md b/demos/face_recognition_demo/python/README.md index eed5a73d2a7..651d1b4e69c 100644 --- a/demos/face_recognition_demo/python/README.md +++ b/demos/face_recognition_demo/python/README.md @@ -27,7 +27,7 @@ to align the faces and the face gallery to match faces found on a video frame with the ones in the gallery. Then, the processing results are visualized and displayed on the screen or written to the output file. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/formula_recognition_demo/python/README.md b/demos/formula_recognition_demo/python/README.md index ac573495e9e..263dd28b01d 100644 --- a/demos/formula_recognition_demo/python/README.md +++ b/demos/formula_recognition_demo/python/README.md @@ -1,6 +1,6 @@ # Formula Recognition Python\* Demo -![example](./demo_intro.gif) +![example](./formula_recognition.gif) This demo shows how to run LaTeX formula recognition models. These models allow to get a LaTeX formula markup from the image. @@ -106,7 +106,7 @@ Navigation keys: The overall process is simillar to the Non-interactive mode with the exception that it runs asynchronously. This means model inference and rendering of the formula do not block main thread, so the image from the web camera can move smoothly. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). The demo has two preprocessing types: Crop and Pad to target shape and Resize and pad to target shape. Two preprocessing types are used for two different datasets as model trained with concrete font size, so if one wants to run the model on inputs with bigger font size (e.g. if input is photographed in 12Mpx, while model trained to imitate scans in ~3Mpx) they should first resize the input to make font size like in train set. Example of the target font size: ![font_size](./sample.png) diff --git a/demos/formula_recognition_demo/python/demo_intro.gif b/demos/formula_recognition_demo/python/demo_intro.gif deleted file mode 100644 index 3636e280bab..00000000000 Binary files a/demos/formula_recognition_demo/python/demo_intro.gif and /dev/null differ diff --git a/demos/formula_recognition_demo/python/formula_recognition.gif b/demos/formula_recognition_demo/python/formula_recognition.gif new file mode 100644 index 00000000000..69314eafe97 Binary files /dev/null and b/demos/formula_recognition_demo/python/formula_recognition.gif differ diff --git a/demos/gaze_estimation_demo/cpp/README.md b/demos/gaze_estimation_demo/cpp/README.md index ffae4e6a916..47acf7ceb2e 100644 --- a/demos/gaze_estimation_demo/cpp/README.md +++ b/demos/gaze_estimation_demo/cpp/README.md @@ -24,7 +24,7 @@ Other demo objectives are: 4. The application performs inference on gaze estimation model using inference results of auxiliary models 5. The application shows the results -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/gaze_estimation_demo/cpp_gapi/CMakeLists.txt b/demos/gaze_estimation_demo/cpp_gapi/CMakeLists.txt index c848dc965da..cfe53e6e894 100644 --- a/demos/gaze_estimation_demo/cpp_gapi/CMakeLists.txt +++ b/demos/gaze_estimation_demo/cpp_gapi/CMakeLists.txt @@ -9,4 +9,5 @@ add_demo(NAME gaze_estimation_demo_gapi SOURCES ${SOURCES} HEADERS ${HEADERS} INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include" - DEPENDENCIES monitors) + DEPENDENCIES monitors utils_gapi + OPENCV_VERSION_REQUIRED 4.5.3) diff --git a/demos/gaze_estimation_demo/cpp_gapi/README.md b/demos/gaze_estimation_demo/cpp_gapi/README.md index 7e8effb0402..d27a142cfec 100644 --- a/demos/gaze_estimation_demo/cpp_gapi/README.md +++ b/demos/gaze_estimation_demo/cpp_gapi/README.md @@ -26,7 +26,7 @@ Other demo objectives are: * Performs inference of Gaze Estimation network and processes its result. 3. The application shows the results. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html) +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters) ## Preparing to Run diff --git a/demos/gaze_estimation_demo/cpp_gapi/include/stream_source.hpp b/demos/gaze_estimation_demo/cpp_gapi/include/stream_source.hpp deleted file mode 100644 index 22702e7c8c2..00000000000 --- a/demos/gaze_estimation_demo/cpp_gapi/include/stream_source.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include - -namespace custom { -class CustomCapSource : public cv::gapi::wip::IStreamSource -{ -public: - explicit CustomCapSource(std::shared_ptr& cap) : cap(cap) { - prep(); - } - -protected: - std::shared_ptr cap; - cv::Mat first; - bool first_pulled = false; - cv::Mat clear_frame; - void prep() { - GAPI_Assert(first.empty()); - cv::Mat tmp = cap->read(); - if (!tmp.data) { - GAPI_Assert(false && "Couldn't grab the frame"); - } - first = tmp.clone(); - } - - virtual bool pull(cv::gapi::wip::Data &data) override { - if (!first_pulled) { - GAPI_Assert(!first.empty()); - first_pulled = true; - data = first; - return true; - } - cv::Mat frame = cap->read(); - if (!frame.data) { - return false; - } - data = frame.clone(); - return true; - } - - virtual cv::GMetaArg descr_of() const override { - GAPI_Assert(!first.empty()); - return cv::GMetaArg{ cv::descr_of(first) }; - } -}; - -} // namespace custom diff --git a/demos/gaze_estimation_demo/cpp_gapi/main.cpp b/demos/gaze_estimation_demo/cpp_gapi/main.cpp index e4f92a5caba..c376e0347c3 100644 --- a/demos/gaze_estimation_demo/cpp_gapi/main.cpp +++ b/demos/gaze_estimation_demo/cpp_gapi/main.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include "gaze_estimation_demo_gapi.hpp" #include "face_inference_results.hpp" @@ -12,7 +12,6 @@ #include "utils.hpp" #include "custom_kernels.hpp" #include "kernel_packages.hpp" -#include "stream_source.hpp" #include #include @@ -166,7 +165,7 @@ int main(int argc, char *argv[]) { }; slog::info << "The Face Detection model " << FLAGS_m_fd << " is loaded to " << FLAGS_d_fd << " device." << slog::endl; - /** Get information about frame from cv::VideoCapture **/ + /** Get information about frame **/ std::shared_ptr cap = openImagesCapture(FLAGS_i, FLAGS_loop, 0, std::numeric_limits::max(), stringToSize(FLAGS_res)); const auto tmp = cap->read(); @@ -238,7 +237,7 @@ int main(int argc, char *argv[]) { std::vector out_gazes; /** ---------------- The execution part ---------------- **/ - pipeline.setSource(cap); + pipeline.setSource(cap); ResultsMarker resultsMarker(false, false, false, true, true); int delay = 1; bool flipImage = false; diff --git a/demos/gaze_estimation_demo/cpp_gapi/src/custom_kerenels.cpp b/demos/gaze_estimation_demo/cpp_gapi/src/custom_kernels.cpp similarity index 100% rename from demos/gaze_estimation_demo/cpp_gapi/src/custom_kerenels.cpp rename to demos/gaze_estimation_demo/cpp_gapi/src/custom_kernels.cpp diff --git a/demos/gaze_estimation_demo/cpp_gapi/src/results_marker.cpp b/demos/gaze_estimation_demo/cpp_gapi/src/results_marker.cpp index bcabc9c5a8c..4366be85a89 100644 --- a/demos/gaze_estimation_demo/cpp_gapi/src/results_marker.cpp +++ b/demos/gaze_estimation_demo/cpp_gapi/src/results_marker.cpp @@ -32,11 +32,11 @@ void ResultsMarker::mark(cv::Mat& image, if (showFaceBoundingBox) { cv::rectangle(image, faceInferenceResults.faceBoundingBox, cv::Scalar::all(255), 1); putHighlightedText(image, - cv::format("Detector confidence: %0.2f", - static_cast(faceInferenceResults.faceDetectionConfidence)), - cv::Point(static_cast(tl.x), - static_cast(tl.y - 5. * faceBoundingBoxWidth / 200.)), - cv::FONT_HERSHEY_COMPLEX, scale, cv::Scalar(200, 10, 10), 1); + cv::format("Detector confidence: %0.2f", + static_cast(faceInferenceResults.faceDetectionConfidence)), + cv::Point(static_cast(tl.x), + static_cast(tl.y - 5. * faceBoundingBoxWidth / 200.)), + cv::FONT_HERSHEY_COMPLEX, scale, cv::Scalar(200, 10, 10), 1); } if (showHeadPoseAxes) { @@ -73,10 +73,10 @@ void ResultsMarker::mark(cv::Mat& image, cv::Scalar(255, 0, 255), 2); putHighlightedText(image, - cv::format("head pose: (y=%0.0f, p=%0.0f, r=%0.0f)", std::round(yaw), std::round(pitch), std::round(roll)), - cv::Point(static_cast(faceBoundingBox.tl().x), - static_cast(faceBoundingBox.br().y + 5. * faceBoundingBoxWidth / 100.)), - cv::FONT_HERSHEY_PLAIN, scale * 2, cv::Scalar(200, 10, 10), 1); + cv::format("head pose: (y=%0.0f, p=%0.0f, r=%0.0f)", std::round(yaw), std::round(pitch), std::round(roll)), + cv::Point(static_cast(faceBoundingBox.tl().x), + static_cast(faceBoundingBox.br().y + 5. * faceBoundingBoxWidth / 100.)), + cv::FONT_HERSHEY_PLAIN, scale * 2, cv::Scalar(200, 10, 10), 1); } if (showLandmarks) { @@ -114,12 +114,12 @@ void ResultsMarker::mark(cv::Mat& image, gazeVectorToGazeAngles(faceInferenceResults.gazeVector, gazeAngles); putHighlightedText(image, - cv::format("gaze angles: (h=%0.0f, v=%0.0f)", - static_cast(std::round(gazeAngles.x)), - static_cast(std::round(gazeAngles.y))), - cv::Point(static_cast(faceBoundingBox.tl().x), - static_cast(faceBoundingBox.br().y + 12. * faceBoundingBoxWidth / 100.)), - cv::FONT_HERSHEY_PLAIN, scale * 2, cv::Scalar(200, 10, 10), 1); + cv::format("gaze angles: (h=%0.0f, v=%0.0f)", + static_cast(std::round(gazeAngles.x)), + static_cast(std::round(gazeAngles.y))), + cv::Point(static_cast(faceBoundingBox.tl().x), + static_cast(faceBoundingBox.br().y + 12. * faceBoundingBoxWidth / 100.)), + cv::FONT_HERSHEY_PLAIN, scale * 2, cv::Scalar(200, 10, 10), 1); } } if (showEyeState) { diff --git a/demos/gaze_estimation_demo/gaze_estimation.gif b/demos/gaze_estimation_demo/gaze_estimation.gif index f35726545ee..1bc39e02434 100644 Binary files a/demos/gaze_estimation_demo/gaze_estimation.gif and b/demos/gaze_estimation_demo/gaze_estimation.gif differ diff --git a/demos/gesture_recognition_demo/cpp_gapi/CMakeLists.txt b/demos/gesture_recognition_demo/cpp_gapi/CMakeLists.txt new file mode 100644 index 00000000000..0c7e4e66171 --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) + +add_demo(NAME gesture_recognition_demo_gapi + SOURCES ${SOURCES} + HEADERS ${HEADERS} + INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include" + DEPENDENCIES monitors + OPENCV_VERSION_REQUIRED 4.5.3) diff --git a/demos/gesture_recognition_demo/cpp_gapi/README.md b/demos/gesture_recognition_demo/cpp_gapi/README.md new file mode 100644 index 00000000000..1fe71aab6c2 --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/README.md @@ -0,0 +1,125 @@ +# G-API Gesture Recognition Demo + +This demo demonstrates how to run Gesture (e.g. American Sign Language (ASL) gestures) Recognition models using OpenVINO™ toolkit. + +## How It Works + +The demo application expects a gesture recognition model in the Intermediate Representation (IR) format. + +As input, the demo application takes: + +* a path to a video file or a device node of a webcam specified with a command line argument `--input` +* a path to a file in JSON format with gesture class names `--class_map` + +The demo workflow is the following: + +1. The demo application reads video frames one by one, runs person detector that extracts ROI, tracks the ROI of very first person. Additional process is used to prepare the batch of frames with constant framerate. +2. Batch of frames and extracted ROI are passed to artificial neural network that predicts the gesture. +3. The app visualizes results of its work as graphical window where following objects are shown: + - Input frame with detected ROI. + - Last recognized gesture. + - Performance characteristics. + +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). + +## Creating a Gallery for Gestures Window + +The gallery of sample videos and list of paths to gesture videos must be created to show the sample gestures on an additional window: + +1. Put videos containing gestures to a separate empty folder. Each video must have only one gesture. +2. Run the `python3 /demos/gesture_recognition_demo/cpp_gapi/create_list.py --classes_map --gesture_storage ` command, which will create a `gesture_gallery.json` file with list of gestures and paths to appropriate videos. + +## Preparing to Run + +For demo input image or video files, refer to the section **Media Files Available for Demos** in the [Open Model Zoo Demos Overview](../../README.md). +The list of models supported by the demo is in `/demos/gesture_recognition_demo/cpp_gapi/models.lst` file. +This file can be used as a parameter for [Model Downloader](../../../tools/model_tools/README.md) and Converter to download and, if necessary, convert models to OpenVINO Inference Engine format (\*.xml + \*.bin). + +An example of using the Model Downloader: + +```sh +omz_downloader --list models.lst +``` + +An example of using the Model Converter: + +```sh +omz_converter --list models.lst +``` + +### Supported Models + +* asl-recognition-0004 +* common-sign-language-0001 +* common-sign-language-0002 +* person-detection-asl-0001 + +> **NOTE**: Refer to the tables [Intel's Pre-Trained Models Device Support](../../../models/intel/device_support.md) and [Public Pre-Trained Models Device Support](../../../models/public/device_support.md) for the details on models inference support at different devices. + +## Running + +Running the application with the `-h` option yields the following usage message: + +``` +InferenceEngine: + API version ............ + Build .................. + +gesture_recognition_demo_gapi [OPTION] + +Options: + -h Show this help message and exit. + -m_a Required. Path to an .xml file with a trained gesture recognition model. + -m_d Required. Path to an .xml file with a trained person detector model. + -i Required. Path to a video file or a device node of a webcam. + -o Optional. Name of the output file(s) to save. + -limit Optional. Number of frames to store in output. If -1 is set, all frames are stored. + -c Required. Path to a file with gesture classes. + -s Optional. Path to a directory with video samples of gestures. + -t Optional. Threshold for the predicted score of an action. + -d_d "" Optional. Target device for Person Detection network (the list of available devices is shown below). + -d_a "" Optional. Target device for Gesture Recognition (the list of available devices is shown below). + -no_show Optional. Don't show output. + -u Optional. List of monitors to show initially. +``` + +Running the application with an empty list of options yields an error message. + +For example, to do inference on a CPU, run the following command: + +```sh +./gesture_recognition_demo_gapi -m_a /asl-recognition-0004.xml \ + -m_d /person-detection-asl-0001.xml \ + -i 0 \ + -c /data/dataset_classes/msasl100.json +``` + +### Run-Time Control Keys + +The demo starts in person tracking mode and to switch it in the action recognition mode you should press `0-9` button with appropriate detection ID (the number in top-left of each bounding box). If frame contains only one person, they will be chosen automatically. After that you can switch back to tracking mode by pressing space button. + +An example of file with class names can be found within the OMZ directory: + +* MS-ASL-100: `/data/dataset_classes/msasl100.json` +* Jester-27: `/data/dataset_classes/jester27.json` +* Common-Sign-Language-12: `/data/dataset_classes/common_sign_language12.json` + + **NOTE**: To run the demo application with video examples of gestures specify the `-s` key with valid path to the directory with video samples. The name of each video sample should be the valid name of gesture from `/data/dataset_classes/msasl100.json` file. To navigate between samples use 'f' and 'b' keys for iterating next and previous video sample, respectively. + +You can save processed results to a Motion JPEG AVI file or separate JPEG or PNG files using the `-o` option: + +* To save processed results in an AVI file, specify the name of the output file with `avi` extension, for example: `-o output.avi`. +* To save processed results as images, specify the template name of the output image file with `jpg` or `png` extension, for example: `-o output_%03d.jpg`. The actual file names are constructed from the template at runtime by replacing regular expression `%03d` with the frame number, resulting in the following: `output_000.jpg`, `output_001.jpg`, and so on. +To avoid disk space overrun in case of continuous input stream, like camera, you can limit the amount of data stored in the output file(s) with the `limit` option. The default value is 1000. To change it, you can apply the `-limit N` option, where `N` is the number of frames to store. + +>**NOTE**: Windows* systems may not have the Motion JPEG codec installed by default. If this is the case, OpenCV FFMPEG backend can be downloaded by the PowerShell script provided with the OpenVINO install package and located at `/opencv/ffmpeg-download.ps1`. Run the script with Administrative privileges. Alternatively, you can save results as images. + +## Demo Output + +The application uses OpenCV to display gesture recognition result and current inference performance. + +## See Also + +* [Open Model Zoo Demos](../../README.md) +* [Model Optimizer](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html) +* [Model Downloader](../../../tools/model_tools/README.md) diff --git a/demos/gesture_recognition_demo/cpp_gapi/create_list.py b/demos/gesture_recognition_demo/cpp_gapi/create_list.py new file mode 100755 index 00000000000..abf454bb551 --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/create_list.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 +''' + Copyright (C) 2021 Intel Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +''' + +import glob +import os +import json +import argparse + +parser = argparse.ArgumentParser() + +parser.add_argument('--gesture_storage', + help='Path to the gesture directory') + +parser.add_argument('--classes_map', + help='Path to the classes file') + +args = parser.parse_args() + +with open(args.classes_map) as json_file: + data = json.load(json_file) + +dir = args.gesture_storage +files_list = [] +for name in data: + list = glob.glob(dir + name + '.mp4') + glob.glob(dir + name + '.avi') + if len(list): + files_list.append(list[0]) + +labels = [] +objects = {} + +for file in files_list: + label = file.rpartition(os.sep)[2].rpartition('.')[0] + path = os.path.abspath(file) + + if label in labels: + raise Exception('An item with the label {} already exists in the gallery!'.format(label)) + else: + labels.append(label) + objects[label] = [path] + +with open('gesture_gallery.json', 'w') as outfile: + json.dump(objects, outfile, indent=4) diff --git a/demos/gesture_recognition_demo/cpp_gapi/gesture_recognition_demo_gapi.hpp b/demos/gesture_recognition_demo/cpp_gapi/gesture_recognition_demo_gapi.hpp new file mode 100644 index 00000000000..37900ca9727 --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/gesture_recognition_demo_gapi.hpp @@ -0,0 +1,64 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include +#include + +DEFINE_INPUT_FLAGS +DEFINE_OUTPUT_FLAGS + +static const char help_message[] = "Print a usage message."; +static const char camera_resolution_message[] = "Optional. Set camera resolution in format WxH."; +static const char person_detection_model_message[] = "Required. Path to an .xml file with a trained person detector model."; +static const char action_recognition_model_message[] = "Required. Path to an .xml file with a trained gesture recognition model."; +static const char target_device_message_d[] = "Optional. Target device for Person Detection network. " + "The demo will look for a suitable plugin for a specified device. Default value is \"CPU\"."; +static const char target_device_message_a[] = "Optional. Target device for Action Recognition network. " + "The demo will look for a suitable plugin for a specified device. Default value is \"CPU\"."; +static const char thresh_output_message[] = "Optional. Threshold for the predicted score of an action. The default value is 0.4."; +static const char class_map_message[] = "Required. Path to a file with gesture classes."; +static const char samples_dir_message[] = "Optional. Path to a .json file that contains paths to samples of gestures."; +static const char no_show_message[] = "Optional. Don't show output."; +static const char utilization_monitors_message[] = "Optional. List of monitors to show initially."; + +DEFINE_bool(h, false, help_message); +DEFINE_string(res, "1280x720", camera_resolution_message); +DEFINE_string(m_a, "", action_recognition_model_message); +DEFINE_string(m_d, "", person_detection_model_message); +DEFINE_string(d_a, "CPU", target_device_message_a); +DEFINE_string(d_d, "CPU", target_device_message_d); +DEFINE_string(c, "", class_map_message); +DEFINE_string(s, "", samples_dir_message); +DEFINE_double(t, 0.8, thresh_output_message); +DEFINE_bool(no_show, false, no_show_message); +DEFINE_string(u, "", utilization_monitors_message); + +/** +* \brief This function shows a help message +*/ + +static void showUsage() { + std::cout << std::endl; + std::cout << "gesture_recognition_demo_gapi [OPTION]" << std::endl; + std::cout << "Options:" << std::endl; + std::cout << std::endl; + std::cout << " -h " << help_message << std::endl; + std::cout << " -i " << input_message << std::endl; + std::cout << " -loop " << loop_message << std::endl; + std::cout << " -o \"\" " << output_message << std::endl; + std::cout << " -limit \"\" " << limit_message << std::endl; + std::cout << " -res \"\" " << camera_resolution_message << std::endl; + std::cout << " -m_d \"\" " << person_detection_model_message << std::endl; + std::cout << " -m_a \"\" " << action_recognition_model_message << std::endl; + std::cout << " -d_d \"\" " << target_device_message_d << std::endl; + std::cout << " -d_a \"\" " << target_device_message_a << std::endl; + std::cout << " -no_show " << no_show_message << std::endl; + std::cout << " -c " << class_map_message << std::endl; + std::cout << " -s " << samples_dir_message << std::endl; + std::cout << " -t " << thresh_output_message << std::endl; + std::cout << " -u " << utilization_monitors_message << std::endl; +} diff --git a/demos/gesture_recognition_demo/cpp_gapi/include/custom_kernels.hpp b/demos/gesture_recognition_demo/cpp_gapi/include/custom_kernels.hpp new file mode 100644 index 00000000000..d594b536ec7 --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/include/custom_kernels.hpp @@ -0,0 +1,72 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include +#include + +#include "tracker.hpp" + +namespace custom { +G_API_OP(GetFastFrame, + , cv::Size)>, "custom.get_fast_frame") { + static cv::GMatDesc outMeta(const cv::GArrayDesc &in, + const cv::Size& frame_size) { + return cv::GMatDesc{CV_8U, 3, frame_size}; + } +}; + +G_API_OP(ExtractBoundingBox, + (cv::GMat, + cv::GMat, + cv::Scalar)>, + "custom.bb_extract") { + static cv::GArrayDesc outMeta(const cv::GMatDesc &in, + const cv::GMatDesc&, + const cv::Scalar) { + return cv::empty_array_desc(); + } +}; + +G_API_OP(TrackPerson, + (cv::GMat, + cv::GArray)>, + "custom.track") { + static cv::GArrayDesc outMeta(const cv::GMatDesc &in, + const cv::GArrayDesc&) { + return cv::empty_array_desc(); + } +}; + +G_API_OP(ConstructClip, + (const cv::GArray, + const cv::GArray, + const cv::Scalar, + const cv::Size, + const cv::GOpaque>)>, + "custom.construct_clip") { + static cv::GArrayDesc outMeta(const cv::GArrayDesc&, + const cv::GArrayDesc&, + const cv::Scalar&, + const cv::Size&, + const cv::GOpaqueDesc&) { + return cv::empty_array_desc(); + } +}; + +G_API_OP(GestureRecognitionPostprocessing, + (cv::GArray, + float)>, + "custom.ar_postproc") { + static cv::GOpaqueDesc outMeta(const cv::GArrayDesc&, + const float) { + return cv::empty_gopaque_desc(); + } +}; + +cv::gapi::GKernelPackage kernels(); +} // namespace custom diff --git a/demos/gesture_recognition_demo/cpp_gapi/include/stream_source.hpp b/demos/gesture_recognition_demo/cpp_gapi/include/stream_source.hpp new file mode 100644 index 00000000000..c750e42625f --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/include/stream_source.hpp @@ -0,0 +1,199 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace custom { +class BatchProducer { +public: + BatchProducer(const int batch_size, const float batch_fps, const std::shared_ptr& drop_batch) + : batch_fps(batch_fps), drop_batch(drop_batch) { + /** Create batch memory space for batch_size + 2 size + * first additional element is fast image + * second additional Mat is sacriface of memory for data about first element + **/ + batch = std::vector(batch_size + 1 + 1); // 16(8) 15FPS-batch imgaes + one fast image + batch description + batch[batch_size + 1].create(cv::Size{ 1, 2 }, CV_8U); // 1x2 Mat for first element position and is_filled batch state + auto ptr = batch[batch.size() - 1].ptr(); + ptr[1] = 0; // set is_filled to NO + } + std::vector getBatch() { + batch_lock.lock(); + std::vector temp_batch = batch; + batch_lock.unlock(); + return temp_batch; + } + + void fillFastFrame(const cv::Mat& frame) { + /** Copy fast frame from VideoCapture to batch memory as 17th (9) image **/ + frame.copyTo(batch[batch.size() - 2]); // 16th (from 0) + } + + void fillBatch(const cv::Mat& frame, std::chrono::steady_clock::time_point time) { + if (*drop_batch) { + DropBatchInfo(); + } + /** Place of new frame in batch **/ + const int step = updateStep(batch.size() - 2); + /** Adding of new image to batch. **/ + frame.copyTo(batch[step]); + /** Putting of info about batch to additional element **/ + auto ptr = batch[batch.size() - 1].ptr(); + ptr[0] = first_el; // position of start of batch in cyclic buffer + const auto cur_step = std::chrono::steady_clock::now() - time; + const auto gap = std::chrono::duration_cast(cur_step); + const auto time_step = std::chrono::milliseconds(int(1000.f / batch_fps)); // 1/15 sec + if (gap < time_step) { + std::this_thread::sleep_for(time_step - gap); // wait for constant step of batch update + } + } +private: + float batch_fps = 0; // constant FPS for batch + const std::shared_ptr drop_batch; // drop parameters of batch + std::vector batch; // pack of images for graph + size_t first_el = 0; // place of first image in batch + size_t images_in_batch_count = 0; // number of images in batch + bool is_filled = false; // is batch filled + std::mutex batch_lock; // batch frames filling will be locked + + int updateStep(const size_t batch_size) { + if (images_in_batch_count < batch_size) { + /** case when batch isn't filled **/ + return images_in_batch_count++; + } else { + if (!is_filled) { + auto ptr = batch[batch.size() - 1].ptr(); + ptr[1] = 1; + is_filled = true; + } + /** Cyclic buffer if filled. Counting of step for next image **/ + first_el = (first_el + 1) % batch_size; + return first_el; + } + } + + void DropBatchInfo() { + /** Drop batch information. + * Processing will continue when the batch will be filled + * Data of the batch will be overwritten */ + auto ptr = batch[batch.size() - 1].ptr(); + ptr[0] = 0; // first position + ptr[1] = 0; // batch if filled + first_el = 0; + images_in_batch_count = 0; + is_filled = false; + } +}; + +static void runBatchFill(const cv::Mat& frame, + BatchProducer& producer, + std::chrono::steady_clock::time_point& time, + bool& is_filling_possible) { + while (is_filling_possible) { + producer.fillBatch(frame, time); + } +} + +class CustomCapSource : public cv::gapi::wip::IStreamSource { +public: + explicit CustomCapSource(const std::shared_ptr& cap, + const cv::Size& frame_size, + const int batch_size, + const float batch_fps, + const std::shared_ptr& drop_batch) + : cap(cap), producer(batch_size, batch_fps, drop_batch), source_fps(cap->fps()) { + if (source_fps <= 0.) { + source_fps = 30.; + wait_gap = true; + slog::warn << "Got a non-positive value as FPS of the input. Interpret it as 30 FPS" << slog::endl; + } + /** Create and get first image for batch **/ + GAPI_Assert(first_batch.empty()); + if (batch_size == 0 || batch_size == 1) { + GAPI_Assert(false && "Batch must contain more than one image"); + } + + /** Reading of frame with ImagesCapture class **/ + read_time = std::chrono::steady_clock::now(); + cv::Mat fast_frame = cap->read(); + if (!fast_frame.data) { + GAPI_Assert(false && "Couldn't grab the frame"); + } + producer.fillFastFrame(fast_frame); + fast_frame.copyTo(thread_frame); + /** Batch filling with constant time step **/ + std::thread fill_bath_thr(runBatchFill, + std::cref(thread_frame), + std::ref(producer), + std::ref(read_time), + std::ref(is_filling_possible)); + fill_bath_thr.detach(); + first_batch = producer.getBatch(); + } + +protected: + std::shared_ptr cap; // wrapper for cv::VideoCapture + BatchProducer producer; // class batch-construcor + double source_fps = 0.; // input source framerate + bool wait_gap = false; // waiting for fast frame reading (stop main thread when got a non-positive FPS value) + bool first_pulled = false; // is first already pulled + std::vector first_batch; // batch from constructor + cv::Mat thread_frame; // frame for batch constant filling + std::mutex thread_frame_lock; // lock for shared frame + std::chrono::steady_clock::time_point read_time; // timepoint from cv::read() + bool is_filling_possible = true; // access for batch filling + + virtual bool pull(cv::gapi::wip::Data& data) override { + /** Is first already pulled **/ + if (!first_pulled) { + GAPI_Assert(!first_batch.empty()); + first_pulled = true; + cv::detail::VectorRef ref(std::move(first_batch)); + data = std::move(ref); + return true; + } + + /** Frame reading with ImagesCapture class **/ + read_time = std::chrono::steady_clock::now(); + cv::Mat fast_frame = cap->read(); + + if (!fast_frame.data) { + is_filling_possible = false; + return false; + } + + thread_frame_lock.lock(); + fast_frame.copyTo(thread_frame); + thread_frame_lock.unlock(); + + /** Put fast frame to the batch **/ + producer.fillFastFrame(fast_frame); + if (wait_gap) { + const auto cur_step = std::chrono::steady_clock::now() - read_time; + const auto gap = std::chrono::duration_cast(cur_step); + const auto time_step = std::chrono::milliseconds(int(1000.f / source_fps)); + if (gap < time_step) { + std::this_thread::sleep_for(time_step - gap); + } + } + + /** Put pulled batch to GRunArg data **/ + cv::detail::VectorRef ref(std::move(producer.getBatch())); + data = std::move(ref); + return true; + } + + virtual cv::GMetaArg descr_of() const override { + GAPI_Assert(!first_batch.empty()); + return cv::GMetaArg{ cv::empty_array_desc() }; + } +}; +} // namespace custom diff --git a/demos/gesture_recognition_demo/cpp_gapi/include/tracker.hpp b/demos/gesture_recognition_demo/cpp_gapi/include/tracker.hpp new file mode 100644 index 00000000000..7c4224f14cb --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/include/tracker.hpp @@ -0,0 +1,234 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include +#include + +struct TrackedObject { + cv::Rect rect; + float confidence = -1.0f; + int object_id = -1; + size_t frame_idx = -1; +}; + +using TrackedObjects = std::vector; + +/// +/// \brief The Params struct stores parameters of Tracker. +/// +struct TrackerParams { + size_t min_track_duration; ///< Min track duration in frames + + size_t forget_delay; ///< Forget about track if the last bounding box in + /// track was detected more than specified number of + /// frames ago. + + float affinity_thr; ///< Affinity threshold which is used to determine if + /// tracklet and detection should be combined. + + float shape_affinity_w; ///< Shape affinity weight. + + float motion_affinity_w; ///< Motion affinity weight. + + bool drop_forgotten_tracks; ///< Drop forgotten tracks. If it's enabled it + /// disables an ability to get detection log. + + int max_num_objects_in_track; ///< The number of objects in track is + /// restricted by this parameter. If it is negative or zero, the max number of + /// objects in track is not restricted. + + int averaging_window_size_for_rects; ///< The number of objects in track for averaging rects of predictions. + int averaging_window_size_for_labels; ///< The number of objects in track for averaging labels of predictions. + + /// + /// Default constructor. + /// + TrackerParams(); +}; + +/// +/// \brief The Track struct describes tracks. +/// +struct Track { + /// + /// \brief Track constructor. + /// \param objs Detected objects sequence. + /// + explicit Track(const TrackedObjects &objs) : objects(objs), lost(0), length(1) { + CV_Assert(!objs.empty()); + first_object = objs[0]; + } + + /// + /// \brief empty returns if track does not contain objects. + /// \return true if track does not contain objects. + /// + bool empty() const { return objects.empty(); } + + /// + /// \brief size returns number of detected objects in a track. + /// \return number of detected objects in a track. + /// + size_t size() const { return objects.size(); } + + /// + /// \brief operator [] return const reference to detected object with + /// specified index. + /// \param i Index of object. + /// \return const reference to detected object with specified index. + /// + const TrackedObject &operator[](size_t i) const { return objects[i]; } + + /// + /// \brief operator [] return non-const reference to detected object with + /// specified index. + /// \param i Index of object. + /// \return non-const reference to detected object with specified index. + /// + TrackedObject &operator[](size_t i) { return objects[i]; } + + /// + /// \brief back returns const reference to last object in track. + /// \return const reference to last object in track. + /// + const TrackedObject &back() const { + CV_Assert(!empty()); + return objects.back(); + } + + /// + /// \brief back returns non-const reference to last object in track. + /// \return non-const reference to last object in track. + /// + TrackedObject &back() { + CV_Assert(!empty()); + return objects.back(); + } + + TrackedObjects objects; ///< Detected objects; + size_t lost; ///< How many frames ago track has been lost. + + TrackedObject first_object; ///< First object in track. + size_t length; ///< Length of a track including number of objects that were + /// removed from track in order to avoid memory usage growth. +}; + +/// +/// \brief Simple Hungarian algorithm-based tracker. +/// +class Tracker { +public: + /// + /// \brief Constructor that creates an instance of Tracker with + /// parameters. + /// \param[in] params Tracker parameters. + /// + explicit Tracker(const TrackerParams ¶ms = TrackerParams()) + : params_(params), + tracks_counter_(0), + frame_size_() {} + + /// + /// \brief process given frame. + /// \param[in] frame Colored image (CV_8UC3). + /// \param[in] detections Detected objects on the frame. + /// \param[in] timestamp Timestamp must be positive and measured in + /// milliseconds + /// + void process(const cv::Mat &frame, const TrackedObjects &detections); + + /// + /// \brief Get tracked detections with labels. + /// \return Tracked detections. + /// + TrackedObjects trackedDetectionsWithLabels() const; + + /// + /// \brief isTrackForgotten returns true if track is forgotten. + /// \param id Track ID. + /// \return true if track is forgotten. + /// + bool isTrackForgotten(size_t id) const; + + /// + /// \brief tracks Returns all tracks including forgotten (lost too many frames + /// ago). + /// \return Set of tracks {id, track}. + /// + const std::unordered_map &tracks() const; + + /// + /// \brief tracks Returns all tracks including forgotten (lost too many frames + /// ago). + /// \return Vector of tracks + /// + std::vector vector_tracks() const; + + /// + /// \brief IsTrackValid Checks whether track is valid (duration > threshold). + /// \param id Index of checked track. + /// \return True if track duration exceeds some predefined value. + /// + bool isTrackValid(size_t id) const; + + /// + /// \brief DropForgottenTracks Removes tracks from memory that were lost too + /// many frames ago. + /// + void dropForgottenTracks(); + +private: + const std::set &active_track_ids() const { return active_track_ids_; } + + float shapeAffinity(const cv::Rect &trk, const cv::Rect &det); + float motionAffinity(const cv::Rect &trk, const cv::Rect &det); + + void solveAssignmentProblem( + const std::set &track_ids, const TrackedObjects &detections, + std::set *unmatched_tracks, + std::set *unmatched_detections, + std::set> *matches); + + void computeDissimilarityMatrix(const std::set &active_track_ids, + const TrackedObjects &detections, + cv::Mat *dissimilarity_matrix); + + float distance(const TrackedObject &obj1, const TrackedObject &obj2); + + void addNewTrack(const TrackedObject &detection); + + void addNewTracks(const TrackedObjects &detections); + + void addNewTracks(const TrackedObjects &detections, + const std::set &ids); + + void appendToTrack(size_t track_id, const TrackedObject &detection); + + bool eraseTrackIfBBoxIsOutOfFrame(size_t track_id); + + bool eraseTrackIfItWasLostTooManyFramesAgo(size_t track_id); + + bool uptateLostTrackAndEraseIfItsNeeded(size_t track_id); + + void updateLostTracks(const std::set &track_ids); + + // Parameters of the pipeline. + TrackerParams params_; + + // Indexes of active tracks. + std::set active_track_ids_; + + // All tracks. + std::unordered_map tracks_; + + // Number of all current tracks. + size_t tracks_counter_; + + cv::Size frame_size_; + + size_t frame_idx_ = 0; +}; diff --git a/demos/gesture_recognition_demo/cpp_gapi/include/utils.hpp b/demos/gesture_recognition_demo/cpp_gapi/include/utils.hpp new file mode 100644 index 00000000000..eea828ad63f --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/include/utils.hpp @@ -0,0 +1,17 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include + +cv::Scalar getNetShape(const std::string& path); + +void erase(std::string& str, const char symbol); + +template +void erase(std::string& str, const char symbol, Sargs... symbols); + +std::vector fill_labels(const std::string& dir); diff --git a/demos/gesture_recognition_demo/cpp_gapi/include/visualizer.hpp b/demos/gesture_recognition_demo/cpp_gapi/include/visualizer.hpp new file mode 100644 index 00000000000..48bc2aef99d --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/include/visualizer.hpp @@ -0,0 +1,64 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "opencv2/imgproc.hpp" +#include +#include "tracker.hpp" + +#include + +class Visualizer { +private: + cv::Mat storageFrame; + bool no_show_; + std::string storage_window_name_; + std::vector labels_; + std::string storage_path_; + std::vector> storage_elements_; + cv::VideoCapture gesture_cap_; + int last_gesture = 0; + std::string last_gesture_path = ""; + int last_action_ = -1; + + const cv::Scalar RED = {0, 0, 255}; + const cv::Scalar GREEN = {0, 255, 0}; + + void getStorageElements(); + + int getPlaceByKey(const int key); + + void updateCap(const std::string& path); + + void applyDrawing(const cv::Mat& frame, + const TrackedObjects out_detections, + const int out_label_number, + const size_t current_id); +public: + Visualizer(const bool no_show, + const std::string& storage_window_name, + const std::vector& labels, + const std::string& storage_path) : + no_show_(no_show), storage_window_name_(storage_window_name), + labels_(labels), storage_path_(storage_path) { + if (storage_path_.size() > 0) { + getStorageElements(); + } + if (no_show) { + return; + } + + if (storage_path_.size() > 0) { + cv::namedWindow(storage_window_name_); + gesture_cap_.open(storage_elements_.front().second); + } + } + + void show(const cv::Mat& frame, + const TrackedObjects out_detections, + const int out_label_number, + const size_t current_id, + const int key); +}; diff --git a/demos/gesture_recognition_demo/cpp_gapi/main.cpp b/demos/gesture_recognition_demo/cpp_gapi/main.cpp new file mode 100644 index 00000000000..97428bb2053 --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/main.cpp @@ -0,0 +1,212 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include +#include +#include + +#include + +#include + +#include "gesture_recognition_demo_gapi.hpp" +#include "stream_source.hpp" +#include "utils.hpp" +#include "custom_kernels.hpp" +#include "visualizer.hpp" + +bool ParseAndCheckCommandLine(int argc, char *argv[]) { + /** ---------- Parsing and validating input arguments ----------**/ + gflags::ParseCommandLineNonHelpFlags(&argc, &argv, true); + if (FLAGS_h) { + showUsage(); + showAvailableDevices(); + return false; + } + slog::info << "Parsing input parameters" << slog::endl; + if (FLAGS_i.empty()) + throw std::logic_error("Parameter -i is not set"); + if (FLAGS_m_a.empty()) + throw std::logic_error("Parameter -m_a is not set"); + if (FLAGS_m_d.empty()) + throw std::logic_error("Parameter -m_d is not set"); + if (FLAGS_c.empty()) + throw std::logic_error("Parameter -c is not set"); + + return true; +} + +namespace nets { +G_API_NET(PersonDetection, , "person_detection"); +G_API_NET(ActionRecognition, , "action_recognition"); +} + +int main(int argc, char *argv[]) { + try { + PerformanceMetrics metrics; + if (!ParseAndCheckCommandLine(argc, argv)) { + return 0; + } + + /** Get information about nets **/ + const auto pd_net_shape = getNetShape(FLAGS_m_d); + const auto ar_net_shape = getNetShape(FLAGS_m_a); + + /** Get information about frame from cv::VideoCapture **/ + std::shared_ptr cap = openImagesCapture(FLAGS_i, FLAGS_loop, 0, + std::numeric_limits::max(), stringToSize(FLAGS_res)); + const auto tmp = cap->read(); + cap.reset(); + if (!tmp.data) { + throw std::runtime_error("Couldn't grab first frame"); + } + cv::Size frame_size = cv::Size{tmp.cols, tmp.rows}; + cap = openImagesCapture(FLAGS_i, FLAGS_loop, 0, + std::numeric_limits::max(), stringToSize(FLAGS_res)); + + /** Share runtime id with graph **/ + auto current_person_id_m = std::make_shared(0); + + /** ---------------- Main graph of demo ---------------- **/ + /** Graph inputs **/ + cv::GArray batch; + cv::GOpaque> current_person_id; + + cv::GMat fast_frame = custom::GetFastFrame::on(batch, frame_size); + + /** Person detection **/ + cv::GMat detections = cv::gapi::infer(fast_frame); + + /** Get ROIs from detections **/ + cv::GArray objects = custom::ExtractBoundingBox::on(detections, fast_frame, pd_net_shape); + + /** Track detection **/ + cv::GArray tracked = custom::TrackPerson::on(fast_frame, objects); + + /** Create clip for AR net **/ + cv::GArray clip = custom::ConstructClip::on(batch, tracked, ar_net_shape, frame_size, current_person_id); + + /** Action recognition **/ + cv::GArray actions = cv::gapi::infer2(fast_frame, clip); + + /** Get action label **/ + cv::GOpaque label = custom::GestureRecognitionPostprocessing::on(actions, float(FLAGS_t)); + + /** Inputs and outputs of graph **/ + auto graph = cv::GComputation(cv::GIn(batch, current_person_id), cv::GOut(fast_frame, tracked, label)); + /** ---------------- End of graph ---------------- **/ + /** Configure networks **/ + auto person_detection = cv::gapi::ie::Params { + FLAGS_m_d, // path to model + fileNameNoExt(FLAGS_m_d) + ".bin", // path to weights + FLAGS_d_d // device to use + }.cfgOutputLayers({"boxes"}); // This clarification here because + // of GAPI take the last layer from .xml + // and last layer sould be the outpul layer + + auto action_recognition = cv::gapi::ie::Params { + FLAGS_m_a, // path to model + fileNameNoExt(FLAGS_m_a) + ".bin", // path to weights + FLAGS_d_a // device to use + }.cfgOutputLayers({"output"}); // The same + + /** Custom kernels **/ + auto kernels = custom::kernels(); + auto networks = cv::gapi::networks(person_detection, action_recognition); + auto comp = cv::compile_args(kernels, networks); + auto pipeline = graph.compileStreaming(std::move(comp)); + + /** Output containers for results **/ + cv::Mat out_frame; + TrackedObjects out_detections; + int out_label_number; + + /** ---------------- The execution part ---------------- **/ + const float batch_constant_FPS = 15; + auto drop_batch = std::make_shared(false); + pipeline.setSource(cv::gin(cv::gapi::wip::make_src(cap, + frame_size, + int(ar_net_shape[1]), + batch_constant_FPS, + drop_batch), + current_person_id_m)); + + std::string gestureWindowName = "Gesture"; + + cv::Size graphSize{static_cast(frame_size.width / 4), 60}; + Presenter presenter(FLAGS_u, frame_size.height - graphSize.height - 10, graphSize); + + /** Save output result **/ + cv::VideoWriter videoWriter; + if (!FLAGS_o.empty() && !videoWriter.open(FLAGS_o, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'), + cap->fps(), frame_size)) { + throw std::runtime_error("Can't open video writer"); + } + + /** Fill labels container from file with classes **/ + const auto labels = fill_labels(FLAGS_c); + size_t current_id = 0; + size_t last_id = current_id; + int gesture = 0; + + /** Configure drawing utilities **/ + Visualizer visualizer(FLAGS_no_show, gestureWindowName, labels, FLAGS_s); + + bool isStart = true; + const auto startTime = std::chrono::steady_clock::now(); + pipeline.start(); + while (pipeline.pull(std::move(cv::gout(out_frame, out_detections, out_label_number)))) { + /** Put FPS to frame**/ + if (isStart) { + metrics.update(startTime, out_frame, { 10, 22 }, cv::FONT_HERSHEY_COMPLEX, + 0.65, { 200, 10, 10 }, 2, PerformanceMetrics::MetricTypes::FPS); + isStart = false; + } else { + metrics.update({}, out_frame, { 10, 22 }, cv::FONT_HERSHEY_COMPLEX, + 0.65, { 200, 10, 10 }, 2, PerformanceMetrics::MetricTypes::FPS); + } + + /** Display system parameters **/ + presenter.drawGraphs(out_frame); + /** Display the results **/ + visualizer.show(out_frame, out_detections, out_label_number, current_id, gesture); + gesture = 0; + + if (videoWriter.isOpened()) { + videoWriter.write(out_frame); + } + + /** Controls **/ + int key = cv::waitKey(1); + if (key == 0x1B) break; // (esc button) exit + else if (key >= 48 && key <= 57) current_id = key - 48; // buttons for person id + else if (key == 0x0D) out_label_number = -1; // (Enter) reset last gesture + else if (key == 'f') gesture = 1; // next gesture + else if (key == 'b') gesture = -1; // prev gesture + else + presenter.handleKey(key); + + /** Share id with graph **/ + if (current_id < out_detections.size()) { + *drop_batch = last_id != current_id; + *current_person_id_m = current_id; + last_id = current_id; + } + } + slog::info << "Metrics report:" << slog::endl; + slog::info << "\tFPS: " << std::fixed << std::setprecision(1) << metrics.getTotal().fps << slog::endl; + slog::info << presenter.reportMeans() << slog::endl; + } + catch (const std::exception& error) { + slog::err << error.what() << slog::endl; + return 1; + } + catch (...) { + slog::err << "Unknown/internal exception happened." << slog::endl; + return 1; + } + slog::info << "Execution successful" << slog::endl; + + return 0; +} diff --git a/demos/gesture_recognition_demo/cpp_gapi/models.lst b/demos/gesture_recognition_demo/cpp_gapi/models.lst new file mode 100644 index 00000000000..6d0c12136d6 --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/models.lst @@ -0,0 +1,4 @@ +# This file can be used with the --list option of the model downloader. +asl-recognition-???? +common-sign-language-???? +person-detection-asl-???? diff --git a/demos/gesture_recognition_demo/cpp_gapi/src/custom_kernels.cpp b/demos/gesture_recognition_demo/cpp_gapi/src/custom_kernels.cpp new file mode 100644 index 00000000000..e3e5a1ea576 --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/src/custom_kernels.cpp @@ -0,0 +1,213 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "custom_kernels.hpp" +#include +#include + +const float BOUNDING_BOX_THRESHOLD = 0.4f; +const int ACTION_IMAGE_SCALE = 256; + +namespace { +cv::Rect convert_to_central_roi(const cv::Rect& person_roi, + const cv::Size& in_size, + const size_t scale) { + const int roi_height = person_roi.height; + const int roi_width = person_roi.width; + + const int src_roi_center_x = int(0.5 * (person_roi.tl().x + person_roi.br().x)); + const int src_roi_center_y = int(0.5 * (person_roi.tl().y + person_roi.br().y)); + + const float height_scale = float(in_size.height) / float(scale); + const float width_scale = float(in_size.width) / float(scale); + + CV_DbgAssert(height_scale < 1.0f); + CV_DbgAssert(width_scale < 1.0f); + + const int min_roi_size = std::min(roi_height, roi_width); + const int trg_roi_height = int(height_scale * min_roi_size); + const int trg_roi_width = int(width_scale * min_roi_size); + + return cv::Rect(int(src_roi_center_x - 0.5 * trg_roi_width), + int(src_roi_center_y - 0.5 * trg_roi_height), + trg_roi_width, + trg_roi_height); +} +} // anonymous namespace + +GAPI_OCV_KERNEL(OCVGetFastFrame, custom::GetFastFrame) { + static void run(const std::vector& batch, + const cv::Size& image_size, + cv::Mat& frame) { + const uint8_t* ptrI = batch[batch.size() - 2].ptr(); + std::copy(ptrI, ptrI + image_size.area() * 3, frame.ptr()); + } +}; + +GAPI_OCV_KERNEL(OCVExtractBoundingBox, custom::ExtractBoundingBox) { + static void run(const cv::Mat& in_ssd_result, + const cv::Mat& in_frame, + const cv::Scalar& net_size, + TrackedObjects& detections) { + float scaling_x = float(in_frame.size().width / net_size[3]); + float scaling_y = float(in_frame.size().height / net_size[2]); + + detections.clear(); + const float *data = in_ssd_result.ptr(); + for (int i = 0; i < 100; i++) { + const int OBJECT_SIZE = 5; + + const float x_min = data[i * OBJECT_SIZE + 0]; + const float y_min = data[i * OBJECT_SIZE + 1]; + const float x_max = data[i * OBJECT_SIZE + 2]; + const float y_max = data[i * OBJECT_SIZE + 3]; + const float conf = data[i * OBJECT_SIZE + 4]; + + if (conf > BOUNDING_BOX_THRESHOLD) { + TrackedObject object; + object.rect = cv::Rect(static_cast(x_min * scaling_x), + static_cast(y_min * scaling_y), + static_cast((x_max - x_min) * scaling_x), + static_cast((y_max - y_min) * scaling_y)); + object.confidence = conf; + detections.push_back(object); + } + } + } +}; + +GAPI_OCV_KERNEL_ST(OCVTrackPerson, custom::TrackPerson, Tracker) { + static void setup(const cv::GMatDesc&, + const cv::GArrayDesc&, + std::shared_ptr& tracker_action, + const cv::GCompileArgs& compileArgs) { + TrackerParams tracker_action_params; + tracker_action_params.min_track_duration = 20; + tracker_action_params.forget_delay = 150; + tracker_action_params.affinity_thr = 0.9f; + tracker_action_params.averaging_window_size_for_rects = 5; + tracker_action_params.averaging_window_size_for_labels = 1; + tracker_action_params.drop_forgotten_tracks = true; + tracker_action_params.max_num_objects_in_track = 5; + tracker_action = std::make_shared(tracker_action_params); + } + static void run(const cv::Mat& frame, + const TrackedObjects& actions, + TrackedObjects& tracked_actions, + Tracker& tracker_action) { + tracker_action.process(frame, actions); + tracked_actions = tracker_action.trackedDetectionsWithLabels(); + } +}; + +namespace BatchState { +struct Params { + cv::Mat current_frame; + cv::Mat prepared_mat; + std::atomic last_id; + Params() {} + Params(const Params& params) { + current_frame = params.current_frame; + prepared_mat = params.prepared_mat; + last_id.fetch_add(params.last_id); + } +}; +} // namespace BatchState + +GAPI_OCV_KERNEL_ST(OCVConstructClip, custom::ConstructClip, BatchState::Params) { + static void setup(const cv::GArrayDesc&, + const cv::GArrayDesc&, + const cv::Scalar& net_size, + const cv::Size& image_size, + const cv::GOpaqueDesc&, + std::shared_ptr& state) { + BatchState::Params params; + params.last_id = 0; + params.prepared_mat.create(std::vector{1, + int(net_size[0]), + int(net_size[1]), + int(net_size[2]), + int(net_size[3])}, CV_32F); + state = std::make_shared(params); + } + static void run(const std::vector& batch, + const TrackedObjects& tracked_persons, + const cv::Scalar& net_size, + const cv::Size& image_size, + const std::shared_ptr& current_person_id, + std::vector& wrapped_mat, + BatchState::Params& state) { + const int duration = int(net_size[1]); + const int height = int(net_size[2]); + const int width = int(net_size[3]); + const auto ptr = batch[batch.size() - 1].ptr(); + auto p_pm = state.prepared_mat.ptr(); + + if (ptr[1] > 0) { // is filled and updated + int step = ptr[0]; // first + size_t& person_id = *current_person_id; + if (person_id < tracked_persons.size()) { // wrong number protection + state.last_id = person_id; + } + for (int i = 0; i < duration; ++i) { + cv::Mat current_frame = batch[step]; + if (++step > (duration - 1)) { + step = 0; + } + + if (tracked_persons.size() > 0) { + cv::Mat crop, cvt, resized; + cv::Rect roi = tracked_persons.at(state.last_id).rect; + + crop = current_frame(convert_to_central_roi(roi, + cv::Size(height, width), + ACTION_IMAGE_SCALE)); + + crop.convertTo(cvt, CV_32F); + cv::resize(cvt, resized, cv::Size{height, width}); + + cv::Mat different_channels[3]; + cv::split(resized, different_channels); + + std::vector rgb = {different_channels[2].ptr(), + different_channels[1].ptr(), + different_channels[0].ptr()}; + + for (int ch = 0; ch < 3; ++ch) { + std::copy(rgb[ch], rgb[ch] + height * width, + p_pm + ch * duration * height * width + + i * height * width); + } + } + } + } + wrapped_mat.push_back(state.prepared_mat); + } +}; + +GAPI_OCV_KERNEL(OCVGestureRecognitionPostprocessing, custom::GestureRecognitionPostprocessing) { + static void run(const std::vector& asl_result, + const float ar_threshold, + int& label_number) { + label_number = -1; + if (!asl_result.empty()) { + double min = 0., max = 0.; + int minIdx = 0, maxIdx = 0; + const float* data = asl_result[0].ptr(); + // Find more suitable action + cv::minMaxIdx(asl_result[0].reshape(1, {int(asl_result[0].total())}), &min, &max, &minIdx, &maxIdx); + if (data[maxIdx] > ar_threshold) { + label_number = maxIdx; + } + } + } +}; + +cv::gapi::GKernelPackage custom::kernels() { + return cv::gapi::kernels(); +} diff --git a/demos/gesture_recognition_demo/cpp_gapi/src/tracker.cpp b/demos/gesture_recognition_demo/cpp_gapi/src/tracker.cpp new file mode 100644 index 00000000000..e24054b5546 --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/src/tracker.cpp @@ -0,0 +1,310 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "tracker.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +cv::Point center(const cv::Rect &rect) { + int x = static_cast(rect.x + rect.width * 0.5); + int y = static_cast(rect.y + rect.height * 0.5); + CV_DbgAssert(x); + CV_DbgAssert(y); + return cv::Point(x, y); +} + +// FIXME: Need to simplify tracker for this demo +TrackerParams::TrackerParams() + : min_track_duration(25), + forget_delay(150), + affinity_thr(0.85f), + shape_affinity_w(0.5f), + motion_affinity_w(0.2f), + drop_forgotten_tracks(true), + max_num_objects_in_track(300), + averaging_window_size_for_rects(1), + averaging_window_size_for_labels(1) {} + +void Tracker::solveAssignmentProblem( + const std::set &track_ids, const TrackedObjects &detections, + std::set *unmatched_tracks, std::set *unmatched_detections, + std::set> *matches) { + CV_Assert(unmatched_tracks); + CV_Assert(unmatched_detections); + unmatched_tracks->clear(); + unmatched_detections->clear(); + + CV_Assert(!track_ids.empty()); + CV_Assert(!detections.empty()); + CV_Assert(matches); + matches->clear(); + + cv::Mat dissimilarity; + computeDissimilarityMatrix(track_ids, detections, &dissimilarity); + + auto res = KuhnMunkres().Solve(dissimilarity); + + for (size_t i = 0; i < detections.size(); i++) { + unmatched_detections->insert(i); + } + + size_t i = 0; + for (auto id : track_ids) { + if (res[i] < detections.size()) { + matches->emplace(id, res[i], 1 - dissimilarity.at(i, res[i])); + } else { + unmatched_tracks->insert(id); + } + i++; + } +} + +bool Tracker::eraseTrackIfBBoxIsOutOfFrame(size_t track_id) { + if (tracks_.find(track_id) == tracks_.end()) return true; + auto c = center(tracks_.at(track_id).back().rect); + if (frame_size_ != cv::Size() && + (c.x < 0 || c.y < 0 || c.x > frame_size_.width || + c.y > frame_size_.height)) { + tracks_.at(track_id).lost = params_.forget_delay + 1; + active_track_ids_.erase(track_id); + return true; + } + return false; +} + +bool Tracker::eraseTrackIfItWasLostTooManyFramesAgo(size_t track_id) { + if (tracks_.find(track_id) == tracks_.end()) return true; + if (tracks_.at(track_id).lost > params_.forget_delay) { + active_track_ids_.erase(track_id); + return true; + } + return false; +} + +bool Tracker::uptateLostTrackAndEraseIfItsNeeded(size_t track_id) { + tracks_.at(track_id).lost++; + bool erased = eraseTrackIfBBoxIsOutOfFrame(track_id); + if (!erased) erased = eraseTrackIfItWasLostTooManyFramesAgo(track_id); + return erased; +} + +void Tracker::updateLostTracks(const std::set &track_ids) { + for (auto track_id : track_ids) { + uptateLostTrackAndEraseIfItsNeeded(track_id); + } +} + +void Tracker::process(const cv::Mat &frame, const TrackedObjects &detections) { + if (frame_size_ == cv::Size()) { + frame_size_ = frame.size(); + } else { + CV_Assert(frame_size_ == frame.size()); + } + + for (auto &obj : detections) { + *const_cast(&obj.frame_idx) = frame_idx_; + } + + ++frame_idx_; + auto active_tracks = active_track_ids_; + + if (!active_tracks.empty() && !detections.empty()) { + std::set unmatched_tracks, unmatched_detections; + std::set> matches; + + solveAssignmentProblem(active_tracks, detections, &unmatched_tracks, + &unmatched_detections, &matches); + + for (const auto &match : matches) { + size_t track_id = std::get<0>(match); + size_t det_id = std::get<1>(match); + float conf = std::get<2>(match); + if (conf > params_.affinity_thr) { + appendToTrack(track_id, detections[det_id]); + unmatched_detections.erase(det_id); + } else { + unmatched_tracks.insert(track_id); + } + } + + addNewTracks(detections, unmatched_detections); + updateLostTracks(unmatched_tracks); + + for (size_t id : active_tracks) { + eraseTrackIfBBoxIsOutOfFrame(id); + } + } else { + addNewTracks(detections); + updateLostTracks(active_tracks); + } + + if (params_.drop_forgotten_tracks) dropForgottenTracks(); +} + +void Tracker::dropForgottenTracks() { + std::unordered_map new_tracks; + std::set new_active_tracks; + + size_t max_id = 0; + if (!active_track_ids_.empty()) + max_id = + *std::max_element(active_track_ids_.begin(), active_track_ids_.end()); + + const size_t kMaxTrackID = 10000; + bool reassign_id = max_id > kMaxTrackID; + + size_t counter = 0; + for (const auto &pair : tracks_) { + if (!isTrackForgotten(pair.first)) { + new_tracks.emplace(reassign_id ? counter : pair.first, pair.second); + new_active_tracks.emplace(reassign_id ? counter : pair.first); + counter++; + } + } + tracks_.swap(new_tracks); + active_track_ids_.swap(new_active_tracks); + + tracks_counter_ = reassign_id ? counter : tracks_counter_; +} + +float Tracker::shapeAffinity(const cv::Rect &trk, const cv::Rect &det) { + float w_dist = static_cast(std::fabs(trk.width - det.width)) / static_cast(trk.width + det.width); + float h_dist = static_cast(std::fabs(trk.height - det.height)) / static_cast(trk.height + det.height); + return exp(-params_.shape_affinity_w * (w_dist + h_dist)); +} + +float Tracker::motionAffinity(const cv::Rect &trk, const cv::Rect &det) { + float x_dist = static_cast(trk.x - det.x) * (trk.x - det.x) / + (det.width * det.width); + float y_dist = static_cast(trk.y - det.y) * (trk.y - det.y) / + (det.height * det.height); + return exp(-params_.motion_affinity_w * (x_dist + y_dist)); +} + +void Tracker::computeDissimilarityMatrix(const std::set &active_tracks, + const TrackedObjects &detections, + cv::Mat *dissimilarity_matrix) { + dissimilarity_matrix->create(active_tracks.size(), detections.size(), CV_32F); + size_t i = 0; + for (auto id : active_tracks) { + auto ptr = dissimilarity_matrix->ptr(i); + for (size_t j = 0; j < detections.size(); j++) { + auto last_det = tracks_.at(id).objects.back(); + ptr[j] = distance(last_det, detections[j]); + } + i++; + } +} + +void Tracker::addNewTracks(const TrackedObjects &detections) { + for (size_t i = 0; i < detections.size(); i++) { + addNewTrack(detections[i]); + } +} + +void Tracker::addNewTracks(const TrackedObjects &detections, + const std::set &ids) { + for (size_t i : ids) { + CV_Assert(i < detections.size()); + addNewTrack(detections[i]); + } +} + +void Tracker::addNewTrack(const TrackedObject &detection) { + auto detection_with_id = detection; + detection_with_id.object_id = tracks_counter_; + tracks_.emplace( + std::pair(tracks_counter_, Track({detection_with_id}))); + + active_track_ids_.insert(tracks_counter_); + tracks_counter_++; +} + +void Tracker::appendToTrack(size_t track_id, const TrackedObject &detection) { + CV_Assert(!isTrackForgotten(track_id)); + + auto detection_with_id = detection; + detection_with_id.object_id = track_id; + + auto &track = tracks_.at(track_id); + + track.objects.emplace_back(detection_with_id); + track.lost = 0; + track.length++; + + if (params_.max_num_objects_in_track > 0) { + while (track.size() > + static_cast(params_.max_num_objects_in_track)) { + track.objects.erase(track.objects.begin()); + } + } +} + +float Tracker::distance(const TrackedObject &obj1, const TrackedObject &obj2) { + const float eps = 1e-6f; + float shp_aff = shapeAffinity(obj1.rect, obj2.rect); + if (shp_aff < eps) return 1.0; + + float mot_aff = motionAffinity(obj1.rect, obj2.rect); + if (mot_aff < eps) return 1.0; + + return 1.0f - shp_aff * mot_aff; +} + +bool Tracker::isTrackValid(size_t id) const { + const auto &track = tracks_.at(id); + const auto &objects = track.objects; + if (objects.empty()) { + return false; + } + size_t duration_frames = objects.back().frame_idx - track.first_object.frame_idx; + if (duration_frames < params_.min_track_duration) + return false; + return true; +} + +bool Tracker::isTrackForgotten(size_t id) const { + return tracks_.at(id).lost > params_.forget_delay; +} + +TrackedObjects Tracker::trackedDetectionsWithLabels() const { + TrackedObjects detections; + + for (size_t idx : active_track_ids()) { + const auto& track = tracks().at(idx); + if (isTrackValid(idx) && !track.lost) { + TrackedObject object = track.objects.back(); + int counter = 1; + size_t start = static_cast(track.objects.size()) >= params_.averaging_window_size_for_rects ? + track.objects.size() - params_.averaging_window_size_for_rects : 0; + + for (size_t i = start; i < track.objects.size() - 1; i++) { + object.rect.width += track.objects[i].rect.width; + object.rect.height += track.objects[i].rect.height; + object.rect.x += track.objects[i].rect.x; + object.rect.y += track.objects[i].rect.y; + counter++; + } + object.rect.width /= counter; + object.rect.height /= counter; + object.rect.x /= counter; + object.rect.y /= counter; + + object.object_id = idx; + + detections.push_back(object); + } + } + return detections; +} + +const std::unordered_map &Tracker::tracks() const { + return tracks_; +} diff --git a/demos/gesture_recognition_demo/cpp_gapi/src/utils.cpp b/demos/gesture_recognition_demo/cpp_gapi/src/utils.cpp new file mode 100644 index 00000000000..3403a825865 --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/src/utils.cpp @@ -0,0 +1,47 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#define _USE_MATH_DEFINES + +#include "utils.hpp" + +cv::Scalar getNetShape(const std::string& path) { + const auto network = InferenceEngine::Core{}.ReadNetwork(path); + const auto layerData = network.getInputsInfo().begin()->second; + const auto layerDims = layerData->getTensorDesc().getDims(); + + const int step = layerDims.size() == 5 ? 1 : 0; + return cv::Scalar(double(layerDims[0 + step]), + double(layerDims[1 + step]), + double(layerDims[2 + step]), + double(layerDims[3 + step])); +} + +void erase(std::string& str, const char symbol) { + str.erase(std::remove(str.begin(), str.end(), symbol), str.end()); +}; + +template +void erase(std::string& str, const char symbol, Sargs... symbols) { + erase(str, symbol); + erase(str, symbols...); +}; + +std::vector fill_labels(const std::string& dir) { + std::ifstream fstream(dir); + std::vector labels; + if (fstream.is_open()) { + while(fstream) { + std::string label; + getline(fstream, label); + erase(label, '"', ',', '[', ']'); + labels.push_back(label); + } + fstream.close(); + labels.erase(std::remove(labels.begin(), labels.end(), ""), labels.end()); + } else { + throw std::logic_error("Gesture file doesn't open."); + } + return labels; +} diff --git a/demos/gesture_recognition_demo/cpp_gapi/src/visualizer.cpp b/demos/gesture_recognition_demo/cpp_gapi/src/visualizer.cpp new file mode 100644 index 00000000000..d4c96ec13a3 --- /dev/null +++ b/demos/gesture_recognition_demo/cpp_gapi/src/visualizer.cpp @@ -0,0 +1,92 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#define _USE_MATH_DEFINES + +#include "visualizer.hpp" + +void Visualizer::getStorageElements() { + cv::FileStorage fs(storage_path_, cv::FileStorage::Mode::READ); + cv::FileNode fn = fs.root(); + + for (auto fit = fn.begin(); fit != fn.end(); ++fit) { + cv::FileNode item = *fit; + std::string label = item.name(); + storage_elements_.emplace_back(item.name(), item[0].string()); + } +} + +int Visualizer::getPlaceByKey(const int key) { + const auto gestures_size = int(storage_elements_.size()); + int new_gesture = last_gesture + key; + if (new_gesture < 0) { + new_gesture *= -1; + } + if (new_gesture > gestures_size) { + new_gesture -= gestures_size; + } + last_gesture = new_gesture; + return new_gesture; +} + +void Visualizer::updateCap(const std::string& path) { + if (gesture_cap_.isOpened()) { + gesture_cap_.release(); + } + gesture_cap_.open(path); +} + +void Visualizer::applyDrawing(const cv::Mat& frame, + const TrackedObjects out_detections, + const int out_label_number, + const size_t current_id) { + cv::Scalar color; + for(const auto& person_id_roi : out_detections) { + const size_t id = size_t(person_id_roi.object_id); + const cv::Rect bb = person_id_roi.rect; + + color = id == current_id ? GREEN : RED; + cv::putText(frame, std::to_string(id), + cv::Point(bb.x + 10, bb.y + 30), + cv::FONT_HERSHEY_SIMPLEX, + 1, color, 2); + cv::rectangle(frame, bb, color, 2); + } + + if (out_label_number >= 0) { + last_action_ = out_label_number; + } + std::string label = std::string("Last gesture: ") + std::string(last_action_ > 0 ? labels_[last_action_] : ""); + cv::putText(frame, label, + cv::Point(40, frame.rows - 40), + cv::FONT_HERSHEY_SIMPLEX, + 0.8, RED, 2); +} + +void Visualizer::show(const cv::Mat& frame, + const TrackedObjects out_detections, + const int out_label_number, + const size_t current_id, + const int key) { + applyDrawing(frame, out_detections, out_label_number, current_id); + if (!no_show_) { + cv::imshow("Gesture Recognition demo G-API", frame); + if (!storage_path_.empty()) { + const auto place = getPlaceByKey(key); + const auto new_path = storage_elements_.at(place).second; + if (last_gesture_path != new_path) { + updateCap(new_path); + last_gesture_path = new_path; + } + cv::Mat gesture_mat; + gesture_cap_.read(gesture_mat); + + cv::putText(gesture_mat, storage_elements_.at(place).first, + cv::Point(20, 20), + cv::FONT_HERSHEY_SIMPLEX, + 2, RED); + cv::imshow(storage_window_name_, gesture_mat); + } + } +} diff --git a/demos/gesture_recognition_demo/python/README.md b/demos/gesture_recognition_demo/python/README.md index 39de1238984..3815ad01b13 100644 --- a/demos/gesture_recognition_demo/python/README.md +++ b/demos/gesture_recognition_demo/python/README.md @@ -22,7 +22,7 @@ The demo workflow is the following: - Last recognized gesture. - Performance characteristics. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/gesture_recognition_demo/python/gesture_recognition.gif b/demos/gesture_recognition_demo/python/gesture_recognition.gif index 6da2abde158..99d7a7b5f95 100644 Binary files a/demos/gesture_recognition_demo/python/gesture_recognition.gif and b/demos/gesture_recognition_demo/python/gesture_recognition.gif differ diff --git a/demos/gpt2_text_prediction_demo/python/README.md b/demos/gpt2_text_prediction_demo/python/README.md index 98c7a86007b..725804075af 100644 --- a/demos/gpt2_text_prediction_demo/python/README.md +++ b/demos/gpt2_text_prediction_demo/python/README.md @@ -26,7 +26,7 @@ omz_converter --list models.lst ### Supported Models -* bert-base-ner +* gpt-2 > **NOTE**: Refer to the tables [Intel's Pre-Trained Models Device Support](../../../models/intel/device_support.md) and [Public Pre-Trained Models Device Support](../../../models/public/device_support.md) for the details on models inference support at different devices. @@ -53,20 +53,14 @@ Options: --max_sample_token_num MAX_SAMPLE_TOKEN_NUM Optional. Maximum number of tokens in generated sample --top_k TOP_K Optional. Number of tokens with the highest - probabilitywhich will be kept for generation + probability which will be kept for generation --top_p TOP_P Optional. Maximum probability, tokens with such a - probabilityand lower will be kept for generation + probability and lower will be kept for generation -d DEVICE, --device DEVICE Optional. Target device to perform inference on.Default value is CPU ``` -## Supported models - -* gpt-2 - -> **NOTE**: Refer to the tables [Intel's Pre-Trained Models Device Support](../../../models/intel/device_support.md) and [Public Pre-Trained Models Device Support](../../../models/public/device_support.md) for the details on models inference support at different devices. - ## Demo Inputs The application reads and encodes text from input string, then performs transformations and uses it as model input. diff --git a/demos/gpt2_text_prediction_demo/python/gpt2_text_prediction_demo.py b/demos/gpt2_text_prediction_demo/python/gpt2_text_prediction_demo.py index 6ae886d8d5e..fe7e7ceb55d 100755 --- a/demos/gpt2_text_prediction_demo/python/gpt2_text_prediction_demo.py +++ b/demos/gpt2_text_prediction_demo/python/gpt2_text_prediction_demo.py @@ -47,14 +47,14 @@ def build_argparser(): args.add_argument("-i", "--input", help="Optional. Input prompt", required=False, type=str, action='append') args.add_argument("--max_sample_token_num", help="Optional. Maximum number of tokens in generated sample", default=40, required=False, type=int) - args.add_argument("--top_k", help="Optional. Number of tokens with the highest probability" + args.add_argument("--top_k", help="Optional. Number of tokens with the highest probability " "which will be kept for generation", default=0, required=False, type=int) - args.add_argument("--top_p", help="Optional. Maximum probability, tokens with such a probability" + args.add_argument("--top_p", help="Optional. Maximum probability, tokens with such a probability " "and lower will be kept for generation", default=0.9, required=False, type=float) args.add_argument("-d", "--device", - help="Optional. Target device to perform inference on." + help="Optional. Target device to perform inference on. " "Default value is CPU", default="CPU", type=str) return parser diff --git a/demos/human_pose_estimation_3d_demo/python/README.md b/demos/human_pose_estimation_3d_demo/python/README.md index fda84157adc..79b76ed2b73 100644 --- a/demos/human_pose_estimation_3d_demo/python/README.md +++ b/demos/human_pose_estimation_3d_demo/python/README.md @@ -21,7 +21,7 @@ The demo workflow is the following: 1. The demo application reads video frames one by one and estimates 3D human poses in a given frame. 2. The app visualizes results of its work as graphical window with 2D poses, which are overlaid on input image, and canvas with corresponding 3D poses. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run @@ -50,7 +50,7 @@ omz_converter --list models.lst ### Prerequisites This demo application requires a native Python extension module to be built before you can run it. -Refer to [Open Model Zoo Demos](../../README.md) for instructions on how to build it and prepare the environment for running the demo. +Refer to [Open Model Zoo Demos](../../README.md) for instructions on how to build it and prepare the environment for running the demo. Once the demo is built with Python extension modules, add the path of the demo build folder to the `PYTHONPATH` environment variable. ## Running diff --git a/demos/human_pose_estimation_demo/cpp/README.md b/demos/human_pose_estimation_demo/cpp/README.md index 2b4263d7be0..e7699b0083d 100644 --- a/demos/human_pose_estimation_demo/cpp/README.md +++ b/demos/human_pose_estimation_demo/cpp/README.md @@ -13,7 +13,7 @@ Other demo objectives are: On startup, the application reads command line parameters and loads human pose estimation model. Upon getting a frame from the OpenCV VideoCapture, input frame height is scaled to model height, frame width is scaled to preserve initial aspect ratio and padded to multiple of 8, then application executes human pose estimation algorithm and displays the results. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/human_pose_estimation_demo/human_pose_estimation.gif b/demos/human_pose_estimation_demo/human_pose_estimation.gif index c54a756941d..7c34ce35011 100644 Binary files a/demos/human_pose_estimation_demo/human_pose_estimation.gif and b/demos/human_pose_estimation_demo/human_pose_estimation.gif differ diff --git a/demos/human_pose_estimation_demo/python/README.md b/demos/human_pose_estimation_demo/python/README.md index 1df9fec0cf1..a4fb9710a06 100644 --- a/demos/human_pose_estimation_demo/python/README.md +++ b/demos/human_pose_estimation_demo/python/README.md @@ -9,7 +9,7 @@ This demo showcases the work of multi-person 2D pose estimation algorithms. The On startup, the application reads command-line parameters and loads a network to the Inference Engine. Upon getting a frame from the OpenCV VideoCapture, it performs inference and displays the results. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/human_pose_estimation_demo/python/human_pose_estimation_demo.py b/demos/human_pose_estimation_demo/python/human_pose_estimation_demo.py index 84df741fbd7..d6e05104276 100755 --- a/demos/human_pose_estimation_demo/python/human_pose_estimation_demo.py +++ b/demos/human_pose_estimation_demo/python/human_pose_estimation_demo.py @@ -23,18 +23,18 @@ import cv2 import numpy as np -from openvino.inference_engine import IECore, get_version sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python')) sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python/openvino/model_zoo')) from model_api import models from model_api.performance_metrics import PerformanceMetrics -from model_api.pipelines import get_user_config, parse_devices, AsyncPipeline +from model_api.pipelines import get_user_config, AsyncPipeline +from model_api.adapters import create_core, OpenvinoAdapter import monitors from images_capture import open_images_capture -from helpers import resolution, log_blobs_info, log_runtime_settings, log_latency_per_stage +from helpers import resolution, log_latency_per_stage log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.DEBUG, stream=sys.stdout) @@ -101,15 +101,15 @@ def build_argparser(): return parser -def get_model(ie, args, aspect_ratio): +def get_model(model_adapter, args, aspect_ratio): if args.architecture_type == 'ae': - model = models.HpeAssociativeEmbedding(ie, args.model, target_size=args.tsize, aspect_ratio=aspect_ratio, + model = models.HpeAssociativeEmbedding(model_adapter, target_size=args.tsize, aspect_ratio=aspect_ratio, prob_threshold=args.prob_threshold) elif args.architecture_type == 'higherhrnet': - model = models.HpeAssociativeEmbedding(ie, args.model, target_size=args.tsize, aspect_ratio=aspect_ratio, + model = models.HpeAssociativeEmbedding(model_adapter, target_size=args.tsize, aspect_ratio=aspect_ratio, prob_threshold=args.prob_threshold, delta=0.5, padding_mode='center') elif args.architecture_type == 'openpose': - model = models.OpenPose(ie, args.model, target_size=args.tsize, aspect_ratio=aspect_ratio, + model = models.OpenPose(model_adapter, target_size=args.tsize, aspect_ratio=aspect_ratio, prob_threshold=args.prob_threshold) else: raise RuntimeError('No model type or invalid model type (-at) provided: {}'.format(args.architecture_type)) @@ -177,26 +177,19 @@ def main(): render_metrics = PerformanceMetrics() video_writer = cv2.VideoWriter() - log.info('OpenVINO Inference Engine') - log.info('\tbuild: {}'.format(get_version())) - ie = IECore() - plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) + model_adapter = OpenvinoAdapter(create_core(), args.model, device=args.device, plugin_config=plugin_config, + max_num_requests=args.num_infer_requests) start_time = perf_counter() frame = cap.read() if frame is None: raise RuntimeError("Can't read an image from the input") - log.info('Reading model {}'.format(args.model)) - model = get_model(ie, args, frame.shape[1] / frame.shape[0]) - log_blobs_info(model) - - hpe_pipeline = AsyncPipeline(ie, model, plugin_config, device=args.device, max_num_requests=args.num_infer_requests) - - log.info('The model {} is loaded to {}'.format(args.model, args.device)) - log_runtime_settings(hpe_pipeline.exec_net, set(parse_devices(args.device))) + model = get_model(model_adapter, args, frame.shape[1] / frame.shape[0]) + model.log_layers_info() + hpe_pipeline = AsyncPipeline(model) hpe_pipeline.submit_data(frame, 0, {'frame': frame, 'start_time': start_time}) output_transform = models.OutputTransform(frame.shape[:2], args.output_resolution) diff --git a/demos/image_processing_demo/cpp/README.md b/demos/image_processing_demo/cpp/README.md index 58ecb745830..ac6407a5f51 100644 --- a/demos/image_processing_demo/cpp/README.md +++ b/demos/image_processing_demo/cpp/README.md @@ -4,20 +4,21 @@ This demo processes the image according to the selected type of processing. The * `super_resolution` * `deblurring` +* `jpeg_restoration` ## Examples -Exmaple for deblurring type (left - source image, right - image after deblurring): - -![](./assets/image_processing_deblurred_image.png) - All images on result frame will be marked one of these flags: * 'O' - original image. * 'R' - result image. * 'D' - difference image (|result - original|). -Example for super_resolution type: +1. Exmaple for deblurring type (left - source image, right - image after deblurring): + +![](./assets/image_processing_deblurred_image.png) + +2. Example for super_resolution type: Low resolution: @@ -31,9 +32,15 @@ Super resolution: ![](./assets/street_resolution.png) +3. Example for jpeg_restoration type: + +![](./assets/parrots_restoration.png) + +For this type of image processing user can use flag `-jc`. It allows to perform compression before the inference (usefull when user want to test model on high quality jpeg images). + ## How It Works -Before running the demo, user must choose type of processing and model for this processing. +Before running the demo, user must choose type of processing and model for this processing.\ For `super_resolution` user can choose the next models: * [single-image-super-resolution-1032](../../../models/intel/single-image-super-resolution-1032/README.md) enhances the resolution of the input image by a factor of 4. @@ -42,9 +49,11 @@ For `super_resolution` user can choose the next models: For `deblurring` user can use [deblurgan-v2](../../../models/public/deblurgan-v2/README.md) - generative adversarial network for single image motion deblurring. +For `jpeg_restoration` user can use [fbcnn](../../../models/public/fbcnn/README.md) - flexible blind convolutional neural network for JPEG artifacts removal. + The demo runs inference and shows results for each image captured from an input. Depending on number of inference requests processing simultaneously (-nireq parameter) the pipeline might minimize the time required to process each single image (for nireq 1) or maximizes utilization of the device and overall processing performance. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run @@ -58,6 +67,7 @@ This file can be used as a parameter for [Model Downloader](../../../tools/model * single-image-super-resolution-1033 * text-image-super-resolution-0001 * deblurgan-v2 +* fbcnn > **NOTE**: Refer to the tables [Intel's Pre-Trained Models Device Support](../../../models/intel/device_support.md) and [Public Pre-Trained Models Device Support](../../../models/public/device_support.md) for the details on models inference support at different devices. @@ -72,7 +82,7 @@ image_processing_demo_async [OPTION] Options: -h Print a usage message. - -at "" Required. Type of the network, either 'sr' for Super Resolution task or 'deblur' for Deblurring + -at "" Required. Type of the network, either 'sr' for Super Resolution task, 'deblur' for Deblurring, 'jr' for JPEGRestoration. -i "" Required. An input to process. The input must be a single image, a folder of images, video file or camera id. -m "" Required. Path to an .xml file with a trained model. -o "" Optional. Name of the output file(s) to save. @@ -88,6 +98,7 @@ Options: -no_show Optional. Do not show processed video. -output_resolution Optional. Specify the maximum output window resolution in (width x height) format. Example: 1280x720. Input frame size used by default. -u Optional. List of monitors to show initially. + -jc Optional. Flag of using compression for jpeg images. Default value if false. Only for jr architecture type. ``` Running the application with the empty list of options yields an error message. diff --git a/demos/image_processing_demo/cpp/assets/parrots_restoration.png b/demos/image_processing_demo/cpp/assets/parrots_restoration.png new file mode 100644 index 00000000000..b77687802f5 Binary files /dev/null and b/demos/image_processing_demo/cpp/assets/parrots_restoration.png differ diff --git a/demos/image_processing_demo/cpp/main.cpp b/demos/image_processing_demo/cpp/main.cpp index 1e6945023cc..03186e7e605 100644 --- a/demos/image_processing_demo/cpp/main.cpp +++ b/demos/image_processing_demo/cpp/main.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "visualizer.hpp" @@ -45,7 +46,7 @@ DEFINE_INPUT_FLAGS DEFINE_OUTPUT_FLAGS static const char help_message[] = "Print a usage message."; -static const char at_message[] = "Required. Type of the network, either 'sr' for Super Resolution task or 'deblur' for Deblurring"; +static const char at_message[] = "Required. Type of the network, either 'sr' for Super Resolution task, 'deblur' for Deblurring, 'jr' for JPEGRestoration."; static const char model_message[] = "Required. Path to an .xml file with a trained model."; static const char target_device_message[] = "Optional. Specify the target device to infer on (the list of available devices is shown below). " "Default value is CPU. Use \"-d HETERO:\" format to specify HETERO plugin. " @@ -63,6 +64,8 @@ static const char no_show_processed_video[] = "Optional. Do not show processed v static const char utilization_monitors_message[] = "Optional. List of monitors to show initially."; static const char output_resolution_message[] = "Optional. Specify the maximum output window resolution " "in (width x height) format. Example: 1280x720. Input frame size used by default."; +static const char jc_message[] = "Optional. Flag of using compression for jpeg images. " + "Default value if false. Only for jr architecture type."; DEFINE_bool(h, false, help_message); DEFINE_string(at, "", at_message); @@ -76,6 +79,8 @@ DEFINE_string(nstreams, "", num_streams_message); DEFINE_bool(no_show, false, no_show_processed_video); DEFINE_string(u, "", utilization_monitors_message); DEFINE_string(output_resolution, "", output_resolution_message); +DEFINE_bool(jc, false, jc_message); + /** * \brief This function shows a help message @@ -102,6 +107,7 @@ static void showUsage() { std::cout << " -no_show " << no_show_processed_video << std::endl; std::cout << " -output_resolution " << output_resolution_message << std::endl; std::cout << " -u " << utilization_monitors_message << std::endl; + std::cout << " -jc " << jc_message << std::endl; } bool ParseAndCheckCommandLine(int argc, char *argv[]) { @@ -130,13 +136,16 @@ bool ParseAndCheckCommandLine(int argc, char *argv[]) { return true; } -std::unique_ptr getModel(const cv::Size& frameSize, const std::string& type) { +std::unique_ptr getModel(const cv::Size& frameSize, const std::string& type, bool doCompression=false) { if (type == "sr") { return std::unique_ptr(new SuperResolutionModel(FLAGS_m, frameSize)); } if (type == "deblur") { return std::unique_ptr(new DeblurringModel(FLAGS_m, frameSize)); } + if (type == "jr") { + return std::unique_ptr(new JPEGRestorationModel(FLAGS_m, frameSize, doCompression)); + } throw std::invalid_argument("No model type or invalid model type (-at) provided: " + FLAGS_at); } @@ -162,7 +171,7 @@ int main(int argc, char *argv[]) { //------------------------------ Running ImageProcessing routines ---------------------------------------------- slog::info << *InferenceEngine::GetInferenceEngineVersion() << slog::endl; InferenceEngine::Core core; - std::unique_ptr model = getModel(cv::Size(curr_frame.cols, curr_frame.rows), FLAGS_at); + std::unique_ptr model = getModel(cv::Size(curr_frame.cols, curr_frame.rows), FLAGS_at, FLAGS_jc); AsyncPipeline pipeline(std::move(model), ConfigFactory::getUserConfig(FLAGS_d, FLAGS_l, FLAGS_c, FLAGS_nireq, FLAGS_nstreams, FLAGS_nthreads), core); diff --git a/demos/image_processing_demo/cpp/models.lst b/demos/image_processing_demo/cpp/models.lst index 94c4c8ec974..d0f0328d386 100644 --- a/demos/image_processing_demo/cpp/models.lst +++ b/demos/image_processing_demo/cpp/models.lst @@ -4,3 +4,5 @@ single-image-super-resolution-???? text-image-super-resolution-???? # For -at deblur deblurgan-v2 +# For -at jr +fbcnn diff --git a/demos/image_processing_demo/cpp/visualizer.cpp b/demos/image_processing_demo/cpp/visualizer.cpp index 4991ab169af..621bf3c473a 100644 --- a/demos/image_processing_demo/cpp/visualizer.cpp +++ b/demos/image_processing_demo/cpp/visualizer.cpp @@ -25,6 +25,8 @@ Visualizer::Visualizer(const std::string& type) { winName = "Image Processing Demo - Super Resolution (press A for help)"; else if (type == "deblur") winName = "Image Processing Demo - Deblurring (press A for help)"; + else if (type == "jr") + winName = "Image Processing Demo - JPEG Restoration (press A for help)"; } cv::Size Visualizer::getSize() { @@ -36,6 +38,10 @@ void Visualizer::handleKey(int key) { if (key == 'a') { isHelpShown = !isHelpShown; } + if (cv::getWindowProperty(winName, 0) < 0) { + mode = "result"; + disableTrackbar(); + } if (key == 'o') { mode = "orig"; addTrackbar(); @@ -46,6 +52,7 @@ void Visualizer::handleKey(int key) { } if (key == 'r') { mode = "result"; + cv::destroyWindow(winName); disableTrackbar(); } } @@ -107,6 +114,10 @@ void Visualizer::changeDisplayImg() { } else if (mode == "diff") { cv::Mat diffImg; cv::absdiff(inputImg, resultImg, diffImg); + double min, max; + cv::minMaxLoc(diffImg, &min, &max); + double scale = 255.0 / (max - min); + diffImg = (diffImg - min) * scale; diffImg(cv::Rect(0, 0, slider, resultImg.rows)).copyTo(displayImg(cv::Rect(0, 0, slider, displayImg.rows))); markImage(displayImg, {"D", "R"}, static_cast(slider) / resolution.width); drawSweepLine(displayImg); @@ -141,10 +152,5 @@ void Visualizer::addTrackbar() { } void Visualizer::disableTrackbar() { - if (isTrackbarShown) { - cv::destroyWindow(winName); - isTrackbarShown = false; - cv::namedWindow(winName); - show(); - } + isTrackbarShown = false; } diff --git a/demos/image_retrieval_demo/python/README.md b/demos/image_retrieval_demo/python/README.md index b77c907bc0b..a879acd8fc4 100644 --- a/demos/image_retrieval_demo/python/README.md +++ b/demos/image_retrieval_demo/python/README.md @@ -25,11 +25,11 @@ The demo workflow is the following: - Top-10 most similar images from the gallery. - Performance characteristics. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run -The demo sample input videos and gallery images can be found in this [repository](https://github.com/19900531/test). An example of file listing gallery images can be found [here](https://github.com/openvinotoolkit/training_extensions/blob/develop/misc/tensorflow_toolkit/image_retrieval/data/gallery/gallery.txt). +The demo sample input videos and gallery images can be found in this [repository](https://github.com/19900531/test). An example of file listing gallery images can be found [here](https://github.com/openvinotoolkit/training_extensions/blob/089de2f24667329a58e8560ed4e01ef203e99def/misc/tensorflow_toolkit/image_retrieval/data/gallery/gallery.txt). The demo dependencies should be installed before run. That can be achieved with the following command: diff --git a/demos/image_retrieval_demo/python/image_retrieval.gif b/demos/image_retrieval_demo/python/image_retrieval.gif index bceed86e055..cbbfa922262 100644 Binary files a/demos/image_retrieval_demo/python/image_retrieval.gif and b/demos/image_retrieval_demo/python/image_retrieval.gif differ diff --git a/demos/instance_segmentation_demo/python/README.md b/demos/instance_segmentation_demo/python/README.md index f2a15ed7458..500fe56b7c7 100644 --- a/demos/instance_segmentation_demo/python/README.md +++ b/demos/instance_segmentation_demo/python/README.md @@ -35,7 +35,7 @@ The demo workflow is the following: * By default, tracking is used to show object instance with the same color throughout the whole video. It assumes more or less static scene with instances in two frames being a part of the same track if intersection over union of the masks is greater than the 0.5 threshold. To disable tracking, specify the `--no_track` argument. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/instance_segmentation_demo/python/instance_segmentation.gif b/demos/instance_segmentation_demo/python/instance_segmentation.gif index 0742c955624..9504dfa5487 100644 Binary files a/demos/instance_segmentation_demo/python/instance_segmentation.gif and b/demos/instance_segmentation_demo/python/instance_segmentation.gif differ diff --git a/demos/interactive_face_detection_demo/cpp/README.md b/demos/interactive_face_detection_demo/cpp/README.md index 579a21013fd..2af2029ab1b 100644 --- a/demos/interactive_face_detection_demo/cpp/README.md +++ b/demos/interactive_face_detection_demo/cpp/README.md @@ -31,7 +31,7 @@ Engine. 4. The application performs up to five simultaneous inferences, using the Age/Gender, Head Pose, Emotions, Facial Landmarks, and Anti-spoof detection networks if they are specified in the command line. 5. The application displays the results. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). The Async API operates with a notion of the Infer Request that encapsulates the inputs/outputs and separates scheduling and waiting for result. diff --git a/demos/interactive_face_detection_demo/cpp_gapi/CMakeLists.txt b/demos/interactive_face_detection_demo/cpp_gapi/CMakeLists.txt index eb54b3d61e9..a0dd9338d1c 100644 --- a/demos/interactive_face_detection_demo/cpp_gapi/CMakeLists.txt +++ b/demos/interactive_face_detection_demo/cpp_gapi/CMakeLists.txt @@ -8,4 +8,5 @@ file(GLOB MAIN_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h*) add_demo(NAME interactive_face_detection_demo_gapi SOURCES ${MAIN_SRC} HEADERS ${MAIN_HEADERS} - DEPENDENCIES monitors) + DEPENDENCIES monitors utils_gapi + OPENCV_VERSION_REQUIRED 4.5.3) diff --git a/demos/interactive_face_detection_demo/cpp_gapi/README.md b/demos/interactive_face_detection_demo/cpp_gapi/README.md index 8cad51ea45f..57dee6bddbd 100644 --- a/demos/interactive_face_detection_demo/cpp_gapi/README.md +++ b/demos/interactive_face_detection_demo/cpp_gapi/README.md @@ -27,7 +27,7 @@ Engine. 5. G-API pipeline performs four inferences, using the Age/Gender, Head Pose, Emotions, and Facial Landmarks detection networks if they are specified in the command line. 6. The application displays the results. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/interactive_face_detection_demo/cpp_gapi/face.hpp b/demos/interactive_face_detection_demo/cpp_gapi/face.hpp index 4d9f5d99eb3..a86bd007658 100644 --- a/demos/interactive_face_detection_demo/cpp_gapi/face.hpp +++ b/demos/interactive_face_detection_demo/cpp_gapi/face.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -8,8 +8,6 @@ #include -#include "utils.hpp" - // -------------------------Describe detected face on a frame------------------------------------------------- struct Face { diff --git a/demos/interactive_face_detection_demo/cpp_gapi/main.cpp b/demos/interactive_face_detection_demo/cpp_gapi/main.cpp index 6b065f09435..c0ca0fd52be 100644 --- a/demos/interactive_face_detection_demo/cpp_gapi/main.cpp +++ b/demos/interactive_face_detection_demo/cpp_gapi/main.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -7,28 +7,21 @@ * \file interactive_face_detection_demo_gapi/main.cpp * \example interactive_face_detection_demo_gapi/main.cpp */ -#include -#include -#include -#include - -#include #include #include #include +#include #include #include -#include #include +#include #include -#include #include #include "interactive_face_detection_gapi.hpp" -#include "utils.hpp" #include "face.hpp" #include "visualizer.hpp" @@ -46,72 +39,42 @@ G_API_NET(HeadPose, , "head-pose-recognition"); G_API_NET(FacialLandmark, , "facial-landmark-recognition"); G_API_NET(Emotions, , "emotions-recognition"); -G_API_OP(PostProc, (cv::GMat, cv::GMat, double, double, double, double)>, "custom.fd_postproc") { - static cv::GArrayDesc outMeta(const cv::GMatDesc &, const cv::GMatDesc &, double, double, double, double) { +G_API_OP(PostProc, (cv::GArray, cv::GOpaque, double, double, double)>, "custom.fd_postproc") { + static cv::GArrayDesc outMeta(const cv::GArrayDesc&, const cv::GOpaqueDesc&, double, double, double) { return cv::empty_array_desc(); } }; GAPI_OCV_KERNEL(OCVPostProc, PostProc) { - static void run(const cv::Mat &in_ssd_result, - const cv::Mat &in_frame, - double threshold, + static void run(const std::vector& rois, + const cv::Size& frame_size, double bb_enlarge_coefficient, double bb_dx_coefficient, double bb_dy_coefficient, std::vector &out_faces) { - const auto &in_ssd_dims = in_ssd_result.size; - CV_Assert(in_ssd_dims.dims() == 4u); - - const int MAX_PROPOSALS = in_ssd_dims[2]; - const int OBJECT_SIZE = in_ssd_dims[3]; - CV_Assert(OBJECT_SIZE == 7); - - const cv::Size upscale = in_frame.size(); - const cv::Rect surface({0,0}, upscale); out_faces.clear(); - - const float *data = in_ssd_result.ptr(); - for (int i = 0; i < MAX_PROPOSALS; i++) { - const float image_id = data[i * OBJECT_SIZE + 0]; // batch id - const float confidence = data[i * OBJECT_SIZE + 2]; - const float rc_left = data[i * OBJECT_SIZE + 3]; - const float rc_top = data[i * OBJECT_SIZE + 4]; - const float rc_right = data[i * OBJECT_SIZE + 5]; - const float rc_bottom = data[i * OBJECT_SIZE + 6]; - - if (image_id < 0.f) { // indicates end of detections - break; - } - if (confidence < threshold) { - continue; - } - - cv::Rect rc; - rc.x = static_cast(rc_left * upscale.width); - rc.y = static_cast(rc_top * upscale.height); - rc.width = static_cast(rc_right * upscale.width) - rc.x; - rc.height = static_cast(rc_bottom * upscale.height) - rc.y; - + const cv::Rect surface({0,0}, frame_size); + for(const auto& rc : rois) { // Make square and enlarge face bounding box for more robust operation of face analytics networks - int bb_width = rc.width; - int bb_height = rc.height; + const int bb_width = rc.width; + const int bb_height = rc.height; - int bb_center_x = rc.x + bb_width / 2; - int bb_center_y = rc.y + bb_height / 2; + const int bb_center_x = rc.x + bb_width / 2; + const int bb_center_y = rc.y + bb_height / 2; - int max_of_sizes = std::max(bb_width, bb_height); + const int max_of_sizes = std::max(bb_width, bb_height); - int bb_new_width = static_cast(bb_enlarge_coefficient * max_of_sizes); - int bb_new_height = static_cast(bb_enlarge_coefficient * max_of_sizes); + const int bb_new_width = static_cast(bb_enlarge_coefficient * max_of_sizes); + const int bb_new_height = static_cast(bb_enlarge_coefficient * max_of_sizes); - rc.x = bb_center_x - static_cast(std::floor(bb_dx_coefficient * bb_new_width / 2)); - rc.y = bb_center_y - static_cast(std::floor(bb_dy_coefficient * bb_new_height / 2)); + cv::Rect square_rect; + square_rect.x = bb_center_x - static_cast(std::floor(bb_dx_coefficient * bb_new_width / 2)); + square_rect.y = bb_center_y - static_cast(std::floor(bb_dy_coefficient * bb_new_height / 2)); - rc.width = bb_new_width; - rc.height = bb_new_height; + square_rect.width = bb_new_width; + square_rect.height = bb_new_height; - out_faces.push_back(rc & surface); + out_faces.push_back(square_rect & surface); } } }; @@ -156,8 +119,8 @@ void rawOutputAgeGender(const int idx, const cv::Mat &out_ages, const cv::Mat &o const float *age_data = out_ages.ptr(); const float *gender_data = out_genders.ptr(); - float maleProb = gender_data[1]; - float age = age_data[0] * 100; + const float maleProb = gender_data[1]; + const float age = age_data[0] * 100; slog::debug << "[" << idx << "] element, male prob = " << maleProb << ", age = " << age << slog::endl; } @@ -182,15 +145,15 @@ void rawOutputLandmarks(const int idx, const cv::Mat &out_landmark) { int n_lm = 70; for (int i_lm = 0; i_lm < n_lm / 2; ++i_lm) { - float normed_x = lm_data[2 * i_lm]; - float normed_y = lm_data[2 * i_lm + 1]; + const float normed_x = lm_data[2 * i_lm]; + const float normed_y = lm_data[2 * i_lm + 1]; slog::debug << '\t' << normed_x << ", " << normed_y << slog::endl; } } void rawOutputEmotions(const int idx, const cv::Mat &out_emotion) { - size_t emotionsVecSize = EMOTION_VECTOR.size(); + const size_t emotionsVecSize = EMOTION_VECTOR.size(); const float *em_data = out_emotion.ptr(); @@ -248,8 +211,8 @@ void ageGenderDataUpdate(const Face::Ptr &face, const float *age_data = out_age.ptr(); const float *gender_data = out_gender.ptr(); - float maleProb = gender_data[1]; - float age = age_data[0] * 100; + const float maleProb = gender_data[1]; + const float age = age_data[0] * 100; face->updateGender(maleProb); face->updateAge(age); @@ -270,7 +233,7 @@ void emotionsDataUpdate(const Face::Ptr &face, const cv::Mat &out_emotion) { const float *em_data = out_emotion.ptr(); std::map em_val_map; - for(size_t i = 0; i < EMOTION_VECTOR.size(); i++) { + for (size_t i = 0; i < EMOTION_VECTOR.size(); i++) { em_val_map[EMOTION_VECTOR[i]] = em_data[i]; } @@ -280,28 +243,17 @@ void emotionsDataUpdate(const Face::Ptr &face, const cv::Mat &out_emotion) { void landmarksDataUpdate(const Face::Ptr &face, const cv::Mat &out_landmark) { const float *lm_data = out_landmark.ptr(); - size_t n_lm = 70; + const size_t n_lm = 70; std::vector normedLandmarks(&lm_data[0], &lm_data[n_lm]); face->updateLandmarks(normedLandmarks); } -void setInput(cv::GStreamingCompiled stream, const std::string& input ) { - try { - // If stoi() throws exception input should be a path not a camera id - stream.setSource(cv::gapi::wip::make_src(std::stoi(input))); - } catch (std::invalid_argument&) { - slog::info << "Input source is treated as a file path" << slog::endl; - stream.setSource(cv::gapi::wip::make_src(input)); - } -} - int main(int argc, char *argv[]) { try { PerformanceMetrics metrics; - - // ------------------------------ Parsing and validating of input arguments -------------------------- + /** ---------- Parsing and validating input arguments ----------**/ gflags::ParseCommandLineNonHelpFlags(&argc, &argv, true); if (FLAGS_h) { showUsage(); @@ -315,47 +267,48 @@ int main(int argc, char *argv[]) { throw std::logic_error("Parameter -m is not set"); slog::info << *InferenceEngine::GetInferenceEngineVersion() << slog::endl; - cv::GComputation pipeline([=]() { - cv::GMat in; - cv::GMat frame = cv::gapi::copy(in); + /** ---------------- Graph of demo ---------------- **/ + cv::GMat in; - cv::GMat detections = cv::gapi::infer(in); + cv::GMat detections = cv::gapi::infer(in); - cv::GArray faces = PostProc::on(detections, in, - FLAGS_t, - FLAGS_bb_enlarge_coef, - FLAGS_dx_coef, - FLAGS_dy_coef); - auto outs = GOut(frame, detections, faces); + cv::GOpaque sz = cv::gapi::streaming::size(in); + cv::GArray faces_rects = + cv::gapi::parseSSD(detections, sz, float(FLAGS_t), false, false); + cv::GArray faces = PostProc::on(faces_rects, sz, + FLAGS_bb_enlarge_coef, + FLAGS_dx_coef, + FLAGS_dy_coef); + auto outs = GOut(cv::gapi::copy(in), detections, faces); - cv::GArray ages, genders; - if (!FLAGS_m_ag.empty()) { - std::tie(ages, genders) = cv::gapi::infer(faces, in); - outs += GOut(ages, genders); - } - - cv::GArray y_fc, p_fc, r_fc; - if (!FLAGS_m_hp.empty()) { - std::tie(y_fc, p_fc, r_fc) = cv::gapi::infer(faces, in); - outs += GOut(y_fc, p_fc, r_fc); - } + cv::GArray ages, genders; + if (!FLAGS_m_ag.empty()) { + std::tie(ages, genders) = cv::gapi::infer(faces, in); + outs += GOut(ages, genders); + } - cv::GArray emotions; - if (!FLAGS_m_em.empty()) { - emotions = cv::gapi::infer(faces, in); - outs += GOut(emotions); - } + cv::GArray y_fc, p_fc, r_fc; + if (!FLAGS_m_hp.empty()) { + std::tie(y_fc, p_fc, r_fc) = cv::gapi::infer(faces, in); + outs += GOut(y_fc, p_fc, r_fc); + } - cv::GArray landmarks; - if (!FLAGS_m_lm.empty()) { - landmarks = cv::gapi::infer(faces, in); - outs += GOut(landmarks); - } + cv::GArray emotions; + if (!FLAGS_m_em.empty()) { + emotions = cv::gapi::infer(faces, in); + outs += GOut(emotions); + } - return cv::GComputation(cv::GIn(in), std::move(outs)); - }); + cv::GArray landmarks; + if (!FLAGS_m_lm.empty()) { + landmarks = cv::gapi::infer(faces, in); + outs += GOut(landmarks); + } + auto pipeline = cv::GComputation(cv::GIn(in), std::move(outs)); + /** ---------------- End of graph ---------------- **/ + /** Configure networks **/ auto det_net = cv::gapi::ie::Params { FLAGS_m, // path to model fileNameNoExt(FLAGS_m) + ".bin", // path to weights @@ -411,13 +364,12 @@ int main(int argc, char *argv[]) { slog::info << "Emotions Recognition DISABLED." << slog::endl; } - // Form a kernel package (including an OpenCV-based implementation of our - // post-processing) and a network package (holding our three networks). + /** Custom kernels **/ auto kernels = cv::gapi::kernels(); auto networks = cv::gapi::networks(det_net, age_net, hp_net, lm_net, emo_net); + auto stream = pipeline.compileStreaming(cv::compile_args(kernels, networks)); - cv::GStreamingCompiled stream = pipeline.compileStreaming(cv::compile_args(kernels, networks)); - + /** Output containers for results **/ cv::Mat frame, ssd_res; std::vector face_hub; auto out_vector = cv::gout(frame, ssd_res, face_hub); @@ -436,129 +388,128 @@ int main(int argc, char *argv[]) { Visualizer::Ptr visualizer = std::make_shared(!FLAGS_m_ag.empty(), !FLAGS_m_em.empty(), !FLAGS_m_hp.empty(), !FLAGS_m_lm.empty()); - std::list faces; + std::list out_faces; std::ostringstream out; - size_t framesCounter = 0; size_t id = 0; - cv::VideoWriter videoWriter; const cv::Point THROUGHPUT_METRIC_POSITION{10, 30}; std::unique_ptr presenter; - bool stop = false; - - do { - try { - setInput(stream, FLAGS_i); - } catch (const std::exception& error) { - std::stringstream msg; - msg << "Can't open source {" << FLAGS_i << "}" << - std::endl << error.what() << std::endl; - throw std::invalid_argument(msg.str()); - } - bool isStart = true; - const auto startTime = std::chrono::steady_clock::now(); - stream.start(); - while (stream.pull(cv::GRunArgsP(out_vector))) { - if (!FLAGS_m_em.empty() && !FLAGS_no_show_emotion_bar) { - visualizer->enableEmotionBar(frame.size(), EMOTION_VECTOR); - } + /** Get information about frame **/ + std::shared_ptr cap = openImagesCapture(FLAGS_i, FLAGS_loop, 0, + FLAGS_limit); + const auto tmp = cap->read(); + cap.reset(); + if (!tmp.data) { + throw std::runtime_error("Couldn't grab first frame"); + } + cv::Size frame_size = cv::Size{tmp.cols, tmp.rows}; + cap = openImagesCapture(FLAGS_i, FLAGS_loop, 0, + FLAGS_limit); + /** ---------------- The execution part ---------------- **/ + stream.setSource(cap); - // Init presenter - if (presenter == nullptr) { - cv::Size graphSize{static_cast(frame.rows / 4), 60}; - presenter.reset(new Presenter(FLAGS_u, THROUGHPUT_METRIC_POSITION.y + 15, graphSize)); - } + /** Save output result **/ + cv::VideoWriter videoWriter; + if (!FLAGS_o.empty() && !videoWriter.open(FLAGS_o, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'), + cap->fps(), frame_size)) { + throw std::runtime_error("Can't open video writer"); + } - // Postprocessing - std::list prev_faces; + bool isStart = true; + const auto startTime = std::chrono::steady_clock::now(); + stream.start(); + while (stream.pull(cv::GRunArgsP(out_vector))) { + if (!FLAGS_m_em.empty() && !FLAGS_no_show_emotion_bar) { + visualizer->enableEmotionBar(frame.size(), EMOTION_VECTOR); + } - if (!FLAGS_no_smooth) { - prev_faces.insert(prev_faces.begin(), faces.begin(), faces.end()); - } + /** Init presenter **/ + if (presenter == nullptr) { + cv::Size graphSize{static_cast(frame.rows / 4), 60}; + presenter.reset(new Presenter(FLAGS_u, THROUGHPUT_METRIC_POSITION.y + 15, graphSize)); + } - faces.clear(); + /** Postprocessing **/ + std::list prev_faces; - // Raw output of detected faces - if (FLAGS_r) { - rawOutputDetections(ssd_res, frame.size(), FLAGS_t); - } + if (!FLAGS_no_smooth) { + prev_faces.insert(prev_faces.begin(), out_faces.begin(), out_faces.end()); + } - // For every detected face - for (size_t i = 0; i < face_hub.size(); i++) { - Face::Ptr face; - - cv::Rect rect = face_hub[i] & cv::Rect({0, 0}, frame.size()); - faceDataUpdate(frame, face, rect, - prev_faces, face_hub, - id, FLAGS_no_smooth); - - if (!FLAGS_m_ag.empty()) { - ageGenderDataUpdate(face, out_ages[i], out_genders[i]); - if (FLAGS_r) - rawOutputAgeGender(i, out_ages[i], out_genders[i]); - } - - if (!FLAGS_m_em.empty()) { - emotionsDataUpdate(face, out_emotions[i]); - if (FLAGS_r) - rawOutputEmotions(i, out_emotions[i]); - } - - if (!FLAGS_m_hp.empty()) { - headPoseDataUpdate(face, out_y_fc[i], out_p_fc[i], out_r_fc[i]); - if (FLAGS_r) - rawOutputHeadpose(i, out_y_fc[i], out_p_fc[i], out_r_fc[i]); - } - - if (!FLAGS_m_lm.empty()) { - landmarksDataUpdate(face, out_landmarks[i]); - if (FLAGS_r) - rawOutputLandmarks(i, out_landmarks[i]); - } - // End of face postprocessing - - faces.push_back(face); - } + out_faces.clear(); + + /** Raw output of detected faces **/ + if (FLAGS_r) { + rawOutputDetections(ssd_res, frame.size(), FLAGS_t); + } + + /** For every detected face **/ + for (size_t i = 0; i < face_hub.size(); i++) { + Face::Ptr face; - // drawing faces - visualizer->draw(frame, faces); + cv::Rect rect = face_hub[i] & cv::Rect({0, 0}, frame.size()); + faceDataUpdate(frame, face, rect, + prev_faces, face_hub, + id, FLAGS_no_smooth); - presenter->drawGraphs(frame); - if (isStart) { - metrics.update(startTime, frame, { 10, 22 }, cv::FONT_HERSHEY_COMPLEX, - 0.65, { 200, 10, 10 }, 2, PerformanceMetrics::MetricTypes::FPS); - isStart = false; + if (!FLAGS_m_ag.empty()) { + ageGenderDataUpdate(face, out_ages[i], out_genders[i]); + if (FLAGS_r) + rawOutputAgeGender(i, out_ages[i], out_genders[i]); } - else { - metrics.update({}, frame, { 10, 22 }, cv::FONT_HERSHEY_COMPLEX, - 0.65, { 200, 10, 10 }, 2, PerformanceMetrics::MetricTypes::FPS); + + if (!FLAGS_m_em.empty()) { + emotionsDataUpdate(face, out_emotions[i]); + if (FLAGS_r) + rawOutputEmotions(i, out_emotions[i]); } - // Visualizing results - if (!FLAGS_no_show || !FLAGS_o.empty()) { - cv::imshow("Detection results", frame); - - int key = cv::waitKey(1); - if (27 == key || 'Q' == key || 'q' == key) { - stream.stop(); - stop = true; - } else { - presenter->handleKey(key); - } + if (!FLAGS_m_hp.empty()) { + headPoseDataUpdate(face, out_y_fc[i], out_p_fc[i], out_r_fc[i]); + if (FLAGS_r) + rawOutputHeadpose(i, out_y_fc[i], out_p_fc[i], out_r_fc[i]); } - if (!FLAGS_o.empty() && framesCounter == 0 && - !videoWriter.open(FLAGS_o, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'), 25, frame.size())) { - throw std::runtime_error("Can't open video writer"); + if (!FLAGS_m_lm.empty()) { + landmarksDataUpdate(face, out_landmarks[i]); + if (FLAGS_r) + rawOutputLandmarks(i, out_landmarks[i]); } - if (videoWriter.isOpened() && (FLAGS_limit == 0 || framesCounter <= FLAGS_limit - 1)) { - videoWriter.write(frame); + /** End of face postprocessing **/ + + out_faces.push_back(face); + } + + /** drawing faces **/ + visualizer->draw(frame, out_faces); + + presenter->drawGraphs(frame); + if (isStart) { + metrics.update(startTime, frame, { 10, 22 }, cv::FONT_HERSHEY_COMPLEX, + 0.65, { 200, 10, 10 }, 2, PerformanceMetrics::MetricTypes::FPS); + isStart = false; + } else { + metrics.update({}, frame, { 10, 22 }, cv::FONT_HERSHEY_COMPLEX, + 0.65, { 200, 10, 10 }, 2, PerformanceMetrics::MetricTypes::FPS); + } + + /** Visualizing results **/ + if (!FLAGS_no_show) { + cv::imshow("Detection results", frame); + + int key = cv::waitKey(1); + if (27 == key || 'Q' == key || 'q' == key) { + stream.stop(); + } else { + presenter->handleKey(key); } + } - framesCounter++; + if (videoWriter.isOpened()) { + videoWriter.write(frame); } - } while (FLAGS_loop && !stop); + } cv::destroyAllWindows(); diff --git a/demos/interactive_face_detection_demo/cpp_gapi/utils.hpp b/demos/interactive_face_detection_demo/cpp_gapi/utils.hpp deleted file mode 100644 index 05727021bee..00000000000 --- a/demos/interactive_face_detection_demo/cpp_gapi/utils.hpp +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (C) 2020 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -# pragma once - -#include -#include -#include -#include - -class CallStat { -public: - typedef std::chrono::duration> ms; - - CallStat(): - _number_of_calls(0), _total_duration(0.0), _last_call_duration(0.0), _smoothed_duration(-1.0) { - } - - double getSmoothedDuration() { - // Additional check is needed for the first frame while duration of the first - // visualisation is not calculated yet. - if (_smoothed_duration < 0) { - auto t = std::chrono::steady_clock::now(); - return std::chrono::duration_cast(t - _last_call_start).count(); - } - return _smoothed_duration; - } - - double getTotalDuration() { - return _total_duration; - } - - double getLastCallDuration() { - return _last_call_duration; - } - - void calculateDuration() { - auto t = std::chrono::steady_clock::now(); - _last_call_duration = std::chrono::duration_cast(t - _last_call_start).count(); - _number_of_calls++; - _total_duration += _last_call_duration; - if (_smoothed_duration < 0) { - _smoothed_duration = _last_call_duration; - } - double alpha = 0.1; - _smoothed_duration = _smoothed_duration * (1.0 - alpha) + _last_call_duration * alpha; - _last_call_start = t; - } - - void setStartTime() { - _last_call_start = std::chrono::steady_clock::now(); - } - -private: - size_t _number_of_calls; - double _total_duration; - double _last_call_duration; - double _smoothed_duration; - std::chrono::time_point _last_call_start; -}; - -class Timer { -public: - void start(const std::string& name) { - _timers[name].setStartTime(); - } - - void finish(const std::string& name) { - auto& timer = (*this)[name]; - timer.calculateDuration(); - } - - CallStat& operator[](const std::string& name) { - if (_timers.find(name) == _timers.end()) { - throw std::logic_error("No timer with name " + name + "."); - } - return _timers[name]; - } - -private: - std::map _timers; -}; diff --git a/demos/interactive_face_detection_demo/cpp_gapi/visualizer.cpp b/demos/interactive_face_detection_demo/cpp_gapi/visualizer.cpp index 31ebdb09fca..97968d84112 100644 --- a/demos/interactive_face_detection_demo/cpp_gapi/visualizer.cpp +++ b/demos/interactive_face_detection_demo/cpp_gapi/visualizer.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // -#include #include #include "visualizer.hpp" diff --git a/demos/interactive_face_detection_demo/interactive_face_detection.gif b/demos/interactive_face_detection_demo/interactive_face_detection.gif index 7ae1b57a6f9..07c11b7c2ed 100644 Binary files a/demos/interactive_face_detection_demo/interactive_face_detection.gif and b/demos/interactive_face_detection_demo/interactive_face_detection.gif differ diff --git a/demos/mask_rcnn_demo/cpp/README.md b/demos/mask_rcnn_demo/cpp/README.md index 1d9844c0282..9a5ea3fdb6d 100644 --- a/demos/mask_rcnn_demo/cpp/README.md +++ b/demos/mask_rcnn_demo/cpp/README.md @@ -8,7 +8,7 @@ The demo has a post-processing part that gathers mask arrays corresponding to bo On startup, the demo application reads command line parameters and loads a network and an image to the Inference Engine plugin. When inference is done, the application creates an output image. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/monodepth_demo/python/README.md b/demos/monodepth_demo/python/README.md index d64cdcab447..44de1c5b2c3 100644 --- a/demos/monodepth_demo/python/README.md +++ b/demos/monodepth_demo/python/README.md @@ -9,10 +9,13 @@ Below is the `midasnet` model inference result for `/deployment_to ## How It Works -On startup, the demo application reads command-line parameters and loads a network and an image to the -Inference Engine plugin. When inference is done, the application outputs the disparity map in PFM and PNG format (color-coded). +On startup, the application reads command-line parameters and loads a network to the Inference +Engine. Upon getting a frame from the OpenCV VideoCapture, it performs inference and displays the results. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +Async API operates with a notion of the "Infer Request" that encapsulates the inputs/outputs and separates +*scheduling and waiting for result*. + +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run @@ -44,33 +47,87 @@ omz_converter --list models.lst Running the application with the `-h` option yields the following usage message: ``` -usage: monodepth_demo.py [-h] -m MODEL -i INPUT [-l CPU_EXTENSION] [-d DEVICE] +usage: monodepth_demo.py [-h] -m MODEL -i INPUT [-d DEVICE] [-nireq NUM_INFER_REQUESTS] [-nstreams NUM_STREAMS] + [-nthreads NUM_THREADS] [--loop] [-o OUTPUT] [-limit OUTPUT_LIMIT] [--no_show] + [--output_resolution OUTPUT_RESOLUTION] [-u UTILIZATION_MONITORS] -optional arguments: - -h, --help show this help message and exit +Options: + -h, --help Show this help message and exit. -m MODEL, --model MODEL - Required. Path to an .xml file with a trained model + Required. Path to an .xml file with a trained model. -i INPUT, --input INPUT - Required. Path to a input image file - -l CPU_EXTENSION, --cpu_extension CPU_EXTENSION - Optional. Required for CPU custom layers. Absolute - MKLDNN (CPU)-targeted custom layers. Absolute path to - a shared library with the kernels implementations + Required. An input to process. The input must be a single image, a folder of images, video + file or camera id. -d DEVICE, --device DEVICE - Optional. Specify the target device to infer on; CPU, - GPU, HDDL or MYRIAD is acceptable. The demo will - look for a suitable plugin for device specified. - Default value is CPU + Optional. Specify the target device to infer on; CPU, GPU, HDDL or MYRIAD is acceptable. The + demo will look for a suitable plugin for device specified. Default value is CPU. + +Inference options: + -nireq NUM_INFER_REQUESTS, --num_infer_requests NUM_INFER_REQUESTS + Optional. Number of infer requests. + -nstreams NUM_STREAMS, --num_streams NUM_STREAMS + Optional. Number of streams to use for inference on the CPU or/and GPU in throughput mode (for + HETERO and MULTI device cases use format :,: or just + ). + -nthreads NUM_THREADS, --num_threads NUM_THREADS + Optional. Number of threads to use for inference on CPU (including HETERO cases). + +Input/output options: + --loop Optional. Enable reading the input in a loop. + -o OUTPUT, --output OUTPUT + Optional. Name of the output file(s) to save. + -limit OUTPUT_LIMIT, --output_limit OUTPUT_LIMIT + Optional. Number of frames to store in output. If 0 is set, all frames are stored. + --no_show Optional. Don't show output. + --output_resolution OUTPUT_RESOLUTION + Optional. Specify the maximum output window resolution in (width x height) format. Example: + 1280x720. Input frame size used by default. + -u UTILIZATION_MONITORS, --utilization_monitors UTILIZATION_MONITORS + Optional. List of monitors to show initially. ``` Running the application with the empty list of options yields the usage message given above and an error message. +You can use the following command to do inference on GPU with a pre-trained midasnet model: + +```sh +python3 monodepth_demo.py \ + -d GPU \ + -i /inputVideo.mp4 \ + -m /midasnet.xml +``` + +The number of Infer Requests is specified by `-nireq` flag. An increase of this number usually leads to an increase +of performance (throughput), since in this case several Infer Requests can be processed simultaneously if the device +supports parallelization. However, a large number of Infer Requests increases the latency because each frame still +has to wait before being sent for inference. + +For higher FPS, it is recommended that you set `-nireq` to slightly exceed the `-nstreams` value, +summed across all devices used. + +> **NOTE**: This demo is based on the callback functionality from the Inference Engine Python API. + The selected approach makes the execution in multi-device mode optimal by preventing wait delays caused by + the differences in device performance. However, the internal organization of the callback mechanism in Python API + leads to a decrease in FPS. + +>**NOTE**: If you provide a single image as an input, the demo processes and renders it quickly, then exits. To continuously visualize inference results on the screen, apply the `loop` option, which enforces processing a single image in a loop. + +You can save processed results to a Motion JPEG AVI file or separate JPEG or PNG files using the `-o` option: + +* To save processed results in an AVI file, specify the name of the output file with `avi` extension, for example: `-o output.avi`. +* To save processed results as images, specify the template name of the output image file with `jpg` or `png` extension, for example: `-o output_%03d.jpg`. The actual file names are constructed from the template at runtime by replacing regular expression `%03d` with the frame number, resulting in the following: `output_000.jpg`, `output_001.jpg`, and so on. +To avoid disk space overrun in case of continuous input stream, like camera, you can limit the amount of data stored in the output file(s) with the `limit` option. The default value is 1000. To change it, you can apply the `-limit N` option, where `N` is the number of frames to store. + +>**NOTE**: Windows\* systems may not have the Motion JPEG codec installed by default. If this is the case, you can download OpenCV FFMPEG back end using the PowerShell script provided with the OpenVINO ™ install package and located at `/opencv/ffmpeg-download.ps1`. The script should be run with administrative privileges if OpenVINO ™ is installed in a system protected folder (this is a typical case). Alternatively, you can save results as images. + ## Demo Output -The application outputs are the floating disparity map (PFM) as well as a color-coded version (PNG). -The demo reports +The demo uses OpenCV to display the resulting frame with colored depth map. +The demo reports: -* **Latency**: total processing time required to process input data (from reading the data to displaying the results). +* **FPS**: average rate of video frame processing (frames per second). +* **Latency**: average time required to process one frame (from reading the frame to displaying the results). +You can use both of these metrics to measure application-level performance. ## See Also diff --git a/demos/monodepth_demo/python/monodepth_demo.py b/demos/monodepth_demo/python/monodepth_demo.py index e78b4334611..bcdc27eeb14 100755 --- a/demos/monodepth_demo/python/monodepth_demo.py +++ b/demos/monodepth_demo/python/monodepth_demo.py @@ -1,106 +1,204 @@ #!/usr/bin/env python3 +""" + Copyright (C) 2018-2021 Intel Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +""" import sys -from argparse import ArgumentParser +from argparse import ArgumentParser, SUPPRESS from pathlib import Path from time import perf_counter import cv2 import numpy as np import logging as log -from openvino.inference_engine import IECore, get_version -import matplotlib.pyplot as plt + +sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python')) +sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python/openvino/model_zoo')) + +from model_api.models import MonoDepthModel, OutputTransform +from model_api.pipelines import get_user_config, AsyncPipeline +from model_api.performance_metrics import PerformanceMetrics +from model_api.adapters import create_core, OpenvinoAdapter, RemoteAdapter + +import monitors +from images_capture import open_images_capture +from helpers import resolution + log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.DEBUG, stream=sys.stdout) +DEMO_NAME = "Depth Estimation" + + +def build_argparser(): + parser = ArgumentParser(add_help=False) + args = parser.add_argument_group('Options') + args.add_argument('-h', '--help', action='help', default=SUPPRESS, help='Show this help message and exit.') + args.add_argument('-m', '--model', help='Required. Path to an .xml file with a trained model.', + required=True, type=Path) + args.add_argument('-i', '--input', required=True, + help='Required. An input to process. The input must be a single image, ' + 'a folder of images, video file or camera id.') + args.add_argument('--adapter', help='Optional. Specify the model adapter. Default is openvino.', + default='openvino', type=str, choices=('openvino', 'remote')) + args.add_argument('-d', '--device', default='CPU', type=str, + help='Optional. Specify the target device to infer on; CPU, GPU, HDDL or MYRIAD is ' + 'acceptable. The demo will look for a suitable plugin for device specified. ' + 'Default value is CPU.') + + infer_args = parser.add_argument_group('Inference options') + infer_args.add_argument('-nireq', '--num_infer_requests', help='Optional. Number of infer requests.', + default=1, type=int) + infer_args.add_argument('-nstreams', '--num_streams', + help='Optional. Number of streams to use for inference on the CPU or/and GPU in throughput ' + 'mode (for HETERO and MULTI device cases use format ' + ':,: or just ).', + default='', type=str) + infer_args.add_argument('-nthreads', '--num_threads', default=None, type=int, + help='Optional. Number of threads to use for inference on CPU (including HETERO cases).') + + io_args = parser.add_argument_group('Input/output options') + io_args.add_argument('--loop', default=False, action='store_true', + help='Optional. Enable reading the input in a loop.') + io_args.add_argument('-o', '--output', required=False, + help='Optional. Name of the output file(s) to save.') + io_args.add_argument('-limit', '--output_limit', required=False, default=1000, type=int, + help='Optional. Number of frames to store in output. ' + 'If 0 is set, all frames are stored.') + io_args.add_argument('--no_show', help="Optional. Don't show output.", action='store_true') + io_args.add_argument('--output_resolution', default=None, type=resolution, + help='Optional. Specify the maximum output window resolution ' + 'in (width x height) format. Example: 1280x720. ' + 'Input frame size used by default.') + io_args.add_argument('-u', '--utilization_monitors', default='', type=str, + help='Optional. List of monitors to show initially.') + + return parser + + +def apply_color_map(depth_map, output_transform): + depth_map = output_transform.resize(depth_map) + depth_map = (depth_map * 255.0).astype(np.uint8) + return cv2.applyColorMap(depth_map, cv2.COLORMAP_INFERNO) + + def main(): - # arguments - parser = ArgumentParser() - - parser.add_argument( - "-m", "--model", help="Required. Path to an .xml file with a trained model", required=True, type=Path) - parser.add_argument( - "-i", "--input", help="Required. Path to a input image file", required=True, type=str) - parser.add_argument("-l", "--cpu_extension", - help="Optional. Required for CPU custom layers. Absolute MKLDNN (CPU)-targeted custom layers. " - "Absolute path to a shared library with the kernels implementations", type=str, default=None) - parser.add_argument("-d", "--device", - help="Optional. Specify the target device to infer on; CPU, GPU, HDDL or MYRIAD is acceptable. " - "The demo will look for a suitable plugin for device specified. Default value is CPU", default="CPU", type=str) - - args = parser.parse_args() - - log.info('OpenVINO Inference Engine') - log.info('\tbuild: {}'.format(get_version())) - ie = IECore() - if args.cpu_extension and "CPU" in args.device: - ie.add_extension(args.cpu_extension, "CPU") - - log.info('Reading model {}'.format(args.model)) - net = ie.read_network(args.model, args.model.with_suffix(".bin")) - - assert len(net.input_info) == 1, "Expected model with only 1 input blob" - assert len(net.outputs) == 1, "Expected model with only 1 output blob" - - input_blob = next(iter(net.input_info)) - out_blob = next(iter(net.outputs)) - net.batch_size = 1 - - # loading model to the plugin - exec_net = ie.load_network(network=net, device_name=args.device) - log.info('The model {} is loaded to {}'.format(args.model, args.device)) - - # read and pre-process input image - _, _, height, width = net.input_info[input_blob].input_data.shape - - start_time = perf_counter() - image = cv2.imread(args.input, cv2.IMREAD_COLOR) - (input_height, input_width) = image.shape[:-1] - - # resize - if (input_height, input_width) != (height, width): - log.debug("Image is resized from {} to {}".format( - image.shape[:-1], (height, width))) - image = cv2.resize(image, (width, height), cv2.INTER_CUBIC) - - # prepare input - image = image.astype(np.float32) - image = image.transpose((2, 0, 1)) - image_input = np.expand_dims(image, 0) - - # start sync inference - res = exec_net.infer(inputs={input_blob: image_input}) - - # processing output blob - disp = np.squeeze(res[out_blob][0]) - - # resize disp to input resolution - disp = cv2.resize(disp, (input_width, input_height), cv2.INTER_CUBIC) - - # rescale disp - disp_min = disp.min() - disp_max = disp.max() - - if disp_max - disp_min > 1e-6: - disp = (disp - disp_min) / (disp_max - disp_min) - else: - disp.fill(0.5) - - total_latency = (perf_counter() - start_time) * 1e3 - log.info("Metrics report:") - log.info("\tLatency: {:.1f} ms".format(total_latency)) - # pfm - out = 'disp.pfm' - cv2.imwrite(out, disp) - - log.debug("Disparity map was saved to {}".format(out)) - - # png - out = 'disp.png' - plt.imsave(out, disp, vmin=0, vmax=1, cmap='inferno') - - log.debug("Color-coded disparity image was saved to {}".format(out)) + args = build_argparser().parse_args() + + cap = open_images_capture(args.input, args.loop) + + if args.adapter == 'openvino': + plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) + model_adapter = OpenvinoAdapter(create_core(), args.model, device=args.device, plugin_config=plugin_config, + max_num_requests=args.num_infer_requests) + elif args.adapter == 'remote': + log.info('Reading model {}'.format(args.model)) + serving_config = {"address": "localhost", "port": 9000} + model_adapter = RemoteAdapter(args.model, serving_config) + + model = MonoDepthModel(model_adapter) + model.log_layers_info() + + pipeline = AsyncPipeline(model) + + next_frame_id = 0 + next_frame_id_to_show = 0 + + metrics = PerformanceMetrics() + presenter = None + output_transform = None + video_writer = cv2.VideoWriter() + + while True: + if pipeline.is_ready(): + # Get new image/frame + start_time = perf_counter() + frame = cap.read() + if frame is None: + if next_frame_id == 0: + raise ValueError("Can't read an image from the input") + break + if next_frame_id == 0: + output_transform = OutputTransform(frame.shape[:2], args.output_resolution) + if args.output_resolution: + output_resolution = output_transform.new_resolution + else: + output_resolution = (frame.shape[1], frame.shape[0]) + presenter = monitors.Presenter(args.utilization_monitors, 55, + (round(output_resolution[0] / 4), round(output_resolution[1] / 8))) + if args.output and not video_writer.open(args.output, cv2.VideoWriter_fourcc(*'MJPG'), + cap.fps(), output_resolution): + raise RuntimeError("Can't open video writer") + # Submit for inference + pipeline.submit_data(frame, next_frame_id, {'start_time': start_time}) + next_frame_id += 1 + else: + # Wait for empty request + pipeline.await_any() + + if pipeline.callback_exceptions: + raise pipeline.callback_exceptions[0] + # Process all completed requests + results = pipeline.get_result(next_frame_id_to_show) + if results: + depth_map, frame_meta = results + depth_map = apply_color_map(depth_map, output_transform) + + start_time = frame_meta['start_time'] + presenter.drawGraphs(depth_map) + metrics.update(start_time, depth_map) + + if video_writer.isOpened() and (args.output_limit <= 0 or next_frame_id_to_show <= args.output_limit-1): + video_writer.write(depth_map) + next_frame_id_to_show += 1 + + if not args.no_show: + cv2.imshow(DEMO_NAME, depth_map) + key = cv2.waitKey(1) + if key == 27 or key == 'q' or key == 'Q': + break + presenter.handleKey(key) + + pipeline.await_all() + # Process completed requests + for next_frame_id_to_show in range(next_frame_id_to_show, next_frame_id): + results = pipeline.get_result(next_frame_id_to_show) + while results is None: + results = pipeline.get_result(next_frame_id_to_show) + depth_map, frame_meta = results + depth_map = apply_color_map(depth_map, output_transform) + + start_time = frame_meta['start_time'] + + presenter.drawGraphs(depth_map) + metrics.update(start_time, depth_map) + + if video_writer.isOpened() and (args.output_limit <= 0 or next_frame_id_to_show <= args.output_limit-1): + video_writer.write(depth_map) + + if not args.no_show: + cv2.imshow(DEMO_NAME, depth_map) + key = cv2.waitKey(1) + if key == 27 or key == 'q' or key == 'Q': + break + presenter.handleKey(key) + + metrics.log_total() + for rep in presenter.reportMeans(): + log.info(rep) if __name__ == '__main__': diff --git a/demos/multi_camera_multi_target_tracking_demo/python/README.md b/demos/multi_camera_multi_target_tracking_demo/python/README.md index 8b5b929398d..cbfd9828095 100644 --- a/demos/multi_camera_multi_target_tracking_demo/python/README.md +++ b/demos/multi_camera_multi_target_tracking_demo/python/README.md @@ -22,7 +22,7 @@ and then for each detected object it extracts embeddings using re-identification 2. All embeddings are passed to tracker which assigns an ID to each object. 3. The demo visualizes the resulting bounding boxes and unique object IDs assigned during tracking. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/multi_channel_face_detection_demo/cpp/README.md b/demos/multi_channel_face_detection_demo/cpp/README.md index 09388afb391..ec80f589f94 100644 --- a/demos/multi_channel_face_detection_demo/cpp/README.md +++ b/demos/multi_channel_face_detection_demo/cpp/README.md @@ -11,7 +11,7 @@ Other demo objectives are: On startup, the application reads command line parameters and loads the specified networks. The Face Detection network is required. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/multi_channel_human_pose_estimation_demo/cpp/README.md b/demos/multi_channel_human_pose_estimation_demo/cpp/README.md index ca3eaae1b18..4c0ed4c502a 100644 --- a/demos/multi_channel_human_pose_estimation_demo/cpp/README.md +++ b/demos/multi_channel_human_pose_estimation_demo/cpp/README.md @@ -11,7 +11,7 @@ Other demo objectives are: On startup, the application reads command line parameters and loads the specified networks. The Human Pose Estimation network is required. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/multi_channel_object_detection_demo_yolov3/cpp/README.md b/demos/multi_channel_object_detection_demo_yolov3/cpp/README.md index 42e7d9f4f32..24f358004bb 100644 --- a/demos/multi_channel_object_detection_demo_yolov3/cpp/README.md +++ b/demos/multi_channel_object_detection_demo_yolov3/cpp/README.md @@ -11,7 +11,7 @@ Other demo objectives are: On startup, the application reads command line parameters and loads the specified networks. The Yolo v3 Object Detection network is required. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/object_detection_demo/cpp/README.md b/demos/object_detection_demo/cpp/README.md index 463af65401f..e671cd76e1b 100644 --- a/demos/object_detection_demo/cpp/README.md +++ b/demos/object_detection_demo/cpp/README.md @@ -29,7 +29,7 @@ need to pull Inference Engine demos helpers to your app On startup, the application reads command-line parameters and loads a network to the Inference Engine. Upon getting a frame from the OpenCV VideoCapture it performs inference and displays the results. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). This demo operates in asynchronous manner by using "Infer Requests" that encapsulate the inputs/outputs and separates *scheduling and waiting for result*, as shown in code mockup below: @@ -82,6 +82,11 @@ omz_converter --list models.lst * architecture_type = ssd - efficientdet-d0-tf - efficientdet-d1-tf + - face-detection-0200 + - face-detection-0202 + - face-detection-0204 + - face-detection-0205 + - face-detection-0206 - face-detection-adas-0001 - face-detection-retail-0004 - face-detection-retail-0005 @@ -102,9 +107,9 @@ omz_converter --list models.lst - person-vehicle-bike-detection-2003 - person-vehicle-bike-detection-2004 - product-detection-0001 - - rfcn-resnet101-coco-tf - retinaface-resnet50-pytorch - retinanet-tf + - rfcn-resnet101-coco-tf - ssd300 - ssd512 - ssd-resnet34-1200-onnx diff --git a/demos/object_detection_demo/cpp/models.lst b/demos/object_detection_demo/cpp/models.lst index 9fd19f708a8..180966f49c1 100644 --- a/demos/object_detection_demo/cpp/models.lst +++ b/demos/object_detection_demo/cpp/models.lst @@ -9,6 +9,7 @@ retinaface-resnet50-pytorch # For -at ssd efficientdet-d0-tf efficientdet-d1-tf +face-detection-???? face-detection-adas-???? face-detection-retail-???? faster-rcnn-resnet101-coco-sparse-60-0001 diff --git a/demos/object_detection_demo/object_detection.gif b/demos/object_detection_demo/object_detection.gif index e85b1dfd046..69a043b7284 100644 Binary files a/demos/object_detection_demo/object_detection.gif and b/demos/object_detection_demo/object_detection.gif differ diff --git a/demos/object_detection_demo/python/README.md b/demos/object_detection_demo/python/README.md index d2b886d14ce..6d80293e6e4 100644 --- a/demos/object_detection_demo/python/README.md +++ b/demos/object_detection_demo/python/README.md @@ -37,7 +37,7 @@ Engine. Upon getting a frame from the OpenCV VideoCapture, it performs inference Async API operates with a notion of the "Infer Request" that encapsulates the inputs/outputs and separates *scheduling and waiting for result*. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run @@ -133,6 +133,9 @@ omz_converter --list models.lst - yolo-v2-tiny-vehicle-detection-0001 - yolo-v3-tf - yolo-v3-tiny-tf +* architecture_type = yolov3-onnx + - yolo-v3-onnx + - yolo-v3-tiny-onnx * architecture_type = yolov4 - yolo-v4-tf - yolo-v4-tiny-tf @@ -149,7 +152,7 @@ Running the application with the `-h` option yields the following usage message: ``` usage: object_detection_demo.py [-h] -m MODEL -at - {ssd,yolo,yolov4,yolof,yolox,faceboxes,centernet,ctpn,retinaface,ultra_lightweight_face_detection,retinaface-pytorch,detr} + {ssd,yolo,yolov3-onnx,yolov4,yolof,yolox,faceboxes,centernet,ctpn,retinaface,ultra_lightweight_face_detection,retinaface-pytorch,detr} -i INPUT [-d DEVICE] [--labels LABELS] [-t PROB_THRESHOLD] [--resize_type {standard,fit_to_window,fit_to_window_letterbox}] [--input_size INPUT_SIZE INPUT_SIZE] [--anchors ANCHORS [ANCHORS ...]] @@ -163,7 +166,7 @@ Options: -h, --help Show this help message and exit. -m MODEL, --model MODEL Required. Path to an .xml file with a trained model. - -at, --architecture_type Required. Specify model' architecture type. Valid values are {ssd,yolo,yolov4,yolof,yolox,faceboxes,centernet,ctpn,retinaface,ultra_lightweight_face_detection,retinaface-pytorch,detr}. + -at, --architecture_type Required. Specify model' architecture type. Valid values are {ssd,yolo,yolov3-onnx,yolov4,yolof,yolox,faceboxes,centernet,ctpn,retinaface,ultra_lightweight_face_detection,retinaface-pytorch,detr}. -i INPUT, --input INPUT Required. An input to process. The input must be a single image, a folder of images, video file or camera id. diff --git a/demos/object_detection_demo/python/models.lst b/demos/object_detection_demo/python/models.lst index 0ec89255e38..eb0e67e5896 100644 --- a/demos/object_detection_demo/python/models.lst +++ b/demos/object_detection_demo/python/models.lst @@ -54,6 +54,9 @@ yolo-v2-tiny-tf yolo-v2-tiny-vehicle-detection-0001 yolo-v3-tf yolo-v3-tiny-tf +# For --architecture_type=yolov3-onnx +yolo-v3-onnx +yolo-v3-tiny-onnx # For --architecture_type=yolov4 yolo-v4-tf yolo-v4-tiny-tf diff --git a/demos/object_detection_demo/python/object_detection_demo.py b/demos/object_detection_demo/python/object_detection_demo.py index 1cdeae81888..fe5546fa2c6 100755 --- a/demos/object_detection_demo/python/object_detection_demo.py +++ b/demos/object_detection_demo/python/object_detection_demo.py @@ -25,18 +25,18 @@ import cv2 import numpy as np -from openvino.inference_engine import IECore, get_version sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python')) sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python/openvino/model_zoo')) from model_api import models from model_api.performance_metrics import PerformanceMetrics -from model_api.pipelines import get_user_config, parse_devices, AsyncPipeline +from model_api.pipelines import get_user_config, AsyncPipeline +from model_api.adapters import create_core, OpenvinoAdapter, RemoteAdapter import monitors from images_capture import open_images_capture -from helpers import resolution, log_blobs_info, log_runtime_settings, log_latency_per_stage +from helpers import resolution, log_latency_per_stage log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.DEBUG, stream=sys.stdout) @@ -46,11 +46,14 @@ def build_argparser(): args = parser.add_argument_group('Options') args.add_argument('-h', '--help', action='help', default=SUPPRESS, help='Show this help message and exit.') args.add_argument('-m', '--model', help='Required. Path to an .xml file with a trained model.', - required=True, type=Path) + required=True) args.add_argument('-at', '--architecture_type', help='Required. Specify model\' architecture type.', - type=str, required=True, choices=('ssd', 'yolo', 'yolov4', 'yolof', 'yolox', 'faceboxes', 'centernet', 'ctpn', + type=str, required=True, choices=('ssd', 'yolo', 'yolov3-onnx', 'yolov4', 'yolof', 'yolox', + 'faceboxes', 'centernet', 'ctpn', 'retinaface', 'ultra_lightweight_face_detection', 'retinaface-pytorch', 'detr')) + args.add_argument('--adapter', help='Optional. Specify the model adapter. Default is openvino.', + default='openvino', type=str, choices=('openvino', 'remote')) args.add_argument('-i', '--input', required=True, help='Required. An input to process. The input must be a single image, ' 'a folder of images, video file or camera id.') @@ -162,36 +165,39 @@ def __len__(self): return len(self.palette) -def get_model(ie, args): +def get_model(model_adapter, args): if args.architecture_type == 'ssd': - return models.SSD(ie, args.model, labels=args.labels, resize_type=args.resize_type, + return models.SSD(model_adapter, labels=args.labels, resize_type=args.resize_type, threshold=args.prob_threshold) elif args.architecture_type == 'ctpn': - return models.CTPN(ie, args.model, input_size=args.input_size, threshold=args.prob_threshold) + return models.CTPN(model_adapter, input_size=args.input_size, threshold=args.prob_threshold) elif args.architecture_type == 'yolo': - return models.YOLO(ie, args.model, labels=args.labels, resize_type=args.resize_type, + return models.YOLO(model_adapter, labels=args.labels, resize_type=args.resize_type, threshold=args.prob_threshold) + elif args.architecture_type == 'yolov3-onnx': + return models.YoloV3ONNX(model_adapter, labels=args.labels, resize_type=args.resize_type, + threshold=args.prob_threshold) elif args.architecture_type == 'yolov4': - return models.YoloV4(ie, args.model, labels=args.labels, + return models.YoloV4(model_adapter, labels=args.labels, threshold=args.prob_threshold, resize_type=args.resize_type, anchors=args.anchors, masks=args.masks) elif args.architecture_type == 'yolof': - return models.YOLOF(ie, args.model, labels=args.labels, resize_type=args.resize_type, + return models.YOLOF(model_adapter, labels=args.labels, resize_type=args.resize_type, threshold=args.prob_threshold) elif args.architecture_type == 'yolox': - return models.YOLOX(ie, args.model, labels=args.labels, threshold=args.prob_threshold) + return models.YOLOX(model_adapter, labels=args.labels, threshold=args.prob_threshold) elif args.architecture_type == 'faceboxes': - return models.FaceBoxes(ie, args.model, threshold=args.prob_threshold) + return models.FaceBoxes(model_adapter, threshold=args.prob_threshold) elif args.architecture_type == 'centernet': - return models.CenterNet(ie, args.model, labels=args.labels, threshold=args.prob_threshold) + return models.CenterNet(model_adapter, labels=args.labels, threshold=args.prob_threshold) elif args.architecture_type == 'retinaface': - return models.RetinaFace(ie, args.model, threshold=args.prob_threshold) + return models.RetinaFace(model_adapter, threshold=args.prob_threshold) elif args.architecture_type == 'ultra_lightweight_face_detection': - return models.UltraLightweightFaceDetection(ie, args.model, threshold=args.prob_threshold) + return models.UltraLightweightFaceDetection(model_adapter, threshold=args.prob_threshold) elif args.architecture_type == 'retinaface-pytorch': - return models.RetinaFacePyTorch(ie, args.model, threshold=args.prob_threshold) + return models.RetinaFacePyTorch(model_adapter, threshold=args.prob_threshold) elif args.architecture_type == 'detr': - return models.DETR(ie, args.model, labels=args.labels, threshold=args.prob_threshold) + return models.DETR(model_adapter, labels=args.labels, threshold=args.prob_threshold) else: raise RuntimeError('No model type or invalid model type (-at) provided: {}'.format(args.architecture_type)) @@ -234,22 +240,20 @@ def main(): cap = open_images_capture(args.input, args.loop) - log.info('OpenVINO Inference Engine') - log.info('\tbuild: {}'.format(get_version())) - ie = IECore() + if args.adapter == 'openvino': + plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) + model_adapter = OpenvinoAdapter(create_core(), args.model, device=args.device, plugin_config=plugin_config, + max_num_requests=args.num_infer_requests) + elif args.adapter == 'remote': + log.info('Reading model {}'.format(args.model)) + serving_config = {"address": "localhost", "port": 9000} + model_adapter = RemoteAdapter(args.model, serving_config) - plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) - - log.info('Reading model {}'.format(args.model)) - model = get_model(ie, args) + model = get_model(model_adapter, args) model.set_inputs_preprocessing(args.reverse_input_channels, args.mean_values, args.scale_values) - log_blobs_info(model) - - detector_pipeline = AsyncPipeline(ie, model, plugin_config, - device=args.device, max_num_requests=args.num_infer_requests) + model.log_layers_info() - log.info('The model {} is loaded to {}'.format(args.model, args.device)) - log_runtime_settings(detector_pipeline.exec_net, set(parse_devices(args.device))) + detector_pipeline = AsyncPipeline(model) next_frame_id = 0 next_frame_id_to_show = 0 diff --git a/demos/pedestrian_tracker_demo/cpp/README.md b/demos/pedestrian_tracker_demo/cpp/README.md index f50f1174e84..5c4e81f8ab0 100644 --- a/demos/pedestrian_tracker_demo/cpp/README.md +++ b/demos/pedestrian_tracker_demo/cpp/README.md @@ -18,7 +18,7 @@ if a detected pedestrian is the next position of a known person or the first pos After that, the application displays the tracks and the latest detections on the screen and goes to the next frame. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/pedestrian_tracker_demo/cpp/pedestrian_tracker.gif b/demos/pedestrian_tracker_demo/cpp/pedestrian_tracker.gif index 001050bc89a..889561e8d8c 100644 Binary files a/demos/pedestrian_tracker_demo/cpp/pedestrian_tracker.gif and b/demos/pedestrian_tracker_demo/cpp/pedestrian_tracker.gif differ diff --git a/demos/place_recognition_demo/python/README.md b/demos/place_recognition_demo/python/README.md index 5f778297914..e69793560c3 100644 --- a/demos/place_recognition_demo/python/README.md +++ b/demos/place_recognition_demo/python/README.md @@ -1,5 +1,7 @@ # Place Recognition Python\* Demo +![example](./place_recognition.png) + This demo demonstrates how to run Place Recognition models using OpenVINO™. > **NOTE**: Only batch size of 1 is supported. @@ -24,7 +26,7 @@ The demo workflow is the following: - Top-10 most similar images from the gallery. - Performance characteristics. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/place_recognition_demo/python/place_recognition.png b/demos/place_recognition_demo/python/place_recognition.png new file mode 100644 index 00000000000..0a75449a847 Binary files /dev/null and b/demos/place_recognition_demo/python/place_recognition.png differ diff --git a/demos/security_barrier_camera_demo/cpp/README.md b/demos/security_barrier_camera_demo/cpp/README.md index 272997f1aa3..6b4eea60adc 100644 --- a/demos/security_barrier_camera_demo/cpp/README.md +++ b/demos/security_barrier_camera_demo/cpp/README.md @@ -34,7 +34,7 @@ The pipeline of this demo executes the following sequence of `Task`s: At the end of the sequence, the `VideoFrame` is destroyed and the sequence starts again for the next frame. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/security_barrier_camera_demo/cpp/security_barrier_camera.gif b/demos/security_barrier_camera_demo/cpp/security_barrier_camera.gif index 42a6b024f8b..18b0570fc76 100644 Binary files a/demos/security_barrier_camera_demo/cpp/security_barrier_camera.gif and b/demos/security_barrier_camera_demo/cpp/security_barrier_camera.gif differ diff --git a/demos/segmentation_demo/cpp/README.md b/demos/segmentation_demo/cpp/README.md index 1764a90d63a..b80142ab72d 100644 --- a/demos/segmentation_demo/cpp/README.md +++ b/demos/segmentation_demo/cpp/README.md @@ -10,7 +10,7 @@ This topic demonstrates how to run the Image Segmentation demo application, whic On startup the demo application reads command line parameters and loads a network. The demo runs inference and shows results for each image captured from an input. Depending on number of inference requests processing simultaneously (-nireq parameter) the pipeline might minimize the time required to process each single image (for nireq 1) or maximizes utilization of the device and overall processing performance. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/segmentation_demo/python/README.md b/demos/segmentation_demo/python/README.md index f0921899535..9d5993f622a 100644 --- a/demos/segmentation_demo/python/README.md +++ b/demos/segmentation_demo/python/README.md @@ -10,7 +10,7 @@ This topic demonstrates how to run the Image Segmentation demo application, whic On startup the demo application reads command line parameters and loads a network. The demo runs inference and shows results for each image captured from an input. Demo provides default mapping of classes to colors and optionally, allow to specify mapping of classes to colors from simple text file, with using `--colors` argument. Depending on number of inference requests processing simultaneously (-nireq parameter) the pipeline might minimize the time required to process each single image (for nireq 1) or maximize utilization of the device and overall processing performance. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/segmentation_demo/python/segmentation_demo.py b/demos/segmentation_demo/python/segmentation_demo.py index e2d5b51c09d..6106621e297 100755 --- a/demos/segmentation_demo/python/segmentation_demo.py +++ b/demos/segmentation_demo/python/segmentation_demo.py @@ -23,18 +23,18 @@ import cv2 import numpy as np -from openvino.inference_engine import IECore, get_version sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python')) sys.path.append(str(Path(__file__).resolve().parents[2] / 'common/python/openvino/model_zoo')) from model_api.models import OutputTransform, SegmentationModel, SalientObjectDetectionModel from model_api.performance_metrics import PerformanceMetrics -from model_api.pipelines import get_user_config, parse_devices, AsyncPipeline +from model_api.pipelines import get_user_config, AsyncPipeline +from model_api.adapters import create_core, OpenvinoAdapter, RemoteAdapter import monitors from images_capture import open_images_capture -from helpers import resolution, log_blobs_info, log_runtime_settings, log_latency_per_stage +from helpers import resolution, log_latency_per_stage log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.DEBUG, stream=sys.stdout) @@ -113,9 +113,11 @@ def build_argparser(): args = parser.add_argument_group('Options') args.add_argument('-h', '--help', action='help', default=SUPPRESS, help='Show this help message and exit.') args.add_argument('-m', '--model', help='Required. Path to an .xml file with a trained model.', - required=True, type=Path) + required=True) args.add_argument('-at', '--architecture_type', help='Required. Specify the model\'s architecture type.', type=str, required=True, choices=('segmentation', 'salient_object_detection')) + args.add_argument('--adapter', help='Optional. Specify the model adapter. Default is openvino.', + default='openvino', type=str, choices=('openvino', 'remote')) args.add_argument('-i', '--input', required=True, help='Required. An input to process. The input must be a single image, ' 'a folder of images, video file or camera id.') @@ -164,11 +166,11 @@ def build_argparser(): return parser -def get_model(ie, args): +def get_model(adapter, args): if args.architecture_type == 'segmentation': - return SegmentationModel(ie, args.model, labels=args.labels), SegmentationVisualizer(args.colors) + return SegmentationModel(adapter, labels=args.labels), SegmentationVisualizer(args.colors) if args.architecture_type == 'salient_object_detection': - return SalientObjectDetectionModel(ie, args.model, labels=args.labels), SaliencyMapVisualizer() + return SalientObjectDetectionModel(adapter, labels=args.labels), SaliencyMapVisualizer() def print_raw_results(mask, frame_id, labels=None): @@ -188,20 +190,19 @@ def main(): cap = open_images_capture(args.input, args.loop) - log.info('OpenVINO Inference Engine') - log.info('\tbuild: {}'.format(get_version())) - ie = IECore() + if args.adapter == 'openvino': + plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) + model_adapter = OpenvinoAdapter(create_core(), args.model, device=args.device, plugin_config=plugin_config, + max_num_requests=args.num_infer_requests) + elif args.adapter == 'remote': + log.info('Reading model {}'.format(args.model)) + serving_config = {"address": "localhost", "port": 9000} + model_adapter = RemoteAdapter(args.model, serving_config) - plugin_config = get_user_config(args.device, args.num_streams, args.num_threads) + model, visualizer = get_model(model_adapter, args) + model.log_layers_info() - model, visualizer = get_model(ie, args) - log.info('Reading model {}'.format(args.model)) - log_blobs_info(model) - - pipeline = AsyncPipeline(ie, model, plugin_config, device=args.device, max_num_requests=args.num_infer_requests) - - log.info('The model {} is loaded to {}'.format(args.model, args.device)) - log_runtime_settings(pipeline.exec_net, set(parse_devices(args.device))) + pipeline = AsyncPipeline(model) next_frame_id = 0 next_frame_id_to_show = 0 diff --git a/demos/segmentation_demo/segmentation.gif b/demos/segmentation_demo/segmentation.gif index 86e33924811..054e152a776 100644 Binary files a/demos/segmentation_demo/segmentation.gif and b/demos/segmentation_demo/segmentation.gif differ diff --git a/demos/single_human_pose_estimation_demo/python/README.md b/demos/single_human_pose_estimation_demo/python/README.md index e178e803149..64be77b4310 100644 --- a/demos/single_human_pose_estimation_demo/python/README.md +++ b/demos/single_human_pose_estimation_demo/python/README.md @@ -8,7 +8,7 @@ This demo showcases top-down pipeline for human pose estimation on video or imag On startup, the application reads command line parameters and loads detection person model and single human pose estimation model. Upon getting a frame from the OpenCV VideoCapture, the demo executes top-down pipeline for this frame and displays the results. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/single_human_pose_estimation_demo/python/single_human_pose_estimation.gif b/demos/single_human_pose_estimation_demo/python/single_human_pose_estimation.gif index 37181127d5b..66ad71b99ef 100644 Binary files a/demos/single_human_pose_estimation_demo/python/single_human_pose_estimation.gif and b/demos/single_human_pose_estimation_demo/python/single_human_pose_estimation.gif differ diff --git a/demos/smart_classroom_demo/cpp/README.md b/demos/smart_classroom_demo/cpp/README.md index 34ca3e8cfde..c7646f1d6bd 100644 --- a/demos/smart_classroom_demo/cpp/README.md +++ b/demos/smart_classroom_demo/cpp/README.md @@ -18,7 +18,7 @@ a vector of features for each detected face. On startup, the application reads command line parameters and loads four networks to the Inference Engine for execution on different devices depending on `-m...` options family. Upon getting a frame from the OpenCV VideoCapture, it performs inference of Face Detection and Action Detection networks. After that, the ROIs obtained by Face Detector are fed to the Facial Landmarks Regression network. Then landmarks are used to align faces by affine transform and feed them to the Face Recognition network. The recognized faces are matched with detected actions to find an action for a recognized person for each frame. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Creating a Gallery for Face Recognition diff --git a/demos/smart_classroom_demo/cpp_gapi/CMakeLists.txt b/demos/smart_classroom_demo/cpp_gapi/CMakeLists.txt index 2d6adde4bef..1fb1e66dc67 100644 --- a/demos/smart_classroom_demo/cpp_gapi/CMakeLists.txt +++ b/demos/smart_classroom_demo/cpp_gapi/CMakeLists.txt @@ -9,4 +9,5 @@ add_demo(NAME smart_classroom_demo_gapi SOURCES ${SOURCES} HEADERS ${HEADERS} INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include" - DEPENDENCIES monitors) + DEPENDENCIES monitors utils_gapi + OPENCV_VERSION_REQUIRED 4.5.3) diff --git a/demos/smart_classroom_demo/cpp_gapi/README.md b/demos/smart_classroom_demo/cpp_gapi/README.md index acac31aacbf..ae39631cb9e 100644 --- a/demos/smart_classroom_demo/cpp_gapi/README.md +++ b/demos/smart_classroom_demo/cpp_gapi/README.md @@ -18,7 +18,7 @@ On the start-up, the application reads command line parameters and loads four ne Face gallery graph gets a frame performs inference of Face Detection network. ROI obtained by Face Detector are fed to the Facial Landmarks Regression network. Then landmarks are used to align faces by affine transform and feed them to the Face Recognition network. Output contains identities metrics for each face from gallery. Main graph works with frames from input source. First steps are equal to gallery processing. These are the same operations with Face Detection, Landmarks Regression, Face Recognition networks. Besides this, graph performs Action Detection network. The recognized faces are matched with detected actions to find an action for a recognized person for each frame. Then it draws results on frame. Output contains processed frame and logs. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Creating a Gallery for Face Recognition diff --git a/demos/smart_classroom_demo/cpp_gapi/include/initialize.hpp b/demos/smart_classroom_demo/cpp_gapi/include/initialize.hpp index fb226cdf415..e193d98d4bb 100644 --- a/demos/smart_classroom_demo/cpp_gapi/include/initialize.hpp +++ b/demos/smart_classroom_demo/cpp_gapi/include/initialize.hpp @@ -203,10 +203,9 @@ void configNets(const NetsFlagsPack& flags, "ActionNet/action_heads/out_head_2_anchor_3", "ActionNet/action_heads/out_head_2_anchor_4"}; /** Create action detector net's parameters **/ - std::array outputBlobList; - outputBlobList = isNetForSixActions(flags.m_act) - ? outputBlobList = action_detector_6 - : outputBlobList = action_detector_5; + std::array outputBlobList = isNetForSixActions(flags.m_act) + ? action_detector_6 + : action_detector_5; auto action_net = cv::gapi::ie::Params{ flags.m_act, fileNameNoExt(flags.m_act) + ".bin", @@ -214,8 +213,7 @@ void configNets(const NetsFlagsPack& flags, }.cfgOutputLayers(outputBlobList); networks += cv::gapi::networks(action_net); slog::info << "The Person/Action Detection model " << flags.m_act << " is loaded to " << flags.d_act << " device." << slog::endl; - } - else { + } else { slog::info << "Person/Action Detection DISABLED." << slog::endl; } if (!flags.m_fd.empty()) { @@ -228,8 +226,7 @@ void configNets(const NetsFlagsPack& flags, {1u, 3u, static_cast(flags.inh_fd), static_cast(flags.inw_fd)}); networks += cv::gapi::networks(det_net); slog::info << "The Face Detection model" << flags.m_fd << " is loaded to " << flags.d_fd << " device." << slog::endl; - } - else { + } else { slog::info << "Face Detection DISABLED." << slog::endl; } @@ -242,8 +239,7 @@ void configNets(const NetsFlagsPack& flags, }; if (!flags.m_lm.empty()) { slog::info << "The Facial Landmarks Regression model" << flags.m_lm << " is loaded to " << flags.d_lm << " device." << slog::endl; - } - else { + } else { slog::info << "Facial Landmarks Regression DISABLED." << slog::endl; } /** Create reidentification net's parameters **/ @@ -255,8 +251,7 @@ void configNets(const NetsFlagsPack& flags, networks += cv::gapi::networks(landm_net, reident_net); if (!flags.m_reid.empty()) { slog::info << "The Face Re-Identification model " << flags.m_reid << " is loaded to " << flags.d_reid << " device." << slog::endl; - } - else { + } else { slog::info << "Face Re-Identification DISABLED." << slog::endl; } InferenceEngine::Core ie; diff --git a/demos/smart_classroom_demo/cpp_gapi/include/stream_source.hpp b/demos/smart_classroom_demo/cpp_gapi/include/stream_source.hpp deleted file mode 100644 index 22702e7c8c2..00000000000 --- a/demos/smart_classroom_demo/cpp_gapi/include/stream_source.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include - -namespace custom { -class CustomCapSource : public cv::gapi::wip::IStreamSource -{ -public: - explicit CustomCapSource(std::shared_ptr& cap) : cap(cap) { - prep(); - } - -protected: - std::shared_ptr cap; - cv::Mat first; - bool first_pulled = false; - cv::Mat clear_frame; - void prep() { - GAPI_Assert(first.empty()); - cv::Mat tmp = cap->read(); - if (!tmp.data) { - GAPI_Assert(false && "Couldn't grab the frame"); - } - first = tmp.clone(); - } - - virtual bool pull(cv::gapi::wip::Data &data) override { - if (!first_pulled) { - GAPI_Assert(!first.empty()); - first_pulled = true; - data = first; - return true; - } - cv::Mat frame = cap->read(); - if (!frame.data) { - return false; - } - data = frame.clone(); - return true; - } - - virtual cv::GMetaArg descr_of() const override { - GAPI_Assert(!first.empty()); - return cv::GMetaArg{ cv::descr_of(first) }; - } -}; - -} // namespace custom diff --git a/demos/smart_classroom_demo/cpp_gapi/main.cpp b/demos/smart_classroom_demo/cpp_gapi/main.cpp index b69d851a9d1..b28b7158f8f 100644 --- a/demos/smart_classroom_demo/cpp_gapi/main.cpp +++ b/demos/smart_classroom_demo/cpp_gapi/main.cpp @@ -7,13 +7,13 @@ #include #include #include +#include #include #include #include #include "initialize.hpp" -#include "stream_source.hpp" #include "smart_classroom_demo_gapi.hpp" namespace util { @@ -244,7 +244,7 @@ int main(int argc, char* argv[]) { FLAGS_r)); /** ---------------- The execution part ---------------- **/ - stream.setSource(cap); + stream.setSource(cap); /** Service constants **/ size_t work_num_frames = 0; @@ -298,7 +298,7 @@ int main(int argc, char* argv[]) { if (!stream.running()) { /** TOP_K part. SPACE_KEY is pressed, monitoring enabled * Compile and start graph **/ - stream.setSource(cap); + stream.setSource(cap); stream.start(); } if (!stream.pull(std::move(out_vector))) { diff --git a/demos/smart_classroom_demo/cpp_gapi/src/custom_kerenels.cpp b/demos/smart_classroom_demo/cpp_gapi/src/custom_kernels.cpp similarity index 100% rename from demos/smart_classroom_demo/cpp_gapi/src/custom_kerenels.cpp rename to demos/smart_classroom_demo/cpp_gapi/src/custom_kernels.cpp diff --git a/demos/smart_classroom_demo/smart_classroom.gif b/demos/smart_classroom_demo/smart_classroom.gif index 30b17cf645d..4a4e367572e 100644 Binary files a/demos/smart_classroom_demo/smart_classroom.gif and b/demos/smart_classroom_demo/smart_classroom.gif differ diff --git a/demos/social_distance_demo/cpp/README.md b/demos/social_distance_demo/cpp/README.md index 55e4b24948c..4902628fae5 100644 --- a/demos/social_distance_demo/cpp/README.md +++ b/demos/social_distance_demo/cpp/README.md @@ -30,7 +30,7 @@ The pipeline of this demo executes the following sequence of `Task`s: At the end of the sequence, the `VideoFrame` is destroyed and the sequence starts again for the next frame. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html) +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters) ## Preparing to Run diff --git a/demos/social_distance_demo/cpp/social_distance.gif b/demos/social_distance_demo/cpp/social_distance.gif index 336a914c9f5..46ebce46ffc 100644 Binary files a/demos/social_distance_demo/cpp/social_distance.gif and b/demos/social_distance_demo/cpp/social_distance.gif differ diff --git a/demos/tests/args.py b/demos/tests/args.py index 72770a7bf66..015676943a0 100644 --- a/demos/tests/args.py +++ b/demos/tests/args.py @@ -55,7 +55,7 @@ def resolve(self, context): class ModelArg(Arg): - def __init__(self, name, precision='FP32'): + def __init__(self, name, precision=None): self.name = name self.precision = precision @@ -64,7 +64,7 @@ def resolve(self, context): @property def required_models(self): - return [RequestedModel(self.name, [self.precision])] + return [RequestedModel(self.name, [])] class ModelFileArg(Arg): diff --git a/demos/tests/cases.py b/demos/tests/cases.py index 59c3d1c9cbd..dd8b6f41879 100644 --- a/demos/tests/cases.py +++ b/demos/tests/cases.py @@ -47,6 +47,40 @@ def device_args(self, device_list): return {'CPU': []} return {device: [arg for key in self.device_keys for arg in [key, device]] for device in device_list} + def get_models(self, case): + return ((case.options[key], key) for key in self.model_keys if key in case.options) + + def update_case(self, case, updated_options, with_replace=False): + if not updated_options: return + new_options = case.options.copy() + for key, value in updated_options.items(): + new_options[key] = value + new_case = case._replace(options=new_options) + if with_replace: + self.test_cases.remove(case) + self.test_cases.append(new_case) + + def set_precisions(self, precisions, model_info): + for case in self.test_cases[:]: + updated_options = {p: {} for p in precisions} + + for model, key in self.get_models(case): + if not isinstance(model, ModelArg): + continue + supported_p = list(set(precisions) & set(model_info[model.name]["precisions"])) + if len(supported_p): + model.precision = supported_p[0] + for p in supported_p[1:]: + updated_options[p][key] = ModelArg(model.name, p) + else: + print("Warning: {} model does not support {} precisions and will not be tested\n".format( + model.name, ','.join(precisions))) + self.test_cases.remove(case) + break + + for p in precisions: + self.update_case(case, updated_options[p]) + class CppDemo(Demo): def __init__(self, name, implementation='cpp', model_keys=None, device_keys=None, test_cases=None): @@ -102,7 +136,12 @@ def single_option_cases(key, *args): ModelArg('alexnet'), ModelArg('densenet-121-tf'), ModelArg('densenet-169'), + ModelArg('googlenet-v1'), + ModelArg('googlenet-v1-tf'), + ModelArg('googlenet-v3'), + ModelArg('googlenet-v3-pytorch'), ModelArg('mixnet-l'), + ModelArg('mobilenet-v2'), ModelArg('mobilenet-v2-pytorch'), ModelArg('repvgg-a0'), ModelArg('repvgg-b1'), @@ -136,11 +175,14 @@ def single_option_cases(key, *args): '-i': DataPatternArg('gaze-estimation-adas')}), TestCase(options={ '-m': ModelArg('gaze-estimation-adas-0002'), - '-m_fd': ModelArg('face-detection-adas-0001'), '-m_hp': ModelArg('head-pose-estimation-adas-0001'), '-m_lm': ModelArg('facial-landmarks-35-adas-0002'), '-m_es': ModelArg('open-closed-eye-0001'), }), + single_option_cases( + '-m_fd', + ModelArg('face-detection-adas-0001'), + ModelArg('face-detection-retail-0004')), )), CppDemo(name='gaze_estimation_demo', implementation='cpp_gapi', @@ -152,13 +194,44 @@ def single_option_cases(key, *args): '-i': DataPatternArg('gaze-estimation-adas')}), TestCase(options={ '-m': ModelArg('gaze-estimation-adas-0002'), - '-m_fd': ModelArg('face-detection-adas-0001'), '-m_hp': ModelArg('head-pose-estimation-adas-0001'), '-m_lm': ModelArg('facial-landmarks-35-adas-0002'), '-m_es': ModelArg('open-closed-eye-0001'), }), + single_option_cases( + '-m_fd', + ModelArg('face-detection-adas-0001'), + ModelArg('face-detection-retail-0004')), + )), + + CppDemo(name='gesture_recognition_demo', implementation='cpp_gapi', + model_keys=['-m_a', '-m_d'], + device_keys=['-d_a', '-d_d'], + test_cases=combine_cases( + TestCase(options={'--no_show': None, + '-i': TestDataArg('msasl/global_crops/_nz_sivss20/clip_0017/img_%05d.jpg'), + '-m_d': ModelArg('person-detection-asl-0001')}), + [ + TestCase(options={'-m_a': ModelArg('asl-recognition-0004'), '-c': str(OMZ_DIR / 'data/dataset_classes/msasl100.json')}), + TestCase(options={'-m_a': ModelArg('common-sign-language-0001'), + '-c': str(OMZ_DIR / 'data/dataset_classes/jester27.json')}), + TestCase(options={'-m_a': ModelArg('common-sign-language-0002'), + '-c': str(OMZ_DIR / 'data/dataset_classes/common_sign_language12.json')}), + ], )), + CppDemo(name='face_detection_mtcnn_demo', implementation='cpp_gapi', + model_keys=['-m_p', '-m_r', '-m_o'], + device_keys=['-d_p', '-d_r', '-d_o'], + test_cases=combine_cases( + TestCase(options={'--no_show': None, + '-i': image_net_arg('00000002'), + '-m_p': ModelArg('mtcnn-p'), + '-m_r': ModelArg('mtcnn-r'), + '-m_o': ModelArg('mtcnn-o')}), + )), + + CppDemo(name='human_pose_estimation_demo', device_keys=['-d'], test_cases=combine_cases( TestCase(options={'-no_show': None, **MONITORS, @@ -195,6 +268,9 @@ def single_option_cases(key, *args): TestCase(options={'-at': 'deblur', '-m': ModelArg('deblurgan-v2')} ), + TestCase(options={'-at': 'jr', + '-m': ModelArg('fbcnn')} + ) ] )), @@ -205,13 +281,16 @@ def single_option_cases(key, *args): TestCase(options={'-no_show': None, **MONITORS, '-i': DataPatternArg('375x500')}), - TestCase(options={'-m': ModelArg('face-detection-adas-0001')}), [ - TestCase(options={}), - TestCase(options={'-m_ag': ModelArg('age-gender-recognition-retail-0013')}), - TestCase(options={'-m_em': ModelArg('emotions-recognition-retail-0003')}), - TestCase(options={'-m_lm': ModelArg('facial-landmarks-35-adas-0002')}), - TestCase(options={'-m_hp': ModelArg('head-pose-estimation-adas-0001')}), + *combine_cases( + [ + TestCase(options={}), + TestCase(options={'-m_ag': ModelArg('age-gender-recognition-retail-0013')}), + TestCase(options={'-m_em': ModelArg('emotions-recognition-retail-0003')}), + TestCase(options={'-m_lm': ModelArg('facial-landmarks-35-adas-0002')}), + TestCase(options={'-m_hp': ModelArg('head-pose-estimation-adas-0001')}), + ], + ), TestCase(options={ '-m_ag': ModelArg('age-gender-recognition-retail-0013'), '-m_em': ModelArg('emotions-recognition-retail-0003'), @@ -219,6 +298,11 @@ def single_option_cases(key, *args): '-m_lm': ModelArg('facial-landmarks-35-adas-0002'), }) ], + single_option_cases( + '-m', + ModelArg('face-detection-adas-0001'), + ModelArg('face-detection-retail-0004'), + ), )), CppDemo(name='interactive_face_detection_demo', implementation='cpp_gapi', @@ -228,13 +312,16 @@ def single_option_cases(key, *args): TestCase(options={'-no_show': None, **MONITORS, '-i': DataPatternArg('375x500')}), - TestCase(options={'-m': ModelArg('face-detection-adas-0001')}), [ - TestCase(options={}), - TestCase(options={'-m_ag': ModelArg('age-gender-recognition-retail-0013')}), - TestCase(options={'-m_em': ModelArg('emotions-recognition-retail-0003')}), - TestCase(options={'-m_lm': ModelArg('facial-landmarks-35-adas-0002')}), - TestCase(options={'-m_hp': ModelArg('head-pose-estimation-adas-0001')}), + *combine_cases( + [ + TestCase(options={}), + TestCase(options={'-m_ag': ModelArg('age-gender-recognition-retail-0013')}), + TestCase(options={'-m_em': ModelArg('emotions-recognition-retail-0003')}), + TestCase(options={'-m_lm': ModelArg('facial-landmarks-35-adas-0002')}), + TestCase(options={'-m_hp': ModelArg('head-pose-estimation-adas-0001')}), + ], + ), TestCase(options={ '-m_ag': ModelArg('age-gender-recognition-retail-0013'), '-m_em': ModelArg('emotions-recognition-retail-0003'), @@ -242,6 +329,11 @@ def single_option_cases(key, *args): '-m_lm': ModelArg('facial-landmarks-35-adas-0002'), }) ], + single_option_cases( + '-m', + ModelArg('face-detection-adas-0001'), + ModelArg('face-detection-retail-0004'), + ), )), CppDemo(name='mask_rcnn_demo', device_keys=['-d'], test_cases=combine_cases( @@ -332,6 +424,11 @@ def single_option_cases(key, *args): *single_option_cases('-m', ModelArg('efficientdet-d0-tf'), ModelArg('efficientdet-d1-tf'), + ModelArg('face-detection-0200'), + ModelArg('face-detection-0202'), + ModelArg('face-detection-0204'), + ModelArg('face-detection-0205'), + ModelArg('face-detection-0206'), ModelArg('face-detection-adas-0001'), ModelArg('face-detection-retail-0004'), ModelArg('face-detection-retail-0005'), @@ -347,8 +444,8 @@ def single_option_cases(key, *args): ModelArg('person-vehicle-bike-detection-2000'), ModelArg('person-vehicle-bike-detection-2001'), ModelArg('person-vehicle-bike-detection-2002'), - #ModelArg('person-vehicle-bike-detection-2003'), - #ModelArg('person-vehicle-bike-detection-2004'), + ModelArg('person-vehicle-bike-detection-2003'), + ModelArg('person-vehicle-bike-detection-2004'), ModelArg('product-detection-0001'), ModelArg('rfcn-resnet101-coco-tf'), ModelArg('retinanet-tf'), @@ -393,48 +490,29 @@ def single_option_cases(key, *args): ], )), - CppDemo('pedestrian_tracker_demo', model_keys=['-m_det', '-m_reid'], device_keys=['-d_det', '-d_reid'], + CppDemo(name='pedestrian_tracker_demo', + model_keys=['-m_det', '-m_reid'], + device_keys=['-d_det', '-d_reid'], test_cases=combine_cases( TestCase(options={'-no_show': None, **MONITORS, '-i': DataPatternArg('person-detection-retail')}), - *combine_cases( - TestCase(options={'-at': 'ssd'}), - single_option_cases('-m_det', - ModelArg('person-detection-retail-0002'), - ModelArg('person-detection-retail-0013'))), - single_option_cases('-m_reid', - ModelArg('person-reidentification-retail-0277'), - ModelArg('person-reidentification-retail-0286'), - ModelArg('person-reidentification-retail-0287'), - ModelArg('person-reidentification-retail-0288')), - *combine_cases( - TestCase(options={'-at': 'yolo', '-person_label': '0'}), - single_option_cases('-m_det', - ModelArg('yolo-v3-tf'))), - single_option_cases('-m_reid', - ModelArg('person-reidentification-retail-0277'), - ModelArg('person-reidentification-retail-0286'), - ModelArg('person-reidentification-retail-0287'), - ModelArg('person-reidentification-retail-0288')), - *combine_cases( - TestCase(options={'-at': 'ssd', '-person_label': '1'}), - single_option_cases('-m_det', - ModelArg('retinanet-tf'))), - single_option_cases('-m_reid', - ModelArg('person-reidentification-retail-0277'), - ModelArg('person-reidentification-retail-0286'), - ModelArg('person-reidentification-retail-0287'), - ModelArg('person-reidentification-retail-0288')), - *combine_cases( - TestCase(options={'-at': 'centernet', '-person_label': '0'}), - single_option_cases('-m_det', - ModelArg('ctdet_coco_dlav0_512'))), - single_option_cases('-m_reid', - ModelArg('person-reidentification-retail-0277'), - ModelArg('person-reidentification-retail-0286'), - ModelArg('person-reidentification-retail-0287'), - ModelArg('person-reidentification-retail-0288')), + [ + *combine_cases( + TestCase(options={'-at': 'ssd'}), + single_option_cases('-m_det', + ModelArg('person-detection-retail-0002'), + ModelArg('person-detection-retail-0013')), + ), + TestCase(options={'-person_label': '0', '-at': 'yolo', '-m_det': ModelArg('yolo-v3-tf')}), + TestCase(options={'-person_label': '0', '-at': 'centernet', '-m_det': ModelArg('ctdet_coco_dlav0_512')}), + TestCase(options={'-person_label': '1', '-at': 'ssd', '-m_det': ModelArg('retinanet-tf')}), + ], + single_option_cases('-m_reid', + ModelArg('person-reidentification-retail-0277'), + ModelArg('person-reidentification-retail-0286'), + ModelArg('person-reidentification-retail-0287'), + ModelArg('person-reidentification-retail-0288')), )), CppDemo(name='security_barrier_camera_demo', @@ -508,8 +586,8 @@ def single_option_cases(key, *args): )), CppDemo(name='smart_classroom_demo', implementation='cpp_gapi', - device_keys=['-d_act', '-d_fd', '-d_lm', '-d_reid'], model_keys=['-m_act', '-m_fd', '-m_lm', '-m_reid'], + device_keys=['-d_act', '-d_fd', '-d_lm', '-d_reid'], test_cases=combine_cases( TestCase(options={'-no_show': None, **MONITORS, @@ -572,7 +650,7 @@ def single_option_cases(key, *args): *combine_cases( TestCase(options={'-dt': 'ctc'}), [ -# *single_option_cases('-m_tr', None, ModelArg('text-recognition-0012')), + *single_option_cases('-m_tr', None, ModelArg('text-recognition-0012')), TestCase(options={'-m_tr': ModelArg('text-recognition-0014'), '-tr_pt_first': None, '-tr_o_blb_nm': 'logits'}), @@ -585,6 +663,11 @@ def single_option_cases(key, *args): '-tr_o_blb_nm': 'logits', '-m_tr_ss': '?0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}, extra_models=[ModelArg('text-recognition-0015-decoder')]), + # TestCase(options={'-m_tr': ModelArg('text-recognition-0016-encoder'), #TODO + # '-tr_pt_first': None, #TODO + # '-tr_o_blb_nm': 'logits', #TODO + # '-m_tr_ss': '?0123456789abcdefghijklmnopqrstuvwxyz'}, #TODO + # extra_models=[ModelArg('text-recognition-0016-decoder')]), #TODO TestCase(options={'-m_tr': ModelArg('text-recognition-resnet-fc'), '-tr_pt_first': None}), TestCase(options={'-m_tr': ModelArg('vitstr-small-patch16-224'), @@ -644,7 +727,7 @@ def single_option_cases(key, *args): '--vocab': str(OMZ_DIR / 'models/intel/bert-small-uncased-whole-word-masking-squad-0002/vocab.txt'), }), TestCase(options={ - '-m': ModelArg('bert-small-uncased-whole-word-masking-squad-int8-0002', precision='FP32-INT8'), + '-m': ModelArg('bert-small-uncased-whole-word-masking-squad-int8-0002'), '--input_names': 'input_ids,attention_mask,token_type_ids,position_ids', '--output_names': 'output_s,output_e', '--vocab': @@ -657,7 +740,7 @@ def single_option_cases(key, *args): '--vocab': str(OMZ_DIR / 'models/intel/bert-large-uncased-whole-word-masking-squad-0001/vocab.txt'), }), TestCase(options={ - '-m': ModelArg('bert-large-uncased-whole-word-masking-squad-int8-0001', precision='FP32-INT8'), + '-m': ModelArg('bert-large-uncased-whole-word-masking-squad-int8-0001'), '--input_names': 'input_ids,attention_mask,token_type_ids', '--output_names': 'output_s,output_e', '--vocab': @@ -685,7 +768,7 @@ def single_option_cases(key, *args): '--vocab': str(OMZ_DIR / 'models/intel/bert-large-uncased-whole-word-masking-squad-emb-0001/vocab.txt'), }), TestCase(options={ - '-m_emb': ModelArg('bert-small-uncased-whole-word-masking-squad-emb-int8-0001', precision='FP32-INT8'), + '-m_emb': ModelArg('bert-small-uncased-whole-word-masking-squad-emb-int8-0001'), '--input_names_emb': 'input_ids,attention_mask,token_type_ids,position_ids', '--vocab': str(OMZ_DIR / 'models/intel/bert-small-uncased-whole-word-masking-squad-emb-int8-0001/vocab.txt'), @@ -738,11 +821,12 @@ def single_option_cases(key, *args): ModelArg('face-detection-retail-0004'), ModelArg('face-detection-retail-0005'), ModelArg('face-detection-retail-0044')), - TestCase(options={'-m_lm': ModelArg('landmarks-regression-retail-0009')}), - TestCase(options={'-m_reid': ModelArg('Sphereface')}), - TestCase(options={'-m_reid': ModelArg('face-reidentification-retail-0095')}), - TestCase(options={'-m_reid': ModelArg('face-recognition-resnet100-arcface-onnx')}), - TestCase(options={'-m_reid': ModelArg('facenet-20180408-102900')}), + single_option_cases('-m_lm', ModelArg('landmarks-regression-retail-0009')), + single_option_cases('-m_reid', + ModelArg('Sphereface'), + ModelArg('face-reidentification-retail-0095'), + ModelArg('face-recognition-resnet100-arcface-onnx'), + ModelArg('facenet-20180408-102900')), )), PythonDemo(name='formula_recognition_demo', device_keys=['-d'], @@ -882,7 +966,8 @@ def single_option_cases(key, *args): )), PythonDemo(name='monodepth_demo', device_keys=['-d'], test_cases=combine_cases( - TestCase(options={'-i': image_net_arg('00000002'), + TestCase(options={'--no_show': None, **MONITORS, + '-i': DataPatternArg('object-detection-demo'), '-m': ModelArg('midasnet')}) )), @@ -1036,6 +1121,8 @@ def single_option_cases(key, *args): ModelArg('yolo-v3-tf'), ModelArg('yolo-v3-tiny-tf')), ), + TestCase(options={'-at': 'yolov3-onnx', '-m': ModelArg('yolo-v3-onnx')}), + TestCase(options={'-at': 'yolov3-onnx', '-m': ModelArg('yolo-v3-tiny-onnx')}), TestCase(options={'-at': 'yolov4', '-m': ModelArg('yolo-v4-tf')}), TestCase(options={'-at': 'yolov4', '-m': ModelArg('yolo-v4-tiny-tf')}), TestCase(options={'-at': 'yolof', '-m': ModelArg('yolof')}), diff --git a/demos/tests/run_tests.py b/demos/tests/run_tests.py index 2c238dbf1f8..19bd65bb72a 100755 --- a/demos/tests/run_tests.py +++ b/demos/tests/run_tests.py @@ -65,6 +65,10 @@ def parse_args(): help='path to report file') parser.add_argument('--suppressed-devices', type=Path, required=False, help='path to file with suppressed devices for each model') + parser.add_argument('--precisions', type=str, nargs='+', default=['FP16'], + help='IR precisions for all models. By default, models are tested in FP16 precision') + parser.add_argument('--models-dir', type=Path, required=False, metavar='DIR', + help='directory with pre-converted models (IRs)') return parser.parse_args() @@ -84,9 +88,9 @@ def temp_dir_as_path(): yield Path(temp_dir) -def prepare_models(auto_tools_dir, downloader_cache_dir, mo_path, global_temp_dir, demos_to_test): +def prepare_models(auto_tools_dir, downloader_cache_dir, mo_path, global_temp_dir, demos_to_test, model_precisions): model_names = set() - model_precisions = set() + model_precisions = set(model_precisions) for demo in demos_to_test: for case in demo.test_cases: @@ -94,10 +98,6 @@ def prepare_models(auto_tools_dir, downloader_cache_dir, mo_path, global_temp_di if isinstance(arg, Arg): for model_request in arg.required_models: model_names.add(model_request.name) - model_precisions.update(model_request.precisions) - - if not model_precisions: - model_precisions.add('FP32') dl_dir = global_temp_dir / 'models' complete_models_lst_path = global_temp_dir / 'models.lst' @@ -184,7 +184,11 @@ def main(): demos_to_test = DEMOS with temp_dir_as_path() as global_temp_dir: - dl_dir = prepare_models(auto_tools_dir, args.downloader_cache_dir, args.mo, global_temp_dir, demos_to_test) + if args.models_dir: + dl_dir = args.models_dir + print(f"\nRunning on pre-converted IRs: {str(dl_dir)}\n") + else: + dl_dir = prepare_models(auto_tools_dir, args.downloader_cache_dir, args.mo, global_temp_dir, demos_to_test, args.precisions) num_failures = 0 @@ -197,6 +201,7 @@ def main(): for demo in demos_to_test: print('Testing {}...'.format(demo.subdirectory)) print() + demo.set_precisions(args.precisions, model_info) declared_model_names = {model['name'] for model in json.loads(subprocess.check_output( diff --git a/demos/text_detection_demo/cpp/README.md b/demos/text_detection_demo/cpp/README.md index 351e6a30ffc..05405e6c7a2 100644 --- a/demos/text_detection_demo/cpp/README.md +++ b/demos/text_detection_demo/cpp/README.md @@ -10,6 +10,7 @@ The demo shows an example of using neural networks to detect and recognize print * `text-recognition-0012`, which is a recognition network for recognizing text. * `text-recognition-0014`, which is a recognition network for recognizing text. You should add option `-tr_pt_first` and specify output layer name via `-tr_o_blb_nm` option for this model (see model [description](../../../models/intel/text-recognition-0014/README.md) for details). * `text-recognition-0015`, which is a recognition network for recognizing text. You should add options `-tr_pt_first`, `-m_tr_ss "?0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"` (supported symbols set), `-tr_o_blb_nm "logits"` (to specify output name) and `-dt simple` (to specify decoder type). You can also specify `-lower` option to convert predicted text to lower-case. See model [description](../../../models/intel/text-recognition-0015/README.md) for details. +* `text-recognition-0016`, which is a recognition network for recognizing text. You should add options `-tr_pt_first`, `-m_tr_ss "?0123456789abcdefghijklmnopqrstuvwxyz"` (supported symbols set), `-tr_o_blb_nm "logits"` (to specify output name) and `-dt simple` (to specify decoder type). You can also specify `-lower` option to convert predicted text to lower-case. See model [description](../../../models/intel/text-recognition-0016/README.md) for details. * `text-recognition-resnet-fc`, which is a recognition network for recognizing text. You should add option `-tr_pt_first`. * `handwritten-score-recognition-0001`, which is a recognition network for recognizing handwritten score marks like `` or `.`. * `vitstr-small-patch16-224`, which is a recognition network for recognizing text. You should add options `-tr_pt_first`, `-m_tr_ss /.vocab.txt` (supported symbols set), `-dt simple` (to specify decoder type), `-start_index 1` (to process output from provided index) and `-pad " "` (to use specific pad symbol). @@ -20,7 +21,7 @@ On startup, the application reads command line parameters and loads one network If text recognition model is provided, the demo prints recognized text as well. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run @@ -52,6 +53,7 @@ omz_converter --list models.lst * text-recognition-0014 * decoder_type = simple * text-recognition-0015 + * text-recognition-0016 * text-recognition-resnet-fc * vitstr-small-patch16-224 @@ -118,7 +120,7 @@ For example, use the following command line command to run the application: -tr_o_blb_nm "logits" ``` -For `text-recognition-resnet-fc` and `text-recognition-0015` you should use `simple` decoder for `-dt` option. For other models use `ctc` decoder (default decoder). In case of `text-recognition-0015` model, specify path to `text-recognition-0015-encoder` models for `-m_tr` key and decoder part (`text-recognition-0015-decoder`) will be found automatically as shown on example below: +For `text-recognition-resnet-fc`, `text-recgonition-0015` and `text-recognition-0016` you should use `simple` decoder for `-dt` option. For the rest models use `ctc` decoder (default decoder). In case of `text-recognition-0015` and `text-recognition-0016` models, specify path to `text-recognition-0015-encoder` (`text-recognition-0016-encoder`) models for `-m_tr` key and decoder part (`text-recognition-0015-decoder` and `text-recognition-0015-encoder`, correspondingly) will be found automatically as shown on example below: ```sh ./text_detection_demo \ diff --git a/demos/text_spotting_demo/python/README.md b/demos/text_spotting_demo/python/README.md index 7328a92e70c..4dfec0e24dd 100644 --- a/demos/text_spotting_demo/python/README.md +++ b/demos/text_spotting_demo/python/README.md @@ -37,7 +37,7 @@ The demo workflow is the following: * By default, tracking is used to show text instance with the same color throughout the whole video. It assumes more or less static scene with instances in two frames being a part of the same track if intersection over union of the masks is greater than the 0.5 threshold. To disable tracking, specify the `--no_track` argument. -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/thirdparty/gflags b/demos/thirdparty/gflags new file mode 160000 index 00000000000..e171aa2d15e --- /dev/null +++ b/demos/thirdparty/gflags @@ -0,0 +1 @@ +Subproject commit e171aa2d15ed9eb17054558e0b3a6a413bb01067 diff --git a/demos/thirdparty/gflags/.gitattributes b/demos/thirdparty/gflags/.gitattributes deleted file mode 100644 index 87fe9c027ec..00000000000 --- a/demos/thirdparty/gflags/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# treat all files in this repository as text files -# and normalize them to LF line endings when committed -* text diff --git a/demos/thirdparty/gflags/.gitignore b/demos/thirdparty/gflags/.gitignore deleted file mode 100644 index 706f7f88f0d..00000000000 --- a/demos/thirdparty/gflags/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/xcode/ -/build/ -/builds/ -/build-*/ -/_build/ -.DS_Store -CMakeCache.txt -DartConfiguration.tcl -Makefile -CMakeFiles/ -/Testing/ -/include/gflags/config.h -/include/gflags/gflags_completions.h -/include/gflags/gflags_declare.h -/include/gflags/gflags.h -/lib/ -/test/gflags_unittest_main.cc -/test/gflags_unittest-main.cc -/packages/ -CMakeLists.txt.user -/bazel-bin -/bazel-genfiles -/bazel-gflags -/bazel-out -/bazel-testlogs diff --git a/demos/thirdparty/gflags/.gitmodules b/demos/thirdparty/gflags/.gitmodules deleted file mode 100644 index aa2072c575f..00000000000 --- a/demos/thirdparty/gflags/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "doc"] - path = doc - url = https://github.com/gflags/gflags.git - branch = gh-pages diff --git a/demos/thirdparty/gflags/.travis.yml b/demos/thirdparty/gflags/.travis.yml deleted file mode 100644 index 0989c7c852c..00000000000 --- a/demos/thirdparty/gflags/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -# Ubuntu 14.04 Trusty support, to get newer cmake and compilers. -sudo: required -dist: trusty - -language: cpp - -os: - - linux - - osx - -compiler: - - clang - - gcc - -env: - - CONFIG=Release - - CONFIG=Debug - -script: - - mkdir out && cd out && cmake -D CMAKE_BUILD_TYPE=$CONFIG -D GFLAGS_BUILD_SHARED_LIBS=ON -D GFLAGS_BUILD_STATIC_LIBS=ON -D GFLAGS_BUILD_TESTING=ON .. && cmake --build . --config $CONFIG && ctest diff --git a/demos/thirdparty/gflags/AUTHORS.txt b/demos/thirdparty/gflags/AUTHORS.txt deleted file mode 100644 index 887918bd00e..00000000000 --- a/demos/thirdparty/gflags/AUTHORS.txt +++ /dev/null @@ -1,2 +0,0 @@ -google-gflags@googlegroups.com - diff --git a/demos/thirdparty/gflags/BUILD b/demos/thirdparty/gflags/BUILD deleted file mode 100644 index 0e7ccdd6df1..00000000000 --- a/demos/thirdparty/gflags/BUILD +++ /dev/null @@ -1,18 +0,0 @@ -# Bazel (http://bazel.io/) BUILD file for gflags. -# -# See INSTALL.md for instructions for adding gflags to a Bazel workspace. - -licenses(["notice"]) - -exports_files(["src/gflags_completions.sh", "COPYING.txt"]) - -config_setting( - name = "x64_windows", - values = {"cpu": "x64_windows"}, -) - -load(":bazel/gflags.bzl", "gflags_sources", "gflags_library") - -(hdrs, srcs) = gflags_sources(namespace=["gflags", "google"]) -gflags_library(hdrs=hdrs, srcs=srcs, threads=0) -gflags_library(hdrs=hdrs, srcs=srcs, threads=1) diff --git a/demos/thirdparty/gflags/CMakeLists.txt b/demos/thirdparty/gflags/CMakeLists.txt deleted file mode 100644 index 657a1f4d413..00000000000 --- a/demos/thirdparty/gflags/CMakeLists.txt +++ /dev/null @@ -1,741 +0,0 @@ -## CMake configuration file of gflags project -## -## This CMakeLists.txt defines some gflags specific configuration variables -## using the "gflags_define" utility macro. The default values of these variables -## can be overridden either on the CMake command-line using the -D option of -## the cmake command or in a super-project which includes the gflags source -## tree by setting the GFLAGS_ CMake variables before adding the -## gflags source directory via CMake's "add_subdirectory" command. Only when -## the non-cached variable GFLAGS_IS_SUBPROJECT has a value equivalent to FALSE, -## these configuration variables are added to the CMake cache so they can be -## edited in the CMake GUI. By default, GFLAGS_IS_SUBPROJECT is set to TRUE when -## the CMAKE_SOURCE_DIR is not identical to the directory of this CMakeLists.txt -## file, i.e., the top-level directory of the gflags project source tree. -## -## When this project is a subproject (GFLAGS_IS_SUBPROJECT is TRUE), the default -## settings are such that only the static single-threaded library is built without -## installation of the gflags files. The "gflags::gflags" target is in this case an ALIAS -## library target for the "gflags_nothreads_static" library target. Targets which -## depend on the gflags library should link to the "gflags::gflags" library target. -## -## Example CMakeLists.txt of user project which requires separate gflags installation: -## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -## -## project(Foo) -## -## find_package(gflags REQUIRED) -## -## add_executable(foo src/foo.cc) -## target_link_libraries(foo gflags::gflags) -## -## Example CMakeLists.txt of user project which requires separate single-threaded static gflags installation: -## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -## -## project(Foo) -## -## find_package(gflags COMPONENTS nothreads_static) -## -## add_executable(foo src/foo.cc) -## target_link_libraries(foo gflags::gflags) -## -## Example CMakeLists.txt of super-project which contains gflags source tree: -## cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -## -## project(Foo) -## -## add_subdirectory(gflags) -## -## add_executable(foo src/foo.cc) -## target_link_libraries(foo gflags::gflags) -## -## Variables to configure the source files: -## - GFLAGS_IS_A_DLL -## - GFLAGS_NAMESPACE -## - GFLAGS_ATTRIBUTE_UNUSED -## - GFLAGS_INTTYPES_FORMAT -## -## Variables to configure the build: -## - GFLAGS_SOVERSION -## - GFLAGS_BUILD_SHARED_LIBS -## - GFLAGS_BUILD_STATIC_LIBS -## - GFLAGS_BUILD_gflags_LIB -## - GFLAGS_BUILD_gflags_nothreads_LIB -## - GFLAGS_BUILD_TESTING -## - GFLAGS_BUILD_PACKAGING -## -## Variables to configure the installation: -## - GFLAGS_INCLUDE_DIR -## - GFLAGS_LIBRARY_INSTALL_DIR or LIB_INSTALL_DIR or LIB_SUFFIX -## - GFLAGS_INSTALL_HEADERS -## - GFLAGS_INSTALL_SHARED_LIBS -## - GFLAGS_INSTALL_STATIC_LIBS - -cmake_minimum_required (VERSION 3.0.2 FATAL_ERROR) - -if (POLICY CMP0042) - cmake_policy (SET CMP0042 NEW) -endif () - -if (POLICY CMP0048) - cmake_policy (SET CMP0048 NEW) -endif () - -# ---------------------------------------------------------------------------- -# includes -include ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake") - -# ---------------------------------------------------------------------------- -# package information -set (PACKAGE_NAME "gflags") -set (PACKAGE_VERSION "2.2.2") -set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") -set (PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") -set (PACKAGE_BUGREPORT "https://github.com/gflags/gflags/issues") -set (PACKAGE_DESCRIPTION "A commandline flags library that allows for distributed flags.") -set (PACKAGE_URL "http://gflags.github.io/gflags") - -project (${PACKAGE_NAME} VERSION ${PACKAGE_VERSION} LANGUAGES CXX) -if (CMAKE_VERSION VERSION_LESS 3.4) - # C language still needed because the following required CMake modules - # (or their dependencies, respectively) are not correctly handling - # the case where only CXX is enabled - # - CheckTypeSize.cmake (fixed in CMake 3.1, cf. https://cmake.org/Bug/view.php?id=14056) - # - FindThreads.cmake (fixed in CMake 3.4, cf. https://cmake.org/Bug/view.php?id=14905) - enable_language (C) -endif () - -version_numbers ( - ${PACKAGE_VERSION} - PACKAGE_VERSION_MAJOR - PACKAGE_VERSION_MINOR - PACKAGE_VERSION_PATCH -) - -# shared library ABI version number, can be overridden by package maintainers -# using -DGFLAGS_SOVERSION=XXX on the command-line -if (GFLAGS_SOVERSION) - set (PACKAGE_SOVERSION "${GFLAGS_SOVERSION}") -else () - # TODO: Change default SOVERSION back to PACKAGE_VERSION_MAJOR with the - # next increase of major version number (i.e., 3.0.0 -> SOVERSION 3) - # The . SOVERSION should be used for the 2.x releases - # versions only which temporarily broke the API by changing the default - # namespace from "google" to "gflags". - set (PACKAGE_SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}") -endif () - -# when gflags is included as subproject (e.g., as Git submodule/subtree) in the source -# tree of a project that uses it, no variables should be added to the CMake cache; -# users may set the non-cached variable GFLAGS_IS_SUBPROJECT before add_subdirectory(gflags) -if (NOT DEFINED GFLAGS_IS_SUBPROJECT) - if ("^${CMAKE_SOURCE_DIR}$" STREQUAL "^${PROJECT_SOURCE_DIR}$") - set (GFLAGS_IS_SUBPROJECT FALSE) - else () - set (GFLAGS_IS_SUBPROJECT TRUE) - endif () -endif () - -# prefix for package variables in CMake configuration file -string (TOUPPER "${PACKAGE_NAME}" PACKAGE_PREFIX) - -# convert file path on Windows with back slashes to path with forward slashes -# otherwise this causes an issue with the cmake_install.cmake script -file (TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX) - -# ---------------------------------------------------------------------------- -# options - -# maintain binary backwards compatibility with gflags library version <= 2.0, -# but at the same time enable the use of the preferred new "gflags" namespace -gflags_define (STRING NAMESPACE "Name(s) of library namespace (separate multiple options by semicolon)" "google;${PACKAGE_NAME}" "${PACKAGE_NAME}") -gflags_property (NAMESPACE ADVANCED TRUE) -set (GFLAGS_NAMESPACE_SECONDARY "${NAMESPACE}") -list (REMOVE_DUPLICATES GFLAGS_NAMESPACE_SECONDARY) -if (NOT GFLAGS_NAMESPACE_SECONDARY) - message (FATAL_ERROR "GFLAGS_NAMESPACE must be set to one (or more) valid C++ namespace identifier(s separated by semicolon \";\").") -endif () -foreach (ns IN LISTS GFLAGS_NAMESPACE_SECONDARY) - if (NOT ns MATCHES "^[a-zA-Z][a-zA-Z0-9_]*$") - message (FATAL_ERROR "GFLAGS_NAMESPACE contains invalid namespace identifier: ${ns}") - endif () -endforeach () -list (GET GFLAGS_NAMESPACE_SECONDARY 0 GFLAGS_NAMESPACE) -list (REMOVE_AT GFLAGS_NAMESPACE_SECONDARY 0) - -# cached build options when gflags is not a subproject, otherwise non-cached CMake variables -# usage: gflags_define(BOOL []) -gflags_define (BOOL BUILD_SHARED_LIBS "Request build of shared libraries." OFF OFF) -gflags_define (BOOL BUILD_STATIC_LIBS "Request build of static libraries (default if BUILD_SHARED_LIBS is OFF)." OFF ON) -gflags_define (BOOL BUILD_gflags_LIB "Request build of the multi-threaded gflags library." ON OFF) -gflags_define (BOOL BUILD_gflags_nothreads_LIB "Request build of the single-threaded gflags library." ON ON) -gflags_define (BOOL BUILD_PACKAGING "Enable build of distribution packages using CPack." OFF OFF) -gflags_define (BOOL BUILD_TESTING "Enable build of the unit tests and their execution using CTest." OFF OFF) -gflags_define (BOOL INSTALL_HEADERS "Request installation of headers and other development files." ON OFF) -gflags_define (BOOL INSTALL_SHARED_LIBS "Request installation of shared libraries." ON ON) -gflags_define (BOOL INSTALL_STATIC_LIBS "Request installation of static libraries." ON OFF) -gflags_define (BOOL REGISTER_BUILD_DIR "Request entry of build directory in CMake's package registry." OFF OFF) -gflags_define (BOOL REGISTER_INSTALL_PREFIX "Request entry of installed package in CMake's package registry." ON OFF) - -gflags_property (BUILD_STATIC_LIBS ADVANCED TRUE) -gflags_property (INSTALL_HEADERS ADVANCED TRUE) -gflags_property (INSTALL_SHARED_LIBS ADVANCED TRUE) -gflags_property (INSTALL_STATIC_LIBS ADVANCED TRUE) - -if (NOT GFLAGS_IS_SUBPROJECT) - foreach (varname IN ITEMS CMAKE_INSTALL_PREFIX) - gflags_property (${varname} ADVANCED FALSE) - endforeach () - foreach (varname IN ITEMS CMAKE_CONFIGURATION_TYPES CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT) - gflags_property (${varname} ADVANCED TRUE) - endforeach () - if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) - gflags_set (CMAKE_BUILD_TYPE Release) - endif () - if (CMAKE_CONFIGURATION_TYPES) - gflags_property (CMAKE_BUILD_TYPE STRINGS "${CMAKE_CONFIGURATION_TYPES}") - endif () -endif () # NOT GFLAGS_IS_SUBPROJECT - -if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) - set (BUILD_STATIC_LIBS ON) -endif () -if (NOT BUILD_gflags_LIB AND NOT BUILD_gflags_nothreads_LIB) - message (FATAL_ERROR "At least one of [GFLAGS_]BUILD_gflags_LIB and [GFLAGS_]BUILD_gflags_nothreads_LIB must be ON.") -endif () - -gflags_define (STRING INCLUDE_DIR "Name of include directory of installed header files relative to CMAKE_INSTALL_PREFIX/include/" "${PACKAGE_NAME}") -gflags_property (INCLUDE_DIR ADVANCED TRUE) -file (TO_CMAKE_PATH "${INCLUDE_DIR}" INCLUDE_DIR) -if (IS_ABSOLUTE INCLUDE_DIR) - message (FATAL_ERROR "[GFLAGS_]INCLUDE_DIR must be a path relative to CMAKE_INSTALL_PREFIX/include/") -endif () -if (INCLUDE_DIR MATCHES "^\\.\\.[/\\]") - message (FATAL_ERROR "[GFLAGS_]INCLUDE_DIR must not start with parent directory reference (../)") -endif () -set (GFLAGS_INCLUDE_DIR "${INCLUDE_DIR}") - -# ---------------------------------------------------------------------------- -# system checks -include (CheckTypeSize) -include (CheckIncludeFileCXX) -include (CheckCXXSymbolExists) - -if (WIN32 AND NOT CYGWIN) - set (OS_WINDOWS 1) -else () - set (OS_WINDOWS 0) -endif () - -if (MSVC) - set (HAVE_SYS_TYPES_H 1) - set (HAVE_STDDEF_H 1) # used by CheckTypeSize module - set (HAVE_UNISTD_H 0) - set (HAVE_SYS_STAT_H 1) - set (HAVE_SHLWAPI_H 1) - if (MSVC_VERSION VERSION_LESS 1600) - check_include_file_cxx ("stdint.h" HAVE_STDINT_H) - bool_to_int (HAVE_STDINT_H) # used in #if directive - else () - set (HAVE_STDINT_H 1) - endif () - if (MSVC_VERSION VERSION_LESS 1800) - check_include_file_cxx ("inttypes.h" HAVE_INTTYPES_H) - bool_to_int (HAVE_INTTYPES_H) # used in #if directive - else () - set (HAVE_INTTYPES_H 1) - endif () -else () - foreach (fname IN ITEMS unistd stdint inttypes sys/types sys/stat fnmatch) - string (TOUPPER "${fname}" FNAME) - string (REPLACE "/" "_" FNAME "${FNAME}") - if (NOT HAVE_${FNAME}_H) - check_include_file_cxx ("${fname}.h" HAVE_${FNAME}_H) - endif () - endforeach () - if (NOT HAVE_FNMATCH_H AND OS_WINDOWS) - check_include_file_cxx ("shlwapi.h" HAVE_SHLWAPI_H) - endif () - # the following are used in #if directives not #ifdef - bool_to_int (HAVE_STDINT_H) - bool_to_int (HAVE_SYS_TYPES_H) - bool_to_int (HAVE_INTTYPES_H) -endif () - -gflags_define (STRING INTTYPES_FORMAT "Format of integer types: \"C99\" (uint32_t), \"BSD\" (u_int32_t), \"VC7\" (__int32)" "") -gflags_property (INTTYPES_FORMAT STRINGS "C99;BSD;VC7") -gflags_property (INTTYPES_FORMAT ADVANCED TRUE) -if (NOT INTTYPES_FORMAT) - set (TYPES uint32_t u_int32_t) - if (MSVC) - list (INSERT TYPES 0 __int32) - endif () - foreach (type IN LISTS TYPES) - check_type_size (${type} ${type} LANGUAGE CXX) - if (HAVE_${type}) - break () - endif () - endforeach () - if (HAVE_uint32_t) - gflags_set (INTTYPES_FORMAT C99) - elseif (HAVE_u_int32_t) - gflags_set (INTTYPES_FORMAT BSD) - elseif (HAVE___int32) - gflags_set (INTTYPES_FORMAT VC7) - else () - gflags_property (INTTYPES_FORMAT ADVANCED FALSE) - message (FATAL_ERROR "Do not know how to define a 32-bit integer quantity on your system!" - " Neither uint32_t, u_int32_t, nor __int32 seem to be available." - " Set [GFLAGS_]INTTYPES_FORMAT to either C99, BSD, or VC7 and try again.") - endif () -endif () -# use of special characters in strings to circumvent bug #0008226 -if ("^${INTTYPES_FORMAT}$" STREQUAL "^WIN$") - gflags_set (INTTYPES_FORMAT VC7) -endif () -if (NOT INTTYPES_FORMAT MATCHES "^(C99|BSD|VC7)$") - message (FATAL_ERROR "Invalid value for [GFLAGS_]INTTYPES_FORMAT! Choose one of \"C99\", \"BSD\", or \"VC7\"") -endif () -set (GFLAGS_INTTYPES_FORMAT "${INTTYPES_FORMAT}") -set (GFLAGS_INTTYPES_FORMAT_C99 0) -set (GFLAGS_INTTYPES_FORMAT_BSD 0) -set (GFLAGS_INTTYPES_FORMAT_VC7 0) -set ("GFLAGS_INTTYPES_FORMAT_${INTTYPES_FORMAT}" 1) - -if (MSVC) - set (HAVE_strtoll 0) - set (HAVE_strtoq 0) -else () - check_cxx_symbol_exists (strtoll stdlib.h HAVE_STRTOLL) - if (NOT HAVE_STRTOLL) - check_cxx_symbol_exists (strtoq stdlib.h HAVE_STRTOQ) - endif () -endif () - -if (BUILD_gflags_LIB) - set (CMAKE_THREAD_PREFER_PTHREAD TRUE) - find_package (Threads) - if (Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) - set (HAVE_PTHREAD 1) - check_type_size (pthread_rwlock_t RWLOCK LANGUAGE CXX) - else () - set (HAVE_PTHREAD 0) - endif () - if (UNIX AND NOT HAVE_PTHREAD) - if (CMAKE_HAVE_PTHREAD_H) - set (what "library") - else () - set (what ".h file") - endif () - message (FATAL_ERROR "Could not find pthread${what}. Check the log file" - "\n\t${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "\nor disable the build of the multi-threaded gflags library (BUILD_gflags_LIB=OFF).") - endif () -else () - set (HAVE_PTHREAD 0) -endif () - -# ---------------------------------------------------------------------------- -# source files - excluding root subdirectory and/or .in suffix -set (PUBLIC_HDRS - "gflags.h" - "gflags_declare.h" - "gflags_completions.h" -) - -if (GFLAGS_NAMESPACE_SECONDARY) - set (INCLUDE_GFLAGS_NS_H "// Import gflags library symbols into alternative/deprecated namespace(s)") - foreach (ns IN LISTS GFLAGS_NAMESPACE_SECONDARY) - string (TOUPPER "${ns}" NS) - set (gflags_ns_h "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/gflags_${ns}.h") - configure_file ("${PROJECT_SOURCE_DIR}/src/gflags_ns.h.in" "${gflags_ns_h}" @ONLY) - list (APPEND PUBLIC_HDRS "${gflags_ns_h}") - set (INCLUDE_GFLAGS_NS_H "${INCLUDE_GFLAGS_NS_H}\n#include \"gflags_${ns}.h\"") - endforeach () -else () - set (INCLUDE_GFLAGS_NS_H) -endif () - -set (PRIVATE_HDRS - "defines.h" - "config.h" - "util.h" - "mutex.h" -) - -set (GFLAGS_SRCS - "gflags.cc" - "gflags_reporting.cc" - "gflags_completions.cc" -) - -if (OS_WINDOWS) - list (APPEND PRIVATE_HDRS "windows_port.h") - list (APPEND GFLAGS_SRCS "windows_port.cc") -endif () - -# ---------------------------------------------------------------------------- -# configure source files -if (NOT DEFINED GFLAGS_ATTRIBUTE_UNUSED) - if (CMAKE_COMPILER_IS_GNUCXX) - set (GFLAGS_ATTRIBUTE_UNUSED "__attribute((unused))") - else () - set (GFLAGS_ATTRIBUTE_UNUSED) - endif () -endif () - -# whenever we build a shared library (DLL on Windows), configure the public -# headers of the API for use of this shared library rather than the optionally -# also build statically linked library; users can override GFLAGS_DLL_DECL -# in particular, this done by setting the INTERFACE_COMPILE_DEFINITIONS of -# static libraries to include an empty definition for GFLAGS_DLL_DECL -if (NOT DEFINED GFLAGS_IS_A_DLL) - if (BUILD_SHARED_LIBS) - set (GFLAGS_IS_A_DLL 1) - else () - set (GFLAGS_IS_A_DLL 0) - endif () -endif () - -configure_headers (PUBLIC_HDRS ${PUBLIC_HDRS}) -configure_sources (PRIVATE_HDRS ${PRIVATE_HDRS}) -configure_sources (GFLAGS_SRCS ${GFLAGS_SRCS}) - -# ---------------------------------------------------------------------------- -# output directories -if (NOT GFLAGS_IS_SUBPROJECT) - set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin") - set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib") - set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "lib") -endif () -# Set postfixes for generated libraries based on buildtype. -set(CMAKE_RELEASE_POSTFIX "") -set(CMAKE_DEBUG_POSTFIX "_debug") - -# ---------------------------------------------------------------------------- -# installation directories -if (OS_WINDOWS) - set (RUNTIME_INSTALL_DIR "bin") - set (LIBRARY_INSTALL_DIR "lib") - set (INCLUDE_INSTALL_DIR "include") - set (CONFIG_INSTALL_DIR "lib/cmake/${PACKAGE_NAME}") - set (PKGCONFIG_INSTALL_DIR) -else () - set (RUNTIME_INSTALL_DIR bin) - # The LIB_INSTALL_DIR and LIB_SUFFIX variables are used by the Fedora - # package maintainers. Also package maintainers of other distribution - # packages need to be able to specify the name of the library directory. - if (NOT GFLAGS_LIBRARY_INSTALL_DIR AND LIB_INSTALL_DIR) - set (GFLAGS_LIBRARY_INSTALL_DIR "${LIB_INSTALL_DIR}") - endif () - gflags_define (PATH LIBRARY_INSTALL_DIR "Directory of installed libraries, e.g., \"lib64\"" "lib${LIB_SUFFIX}") - gflags_property (LIBRARY_INSTALL_DIR ADVANCED TRUE) - set (INCLUDE_INSTALL_DIR include) - set (CONFIG_INSTALL_DIR ${LIBRARY_INSTALL_DIR}/cmake/${PACKAGE_NAME}) - set (PKGCONFIG_INSTALL_DIR ${LIBRARY_INSTALL_DIR}/pkgconfig) -endif () - -# ---------------------------------------------------------------------------- -# add library targets -set (TARGETS) -# static vs. shared -foreach (TYPE IN ITEMS STATIC SHARED) - if (BUILD_${TYPE}_LIBS) - string (TOLOWER "${TYPE}" type) - # whether or not targets are a DLL - if (OS_WINDOWS AND "^${TYPE}$" STREQUAL "^SHARED$") - set (GFLAGS_IS_A_DLL 1) - else () - set (GFLAGS_IS_A_DLL 0) - endif () - # filename suffix for static libraries on Windows - if (OS_WINDOWS AND "^${TYPE}$" STREQUAL "^STATIC$") - set (type_suffix "_${type}") - else () - set (type_suffix "") - endif () - # multi-threaded vs. single-threaded - foreach (opts IN ITEMS "" _nothreads) - if (BUILD_gflags${opts}_LIB) - set (target_name "gflags${opts}_${type}") - add_library (${target_name} ${TYPE} ${GFLAGS_SRCS} ${PRIVATE_HDRS} ${PUBLIC_HDRS}) - set_target_properties (${target_name} PROPERTIES - OUTPUT_NAME "gflags${opts}${type_suffix}" - VERSION "${PACKAGE_VERSION}" - SOVERSION "${PACKAGE_SOVERSION}" - ) - set (include_dirs "$") - if (INSTALL_HEADERS) - list (APPEND include_dirs "$") - endif () - target_include_directories (${target_name} - PUBLIC "${include_dirs}" - PRIVATE "${PROJECT_SOURCE_DIR}/src;${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}" - ) - target_compile_definitions (${target_name} PUBLIC GFLAGS_IS_A_DLL=${GFLAGS_IS_A_DLL}) - if (opts MATCHES "nothreads") - target_compile_definitions (${target_name} PRIVATE NO_THREADS) - elseif (CMAKE_USE_PTHREADS_INIT) - target_link_libraries (${target_name} ${CMAKE_THREAD_LIBS_INIT}) - endif () - if (HAVE_SHLWAPI_H) - target_link_libraries (${target_name} shlwapi.lib) - endif () - list (APPEND TARGETS ${target_name}) - # add convenience make target for build of both shared and static libraries - if (NOT GFLAGS_IS_SUBPROJECT) - if (NOT TARGET gflags${opts}) - add_custom_target (gflags${opts}) - endif () - add_dependencies (gflags${opts} ${target_name}) - endif () - endif () - endforeach () - endif () -endforeach () - -# add ALIAS target for use in super-project, prefer static over shared, single-threaded over multi-threaded -if (GFLAGS_IS_SUBPROJECT) - foreach (type IN ITEMS static shared) - foreach (opts IN ITEMS "_nothreads" "") - if (TARGET gflags${opts}_${type}) - # Define "gflags" alias for super-projects treating targets of this library as part of their own project - # (also for backwards compatibility with gflags 2.2.1 which only defined this alias) - add_library (gflags ALIAS gflags${opts}_${type}) - # Define "gflags::gflags" alias for projects that support both find_package(gflags) and add_subdirectory(gflags) - add_library (gflags::gflags ALIAS gflags${opts}_${type}) - break () - endif () - endforeach () - if (TARGET gflags::gflags) - break () - endif () - endforeach () -endif () - -# ---------------------------------------------------------------------------- -# installation rules -set (EXPORT_NAME ${PACKAGE_NAME}-targets) -file (RELATIVE_PATH INSTALL_PREFIX_REL2CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${CONFIG_INSTALL_DIR}" "${CMAKE_INSTALL_PREFIX}") -configure_file (cmake/config.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-install.cmake" @ONLY) -configure_file (cmake/version.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" @ONLY) - -if (BUILD_SHARED_LIBS AND INSTALL_SHARED_LIBS) - foreach (opts IN ITEMS "" _nothreads) - if (BUILD_gflags${opts}_LIB) - install (TARGETS gflags${opts}_shared - EXPORT ${EXPORT_NAME} - RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} - LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} - ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} - ) - endif () - endforeach () -endif () -if (BUILD_STATIC_LIBS AND INSTALL_STATIC_LIBS) - foreach (opts IN ITEMS "" _nothreads) - if (BUILD_gflags${opts}_LIB) - install (TARGETS gflags${opts}_static - EXPORT ${EXPORT_NAME} - RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} - LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} - ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} - ) - endif () - endforeach () -endif () - -if (INSTALL_HEADERS) - install (FILES ${PUBLIC_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/${GFLAGS_INCLUDE_DIR}) - install ( - FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-install.cmake" - RENAME ${PACKAGE_NAME}-config.cmake - DESTINATION ${CONFIG_INSTALL_DIR} - ) - install ( - FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake" - DESTINATION ${CONFIG_INSTALL_DIR} - ) - install ( - EXPORT ${EXPORT_NAME} - NAMESPACE ${PACKAGE_NAME}:: - DESTINATION ${CONFIG_INSTALL_DIR} - ) - install ( - EXPORT ${EXPORT_NAME} - FILE ${PACKAGE_NAME}-nonamespace-targets.cmake - DESTINATION ${CONFIG_INSTALL_DIR} - ) - if (UNIX) - install (PROGRAMS src/gflags_completions.sh DESTINATION ${RUNTIME_INSTALL_DIR}) - endif () -endif () - -if (PKGCONFIG_INSTALL_DIR) - configure_file ("cmake/package.pc.in" "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}.pc" @ONLY) - install (FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}.pc" DESTINATION "${PKGCONFIG_INSTALL_DIR}") -endif () - -# ---------------------------------------------------------------------------- -# support direct use of build tree -set (INSTALL_PREFIX_REL2CONFIG_DIR .) -export ( - TARGETS ${TARGETS} - NAMESPACE ${PACKAGE_NAME}:: - FILE "${PROJECT_BINARY_DIR}/${EXPORT_NAME}.cmake" -) -export ( - TARGETS ${TARGETS} - FILE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-nonamespace-targets.cmake" -) -if (REGISTER_BUILD_DIR) - export (PACKAGE ${PACKAGE_NAME}) -endif () -if (REGISTER_INSTALL_PREFIX) - register_gflags_package(${CONFIG_INSTALL_DIR}) -endif () -configure_file (cmake/config.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-config.cmake" @ONLY) - -# ---------------------------------------------------------------------------- -# testing - MUST follow the generation of the build tree config file -if (BUILD_TESTING) - include (CTest) - add_subdirectory (test) -endif () - -# ---------------------------------------------------------------------------- -# packaging -if (BUILD_PACKAGING) - - if (NOT BUILD_SHARED_LIBS AND NOT INSTALL_HEADERS) - message (WARNING "Package will contain static libraries without headers!" - "\nRecommended options for generation of runtime package:" - "\n BUILD_SHARED_LIBS=ON" - "\n BUILD_STATIC_LIBS=OFF" - "\n INSTALL_HEADERS=OFF" - "\n INSTALL_SHARED_LIBS=ON" - "\nRecommended options for generation of development package:" - "\n BUILD_SHARED_LIBS=ON" - "\n BUILD_STATIC_LIBS=ON" - "\n INSTALL_HEADERS=ON" - "\n INSTALL_SHARED_LIBS=ON" - "\n INSTALL_STATIC_LIBS=ON" - ) - endif () - - # default package generators - if (APPLE) - set (PACKAGE_GENERATOR "PackageMaker") - set (PACKAGE_SOURCE_GENERATOR "TGZ;ZIP") - elseif (UNIX) - set (PACKAGE_GENERATOR "DEB;RPM") - set (PACKAGE_SOURCE_GENERATOR "TGZ;ZIP") - else () - set (PACKAGE_GENERATOR "ZIP") - set (PACKAGE_SOURCE_GENERATOR "ZIP") - endif () - - # used package generators - set (CPACK_GENERATOR "${PACKAGE_GENERATOR}" CACHE STRING "List of binary package generators (CPack).") - set (CPACK_SOURCE_GENERATOR "${PACKAGE_SOURCE_GENERATOR}" CACHE STRING "List of source package generators (CPack).") - mark_as_advanced (CPACK_GENERATOR CPACK_SOURCE_GENERATOR) - - # some package generators (e.g., PackageMaker) do not allow .md extension - configure_file ("${CMAKE_CURRENT_LIST_DIR}/README.md" "${CMAKE_CURRENT_BINARY_DIR}/README.txt" COPYONLY) - - # common package information - set (CPACK_PACKAGE_VENDOR "Andreas Schuh") - set (CPACK_PACKAGE_CONTACT "google-gflags@googlegroups.com") - set (CPACK_PACKAGE_NAME "${PACKAGE_NAME}") - set (CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}") - set (CPACK_PACKAGE_VERSION_MAJOR "${PACKAGE_VERSION_MAJOR}") - set (CPACK_PACKAGE_VERSION_MINOR "${PACKAGE_VERSION_MINOR}") - set (CPACK_PACKAGE_VERSION_PATCH "${PACKAGE_VERSION_PATCH}") - set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE_DESCRIPTION}") - set (CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_BINARY_DIR}/README.txt") - set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/COPYING.txt") - set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/README.txt") - set (CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") - set (CPACK_OUTPUT_FILE_PREFIX packages) - set (CPACK_PACKAGE_RELOCATABLE TRUE) - set (CPACK_MONOLITHIC_INSTALL TRUE) - - # RPM package information -- used in cmake/package.cmake.in also for DEB - set (CPACK_RPM_PACKAGE_GROUP "Development/Libraries") - set (CPACK_RPM_PACKAGE_LICENSE "BSD") - set (CPACK_RPM_PACKAGE_URL "${PACKAGE_URL}") - set (CPACK_RPM_CHANGELOG_FILE "${CMAKE_CURRENT_LIST_DIR}/ChangeLog.txt") - - if (INSTALL_HEADERS) - set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_LIST_DIR}/doc/index.html") - else () - set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_LIST_DIR}/cmake/README_runtime.txt") - endif () - - # system/architecture - if (WINDOWS) - if (CMAKE_CL_64) - set (CPACK_SYSTEM_NAME "win64") - else () - set (CPACK_SYSTEM_NAME "win32") - endif () - set (CPACK_PACKAGE_ARCHITECTURE) - elseif (APPLE) - set (CPACK_PACKAGE_ARCHITECTURE darwin) - else () - string (TOLOWER "${CMAKE_SYSTEM_NAME}" CPACK_SYSTEM_NAME) - if (CMAKE_CXX_FLAGS MATCHES "-m32") - set (CPACK_PACKAGE_ARCHITECTURE i386) - else () - execute_process ( - COMMAND dpkg --print-architecture - RESULT_VARIABLE RV - OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE - ) - if (RV EQUAL 0) - string (STRIP "${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_ARCHITECTURE) - else () - execute_process (COMMAND uname -m OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE) - if (CPACK_PACKAGE_ARCHITECTURE MATCHES "x86_64") - set (CPACK_PACKAGE_ARCHITECTURE amd64) - else () - set (CPACK_PACKAGE_ARCHITECTURE i386) - endif () - endif () - endif () - endif () - - # source package settings - set (CPACK_SOURCE_TOPLEVEL_TAG "source") - set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") - set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;\\\\.swp$;\\\\.#;/#;\\\\.*~;cscope\\\\.*;/[Bb]uild[.+-_a-zA-Z0-9]*/") - - # default binary package settings - set (CPACK_INCLUDE_TOPLEVEL_DIRECTORY TRUE) - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}") - if (CPACK_PACKAGE_ARCHITECTURE) - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_ARCHITECTURE}") - endif () - - # generator specific configuration file - # - # allow package maintainers to use their own configuration file - # $ cmake -DCPACK_PROJECT_CONFIG_FILE:FILE=/path/to/package/config - if (NOT CPACK_PROJECT_CONFIG_FILE) - configure_file ( - "${CMAKE_CURRENT_LIST_DIR}/cmake/package.cmake.in" - "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-package.cmake" @ONLY - ) - set (CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-package.cmake") - endif () - - include (CPack) - -endif () # BUILD_PACKAGING - -if (NOT GFLAGS_IS_SUBPROJECT AND NOT TARGET uninstall) - configure_file ( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" @ONLY - ) - add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") -endif () diff --git a/demos/thirdparty/gflags/COPYING.txt b/demos/thirdparty/gflags/COPYING.txt deleted file mode 100644 index d15b0c24134..00000000000 --- a/demos/thirdparty/gflags/COPYING.txt +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (c) 2006, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/demos/thirdparty/gflags/ChangeLog.txt b/demos/thirdparty/gflags/ChangeLog.txt deleted file mode 100644 index ecdd4658dc1..00000000000 --- a/demos/thirdparty/gflags/ChangeLog.txt +++ /dev/null @@ -1,276 +0,0 @@ -* Sun Nov 11 2018 - Andreas Schuh - -- gflags: version 2.2.2 -Fixed 267: Support build with GCC option "-fvisibility=hidden". -Fixed 262: Declare FALGS_no##name variables as static to avoid "previous extern" warning. -Fixed 261: Declare FlagRegisterer c’tor explicit template instanations as extern in header -Fixed 257: Build with _UNICODE support on Windows. -Fixed 233/234/235: Move CMake defines that are unused by Bazel to separate header; makes config.h private again -Fixed 228: Build with recent MinGW versions that define setenv. -Fixed 226: Remove obsolete and unused CleanFileName code -Merged 266: Various PVS Studio and GCC warnings. -Merged 258: Fix build with some Clang variants that define "restrict" macro. -Merged 252: Update documentation on how to use Bazel. -Merged 249: Use "_debug" postfix for debug libraries. -Merged 247: CMake "project" VERSION; no enable_testing(); "gflags::" import target prefix. -Merged 246: Add Bazel-on-Windows support. -Merged 239: Use GFLAGS_NAMESPACE instead of "gflags" in test executable. -Merged 237: Removed unused functions; fixes compilation with -Werror compiler option. -Merged 232: Fix typo in Bazel's BUILD definition -Merged 230: Remove using ::fLS::clstring. -Merged 221: Add convenience 'uninstall' target - -* Tue Jul 11 2017 - Andreas Schuh - -- gflags: version 2.2.1 -- Link to online documentation in README -- Merged 194: Include utils by file instead of CMAKE_MODULE_PATH search -- Merged 195: Remove unused program_name variable -- Merged 196: Enable language C for older CMake versions when needed -- Merged 202: Changed include directory in bazel build -- Merged 207: Mark single argument constructors in mutex.h as explicit -- Merged 209: Use inttypes.h on VC++ 2013 and later -- Merged 212: Fix statically linked gflags library with MSVC -- Meregd 213: Modify installation paths on Windows for vcpkg -- Merged 215: Fix static initialization order fiasco caused by global registry lock -- Merged 216: Fix use of ARGC in CMake macros -- Merged 222: Static code analyzer error regarding strncmp with empty kRootDir -- Merged 224: Check HAVE_STDINT_H or HAVE_INTTYPES_H for older MSVC versions - -* Fri Nov 25 2016 - Andreas Schuh - -- gflags: version 2.2.0 -- Merged 178: Implicitly convert dashes in option names to underscores -- Merged 159: CI builds and automatic tests with Travis CI and AppVeyor -- Merged 158: Use enum for flag value types -- Merged 126: File name postfix for static libraries on Windows -- Closed issue 120: Configure and install gflags.pc file for pkg-config users -- Fixed issue 127: snprintf already defined when building with MSVC 2015 -- Fixed issue 51/138: Memory leaks reported by valgrind -- Fixed issue 173: Validate flags only once -- Fixed issue 168: Unsigned and signed comparison in gflags_reporting.cc -- Fixed issues 176/153: Add -lpthread link argument to Bazel build, refactor BUILD rules -- Fixed issue 89: Add GFLAGS_IS_A_DLL to imported CMake target INTERFACE_COMPILE_DEFINITIONS -- Fixed issue 104: Set INTERFACE_INCLUDE_DIRECTORIES of exported CMake targets -- Fixed issue 174: Missing gflags-targets.cmake file after installation -- Fixed issue 186: Error linking to gflags IMPLIB with MSVC using CMake -- Closed issue 106: Add example project to test use of gflags library - -* Tue Mar 24 2014 - Andreas Schuh - -- gflags: version 2.1.2 -- Moved project to GitHub -- Added GFLAGS_NAMESPACE definition to gflags_declare.h -- Fixed issue 94: Keep "google" as primary namespace and import symbols into "gflags" namespace -- Fixed issue 96: Fix binary ABI compatibility with gflags 2.0 using "google" as primary namespace -- Fixed issue 97/101: Removed (patched) CMake modules and enabled C language instead -- Fixed issue 103: Set CMake policy CMP0042 to silence warning regarding MACOS_RPATH setting - -* Sun Mar 20 2014 - Andreas Schuh - -- gflags: version 2.1.1 -- Fixed issue 77: GFLAGS_IS_A_DLL expands to empty string in gflags_declare.h -- Fixed issue 79: GFLAGS_NAMESPACE not expanded to actual namespace in gflags_declare.h -- Fixed issue 80: Allow include path to differ from GFLAGS_NAMESPACE - -* Thu Mar 20 2014 - Andreas Schuh - -- gflags: version 2.1.0 -- Build system configuration using CMake instead of autotools -- CPack packaging support for Debian/Ubuntu, Red Hat, and Mac OS X -- Fixed issue 54: Fix "invalid suffix on literal" (C++11) -- Fixed issue 57: Use _strdup instead of strdup on Windows -- Fixed issue 62: Change all preprocessor include guards to start with GFLAGS_ -- Fixed issue 64: Add DEFINE_validator macro -- Fixed issue 73: Warnings in Visual Studio 2010 and unable to compile unit test - -* Wed Jan 25 2012 - Google Inc. - -- gflags: version 2.0 -- Changed the 'official' gflags email in setup.py/etc -- Renamed google-gflags.sln to gflags.sln -- Changed copyright text to reflect Google's relinquished ownership - -* Tue Dec 20 2011 - Google Inc. - -- google-gflags: version 1.7 -- Add CommandLineFlagInfo::flag_ptr pointing to current storage (musji) -- PORTING: flush after writing to stderr, needed on cygwin -- PORTING: Clean up the GFLAGS_DLL_DECL stuff better -- Fix a bug in StringPrintf() that affected large strings (csilvers) -- Die at configure-time when g++ isn't installed - -* Fri Jul 29 2011 - Google Inc. - -- google-gflags: version 1.6 -- BUGFIX: Fix a bug where we were leaving out a required $(top_srcdir) -- Fix definition of clstring (jyrki) -- Split up flag declares into its own file (jyrki) -- Add --version support (csilvers) -- Update the README for gflags with static libs -- Update acx_pthread.m4 for nostdlib -- Change ReparseCommandLineFlags to return void (csilvers) -- Some doc typofixes and example augmentation (various) - -* Mon Jan 24 2011 - Google Inc. - -- google-gflags: version 1.5 -- Better reporting of current vs default value (handler) -- Add API for cleaning up of memory at program-exit (jmarantz) -- Fix macros to work inside namespaces (csilvers) -- Use our own string typedef in case string is redefined (csilvers) -- Updated to autoconf 2.65 - -* Wed Oct 13 2010 - Google Inc. - -- google-gflags: version 1.4 -- Add a check to prevent passing 0 to DEFINE_string (jorg) -- Reduce compile (.o) size (jyrki) -- Some small changes to quiet debug compiles (alexk) -- PORTING: better support static linking on windows (csilvers) -- DOCUMENTATION: change default values, use validators, etc. -- Update the NEWS file to be non-empty -- Add pkg-config (.pc) files for libgflags and libgflags_nothreads - -* Mon Jan 4 2010 - Google Inc. - -- google-gflags: version 1.3 -- PORTABILITY: can now build and run tests under MSVC (csilvers) -- Remove the python gflags code, which is now its own package (tansell) -- Clarify that "last flag wins" in the docs (csilvers) -- Comment danger of using GetAllFlags in validators (wojtekm) -- PORTABILITY: Some fixes necessary for c++0x (mboerger) -- Makefile fix: $(srcdir) -> $(top_srcdir) in one place (csilvres) -- INSTALL: autotools to autoconf v2.64 + automake v1.11 (csilvers) - -* Thu Sep 10 2009 - Google Inc. - -- google-gflags: version 1.2 -- PORTABILITY: can now build and run tests under mingw (csilvers) -- Using a string arg for a bool flag is a compile-time error (rbayardo) -- Add --helpxml to gflags.py (salcianu) -- Protect against a hypothetical global d'tor mutex problem (csilvers) -- BUGFIX: can now define a flag after 'using namespace google' (hamaji) - -* Tue Apr 14 2009 - Google Inc. - -- google-gflags: version 1.1 -- Add both foo and nofoo for boolean flags, with --undefok (andychu) -- Better document how validators work (wojtekm) -- Improve binary-detection for bash-completion (mtamsky) -- Python: Add a concept of "key flags", used with --help (salcianu) -- Python: Robustify flag_values (salcianu) -- Python: Add a new DEFINE_bool alias (keir, andrewliu) -- Python: Do module introspection based on module name (dsturtevant) -- Fix autoconf a bit better, especially on windows and solaris (ajenjo) -- BUG FIX: gflags_nothreads was linking against the wrong lib (ajenjo) -- BUG FIX: threads-detection failed on FreeBSD; replace it (ajenjo) -- PORTABILITY: Quiet an internal compiler error with SUSE 10 (csilvers) -- PORTABILITY: Update deb.sh for more recenty debuilds (csilvers) -- PORTABILITY: #include more headers to satify new gcc's (csilvers) -- INSTALL: Updated to autoconf 2.61 and libtool 1.5.26 (csilvers) - -* Fri Oct 3 2008 - Google Inc. - -- google-gflags: version 1.0 -- Add a missing newline to an error string (bcmills) -- (otherwise exactly the same as gflags 1.0rc2) - -* Thu Sep 18 2008 - Google Inc. - -- google-gflags: version 1.0rc2 -- Report current flag values in --helpxml (hdn) -- Fix compilation troubles with gcc 4.3.3 (simonb) -- BUG FIX: I was missing a std:: in DECLARE_string (csilvers) -- BUG FIX: Clarify in docs how to specify --bool flags (csilvers) -- BUG FIX: Fix --helpshort for source files not in a subdir (csilvers) -- BUG FIX: Fix python unittest for 64-bit builds (bcmills) - -* Tue Aug 19 2008 - Google Inc. - -- google-gflags: version 1.0rc1 -- Move #include files from google/ to gflags/ (csilvers) -- Small optimizations to reduce binary (library) size (jyrki) -- BUGFIX: forgot a std:: in one of the .h files (csilvers) -- Speed up locking by making sure calls are inlined (ajenjo) -- 64-BIT COMPATIBILITY: Use %PRId64 instead of %lld (csilvers) -- PORTABILITY: fix Makefile to work with Cygwin (ajenjo) -- PORTABILITY: fix code to compile under Visual Studio (ajenjo) -- PORTABILITY: fix code to compile under Solaris 10 with CC (csilvers) - -* Mon Jul 21 2008 - Google Inc. - -- google-gflags: version 0.9 -- Add the ability to validate a command-line flag (csilvers) -- Add completion support for commandline flags in bash (daven) -- Add -W compile flags to Makefile, when using gcc (csilvers) -- Allow helpstring to be NULL (cristianoc) -- Improved documentation of classes in the .cc file (csilvers) -- Fix python bug with AppendFlagValues + shortnames (jjtswan) -- Use bool instead of int for boolean flags in gflags.py (bcmills) -- Simplify the way we declare flags, now more foolproof (csilvers) -- Better error messages when bool flags collide (colohan) -- Only evaluate DEFINE_foo macro args once (csilvers) - -* Wed Mar 26 2008 - Google Inc. - -- google-gflags: version 0.8 -- Export DescribeOneFlag() in the API -- Add support for automatic line wrapping at 80 cols for gflags.py -- Bugfix: do not treat an isolated "-" the same as an isolated "--" -- Update rpm spec to point to Google Code rather than sourceforge (!) -- Improve documentation (including documenting thread-safety) -- Improve #include hygiene -- Improve testing - -* Thu Oct 18 2007 - Google Inc. - -- google-gflags: version 0.7 -- Deal even more correctly with libpthread not linked in (csilvers) -- Add STRIP_LOG, an improved DO_NOT_SHOW_COMMANDLINE_HELP (sioffe) -- Be more accurate printing default flag values in --help (dsturtevant) -- Reduce .o file size a bit by using shorter namespace names (jeff) -- Use relative install path, so 'setup.py --home' works (csilvers) -- Notice when a boolean flag has a non-boolean default (bnmouli) -- Broaden --helpshort to match foo-main.cc and foo_main.cc (hendrie) -- Fix "no modules match" message for --helpshort, etc (hendrie) - -* Wed Aug 15 2007 - Google Inc. - -- google-gflags: version 0.6 -- Deal correctly with case that libpthread is not linked in (csilvers) -- Update Makefile/tests so we pass "make distcheck" (csilvers) -- Document and test that last assignment to a flag wins (wan) - -* Tue Jun 12 2007 - Google Inc. - -- google-gflags: version 0.5 -- Include all m4 macros in the distribution (csilvers) -- Python: Fix broken data_files field in setup.py (sidlon) -- Python: better string serliaizing and unparsing (abo, csimmons) -- Fix checks for NaN and inf to work with Mac OS X (csilvers) - -* Thu Apr 19 2007 - Google Inc. - -- google-gflags: version 0.4 -- Remove is_default from GetCommandLineFlagInfo (csilvers) -- Portability fixes: includes, strtoll, gcc4.3 errors (csilvers) -- A few doc typo cleanups (csilvers) - -* Wed Mar 28 2007 - Google Inc. - -- google-gflags: version 0.3 -- python portability fix: use popen instead of subprocess (csilvers) -- Add is_default to CommandLineFlagInfo (pchien) -- Make docs a bit prettier (csilvers) -- Actually include the python files in the distribution! :-/ (csilvers) - -* Mon Jan 22 2007 - Google Inc. - -- google-gflags: version 0.2 -- added support for python commandlineflags, as well as c++ -- gflags2man, a script to turn flags into a man page (dchristian) - -* Wed Dec 13 2006 - Google Inc. - -- google-gflags: version 0.1 diff --git a/demos/thirdparty/gflags/INSTALL.md b/demos/thirdparty/gflags/INSTALL.md deleted file mode 100644 index 76d7eddf752..00000000000 --- a/demos/thirdparty/gflags/INSTALL.md +++ /dev/null @@ -1,83 +0,0 @@ -Installing a binary distribution package -======================================== - -No official binary distribution packages are provided by the gflags developers. -There may, however, be binary packages available for your OS. Please consult -also the package repositories of your Linux distribution. - -For example on Debian/Ubuntu Linux, gflags can be installed using the -following command: - - sudo apt-get install libgflags-dev - - -Compiling the source code with CMake -========================= - -The build system of gflags is since version 2.1 based on [CMake](http://cmake.org). -The common steps to build, test, and install software are therefore: - -1. Extract source files. -2. Create build directory and change to it. -3. Run CMake to configure the build tree. -4. Build the software using selected build tool. -5. Test the built software. -6. Install the built files. - -On Unix-like systems with GNU Make as build tool, these build steps can be -summarized by the following sequence of commands executed in a shell, -where ```$package``` and ```$version``` are shell variables which represent -the name of this package and the obtained version of the software. - - $ tar xzf gflags-$version-source.tar.gz - $ cd gflags-$version - $ mkdir build && cd build - $ ccmake .. - - - Press 'c' to configure the build system and 'e' to ignore warnings. - - Set CMAKE_INSTALL_PREFIX and other CMake variables and options. - - Continue pressing 'c' until the option 'g' is available. - - Then press 'g' to generate the configuration files for GNU Make. - - $ make - $ make test (optional) - $ make install (optional) - -In the following, only gflags-specific CMake settings available to -configure the build and installation are documented. Note that most of these -variables are for advanced users and binary package maintainers only. -They usually do not have to be modified. - - -CMake Option | Description ---------------------------- | ------------------------------------------------------- -CMAKE_INSTALL_PREFIX | Installation directory, e.g., "/usr/local" on Unix and "C:\Program Files\gflags" on Windows. -BUILD_SHARED_LIBS | Request build of dynamic link libraries. -BUILD_STATIC_LIBS | Request build of static link libraries. Implied if BUILD_SHARED_LIBS is OFF. -BUILD_PACKAGING | Enable binary package generation using CPack. -BUILD_TESTING | Build tests for execution by CTest. -BUILD_NC_TESTS | Request inclusion of negative compilation tests (requires Python). -BUILD_CONFIG_TESTS | Request inclusion of package configuration tests (requires Python). -BUILD_gflags_LIBS | Request build of multi-threaded gflags libraries (if threading library found). -BUILD_gflags_nothreads_LIBS | Request build of single-threaded gflags libraries. -GFLAGS_NAMESPACE | Name of the C++ namespace to be used by the gflags library. Note that the public source header files are installed in a subdirectory named after this namespace. To maintain backwards compatibility with the Google Commandline Flags, set this variable to "google". The default is "gflags". -GFLAGS_INTTYPES_FORMAT | String identifying format of built-in integer types. -GFLAGS_INCLUDE_DIR | Name of headers installation directory relative to CMAKE_INSTALL_PREFIX. -LIBRARY_INSTALL_DIR | Name of library installation directory relative to CMAKE_INSTALL_PREFIX. -INSTALL_HEADERS | Request installation of public header files. - -Using gflags with [Bazel](http://bazel.io) -========================= - -To use gflags in a Bazel project, map it in as an external dependency by editing -your WORKSPACE file: - - git_repository( - name = "com_github_gflags_gflags", - commit = "", - remote = "https://github.com/gflags/gflags.git", - ) - -You can then add `@com_github_gflags_gflags//:gflags` to the `deps` section of a -`cc_binary` or `cc_library` rule, and `#include ` to include it -in your source code. diff --git a/demos/thirdparty/gflags/README.md b/demos/thirdparty/gflags/README.md deleted file mode 100644 index 6e5267c1e41..00000000000 --- a/demos/thirdparty/gflags/README.md +++ /dev/null @@ -1,320 +0,0 @@ -[![Build Status](https://travis-ci.org/gflags/gflags.svg?branch=master)](https://travis-ci.org/gflags/gflags) -[![Build status](https://ci.appveyor.com/api/projects/status/4ctod566ysraus74/branch/master?svg=true)](https://ci.appveyor.com/project/schuhschuh/gflags/branch/master) - -The documentation of the gflags library is available online at https://gflags.github.io/gflags/. - - -11 November 2018 ----------------- - -I've just released gflags 2.2.2. - -This maintenance release improves lives of Bazel users (no more "config.h" leaking into global include paths), -fixes build with recent MinGW versions, and silences a number of static code analyzer and compiler warnings. -The build targets exported by the CMake configuration of this library are now also prefixed by the package -name "gflags::" following a more recent (unwritten) CMake convention. The unprefixed target names are still -supported to avoid that dependent projects have to be modified due to this change in imported target names. - -Please report any further issues with this release using the GitHub issue tracker. - - -11 July 2017 ------------- - -I've just released gflags 2.2.1. - -This maintenance release primarily fixes build issues on Windows and -false alarms reported by static code analyzers. - -Please report any further issues with this release using the GitHub issue tracker. - - -25 November 2016 ----------------- - -I've finally released gflags 2.2.0. - -This release adds support for use of the gflags library as external dependency -not only in projects using CMake, but also [Bazel](https://bazel.build/), -or [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/). -One new minor feature is added in this release: when a command flag argument -contains dashes, these are implicitly converted to underscores. -This is to allow those used to separate words of the flag name by dashes -to do so, while the flag variable names are required to use underscores. - -Memory leaks reported by valgrind should be resolved by this release. -This release fixes build errors with MS Visual Studio 2015. - -Please report any further issues with this release using the GitHub issue tracker. - - -24 March 2015 -------------- - -I've just released gflags 2.1.2. - -This release completes the namespace change fixes. In particular, -it restores binary ABI compatibility with release version 2.0. -The deprecated "google" namespace is by default still kept as -primary namespace while symbols are imported into the new "gflags" namespace. -This can be overridden using the CMake variable GFLAGS_NAMESPACE. - -Other fixes of the build configuration are related to the (patched) -CMake modules FindThreads.cmake and CheckTypeSize.cmake. These have -been removed and instead the C language is enabled again even though -gflags is written in C++ only. - -This release also marks the complete move of the gflags project -from Google Code to GitHub. Email addresses of original issue -reporters got lost in the process. Given the age of most issue reports, -this should be negligable. - -Please report any further issues using the GitHub issue tracker. - - -30 March 2014 -------------- - -I've just released gflags 2.1.1. - -This release fixes a few bugs in the configuration of gflags\_declare.h -and adds a separate GFLAGS\_INCLUDE\_DIR CMake variable to the build configuration. -Setting GFLAGS\_NAMESPACE to "google" no longer changes also the include -path of the public header files. This allows the use of the library with -other Google projects such as glog which still use the deprecated "google" -namespace for the gflags library, but include it as "gflags/gflags.h". - -20 March 2014 -------------- - -I've just released gflags 2.1. - -The major changes are the use of CMake for the build configuration instead -of the autotools and packaging support through CPack. The default namespace -of all C++ symbols is now "gflags" instead of "google". This can be -configured via the GFLAGS\_NAMESPACE variable. - -This release compiles with all major compilers without warnings and passed -the unit tests on Ubuntu 12.04, Windows 7 (Visual Studio 2008 and 2010, -Cygwin, MinGW), and Mac OS X (Xcode 5.1). - -The SVN repository on Google Code is now frozen and replaced by a Git -repository such that it can be used as Git submodule by projects. The main -hosting of this project remains at Google Code. Thanks to the distributed -character of Git, I can push (and pull) changes from both GitHub and Google Code -in order to keep the two public repositories in sync. -When fixing an issue for a pull request through either of these hosting -platforms, please reference the issue number as -[described here](https://code.google.com/p/support/wiki/IssueTracker#Integration_with_version_control). -For the further development, I am following the -[Git branching model](http://nvie.com/posts/a-successful-git-branching-model/) -with feature branch names prefixed by "feature/" and bugfix branch names -prefixed by "bugfix/", respectively. - -Binary and source [packages](https://github.com/schuhschuh/gflags/releases) are available on GitHub. - - -14 January 2014 ---------------- - -The migration of the build system to CMake is almost complete. -What remains to be done is rewriting the tests in Python such they can be -executed on non-Unix platforms and splitting them up into separate CTest tests. -Though merging these changes into the master branch yet remains to be done, -it is recommended to already start using the -[cmake-migration](https://github.com/schuhschuh/gflags/tree/cmake-migration) branch. - - -20 April 2013 -------------- - -More than a year has past since I (Andreas) took over the maintenance for -`gflags`. Only few minor changes have been made since then, much to my regret. -To get more involved and stimulate participation in the further -development of the library, I moved the project source code today to -[GitHub](https://github.com/schuhschuh/gflags). -I believe that the strengths of [Git](http://git-scm.com/) will allow for better community collaboration -as well as ease the integration of changes made by others. I encourage everyone -who would like to contribute to send me pull requests. -Git's lightweight feature branches will also provide the right tool for more -radical changes which should only be merged back into the master branch -after these are complete and implement the desired behavior. - -The SVN repository remains accessible at Google Code and I will keep the -master branch of the Git repository hosted at GitHub and the trunk of the -Subversion repository synchronized. Initially, I was going to simply switch the -Google Code project to Git, but in this case the SVN repository would be -frozen and force everyone who would like the latest development changes to -use Git as well. Therefore I decided to host the public Git repository at GitHub -instead. - -Please continue to report any issues with gflags on Google Code. The GitHub project will -only be used to host the Git repository. - -One major change of the project structure I have in mind for the next weeks -is the migration from autotools to [CMake](http://www.cmake.org/). -Check out the (unstable!) -[cmake-migration](https://github.com/schuhschuh/gflags/tree/cmake-migration) -branch on GitHub for details. - - -25 January 2012 ---------------- - -I've just released gflags 2.0. - -The `google-gflags` project has been renamed to `gflags`. I -(csilvers) am stepping down as maintainer, to be replaced by Andreas -Schuh. Welcome to the team, Andreas! I've seen the energy you have -around gflags and the ideas you have for the project going forward, -and look forward to having you on the team. - -I bumped the major version number up to 2 to reflect the new community -ownership of the project. All the [changes](ChangeLog.txt) -are related to the renaming. There are no functional changes from -gflags 1.7. In particular, I've kept the code in the namespace -`google`, though in a future version it should be renamed to `gflags`. -I've also kept the `/usr/local/include/google/` subdirectory as -synonym of `/usr/local/include/gflags/`, though the former name has -been obsolete for some time now. - - -18 January 2011 ---------------- - -The `google-gflags` Google Code page has been renamed to -`gflags`, in preparation for the project being renamed to -`gflags`. In the coming weeks, I'll be stepping down as -maintainer for the gflags project, and as part of that Google is -relinquishing ownership of the project; it will now be entirely -community run. The name change reflects that shift. - - -20 December 2011 ----------------- - -I've just released gflags 1.7. This is a minor release; the major -change is that `CommandLineFlagInfo` now exports the address in memory -where the flag is located. There has also been a bugfix involving -very long --help strings, and some other minor [changes](ChangeLog.txt). - -29 July 2011 ------------- - -I've just released gflags 1.6. The major new feature in this release -is support for setting version info, so that --version does something -useful. - -One minor change has required bumping the library number: -`ReparseCommandlineFlags` now returns `void` instead of `int` (the int -return value was always meaningless). Though I doubt anyone ever used -this (meaningless) return value, technically it's a change to the ABI -that requires a version bump. A bit sad. - -There's also a procedural change with this release: I've changed the -internal tools used to integrate Google-supplied patches for gflags -into the opensource release. These new tools should result in more -frequent updates with better change descriptions. They will also -result in future `ChangeLog` entries being much more verbose (for better -or for worse). - -See the [ChangeLog](ChangeLog.txt) for a full list of changes for this release. - -24 January 2011 ---------------- - -I've just released gflags 1.5. This release has only minor changes -from 1.4, including some slightly better reporting in --help, and -an new memory-cleanup function that can help when running gflags-using -libraries under valgrind. The major change is to fix up the macros -(`DEFINE_bool` and the like) to work more reliably inside namespaces. - -If you have not had a problem with these macros, and don't need any of -the other changes described, there is no need to upgrade. See the -[ChangeLog](ChangeLog.txt) for a full list of changes for this release. - -11 October 2010 ---------------- - -I've just released gflags 1.4. This release has only minor changes -from 1.3, including some documentation tweaks and some work to make -the library smaller. If 1.3 is working well for you, there's no -particular reason to upgrade. - -4 January 2010 --------------- - -I've just released gflags 1.3. gflags now compiles under MSVC, and -all tests pass. I **really** never thought non-unix-y Windows folks -would want gflags, but at least some of them do. - -The major news, though, is that I've separated out the python package -into its own library, [python-gflags](http://code.google.com/p/python-gflags). -If you're interested in the Python version of gflags, that's the place to -get it now. - -10 September 2009 ------------------ - -I've just released gflags 1.2. The major change from gflags 1.1 is it -now compiles under MinGW (as well as cygwin), and all tests pass. I -never thought Windows folks would want unix-style command-line flags, -since they're so different from the Windows style, but I guess I was -wrong! - -The other changes are minor, such as support for --htmlxml in the -python version of gflags. - -15 April 2009 -------------- - -I've just released gflags 1.1. It has only minor changes fdrom gflags -1.0 (see the [ChangeLog](ChangeLog.txt) for details). -The major change is that I moved to a new system for creating .deb and .rpm files. -This allows me to create x86\_64 deb and rpm files. - -In the process of moving to this new system, I noticed an -inconsistency: the tar.gz and .rpm files created libraries named -libgflags.so, but the deb file created libgoogle-gflags.so. I have -fixed the deb file to create libraries like the others. I'm no expert -in debian packaging, but I believe this has caused the package name to -change as well. Please let me know (at -[[mailto:google-gflags@googlegroups.com](mailto:google-gflags@googlegroups.com) -google-gflags@googlegroups.com]) if this causes problems for you -- -especially if you know of a fix! I would be happy to change the deb -packages to add symlinks from the old library name to the new -(libgoogle-gflags.so -> libgflags.so), but that is beyond my knowledge -of how to make .debs. - -If you've tried to install a .rpm or .deb and it doesn't work for you, -let me know. I'm excited to finally have 64-bit package files, but -there may still be some wrinkles in the new system to iron out. - -1 October 2008 --------------- - -gflags 1.0rc2 was out for a few weeks without any issues, so gflags -1.0 is now released. This is much like gflags 0.9. The major change -is that the .h files have been moved from `/usr/include/google` to -`/usr/include/gflags`. While I have backwards-compatibility -forwarding headeds in place, please rewrite existing code to say -``` - #include -``` -instead of -``` - #include -``` - -I've kept the default namespace to google. You can still change with -with the appropriate flag to the configure script (`./configure ---help` to see the flags). If you have feedback as to whether the -default namespace should change to gflags, which would be a -non-backwards-compatible change, send mail to -`google-gflags@googlegroups.com`! - -Version 1.0 also has some neat new features, like support for bash -commandline-completion of help flags. See the [ChangeLog](ChangeLog.txt) -for more details. - -If I don't hear any bad news for a few weeks, I'll release 1.0-final. diff --git a/demos/thirdparty/gflags/WORKSPACE b/demos/thirdparty/gflags/WORKSPACE deleted file mode 100644 index f3707e9069b..00000000000 --- a/demos/thirdparty/gflags/WORKSPACE +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright 2006 Google Inc. All Rights Reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the COPYING.txt file. - -# Bazel (http://bazel.io/) WORKSPACE file for gflags. -workspace(name="com_github_gflags_gflags") diff --git a/demos/thirdparty/gflags/appveyor.yml b/demos/thirdparty/gflags/appveyor.yml deleted file mode 100644 index a5110e55594..00000000000 --- a/demos/thirdparty/gflags/appveyor.yml +++ /dev/null @@ -1,68 +0,0 @@ -# Configuration for continuous integration service at appveyor.com - -version: '{build}' - -os: Visual Studio 2015 - -environment: - matrix: - - Toolset: v140 - - Toolset: v120 - - Toolset: v110 - - Toolset: v100 - - Toolset: v90 - -platform: - - Win32 - - x64 - -configuration: - - Release - -matrix: - exclude: - - Toolset: v90 - platform: x64 - - Toolset: v100 - platform: x64 - -build: - verbosity: minimal - -before_build: -- ps: | - Write-Output "Configuration: $env:CONFIGURATION" - Write-Output "Platform: $env:PLATFORM" - $generator = switch ($env:TOOLSET) - { - "v140" {"Visual Studio 14 2015"} - "v120" {"Visual Studio 12 2013"} - "v110" {"Visual Studio 11 2012"} - "v100" {"Visual Studio 10 2010"} - "v90" {"Visual Studio 9 2008"} - } - if ($env:PLATFORM -eq "x64") - { - $generator = "$generator Win64" - } - -build_script: -- ps: | - md _build -Force | Out-Null - cd _build - - & cmake -G "$generator" -D CMAKE_CONFIGURATION_TYPES="Debug;Release" -D GFLAGS_BUILD_TESTING=ON -D GFLAGS_BUILD_SHARED_LIBS=ON -D GFLAGS_BUILD_STATIC_LIBS=ON .. - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } - & cmake --build . --config $env:CONFIGURATION - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } - -test_script: -- ps: | - & ctest -C $env:CONFIGURATION --output-on-failure - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } diff --git a/demos/thirdparty/gflags/bazel/gflags.bzl b/demos/thirdparty/gflags/bazel/gflags.bzl deleted file mode 100644 index 533fd61007a..00000000000 --- a/demos/thirdparty/gflags/bazel/gflags.bzl +++ /dev/null @@ -1,103 +0,0 @@ -# ------------------------------------------------------------------------------ -# Add native rules to configure source files -def gflags_sources(namespace=["google", "gflags"]): - native.genrule( - name = "gflags_declare_h", - srcs = ["src/gflags_declare.h.in"], - outs = ["gflags_declare.h"], - cmd = ("awk '{ " + - "gsub(/@GFLAGS_NAMESPACE@/, \"" + namespace[0] + "\"); " + - "gsub(/@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@/, \"1\"); " + - "gsub(/@([A-Z0-9_]+)@/, \"0\"); " + - "print; }' $(<) > $(@)") - ) - gflags_ns_h_files = [] - for ns in namespace[1:]: - gflags_ns_h_file = "gflags_{}.h".format(ns) - native.genrule( - name = gflags_ns_h_file.replace('.', '_'), - srcs = ["src/gflags_ns.h.in"], - outs = [gflags_ns_h_file], - cmd = ("awk '{ " + - "gsub(/@ns@/, \"" + ns + "\"); " + - "gsub(/@NS@/, \"" + ns.upper() + "\"); " + - "print; }' $(<) > $(@)") - ) - gflags_ns_h_files.append(gflags_ns_h_file) - native.genrule( - name = "gflags_h", - srcs = ["src/gflags.h.in"], - outs = ["gflags.h"], - cmd = ("awk '{ " + - "gsub(/@GFLAGS_ATTRIBUTE_UNUSED@/, \"\"); " + - "gsub(/@INCLUDE_GFLAGS_NS_H@/, \"" + '\n'.join(["#include \\\"gflags/{}\\\"".format(hdr) for hdr in gflags_ns_h_files]) + "\"); " + - "print; }' $(<) > $(@)") - ) - native.genrule( - name = "gflags_completions_h", - srcs = ["src/gflags_completions.h.in"], - outs = ["gflags_completions.h"], - cmd = "awk '{ gsub(/@GFLAGS_NAMESPACE@/, \"" + namespace[0] + "\"); print; }' $(<) > $(@)" - ) - hdrs = [":gflags_h", ":gflags_declare_h", ":gflags_completions_h"] - hdrs.extend([':' + hdr.replace('.', '_') for hdr in gflags_ns_h_files]) - srcs = [ - "src/config.h", - "src/gflags.cc", - "src/gflags_completions.cc", - "src/gflags_reporting.cc", - "src/mutex.h", - "src/util.h", - ] + select({ - "//:x64_windows": [ - "src/windows_port.cc", - "src/windows_port.h", - ], - "//conditions:default": [], - }) - return [hdrs, srcs] - -# ------------------------------------------------------------------------------ -# Add native rule to build gflags library -def gflags_library(hdrs=[], srcs=[], threads=1): - name = "gflags" - copts = [ - "-DGFLAGS_BAZEL_BUILD", - "-DGFLAGS_INTTYPES_FORMAT_C99", - "-DGFLAGS_IS_A_DLL=0", - # macros otherwise defined by CMake configured defines.h file - "-DHAVE_STDINT_H", - "-DHAVE_SYS_TYPES_H", - "-DHAVE_INTTYPES_H", - "-DHAVE_SYS_STAT_H", - "-DHAVE_STRTOLL", - "-DHAVE_STRTOQ", - "-DHAVE_RWLOCK", - ] + select({ - "//:x64_windows": [ - "-DOS_WINDOWS", - ], - "//conditions:default": [ - "-DHAVE_UNISTD_H", - "-DHAVE_FNMATCH_H", - "-DHAVE_PTHREAD", - ], - }) - linkopts = [] - if threads: - linkopts += select({ - "//:x64_windows": [], - "//conditions:default": ["-lpthread"], - }) - else: - name += "_nothreads" - copts += ["-DNO_THREADS"] - native.cc_library( - name = name, - hdrs = hdrs, - srcs = srcs, - copts = copts, - linkopts = linkopts, - visibility = ["//visibility:public"], - include_prefix = 'gflags' - ) diff --git a/demos/thirdparty/gflags/cmake/README_runtime.txt b/demos/thirdparty/gflags/cmake/README_runtime.txt deleted file mode 100644 index d2556b2e8d4..00000000000 --- a/demos/thirdparty/gflags/cmake/README_runtime.txt +++ /dev/null @@ -1,4 +0,0 @@ -This package contains runtime libraries only which are required -by applications that use these libraries for the commandline flags -processing. If you want to develop such application, download -and install the development package instead. diff --git a/demos/thirdparty/gflags/cmake/cmake_uninstall.cmake.in b/demos/thirdparty/gflags/cmake/cmake_uninstall.cmake.in deleted file mode 100644 index d00a5166581..00000000000 --- a/demos/thirdparty/gflags/cmake/cmake_uninstall.cmake.in +++ /dev/null @@ -1,26 +0,0 @@ -if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") -endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - -if (NOT DEFINED CMAKE_INSTALL_PREFIX) - set (CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") -endif () - message(${CMAKE_INSTALL_PREFIX}) - -file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) -string(REGEX REPLACE "\n" ";" files "${files}") -foreach(file ${files}) - message(STATUS "Uninstalling $ENV{DESTDIR}${file}") - if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - exec_program( - "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval - ) - if(NOT "${rm_retval}" STREQUAL 0) - message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") - endif(NOT "${rm_retval}" STREQUAL 0) - else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - message(STATUS "File $ENV{DESTDIR}${file} does not exist.") - endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") -endforeach(file) diff --git a/demos/thirdparty/gflags/cmake/config.cmake.in b/demos/thirdparty/gflags/cmake/config.cmake.in deleted file mode 100644 index a512c2a2e6e..00000000000 --- a/demos/thirdparty/gflags/cmake/config.cmake.in +++ /dev/null @@ -1,183 +0,0 @@ -## gflags CMake configuration file - -# library version information -set (@PACKAGE_PREFIX@_VERSION_STRING "@PACKAGE_VERSION@") -set (@PACKAGE_PREFIX@_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@) -set (@PACKAGE_PREFIX@_VERSION_MINOR @PACKAGE_VERSION_MINOR@) -set (@PACKAGE_PREFIX@_VERSION_PATCH @PACKAGE_VERSION_PATCH@) - -# import targets -if (NOT DEFINED @PACKAGE_PREFIX@_USE_TARGET_NAMESPACE) - set (@PACKAGE_PREFIX@_USE_TARGET_NAMESPACE FALSE) -endif () -if (@PACKAGE_PREFIX@_USE_TARGET_NAMESPACE) - include ("${CMAKE_CURRENT_LIST_DIR}/@EXPORT_NAME@.cmake") - set (@PACKAGE_PREFIX@_TARGET_NAMESPACE @PACKAGE_NAME@) -else () - include ("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-nonamespace-targets.cmake") - set (@PACKAGE_PREFIX@_TARGET_NAMESPACE) -endif () -if (@PACKAGE_PREFIX@_TARGET_NAMESPACE) - set (@PACKAGE_PREFIX@_TARGET_PREFIX ${@PACKAGE_PREFIX@_TARGET_NAMESPACE}::) -else () - set (@PACKAGE_PREFIX@_TARGET_PREFIX) -endif () - -# installation prefix -get_filename_component (CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -get_filename_component (_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_PREFIX_REL2CONFIG_DIR@" ABSOLUTE) - -# include directory -# -# Newer versions of CMake set the INTERFACE_INCLUDE_DIRECTORIES property -# of the imported targets. It is hence not necessary to add this path -# manually to the include search path for targets which link to gflags. -set (@PACKAGE_PREFIX@_INCLUDE_DIR "${_INSTALL_PREFIX}/@INCLUDE_INSTALL_DIR@") - -if (@PACKAGE_NAME@_FIND_COMPONENTS) - foreach (@PACKAGE_NAME@_FIND_COMPONENT IN LISTS @PACKAGE_NAME@_FIND_COMPONENTS) - if (@PACKAGE_NAME@_FIND_REQUIRED_${@PACKAGE_NAME@_FIND_COMPONENT} AND NOT TARGET @PACKAGE_NAME@_${@PACKAGE_NAME@_FIND_COMPONENT}) - message (FATAL_ERROR "Package @PACKAGE_NAME@ was installed without required component ${@PACKAGE_NAME@_FIND_COMPONENT}!") - endif () - endforeach () - list (GET @PACKAGE_NAME@_FIND_COMPONENTS 0 @PACKAGE_NAME@_FIND_COMPONENT) -else () - set (@PACKAGE_NAME@_FIND_COMPONENT) -endif () - -# default settings of @PACKAGE_PREFIX@_SHARED and @PACKAGE_PREFIX@_NOTHREADS -# -# It is recommended to use either one of the following find_package commands -# instead of setting the @PACKAGE_PREFIX@_(SHARED|NOTHREADS) variables: -# - find_package(@PACKAGE_NAME@ REQUIRED) -# - find_package(@PACKAGE_NAME@ COMPONENTS nothreads_static) -# - find_package(@PACKAGE_NAME@ COMPONENTS nothreads_shared) -# - find_package(@PACKAGE_NAME@ COMPONENTS static) -# - find_package(@PACKAGE_NAME@ COMPONENTS shared) -if (NOT DEFINED @PACKAGE_PREFIX@_SHARED) - if (DEFINED @PACKAGE_NAME@_SHARED) - set (@PACKAGE_PREFIX@_SHARED ${@PACKAGE_NAME@_SHARED}) - elseif (@PACKAGE_NAME@_FIND_COMPONENT) - if (@PACKAGE_NAME@_FIND_COMPONENT MATCHES "shared") - set (@PACKAGE_PREFIX@_SHARED TRUE) - else () - set (@PACKAGE_PREFIX@_SHARED FALSE) - endif () - elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_shared) - set (@PACKAGE_PREFIX@_SHARED TRUE) - else () - set (@PACKAGE_PREFIX@_SHARED FALSE) - endif () -endif () -if (NOT DEFINED @PACKAGE_PREFIX@_NOTHREADS) - if (DEFINED @PACKAGE_NAME@_NOTHREADS) - set (@PACKAGE_PREFIX@_NOTHREADS ${@PACKAGE_NAME@_NOTHREADS}) - elseif (@PACKAGE_NAME@_FIND_COMPONENT) - if (@PACKAGE_NAME@_FIND_COMPONENT MATCHES "nothreads") - set (@PACKAGE_PREFIX@_NOTHREADS TRUE) - else () - set (@PACKAGE_PREFIX@_NOTHREADS FALSE) - endif () - elseif (TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}PACKAGE_NAME@_static OR TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared) - set (@PACKAGE_PREFIX@_NOTHREADS FALSE) - else () - set (@PACKAGE_PREFIX@_NOTHREADS TRUE) - endif () -endif () - -# choose imported library target -if (NOT @PACKAGE_PREFIX@_TARGET) - if (@PACKAGE_NAME@_TARGET) - set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_NAME@_TARGET}) - elseif (@PACKAGE_PREFIX@_SHARED) - if (@PACKAGE_PREFIX@_NOTHREADS) - set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_shared) - else () - set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_shared) - endif () - else () - if (@PACKAGE_PREFIX@_NOTHREADS) - set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_nothreads_static) - else () - set (@PACKAGE_PREFIX@_TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@_static) - endif () - endif () -endif () -if (NOT TARGET ${@PACKAGE_PREFIX@_TARGET}) - message (FATAL_ERROR "Your @PACKAGE_NAME@ installation does not contain a ${@PACKAGE_PREFIX@_TARGET} library target!" - " Try a different combination of @PACKAGE_PREFIX@_SHARED and @PACKAGE_PREFIX@_NOTHREADS.") -endif () - -# add more convenient "${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@" import target -if (NOT TARGET ${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@) - if (@PACKAGE_PREFIX@_SHARED) - add_library (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ SHARED IMPORTED) - else () - add_library (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ STATIC IMPORTED) - endif () - # copy INTERFACE_* properties - foreach (_@PACKAGE_PREFIX@_PROPERTY_NAME IN ITEMS - COMPILE_DEFINITIONS - COMPILE_FEATURES - COMPILE_OPTIONS - INCLUDE_DIRECTORIES - LINK_LIBRARIES - POSITION_INDEPENDENT_CODE - ) - get_target_property (_@PACKAGE_PREFIX@_PROPERTY_VALUE ${@PACKAGE_PREFIX@_TARGET} INTERFACE_${_@PACKAGE_PREFIX@_PROPERTY_NAME}) - if (_@PACKAGE_PREFIX@_PROPERTY_VALUE) - set_target_properties(${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES - INTERFACE_${_@PACKAGE_PREFIX@_PROPERTY_NAME} "${_@PACKAGE_PREFIX@_PROPERTY_VALUE}" - ) - endif () - endforeach () - # copy IMPORTED_*_ properties - get_target_property (_@PACKAGE_PREFIX@_CONFIGURATIONS ${@PACKAGE_PREFIX@_TARGET} IMPORTED_CONFIGURATIONS) - set_target_properties (${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES IMPORTED_CONFIGURATIONS "${_@PACKAGE_PREFIX@_CONFIGURATIONS}") - foreach (_@PACKAGE_PREFIX@_PROPERTY_NAME IN ITEMS - IMPLIB - LOCATION - LINK_DEPENDENT_LIBRARIES - LINK_INTERFACE_LIBRARIES - LINK_INTERFACE_LANGUAGES - LINK_INTERFACE_MULTIPLICITY - NO_SONAME - SONAME - ) - foreach (_@PACKAGE_PREFIX@_CONFIG IN LISTS _@PACKAGE_PREFIX@_CONFIGURATIONS) - get_target_property (_@PACKAGE_PREFIX@_PROPERTY_VALUE ${@PACKAGE_PREFIX@_TARGET} IMPORTED_${_@PACKAGE_PREFIX@_PROPERTY_NAME}_${_@PACKAGE_PREFIX@_CONFIG}) - if (_@PACKAGE_PREFIX@_PROPERTY_VALUE) - set_target_properties(${@PACKAGE_PREFIX@_TARGET_PREFIX}@PACKAGE_NAME@ PROPERTIES - IMPORTED_${_@PACKAGE_PREFIX@_PROPERTY_NAME}_${_@PACKAGE_PREFIX@_CONFIG} "${_@PACKAGE_PREFIX@_PROPERTY_VALUE}" - ) - endif () - endforeach () - endforeach () - unset (_@PACKAGE_PREFIX@_CONFIGURATIONS) - unset (_@PACKAGE_PREFIX@_CONFIG) - unset (_@PACKAGE_PREFIX@_PROPERTY_NAME) - unset (_@PACKAGE_PREFIX@_PROPERTY_VALUE) -endif () - -# alias for default import target to be compatible with older CMake package configurations -set (@PACKAGE_PREFIX@_LIBRARIES "${@PACKAGE_PREFIX@_TARGET}") - -# set @PACKAGE_NAME@_* variables for backwards compatibility -if (NOT "^@PACKAGE_NAME@$" STREQUAL "^@PACKAGE_PREFIX@$") - foreach (_@PACKAGE_PREFIX@_VARIABLE IN ITEMS - VERSION_STRING - VERSION_MAJOR - VERSION_MINOR - VERSION_PATCH - INCLUDE_DIR - LIBRARIES - TARGET - ) - set (@PACKAGE_NAME@_${_@PACKAGE_PREFIX@_VARIABLE} "${@PACKAGE_PREFIX@_${_@PACKAGE_PREFIX@_VARIABLE}}") - endforeach () - unset (_@PACKAGE_PREFIX@_VARIABLE) -endif () - -# unset private variables -unset (@PACKAGE_NAME@_FIND_COMPONENT) -unset (_INSTALL_PREFIX) diff --git a/demos/thirdparty/gflags/cmake/execute_test.cmake b/demos/thirdparty/gflags/cmake/execute_test.cmake deleted file mode 100644 index df008cf465e..00000000000 --- a/demos/thirdparty/gflags/cmake/execute_test.cmake +++ /dev/null @@ -1,53 +0,0 @@ -# ---------------------------------------------------------------------------- -# sanitize string stored in variable for use in regular expression. -macro (sanitize_for_regex STRVAR) - string (REGEX REPLACE "([.+*?^$()])" "\\\\\\1" ${STRVAR} "${${STRVAR}}") -endmacro () - -# ---------------------------------------------------------------------------- -# script arguments -if (NOT COMMAND) - message (FATAL_ERROR "Test command not specified!") -endif () -if (NOT DEFINED EXPECTED_RC) - set (EXPECTED_RC 0) -endif () -if (EXPECTED_OUTPUT) - sanitize_for_regex(EXPECTED_OUTPUT) -endif () -if (UNEXPECTED_OUTPUT) - sanitize_for_regex(UNEXPECTED_OUTPUT) -endif () - -# ---------------------------------------------------------------------------- -# set a few environment variables (useful for --tryfromenv) -set (ENV{FLAGS_undefok} "foo,bar") -set (ENV{FLAGS_weirdo} "") -set (ENV{FLAGS_version} "true") -set (ENV{FLAGS_help} "false") - -# ---------------------------------------------------------------------------- -# execute test command -execute_process( - COMMAND ${COMMAND} - RESULT_VARIABLE RC - OUTPUT_VARIABLE OUTPUT - ERROR_VARIABLE OUTPUT -) - -if (OUTPUT) - message ("${OUTPUT}") -endif () - -# ---------------------------------------------------------------------------- -# check test result -if (NOT RC EQUAL EXPECTED_RC) - string (REPLACE ";" " " COMMAND "${COMMAND}") - message (FATAL_ERROR "Command:\n\t${COMMAND}\nExit status is ${RC}, expected ${EXPECTED_RC}") -endif () -if (EXPECTED_OUTPUT AND NOT OUTPUT MATCHES "${EXPECTED_OUTPUT}") - message (FATAL_ERROR "Test output does not match expected output: ${EXPECTED_OUTPUT}") -endif () -if (UNEXPECTED_OUTPUT AND OUTPUT MATCHES "${UNEXPECTED_OUTPUT}") - message (FATAL_ERROR "Test output matches unexpected output: ${UNEXPECTED_OUTPUT}") -endif () \ No newline at end of file diff --git a/demos/thirdparty/gflags/cmake/package.cmake.in b/demos/thirdparty/gflags/cmake/package.cmake.in deleted file mode 100644 index aaec7925e34..00000000000 --- a/demos/thirdparty/gflags/cmake/package.cmake.in +++ /dev/null @@ -1,49 +0,0 @@ -# Per-generator CPack configuration file. See CPACK_PROJECT_CONFIG_FILE documented at -# http://www.cmake.org/cmake/help/v2.8.12/cpack.html#variable:CPACK_PROJECT_CONFIG_FILE -# -# All common CPACK_* variables are set in CMakeLists.txt already. This file only -# overrides some of these to provide package generator specific settings. - -# whether package contains all development files or only runtime files -set (DEVEL @INSTALL_HEADERS@) - -# ------------------------------------------------------------------------------ -# Mac OS X package -if (CPACK_GENERATOR MATCHES "PackageMaker|DragNDrop") - - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") - if (DEVEL) - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-devel") - endif () - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_VERSION}") - -# ------------------------------------------------------------------------------ -# Debian package -elseif (CPACK_GENERATOR MATCHES "DEB") - - set (CPACK_PACKAGE_FILE_NAME "lib${CPACK_PACKAGE_NAME}") - if (DEVEL) - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-dev") - else () - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}0") - endif () - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_${CPACK_PACKAGE_VERSION}-1_${CPACK_PACKAGE_ARCHITECTURE}") - - set (CPACK_DEBIAN_PACKAGE_DEPENDS) - set (CPACK_DEBIAN_PACKAGE_SECTION "devel") - set (CPACK_DEBIAN_PACKAGE_PRIORITY "optional") - set (CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_RPM_PACKAGE_URL}") - set (CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}") - set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_PACKAGE_ARCHITECTURE}") - -# ------------------------------------------------------------------------------ -# RPM package -elseif (CPACK_GENERATOR MATCHES "RPM") - - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") - if (DEVEL) - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-devel") - endif () - set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_VERSION}-1.${CPACK_PACKAGE_ARCHITECTURE}") - -endif () diff --git a/demos/thirdparty/gflags/cmake/package.pc.in b/demos/thirdparty/gflags/cmake/package.pc.in deleted file mode 100644 index 80df818eba3..00000000000 --- a/demos/thirdparty/gflags/cmake/package.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -bindir=${prefix}/@RUNTIME_INSTALL_DIR@ -libdir=${prefix}/@LIBRARY_INSTALL_DIR@ -includedir=${prefix}/@INCLUDE_INSTALL_DIR@ - -Name: @PACKAGE_NAME@ -Version: @PACKAGE_VERSION@ -Description: @PACKAGE_DESCRIPTION@ -URL: @PACKAGE_URL@ -Requires: -Libs: -L${libdir} -lgflags -Libs.private: -lpthread -Cflags: -I${includedir} diff --git a/demos/thirdparty/gflags/cmake/utils.cmake b/demos/thirdparty/gflags/cmake/utils.cmake deleted file mode 100644 index d039e5c8831..00000000000 --- a/demos/thirdparty/gflags/cmake/utils.cmake +++ /dev/null @@ -1,205 +0,0 @@ -## Utility CMake functions. - -# ---------------------------------------------------------------------------- -## Convert boolean value to 0 or 1 -macro (bool_to_int VAR) - if (${VAR}) - set (${VAR} 1) - else () - set (${VAR} 0) - endif () -endmacro () - -# ---------------------------------------------------------------------------- -## Extract version numbers from version string -function (version_numbers version major minor patch) - if (version MATCHES "([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(rc[1-9][0-9]*|[a-z]+)?") - if (CMAKE_MATCH_1) - set (_major ${CMAKE_MATCH_1}) - else () - set (_major 0) - endif () - if (CMAKE_MATCH_2) - set (_minor ${CMAKE_MATCH_2}) - string (REGEX REPLACE "^\\." "" _minor "${_minor}") - else () - set (_minor 0) - endif () - if (CMAKE_MATCH_3) - set (_patch ${CMAKE_MATCH_3}) - string (REGEX REPLACE "^\\." "" _patch "${_patch}") - else () - set (_patch 0) - endif () - else () - set (_major 0) - set (_minor 0) - set (_patch 0) - endif () - set ("${major}" "${_major}" PARENT_SCOPE) - set ("${minor}" "${_minor}" PARENT_SCOPE) - set ("${patch}" "${_patch}" PARENT_SCOPE) -endfunction () - -# ---------------------------------------------------------------------------- -## Determine if cache entry exists -macro (gflags_is_cached retvar varname) - if (DEFINED ${varname}) - get_property (${retvar} CACHE ${varname} PROPERTY TYPE SET) - else () - set (${retvar} FALSE) - endif () -endmacro () - -# ---------------------------------------------------------------------------- -## Add gflags configuration variable -# -# The default value of the (cached) configuration value can be overridden either -# on the CMake command-line or the super-project by setting the GFLAGS_ -# variable. When gflags is a subproject of another project (GFLAGS_IS_SUBPROJECT), -# the variable is not added to the CMake cache. Otherwise it is cached. -macro (gflags_define type varname docstring default) - # note that ARGC must be expanded here, as it is not a "real" variable - # (see the CMake documentation for the macro command) - if ("${ARGC}" GREATER 5) - message (FATAL_ERROR "gflags_variable: Too many macro arguments") - endif () - if (NOT DEFINED GFLAGS_${varname}) - if (GFLAGS_IS_SUBPROJECT AND "${ARGC}" EQUAL 5) - set (GFLAGS_${varname} "${ARGV4}") - else () - set (GFLAGS_${varname} "${default}") - endif () - endif () - if (GFLAGS_IS_SUBPROJECT) - if (NOT DEFINED ${varname}) - set (${varname} "${GFLAGS_${varname}}") - endif () - else () - set (${varname} "${GFLAGS_${varname}}" CACHE ${type} "${docstring}") - endif () -endmacro () - -# ---------------------------------------------------------------------------- -## Set property of cached gflags configuration variable -macro (gflags_property varname property value) - gflags_is_cached (_cached ${varname}) - if (_cached) - # note that property must be expanded here, as it is not a "real" variable - # (see the CMake documentation for the macro command) - if ("${property}" STREQUAL "ADVANCED") - if (${value}) - mark_as_advanced (FORCE ${varname}) - else () - mark_as_advanced (CLEAR ${varname}) - endif () - else () - set_property (CACHE ${varname} PROPERTY "${property}" "${value}") - endif () - endif () - unset (_cached) -endmacro () - -# ---------------------------------------------------------------------------- -## Modify value of gflags configuration variable -macro (gflags_set varname value) - gflags_is_cached (_cached ${varname}) - if (_cached) - set_property (CACHE ${varname} PROPERTY VALUE "${value}") - else () - set (${varname} "${value}") - endif () - unset (_cached) -endmacro () - -# ---------------------------------------------------------------------------- -## Configure public header files -function (configure_headers out) - set (tmp) - foreach (src IN LISTS ARGN) - if (IS_ABSOLUTE "${src}") - list (APPEND tmp "${src}") - elseif (EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in") - configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" @ONLY) - list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}") - else () - configure_file ("${PROJECT_SOURCE_DIR}/src/${src}" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" COPYONLY) - list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}") - endif () - endforeach () - set (${out} "${tmp}" PARENT_SCOPE) -endfunction () - -# ---------------------------------------------------------------------------- -## Configure source files with .in suffix -function (configure_sources out) - set (tmp) - foreach (src IN LISTS ARGN) - if (src MATCHES ".h$" AND EXISTS "${PROJECT_SOURCE_DIR}/src/${src}.in") - configure_file ("${PROJECT_SOURCE_DIR}/src/${src}.in" "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}" @ONLY) - list (APPEND tmp "${PROJECT_BINARY_DIR}/include/${GFLAGS_INCLUDE_DIR}/${src}") - else () - list (APPEND tmp "${PROJECT_SOURCE_DIR}/src/${src}") - endif () - endforeach () - set (${out} "${tmp}" PARENT_SCOPE) -endfunction () - -# ---------------------------------------------------------------------------- -## Add usage test -# -# Using PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION would -# do as well, but CMake/CTest does not allow us to specify an -# expected exit status. Moreover, the execute_test.cmake script -# sets environment variables needed by the --fromenv/--tryfromenv tests. -macro (add_gflags_test name expected_rc expected_output unexpected_output cmd) - set (args "--test_tmpdir=${PROJECT_BINARY_DIR}/Testing/Temporary" - "--srcdir=${PROJECT_SOURCE_DIR}/test") - add_test ( - NAME ${name} - COMMAND "${CMAKE_COMMAND}" "-DCOMMAND:STRING=$;${args};${ARGN}" - "-DEXPECTED_RC:STRING=${expected_rc}" - "-DEXPECTED_OUTPUT:STRING=${expected_output}" - "-DUNEXPECTED_OUTPUT:STRING=${unexpected_output}" - -P "${PROJECT_SOURCE_DIR}/cmake/execute_test.cmake" - WORKING_DIRECTORY "${GFLAGS_FLAGFILES_DIR}" - ) -endmacro () - -# ------------------------------------------------------------------------------ -## Register installed package with CMake -# -# This function adds an entry to the CMake registry for packages with the -# path of the directory where the package configuration file of the installed -# package is located in order to help CMake find the package in a custom -# installation prefix. This differs from CMake's export(PACKAGE) command -# which registers the build directory instead. -function (register_gflags_package CONFIG_DIR) - if (NOT IS_ABSOLUTE "${CONFIG_DIR}") - set (CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${CONFIG_DIR}") - endif () - string (MD5 REGISTRY_ENTRY "${CONFIG_DIR}") - if (WIN32) - install (CODE - "execute_process ( - COMMAND reg add \"HKCU\\\\Software\\\\Kitware\\\\CMake\\\\Packages\\\\${PACKAGE_NAME}\" /v \"${REGISTRY_ENTRY}\" /d \"${CONFIG_DIR}\" /t REG_SZ /f - RESULT_VARIABLE RT - ERROR_VARIABLE ERR - OUTPUT_QUIET - ) - if (RT EQUAL 0) - message (STATUS \"Register: Added HKEY_CURRENT_USER\\\\Software\\\\Kitware\\\\CMake\\\\Packages\\\\${PACKAGE_NAME}\\\\${REGISTRY_ENTRY}\") - else () - string (STRIP \"\${ERR}\" ERR) - message (STATUS \"Register: Failed to add registry entry: \${ERR}\") - endif ()" - ) - elseif (IS_DIRECTORY "$ENV{HOME}") - file (WRITE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-registry-entry" "${CONFIG_DIR}") - install ( - FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-registry-entry" - DESTINATION "$ENV{HOME}/.cmake/packages/${PACKAGE_NAME}" - RENAME "${REGISTRY_ENTRY}" - ) - endif () -endfunction () diff --git a/demos/thirdparty/gflags/cmake/version.cmake.in b/demos/thirdparty/gflags/cmake/version.cmake.in deleted file mode 100644 index 1e1af050d97..00000000000 --- a/demos/thirdparty/gflags/cmake/version.cmake.in +++ /dev/null @@ -1,21 +0,0 @@ -## gflags CMake configuration version file - -# ----------------------------------------------------------------------------- -# library version -set (PACKAGE_VERSION "@PACKAGE_VERSION@") - -# ----------------------------------------------------------------------------- -# check compatibility - -# Perform compatibility check here using the input CMake variables. -# See example in http://www.cmake.org/Wiki/CMake_2.6_Notes. - -set (PACKAGE_VERSION_COMPATIBLE TRUE) -set (PACKAGE_VERSION_UNSUITABLE FALSE) - -if ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@PACKAGE_VERSION_MAJOR@" AND - "${PACKAGE_FIND_VERSION_MINOR}" EQUAL "@PACKAGE_VERSION_MINOR@") - set (PACKAGE_VERSION_EXACT TRUE) -else () - set (PACKAGE_VERSION_EXACT FALSE) -endif () diff --git a/demos/thirdparty/gflags/src/config.h b/demos/thirdparty/gflags/src/config.h deleted file mode 100644 index c33d207c7f3..00000000000 --- a/demos/thirdparty/gflags/src/config.h +++ /dev/null @@ -1,59 +0,0 @@ -// Note: This header file is only used internally. It is not part of public interface! - -#ifndef GFLAGS_CONFIG_H_ -#define GFLAGS_CONFIG_H_ - - -// --------------------------------------------------------------------------- -// System checks - -// CMake build configuration is written to defines.h file, unused by Bazel build -#if !defined(GFLAGS_BAZEL_BUILD) -# include "defines.h" -#endif - -// gcc requires this to get PRId64, etc. -#if defined(HAVE_INTTYPES_H) && !defined(__STDC_FORMAT_MACROS) -# define __STDC_FORMAT_MACROS 1 -#endif - -// --------------------------------------------------------------------------- -// Path separator -#ifndef PATH_SEPARATOR -# ifdef OS_WINDOWS -# define PATH_SEPARATOR '\\' -# else -# define PATH_SEPARATOR '/' -# endif -#endif - -// --------------------------------------------------------------------------- -// Windows - -// Always export symbols when compiling a shared library as this file is only -// included by internal modules when building the gflags library itself. -// The gflags_declare.h header file will set it to import these symbols otherwise. -#ifndef GFLAGS_DLL_DECL -# if GFLAGS_IS_A_DLL && defined(_MSC_VER) -# define GFLAGS_DLL_DECL __declspec(dllexport) -# elif defined(__GNUC__) && __GNUC__ >= 4 -# define GFLAGS_DLL_DECL __attribute__((visibility("default"))) -# else -# define GFLAGS_DLL_DECL -# endif -#endif -// Flags defined by the gflags library itself must be exported -#ifndef GFLAGS_DLL_DEFINE_FLAG -# define GFLAGS_DLL_DEFINE_FLAG GFLAGS_DLL_DECL -#endif - -#ifdef OS_WINDOWS -// The unittests import the symbols of the shared gflags library -# if GFLAGS_IS_A_DLL && defined(_MSC_VER) -# define GFLAGS_DLL_DECL_FOR_UNITTESTS __declspec(dllimport) -# endif -# include "windows_port.h" -#endif - - -#endif // GFLAGS_CONFIG_H_ diff --git a/demos/thirdparty/gflags/src/defines.h.in b/demos/thirdparty/gflags/src/defines.h.in deleted file mode 100644 index dfb214edb9f..00000000000 --- a/demos/thirdparty/gflags/src/defines.h.in +++ /dev/null @@ -1,48 +0,0 @@ -/* Generated from defines.h.in during build configuration using CMake. */ - -// Note: This header file is only used internally. It is not part of public interface! -// Any cmakedefine is defined using the -D flag instead when Bazel is used. -// For Bazel, this file is thus not used to avoid a private file in $(GENDIR). - -#ifndef GFLAGS_DEFINES_H_ -#define GFLAGS_DEFINES_H_ - - -// Define if you build this library for a MS Windows OS. -#cmakedefine OS_WINDOWS - -// Define if you have the header file. -#cmakedefine HAVE_STDINT_H - -// Define if you have the header file. -#cmakedefine HAVE_SYS_TYPES_H - -// Define if you have the header file. -#cmakedefine HAVE_INTTYPES_H - -// Define if you have the header file. -#cmakedefine HAVE_SYS_STAT_H - -// Define if you have the header file. -#cmakedefine HAVE_UNISTD_H - -// Define if you have the header file. -#cmakedefine HAVE_FNMATCH_H - -// Define if you have the header file (Windows 2000/XP). -#cmakedefine HAVE_SHLWAPI_H - -// Define if you have the strtoll function. -#cmakedefine HAVE_STRTOLL - -// Define if you have the strtoq function. -#cmakedefine HAVE_STRTOQ - -// Define if you have the header file. -#cmakedefine HAVE_PTHREAD - -// Define if your pthread library defines the type pthread_rwlock_t -#cmakedefine HAVE_RWLOCK - - -#endif // GFLAGS_DEFINES_H_ diff --git a/demos/thirdparty/gflags/src/gflags.cc b/demos/thirdparty/gflags/src/gflags.cc deleted file mode 100644 index 8f5aa0babb3..00000000000 --- a/demos/thirdparty/gflags/src/gflags.cc +++ /dev/null @@ -1,2013 +0,0 @@ -// Copyright (c) 1999, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// Revamped and reorganized by Craig Silverstein -// -// This file contains the implementation of all our command line flags -// stuff. Here's how everything fits together -// -// * FlagRegistry owns CommandLineFlags owns FlagValue. -// * FlagSaver holds a FlagRegistry (saves it at construct time, -// restores it at destroy time). -// * CommandLineFlagParser lives outside that hierarchy, but works on -// CommandLineFlags (modifying the FlagValues). -// * Free functions like SetCommandLineOption() work via one of the -// above (such as CommandLineFlagParser). -// -// In more detail: -// -// -- The main classes that hold flag data: -// -// FlagValue holds the current value of a flag. It's -// pseudo-templatized: every operation on a FlagValue is typed. It -// also deals with storage-lifetime issues (so flag values don't go -// away in a destructor), which is why we need a whole class to hold a -// variable's value. -// -// CommandLineFlag is all the information about a single command-line -// flag. It has a FlagValue for the flag's current value, but also -// the flag's name, type, etc. -// -// FlagRegistry is a collection of CommandLineFlags. There's the -// global registry, which is where flags defined via DEFINE_foo() -// live. But it's possible to define your own flag, manually, in a -// different registry you create. (In practice, multiple registries -// are used only by FlagSaver). -// -// A given FlagValue is owned by exactly one CommandLineFlag. A given -// CommandLineFlag is owned by exactly one FlagRegistry. FlagRegistry -// has a lock; any operation that writes to a FlagValue or -// CommandLineFlag owned by that registry must acquire the -// FlagRegistry lock before doing so. -// -// --- Some other classes and free functions: -// -// CommandLineFlagInfo is a client-exposed version of CommandLineFlag. -// Once it's instantiated, it has no dependencies or relationships -// with any other part of this file. -// -// FlagRegisterer is the helper class used by the DEFINE_* macros to -// allow work to be done at global initialization time. -// -// CommandLineFlagParser is the class that reads from the commandline -// and instantiates flag values based on that. It needs to poke into -// the innards of the FlagValue->CommandLineFlag->FlagRegistry class -// hierarchy to do that. It's careful to acquire the FlagRegistry -// lock before doing any writing or other non-const actions. -// -// GetCommandLineOption is just a hook into registry routines to -// retrieve a flag based on its name. SetCommandLineOption, on the -// other hand, hooks into CommandLineFlagParser. Other API functions -// are, similarly, mostly hooks into the functionality described above. - -#include "config.h" -#include "gflags/gflags.h" - -#include -#include -#include -#if defined(HAVE_FNMATCH_H) -# include -#elif defined(HAVE_SHLWAPI_H) -# define NO_SHLWAPI_ISOS -# include -#endif -#include // For va_list and related operations -#include -#include - -#include -#include -#include -#include // for pair<> -#include - -#include "mutex.h" -#include "util.h" - -using namespace MUTEX_NAMESPACE; - - -// Special flags, type 1: the 'recursive' flags. They set another flag's val. -DEFINE_string(flagfile, "", "load flags from file"); -DEFINE_string(fromenv, "", "set flags from the environment" - " [use 'export FLAGS_flag1=value']"); -DEFINE_string(tryfromenv, "", "set flags from the environment if present"); - -// Special flags, type 2: the 'parsing' flags. They modify how we parse. -DEFINE_string(undefok, "", "comma-separated list of flag names that it is okay to specify " - "on the command line even if the program does not define a flag " - "with that name. IMPORTANT: flags in this list that have " - "arguments MUST use the flag=value format"); - -namespace GFLAGS_NAMESPACE { - -using std::map; -using std::pair; -using std::sort; -using std::string; -using std::vector; - -// This is used by the unittest to test error-exit code -void GFLAGS_DLL_DECL (*gflags_exitfunc)(int) = &exit; // from stdlib.h - - -// The help message indicating that the commandline flag has been -// 'stripped'. It will not show up when doing "-help" and its -// variants. The flag is stripped if STRIP_FLAG_HELP is set to 1 -// before including base/gflags.h - -// This is used by this file, and also in gflags_reporting.cc -const char kStrippedFlagHelp[] = "\001\002\003\004 (unknown) \004\003\002\001"; - -namespace { - -// There are also 'reporting' flags, in gflags_reporting.cc. - -static const char kError[] = "ERROR: "; - -// Indicates that undefined options are to be ignored. -// Enables deferred processing of flags in dynamically loaded libraries. -static bool allow_command_line_reparsing = false; - -static bool logging_is_probably_set_up = false; - -// This is a 'prototype' validate-function. 'Real' validate -// functions, take a flag-value as an argument: ValidateFn(bool) or -// ValidateFn(uint64). However, for easier storage, we strip off this -// argument and then restore it when actually calling the function on -// a flag value. -typedef bool (*ValidateFnProto)(); - -// Whether we should die when reporting an error. -enum DieWhenReporting { DIE, DO_NOT_DIE }; - -// Report Error and exit if requested. -static void ReportError(DieWhenReporting should_die, const char* format, ...) { - va_list ap; - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - fflush(stderr); // should be unnecessary, but cygwin's rxvt buffers stderr - if (should_die == DIE) gflags_exitfunc(1); -} - - -// -------------------------------------------------------------------- -// FlagValue -// This represent the value a single flag might have. The major -// functionality is to convert from a string to an object of a -// given type, and back. Thread-compatible. -// -------------------------------------------------------------------- - -class CommandLineFlag; -class FlagValue { - public: - enum ValueType { - FV_BOOL = 0, - FV_INT32 = 1, - FV_UINT32 = 2, - FV_INT64 = 3, - FV_UINT64 = 4, - FV_DOUBLE = 5, - FV_STRING = 6, - FV_MAX_INDEX = 6, - }; - - template - FlagValue(FlagType* valbuf, bool transfer_ownership_of_value); - ~FlagValue(); - - bool ParseFrom(const char* spec); - string ToString() const; - - ValueType Type() const { return static_cast(type_); } - - private: - friend class CommandLineFlag; // for many things, including Validate() - friend class GFLAGS_NAMESPACE::FlagSaverImpl; // calls New() - friend class FlagRegistry; // checks value_buffer_ for flags_by_ptr_ map - template friend T GetFromEnv(const char*, T); - friend bool TryParseLocked(const CommandLineFlag*, FlagValue*, - const char*, string*); // for New(), CopyFrom() - - template - struct FlagValueTraits; - - const char* TypeName() const; - bool Equal(const FlagValue& x) const; - FlagValue* New() const; // creates a new one with default value - void CopyFrom(const FlagValue& x); - - // Calls the given validate-fn on value_buffer_, and returns - // whatever it returns. But first casts validate_fn_proto to a - // function that takes our value as an argument (eg void - // (*validate_fn)(bool) for a bool flag). - bool Validate(const char* flagname, ValidateFnProto validate_fn_proto) const; - - void* const value_buffer_; // points to the buffer holding our data - const int8 type_; // how to interpret value_ - const bool owns_value_; // whether to free value on destruct - - FlagValue(const FlagValue&); // no copying! - void operator=(const FlagValue&); -}; - -// Map the given C++ type to a value of the ValueType enum at compile time. -#define DEFINE_FLAG_TRAITS(type, value) \ - template <> \ - struct FlagValue::FlagValueTraits { \ - static const ValueType kValueType = value; \ - } - -// Define full template specializations of the FlagValueTraits template -// for all supported flag types. -DEFINE_FLAG_TRAITS(bool, FV_BOOL); -DEFINE_FLAG_TRAITS(int32, FV_INT32); -DEFINE_FLAG_TRAITS(uint32, FV_UINT32); -DEFINE_FLAG_TRAITS(int64, FV_INT64); -DEFINE_FLAG_TRAITS(uint64, FV_UINT64); -DEFINE_FLAG_TRAITS(double, FV_DOUBLE); -DEFINE_FLAG_TRAITS(std::string, FV_STRING); - -#undef DEFINE_FLAG_TRAITS - - -// This could be a templated method of FlagValue, but doing so adds to the -// size of the .o. Since there's no type-safety here anyway, macro is ok. -#define VALUE_AS(type) *reinterpret_cast(value_buffer_) -#define OTHER_VALUE_AS(fv, type) *reinterpret_cast(fv.value_buffer_) -#define SET_VALUE_AS(type, value) VALUE_AS(type) = (value) - -template -FlagValue::FlagValue(FlagType* valbuf, - bool transfer_ownership_of_value) - : value_buffer_(valbuf), - type_(FlagValueTraits::kValueType), - owns_value_(transfer_ownership_of_value) { -} - -FlagValue::~FlagValue() { - if (!owns_value_) { - return; - } - switch (type_) { - case FV_BOOL: delete reinterpret_cast(value_buffer_); break; - case FV_INT32: delete reinterpret_cast(value_buffer_); break; - case FV_UINT32: delete reinterpret_cast(value_buffer_); break; - case FV_INT64: delete reinterpret_cast(value_buffer_); break; - case FV_UINT64: delete reinterpret_cast(value_buffer_); break; - case FV_DOUBLE: delete reinterpret_cast(value_buffer_); break; - case FV_STRING: delete reinterpret_cast(value_buffer_); break; - } -} - -bool FlagValue::ParseFrom(const char* value) { - if (type_ == FV_BOOL) { - const char* kTrue[] = { "1", "t", "true", "y", "yes" }; - const char* kFalse[] = { "0", "f", "false", "n", "no" }; - COMPILE_ASSERT(sizeof(kTrue) == sizeof(kFalse), true_false_equal); - for (size_t i = 0; i < sizeof(kTrue)/sizeof(*kTrue); ++i) { - if (strcasecmp(value, kTrue[i]) == 0) { - SET_VALUE_AS(bool, true); - return true; - } else if (strcasecmp(value, kFalse[i]) == 0) { - SET_VALUE_AS(bool, false); - return true; - } - } - return false; // didn't match a legal input - - } else if (type_ == FV_STRING) { - SET_VALUE_AS(string, value); - return true; - } - - // OK, it's likely to be numeric, and we'll be using a strtoXXX method. - if (value[0] == '\0') // empty-string is only allowed for string type. - return false; - char* end; - // Leading 0x puts us in base 16. But leading 0 does not put us in base 8! - // It caused too many bugs when we had that behavior. - int base = 10; // by default - if (value[0] == '0' && (value[1] == 'x' || value[1] == 'X')) - base = 16; - errno = 0; - - switch (type_) { - case FV_INT32: { - const int64 r = strto64(value, &end, base); - if (errno || end != value + strlen(value)) return false; // bad parse - if (static_cast(r) != r) // worked, but number out of range - return false; - SET_VALUE_AS(int32, static_cast(r)); - return true; - } - case FV_UINT32: { - while (*value == ' ') value++; - if (*value == '-') return false; // negative number - const uint64 r = strtou64(value, &end, base); - if (errno || end != value + strlen(value)) return false; // bad parse - if (static_cast(r) != r) // worked, but number out of range - return false; - SET_VALUE_AS(uint32, static_cast(r)); - return true; - } - case FV_INT64: { - const int64 r = strto64(value, &end, base); - if (errno || end != value + strlen(value)) return false; // bad parse - SET_VALUE_AS(int64, r); - return true; - } - case FV_UINT64: { - while (*value == ' ') value++; - if (*value == '-') return false; // negative number - const uint64 r = strtou64(value, &end, base); - if (errno || end != value + strlen(value)) return false; // bad parse - SET_VALUE_AS(uint64, r); - return true; - } - case FV_DOUBLE: { - const double r = strtod(value, &end); - if (errno || end != value + strlen(value)) return false; // bad parse - SET_VALUE_AS(double, r); - return true; - } - default: { - assert(false); // unknown type - return false; - } - } -} - -string FlagValue::ToString() const { - char intbuf[64]; // enough to hold even the biggest number - switch (type_) { - case FV_BOOL: - return VALUE_AS(bool) ? "true" : "false"; - case FV_INT32: - snprintf(intbuf, sizeof(intbuf), "%" PRId32, VALUE_AS(int32)); - return intbuf; - case FV_UINT32: - snprintf(intbuf, sizeof(intbuf), "%" PRIu32, VALUE_AS(uint32)); - return intbuf; - case FV_INT64: - snprintf(intbuf, sizeof(intbuf), "%" PRId64, VALUE_AS(int64)); - return intbuf; - case FV_UINT64: - snprintf(intbuf, sizeof(intbuf), "%" PRIu64, VALUE_AS(uint64)); - return intbuf; - case FV_DOUBLE: - snprintf(intbuf, sizeof(intbuf), "%.17g", VALUE_AS(double)); - return intbuf; - case FV_STRING: - return VALUE_AS(string); - default: - assert(false); - return ""; // unknown type - } -} - -bool FlagValue::Validate(const char* flagname, - ValidateFnProto validate_fn_proto) const { - switch (type_) { - case FV_BOOL: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(bool)); - case FV_INT32: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(int32)); - case FV_UINT32: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(uint32)); - case FV_INT64: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(int64)); - case FV_UINT64: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(uint64)); - case FV_DOUBLE: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(double)); - case FV_STRING: - return reinterpret_cast( - validate_fn_proto)(flagname, VALUE_AS(string)); - default: - assert(false); // unknown type - return false; - } -} - -const char* FlagValue::TypeName() const { - static const char types[] = - "bool\0xx" - "int32\0x" - "uint32\0" - "int64\0x" - "uint64\0" - "double\0" - "string"; - if (type_ > FV_MAX_INDEX) { - assert(false); - return ""; - } - // Directly indexing the strings in the 'types' string, each of them is 7 bytes long. - return &types[type_ * 7]; -} - -bool FlagValue::Equal(const FlagValue& x) const { - if (type_ != x.type_) - return false; - switch (type_) { - case FV_BOOL: return VALUE_AS(bool) == OTHER_VALUE_AS(x, bool); - case FV_INT32: return VALUE_AS(int32) == OTHER_VALUE_AS(x, int32); - case FV_UINT32: return VALUE_AS(uint32) == OTHER_VALUE_AS(x, uint32); - case FV_INT64: return VALUE_AS(int64) == OTHER_VALUE_AS(x, int64); - case FV_UINT64: return VALUE_AS(uint64) == OTHER_VALUE_AS(x, uint64); - case FV_DOUBLE: return VALUE_AS(double) == OTHER_VALUE_AS(x, double); - case FV_STRING: return VALUE_AS(string) == OTHER_VALUE_AS(x, string); - default: assert(false); return false; // unknown type - } -} - -FlagValue* FlagValue::New() const { - switch (type_) { - case FV_BOOL: return new FlagValue(new bool(false), true); - case FV_INT32: return new FlagValue(new int32(0), true); - case FV_UINT32: return new FlagValue(new uint32(0), true); - case FV_INT64: return new FlagValue(new int64(0), true); - case FV_UINT64: return new FlagValue(new uint64(0), true); - case FV_DOUBLE: return new FlagValue(new double(0.0), true); - case FV_STRING: return new FlagValue(new string, true); - default: assert(false); return NULL; // unknown type - } -} - -void FlagValue::CopyFrom(const FlagValue& x) { - assert(type_ == x.type_); - switch (type_) { - case FV_BOOL: SET_VALUE_AS(bool, OTHER_VALUE_AS(x, bool)); break; - case FV_INT32: SET_VALUE_AS(int32, OTHER_VALUE_AS(x, int32)); break; - case FV_UINT32: SET_VALUE_AS(uint32, OTHER_VALUE_AS(x, uint32)); break; - case FV_INT64: SET_VALUE_AS(int64, OTHER_VALUE_AS(x, int64)); break; - case FV_UINT64: SET_VALUE_AS(uint64, OTHER_VALUE_AS(x, uint64)); break; - case FV_DOUBLE: SET_VALUE_AS(double, OTHER_VALUE_AS(x, double)); break; - case FV_STRING: SET_VALUE_AS(string, OTHER_VALUE_AS(x, string)); break; - default: assert(false); // unknown type - } -} - -// -------------------------------------------------------------------- -// CommandLineFlag -// This represents a single flag, including its name, description, -// default value, and current value. Mostly this serves as a -// struct, though it also knows how to register itself. -// All CommandLineFlags are owned by a (exactly one) -// FlagRegistry. If you wish to modify fields in this class, you -// should acquire the FlagRegistry lock for the registry that owns -// this flag. -// -------------------------------------------------------------------- - -class CommandLineFlag { - public: - // Note: we take over memory-ownership of current_val and default_val. - CommandLineFlag(const char* name, const char* help, const char* filename, - FlagValue* current_val, FlagValue* default_val); - ~CommandLineFlag(); - - const char* name() const { return name_; } - const char* help() const { return help_; } - const char* filename() const { return file_; } - const char* CleanFileName() const; // nixes irrelevant prefix such as homedir - string current_value() const { return current_->ToString(); } - string default_value() const { return defvalue_->ToString(); } - const char* type_name() const { return defvalue_->TypeName(); } - ValidateFnProto validate_function() const { return validate_fn_proto_; } - const void* flag_ptr() const { return current_->value_buffer_; } - - FlagValue::ValueType Type() const { return defvalue_->Type(); } - - void FillCommandLineFlagInfo(struct CommandLineFlagInfo* result); - - // If validate_fn_proto_ is non-NULL, calls it on value, returns result. - bool Validate(const FlagValue& value) const; - bool ValidateCurrent() const { return Validate(*current_); } - bool Modified() const { return modified_; } - - private: - // for SetFlagLocked() and setting flags_by_ptr_ - friend class FlagRegistry; - friend class GFLAGS_NAMESPACE::FlagSaverImpl; // for cloning the values - // set validate_fn - friend bool AddFlagValidator(const void*, ValidateFnProto); - - // This copies all the non-const members: modified, processed, defvalue, etc. - void CopyFrom(const CommandLineFlag& src); - - void UpdateModifiedBit(); - - const char* const name_; // Flag name - const char* const help_; // Help message - const char* const file_; // Which file did this come from? - bool modified_; // Set after default assignment? - FlagValue* defvalue_; // Default value for flag - FlagValue* current_; // Current value for flag - // This is a casted, 'generic' version of validate_fn, which actually - // takes a flag-value as an arg (void (*validate_fn)(bool), say). - // When we pass this to current_->Validate(), it will cast it back to - // the proper type. This may be NULL to mean we have no validate_fn. - ValidateFnProto validate_fn_proto_; - - CommandLineFlag(const CommandLineFlag&); // no copying! - void operator=(const CommandLineFlag&); -}; - -CommandLineFlag::CommandLineFlag(const char* name, const char* help, - const char* filename, - FlagValue* current_val, FlagValue* default_val) - : name_(name), help_(help), file_(filename), modified_(false), - defvalue_(default_val), current_(current_val), validate_fn_proto_(NULL) { -} - -CommandLineFlag::~CommandLineFlag() { - delete current_; - delete defvalue_; -} - -const char* CommandLineFlag::CleanFileName() const { - // This function has been used to strip off a common prefix from - // flag source file names. Because flags can be defined in different - // shared libraries, there may not be a single common prefix. - // Further, this functionality hasn't been active for many years. - // Need a better way to produce more user friendly help output or - // "anonymize" file paths in help output, respectively. - // Follow issue at: https://github.com/gflags/gflags/issues/86 - return filename(); -} - -void CommandLineFlag::FillCommandLineFlagInfo( - CommandLineFlagInfo* result) { - result->name = name(); - result->type = type_name(); - result->description = help(); - result->current_value = current_value(); - result->default_value = default_value(); - result->filename = CleanFileName(); - UpdateModifiedBit(); - result->is_default = !modified_; - result->has_validator_fn = validate_function() != NULL; - result->flag_ptr = flag_ptr(); -} - -void CommandLineFlag::UpdateModifiedBit() { - // Update the "modified" bit in case somebody bypassed the - // Flags API and wrote directly through the FLAGS_name variable. - if (!modified_ && !current_->Equal(*defvalue_)) { - modified_ = true; - } -} - -void CommandLineFlag::CopyFrom(const CommandLineFlag& src) { - // Note we only copy the non-const members; others are fixed at construct time - if (modified_ != src.modified_) modified_ = src.modified_; - if (!current_->Equal(*src.current_)) current_->CopyFrom(*src.current_); - if (!defvalue_->Equal(*src.defvalue_)) defvalue_->CopyFrom(*src.defvalue_); - if (validate_fn_proto_ != src.validate_fn_proto_) - validate_fn_proto_ = src.validate_fn_proto_; -} - -bool CommandLineFlag::Validate(const FlagValue& value) const { - - if (validate_function() == NULL) - return true; - else - return value.Validate(name(), validate_function()); -} - - -// -------------------------------------------------------------------- -// FlagRegistry -// A FlagRegistry singleton object holds all flag objects indexed -// by their names so that if you know a flag's name (as a C -// string), you can access or set it. If the function is named -// FooLocked(), you must own the registry lock before calling -// the function; otherwise, you should *not* hold the lock, and -// the function will acquire it itself if needed. -// -------------------------------------------------------------------- - -struct StringCmp { // Used by the FlagRegistry map class to compare char*'s - bool operator() (const char* s1, const char* s2) const { - return (strcmp(s1, s2) < 0); - } -}; - - -class FlagRegistry { - public: - FlagRegistry() { - } - ~FlagRegistry() { - // Not using STLDeleteElements as that resides in util and this - // class is base. - for (FlagMap::iterator p = flags_.begin(), e = flags_.end(); p != e; ++p) { - CommandLineFlag* flag = p->second; - delete flag; - } - } - - static void DeleteGlobalRegistry() { - delete global_registry_; - global_registry_ = NULL; - } - - // Store a flag in this registry. Takes ownership of the given pointer. - void RegisterFlag(CommandLineFlag* flag); - - void Lock() { lock_.Lock(); } - void Unlock() { lock_.Unlock(); } - - // Returns the flag object for the specified name, or NULL if not found. - CommandLineFlag* FindFlagLocked(const char* name); - - // Returns the flag object whose current-value is stored at flag_ptr. - // That is, for whom current_->value_buffer_ == flag_ptr - CommandLineFlag* FindFlagViaPtrLocked(const void* flag_ptr); - - // A fancier form of FindFlag that works correctly if name is of the - // form flag=value. In that case, we set key to point to flag, and - // modify v to point to the value (if present), and return the flag - // with the given name. If the flag does not exist, returns NULL - // and sets error_message. - CommandLineFlag* SplitArgumentLocked(const char* argument, - string* key, const char** v, - string* error_message); - - // Set the value of a flag. If the flag was successfully set to - // value, set msg to indicate the new flag-value, and return true. - // Otherwise, set msg to indicate the error, leave flag unchanged, - // and return false. msg can be NULL. - bool SetFlagLocked(CommandLineFlag* flag, const char* value, - FlagSettingMode set_mode, string* msg); - - static FlagRegistry* GlobalRegistry(); // returns a singleton registry - - private: - friend class GFLAGS_NAMESPACE::FlagSaverImpl; // reads all the flags in order to copy them - friend class CommandLineFlagParser; // for ValidateUnmodifiedFlags - friend void GFLAGS_NAMESPACE::GetAllFlags(vector*); - - // The map from name to flag, for FindFlagLocked(). - typedef map FlagMap; - typedef FlagMap::iterator FlagIterator; - typedef FlagMap::const_iterator FlagConstIterator; - FlagMap flags_; - - // The map from current-value pointer to flag, fo FindFlagViaPtrLocked(). - typedef map FlagPtrMap; - FlagPtrMap flags_by_ptr_; - - static FlagRegistry* global_registry_; // a singleton registry - - Mutex lock_; - - static void InitGlobalRegistry(); - - // Disallow - FlagRegistry(const FlagRegistry&); - FlagRegistry& operator=(const FlagRegistry&); -}; - -class FlagRegistryLock { - public: - explicit FlagRegistryLock(FlagRegistry* fr) : fr_(fr) { fr_->Lock(); } - ~FlagRegistryLock() { fr_->Unlock(); } - private: - FlagRegistry *const fr_; -}; - - -void FlagRegistry::RegisterFlag(CommandLineFlag* flag) { - Lock(); - pair ins = - flags_.insert(pair(flag->name(), flag)); - if (ins.second == false) { // means the name was already in the map - if (strcmp(ins.first->second->filename(), flag->filename()) != 0) { - ReportError(DIE, "ERROR: flag '%s' was defined more than once " - "(in files '%s' and '%s').\n", - flag->name(), - ins.first->second->filename(), - flag->filename()); - } else { - ReportError(DIE, "ERROR: something wrong with flag '%s' in file '%s'. " - "One possibility: file '%s' is being linked both statically " - "and dynamically into this executable.\n", - flag->name(), - flag->filename(), flag->filename()); - } - } - // Also add to the flags_by_ptr_ map. - flags_by_ptr_[flag->current_->value_buffer_] = flag; - Unlock(); -} - -CommandLineFlag* FlagRegistry::FindFlagLocked(const char* name) { - FlagConstIterator i = flags_.find(name); - if (i == flags_.end()) { - // If the name has dashes in it, try again after replacing with - // underscores. - if (strchr(name, '-') == NULL) return NULL; - string name_rep = name; - std::replace(name_rep.begin(), name_rep.end(), '-', '_'); - return FindFlagLocked(name_rep.c_str()); - } else { - return i->second; - } -} - -CommandLineFlag* FlagRegistry::FindFlagViaPtrLocked(const void* flag_ptr) { - FlagPtrMap::const_iterator i = flags_by_ptr_.find(flag_ptr); - if (i == flags_by_ptr_.end()) { - return NULL; - } else { - return i->second; - } -} - -CommandLineFlag* FlagRegistry::SplitArgumentLocked(const char* arg, - string* key, - const char** v, - string* error_message) { - // Find the flag object for this option - const char* flag_name; - const char* value = strchr(arg, '='); - if (value == NULL) { - key->assign(arg); - *v = NULL; - } else { - // Strip out the "=value" portion from arg - key->assign(arg, value-arg); - *v = ++value; // advance past the '=' - } - flag_name = key->c_str(); - - CommandLineFlag* flag = FindFlagLocked(flag_name); - - if (flag == NULL) { - // If we can't find the flag-name, then we should return an error. - // The one exception is if 1) the flag-name is 'nox', 2) there - // exists a flag named 'x', and 3) 'x' is a boolean flag. - // In that case, we want to return flag 'x'. - if (!(flag_name[0] == 'n' && flag_name[1] == 'o')) { - // flag-name is not 'nox', so we're not in the exception case. - *error_message = StringPrintf("%sunknown command line flag '%s'\n", - kError, key->c_str()); - return NULL; - } - flag = FindFlagLocked(flag_name+2); - if (flag == NULL) { - // No flag named 'x' exists, so we're not in the exception case. - *error_message = StringPrintf("%sunknown command line flag '%s'\n", - kError, key->c_str()); - return NULL; - } - if (flag->Type() != FlagValue::FV_BOOL) { - // 'x' exists but is not boolean, so we're not in the exception case. - *error_message = StringPrintf( - "%sboolean value (%s) specified for %s command line flag\n", - kError, key->c_str(), flag->type_name()); - return NULL; - } - // We're in the exception case! - // Make up a fake value to replace the "no" we stripped out - key->assign(flag_name+2); // the name without the "no" - *v = "0"; - } - - // Assign a value if this is a boolean flag - if (*v == NULL && flag->Type() == FlagValue::FV_BOOL) { - *v = "1"; // the --nox case was already handled, so this is the --x case - } - - return flag; -} - -bool TryParseLocked(const CommandLineFlag* flag, FlagValue* flag_value, - const char* value, string* msg) { - // Use tenative_value, not flag_value, until we know value is valid. - FlagValue* tentative_value = flag_value->New(); - if (!tentative_value->ParseFrom(value)) { - if (msg) { - StringAppendF(msg, - "%sillegal value '%s' specified for %s flag '%s'\n", - kError, value, - flag->type_name(), flag->name()); - } - delete tentative_value; - return false; - } else if (!flag->Validate(*tentative_value)) { - if (msg) { - StringAppendF(msg, - "%sfailed validation of new value '%s' for flag '%s'\n", - kError, tentative_value->ToString().c_str(), - flag->name()); - } - delete tentative_value; - return false; - } else { - flag_value->CopyFrom(*tentative_value); - if (msg) { - StringAppendF(msg, "%s set to %s\n", - flag->name(), flag_value->ToString().c_str()); - } - delete tentative_value; - return true; - } -} - -bool FlagRegistry::SetFlagLocked(CommandLineFlag* flag, - const char* value, - FlagSettingMode set_mode, - string* msg) { - flag->UpdateModifiedBit(); - switch (set_mode) { - case SET_FLAGS_VALUE: { - // set or modify the flag's value - if (!TryParseLocked(flag, flag->current_, value, msg)) - return false; - flag->modified_ = true; - break; - } - case SET_FLAG_IF_DEFAULT: { - // set the flag's value, but only if it hasn't been set by someone else - if (!flag->modified_) { - if (!TryParseLocked(flag, flag->current_, value, msg)) - return false; - flag->modified_ = true; - } else { - *msg = StringPrintf("%s set to %s", - flag->name(), flag->current_value().c_str()); - } - break; - } - case SET_FLAGS_DEFAULT: { - // modify the flag's default-value - if (!TryParseLocked(flag, flag->defvalue_, value, msg)) - return false; - if (!flag->modified_) { - // Need to set both defvalue *and* current, in this case - TryParseLocked(flag, flag->current_, value, NULL); - } - break; - } - default: { - // unknown set_mode - assert(false); - return false; - } - } - - return true; -} - -// Get the singleton FlagRegistry object -FlagRegistry* FlagRegistry::global_registry_ = NULL; - -FlagRegistry* FlagRegistry::GlobalRegistry() { - static Mutex lock(Mutex::LINKER_INITIALIZED); - MutexLock acquire_lock(&lock); - if (!global_registry_) { - global_registry_ = new FlagRegistry; - } - return global_registry_; -} - -// -------------------------------------------------------------------- -// CommandLineFlagParser -// Parsing is done in two stages. In the first, we go through -// argv. For every flag-like arg we can make sense of, we parse -// it and set the appropriate FLAGS_* variable. For every flag- -// like arg we can't make sense of, we store it in a vector, -// along with an explanation of the trouble. In stage 2, we -// handle the 'reporting' flags like --help and --mpm_version. -// (This is via a call to HandleCommandLineHelpFlags(), in -// gflags_reporting.cc.) -// An optional stage 3 prints out the error messages. -// This is a bit of a simplification. For instance, --flagfile -// is handled as soon as it's seen in stage 1, not in stage 2. -// -------------------------------------------------------------------- - -class CommandLineFlagParser { - public: - // The argument is the flag-registry to register the parsed flags in - explicit CommandLineFlagParser(FlagRegistry* reg) : registry_(reg) {} - ~CommandLineFlagParser() {} - - // Stage 1: Every time this is called, it reads all flags in argv. - // However, it ignores all flags that have been successfully set - // before. Typically this is only called once, so this 'reparsing' - // behavior isn't important. It can be useful when trying to - // reparse after loading a dll, though. - uint32 ParseNewCommandLineFlags(int* argc, char*** argv, bool remove_flags); - - // Stage 2: print reporting info and exit, if requested. - // In gflags_reporting.cc:HandleCommandLineHelpFlags(). - - // Stage 3: validate all the commandline flags that have validators - // registered and were not set/modified by ParseNewCommandLineFlags. - void ValidateFlags(bool all); - void ValidateUnmodifiedFlags(); - - // Stage 4: report any errors and return true if any were found. - bool ReportErrors(); - - // Set a particular command line option. "newval" is a string - // describing the new value that the option has been set to. If - // option_name does not specify a valid option name, or value is not - // a valid value for option_name, newval is empty. Does recursive - // processing for --flagfile and --fromenv. Returns the new value - // if everything went ok, or empty-string if not. (Actually, the - // return-string could hold many flag/value pairs due to --flagfile.) - // NB: Must have called registry_->Lock() before calling this function. - string ProcessSingleOptionLocked(CommandLineFlag* flag, - const char* value, - FlagSettingMode set_mode); - - // Set a whole batch of command line options as specified by contentdata, - // which is in flagfile format (and probably has been read from a flagfile). - // Returns the new value if everything went ok, or empty-string if - // not. (Actually, the return-string could hold many flag/value - // pairs due to --flagfile.) - // NB: Must have called registry_->Lock() before calling this function. - string ProcessOptionsFromStringLocked(const string& contentdata, - FlagSettingMode set_mode); - - // These are the 'recursive' flags, defined at the top of this file. - // Whenever we see these flags on the commandline, we must take action. - // These are called by ProcessSingleOptionLocked and, similarly, return - // new values if everything went ok, or the empty-string if not. - string ProcessFlagfileLocked(const string& flagval, FlagSettingMode set_mode); - // diff fromenv/tryfromenv - string ProcessFromenvLocked(const string& flagval, FlagSettingMode set_mode, - bool errors_are_fatal); - - private: - FlagRegistry* const registry_; - map error_flags_; // map from name to error message - // This could be a set, but we reuse the map to minimize the .o size - map undefined_names_; // --[flag] name was not registered -}; - - -// Parse a list of (comma-separated) flags. -static void ParseFlagList(const char* value, vector* flags) { - for (const char *p = value; p && *p; value = p) { - p = strchr(value, ','); - size_t len; - if (p) { - len = p - value; - p++; - } else { - len = strlen(value); - } - - if (len == 0) - ReportError(DIE, "ERROR: empty flaglist entry\n"); - if (value[0] == '-') - ReportError(DIE, "ERROR: flag \"%*s\" begins with '-'\n", len, value); - - flags->push_back(string(value, len)); - } -} - -// Snarf an entire file into a C++ string. This is just so that we -// can do all the I/O in one place and not worry about it everywhere. -// Plus, it's convenient to have the whole file contents at hand. -// Adds a newline at the end of the file. -#define PFATAL(s) do { perror(s); gflags_exitfunc(1); } while (0) - -static string ReadFileIntoString(const char* filename) { - const int kBufSize = 8092; - char buffer[kBufSize]; - string s; - FILE* fp; - if ((errno = SafeFOpen(&fp, filename, "r")) != 0) PFATAL(filename); - size_t n; - while ( (n=fread(buffer, 1, kBufSize, fp)) > 0 ) { - if (ferror(fp)) PFATAL(filename); - s.append(buffer, n); - } - fclose(fp); - return s; -} - -uint32 CommandLineFlagParser::ParseNewCommandLineFlags(int* argc, char*** argv, - bool remove_flags) { - int first_nonopt = *argc; // for non-options moved to the end - - registry_->Lock(); - for (int i = 1; i < first_nonopt; i++) { - char* arg = (*argv)[i]; - - // Like getopt(), we permute non-option flags to be at the end. - if (arg[0] != '-' || arg[1] == '\0') { // must be a program argument: "-" is an argument, not a flag - memmove((*argv) + i, (*argv) + i+1, (*argc - (i+1)) * sizeof((*argv)[i])); - (*argv)[*argc-1] = arg; // we go last - first_nonopt--; // we've been pushed onto the stack - i--; // to undo the i++ in the loop - continue; - } - arg++; // skip leading '-' - if (arg[0] == '-') arg++; // or leading '--' - - // -- alone means what it does for GNU: stop options parsing - if (*arg == '\0') { - first_nonopt = i+1; - break; - } - - // Find the flag object for this option - string key; - const char* value; - string error_message; - CommandLineFlag* flag = registry_->SplitArgumentLocked(arg, &key, &value, - &error_message); - if (flag == NULL) { - undefined_names_[key] = ""; // value isn't actually used - error_flags_[key] = error_message; - continue; - } - - if (value == NULL) { - // Boolean options are always assigned a value by SplitArgumentLocked() - assert(flag->Type() != FlagValue::FV_BOOL); - if (i+1 >= first_nonopt) { - // This flag needs a value, but there is nothing available - error_flags_[key] = (string(kError) + "flag '" + (*argv)[i] + "'" - + " is missing its argument"); - if (flag->help() && flag->help()[0] > '\001') { - // Be useful in case we have a non-stripped description. - error_flags_[key] += string("; flag description: ") + flag->help(); - } - error_flags_[key] += "\n"; - break; // we treat this as an unrecoverable error - } else { - value = (*argv)[++i]; // read next arg for value - - // Heuristic to detect the case where someone treats a string arg - // like a bool: - // --my_string_var --foo=bar - // We look for a flag of string type, whose value begins with a - // dash, and where the flag-name and value are separated by a - // space rather than an '='. - // To avoid false positives, we also require the word "true" - // or "false" in the help string. Without this, a valid usage - // "-lat -30.5" would trigger the warning. The common cases we - // want to solve talk about true and false as values. - if (value[0] == '-' - && flag->Type() == FlagValue::FV_STRING - && (strstr(flag->help(), "true") - || strstr(flag->help(), "false"))) { - LOG(WARNING) << "Did you really mean to set flag '" - << flag->name() << "' to the value '" - << value << "'?"; - } - } - } - - // TODO(csilvers): only set a flag if we hadn't set it before here - ProcessSingleOptionLocked(flag, value, SET_FLAGS_VALUE); - } - registry_->Unlock(); - - if (remove_flags) { // Fix up argc and argv by removing command line flags - (*argv)[first_nonopt-1] = (*argv)[0]; - (*argv) += (first_nonopt-1); - (*argc) -= (first_nonopt-1); - first_nonopt = 1; // because we still don't count argv[0] - } - - logging_is_probably_set_up = true; // because we've parsed --logdir, etc. - - return first_nonopt; -} - -string CommandLineFlagParser::ProcessFlagfileLocked(const string& flagval, - FlagSettingMode set_mode) { - if (flagval.empty()) - return ""; - - string msg; - vector filename_list; - ParseFlagList(flagval.c_str(), &filename_list); // take a list of filenames - for (size_t i = 0; i < filename_list.size(); ++i) { - const char* file = filename_list[i].c_str(); - msg += ProcessOptionsFromStringLocked(ReadFileIntoString(file), set_mode); - } - return msg; -} - -string CommandLineFlagParser::ProcessFromenvLocked(const string& flagval, - FlagSettingMode set_mode, - bool errors_are_fatal) { - if (flagval.empty()) - return ""; - - string msg; - vector flaglist; - ParseFlagList(flagval.c_str(), &flaglist); - - for (size_t i = 0; i < flaglist.size(); ++i) { - const char* flagname = flaglist[i].c_str(); - CommandLineFlag* flag = registry_->FindFlagLocked(flagname); - if (flag == NULL) { - error_flags_[flagname] = - StringPrintf("%sunknown command line flag '%s' " - "(via --fromenv or --tryfromenv)\n", - kError, flagname); - undefined_names_[flagname] = ""; - continue; - } - - const string envname = string("FLAGS_") + string(flagname); - string envval; - if (!SafeGetEnv(envname.c_str(), envval)) { - if (errors_are_fatal) { - error_flags_[flagname] = (string(kError) + envname + - " not found in environment\n"); - } - continue; - } - - // Avoid infinite recursion. - if (envval == "fromenv" || envval == "tryfromenv") { - error_flags_[flagname] = - StringPrintf("%sinfinite recursion on environment flag '%s'\n", - kError, envval.c_str()); - continue; - } - - msg += ProcessSingleOptionLocked(flag, envval.c_str(), set_mode); - } - return msg; -} - -string CommandLineFlagParser::ProcessSingleOptionLocked( - CommandLineFlag* flag, const char* value, FlagSettingMode set_mode) { - string msg; - if (value && !registry_->SetFlagLocked(flag, value, set_mode, &msg)) { - error_flags_[flag->name()] = msg; - return ""; - } - - // The recursive flags, --flagfile and --fromenv and --tryfromenv, - // must be dealt with as soon as they're seen. They will emit - // messages of their own. - if (strcmp(flag->name(), "flagfile") == 0) { - msg += ProcessFlagfileLocked(FLAGS_flagfile, set_mode); - - } else if (strcmp(flag->name(), "fromenv") == 0) { - // last arg indicates envval-not-found is fatal (unlike in --tryfromenv) - msg += ProcessFromenvLocked(FLAGS_fromenv, set_mode, true); - - } else if (strcmp(flag->name(), "tryfromenv") == 0) { - msg += ProcessFromenvLocked(FLAGS_tryfromenv, set_mode, false); - } - - return msg; -} - -void CommandLineFlagParser::ValidateFlags(bool all) { - FlagRegistryLock frl(registry_); - for (FlagRegistry::FlagConstIterator i = registry_->flags_.begin(); - i != registry_->flags_.end(); ++i) { - if ((all || !i->second->Modified()) && !i->second->ValidateCurrent()) { - // only set a message if one isn't already there. (If there's - // an error message, our job is done, even if it's not exactly - // the same error.) - if (error_flags_[i->second->name()].empty()) { - error_flags_[i->second->name()] = - string(kError) + "--" + i->second->name() + - " must be set on the commandline"; - if (!i->second->Modified()) { - error_flags_[i->second->name()] += " (default value fails validation)"; - } - error_flags_[i->second->name()] += "\n"; - } - } - } -} - -void CommandLineFlagParser::ValidateUnmodifiedFlags() { - ValidateFlags(false); -} - -bool CommandLineFlagParser::ReportErrors() { - // error_flags_ indicates errors we saw while parsing. - // But we ignore undefined-names if ok'ed by --undef_ok - if (!FLAGS_undefok.empty()) { - vector flaglist; - ParseFlagList(FLAGS_undefok.c_str(), &flaglist); - for (size_t i = 0; i < flaglist.size(); ++i) { - // We also deal with --no, in case the flagname was boolean - const string no_version = string("no") + flaglist[i]; - if (undefined_names_.find(flaglist[i]) != undefined_names_.end()) { - error_flags_[flaglist[i]] = ""; // clear the error message - } else if (undefined_names_.find(no_version) != undefined_names_.end()) { - error_flags_[no_version] = ""; - } - } - } - // Likewise, if they decided to allow reparsing, all undefined-names - // are ok; we just silently ignore them now, and hope that a future - // parse will pick them up somehow. - if (allow_command_line_reparsing) { - for (map::const_iterator it = undefined_names_.begin(); - it != undefined_names_.end(); ++it) - error_flags_[it->first] = ""; // clear the error message - } - - bool found_error = false; - string error_message; - for (map::const_iterator it = error_flags_.begin(); - it != error_flags_.end(); ++it) { - if (!it->second.empty()) { - error_message.append(it->second.data(), it->second.size()); - found_error = true; - } - } - if (found_error) - ReportError(DO_NOT_DIE, "%s", error_message.c_str()); - return found_error; -} - -string CommandLineFlagParser::ProcessOptionsFromStringLocked( - const string& contentdata, FlagSettingMode set_mode) { - string retval; - const char* flagfile_contents = contentdata.c_str(); - bool flags_are_relevant = true; // set to false when filenames don't match - bool in_filename_section = false; - - const char* line_end = flagfile_contents; - // We read this file a line at a time. - for (; line_end; flagfile_contents = line_end + 1) { - while (*flagfile_contents && isspace(*flagfile_contents)) - ++flagfile_contents; - // Windows uses "\r\n" - line_end = strchr(flagfile_contents, '\r'); - if (line_end == NULL) - line_end = strchr(flagfile_contents, '\n'); - - size_t len = line_end ? line_end - flagfile_contents - : strlen(flagfile_contents); - string line(flagfile_contents, len); - - // Each line can be one of four things: - // 1) A comment line -- we skip it - // 2) An empty line -- we skip it - // 3) A list of filenames -- starts a new filenames+flags section - // 4) A --flag=value line -- apply if previous filenames match - if (line.empty() || line[0] == '#') { - // comment or empty line; just ignore - - } else if (line[0] == '-') { // flag - in_filename_section = false; // instead, it was a flag-line - if (!flags_are_relevant) // skip this flag; applies to someone else - continue; - - const char* name_and_val = line.c_str() + 1; // skip the leading - - if (*name_and_val == '-') - name_and_val++; // skip second - too - string key; - const char* value; - string error_message; - CommandLineFlag* flag = registry_->SplitArgumentLocked(name_and_val, - &key, &value, - &error_message); - // By API, errors parsing flagfile lines are silently ignored. - if (flag == NULL) { - // "WARNING: flagname '" + key + "' not found\n" - } else if (value == NULL) { - // "WARNING: flagname '" + key + "' missing a value\n" - } else { - retval += ProcessSingleOptionLocked(flag, value, set_mode); - } - - } else { // a filename! - if (!in_filename_section) { // start over: assume filenames don't match - in_filename_section = true; - flags_are_relevant = false; - } - - // Split the line up at spaces into glob-patterns - const char* space = line.c_str(); // just has to be non-NULL - for (const char* word = line.c_str(); *space; word = space+1) { - if (flags_are_relevant) // we can stop as soon as we match - break; - space = strchr(word, ' '); - if (space == NULL) - space = word + strlen(word); - const string glob(word, space - word); - // We try matching both against the full argv0 and basename(argv0) - if (glob == ProgramInvocationName() // small optimization - || glob == ProgramInvocationShortName() -#if defined(HAVE_FNMATCH_H) - || fnmatch(glob.c_str(), ProgramInvocationName(), FNM_PATHNAME) == 0 - || fnmatch(glob.c_str(), ProgramInvocationShortName(), FNM_PATHNAME) == 0 -#elif defined(HAVE_SHLWAPI_H) - || PathMatchSpecA(glob.c_str(), ProgramInvocationName()) - || PathMatchSpecA(glob.c_str(), ProgramInvocationShortName()) -#endif - ) { - flags_are_relevant = true; - } - } - } - } - return retval; -} - -// -------------------------------------------------------------------- -// GetFromEnv() -// AddFlagValidator() -// These are helper functions for routines like BoolFromEnv() and -// RegisterFlagValidator, defined below. They're defined here so -// they can live in the unnamed namespace (which makes friendship -// declarations for these classes possible). -// -------------------------------------------------------------------- - -template -T GetFromEnv(const char *varname, T dflt) { - std::string valstr; - if (SafeGetEnv(varname, valstr)) { - FlagValue ifv(new T, true); - if (!ifv.ParseFrom(valstr.c_str())) { - ReportError(DIE, "ERROR: error parsing env variable '%s' with value '%s'\n", - varname, valstr.c_str()); - } - return OTHER_VALUE_AS(ifv, T); - } else return dflt; -} - -bool AddFlagValidator(const void* flag_ptr, ValidateFnProto validate_fn_proto) { - // We want a lock around this routine, in case two threads try to - // add a validator (hopefully the same one!) at once. We could use - // our own thread, but we need to loook at the registry anyway, so - // we just steal that one. - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - FlagRegistryLock frl(registry); - // First, find the flag whose current-flag storage is 'flag'. - // This is the CommandLineFlag whose current_->value_buffer_ == flag - CommandLineFlag* flag = registry->FindFlagViaPtrLocked(flag_ptr); - if (!flag) { - LOG(WARNING) << "Ignoring RegisterValidateFunction() for flag pointer " - << flag_ptr << ": no flag found at that address"; - return false; - } else if (validate_fn_proto == flag->validate_function()) { - return true; // ok to register the same function over and over again - } else if (validate_fn_proto != NULL && flag->validate_function() != NULL) { - LOG(WARNING) << "Ignoring RegisterValidateFunction() for flag '" - << flag->name() << "': validate-fn already registered"; - return false; - } else { - flag->validate_fn_proto_ = validate_fn_proto; - return true; - } -} - -} // end unnamed namespaces - - -// Now define the functions that are exported via the .h file - -// -------------------------------------------------------------------- -// FlagRegisterer -// This class exists merely to have a global constructor (the -// kind that runs before main(), that goes an initializes each -// flag that's been declared. Note that it's very important we -// don't have a destructor that deletes flag_, because that would -// cause us to delete current_storage/defvalue_storage as well, -// which can cause a crash if anything tries to access the flag -// values in a global destructor. -// -------------------------------------------------------------------- - -namespace { -void RegisterCommandLineFlag(const char* name, - const char* help, - const char* filename, - FlagValue* current, - FlagValue* defvalue) { - if (help == NULL) - help = ""; - // Importantly, flag_ will never be deleted, so storage is always good. - CommandLineFlag* flag = - new CommandLineFlag(name, help, filename, current, defvalue); - FlagRegistry::GlobalRegistry()->RegisterFlag(flag); // default registry -} -} - -template -FlagRegisterer::FlagRegisterer(const char* name, - const char* help, - const char* filename, - FlagType* current_storage, - FlagType* defvalue_storage) { - FlagValue* const current = new FlagValue(current_storage, false); - FlagValue* const defvalue = new FlagValue(defvalue_storage, false); - RegisterCommandLineFlag(name, help, filename, current, defvalue); -} - -// Force compiler to generate code for the given template specialization. -#define INSTANTIATE_FLAG_REGISTERER_CTOR(type) \ - template GFLAGS_DLL_DECL FlagRegisterer::FlagRegisterer( \ - const char* name, const char* help, const char* filename, \ - type* current_storage, type* defvalue_storage) - -// Do this for all supported flag types. -INSTANTIATE_FLAG_REGISTERER_CTOR(bool); -INSTANTIATE_FLAG_REGISTERER_CTOR(int32); -INSTANTIATE_FLAG_REGISTERER_CTOR(uint32); -INSTANTIATE_FLAG_REGISTERER_CTOR(int64); -INSTANTIATE_FLAG_REGISTERER_CTOR(uint64); -INSTANTIATE_FLAG_REGISTERER_CTOR(double); -INSTANTIATE_FLAG_REGISTERER_CTOR(std::string); - -#undef INSTANTIATE_FLAG_REGISTERER_CTOR - -// -------------------------------------------------------------------- -// GetAllFlags() -// The main way the FlagRegistry class exposes its data. This -// returns, as strings, all the info about all the flags in -// the main registry, sorted first by filename they are defined -// in, and then by flagname. -// -------------------------------------------------------------------- - -struct FilenameFlagnameCmp { - bool operator()(const CommandLineFlagInfo& a, - const CommandLineFlagInfo& b) const { - int cmp = strcmp(a.filename.c_str(), b.filename.c_str()); - if (cmp == 0) - cmp = strcmp(a.name.c_str(), b.name.c_str()); // secondary sort key - return cmp < 0; - } -}; - -void GetAllFlags(vector* OUTPUT) { - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - registry->Lock(); - for (FlagRegistry::FlagConstIterator i = registry->flags_.begin(); - i != registry->flags_.end(); ++i) { - CommandLineFlagInfo fi; - i->second->FillCommandLineFlagInfo(&fi); - OUTPUT->push_back(fi); - } - registry->Unlock(); - // Now sort the flags, first by filename they occur in, then alphabetically - sort(OUTPUT->begin(), OUTPUT->end(), FilenameFlagnameCmp()); -} - -// -------------------------------------------------------------------- -// SetArgv() -// GetArgvs() -// GetArgv() -// GetArgv0() -// ProgramInvocationName() -// ProgramInvocationShortName() -// SetUsageMessage() -// ProgramUsage() -// Functions to set and get argv. Typically the setter is called -// by ParseCommandLineFlags. Also can get the ProgramUsage string, -// set by SetUsageMessage. -// -------------------------------------------------------------------- - -// These values are not protected by a Mutex because they are normally -// set only once during program startup. -static string argv0("UNKNOWN"); // just the program name -static string cmdline; // the entire command-line -static string program_usage; -static vector argvs; -static uint32 argv_sum = 0; - -void SetArgv(int argc, const char** argv) { - static bool called_set_argv = false; - if (called_set_argv) return; - called_set_argv = true; - - assert(argc > 0); // every program has at least a name - argv0 = argv[0]; - - cmdline.clear(); - for (int i = 0; i < argc; i++) { - if (i != 0) cmdline += " "; - cmdline += argv[i]; - argvs.push_back(argv[i]); - } - - // Compute a simple sum of all the chars in argv - argv_sum = 0; - for (string::const_iterator c = cmdline.begin(); c != cmdline.end(); ++c) { - argv_sum += *c; - } -} - -const vector& GetArgvs() { return argvs; } -const char* GetArgv() { return cmdline.c_str(); } -const char* GetArgv0() { return argv0.c_str(); } -uint32 GetArgvSum() { return argv_sum; } -const char* ProgramInvocationName() { // like the GNU libc fn - return GetArgv0(); -} -const char* ProgramInvocationShortName() { // like the GNU libc fn - size_t pos = argv0.rfind('/'); -#ifdef OS_WINDOWS - if (pos == string::npos) pos = argv0.rfind('\\'); -#endif - return (pos == string::npos ? argv0.c_str() : (argv0.c_str() + pos + 1)); -} - -void SetUsageMessage(const string& usage) { - program_usage = usage; -} - -const char* ProgramUsage() { - if (program_usage.empty()) { - return "Warning: SetUsageMessage() never called"; - } - return program_usage.c_str(); -} - -// -------------------------------------------------------------------- -// SetVersionString() -// VersionString() -// -------------------------------------------------------------------- - -static string version_string; - -void SetVersionString(const string& version) { - version_string = version; -} - -const char* VersionString() { - return version_string.c_str(); -} - - -// -------------------------------------------------------------------- -// GetCommandLineOption() -// GetCommandLineFlagInfo() -// GetCommandLineFlagInfoOrDie() -// SetCommandLineOption() -// SetCommandLineOptionWithMode() -// The programmatic way to set a flag's value, using a string -// for its name rather than the variable itself (that is, -// SetCommandLineOption("foo", x) rather than FLAGS_foo = x). -// There's also a bit more flexibility here due to the various -// set-modes, but typically these are used when you only have -// that flag's name as a string, perhaps at runtime. -// All of these work on the default, global registry. -// For GetCommandLineOption, return false if no such flag -// is known, true otherwise. We clear "value" if a suitable -// flag is found. -// -------------------------------------------------------------------- - - -bool GetCommandLineOption(const char* name, string* value) { - if (NULL == name) - return false; - assert(value); - - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - FlagRegistryLock frl(registry); - CommandLineFlag* flag = registry->FindFlagLocked(name); - if (flag == NULL) { - return false; - } else { - *value = flag->current_value(); - return true; - } -} - -bool GetCommandLineFlagInfo(const char* name, CommandLineFlagInfo* OUTPUT) { - if (NULL == name) return false; - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - FlagRegistryLock frl(registry); - CommandLineFlag* flag = registry->FindFlagLocked(name); - if (flag == NULL) { - return false; - } else { - assert(OUTPUT); - flag->FillCommandLineFlagInfo(OUTPUT); - return true; - } -} - -CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name) { - CommandLineFlagInfo info; - if (!GetCommandLineFlagInfo(name, &info)) { - fprintf(stderr, "FATAL ERROR: flag name '%s' doesn't exist\n", name); - gflags_exitfunc(1); // almost certainly gflags_exitfunc() - } - return info; -} - -string SetCommandLineOptionWithMode(const char* name, const char* value, - FlagSettingMode set_mode) { - string result; - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - FlagRegistryLock frl(registry); - CommandLineFlag* flag = registry->FindFlagLocked(name); - if (flag) { - CommandLineFlagParser parser(registry); - result = parser.ProcessSingleOptionLocked(flag, value, set_mode); - if (!result.empty()) { // in the error case, we've already logged - // Could consider logging this change - } - } - // The API of this function is that we return empty string on error - return result; -} - -string SetCommandLineOption(const char* name, const char* value) { - return SetCommandLineOptionWithMode(name, value, SET_FLAGS_VALUE); -} - -// -------------------------------------------------------------------- -// FlagSaver -// FlagSaverImpl -// This class stores the states of all flags at construct time, -// and restores all flags to that state at destruct time. -// Its major implementation challenge is that it never modifies -// pointers in the 'main' registry, so global FLAG_* vars always -// point to the right place. -// -------------------------------------------------------------------- - -class FlagSaverImpl { - public: - // Constructs an empty FlagSaverImpl object. - explicit FlagSaverImpl(FlagRegistry* main_registry) - : main_registry_(main_registry) { } - ~FlagSaverImpl() { - // reclaim memory from each of our CommandLineFlags - vector::const_iterator it; - for (it = backup_registry_.begin(); it != backup_registry_.end(); ++it) - delete *it; - } - - // Saves the flag states from the flag registry into this object. - // It's an error to call this more than once. - // Must be called when the registry mutex is not held. - void SaveFromRegistry() { - FlagRegistryLock frl(main_registry_); - assert(backup_registry_.empty()); // call only once! - for (FlagRegistry::FlagConstIterator it = main_registry_->flags_.begin(); - it != main_registry_->flags_.end(); - ++it) { - const CommandLineFlag* main = it->second; - // Sets up all the const variables in backup correctly - CommandLineFlag* backup = new CommandLineFlag( - main->name(), main->help(), main->filename(), - main->current_->New(), main->defvalue_->New()); - // Sets up all the non-const variables in backup correctly - backup->CopyFrom(*main); - backup_registry_.push_back(backup); // add it to a convenient list - } - } - - // Restores the saved flag states into the flag registry. We - // assume no flags were added or deleted from the registry since - // the SaveFromRegistry; if they were, that's trouble! Must be - // called when the registry mutex is not held. - void RestoreToRegistry() { - FlagRegistryLock frl(main_registry_); - vector::const_iterator it; - for (it = backup_registry_.begin(); it != backup_registry_.end(); ++it) { - CommandLineFlag* main = main_registry_->FindFlagLocked((*it)->name()); - if (main != NULL) { // if NULL, flag got deleted from registry(!) - main->CopyFrom(**it); - } - } - } - - private: - FlagRegistry* const main_registry_; - vector backup_registry_; - - FlagSaverImpl(const FlagSaverImpl&); // no copying! - void operator=(const FlagSaverImpl&); -}; - -FlagSaver::FlagSaver() - : impl_(new FlagSaverImpl(FlagRegistry::GlobalRegistry())) { - impl_->SaveFromRegistry(); -} - -FlagSaver::~FlagSaver() { - impl_->RestoreToRegistry(); - delete impl_; -} - - -// -------------------------------------------------------------------- -// CommandlineFlagsIntoString() -// ReadFlagsFromString() -// AppendFlagsIntoFile() -// ReadFromFlagsFile() -// These are mostly-deprecated routines that stick the -// commandline flags into a file/string and read them back -// out again. I can see a use for CommandlineFlagsIntoString, -// for creating a flagfile, but the rest don't seem that useful -// -- some, I think, are a poor-man's attempt at FlagSaver -- -// and are included only until we can delete them from callers. -// Note they don't save --flagfile flags (though they do save -// the result of having called the flagfile, of course). -// -------------------------------------------------------------------- - -static string TheseCommandlineFlagsIntoString( - const vector& flags) { - vector::const_iterator i; - - size_t retval_space = 0; - for (i = flags.begin(); i != flags.end(); ++i) { - // An (over)estimate of how much space it will take to print this flag - retval_space += i->name.length() + i->current_value.length() + 5; - } - - string retval; - retval.reserve(retval_space); - for (i = flags.begin(); i != flags.end(); ++i) { - retval += "--"; - retval += i->name; - retval += "="; - retval += i->current_value; - retval += "\n"; - } - return retval; -} - -string CommandlineFlagsIntoString() { - vector sorted_flags; - GetAllFlags(&sorted_flags); - return TheseCommandlineFlagsIntoString(sorted_flags); -} - -bool ReadFlagsFromString(const string& flagfilecontents, - const char* /*prog_name*/, // TODO(csilvers): nix this - bool errors_are_fatal) { - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - FlagSaverImpl saved_states(registry); - saved_states.SaveFromRegistry(); - - CommandLineFlagParser parser(registry); - registry->Lock(); - parser.ProcessOptionsFromStringLocked(flagfilecontents, SET_FLAGS_VALUE); - registry->Unlock(); - // Should we handle --help and such when reading flags from a string? Sure. - HandleCommandLineHelpFlags(); - if (parser.ReportErrors()) { - // Error. Restore all global flags to their previous values. - if (errors_are_fatal) - gflags_exitfunc(1); - saved_states.RestoreToRegistry(); - return false; - } - return true; -} - -// TODO(csilvers): nix prog_name in favor of ProgramInvocationShortName() -bool AppendFlagsIntoFile(const string& filename, const char *prog_name) { - FILE *fp; - if (SafeFOpen(&fp, filename.c_str(), "a") != 0) { - return false; - } - - if (prog_name) - fprintf(fp, "%s\n", prog_name); - - vector flags; - GetAllFlags(&flags); - // But we don't want --flagfile, which leads to weird recursion issues - vector::iterator i; - for (i = flags.begin(); i != flags.end(); ++i) { - if (strcmp(i->name.c_str(), "flagfile") == 0) { - flags.erase(i); - break; - } - } - fprintf(fp, "%s", TheseCommandlineFlagsIntoString(flags).c_str()); - - fclose(fp); - return true; -} - -bool ReadFromFlagsFile(const string& filename, const char* prog_name, - bool errors_are_fatal) { - return ReadFlagsFromString(ReadFileIntoString(filename.c_str()), - prog_name, errors_are_fatal); -} - - -// -------------------------------------------------------------------- -// BoolFromEnv() -// Int32FromEnv() -// Uint32FromEnv() -// Int64FromEnv() -// Uint64FromEnv() -// DoubleFromEnv() -// StringFromEnv() -// Reads the value from the environment and returns it. -// We use an FlagValue to make the parsing easy. -// Example usage: -// DEFINE_bool(myflag, BoolFromEnv("MYFLAG_DEFAULT", false), "whatever"); -// -------------------------------------------------------------------- - -bool BoolFromEnv(const char *v, bool dflt) { - return GetFromEnv(v, dflt); -} -int32 Int32FromEnv(const char *v, int32 dflt) { - return GetFromEnv(v, dflt); -} -uint32 Uint32FromEnv(const char *v, uint32 dflt) { - return GetFromEnv(v, dflt); -} -int64 Int64FromEnv(const char *v, int64 dflt) { - return GetFromEnv(v, dflt); -} -uint64 Uint64FromEnv(const char *v, uint64 dflt) { - return GetFromEnv(v, dflt); -} -double DoubleFromEnv(const char *v, double dflt) { - return GetFromEnv(v, dflt); -} - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4996) // ignore getenv security warning -#endif -const char *StringFromEnv(const char *varname, const char *dflt) { - const char* const val = getenv(varname); - return val ? val : dflt; -} -#ifdef _MSC_VER -# pragma warning(pop) -#endif - - -// -------------------------------------------------------------------- -// RegisterFlagValidator() -// RegisterFlagValidator() is the function that clients use to -// 'decorate' a flag with a validation function. Once this is -// done, every time the flag is set (including when the flag -// is parsed from argv), the validator-function is called. -// These functions return true if the validator was added -// successfully, or false if not: the flag already has a validator, -// (only one allowed per flag), the 1st arg isn't a flag, etc. -// This function is not thread-safe. -// -------------------------------------------------------------------- - -bool RegisterFlagValidator(const bool* flag, - bool (*validate_fn)(const char*, bool)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const int32* flag, - bool (*validate_fn)(const char*, int32)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const uint32* flag, - bool (*validate_fn)(const char*, uint32)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const int64* flag, - bool (*validate_fn)(const char*, int64)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const uint64* flag, - bool (*validate_fn)(const char*, uint64)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const double* flag, - bool (*validate_fn)(const char*, double)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} -bool RegisterFlagValidator(const string* flag, - bool (*validate_fn)(const char*, const string&)) { - return AddFlagValidator(flag, reinterpret_cast(validate_fn)); -} - - -// -------------------------------------------------------------------- -// ParseCommandLineFlags() -// ParseCommandLineNonHelpFlags() -// HandleCommandLineHelpFlags() -// This is the main function called from main(), to actually -// parse the commandline. It modifies argc and argv as described -// at the top of gflags.h. You can also divide this -// function into two parts, if you want to do work between -// the parsing of the flags and the printing of any help output. -// -------------------------------------------------------------------- - -static uint32 ParseCommandLineFlagsInternal(int* argc, char*** argv, - bool remove_flags, bool do_report) { - SetArgv(*argc, const_cast(*argv)); // save it for later - - FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); - CommandLineFlagParser parser(registry); - - // When we parse the commandline flags, we'll handle --flagfile, - // --tryfromenv, etc. as we see them (since flag-evaluation order - // may be important). But sometimes apps set FLAGS_tryfromenv/etc. - // manually before calling ParseCommandLineFlags. We want to evaluate - // those too, as if they were the first flags on the commandline. - registry->Lock(); - parser.ProcessFlagfileLocked(FLAGS_flagfile, SET_FLAGS_VALUE); - // Last arg here indicates whether flag-not-found is a fatal error or not - parser.ProcessFromenvLocked(FLAGS_fromenv, SET_FLAGS_VALUE, true); - parser.ProcessFromenvLocked(FLAGS_tryfromenv, SET_FLAGS_VALUE, false); - registry->Unlock(); - - // Now get the flags specified on the commandline - const int r = parser.ParseNewCommandLineFlags(argc, argv, remove_flags); - - if (do_report) - HandleCommandLineHelpFlags(); // may cause us to exit on --help, etc. - - // See if any of the unset flags fail their validation checks - parser.ValidateUnmodifiedFlags(); - - if (parser.ReportErrors()) // may cause us to exit on illegal flags - gflags_exitfunc(1); - return r; -} - -uint32 ParseCommandLineFlags(int* argc, char*** argv, bool remove_flags) { - return ParseCommandLineFlagsInternal(argc, argv, remove_flags, true); -} - -uint32 ParseCommandLineNonHelpFlags(int* argc, char*** argv, - bool remove_flags) { - return ParseCommandLineFlagsInternal(argc, argv, remove_flags, false); -} - -// -------------------------------------------------------------------- -// AllowCommandLineReparsing() -// ReparseCommandLineNonHelpFlags() -// This is most useful for shared libraries. The idea is if -// a flag is defined in a shared library that is dlopen'ed -// sometime after main(), you can ParseCommandLineFlags before -// the dlopen, then ReparseCommandLineNonHelpFlags() after the -// dlopen, to get the new flags. But you have to explicitly -// Allow() it; otherwise, you get the normal default behavior -// of unrecognized flags calling a fatal error. -// TODO(csilvers): this isn't used. Just delete it? -// -------------------------------------------------------------------- - -void AllowCommandLineReparsing() { - allow_command_line_reparsing = true; -} - -void ReparseCommandLineNonHelpFlags() { - // We make a copy of argc and argv to pass in - const vector& argvs = GetArgvs(); - int tmp_argc = static_cast(argvs.size()); - char** tmp_argv = new char* [tmp_argc + 1]; - for (int i = 0; i < tmp_argc; ++i) - tmp_argv[i] = strdup(argvs[i].c_str()); // TODO(csilvers): don't dup - - ParseCommandLineNonHelpFlags(&tmp_argc, &tmp_argv, false); - - for (int i = 0; i < tmp_argc; ++i) - free(tmp_argv[i]); - delete[] tmp_argv; -} - -void ShutDownCommandLineFlags() { - FlagRegistry::DeleteGlobalRegistry(); -} - - -} // namespace GFLAGS_NAMESPACE diff --git a/demos/thirdparty/gflags/src/gflags.h.in b/demos/thirdparty/gflags/src/gflags.h.in deleted file mode 100644 index 7b218b90d15..00000000000 --- a/demos/thirdparty/gflags/src/gflags.h.in +++ /dev/null @@ -1,626 +0,0 @@ -// Copyright (c) 2006, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// Revamped and reorganized by Craig Silverstein -// -// This is the file that should be included by any file which declares -// or defines a command line flag or wants to parse command line flags -// or print a program usage message (which will include information about -// flags). Executive summary, in the form of an example foo.cc file: -// -// #include "foo.h" // foo.h has a line "DECLARE_int32(start);" -// #include "validators.h" // hypothetical file defining ValidateIsFile() -// -// DEFINE_int32(end, 1000, "The last record to read"); -// -// DEFINE_string(filename, "my_file.txt", "The file to read"); -// // Crash if the specified file does not exist. -// static bool dummy = RegisterFlagValidator(&FLAGS_filename, -// &ValidateIsFile); -// -// DECLARE_bool(verbose); // some other file has a DEFINE_bool(verbose, ...) -// -// void MyFunc() { -// if (FLAGS_verbose) printf("Records %d-%d\n", FLAGS_start, FLAGS_end); -// } -// -// Then, at the command-line: -// ./foo --noverbose --start=5 --end=100 -// -// For more details, see -// doc/gflags.html -// -// --- A note about thread-safety: -// -// We describe many functions in this routine as being thread-hostile, -// thread-compatible, or thread-safe. Here are the meanings we use: -// -// thread-safe: it is safe for multiple threads to call this routine -// (or, when referring to a class, methods of this class) -// concurrently. -// thread-hostile: it is not safe for multiple threads to call this -// routine (or methods of this class) concurrently. In gflags, -// most thread-hostile routines are intended to be called early in, -// or even before, main() -- that is, before threads are spawned. -// thread-compatible: it is safe for multiple threads to read from -// this variable (when applied to variables), or to call const -// methods of this class (when applied to classes), as long as no -// other thread is writing to the variable or calling non-const -// methods of this class. - -#ifndef GFLAGS_GFLAGS_H_ -#define GFLAGS_GFLAGS_H_ - -#include -#include - -#include "gflags/gflags_declare.h" // IWYU pragma: export - - -// We always want to export variables defined in user code -#ifndef GFLAGS_DLL_DEFINE_FLAG -# if GFLAGS_IS_A_DLL && defined(_MSC_VER) -# define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport) -# else -# define GFLAGS_DLL_DEFINE_FLAG -# endif -#endif - - -namespace GFLAGS_NAMESPACE { - - -// -------------------------------------------------------------------- -// To actually define a flag in a file, use DEFINE_bool, -// DEFINE_string, etc. at the bottom of this file. You may also find -// it useful to register a validator with the flag. This ensures that -// when the flag is parsed from the commandline, or is later set via -// SetCommandLineOption, we call the validation function. It is _not_ -// called when you assign the value to the flag directly using the = operator. -// -// The validation function should return true if the flag value is valid, and -// false otherwise. If the function returns false for the new setting of the -// flag, the flag will retain its current value. If it returns false for the -// default value, ParseCommandLineFlags() will die. -// -// This function is safe to call at global construct time (as in the -// example below). -// -// Example use: -// static bool ValidatePort(const char* flagname, int32 value) { -// if (value > 0 && value < 32768) // value is ok -// return true; -// printf("Invalid value for --%s: %d\n", flagname, (int)value); -// return false; -// } -// DEFINE_int32(port, 0, "What port to listen on"); -// static bool dummy = RegisterFlagValidator(&FLAGS_port, &ValidatePort); - -// Returns true if successfully registered, false if not (because the -// first argument doesn't point to a command-line flag, or because a -// validator is already registered for this flag). -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const bool* flag, bool (*validate_fn)(const char*, bool)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int32* flag, bool (*validate_fn)(const char*, int32)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const uint32* flag, bool (*validate_fn)(const char*, uint32)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int64* flag, bool (*validate_fn)(const char*, int64)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const uint64* flag, bool (*validate_fn)(const char*, uint64)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const double* flag, bool (*validate_fn)(const char*, double)); -extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const std::string* flag, bool (*validate_fn)(const char*, const std::string&)); - -// Convenience macro for the registration of a flag validator -#define DEFINE_validator(name, validator) \ - static const bool name##_validator_registered = \ - GFLAGS_NAMESPACE::RegisterFlagValidator(&FLAGS_##name, validator) - - -// -------------------------------------------------------------------- -// These methods are the best way to get access to info about the -// list of commandline flags. Note that these routines are pretty slow. -// GetAllFlags: mostly-complete info about the list, sorted by file. -// ShowUsageWithFlags: pretty-prints the list to stdout (what --help does) -// ShowUsageWithFlagsRestrict: limit to filenames with restrict as a substr -// -// In addition to accessing flags, you can also access argv[0] (the program -// name) and argv (the entire commandline), which we sock away a copy of. -// These variables are static, so you should only set them once. -// -// No need to export this data only structure from DLL, avoiding VS warning 4251. -struct CommandLineFlagInfo { - std::string name; // the name of the flag - std::string type; // the type of the flag: int32, etc - std::string description; // the "help text" associated with the flag - std::string current_value; // the current value, as a string - std::string default_value; // the default value, as a string - std::string filename; // 'cleaned' version of filename holding the flag - bool has_validator_fn; // true if RegisterFlagValidator called on this flag - bool is_default; // true if the flag has the default value and - // has not been set explicitly from the cmdline - // or via SetCommandLineOption - const void* flag_ptr; // pointer to the flag's current value (i.e. FLAGS_foo) -}; - -// Using this inside of a validator is a recipe for a deadlock. -// TODO(user) Fix locking when validators are running, to make it safe to -// call validators during ParseAllFlags. -// Also make sure then to uncomment the corresponding unit test in -// gflags_unittest.sh -extern GFLAGS_DLL_DECL void GetAllFlags(std::vector* OUTPUT); -// These two are actually defined in gflags_reporting.cc. -extern GFLAGS_DLL_DECL void ShowUsageWithFlags(const char *argv0); // what --help does -extern GFLAGS_DLL_DECL void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict); - -// Create a descriptive string for a flag. -// Goes to some trouble to make pretty line breaks. -extern GFLAGS_DLL_DECL std::string DescribeOneFlag(const CommandLineFlagInfo& flag); - -// Thread-hostile; meant to be called before any threads are spawned. -extern GFLAGS_DLL_DECL void SetArgv(int argc, const char** argv); - -// The following functions are thread-safe as long as SetArgv() is -// only called before any threads start. -extern GFLAGS_DLL_DECL const std::vector& GetArgvs(); -extern GFLAGS_DLL_DECL const char* GetArgv(); // all of argv as a string -extern GFLAGS_DLL_DECL const char* GetArgv0(); // only argv0 -extern GFLAGS_DLL_DECL uint32 GetArgvSum(); // simple checksum of argv -extern GFLAGS_DLL_DECL const char* ProgramInvocationName(); // argv0, or "UNKNOWN" if not set -extern GFLAGS_DLL_DECL const char* ProgramInvocationShortName(); // basename(argv0) - -// ProgramUsage() is thread-safe as long as SetUsageMessage() is only -// called before any threads start. -extern GFLAGS_DLL_DECL const char* ProgramUsage(); // string set by SetUsageMessage() - -// VersionString() is thread-safe as long as SetVersionString() is only -// called before any threads start. -extern GFLAGS_DLL_DECL const char* VersionString(); // string set by SetVersionString() - - - -// -------------------------------------------------------------------- -// Normally you access commandline flags by just saying "if (FLAGS_foo)" -// or whatever, and set them by calling "FLAGS_foo = bar" (or, more -// commonly, via the DEFINE_foo macro). But if you need a bit more -// control, we have programmatic ways to get/set the flags as well. -// These programmatic ways to access flags are thread-safe, but direct -// access is only thread-compatible. - -// Return true iff the flagname was found. -// OUTPUT is set to the flag's value, or unchanged if we return false. -extern GFLAGS_DLL_DECL bool GetCommandLineOption(const char* name, std::string* OUTPUT); - -// Return true iff the flagname was found. OUTPUT is set to the flag's -// CommandLineFlagInfo or unchanged if we return false. -extern GFLAGS_DLL_DECL bool GetCommandLineFlagInfo(const char* name, CommandLineFlagInfo* OUTPUT); - -// Return the CommandLineFlagInfo of the flagname. exit() if name not found. -// Example usage, to check if a flag's value is currently the default value: -// if (GetCommandLineFlagInfoOrDie("foo").is_default) ... -extern GFLAGS_DLL_DECL CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name); - -enum GFLAGS_DLL_DECL FlagSettingMode { - // update the flag's value (can call this multiple times). - SET_FLAGS_VALUE, - // update the flag's value, but *only if* it has not yet been updated - // with SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef". - SET_FLAG_IF_DEFAULT, - // set the flag's default value to this. If the flag has not yet updated - // yet (via SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef") - // change the flag's current value to the new default value as well. - SET_FLAGS_DEFAULT -}; - -// Set a particular flag ("command line option"). Returns a string -// describing the new value that the option has been set to. The -// return value API is not well-specified, so basically just depend on -// it to be empty if the setting failed for some reason -- the name is -// not a valid flag name, or the value is not a valid value -- and -// non-empty else. - -// SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case) -extern GFLAGS_DLL_DECL std::string SetCommandLineOption (const char* name, const char* value); -extern GFLAGS_DLL_DECL std::string SetCommandLineOptionWithMode(const char* name, const char* value, FlagSettingMode set_mode); - - -// -------------------------------------------------------------------- -// Saves the states (value, default value, whether the user has set -// the flag, registered validators, etc) of all flags, and restores -// them when the FlagSaver is destroyed. This is very useful in -// tests, say, when you want to let your tests change the flags, but -// make sure that they get reverted to the original states when your -// test is complete. -// -// Example usage: -// void TestFoo() { -// FlagSaver s1; -// FLAG_foo = false; -// FLAG_bar = "some value"; -// -// // test happens here. You can return at any time -// // without worrying about restoring the FLAG values. -// } -// -// Note: This class is marked with GFLAGS_ATTRIBUTE_UNUSED because all -// the work is done in the constructor and destructor, so in the standard -// usage example above, the compiler would complain that it's an -// unused variable. -// -// This class is thread-safe. However, its destructor writes to -// exactly the set of flags that have changed value during its -// lifetime, so concurrent _direct_ access to those flags -// (i.e. FLAGS_foo instead of {Get,Set}CommandLineOption()) is unsafe. - -class GFLAGS_DLL_DECL FlagSaver { - public: - FlagSaver(); - ~FlagSaver(); - - private: - class FlagSaverImpl* impl_; // we use pimpl here to keep API steady - - FlagSaver(const FlagSaver&); // no copying! - void operator=(const FlagSaver&); -}@GFLAGS_ATTRIBUTE_UNUSED@; - -// -------------------------------------------------------------------- -// Some deprecated or hopefully-soon-to-be-deprecated functions. - -// This is often used for logging. TODO(csilvers): figure out a better way -extern GFLAGS_DLL_DECL std::string CommandlineFlagsIntoString(); -// Usually where this is used, a FlagSaver should be used instead. -extern GFLAGS_DLL_DECL -bool ReadFlagsFromString(const std::string& flagfilecontents, - const char* prog_name, - bool errors_are_fatal); // uses SET_FLAGS_VALUE - -// These let you manually implement --flagfile functionality. -// DEPRECATED. -extern GFLAGS_DLL_DECL bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name); -extern GFLAGS_DLL_DECL bool ReadFromFlagsFile(const std::string& filename, const char* prog_name, bool errors_are_fatal); // uses SET_FLAGS_VALUE - - -// -------------------------------------------------------------------- -// Useful routines for initializing flags from the environment. -// In each case, if 'varname' does not exist in the environment -// return defval. If 'varname' does exist but is not valid -// (e.g., not a number for an int32 flag), abort with an error. -// Otherwise, return the value. NOTE: for booleans, for true use -// 't' or 'T' or 'true' or '1', for false 'f' or 'F' or 'false' or '0'. - -extern GFLAGS_DLL_DECL bool BoolFromEnv(const char *varname, bool defval); -extern GFLAGS_DLL_DECL int32 Int32FromEnv(const char *varname, int32 defval); -extern GFLAGS_DLL_DECL uint32 Uint32FromEnv(const char *varname, uint32 defval); -extern GFLAGS_DLL_DECL int64 Int64FromEnv(const char *varname, int64 defval); -extern GFLAGS_DLL_DECL uint64 Uint64FromEnv(const char *varname, uint64 defval); -extern GFLAGS_DLL_DECL double DoubleFromEnv(const char *varname, double defval); -extern GFLAGS_DLL_DECL const char *StringFromEnv(const char *varname, const char *defval); - - -// -------------------------------------------------------------------- -// The next two functions parse gflags from main(): - -// Set the "usage" message for this program. For example: -// string usage("This program does nothing. Sample usage:\n"); -// usage += argv[0] + " "; -// SetUsageMessage(usage); -// Do not include commandline flags in the usage: we do that for you! -// Thread-hostile; meant to be called before any threads are spawned. -extern GFLAGS_DLL_DECL void SetUsageMessage(const std::string& usage); - -// Sets the version string, which is emitted with --version. -// For instance: SetVersionString("1.3"); -// Thread-hostile; meant to be called before any threads are spawned. -extern GFLAGS_DLL_DECL void SetVersionString(const std::string& version); - - -// Looks for flags in argv and parses them. Rearranges argv to put -// flags first, or removes them entirely if remove_flags is true. -// If a flag is defined more than once in the command line or flag -// file, the last definition is used. Returns the index (into argv) -// of the first non-flag argument. -// See top-of-file for more details on this function. -#ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead. -extern GFLAGS_DLL_DECL uint32 ParseCommandLineFlags(int *argc, char*** argv, bool remove_flags); -#endif - - -// Calls to ParseCommandLineNonHelpFlags and then to -// HandleCommandLineHelpFlags can be used instead of a call to -// ParseCommandLineFlags during initialization, in order to allow for -// changing default values for some FLAGS (via -// e.g. SetCommandLineOptionWithMode calls) between the time of -// command line parsing and the time of dumping help information for -// the flags as a result of command line parsing. If a flag is -// defined more than once in the command line or flag file, the last -// definition is used. Returns the index (into argv) of the first -// non-flag argument. (If remove_flags is true, will always return 1.) -extern GFLAGS_DLL_DECL uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv, bool remove_flags); - -// This is actually defined in gflags_reporting.cc. -// This function is misnamed (it also handles --version, etc.), but -// it's too late to change that now. :-( -extern GFLAGS_DLL_DECL void HandleCommandLineHelpFlags(); // in gflags_reporting.cc - -// Allow command line reparsing. Disables the error normally -// generated when an unknown flag is found, since it may be found in a -// later parse. Thread-hostile; meant to be called before any threads -// are spawned. -extern GFLAGS_DLL_DECL void AllowCommandLineReparsing(); - -// Reparse the flags that have not yet been recognized. Only flags -// registered since the last parse will be recognized. Any flag value -// must be provided as part of the argument using "=", not as a -// separate command line argument that follows the flag argument. -// Intended for handling flags from dynamically loaded libraries, -// since their flags are not registered until they are loaded. -extern GFLAGS_DLL_DECL void ReparseCommandLineNonHelpFlags(); - -// Clean up memory allocated by flags. This is only needed to reduce -// the quantity of "potentially leaked" reports emitted by memory -// debugging tools such as valgrind. It is not required for normal -// operation, or for the google perftools heap-checker. It must only -// be called when the process is about to exit, and all threads that -// might access flags are quiescent. Referencing flags after this is -// called will have unexpected consequences. This is not safe to run -// when multiple threads might be running: the function is -// thread-hostile. -extern GFLAGS_DLL_DECL void ShutDownCommandLineFlags(); - - -// -------------------------------------------------------------------- -// Now come the command line flag declaration/definition macros that -// will actually be used. They're kind of hairy. A major reason -// for this is initialization: we want people to be able to access -// variables in global constructors and have that not crash, even if -// their global constructor runs before the global constructor here. -// (Obviously, we can't guarantee the flags will have the correct -// default value in that case, but at least accessing them is safe.) -// The only way to do that is have flags point to a static buffer. -// So we make one, using a union to ensure proper alignment, and -// then use placement-new to actually set up the flag with the -// correct default value. In the same vein, we have to worry about -// flag access in global destructors, so FlagRegisterer has to be -// careful never to destroy the flag-values it constructs. -// -// Note that when we define a flag variable FLAGS_, we also -// preemptively define a junk variable, FLAGS_no. This is to -// cause a link-time error if someone tries to define 2 flags with -// names like "logging" and "nologging". We do this because a bool -// flag FLAG can be set from the command line to true with a "-FLAG" -// argument, and to false with a "-noFLAG" argument, and so this can -// potentially avert confusion. -// -// We also put flags into their own namespace. It is purposefully -// named in an opaque way that people should have trouble typing -// directly. The idea is that DEFINE puts the flag in the weird -// namespace, and DECLARE imports the flag from there into the current -// namespace. The net result is to force people to use DECLARE to get -// access to a flag, rather than saying "extern GFLAGS_DLL_DECL bool FLAGS_whatever;" -// or some such instead. We want this so we can put extra -// functionality (like sanity-checking) in DECLARE if we want, and -// make sure it is picked up everywhere. -// -// We also put the type of the variable in the namespace, so that -// people can't DECLARE_int32 something that they DEFINE_bool'd -// elsewhere. - -class GFLAGS_DLL_DECL FlagRegisterer { - public: - // We instantiate this template ctor for all supported types, - // so it is possible to place implementation of the FlagRegisterer ctor in - // .cc file. - // Calling this constructor with unsupported type will produce linker error. - template - FlagRegisterer(const char* name, - const char* help, const char* filename, - FlagType* current_storage, FlagType* defvalue_storage); -}; - -// Force compiler to not generate code for the given template specialization. -#if defined(_MSC_VER) && _MSC_VER < 1800 // Visual Studio 2013 version 12.0 - #define GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(type) -#else - #define GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(type) \ - extern template GFLAGS_DLL_DECL FlagRegisterer::FlagRegisterer( \ - const char* name, const char* help, const char* filename, \ - type* current_storage, type* defvalue_storage) -#endif - -// Do this for all supported flag types. -GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(bool); -GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(int32); -GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(uint32); -GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(int64); -GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(uint64); -GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(double); -GFLAGS_DECLARE_FLAG_REGISTERER_CTOR(std::string); - -#undef GFLAGS_DECLARE_FLAG_REGISTERER_CTOR - -// If your application #defines STRIP_FLAG_HELP to a non-zero value -// before #including this file, we remove the help message from the -// binary file. This can reduce the size of the resulting binary -// somewhat, and may also be useful for security reasons. - -extern GFLAGS_DLL_DECL const char kStrippedFlagHelp[]; - - -} // namespace GFLAGS_NAMESPACE - - -#ifndef SWIG // In swig, ignore the main flag declarations - -#if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0 -// Need this construct to avoid the 'defined but not used' warning. -#define MAYBE_STRIPPED_HELP(txt) \ - (false ? (txt) : GFLAGS_NAMESPACE::kStrippedFlagHelp) -#else -#define MAYBE_STRIPPED_HELP(txt) txt -#endif - -// Each command-line flag has two variables associated with it: one -// with the current value, and one with the default value. However, -// we have a third variable, which is where value is assigned; it's a -// constant. This guarantees that FLAG_##value is initialized at -// static initialization time (e.g. before program-start) rather than -// than global construction time (which is after program-start but -// before main), at least when 'value' is a compile-time constant. We -// use a small trick for the "default value" variable, and call it -// FLAGS_no. This serves the second purpose of assuring a -// compile error if someone tries to define a flag named no -// which is illegal (--foo and --nofoo both affect the "foo" flag). -#define DEFINE_VARIABLE(type, shorttype, name, value, help) \ - namespace fL##shorttype { \ - static const type FLAGS_nono##name = value; \ - /* We always want to export defined variables, dll or no */ \ - GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name; \ - static type FLAGS_no##name = FLAGS_nono##name; \ - static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \ - #name, MAYBE_STRIPPED_HELP(help), __FILE__, \ - &FLAGS_##name, &FLAGS_no##name); \ - } \ - using fL##shorttype::FLAGS_##name - -// For DEFINE_bool, we want to do the extra check that the passed-in -// value is actually a bool, and not a string or something that can be -// coerced to a bool. These declarations (no definition needed!) will -// help us do that, and never evaluate From, which is important. -// We'll use 'sizeof(IsBool(val))' to distinguish. This code requires -// that the compiler have different sizes for bool & double. Since -// this is not guaranteed by the standard, we check it with a -// COMPILE_ASSERT. -namespace fLB { -struct CompileAssert {}; -typedef CompileAssert expected_sizeof_double_neq_sizeof_bool[ - (sizeof(double) != sizeof(bool)) ? 1 : -1]; -template double GFLAGS_DLL_DECL IsBoolFlag(const From& from); -GFLAGS_DLL_DECL bool IsBoolFlag(bool from); -} // namespace fLB - -// Here are the actual DEFINE_*-macros. The respective DECLARE_*-macros -// are in a separate include, gflags_declare.h, for reducing -// the physical transitive size for DECLARE use. -#define DEFINE_bool(name, val, txt) \ - namespace fLB { \ - typedef ::fLB::CompileAssert FLAG_##name##_value_is_not_a_bool[ \ - (sizeof(::fLB::IsBoolFlag(val)) != sizeof(double))? 1: -1]; \ - } \ - DEFINE_VARIABLE(bool, B, name, val, txt) - -#define DEFINE_int32(name, val, txt) \ - DEFINE_VARIABLE(GFLAGS_NAMESPACE::int32, I, \ - name, val, txt) - -#define DEFINE_uint32(name,val, txt) \ - DEFINE_VARIABLE(GFLAGS_NAMESPACE::uint32, U, \ - name, val, txt) - -#define DEFINE_int64(name, val, txt) \ - DEFINE_VARIABLE(GFLAGS_NAMESPACE::int64, I64, \ - name, val, txt) - -#define DEFINE_uint64(name,val, txt) \ - DEFINE_VARIABLE(GFLAGS_NAMESPACE::uint64, U64, \ - name, val, txt) - -#define DEFINE_double(name, val, txt) \ - DEFINE_VARIABLE(double, D, name, val, txt) - -// Strings are trickier, because they're not a POD, so we can't -// construct them at static-initialization time (instead they get -// constructed at global-constructor time, which is much later). To -// try to avoid crashes in that case, we use a char buffer to store -// the string, which we can static-initialize, and then placement-new -// into it later. It's not perfect, but the best we can do. - -namespace fLS { - -inline clstring* dont_pass0toDEFINE_string(char *stringspot, - const char *value) { - return new(stringspot) clstring(value); -} -inline clstring* dont_pass0toDEFINE_string(char *stringspot, - const clstring &value) { - return new(stringspot) clstring(value); -} -inline clstring* dont_pass0toDEFINE_string(char *stringspot, - int value); - -// Auxiliary class used to explicitly call destructor of string objects -// allocated using placement new during static program deinitialization. -// The destructor MUST be an inline function such that the explicit -// destruction occurs in the same compilation unit as the placement new. -class StringFlagDestructor { - void *current_storage_; - void *defvalue_storage_; - -public: - - StringFlagDestructor(void *current, void *defvalue) - : current_storage_(current), defvalue_storage_(defvalue) {} - - ~StringFlagDestructor() { - reinterpret_cast(current_storage_ )->~clstring(); - reinterpret_cast(defvalue_storage_)->~clstring(); - } -}; - -} // namespace fLS - -// We need to define a var named FLAGS_no##name so people don't define -// --string and --nostring. And we need a temporary place to put val -// so we don't have to evaluate it twice. Two great needs that go -// great together! -// The weird 'using' + 'extern' inside the fLS namespace is to work around -// an unknown compiler bug/issue with the gcc 4.2.1 on SUSE 10. See -// http://code.google.com/p/google-gflags/issues/detail?id=20 -#define DEFINE_string(name, val, txt) \ - namespace fLS { \ - using ::fLS::clstring; \ - using ::fLS::StringFlagDestructor; \ - static union { void* align; char s[sizeof(clstring)]; } s_##name[2]; \ - clstring* const FLAGS_no##name = ::fLS:: \ - dont_pass0toDEFINE_string(s_##name[0].s, \ - val); \ - static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \ - #name, MAYBE_STRIPPED_HELP(txt), __FILE__, \ - FLAGS_no##name, new (s_##name[1].s) clstring(*FLAGS_no##name)); \ - static StringFlagDestructor d_##name(s_##name[0].s, s_##name[1].s); \ - extern GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name; \ - using fLS::FLAGS_##name; \ - clstring& FLAGS_##name = *FLAGS_no##name; \ - } \ - using fLS::FLAGS_##name - -#endif // SWIG - - -@INCLUDE_GFLAGS_NS_H@ - - -#endif // GFLAGS_GFLAGS_H_ diff --git a/demos/thirdparty/gflags/src/gflags_completions.cc b/demos/thirdparty/gflags/src/gflags_completions.cc deleted file mode 100644 index c53a128de51..00000000000 --- a/demos/thirdparty/gflags/src/gflags_completions.cc +++ /dev/null @@ -1,772 +0,0 @@ -// Copyright (c) 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --- - -// Bash-style command line flag completion for C++ binaries -// -// This module implements bash-style completions. It achieves this -// goal in the following broad chunks: -// -// 1) Take a to-be-completed word, and examine it for search hints -// 2) Identify all potentially matching flags -// 2a) If there are no matching flags, do nothing. -// 2b) If all matching flags share a common prefix longer than the -// completion word, output just that matching prefix -// 3) Categorize those flags to produce a rough ordering of relevence. -// 4) Potentially trim the set of flags returned to a smaller number -// that bash is happier with -// 5) Output the matching flags in groups ordered by relevence. -// 5a) Force bash to place most-relevent groups at the top of the list -// 5b) Trim most flag's descriptions to fit on a single terminal line - -#include -#include -#include // for strlen - -#include -#include -#include -#include - -#include "config.h" -#include "gflags/gflags.h" -#include "gflags/gflags_completions.h" -#include "util.h" - -using std::set; -using std::string; -using std::vector; - - -DEFINE_string(tab_completion_word, "", - "If non-empty, HandleCommandLineCompletions() will hijack the " - "process and attempt to do bash-style command line flag " - "completion on this value."); -DEFINE_int32(tab_completion_columns, 80, - "Number of columns to use in output for tab completion"); - - -namespace GFLAGS_NAMESPACE { - - -namespace { -// Function prototypes and Type forward declarations. Code may be -// more easily understood if it is roughly ordered according to -// control flow, rather than by C's "declare before use" ordering -struct CompletionOptions; -struct NotableFlags; - -// The entry point if flag completion is to be used. -static void PrintFlagCompletionInfo(void); - - -// 1) Examine search word -static void CanonicalizeCursorWordAndSearchOptions( - const string &cursor_word, - string *canonical_search_token, - CompletionOptions *options); - -static bool RemoveTrailingChar(string *str, char c); - - -// 2) Find all matches -static void FindMatchingFlags( - const vector &all_flags, - const CompletionOptions &options, - const string &match_token, - set *all_matches, - string *longest_common_prefix); - -static bool DoesSingleFlagMatch( - const CommandLineFlagInfo &flag, - const CompletionOptions &options, - const string &match_token); - - -// 3) Categorize matches -static void CategorizeAllMatchingFlags( - const set &all_matches, - const string &search_token, - const string &module, - const string &package_dir, - NotableFlags *notable_flags); - -static void TryFindModuleAndPackageDir( - const vector &all_flags, - string *module, - string *package_dir); - - -// 4) Decide which flags to use -static void FinalizeCompletionOutput( - const set &matching_flags, - CompletionOptions *options, - NotableFlags *notable_flags, - vector *completions); - -static void RetrieveUnusedFlags( - const set &matching_flags, - const NotableFlags ¬able_flags, - set *unused_flags); - - -// 5) Output matches -static void OutputSingleGroupWithLimit( - const set &group, - const string &line_indentation, - const string &header, - const string &footer, - bool long_output_format, - int *remaining_line_limit, - size_t *completion_elements_added, - vector *completions); - -// (helpers for #5) -static string GetShortFlagLine( - const string &line_indentation, - const CommandLineFlagInfo &info); - -static string GetLongFlagLine( - const string &line_indentation, - const CommandLineFlagInfo &info); - - -// -// Useful types - -// Try to deduce the intentions behind this completion attempt. Return the -// canonical search term in 'canonical_search_token'. Binary search options -// are returned in the various booleans, which should all have intuitive -// semantics, possibly except: -// - return_all_matching_flags: Generally, we'll trim the number of -// returned candidates to some small number, showing those that are -// most likely to be useful first. If this is set, however, the user -// really does want us to return every single flag as an option. -// - force_no_update: Any time we output lines, all of which share a -// common prefix, bash will 'helpfully' not even bother to show the -// output, instead changing the current word to be that common prefix. -// If it's clear this shouldn't happen, we'll set this boolean -struct CompletionOptions { - bool flag_name_substring_search; - bool flag_location_substring_search; - bool flag_description_substring_search; - bool return_all_matching_flags; - bool force_no_update; - CompletionOptions(): flag_name_substring_search(false), - flag_location_substring_search(false), - flag_description_substring_search(false), - return_all_matching_flags(false), - force_no_update(false) { } -}; - -// Notable flags are flags that are special or preferred for some -// reason. For example, flags that are defined in the binary's module -// are expected to be much more relevent than flags defined in some -// other random location. These sets are specified roughly in precedence -// order. Once a flag is placed in one of these 'higher' sets, it won't -// be placed in any of the 'lower' sets. -struct NotableFlags { - typedef set FlagSet; - FlagSet perfect_match_flag; - FlagSet module_flags; // Found in module file - FlagSet package_flags; // Found in same directory as module file - FlagSet most_common_flags; // One of the XXX most commonly supplied flags - FlagSet subpackage_flags; // Found in subdirectories of package -}; - - -// -// Tab completion implementation - entry point -static void PrintFlagCompletionInfo(void) { - string cursor_word = FLAGS_tab_completion_word; - string canonical_token; - CompletionOptions options = CompletionOptions(); - CanonicalizeCursorWordAndSearchOptions( - cursor_word, - &canonical_token, - &options); - - DVLOG(1) << "Identified canonical_token: '" << canonical_token << "'"; - - vector all_flags; - set matching_flags; - GetAllFlags(&all_flags); - DVLOG(2) << "Found " << all_flags.size() << " flags overall"; - - string longest_common_prefix; - FindMatchingFlags( - all_flags, - options, - canonical_token, - &matching_flags, - &longest_common_prefix); - DVLOG(1) << "Identified " << matching_flags.size() << " matching flags"; - DVLOG(1) << "Identified " << longest_common_prefix - << " as longest common prefix."; - if (longest_common_prefix.size() > canonical_token.size()) { - // There's actually a shared common prefix to all matching flags, - // so may as well output that and quit quickly. - DVLOG(1) << "The common prefix '" << longest_common_prefix - << "' was longer than the token '" << canonical_token - << "'. Returning just this prefix for completion."; - fprintf(stdout, "--%s", longest_common_prefix.c_str()); - return; - } - if (matching_flags.empty()) { - VLOG(1) << "There were no matching flags, returning nothing."; - return; - } - - string module; - string package_dir; - TryFindModuleAndPackageDir(all_flags, &module, &package_dir); - DVLOG(1) << "Identified module: '" << module << "'"; - DVLOG(1) << "Identified package_dir: '" << package_dir << "'"; - - NotableFlags notable_flags; - CategorizeAllMatchingFlags( - matching_flags, - canonical_token, - module, - package_dir, - ¬able_flags); - DVLOG(2) << "Categorized matching flags:"; - DVLOG(2) << " perfect_match: " << notable_flags.perfect_match_flag.size(); - DVLOG(2) << " module: " << notable_flags.module_flags.size(); - DVLOG(2) << " package: " << notable_flags.package_flags.size(); - DVLOG(2) << " most common: " << notable_flags.most_common_flags.size(); - DVLOG(2) << " subpackage: " << notable_flags.subpackage_flags.size(); - - vector completions; - FinalizeCompletionOutput( - matching_flags, - &options, - ¬able_flags, - &completions); - - if (options.force_no_update) - completions.push_back("~"); - - DVLOG(1) << "Finalized with " << completions.size() - << " chosen completions"; - - for (vector::const_iterator it = completions.begin(); - it != completions.end(); - ++it) { - DVLOG(9) << " Completion entry: '" << *it << "'"; - fprintf(stdout, "%s\n", it->c_str()); - } -} - - -// 1) Examine search word (and helper method) -static void CanonicalizeCursorWordAndSearchOptions( - const string &cursor_word, - string *canonical_search_token, - CompletionOptions *options) { - *canonical_search_token = cursor_word; - if (canonical_search_token->empty()) return; - - // Get rid of leading quotes and dashes in the search term - if ((*canonical_search_token)[0] == '"') - *canonical_search_token = canonical_search_token->substr(1); - while ((*canonical_search_token)[0] == '-') - *canonical_search_token = canonical_search_token->substr(1); - - options->flag_name_substring_search = false; - options->flag_location_substring_search = false; - options->flag_description_substring_search = false; - options->return_all_matching_flags = false; - options->force_no_update = false; - - // Look for all search options we can deduce now. Do this by walking - // backwards through the term, looking for up to three '?' and up to - // one '+' as suffixed characters. Consume them if found, and remove - // them from the canonical search token. - int found_question_marks = 0; - int found_plusses = 0; - while (true) { - if (found_question_marks < 3 && - RemoveTrailingChar(canonical_search_token, '?')) { - ++found_question_marks; - continue; - } - if (found_plusses < 1 && - RemoveTrailingChar(canonical_search_token, '+')) { - ++found_plusses; - continue; - } - break; - } - - switch (found_question_marks) { // all fallthroughs - case 3: options->flag_description_substring_search = true; - case 2: options->flag_location_substring_search = true; - case 1: options->flag_name_substring_search = true; - }; - - options->return_all_matching_flags = (found_plusses > 0); -} - -// Returns true if a char was removed -static bool RemoveTrailingChar(string *str, char c) { - if (str->empty()) return false; - if ((*str)[str->size() - 1] == c) { - *str = str->substr(0, str->size() - 1); - return true; - } - return false; -} - - -// 2) Find all matches (and helper methods) -static void FindMatchingFlags( - const vector &all_flags, - const CompletionOptions &options, - const string &match_token, - set *all_matches, - string *longest_common_prefix) { - all_matches->clear(); - bool first_match = true; - for (vector::const_iterator it = all_flags.begin(); - it != all_flags.end(); - ++it) { - if (DoesSingleFlagMatch(*it, options, match_token)) { - all_matches->insert(&*it); - if (first_match) { - first_match = false; - *longest_common_prefix = it->name; - } else { - if (longest_common_prefix->empty() || it->name.empty()) { - longest_common_prefix->clear(); - continue; - } - string::size_type pos = 0; - while (pos < longest_common_prefix->size() && - pos < it->name.size() && - (*longest_common_prefix)[pos] == it->name[pos]) - ++pos; - longest_common_prefix->erase(pos); - } - } - } -} - -// Given the set of all flags, the parsed match options, and the -// canonical search token, produce the set of all candidate matching -// flags for subsequent analysis or filtering. -static bool DoesSingleFlagMatch( - const CommandLineFlagInfo &flag, - const CompletionOptions &options, - const string &match_token) { - // Is there a prefix match? - string::size_type pos = flag.name.find(match_token); - if (pos == 0) return true; - - // Is there a substring match if we want it? - if (options.flag_name_substring_search && - pos != string::npos) - return true; - - // Is there a location match if we want it? - if (options.flag_location_substring_search && - flag.filename.find(match_token) != string::npos) - return true; - - // TODO(user): All searches should probably be case-insensitive - // (especially this one...) - if (options.flag_description_substring_search && - flag.description.find(match_token) != string::npos) - return true; - - return false; -} - -// 3) Categorize matches (and helper method) - -// Given a set of matching flags, categorize them by -// likely relevence to this specific binary -static void CategorizeAllMatchingFlags( - const set &all_matches, - const string &search_token, - const string &module, // empty if we couldn't find any - const string &package_dir, // empty if we couldn't find any - NotableFlags *notable_flags) { - notable_flags->perfect_match_flag.clear(); - notable_flags->module_flags.clear(); - notable_flags->package_flags.clear(); - notable_flags->most_common_flags.clear(); - notable_flags->subpackage_flags.clear(); - - for (set::const_iterator it = - all_matches.begin(); - it != all_matches.end(); - ++it) { - DVLOG(2) << "Examining match '" << (*it)->name << "'"; - DVLOG(7) << " filename: '" << (*it)->filename << "'"; - string::size_type pos = string::npos; - if (!package_dir.empty()) - pos = (*it)->filename.find(package_dir); - string::size_type slash = string::npos; - if (pos != string::npos) // candidate for package or subpackage match - slash = (*it)->filename.find( - PATH_SEPARATOR, - pos + package_dir.size() + 1); - - if ((*it)->name == search_token) { - // Exact match on some flag's name - notable_flags->perfect_match_flag.insert(*it); - DVLOG(3) << "Result: perfect match"; - } else if (!module.empty() && (*it)->filename == module) { - // Exact match on module filename - notable_flags->module_flags.insert(*it); - DVLOG(3) << "Result: module match"; - } else if (!package_dir.empty() && - pos != string::npos && slash == string::npos) { - // In the package, since there was no slash after the package portion - notable_flags->package_flags.insert(*it); - DVLOG(3) << "Result: package match"; - } else if (false) { - // In the list of the XXX most commonly supplied flags overall - // TODO(user): Compile this list. - DVLOG(3) << "Result: most-common match"; - } else if (!package_dir.empty() && - pos != string::npos && slash != string::npos) { - // In a subdirectory of the package - notable_flags->subpackage_flags.insert(*it); - DVLOG(3) << "Result: subpackage match"; - } - - DVLOG(3) << "Result: not special match"; - } -} - -static void PushNameWithSuffix(vector* suffixes, const char* suffix) { - suffixes->push_back( - StringPrintf("/%s%s", ProgramInvocationShortName(), suffix)); -} - -static void TryFindModuleAndPackageDir( - const vector &all_flags, - string *module, - string *package_dir) { - module->clear(); - package_dir->clear(); - - vector suffixes; - // TODO(user): There's some inherant ambiguity here - multiple directories - // could share the same trailing folder and file structure (and even worse, - // same file names), causing us to be unsure as to which of the two is the - // actual package for this binary. In this case, we'll arbitrarily choose. - PushNameWithSuffix(&suffixes, "."); - PushNameWithSuffix(&suffixes, "-main."); - PushNameWithSuffix(&suffixes, "_main."); - // These four are new but probably merited? - PushNameWithSuffix(&suffixes, "-test."); - PushNameWithSuffix(&suffixes, "_test."); - PushNameWithSuffix(&suffixes, "-unittest."); - PushNameWithSuffix(&suffixes, "_unittest."); - - for (vector::const_iterator it = all_flags.begin(); - it != all_flags.end(); - ++it) { - for (vector::const_iterator suffix = suffixes.begin(); - suffix != suffixes.end(); - ++suffix) { - // TODO(user): Make sure the match is near the end of the string - if (it->filename.find(*suffix) != string::npos) { - *module = it->filename; - string::size_type sep = it->filename.rfind(PATH_SEPARATOR); - *package_dir = it->filename.substr(0, (sep == string::npos) ? 0 : sep); - return; - } - } - } -} - -// Can't specialize template type on a locally defined type. Silly C++... -struct DisplayInfoGroup { - const char* header; - const char* footer; - set *group; - - int SizeInLines() const { - int size_in_lines = static_cast(group->size()) + 1; - if (strlen(header) > 0) { - size_in_lines++; - } - if (strlen(footer) > 0) { - size_in_lines++; - } - return size_in_lines; - } -}; - -// 4) Finalize and trim output flag set -static void FinalizeCompletionOutput( - const set &matching_flags, - CompletionOptions *options, - NotableFlags *notable_flags, - vector *completions) { - - // We want to output lines in groups. Each group needs to be indented - // the same to keep its lines together. Unless otherwise required, - // only 99 lines should be output to prevent bash from harassing the - // user. - - // First, figure out which output groups we'll actually use. For each - // nonempty group, there will be ~3 lines of header & footer, plus all - // output lines themselves. - int max_desired_lines = // "999999 flags should be enough for anyone. -dave" - (options->return_all_matching_flags ? 999999 : 98); - int lines_so_far = 0; - - vector output_groups; - bool perfect_match_found = false; - if (!notable_flags->perfect_match_flag.empty()) { - perfect_match_found = true; - DisplayInfoGroup group = - { "", - "==========", - ¬able_flags->perfect_match_flag }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - if (lines_so_far < max_desired_lines && - !notable_flags->module_flags.empty()) { - DisplayInfoGroup group = { - "-* Matching module flags *-", - "===========================", - ¬able_flags->module_flags }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - if (lines_so_far < max_desired_lines && - !notable_flags->package_flags.empty()) { - DisplayInfoGroup group = { - "-* Matching package flags *-", - "============================", - ¬able_flags->package_flags }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - if (lines_so_far < max_desired_lines && - !notable_flags->most_common_flags.empty()) { - DisplayInfoGroup group = { - "-* Commonly used flags *-", - "=========================", - ¬able_flags->most_common_flags }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - if (lines_so_far < max_desired_lines && - !notable_flags->subpackage_flags.empty()) { - DisplayInfoGroup group = { - "-* Matching sub-package flags *-", - "================================", - ¬able_flags->subpackage_flags }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - - set obscure_flags; // flags not notable - if (lines_so_far < max_desired_lines) { - RetrieveUnusedFlags(matching_flags, *notable_flags, &obscure_flags); - if (!obscure_flags.empty()) { - DisplayInfoGroup group = { - "-* Other flags *-", - "", - &obscure_flags }; - lines_so_far += group.SizeInLines(); - output_groups.push_back(group); - } - } - - // Second, go through each of the chosen output groups and output - // as many of those flags as we can, while remaining below our limit - int remaining_lines = max_desired_lines; - size_t completions_output = 0; - int indent = static_cast(output_groups.size()) - 1; - for (vector::const_iterator it = - output_groups.begin(); - it != output_groups.end(); - ++it, --indent) { - OutputSingleGroupWithLimit( - *it->group, // group - string(indent, ' '), // line indentation - string(it->header), // header - string(it->footer), // footer - perfect_match_found, // long format - &remaining_lines, // line limit - reduces this by number printed - &completions_output, // completions (not lines) added - completions); // produced completions - perfect_match_found = false; - } - - if (completions_output != matching_flags.size()) { - options->force_no_update = false; - completions->push_back("~ (Remaining flags hidden) ~"); - } else { - options->force_no_update = true; - } -} - -static void RetrieveUnusedFlags( - const set &matching_flags, - const NotableFlags ¬able_flags, - set *unused_flags) { - // Remove from 'matching_flags' set all members of the sets of - // flags we've already printed (specifically, those in notable_flags) - for (set::const_iterator it = - matching_flags.begin(); - it != matching_flags.end(); - ++it) { - if (notable_flags.perfect_match_flag.count(*it) || - notable_flags.module_flags.count(*it) || - notable_flags.package_flags.count(*it) || - notable_flags.most_common_flags.count(*it) || - notable_flags.subpackage_flags.count(*it)) - continue; - unused_flags->insert(*it); - } -} - -// 5) Output matches (and helper methods) - -static void OutputSingleGroupWithLimit( - const set &group, - const string &line_indentation, - const string &header, - const string &footer, - bool long_output_format, - int *remaining_line_limit, - size_t *completion_elements_output, - vector *completions) { - if (group.empty()) return; - if (!header.empty()) { - if (*remaining_line_limit < 2) return; - *remaining_line_limit -= 2; - completions->push_back(line_indentation + header); - completions->push_back(line_indentation + string(header.size(), '-')); - } - for (set::const_iterator it = group.begin(); - it != group.end() && *remaining_line_limit > 0; - ++it) { - --*remaining_line_limit; - ++*completion_elements_output; - completions->push_back( - (long_output_format - ? GetLongFlagLine(line_indentation, **it) - : GetShortFlagLine(line_indentation, **it))); - } - if (!footer.empty()) { - if (*remaining_line_limit < 1) return; - --*remaining_line_limit; - completions->push_back(line_indentation + footer); - } -} - -static string GetShortFlagLine( - const string &line_indentation, - const CommandLineFlagInfo &info) { - string prefix; - bool is_string = (info.type == "string"); - SStringPrintf(&prefix, "%s--%s [%s%s%s] ", - line_indentation.c_str(), - info.name.c_str(), - (is_string ? "'" : ""), - info.default_value.c_str(), - (is_string ? "'" : "")); - int remainder = - FLAGS_tab_completion_columns - static_cast(prefix.size()); - string suffix; - if (remainder > 0) - suffix = - (static_cast(info.description.size()) > remainder ? - (info.description.substr(0, remainder - 3) + "...").c_str() : - info.description.c_str()); - return prefix + suffix; -} - -static string GetLongFlagLine( - const string &line_indentation, - const CommandLineFlagInfo &info) { - - string output = DescribeOneFlag(info); - - // Replace '-' with '--', and remove trailing newline before appending - // the module definition location. - string old_flagname = "-" + info.name; - output.replace( - output.find(old_flagname), - old_flagname.size(), - "-" + old_flagname); - // Stick a newline and indentation in front of the type and default - // portions of DescribeOneFlag()s description - static const char kNewlineWithIndent[] = "\n "; - output.replace(output.find(" type:"), 1, string(kNewlineWithIndent)); - output.replace(output.find(" default:"), 1, string(kNewlineWithIndent)); - output = StringPrintf("%s Details for '--%s':\n" - "%s defined: %s", - line_indentation.c_str(), - info.name.c_str(), - output.c_str(), - info.filename.c_str()); - - // Eliminate any doubled newlines that crept in. Specifically, if - // DescribeOneFlag() decided to break the line just before "type" - // or "default", we don't want to introduce an extra blank line - static const string line_of_spaces(FLAGS_tab_completion_columns, ' '); - static const char kDoubledNewlines[] = "\n \n"; - for (string::size_type newlines = output.find(kDoubledNewlines); - newlines != string::npos; - newlines = output.find(kDoubledNewlines)) - // Replace each 'doubled newline' with a single newline - output.replace(newlines, sizeof(kDoubledNewlines) - 1, string("\n")); - - for (string::size_type newline = output.find('\n'); - newline != string::npos; - newline = output.find('\n')) { - int newline_pos = static_cast(newline) % FLAGS_tab_completion_columns; - int missing_spaces = FLAGS_tab_completion_columns - newline_pos; - output.replace(newline, 1, line_of_spaces, 1, missing_spaces); - } - return output; -} -} // anonymous - -void HandleCommandLineCompletions(void) { - if (FLAGS_tab_completion_word.empty()) return; - PrintFlagCompletionInfo(); - gflags_exitfunc(0); -} - - -} // namespace GFLAGS_NAMESPACE diff --git a/demos/thirdparty/gflags/src/gflags_completions.h.in b/demos/thirdparty/gflags/src/gflags_completions.h.in deleted file mode 100644 index b27e5fda114..00000000000 --- a/demos/thirdparty/gflags/src/gflags_completions.h.in +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --- - -// -// Implement helpful bash-style command line flag completions -// -// ** Functional API: -// HandleCommandLineCompletions() should be called early during -// program startup, but after command line flag code has been -// initialized, such as the beginning of HandleCommandLineHelpFlags(). -// It checks the value of the flag --tab_completion_word. If this -// flag is empty, nothing happens here. If it contains a string, -// however, then HandleCommandLineCompletions() will hijack the -// process, attempting to identify the intention behind this -// completion. Regardless of the outcome of this deduction, the -// process will be terminated, similar to --helpshort flag -// handling. -// -// ** Overview of Bash completions: -// Bash can be told to programatically determine completions for the -// current 'cursor word'. It does this by (in this case) invoking a -// command with some additional arguments identifying the command -// being executed, the word being completed, and the previous word -// (if any). Bash then expects a sequence of output lines to be -// printed to stdout. If these lines all contain a common prefix -// longer than the cursor word, bash will replace the cursor word -// with that common prefix, and display nothing. If there isn't such -// a common prefix, bash will display the lines in pages using 'more'. -// -// ** Strategy taken for command line completions: -// If we can deduce either the exact flag intended, or a common flag -// prefix, we'll output exactly that. Otherwise, if information -// must be displayed to the user, we'll take the opportunity to add -// some helpful information beyond just the flag name (specifically, -// we'll include the default flag value and as much of the flag's -// description as can fit on a single terminal line width, as specified -// by the flag --tab_completion_columns). Furthermore, we'll try to -// make bash order the output such that the most useful or relevent -// flags are the most likely to be shown at the top. -// -// ** Additional features: -// To assist in finding that one really useful flag, substring matching -// was implemented. Before pressing a to get completion for the -// current word, you can append one or more '?' to the flag to do -// substring matching. Here's the semantics: -// --foo Show me all flags with names prefixed by 'foo' -// --foo? Show me all flags with 'foo' somewhere in the name -// --foo?? Same as prior case, but also search in module -// definition path for 'foo' -// --foo??? Same as prior case, but also search in flag -// descriptions for 'foo' -// Finally, we'll trim the output to a relatively small number of -// flags to keep bash quiet about the verbosity of output. If one -// really wanted to see all possible matches, appending a '+' to the -// search word will force the exhaustive list of matches to be printed. -// -// ** How to have bash accept completions from a binary: -// Bash requires that it be informed about each command that programmatic -// completion should be enabled for. Example addition to a .bashrc -// file would be (your path to gflags_completions.sh file may differ): - -/* -$ complete -o bashdefault -o default -o nospace -C \ - '/home/build/eng/bash/bash_completions.sh --tab_completion_columns $COLUMNS' \ - time env binary_name another_binary [...] -*/ - -// This would allow the following to work: -// $ /path/to/binary_name --vmodule -// Or: -// $ ./bin/path/another_binary --gfs_u -// (etc) -// -// Sadly, it appears that bash gives no easy way to force this behavior for -// all commands. That's where the "time" in the above example comes in. -// If you haven't specifically added a command to the list of completion -// supported commands, you can still get completions by prefixing the -// entire command with "env". -// $ env /some/brand/new/binary --vmod -// Assuming that "binary" is a newly compiled binary, this should still -// produce the expected completion output. - - -#ifndef GFLAGS_COMPLETIONS_H_ -#define GFLAGS_COMPLETIONS_H_ - -namespace @GFLAGS_NAMESPACE@ { - -extern void HandleCommandLineCompletions(void); - -} - -#endif // GFLAGS_COMPLETIONS_H_ diff --git a/demos/thirdparty/gflags/src/gflags_completions.sh b/demos/thirdparty/gflags/src/gflags_completions.sh deleted file mode 100755 index c5fb7e6bc57..00000000000 --- a/demos/thirdparty/gflags/src/gflags_completions.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2008, Google Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# --- -# Author: Dave Nicponski -# -# This script is invoked by bash in response to a matching compspec. When -# this happens, bash calls this script using the command shown in the -C -# block of the complete entry, but also appends 3 arguments. They are: -# - The command being used for completion -# - The word being completed -# - The word preceding the completion word. -# -# Here's an example of how you might use this script: -# $ complete -o bashdefault -o default -o nospace -C \ -# '/usr/local/bin/gflags_completions.sh --tab_completion_columns $COLUMNS' \ -# time env binary_name another_binary [...] - -# completion_word_index gets the index of the (N-1)th argument for -# this command line. completion_word gets the actual argument from -# this command line at the (N-1)th position -completion_word_index="$(($# - 1))" -completion_word="${!completion_word_index}" - -# TODO(user): Replace this once gflags_completions.cc has -# a bool parameter indicating unambiguously to hijack the process for -# completion purposes. -if [ -z "$completion_word" ]; then - # Until an empty value for the completion word stops being misunderstood - # by binaries, don't actually execute the binary or the process - # won't be hijacked! - exit 0 -fi - -# binary_index gets the index of the command being completed (which bash -# places in the (N-2)nd position. binary gets the actual command from -# this command line at that (N-2)nd position -binary_index="$(($# - 2))" -binary="${!binary_index}" - -# For completions to be universal, we may have setup the compspec to -# trigger on 'harmless pass-through' commands, like 'time' or 'env'. -# If the command being completed is one of those two, we'll need to -# identify the actual command being executed. To do this, we need -# the actual command line that the was pressed on. Bash helpfully -# places this in the $COMP_LINE variable. -if [ "$binary" == "time" ] || [ "$binary" == "env" ]; then - # we'll assume that the first 'argument' is actually the - # binary - - - # TODO(user): This is not perfect - the 'env' command, for instance, - # is allowed to have options between the 'env' and 'the command to - # be executed'. For example, consider: - # $ env FOO="bar" bin/do_something --help - # In this case, we'll mistake the FOO="bar" portion as the binary. - # Perhaps we should continuing consuming leading words until we - # either run out of words, or find a word that is a valid file - # marked as executable. I can't think of any reason this wouldn't - # work. - - # Break up the 'original command line' (not this script's command line, - # rather the one the was pressed on) and find the second word. - parts=( ${COMP_LINE} ) - binary=${parts[1]} -fi - -# Build the command line to use for completion. Basically it involves -# passing through all the arguments given to this script (except the 3 -# that bash added), and appending a '--tab_completion_word "WORD"' to -# the arguments. -params="" -for ((i=1; i<=$(($# - 3)); ++i)); do - params="$params \"${!i}\""; -done -params="$params --tab_completion_word \"$completion_word\"" - -# TODO(user): Perhaps stash the output in a temporary file somewhere -# in /tmp, and only cat it to stdout if the command returned a success -# code, to prevent false positives - -# If we think we have a reasonable command to execute, then execute it -# and hope for the best. -candidate=$(type -p "$binary") -if [ ! -z "$candidate" ]; then - eval "$candidate 2>/dev/null $params" -elif [ -f "$binary" ] && [ -x "$binary" ]; then - eval "$binary 2>/dev/null $params" -fi diff --git a/demos/thirdparty/gflags/src/gflags_declare.h.in b/demos/thirdparty/gflags/src/gflags_declare.h.in deleted file mode 100644 index ab7bd248418..00000000000 --- a/demos/thirdparty/gflags/src/gflags_declare.h.in +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) 1999, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// -// Revamped and reorganized by Craig Silverstein -// -// This is the file that should be included by any file which declares -// command line flag. - -#ifndef GFLAGS_DECLARE_H_ -#define GFLAGS_DECLARE_H_ - - -// --------------------------------------------------------------------------- -// Namespace of gflags library symbols. -#define GFLAGS_NAMESPACE @GFLAGS_NAMESPACE@ - -// --------------------------------------------------------------------------- -// Windows DLL import/export. - -// Whether gflags library is a DLL. -// -// Set to 1 by default when the shared gflags library was built on Windows. -// Must be overwritten when this header file is used with the optionally also -// built static library instead; set by CMake's INTERFACE_COMPILE_DEFINITIONS. -#ifndef GFLAGS_IS_A_DLL -# define GFLAGS_IS_A_DLL @GFLAGS_IS_A_DLL@ -#endif - -// We always want to import the symbols of the gflags library. -#ifndef GFLAGS_DLL_DECL -# if GFLAGS_IS_A_DLL && defined(_MSC_VER) -# define GFLAGS_DLL_DECL __declspec(dllimport) -# elif defined(__GNUC__) && __GNUC__ >= 4 -# define GFLAGS_DLL_DECL __attribute__((visibility("default"))) -# else -# define GFLAGS_DLL_DECL -# endif -#endif - -// We always want to import variables declared in user code. -#ifndef GFLAGS_DLL_DECLARE_FLAG -# if GFLAGS_IS_A_DLL && defined(_MSC_VER) -# define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport) -# elif defined(__GNUC__) && __GNUC__ >= 4 -# define GFLAGS_DLL_DECLARE_FLAG __attribute__((visibility("default"))) -# else -# define GFLAGS_DLL_DECLARE_FLAG -# endif -#endif - -// --------------------------------------------------------------------------- -// Flag types -#include -#if @HAVE_STDINT_H@ -# include // the normal place uint32_t is defined -#elif @HAVE_SYS_TYPES_H@ -# include // the normal place u_int32_t is defined -#elif @HAVE_INTTYPES_H@ -# include // a third place for uint32_t or u_int32_t -#endif - -namespace GFLAGS_NAMESPACE { - -#if @GFLAGS_INTTYPES_FORMAT_C99@ // C99 -typedef int32_t int32; -typedef uint32_t uint32; -typedef int64_t int64; -typedef uint64_t uint64; -#elif @GFLAGS_INTTYPES_FORMAT_BSD@ // BSD -typedef int32_t int32; -typedef u_int32_t uint32; -typedef int64_t int64; -typedef u_int64_t uint64; -#elif @GFLAGS_INTTYPES_FORMAT_VC7@ // Windows -typedef __int32 int32; -typedef unsigned __int32 uint32; -typedef __int64 int64; -typedef unsigned __int64 uint64; -#else -# error Do not know how to define a 32-bit integer quantity on your system -#endif - -} // namespace GFLAGS_NAMESPACE - - -namespace fLS { - -// The meaning of "string" might be different between now and when the -// macros below get invoked (e.g., if someone is experimenting with -// other string implementations that get defined after this file is -// included). Save the current meaning now and use it in the macros. -typedef std::string clstring; - -} // namespace fLS - - -#define DECLARE_VARIABLE(type, shorttype, name) \ - /* We always want to import declared variables, dll or no */ \ - namespace fL##shorttype { extern GFLAGS_DLL_DECLARE_FLAG type FLAGS_##name; } \ - using fL##shorttype::FLAGS_##name - -#define DECLARE_bool(name) \ - DECLARE_VARIABLE(bool, B, name) - -#define DECLARE_int32(name) \ - DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int32, I, name) - -#define DECLARE_uint32(name) \ - DECLARE_VARIABLE(::GFLAGS_NAMESPACE::uint32, U, name) - -#define DECLARE_int64(name) \ - DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int64, I64, name) - -#define DECLARE_uint64(name) \ - DECLARE_VARIABLE(::GFLAGS_NAMESPACE::uint64, U64, name) - -#define DECLARE_double(name) \ - DECLARE_VARIABLE(double, D, name) - -#define DECLARE_string(name) \ - /* We always want to import declared variables, dll or no */ \ - namespace fLS { \ - extern GFLAGS_DLL_DECLARE_FLAG ::fLS::clstring& FLAGS_##name; \ - } \ - using fLS::FLAGS_##name - - -#endif // GFLAGS_DECLARE_H_ diff --git a/demos/thirdparty/gflags/src/gflags_ns.h.in b/demos/thirdparty/gflags/src/gflags_ns.h.in deleted file mode 100644 index ef6ac29868c..00000000000 --- a/demos/thirdparty/gflags/src/gflags_ns.h.in +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2014, Andreas Schuh -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// ----------------------------------------------------------------------------- -// Imports the gflags library symbols into an alternative/deprecated namespace. - -#ifndef GFLAGS_GFLAGS_H_ -# error The internal header gflags_@ns@.h may only be included by gflags.h -#endif - -#ifndef GFLAGS_NS_@NS@_H_ -#define GFLAGS_NS_@NS@_H_ - - -namespace @ns@ { - - -using GFLAGS_NAMESPACE::int32; -using GFLAGS_NAMESPACE::uint32; -using GFLAGS_NAMESPACE::int64; -using GFLAGS_NAMESPACE::uint64; - -using GFLAGS_NAMESPACE::RegisterFlagValidator; -using GFLAGS_NAMESPACE::CommandLineFlagInfo; -using GFLAGS_NAMESPACE::GetAllFlags; -using GFLAGS_NAMESPACE::ShowUsageWithFlags; -using GFLAGS_NAMESPACE::ShowUsageWithFlagsRestrict; -using GFLAGS_NAMESPACE::DescribeOneFlag; -using GFLAGS_NAMESPACE::SetArgv; -using GFLAGS_NAMESPACE::GetArgvs; -using GFLAGS_NAMESPACE::GetArgv; -using GFLAGS_NAMESPACE::GetArgv0; -using GFLAGS_NAMESPACE::GetArgvSum; -using GFLAGS_NAMESPACE::ProgramInvocationName; -using GFLAGS_NAMESPACE::ProgramInvocationShortName; -using GFLAGS_NAMESPACE::ProgramUsage; -using GFLAGS_NAMESPACE::VersionString; -using GFLAGS_NAMESPACE::GetCommandLineOption; -using GFLAGS_NAMESPACE::GetCommandLineFlagInfo; -using GFLAGS_NAMESPACE::GetCommandLineFlagInfoOrDie; -using GFLAGS_NAMESPACE::FlagSettingMode; -using GFLAGS_NAMESPACE::SET_FLAGS_VALUE; -using GFLAGS_NAMESPACE::SET_FLAG_IF_DEFAULT; -using GFLAGS_NAMESPACE::SET_FLAGS_DEFAULT; -using GFLAGS_NAMESPACE::SetCommandLineOption; -using GFLAGS_NAMESPACE::SetCommandLineOptionWithMode; -using GFLAGS_NAMESPACE::FlagSaver; -using GFLAGS_NAMESPACE::CommandlineFlagsIntoString; -using GFLAGS_NAMESPACE::ReadFlagsFromString; -using GFLAGS_NAMESPACE::AppendFlagsIntoFile; -using GFLAGS_NAMESPACE::ReadFromFlagsFile; -using GFLAGS_NAMESPACE::BoolFromEnv; -using GFLAGS_NAMESPACE::Int32FromEnv; -using GFLAGS_NAMESPACE::Uint32FromEnv; -using GFLAGS_NAMESPACE::Int64FromEnv; -using GFLAGS_NAMESPACE::Uint64FromEnv; -using GFLAGS_NAMESPACE::DoubleFromEnv; -using GFLAGS_NAMESPACE::StringFromEnv; -using GFLAGS_NAMESPACE::SetUsageMessage; -using GFLAGS_NAMESPACE::SetVersionString; -using GFLAGS_NAMESPACE::ParseCommandLineNonHelpFlags; -using GFLAGS_NAMESPACE::HandleCommandLineHelpFlags; -using GFLAGS_NAMESPACE::AllowCommandLineReparsing; -using GFLAGS_NAMESPACE::ReparseCommandLineNonHelpFlags; -using GFLAGS_NAMESPACE::ShutDownCommandLineFlags; -using GFLAGS_NAMESPACE::FlagRegisterer; - -#ifndef SWIG -using GFLAGS_NAMESPACE::ParseCommandLineFlags; -#endif - - -} // namespace @ns@ - - -#endif // GFLAGS_NS_@NS@_H_ diff --git a/demos/thirdparty/gflags/src/gflags_reporting.cc b/demos/thirdparty/gflags/src/gflags_reporting.cc deleted file mode 100644 index 29be922faeb..00000000000 --- a/demos/thirdparty/gflags/src/gflags_reporting.cc +++ /dev/null @@ -1,442 +0,0 @@ -// Copyright (c) 1999, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// -// Revamped and reorganized by Craig Silverstein -// -// This file contains code for handling the 'reporting' flags. These -// are flags that, when present, cause the program to report some -// information and then exit. --help and --version are the canonical -// reporting flags, but we also have flags like --helpxml, etc. -// -// There's only one function that's meant to be called externally: -// HandleCommandLineHelpFlags(). (Well, actually, ShowUsageWithFlags(), -// ShowUsageWithFlagsRestrict(), and DescribeOneFlag() can be called -// externally too, but there's little need for it.) These are all -// declared in the main gflags.h header file. -// -// HandleCommandLineHelpFlags() will check what 'reporting' flags have -// been defined, if any -- the "help" part of the function name is a -// bit misleading -- and do the relevant reporting. It should be -// called after all flag-values have been assigned, that is, after -// parsing the command-line. - -#include -#include -#include -#include -#include -#include - -#include "config.h" -#include "gflags/gflags.h" -#include "gflags/gflags_completions.h" -#include "util.h" - - -// The 'reporting' flags. They all call gflags_exitfunc(). -DEFINE_bool (help, false, "show help on all flags [tip: all flags can have two dashes]"); -DEFINE_bool (helpfull, false, "show help on all flags -- same as -help"); -DEFINE_bool (helpshort, false, "show help on only the main module for this program"); -DEFINE_string(helpon, "", "show help on the modules named by this flag value"); -DEFINE_string(helpmatch, "", "show help on modules whose name contains the specified substr"); -DEFINE_bool (helppackage, false, "show help on all modules in the main package"); -DEFINE_bool (helpxml, false, "produce an xml version of help"); -DEFINE_bool (version, false, "show version and build info and exit"); - - -namespace GFLAGS_NAMESPACE { - - -using std::string; -using std::vector; - - -// -------------------------------------------------------------------- -// DescribeOneFlag() -// DescribeOneFlagInXML() -// Routines that pretty-print info about a flag. These use -// a CommandLineFlagInfo, which is the way the gflags -// API exposes static info about a flag. -// -------------------------------------------------------------------- - -static const int kLineLength = 80; - -static void AddString(const string& s, - string* final_string, int* chars_in_line) { - const int slen = static_cast(s.length()); - if (*chars_in_line + 1 + slen >= kLineLength) { // < 80 chars/line - *final_string += "\n "; - *chars_in_line = 6; - } else { - *final_string += " "; - *chars_in_line += 1; - } - *final_string += s; - *chars_in_line += slen; -} - -static string PrintStringFlagsWithQuotes(const CommandLineFlagInfo& flag, - const string& text, bool current) { - const char* c_string = (current ? flag.current_value.c_str() : - flag.default_value.c_str()); - if (strcmp(flag.type.c_str(), "string") == 0) { // add quotes for strings - return StringPrintf("%s: \"%s\"", text.c_str(), c_string); - } else { - return StringPrintf("%s: %s", text.c_str(), c_string); - } -} - -// Create a descriptive string for a flag. -// Goes to some trouble to make pretty line breaks. -string DescribeOneFlag(const CommandLineFlagInfo& flag) { - string main_part; - SStringPrintf(&main_part, " -%s (%s)", - flag.name.c_str(), - flag.description.c_str()); - const char* c_string = main_part.c_str(); - int chars_left = static_cast(main_part.length()); - string final_string = ""; - int chars_in_line = 0; // how many chars in current line so far? - while (1) { - assert(static_cast(chars_left) - == strlen(c_string)); // Unless there's a \0 in there? - const char* newline = strchr(c_string, '\n'); - if (newline == NULL && chars_in_line+chars_left < kLineLength) { - // The whole remainder of the string fits on this line - final_string += c_string; - chars_in_line += chars_left; - break; - } - if (newline != NULL && newline - c_string < kLineLength - chars_in_line) { - int n = static_cast(newline - c_string); - final_string.append(c_string, n); - chars_left -= n + 1; - c_string += n + 1; - } else { - // Find the last whitespace on this 80-char line - int whitespace = kLineLength-chars_in_line-1; // < 80 chars/line - while ( whitespace > 0 && !isspace(c_string[whitespace]) ) { - --whitespace; - } - if (whitespace <= 0) { - // Couldn't find any whitespace to make a line break. Just dump the - // rest out! - final_string += c_string; - chars_in_line = kLineLength; // next part gets its own line for sure! - break; - } - final_string += string(c_string, whitespace); - chars_in_line += whitespace; - while (isspace(c_string[whitespace])) ++whitespace; - c_string += whitespace; - chars_left -= whitespace; - } - if (*c_string == '\0') - break; - StringAppendF(&final_string, "\n "); - chars_in_line = 6; - } - - // Append data type - AddString(string("type: ") + flag.type, &final_string, &chars_in_line); - // The listed default value will be the actual default from the flag - // definition in the originating source file, unless the value has - // subsequently been modified using SetCommandLineOptionWithMode() with mode - // SET_FLAGS_DEFAULT, or by setting FLAGS_foo = bar before ParseCommandLineFlags(). - AddString(PrintStringFlagsWithQuotes(flag, "default", false), &final_string, - &chars_in_line); - if (!flag.is_default) { - AddString(PrintStringFlagsWithQuotes(flag, "currently", true), - &final_string, &chars_in_line); - } - - StringAppendF(&final_string, "\n"); - return final_string; -} - -// Simple routine to xml-escape a string: escape & and < only. -static string XMLText(const string& txt) { - string ans = txt; - for (string::size_type pos = 0; (pos = ans.find("&", pos)) != string::npos; ) - ans.replace(pos++, 1, "&"); - for (string::size_type pos = 0; (pos = ans.find("<", pos)) != string::npos; ) - ans.replace(pos++, 1, "<"); - return ans; -} - -static void AddXMLTag(string* r, const char* tag, const string& txt) { - StringAppendF(r, "<%s>%s", tag, XMLText(txt).c_str(), tag); -} - - -static string DescribeOneFlagInXML(const CommandLineFlagInfo& flag) { - // The file and flagname could have been attributes, but default - // and meaning need to avoid attribute normalization. This way it - // can be parsed by simple programs, in addition to xml parsers. - string r(""); - AddXMLTag(&r, "file", flag.filename); - AddXMLTag(&r, "name", flag.name); - AddXMLTag(&r, "meaning", flag.description); - AddXMLTag(&r, "default", flag.default_value); - AddXMLTag(&r, "current", flag.current_value); - AddXMLTag(&r, "type", flag.type); - r += ""; - return r; -} - -// -------------------------------------------------------------------- -// ShowUsageWithFlags() -// ShowUsageWithFlagsRestrict() -// ShowXMLOfFlags() -// These routines variously expose the registry's list of flag -// values. ShowUsage*() prints the flag-value information -// to stdout in a user-readable format (that's what --help uses). -// The Restrict() version limits what flags are shown. -// ShowXMLOfFlags() prints the flag-value information to stdout -// in a machine-readable format. In all cases, the flags are -// sorted: first by filename they are defined in, then by flagname. -// -------------------------------------------------------------------- - -static const char* Basename(const char* filename) { - const char* sep = strrchr(filename, PATH_SEPARATOR); - return sep ? sep + 1 : filename; -} - -static string Dirname(const string& filename) { - string::size_type sep = filename.rfind(PATH_SEPARATOR); - return filename.substr(0, (sep == string::npos) ? 0 : sep); -} - -// Test whether a filename contains at least one of the substrings. -static bool FileMatchesSubstring(const string& filename, - const vector& substrings) { - for (vector::const_iterator target = substrings.begin(); - target != substrings.end(); - ++target) { - if (strstr(filename.c_str(), target->c_str()) != NULL) - return true; - // If the substring starts with a '/', that means that we want - // the string to be at the beginning of a directory component. - // That should match the first directory component as well, so - // we allow '/foo' to match a filename of 'foo'. - if (!target->empty() && (*target)[0] == PATH_SEPARATOR && - strncmp(filename.c_str(), target->c_str() + 1, - strlen(target->c_str() + 1)) == 0) - return true; - } - return false; -} - -// Show help for every filename which matches any of the target substrings. -// If substrings is empty, shows help for every file. If a flag's help message -// has been stripped (e.g. by adding '#define STRIP_FLAG_HELP 1' -// before including gflags/gflags.h), then this flag will not be displayed -// by '--help' and its variants. -static void ShowUsageWithFlagsMatching(const char *argv0, - const vector &substrings) { - fprintf(stdout, "%s: %s\n", Basename(argv0), ProgramUsage()); - - vector flags; - GetAllFlags(&flags); // flags are sorted by filename, then flagname - - string last_filename; // so we know when we're at a new file - bool first_directory = true; // controls blank lines between dirs - bool found_match = false; // stays false iff no dir matches restrict - for (vector::const_iterator flag = flags.begin(); - flag != flags.end(); - ++flag) { - if (substrings.empty() || - FileMatchesSubstring(flag->filename, substrings)) { - // If the flag has been stripped, pretend that it doesn't exist. - if (flag->description == kStrippedFlagHelp) continue; - found_match = true; // this flag passed the match! - if (flag->filename != last_filename) { // new file - if (Dirname(flag->filename) != Dirname(last_filename)) { // new dir! - if (!first_directory) - fprintf(stdout, "\n\n"); // put blank lines between directories - first_directory = false; - } - fprintf(stdout, "\n Flags from %s:\n", flag->filename.c_str()); - last_filename = flag->filename; - } - // Now print this flag - fprintf(stdout, "%s", DescribeOneFlag(*flag).c_str()); - } - } - if (!found_match && !substrings.empty()) { - fprintf(stdout, "\n No modules matched: use -help\n"); - } -} - -void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict_) { - vector substrings; - if (restrict_ != NULL && *restrict_ != '\0') { - substrings.push_back(restrict_); - } - ShowUsageWithFlagsMatching(argv0, substrings); -} - -void ShowUsageWithFlags(const char *argv0) { - ShowUsageWithFlagsRestrict(argv0, ""); -} - -// Convert the help, program, and usage to xml. -static void ShowXMLOfFlags(const char *prog_name) { - vector flags; - GetAllFlags(&flags); // flags are sorted: by filename, then flagname - - // XML. There is no corresponding schema yet - fprintf(stdout, "\n"); - // The document - fprintf(stdout, "\n"); - // the program name and usage - fprintf(stdout, "%s\n", - XMLText(Basename(prog_name)).c_str()); - fprintf(stdout, "%s\n", - XMLText(ProgramUsage()).c_str()); - // All the flags - for (vector::const_iterator flag = flags.begin(); - flag != flags.end(); - ++flag) { - if (flag->description != kStrippedFlagHelp) - fprintf(stdout, "%s\n", DescribeOneFlagInXML(*flag).c_str()); - } - // The end of the document - fprintf(stdout, "\n"); -} - -// -------------------------------------------------------------------- -// ShowVersion() -// Called upon --version. Prints build-related info. -// -------------------------------------------------------------------- - -static void ShowVersion() { - const char* version_string = VersionString(); - if (version_string && *version_string) { - fprintf(stdout, "%s version %s\n", - ProgramInvocationShortName(), version_string); - } else { - fprintf(stdout, "%s\n", ProgramInvocationShortName()); - } -# if !defined(NDEBUG) - fprintf(stdout, "Debug build (NDEBUG not #defined)\n"); -# endif -} - -static void AppendPrognameStrings(vector* substrings, - const char* progname) { - string r(""); - r += PATH_SEPARATOR; - r += progname; - substrings->push_back(r + "."); - substrings->push_back(r + "-main."); - substrings->push_back(r + "_main."); -} - -// -------------------------------------------------------------------- -// HandleCommandLineHelpFlags() -// Checks all the 'reporting' commandline flags to see if any -// have been set. If so, handles them appropriately. Note -// that all of them, by definition, cause the program to exit -// if they trigger. -// -------------------------------------------------------------------- - -void HandleCommandLineHelpFlags() { - const char* progname = ProgramInvocationShortName(); - - HandleCommandLineCompletions(); - - vector substrings; - AppendPrognameStrings(&substrings, progname); - - if (FLAGS_helpshort) { - // show only flags related to this binary: - // E.g. for fileutil.cc, want flags containing ... "/fileutil." cc - ShowUsageWithFlagsMatching(progname, substrings); - gflags_exitfunc(1); - - } else if (FLAGS_help || FLAGS_helpfull) { - // show all options - ShowUsageWithFlagsRestrict(progname, ""); // empty restrict - gflags_exitfunc(1); - - } else if (!FLAGS_helpon.empty()) { - string restrict_ = PATH_SEPARATOR + FLAGS_helpon + "."; - ShowUsageWithFlagsRestrict(progname, restrict_.c_str()); - gflags_exitfunc(1); - - } else if (!FLAGS_helpmatch.empty()) { - ShowUsageWithFlagsRestrict(progname, FLAGS_helpmatch.c_str()); - gflags_exitfunc(1); - - } else if (FLAGS_helppackage) { - // Shows help for all files in the same directory as main(). We - // don't want to resort to looking at dirname(progname), because - // the user can pick progname, and it may not relate to the file - // where main() resides. So instead, we search the flags for a - // filename like "/progname.cc", and take the dirname of that. - vector flags; - GetAllFlags(&flags); - string last_package; - for (vector::const_iterator flag = flags.begin(); - flag != flags.end(); - ++flag) { - if (!FileMatchesSubstring(flag->filename, substrings)) - continue; - const string package = Dirname(flag->filename) + PATH_SEPARATOR; - if (package != last_package) { - ShowUsageWithFlagsRestrict(progname, package.c_str()); - VLOG(7) << "Found package: " << package; - if (!last_package.empty()) { // means this isn't our first pkg - LOG(WARNING) << "Multiple packages contain a file=" << progname; - } - last_package = package; - } - } - if (last_package.empty()) { // never found a package to print - LOG(WARNING) << "Unable to find a package for file=" << progname; - } - gflags_exitfunc(1); - - } else if (FLAGS_helpxml) { - ShowXMLOfFlags(progname); - gflags_exitfunc(1); - - } else if (FLAGS_version) { - ShowVersion(); - // Unlike help, we may be asking for version in a script, so return 0 - gflags_exitfunc(0); - - } -} - - -} // namespace GFLAGS_NAMESPACE diff --git a/demos/thirdparty/gflags/src/mutex.h b/demos/thirdparty/gflags/src/mutex.h deleted file mode 100644 index 7d7c364b795..00000000000 --- a/demos/thirdparty/gflags/src/mutex.h +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --- -// -// A simple mutex wrapper, supporting locks and read-write locks. -// You should assume the locks are *not* re-entrant. -// -// This class is meant to be internal-only and should be wrapped by an -// internal namespace. Before you use this module, please give the -// name of your internal namespace for this module. Or, if you want -// to expose it, you'll want to move it to the Google namespace. We -// cannot put this class in global namespace because there can be some -// problems when we have multiple versions of Mutex in each shared object. -// -// NOTE: by default, we have #ifdef'ed out the TryLock() method. -// This is for two reasons: -// 1) TryLock() under Windows is a bit annoying (it requires a -// #define to be defined very early). -// 2) TryLock() is broken for NO_THREADS mode, at least in NDEBUG -// mode. -// If you need TryLock(), and either these two caveats are not a -// problem for you, or you're willing to work around them, then -// feel free to #define GMUTEX_TRYLOCK, or to remove the #ifdefs -// in the code below. -// -// CYGWIN NOTE: Cygwin support for rwlock seems to be buggy: -// http://www.cygwin.com/ml/cygwin/2008-12/msg00017.html -// Because of that, we might as well use windows locks for -// cygwin. They seem to be more reliable than the cygwin pthreads layer. -// -// TRICKY IMPLEMENTATION NOTE: -// This class is designed to be safe to use during -// dynamic-initialization -- that is, by global constructors that are -// run before main() starts. The issue in this case is that -// dynamic-initialization happens in an unpredictable order, and it -// could be that someone else's dynamic initializer could call a -// function that tries to acquire this mutex -- but that all happens -// before this mutex's constructor has run. (This can happen even if -// the mutex and the function that uses the mutex are in the same .cc -// file.) Basically, because Mutex does non-trivial work in its -// constructor, it's not, in the naive implementation, safe to use -// before dynamic initialization has run on it. -// -// The solution used here is to pair the actual mutex primitive with a -// bool that is set to true when the mutex is dynamically initialized. -// (Before that it's false.) Then we modify all mutex routines to -// look at the bool, and not try to lock/unlock until the bool makes -// it to true (which happens after the Mutex constructor has run.) -// -// This works because before main() starts -- particularly, during -// dynamic initialization -- there are no threads, so a) it's ok that -// the mutex operations are a no-op, since we don't need locking then -// anyway; and b) we can be quite confident our bool won't change -// state between a call to Lock() and a call to Unlock() (that would -// require a global constructor in one translation unit to call Lock() -// and another global constructor in another translation unit to call -// Unlock() later, which is pretty perverse). -// -// That said, it's tricky, and can conceivably fail; it's safest to -// avoid trying to acquire a mutex in a global constructor, if you -// can. One way it can fail is that a really smart compiler might -// initialize the bool to true at static-initialization time (too -// early) rather than at dynamic-initialization time. To discourage -// that, we set is_safe_ to true in code (not the constructor -// colon-initializer) and set it to true via a function that always -// evaluates to true, but that the compiler can't know always -// evaluates to true. This should be good enough. -// -// A related issue is code that could try to access the mutex -// after it's been destroyed in the global destructors (because -// the Mutex global destructor runs before some other global -// destructor, that tries to acquire the mutex). The way we -// deal with this is by taking a constructor arg that global -// mutexes should pass in, that causes the destructor to do no -// work. We still depend on the compiler not doing anything -// weird to a Mutex's memory after it is destroyed, but for a -// static global variable, that's pretty safe. - -#ifndef GFLAGS_MUTEX_H_ -#define GFLAGS_MUTEX_H_ - -#include "gflags/gflags_declare.h" // to figure out pthreads support - -#if defined(NO_THREADS) - typedef int MutexType; // to keep a lock-count -#elif defined(OS_WINDOWS) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN // We only need minimal includes -# endif -# ifndef NOMINMAX -# define NOMINMAX // Don't want windows to override min()/max() -# endif -# ifdef GMUTEX_TRYLOCK - // We need Windows NT or later for TryEnterCriticalSection(). If you - // don't need that functionality, you can remove these _WIN32_WINNT - // lines, and change TryLock() to assert(0) or something. -# ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0400 -# endif -# endif -# include - typedef CRITICAL_SECTION MutexType; -#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK) - // Needed for pthread_rwlock_*. If it causes problems, you could take it - // out, but then you'd have to unset HAVE_RWLOCK (at least on linux -- it - // *does* cause problems for FreeBSD, or MacOSX, but isn't needed - // for locking there.) -# ifdef __linux__ -# if _XOPEN_SOURCE < 500 // including not being defined at all -# undef _XOPEN_SOURCE -# define _XOPEN_SOURCE 500 // may be needed to get the rwlock calls -# endif -# endif -# include - typedef pthread_rwlock_t MutexType; -#elif defined(HAVE_PTHREAD) -# include - typedef pthread_mutex_t MutexType; -#else -# error Need to implement mutex.h for your architecture, or #define NO_THREADS -#endif - -#include -#include // for abort() - -#define MUTEX_NAMESPACE gflags_mutex_namespace - -namespace MUTEX_NAMESPACE { - -class Mutex { - public: - // This is used for the single-arg constructor - enum LinkerInitialized { LINKER_INITIALIZED }; - - // Create a Mutex that is not held by anybody. This constructor is - // typically used for Mutexes allocated on the heap or the stack. - inline Mutex(); - // This constructor should be used for global, static Mutex objects. - // It inhibits work being done by the destructor, which makes it - // safer for code that tries to acqiure this mutex in their global - // destructor. - explicit inline Mutex(LinkerInitialized); - - // Destructor - inline ~Mutex(); - - inline void Lock(); // Block if needed until free then acquire exclusively - inline void Unlock(); // Release a lock acquired via Lock() -#ifdef GMUTEX_TRYLOCK - inline bool TryLock(); // If free, Lock() and return true, else return false -#endif - // Note that on systems that don't support read-write locks, these may - // be implemented as synonyms to Lock() and Unlock(). So you can use - // these for efficiency, but don't use them anyplace where being able - // to do shared reads is necessary to avoid deadlock. - inline void ReaderLock(); // Block until free or shared then acquire a share - inline void ReaderUnlock(); // Release a read share of this Mutex - inline void WriterLock() { Lock(); } // Acquire an exclusive lock - inline void WriterUnlock() { Unlock(); } // Release a lock from WriterLock() - - private: - MutexType mutex_; - // We want to make sure that the compiler sets is_safe_ to true only - // when we tell it to, and never makes assumptions is_safe_ is - // always true. volatile is the most reliable way to do that. - volatile bool is_safe_; - // This indicates which constructor was called. - bool destroy_; - - inline void SetIsSafe() { is_safe_ = true; } - - // Catch the error of writing Mutex when intending MutexLock. - explicit Mutex(Mutex* /*ignored*/) {} - // Disallow "evil" constructors - Mutex(const Mutex&); - void operator=(const Mutex&); -}; - -// Now the implementation of Mutex for various systems -#if defined(NO_THREADS) - -// When we don't have threads, we can be either reading or writing, -// but not both. We can have lots of readers at once (in no-threads -// mode, that's most likely to happen in recursive function calls), -// but only one writer. We represent this by having mutex_ be -1 when -// writing and a number > 0 when reading (and 0 when no lock is held). -// -// In debug mode, we assert these invariants, while in non-debug mode -// we do nothing, for efficiency. That's why everything is in an -// assert. - -Mutex::Mutex() : mutex_(0) { } -Mutex::Mutex(Mutex::LinkerInitialized) : mutex_(0) { } -Mutex::~Mutex() { assert(mutex_ == 0); } -void Mutex::Lock() { assert(--mutex_ == -1); } -void Mutex::Unlock() { assert(mutex_++ == -1); } -#ifdef GMUTEX_TRYLOCK -bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; } -#endif -void Mutex::ReaderLock() { assert(++mutex_ > 0); } -void Mutex::ReaderUnlock() { assert(mutex_-- > 0); } - -#elif defined(OS_WINDOWS) - -Mutex::Mutex() : destroy_(true) { - InitializeCriticalSection(&mutex_); - SetIsSafe(); -} -Mutex::Mutex(LinkerInitialized) : destroy_(false) { - InitializeCriticalSection(&mutex_); - SetIsSafe(); -} -Mutex::~Mutex() { if (destroy_) DeleteCriticalSection(&mutex_); } -void Mutex::Lock() { if (is_safe_) EnterCriticalSection(&mutex_); } -void Mutex::Unlock() { if (is_safe_) LeaveCriticalSection(&mutex_); } -#ifdef GMUTEX_TRYLOCK -bool Mutex::TryLock() { return is_safe_ ? - TryEnterCriticalSection(&mutex_) != 0 : true; } -#endif -void Mutex::ReaderLock() { Lock(); } // we don't have read-write locks -void Mutex::ReaderUnlock() { Unlock(); } - -#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK) - -#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \ - if (is_safe_ && fncall(&mutex_) != 0) abort(); \ -} while (0) - -Mutex::Mutex() : destroy_(true) { - SetIsSafe(); - if (is_safe_ && pthread_rwlock_init(&mutex_, NULL) != 0) abort(); -} -Mutex::Mutex(Mutex::LinkerInitialized) : destroy_(false) { - SetIsSafe(); - if (is_safe_ && pthread_rwlock_init(&mutex_, NULL) != 0) abort(); -} -Mutex::~Mutex() { if (destroy_) SAFE_PTHREAD(pthread_rwlock_destroy); } -void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock); } -void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } -#ifdef GMUTEX_TRYLOCK -bool Mutex::TryLock() { return is_safe_ ? - pthread_rwlock_trywrlock(&mutex_) == 0 : true; } -#endif -void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock); } -void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } -#undef SAFE_PTHREAD - -#elif defined(HAVE_PTHREAD) - -#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \ - if (is_safe_ && fncall(&mutex_) != 0) abort(); \ -} while (0) - -Mutex::Mutex() : destroy_(true) { - SetIsSafe(); - if (is_safe_ && pthread_mutex_init(&mutex_, NULL) != 0) abort(); -} -Mutex::Mutex(Mutex::LinkerInitialized) : destroy_(false) { - SetIsSafe(); - if (is_safe_ && pthread_mutex_init(&mutex_, NULL) != 0) abort(); -} -Mutex::~Mutex() { if (destroy_) SAFE_PTHREAD(pthread_mutex_destroy); } -void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock); } -void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock); } -#ifdef GMUTEX_TRYLOCK -bool Mutex::TryLock() { return is_safe_ ? - pthread_mutex_trylock(&mutex_) == 0 : true; } -#endif -void Mutex::ReaderLock() { Lock(); } -void Mutex::ReaderUnlock() { Unlock(); } -#undef SAFE_PTHREAD - -#endif - -// -------------------------------------------------------------------------- -// Some helper classes - -// MutexLock(mu) acquires mu when constructed and releases it when destroyed. -class MutexLock { - public: - explicit MutexLock(Mutex *mu) : mu_(mu) { mu_->Lock(); } - ~MutexLock() { mu_->Unlock(); } - private: - Mutex * const mu_; - // Disallow "evil" constructors - MutexLock(const MutexLock&); - void operator=(const MutexLock&); -}; - -// ReaderMutexLock and WriterMutexLock do the same, for rwlocks -class ReaderMutexLock { - public: - explicit ReaderMutexLock(Mutex *mu) : mu_(mu) { mu_->ReaderLock(); } - ~ReaderMutexLock() { mu_->ReaderUnlock(); } - private: - Mutex * const mu_; - // Disallow "evil" constructors - ReaderMutexLock(const ReaderMutexLock&); - void operator=(const ReaderMutexLock&); -}; - -class WriterMutexLock { - public: - explicit WriterMutexLock(Mutex *mu) : mu_(mu) { mu_->WriterLock(); } - ~WriterMutexLock() { mu_->WriterUnlock(); } - private: - Mutex * const mu_; - // Disallow "evil" constructors - WriterMutexLock(const WriterMutexLock&); - void operator=(const WriterMutexLock&); -}; - -// Catch bug where variable name is omitted, e.g. MutexLock (&mu); -#define MutexLock(x) COMPILE_ASSERT(0, mutex_lock_decl_missing_var_name) -#define ReaderMutexLock(x) COMPILE_ASSERT(0, rmutex_lock_decl_missing_var_name) -#define WriterMutexLock(x) COMPILE_ASSERT(0, wmutex_lock_decl_missing_var_name) - -} // namespace MUTEX_NAMESPACE - - -#endif /* #define GFLAGS_MUTEX_H__ */ diff --git a/demos/thirdparty/gflags/src/util.h b/demos/thirdparty/gflags/src/util.h deleted file mode 100644 index 164e3cf86ab..00000000000 --- a/demos/thirdparty/gflags/src/util.h +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) 2011, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// --- -// -// Some generically useful utility routines that in google-land would -// be their own projects. We make a shortened version here. - -#ifndef GFLAGS_UTIL_H_ -#define GFLAGS_UTIL_H_ - -#include "config.h" - -#include -#ifdef HAVE_INTTYPES_H -# include -#endif -#include // for va_* -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_STAT_H -# include // for mkdir -#endif - - -namespace GFLAGS_NAMESPACE { - - -// This is used for unittests for death-testing. It is defined in gflags.cc. -extern GFLAGS_DLL_DECL void (*gflags_exitfunc)(int); - -// Work properly if either strtoll or strtoq is on this system. -#if defined(strtoll) || defined(HAVE_STRTOLL) -# define strto64 strtoll -# define strtou64 strtoull -#elif defined(HAVE_STRTOQ) -# define strto64 strtoq -# define strtou64 strtouq -// Neither strtoll nor strtoq are defined. I hope strtol works! -#else -# define strto64 strtol -# define strtou64 strtoul -#endif - -// If we have inttypes.h, it will have defined PRId32/etc for us. -// If not, take our best guess. -#ifndef PRId32 -# define PRId32 "d" -#endif -#ifndef PRId64 -# define PRId64 "lld" -#endif -#ifndef PRIu64 -# define PRIu64 "llu" -#endif - -typedef signed char int8; -typedef unsigned char uint8; - -// -- utility macros --------------------------------------------------------- - -template struct CompileAssert; -template <> struct CompileAssert {}; -#define COMPILE_ASSERT(expr, msg) \ - enum { assert_##msg = sizeof(CompileAssert) } - -// Returns the number of elements in an array. -#define arraysize(arr) (sizeof(arr)/sizeof(*(arr))) - - -// -- logging and testing --------------------------------------------------- - -// For now, we ignore the level for logging, and don't show *VLOG's at -// all, except by hand-editing the lines below -#define LOG(level) std::cerr -#define VLOG(level) if (true) {} else std::cerr -#define DVLOG(level) if (true) {} else std::cerr - -// CHECK dies with a fatal error if condition is not true. It is *not* -// controlled by NDEBUG, so the check will be executed regardless of -// compilation mode. Therefore, it is safe to do things like: -// CHECK(fp->Write(x) == 4) -// We allow stream-like objects after this for debugging, but they're ignored. -#define EXPECT_TRUE(condition) \ - if (true) { \ - if (!(condition)) { \ - fprintf(stderr, "Check failed: %s\n", #condition); \ - exit(1); \ - } \ - } else std::cerr << "" - -#define EXPECT_OP(op, val1, val2) \ - if (true) { \ - if (!((val1) op (val2))) { \ - fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2); \ - exit(1); \ - } \ - } else std::cerr << "" - -#define EXPECT_EQ(val1, val2) EXPECT_OP(==, val1, val2) -#define EXPECT_NE(val1, val2) EXPECT_OP(!=, val1, val2) -#define EXPECT_LE(val1, val2) EXPECT_OP(<=, val1, val2) -#define EXPECT_LT(val1, val2) EXPECT_OP(< , val1, val2) -#define EXPECT_GE(val1, val2) EXPECT_OP(>=, val1, val2) -#define EXPECT_GT(val1, val2) EXPECT_OP(> , val1, val2) -#define EXPECT_FALSE(cond) EXPECT_TRUE(!(cond)) - -// C99 declares isnan and isinf should be macros, so the #ifdef test -// should be reliable everywhere. Of course, it's not, but these -// are testing pertty marginal functionality anyway, so it's ok to -// not-run them even in situations they might, with effort, be made to work. -#ifdef isnan // Some compilers, like sun's for Solaris 10, don't define this -#define EXPECT_NAN(arg) \ - do { \ - if (!isnan(arg)) { \ - fprintf(stderr, "Check failed: isnan(%s)\n", #arg); \ - exit(1); \ - } \ - } while (0) -#else -#define EXPECT_NAN(arg) -#endif - -#ifdef isinf // Some compilers, like sun's for Solaris 10, don't define this -#define EXPECT_INF(arg) \ - do { \ - if (!isinf(arg)) { \ - fprintf(stderr, "Check failed: isinf(%s)\n", #arg); \ - exit(1); \ - } \ - } while (0) -#else -#define EXPECT_INF(arg) -#endif - -#define EXPECT_DOUBLE_EQ(val1, val2) \ - do { \ - if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) { \ - fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2); \ - exit(1); \ - } \ - } while (0) - -#define EXPECT_STREQ(val1, val2) \ - do { \ - if (strcmp((val1), (val2)) != 0) { \ - fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2); \ - exit(1); \ - } \ - } while (0) - -// Call this in a .cc file where you will later call RUN_ALL_TESTS in main(). -#define TEST_INIT \ - static std::vector g_testlist; /* the tests to run */ \ - static int RUN_ALL_TESTS() { \ - std::vector::const_iterator it; \ - for (it = g_testlist.begin(); it != g_testlist.end(); ++it) { \ - (*it)(); /* The test will error-exit if there's a problem. */ \ - } \ - fprintf(stderr, "\nPassed %d tests\n\nPASS\n", \ - static_cast(g_testlist.size())); \ - return 0; \ - } - -// Note that this macro uses a FlagSaver to keep tests isolated. -#define TEST(a, b) \ - struct Test_##a##_##b { \ - Test_##a##_##b() { g_testlist.push_back(&Run); } \ - static void Run() { \ - FlagSaver fs; \ - fprintf(stderr, "Running test %s/%s\n", #a, #b); \ - RunTest(); \ - } \ - static void RunTest(); \ - }; \ - static Test_##a##_##b g_test_##a##_##b; \ - void Test_##a##_##b::RunTest() - -// This is a dummy class that eases the google->opensource transition. -namespace testing { -class Test {}; -} - -// Call this in a .cc file where you will later call EXPECT_DEATH -#define EXPECT_DEATH_INIT \ - static bool g_called_exit; \ - static void CalledExit(int) { g_called_exit = true; } - -#define EXPECT_DEATH(fn, msg) \ - do { \ - g_called_exit = false; \ - gflags_exitfunc = &CalledExit; \ - fn; \ - gflags_exitfunc = &exit; /* set back to its default */ \ - if (!g_called_exit) { \ - fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn); \ - exit(1); \ - } \ - } while (0) - -#define GTEST_HAS_DEATH_TEST 1 - -// -- path routines ---------------------------------------------------------- - -// Tries to create the directory path as a temp-dir. If it fails, -// changes path to some directory it *can* create. -#if defined(__MINGW32__) -#include -inline void MakeTmpdir(std::string* path) { - if (!path->empty()) { - path->append("/gflags_unittest_testdir"); - int err = mkdir(path->c_str()); - if (err == 0 || errno == EEXIST) return; - } - // I had trouble creating a directory in /tmp from mingw - *path = "./gflags_unittest"; - mkdir(path->c_str()); -} -#elif defined(_MSC_VER) -#include -inline void MakeTmpdir(std::string* path) { - if (!path->empty()) { - int err = _mkdir(path->c_str()); - if (err == 0 || errno == EEXIST) return; - } - char tmppath_buffer[1024]; - int tmppath_len = GetTempPathA(sizeof(tmppath_buffer), tmppath_buffer); - assert(tmppath_len > 0 && tmppath_len < sizeof(tmppath_buffer)); - assert(tmppath_buffer[tmppath_len - 1] == '\\'); // API guarantees it - *path = std::string(tmppath_buffer) + "gflags_unittest"; - _mkdir(path->c_str()); -} -#else -inline void MakeTmpdir(std::string* path) { - if (!path->empty()) { - int err = mkdir(path->c_str(), 0755); - if (err == 0 || errno == EEXIST) return; - } - mkdir("/tmp/gflags_unittest", 0755); -} -#endif - -// -- string routines -------------------------------------------------------- - -inline void InternalStringPrintf(std::string* output, const char* format, - va_list ap) { - char space[128]; // try a small buffer and hope it fits - - // It's possible for methods that use a va_list to invalidate - // the data in it upon use. The fix is to make a copy - // of the structure before using it and use that copy instead. - va_list backup_ap; - va_copy(backup_ap, ap); - int bytes_written = vsnprintf(space, sizeof(space), format, backup_ap); - va_end(backup_ap); - - if ((bytes_written >= 0) && (static_cast(bytes_written) < sizeof(space))) { - output->append(space, bytes_written); - return; - } - - // Repeatedly increase buffer size until it fits. - int length = sizeof(space); - while (true) { - if (bytes_written < 0) { - // Older snprintf() behavior. :-( Just try doubling the buffer size - length *= 2; - } else { - // We need exactly "bytes_written+1" characters - length = bytes_written+1; - } - char* buf = new char[length]; - - // Restore the va_list before we use it again - va_copy(backup_ap, ap); - bytes_written = vsnprintf(buf, length, format, backup_ap); - va_end(backup_ap); - - if ((bytes_written >= 0) && (bytes_written < length)) { - output->append(buf, bytes_written); - delete[] buf; - return; - } - delete[] buf; - } -} - -// Clears output before writing to it. -inline void SStringPrintf(std::string* output, const char* format, ...) { - va_list ap; - va_start(ap, format); - output->clear(); - InternalStringPrintf(output, format, ap); - va_end(ap); -} - -inline void StringAppendF(std::string* output, const char* format, ...) { - va_list ap; - va_start(ap, format); - InternalStringPrintf(output, format, ap); - va_end(ap); -} - -inline std::string StringPrintf(const char* format, ...) { - va_list ap; - va_start(ap, format); - std::string output; - InternalStringPrintf(&output, format, ap); - va_end(ap); - return output; -} - -inline bool SafeGetEnv(const char *varname, std::string &valstr) -{ -#if defined(_MSC_VER) && _MSC_VER >= 1400 - char *val; - size_t sz; - if (_dupenv_s(&val, &sz, varname) != 0 || !val) return false; - valstr = val; - free(val); -#else - const char * const val = getenv(varname); - if (!val) return false; - valstr = val; -#endif - return true; -} - -inline int SafeFOpen(FILE **fp, const char* fname, const char *mode) -{ -#if defined(_MSC_VER) && _MSC_VER >= 1400 - return fopen_s(fp, fname, mode); -#else - assert(fp != NULL); - *fp = fopen(fname, mode); - // errno only guaranteed to be set on failure - return ((*fp == NULL) ? errno : 0); -#endif -} - - -} // namespace GFLAGS_NAMESPACE - - -#endif // GFLAGS_UTIL_H_ diff --git a/demos/thirdparty/gflags/src/windows_port.cc b/demos/thirdparty/gflags/src/windows_port.cc deleted file mode 100644 index b5b7194c9a4..00000000000 --- a/demos/thirdparty/gflags/src/windows_port.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright (c) 2009, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * --- - * Author: Craig Silverstein - */ - -#ifndef _WIN32 -# error You should only be including windows/port.cc in a windows environment! -#endif - -#include // for strlen(), memset(), memcmp() -#include -#include // for va_list, va_start, va_end -#include - -#include "windows_port.h" - -// These call the windows _vsnprintf, but always NUL-terminate. -#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */ -#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */ - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4996) // ignore _vsnprintf security warning -#endif -int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) { - if (size == 0) // not even room for a \0? - return -1; // not what C99 says to do, but what windows does - str[size-1] = '\0'; - return _vsnprintf(str, size-1, format, ap); -} -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -int snprintf(char *str, size_t size, const char *format, ...) { - int r; - va_list ap; - va_start(ap, format); - r = vsnprintf(str, size, format, ap); - va_end(ap); - return r; -} - -#endif /* if !(defined(_MSC_VER) && _MSC_VER >= 1900) */ -#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */ diff --git a/demos/thirdparty/gflags/src/windows_port.h b/demos/thirdparty/gflags/src/windows_port.h deleted file mode 100644 index 59a310e1031..00000000000 --- a/demos/thirdparty/gflags/src/windows_port.h +++ /dev/null @@ -1,135 +0,0 @@ -/* Copyright (c) 2009, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * --- - * Author: Craig Silverstein - * - * These are some portability typedefs and defines to make it a bit - * easier to compile this code under VC++. - * - * Several of these are taken from glib: - * http://developer.gnome.org/doc/API/glib/glib-windows-compatability-functions.html - */ - -#ifndef GFLAGS_WINDOWS_PORT_H_ -#define GFLAGS_WINDOWS_PORT_H_ - -#include "config.h" - -// This must be defined before the windows.h is included. -// It's needed for mutex.h, to give access to the TryLock method. -# if !defined(_WIN32_WINNT) && !(defined( __MINGW32__) || defined(__MINGW64__)) -# define _WIN32_WINNT 0x0400 -# endif -// We always want minimal includes -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif -#include -#include /* for mkdir */ -#include /* for _putenv, getenv */ -#include /* need this to override stdio's snprintf, also defines _unlink used by unit tests */ -#include /* util.h uses va_copy */ -#include /* for _stricmp and _strdup */ - -/* We can't just use _vsnprintf and _snprintf as drop-in-replacements, - * because they don't always NUL-terminate. :-( We also can't use the - * name vsnprintf, since windows defines that (but not snprintf (!)). - */ -#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */ -#if !(defined(_MSC_VER) && _MSC_VER >= 1900) /* msvc 2015 already defines */ -extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size, - const char *format, ...); -extern int GFLAGS_DLL_DECL safe_vsnprintf(char *str, size_t size, - const char *format, va_list ap); -#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap) -#define va_copy(dst, src) (dst) = (src) -#endif -#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */ - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4996) // ignore getenv security warning -#endif -#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L -inline void setenv(const char* name, const char* value, int) { - // In windows, it's impossible to set a variable to the empty string. - // We handle this by setting it to "0" and the NUL-ing out the \0. - // That is, we putenv("FOO=0") and then find out where in memory the - // putenv wrote "FOO=0", and change it in-place to "FOO=\0". - // c.f. http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/environ.cpp?r1=611451&r2=637508&pathrev=637508 - static const char* const kFakeZero = "0"; - if (*value == '\0') - value = kFakeZero; - // Apparently the semantics of putenv() is that the input - // must live forever, so we leak memory here. :-( - const size_t nameval_len = strlen(name) + 1 + strlen(value) + 1; - char* nameval = reinterpret_cast(malloc(nameval_len)); - snprintf(nameval, nameval_len, "%s=%s", name, value); - _putenv(nameval); - if (value == kFakeZero) { - nameval[nameval_len - 2] = '\0'; // works when putenv() makes no copy - if (*getenv(name) != '\0') - *getenv(name) = '\0'; // works when putenv() copies nameval - } -} -#endif -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#define strcasecmp _stricmp - -#if defined(_MSC_VER) && _MSC_VER >= 1400 -#define strdup _strdup -#define unlink _unlink -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1800 -#include -#else -#define PRId32 "d" -#define PRIu32 "u" -#define PRId64 "I64d" -#define PRIu64 "I64u" -#endif - -#if !defined(__MINGW32__) && !defined(__MINGW64__) -#define strtoq _strtoi64 -#define strtouq _strtoui64 -#define strtoll _strtoi64 -#define strtoull _strtoui64 -#define atoll _atoi64 -#endif - -#ifndef PATH_MAX -#define PATH_MAX 1024 -#endif - -#endif /* GFLAGS_WINDOWS_PORT_H_ */ diff --git a/demos/thirdparty/gflags/test/CMakeLists.txt b/demos/thirdparty/gflags/test/CMakeLists.txt deleted file mode 100644 index 4cd1e69702a..00000000000 --- a/demos/thirdparty/gflags/test/CMakeLists.txt +++ /dev/null @@ -1,209 +0,0 @@ -## gflags tests - -# ---------------------------------------------------------------------------- -# output directories -set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") -set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") -set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") - -# set working directory of test commands -set (GFLAGS_FLAGFILES_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - -# ---------------------------------------------------------------------------- -# common include directories and link libraries -include_directories ("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories ("${gflags_SOURCE_DIR}/src") -include_directories ("${gflags_BINARY_DIR}/include") -include_directories ("${gflags_BINARY_DIR}/include/gflags") - -if (BUILD_SHARED_LIBS) - set (type shared) - if (GFLAGS_IS_A_DLL) - add_definitions(-DGFLAGS_IS_A_DLL) - endif () -else () - set (type static) -endif () -if (BUILD_gflags_LIB) - link_libraries (gflags_${type}) -else () - link_libraries (gflags_nothreads_${type}) -endif () - -# ---------------------------------------------------------------------------- -# STRIP_FLAG_HELP -add_executable (gflags_strip_flags_test gflags_strip_flags_test.cc) -# Make sure the --help output doesn't print the stripped text. -add_gflags_test (strip_flags_help 1 "" "This text should be stripped out" gflags_strip_flags_test --help) -# Make sure the stripped text isn't in the binary at all. -add_test ( - NAME strip_flags_binary - COMMAND "${CMAKE_COMMAND}" "-DBINARY=$" - -P "${CMAKE_CURRENT_SOURCE_DIR}/gflags_strip_flags_test.cmake" - CONFIGURATIONS Release MinSizeRel -) - -# ---------------------------------------------------------------------------- -# unit tests -configure_file (gflags_unittest.cc gflags_unittest-main.cc COPYONLY) -configure_file (gflags_unittest.cc gflags_unittest_main.cc COPYONLY) - -add_executable (gflags_unittest gflags_unittest.cc) -add_executable (gflags_unittest-main gflags_unittest-main.cc) -add_executable (gflags_unittest_main gflags_unittest_main.cc) - -if (OS_WINDOWS) - set (SLASH "\\\\") -else () - set (SLASH "/") -endif () - -# First, just make sure the gflags_unittest works as-is -add_gflags_test(unittest 0 "" "" gflags_unittest) - -# --help should show all flags, including flags from gflags_reporting -add_gflags_test(help-reporting 1 "${SLASH}gflags_reporting.cc:" "" gflags_unittest --help) - -# Make sure that --help prints even very long helpstrings. -add_gflags_test(long-helpstring 1 "end of a long helpstring" "" gflags_unittest --help) - -# Make sure --help reflects flag changes made before flag-parsing -add_gflags_test(changed_bool1 1 "-changed_bool1 (changed) type: bool default: true" "" gflags_unittest --help) -add_gflags_test(changed_bool2 1 "-changed_bool2 (changed) type: bool default: false currently: true" "" gflags_unittest --help) -# And on the command-line, too -add_gflags_test(changeable_string_var 1 "-changeable_string_var () type: string default: \"1\" currently: \"2\"" "" gflags_unittest --changeable_string_var 2 --help) - -# --nohelp and --help=false should be as if we didn't say anything -add_gflags_test(nohelp 0 "PASS" "" gflags_unittest --nohelp) -add_gflags_test(help=false 0 "PASS" "" gflags_unittest --help=false) - -# --helpfull is the same as help -add_gflags_test(helpfull 1 "${SLASH}gflags_reporting.cc:" "" gflags_unittest --helpfull) - -# --helpshort should show only flags from the gflags_unittest itself -add_gflags_test(helpshort 1 "${SLASH}gflags_unittest.cc:" "${SLASH}gflags_reporting.cc:" gflags_unittest --helpshort) - -# --helpshort should show the tldflag we created in the gflags_unittest dir -add_gflags_test(helpshort-tldflag1 1 "tldflag1" "${SLASH}google.cc:" gflags_unittest --helpshort) -add_gflags_test(helpshort-tldflag2 1 "tldflag2" "${SLASH}google.cc:" gflags_unittest --helpshort) - -# --helpshort should work if the main source file is suffixed with [_-]main -add_gflags_test(helpshort-main 1 "${SLASH}gflags_unittest-main.cc:" "${SLASH}gflags_reporting.cc:" gflags_unittest-main --helpshort) -add_gflags_test(helpshort_main 1 "${SLASH}gflags_unittest_main.cc:" "${SLASH}gflags_reporting.cc:" gflags_unittest_main --helpshort) - -# --helpon needs an argument -add_gflags_test(helpon 1 "'--helpon' is missing its argument; flag description: show help on" "" gflags_unittest --helpon) -# --helpon argument indicates what file we'll show args from -add_gflags_test(helpon=gflags 1 "${SLASH}gflags.cc:" "${SLASH}gflags_unittest.cc:" gflags_unittest --helpon=gflags) -# another way of specifying the argument -add_gflags_test(helpon_gflags 1 "${SLASH}gflags.cc:" "${SLASH}gflags_unittest.cc:" gflags_unittest --helpon gflags) -# test another argument -add_gflags_test(helpon=gflags_unittest 1 "${SLASH}gflags_unittest.cc:" "${SLASH}gflags.cc:" gflags_unittest --helpon=gflags_unittest) - -# helpmatch is like helpon but takes substrings -add_gflags_test(helpmatch_reporting 1 "${SLASH}gflags_reporting.cc:" "${SLASH}gflags_unittest.cc:" gflags_unittest -helpmatch reporting) -add_gflags_test(helpmatch=unittest 1 "${SLASH}gflags_unittest.cc:" "${SLASH}gflags.cc:" gflags_unittest -helpmatch=unittest) - -# if no flags are found with helpmatch or helpon, suggest --help -add_gflags_test(helpmatch=nosuchsubstring 1 "No modules matched" "${SLASH}gflags_unittest.cc:" gflags_unittest -helpmatch=nosuchsubstring) -add_gflags_test(helpon=nosuchmodule 1 "No modules matched" "${SLASH}gflags_unittest.cc:" gflags_unittest -helpon=nosuchmodule) - -# helppackage shows all the flags in the same dir as this unittest -# --help should show all flags, including flags from google.cc -add_gflags_test(helppackage 1 "${SLASH}gflags_reporting.cc:" "" gflags_unittest --helppackage) - -# xml! -add_gflags_test(helpxml 1 "${SLASH}gflags_unittest.cc" "${SLASH}gflags_unittest.cc:" gflags_unittest --helpxml) - -# just print the version info and exit -add_gflags_test(version-1 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --version) -add_gflags_test(version-2 0 "version test_version" "${SLASH}gflags_unittest.cc:" gflags_unittest --version) - -# --undefok is a fun flag... -add_gflags_test(undefok-1 1 "unknown command line flag 'foo'" "" gflags_unittest --undefok= --foo --unused_bool) -add_gflags_test(undefok-2 0 "PASS" "" gflags_unittest --undefok=foo --foo --unused_bool) -# If you say foo is ok to be undefined, we'll accept --nofoo as well -add_gflags_test(undefok-3 0 "PASS" "" gflags_unittest --undefok=foo --nofoo --unused_bool) -# It's ok if the foo is in the middle -add_gflags_test(undefok-4 0 "PASS" "" gflags_unittest --undefok=fee,fi,foo,fum --foo --unused_bool) -# But the spelling has to be just right... -add_gflags_test(undefok-5 1 "unknown command line flag 'foo'" "" gflags_unittest --undefok=fo --foo --unused_bool) -add_gflags_test(undefok-6 1 "unknown command line flag 'foo'" "" gflags_unittest --undefok=foot --foo --unused_bool) - -# See if we can successfully load our flags from the flagfile -add_gflags_test(flagfile.1 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest "--flagfile=flagfile.1") -add_gflags_test(flagfile.2 0 "PASS" "" gflags_unittest "--flagfile=flagfile.2") -add_gflags_test(flagfile.3 0 "PASS" "" gflags_unittest "--flagfile=flagfile.3") - -# Also try to load flags from the environment -add_gflags_test(fromenv=version 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --fromenv=version) -add_gflags_test(tryfromenv=version 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --tryfromenv=version) -add_gflags_test(fromenv=help 0 "PASS" "" gflags_unittest --fromenv=help) -add_gflags_test(tryfromenv=help 0 "PASS" "" gflags_unittest --tryfromenv=help) -add_gflags_test(fromenv=helpfull 1 "helpfull not found in environment" "" gflags_unittest --fromenv=helpfull) -add_gflags_test(tryfromenv=helpfull 0 "PASS" "" gflags_unittest --tryfromenv=helpfull) -add_gflags_test(tryfromenv=undefok 0 "PASS" "" gflags_unittest --tryfromenv=undefok --foo) -add_gflags_test(tryfromenv=weirdo 1 "unknown command line flag" "" gflags_unittest --tryfromenv=weirdo) -add_gflags_test(tryfromenv-multiple 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --tryfromenv=test_bool,version,unused_bool) -add_gflags_test(fromenv=test_bool 1 "not found in environment" "" gflags_unittest --fromenv=test_bool) -add_gflags_test(fromenv=test_bool-ok 1 "unknown command line flag" "" gflags_unittest --fromenv=test_bool,ok) -# Here, the --version overrides the fromenv -add_gflags_test(version-overrides-fromenv 0 "gflags_unittest" "${SLASH}gflags_unittest.cc:" gflags_unittest --fromenv=test_bool,version,ok) - -# Make sure -- by itself stops argv processing -add_gflags_test(dashdash 0 "PASS" "" gflags_unittest -- --help) - -# And we should die if the flag value doesn't pass the validator -add_gflags_test(always_fail 1 "ERROR: failed validation of new value 'true' for flag 'always_fail'" "" gflags_unittest --always_fail) - -# And if locking in validators fails -# TODO(andreas): Worked on Windows 7 Release configuration, but causes -# debugger abort() intervention in case of Debug configuration. -#add_gflags_test(deadlock_if_cant_lock 0 "PASS" "" gflags_unittest --deadlock_if_cant_lock) - -# ---------------------------------------------------------------------------- -# use gflags_declare.h -add_executable (gflags_declare_test gflags_declare_test.cc gflags_declare_flags.cc) - -add_test(NAME gflags_declare COMMAND gflags_declare_test --message "Hello gflags!") -set_tests_properties(gflags_declare PROPERTIES PASS_REGULAR_EXPRESSION "Hello gflags!") - -# ---------------------------------------------------------------------------- -# configure Python script which configures and builds a test project -if (BUILD_NC_TESTS OR BUILD_CONFIG_TESTS) - find_package (PythonInterp) - if (NOT PYTHON_EXECUTABLE) - message (FATAL_ERROR "No Python installation found! It is required by the (negative) compilation tests." - " Either install Python or set BUILD_NC_TESTS and BUILD_CONFIG_TESTS to FALSE.") - endif () - set (TMPDIR "${PROJECT_BINARY_DIR}/Testing/Temporary") - configure_file (gflags_build.py.in "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/build.py" @ONLY) - function (add_gflags_build_test name srcdir expect_fail) - set (srcdir "${CMAKE_CURRENT_SOURCE_DIR}/${srcdir}") - add_test ( - NAME "${name}" - COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/build.py" - ${name} ${srcdir} ${expect_fail} - ) - endfunction () -endif () - -# ---------------------------------------------------------------------------- -# negative compilation tests -option (BUILD_NC_TESTS "Request addition of negative compilation tests." OFF) -mark_as_advanced (BUILD_NC_TESTS) -if (BUILD_NC_TESTS) - add_gflags_build_test (nc_sanity nc 0) - add_gflags_build_test (nc_swapped_args nc 1) - add_gflags_build_test (nc_int_instead_of_bool nc 1) - add_gflags_build_test (nc_bool_in_quotes nc 1) - add_gflags_build_test (nc_define_string_with_0 nc 1) -endif () - -# ---------------------------------------------------------------------------- -# build configuration test -option (BUILD_CONFIG_TESTS "Request addition of package configuration tests." OFF) -mark_as_advanced (BUILD_CONFIG_TESTS) -if (BUILD_CONFIG_TESTS) - add_gflags_build_test (cmake_config config 0) -endif () diff --git a/demos/thirdparty/gflags/test/config/CMakeLists.txt b/demos/thirdparty/gflags/test/config/CMakeLists.txt deleted file mode 100644 index 6190b253274..00000000000 --- a/demos/thirdparty/gflags/test/config/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -## gflags package configuration tests - -cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) - -project (gflags_${TEST_NAME}) - -find_package (gflags REQUIRED) - -add_executable (foo main.cc) -target_link_libraries (foo gflags::gflags) diff --git a/demos/thirdparty/gflags/test/config/main.cc b/demos/thirdparty/gflags/test/config/main.cc deleted file mode 100644 index 3c033e3afbb..00000000000 --- a/demos/thirdparty/gflags/test/config/main.cc +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -DEFINE_string(message, "Hello World!", "The message to print"); - -static bool ValidateMessage(const char* flagname, const std::string &message) -{ - return !message.empty(); -} -DEFINE_validator(message, ValidateMessage); - -int main(int argc, char **argv) -{ - gflags::SetUsageMessage("Test CMake configuration of gflags library (gflags-config.cmake)"); - gflags::SetVersionString("0.1"); - gflags::ParseCommandLineFlags(&argc, &argv, true); - std::cout << FLAGS_message << std::endl; - gflags::ShutDownCommandLineFlags(); - return 0; -} diff --git a/demos/thirdparty/gflags/test/flagfile.1 b/demos/thirdparty/gflags/test/flagfile.1 deleted file mode 100644 index e0f921769cf..00000000000 --- a/demos/thirdparty/gflags/test/flagfile.1 +++ /dev/null @@ -1 +0,0 @@ ---version \ No newline at end of file diff --git a/demos/thirdparty/gflags/test/flagfile.2 b/demos/thirdparty/gflags/test/flagfile.2 deleted file mode 100644 index 864f8e8a138..00000000000 --- a/demos/thirdparty/gflags/test/flagfile.2 +++ /dev/null @@ -1,2 +0,0 @@ ---foo=bar ---nounused_bool \ No newline at end of file diff --git a/demos/thirdparty/gflags/test/flagfile.3 b/demos/thirdparty/gflags/test/flagfile.3 deleted file mode 100644 index 76d92bb1e0f..00000000000 --- a/demos/thirdparty/gflags/test/flagfile.3 +++ /dev/null @@ -1 +0,0 @@ ---flagfile=flagfile.2 \ No newline at end of file diff --git a/demos/thirdparty/gflags/test/gflags_build.py.in b/demos/thirdparty/gflags/test/gflags_build.py.in deleted file mode 100644 index 84c73d503bd..00000000000 --- a/demos/thirdparty/gflags/test/gflags_build.py.in +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python - -import os -import sys -import subprocess # nosec - disable B404:import-subprocess check -import shutil - -CMAKE = '@CMAKE_COMMAND@' -CMAKE_BUILD_TYPE = '@CMAKE_BUILD_TYPE@' -TMPDIR = '@TMPDIR@' -SRCDIR = '@SRCDIR@' -GFLAGS_DIR = '@gflags_BINARY_DIR@' - -if __name__ == "__main__": - if len(sys.argv) != 4: - sys.stderr.write(' '.join(['usage:', sys.argv[0], ' \n'])) - sys.exit(1) - test_name = sys.argv[1] - srcdir = sys.argv[2] - expect_fail = (sys.argv[3].lower() in ['true', 'yes', 'on', '1']) - bindir = os.path.join(TMPDIR, test_name) - if TMPDIR == '': - sys.stderr.write('Temporary directory not set!\n') - sys.exit(1) - # create build directory - if os.path.isdir(bindir): shutil.rmtree(bindir) - os.makedirs(bindir) - # configure the build tree - if subprocess.call([CMAKE, '-DCMAKE_BUILD_TYPE:STRING='+CMAKE_BUILD_TYPE, - '-Dgflags_DIR:PATH='+GFLAGS_DIR, - '-DTEST_NAME:STRING='+test_name, srcdir], cwd=bindir) != 0: - sys.stderr.write('Failed to configure the build tree!\n') - sys.exit(1) - # build the test project - exit_code = subprocess.call([CMAKE, '--build', bindir, '--config', CMAKE_BUILD_TYPE], cwd=bindir) - if expect_fail == True: - if exit_code == 0: - sys.stderr.write('Build expected to fail, but it succeeded!\n') - sys.exit(1) - else: - sys.stderr.write('Build failed as expected\n') - exit_code = 0 - sys.exit(exit_code) diff --git a/demos/thirdparty/gflags/test/gflags_declare_flags.cc b/demos/thirdparty/gflags/test/gflags_declare_flags.cc deleted file mode 100644 index 3d952a88ea0..00000000000 --- a/demos/thirdparty/gflags/test/gflags_declare_flags.cc +++ /dev/null @@ -1,12 +0,0 @@ -#define GFLAGS_DLL_DECLARE_FLAG - -#include -#include - -DECLARE_string(message); // in gflags_delcare_test.cc - -void print_message(); -void print_message() -{ - std::cout << FLAGS_message << std::endl; -} diff --git a/demos/thirdparty/gflags/test/gflags_declare_test.cc b/demos/thirdparty/gflags/test/gflags_declare_test.cc deleted file mode 100644 index 47d11c293b5..00000000000 --- a/demos/thirdparty/gflags/test/gflags_declare_test.cc +++ /dev/null @@ -1,12 +0,0 @@ -#include - -DEFINE_string(message, "", "The message to print"); -void print_message(); // in gflags_declare_flags.cc - -int main(int argc, char **argv) -{ - GFLAGS_NAMESPACE::SetUsageMessage("Test compilation and use of gflags_declare.h"); - GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); - print_message(); - return 0; -} diff --git a/demos/thirdparty/gflags/test/gflags_strip_flags_test.cc b/demos/thirdparty/gflags/test/gflags_strip_flags_test.cc deleted file mode 100644 index 143f0c68daf..00000000000 --- a/demos/thirdparty/gflags/test/gflags_strip_flags_test.cc +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2011, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --- -// Author: csilvers@google.com (Craig Silverstein) -// -// A simple program that uses STRIP_FLAG_HELP. We'll have a shell -// script that runs 'strings' over this program and makes sure -// that the help string is not in there. - -#define STRIP_FLAG_HELP 1 -#include - -#include - -using GFLAGS_NAMESPACE::SetUsageMessage; -using GFLAGS_NAMESPACE::ParseCommandLineFlags; - - -DEFINE_bool(test, true, "This text should be stripped out"); - -int main(int argc, char** argv) { - SetUsageMessage("Usage message"); - ParseCommandLineFlags(&argc, &argv, false); - - // Unfortunately, for us, libtool can replace executables with a shell - // script that does some work before calling the 'real' executable - // under a different name. We need the 'real' executable name to run - // 'strings' on it, so we construct this binary to print the real - // name (argv[0]) on stdout when run. - puts(argv[0]); - - return 0; -} diff --git a/demos/thirdparty/gflags/test/gflags_strip_flags_test.cmake b/demos/thirdparty/gflags/test/gflags_strip_flags_test.cmake deleted file mode 100644 index 5bb5cc1a1fb..00000000000 --- a/demos/thirdparty/gflags/test/gflags_strip_flags_test.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if (NOT BINARY) - message (FATAL_ERROR "BINARY file to check not specified!") -endif () -file (STRINGS "${BINARY}" strings REGEX "This text should be stripped out") -if (strings) - message (FATAL_ERROR "Text not stripped from binary like it should be: ${BINARY}") -endif () diff --git a/demos/thirdparty/gflags/test/gflags_unittest.cc b/demos/thirdparty/gflags/test/gflags_unittest.cc deleted file mode 100644 index 9a922efdadd..00000000000 --- a/demos/thirdparty/gflags/test/gflags_unittest.cc +++ /dev/null @@ -1,1572 +0,0 @@ -// Copyright (c) 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// -// For now, this unit test does not cover all features of -// gflags.cc - -#include - -#include "config.h" -#include "util.h" - -#include // for isinf() and isnan() -#include -#include -#include -#ifdef HAVE_UNISTD_H -# include // for unlink() -#endif -#include -#include -TEST_INIT -EXPECT_DEATH_INIT - -// I don't actually use this header file, but #include it under the -// old location to make sure that the include-header-forwarding -// works. But don't bother on windows; the windows port is so new -// it never had the old location-names. -#ifndef _MSC_VER -#include -void (*unused_fn)() = &GFLAGS_NAMESPACE::HandleCommandLineCompletions; -#endif - -using std::string; -using std::vector; -using GFLAGS_NAMESPACE::int32; -using GFLAGS_NAMESPACE::FlagRegisterer; -using GFLAGS_NAMESPACE::StringFromEnv; -using GFLAGS_NAMESPACE::RegisterFlagValidator; -using GFLAGS_NAMESPACE::CommandLineFlagInfo; -using GFLAGS_NAMESPACE::GetAllFlags; - -DEFINE_string(test_tmpdir, "", "Dir we use for temp files"); -DEFINE_string(srcdir, StringFromEnv("SRCDIR", "."), "Source-dir root, needed to find gflags_unittest_flagfile"); - -DECLARE_string(tryfromenv); // in gflags.cc - -DEFINE_bool(test_bool, false, "tests bool-ness"); -DEFINE_int32(test_int32, -1, ""); -DEFINE_int64(test_int64, -2, ""); -DEFINE_uint32(test_uint32, 1, ""); -DEFINE_uint64(test_uint64, 2, ""); -DEFINE_double(test_double, -1.0, ""); -DEFINE_string(test_string, "initial", ""); - -// -// The below ugliness gets some additional code coverage in the -helpxml -// and -helpmatch test cases having to do with string lengths and formatting -// -DEFINE_bool(test_bool_with_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_long_name, - false, - "extremely_extremely_extremely_extremely_extremely_extremely_extremely_extremely_long_meaning"); - -DEFINE_string(test_str1, "initial", ""); -DEFINE_string(test_str2, "initial", ""); -DEFINE_string(test_str3, "initial", ""); - -// This is used to test setting tryfromenv manually -DEFINE_string(test_tryfromenv, "initial", ""); - -// Don't try this at home! -static int changeable_var = 12; -DEFINE_int32(changeable_var, ++changeable_var, ""); - -static int changeable_bool_var = 8008; -DEFINE_bool(changeable_bool_var, ++changeable_bool_var == 8009, ""); - -static int changeable_string_var = 0; -static string ChangeableString() { - char r[] = {static_cast('0' + ++changeable_string_var), '\0'}; - return r; -} -DEFINE_string(changeable_string_var, ChangeableString(), ""); - -// These are never used in this unittest, but can be used by -// gflags_unittest.sh when it needs to specify flags -// that are legal for gflags_unittest but don't need to -// be a particular value. -DEFINE_bool(unused_bool, true, "unused bool-ness"); -DEFINE_int32(unused_int32, -1001, ""); -DEFINE_int64(unused_int64, -2001, ""); -DEFINE_uint32(unused_uint32, 1000, ""); -DEFINE_uint64(unused_uint64, 2000, ""); -DEFINE_double(unused_double, -1000.0, ""); -DEFINE_string(unused_string, "unused", ""); - -// These flags are used by gflags_unittest.sh -DEFINE_bool(changed_bool1, false, "changed"); -DEFINE_bool(changed_bool2, false, "changed"); -DEFINE_bool(long_helpstring, false, - "This helpstring goes on forever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever and ever and ever and ever and ever and ever and ever and " - "ever. This is the end of a long helpstring"); - - -static bool AlwaysFail(const char* flag, bool value) { return value == false; } -DEFINE_bool(always_fail, false, "will fail to validate when you set it"); -DEFINE_validator(always_fail, AlwaysFail); - -// See the comment by GetAllFlags in gflags.h -static bool DeadlockIfCantLockInValidators(const char* flag, bool value) { - if (!value) { - return true; - } - vector dummy; - GetAllFlags(&dummy); - return true; -} -DEFINE_bool(deadlock_if_cant_lock, - false, - "will deadlock if set to true and " - "if locking of registry in validators fails."); -DEFINE_validator(deadlock_if_cant_lock, DeadlockIfCantLockInValidators); - -#define MAKEFLAG(x) DEFINE_int32(test_flag_num##x, x, "Test flag") - -// Define 10 flags -#define MAKEFLAG10(x) \ - MAKEFLAG(x##0); \ - MAKEFLAG(x##1); \ - MAKEFLAG(x##2); \ - MAKEFLAG(x##3); \ - MAKEFLAG(x##4); \ - MAKEFLAG(x##5); \ - MAKEFLAG(x##6); \ - MAKEFLAG(x##7); \ - MAKEFLAG(x##8); \ - MAKEFLAG(x##9) - -// Define 100 flags -#define MAKEFLAG100(x) \ - MAKEFLAG10(x##0); \ - MAKEFLAG10(x##1); \ - MAKEFLAG10(x##2); \ - MAKEFLAG10(x##3); \ - MAKEFLAG10(x##4); \ - MAKEFLAG10(x##5); \ - MAKEFLAG10(x##6); \ - MAKEFLAG10(x##7); \ - MAKEFLAG10(x##8); \ - MAKEFLAG10(x##9) - -// Define a bunch of command-line flags. Each occurrence of the MAKEFLAG100 -// macro defines 100 integer flags. This lets us test the effect of having -// many flags on startup time. -MAKEFLAG100(1); -MAKEFLAG100(2); -MAKEFLAG100(3); -MAKEFLAG100(4); -MAKEFLAG100(5); -MAKEFLAG100(6); -MAKEFLAG100(7); -MAKEFLAG100(8); -MAKEFLAG100(9); -MAKEFLAG100(10); -MAKEFLAG100(11); -MAKEFLAG100(12); -MAKEFLAG100(13); -MAKEFLAG100(14); -MAKEFLAG100(15); - -#undef MAKEFLAG100 -#undef MAKEFLAG10 -#undef MAKEFLAG - -// This is a pseudo-flag -- we want to register a flag with a filename -// at the top level, but there is no way to do this except by faking -// the filename. -namespace fLI { - static const int32 FLAGS_nonotldflag1 = 12; - int32 FLAGS_tldflag1 = FLAGS_nonotldflag1; - int32 FLAGS_notldflag1 = FLAGS_nonotldflag1; - static FlagRegisterer o_tldflag1( - "tldflag1", - "should show up in --helpshort", "gflags_unittest.cc", - &FLAGS_tldflag1, &FLAGS_notldflag1); -} -using fLI::FLAGS_tldflag1; - -namespace fLI { - static const int32 FLAGS_nonotldflag2 = 23; - int32 FLAGS_tldflag2 = FLAGS_nonotldflag2; - int32 FLAGS_notldflag2 = FLAGS_nonotldflag2; - static FlagRegisterer o_tldflag2( - "tldflag2", - "should show up in --helpshort", "gflags_unittest.", - &FLAGS_tldflag2, &FLAGS_notldflag2); -} -using fLI::FLAGS_tldflag2; - -namespace GFLAGS_NAMESPACE { - -namespace { - - -static string TmpFile(const string& basename) { -#ifdef _MSC_VER - return FLAGS_test_tmpdir + "\\" + basename; -#else - return FLAGS_test_tmpdir + "/" + basename; -#endif -} - -// Returns the definition of the --flagfile flag to be used in the tests. -// Must be called after ParseCommandLineFlags(). -static const char* GetFlagFileFlag() { -#ifdef _MSC_VER - static const string flagfile = FLAGS_srcdir + "\\gflags_unittest_flagfile"; -#else - static const string flagfile = FLAGS_srcdir + "/gflags_unittest_flagfile"; -#endif - static const string flagfile_flag = string("--flagfile=") + flagfile; - return flagfile_flag.c_str(); -} - - -// Defining a variable of type CompileAssertTypesEqual will cause a -// compiler error iff T1 and T2 are different types. -template -struct CompileAssertTypesEqual; - -template -struct CompileAssertTypesEqual { -}; - - -template -void AssertIsType(Actual& x) { - CompileAssertTypesEqual(); -} - -// Verify all the flags are the right type. -TEST(FlagTypes, FlagTypes) { - AssertIsType(FLAGS_test_bool); - AssertIsType(FLAGS_test_int32); - AssertIsType(FLAGS_test_int64); - AssertIsType(FLAGS_test_uint32); - AssertIsType(FLAGS_test_uint64); - AssertIsType(FLAGS_test_double); - AssertIsType(FLAGS_test_string); -} - -#ifdef GTEST_HAS_DEATH_TEST -// Death tests for "help" options. -// -// The help system automatically calls gflags_exitfunc(1) when you specify any of -// the help-related flags ("-helpmatch", "-helpxml") so we can't test -// those mainline. - -// Tests that "-helpmatch" causes the process to die. -TEST(ReadFlagsFromStringDeathTest, HelpMatch) { - EXPECT_DEATH(ReadFlagsFromString("-helpmatch=base", GetArgv0(), true), - ""); -} - - -// Tests that "-helpxml" causes the process to die. -TEST(ReadFlagsFromStringDeathTest, HelpXml) { - EXPECT_DEATH(ReadFlagsFromString("-helpxml", GetArgv0(), true), - ""); -} -#endif - - -// A subroutine needed for testing reading flags from a string. -void TestFlagString(const string& flags, - const string& expected_string, - bool expected_bool, - int32 expected_int32, - double expected_double) { - EXPECT_TRUE(ReadFlagsFromString(flags, - GetArgv0(), - // errors are fatal - true)); - - EXPECT_EQ(expected_string, FLAGS_test_string); - EXPECT_EQ(expected_bool, FLAGS_test_bool); - EXPECT_EQ(expected_int32, FLAGS_test_int32); - EXPECT_DOUBLE_EQ(expected_double, FLAGS_test_double); -} - - -// Tests reading flags from a string. -TEST(FlagFileTest, ReadFlagsFromString) { - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "-test_bool=true\n" - " -test_int32=1\n" - "-test_double=0.0\n", - // Expected values - "continued", - true, - 1, - 0.0); - - TestFlagString( - // Flag string - "# let's make sure it can update values\n" - "-test_string=initial\n" - "-test_bool=false\n" - "-test_int32=123\n" - "-test_double=123.0\n", - // Expected values - "initial", - false, - 123, - 123.0); - - // Test that flags can use dashes instead of underscores. - TestFlagString( - // Flag string - "-test-string=initial\n" - "--test-bool=false\n" - "--test-int32=123\n" - "--test-double=123.0\n", - // Expected values - "initial", - false, - 123, - 123.0); -} - -// Tests the filename part of the flagfile -TEST(FlagFileTest, FilenamesOurfileLast) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "not_our_filename\n" - "-test_bool=true\n" - " -test_int32=1\n" - "gflags_unittest\n" - "-test_double=1000.0\n", - // Expected values - "continued", - false, - -1, - 1000.0); -} - -TEST(FlagFileTest, FilenamesOurfileFirst) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "gflags_unittest\n" - "-test_bool=true\n" - " -test_int32=1\n" - "not_our_filename\n" - "-test_double=1000.0\n", - // Expected values - "continued", - true, - 1, - -1.0); -} - -#if defined(HAVE_FNMATCH_H) || defined(HAVE_SHLWAPI_H) // otherwise glob isn't supported -TEST(FlagFileTest, FilenamesOurfileGlob) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "*flags*\n" - "-test_bool=true\n" - " -test_int32=1\n" - "flags\n" - "-test_double=1000.0\n", - // Expected values - "continued", - true, - 1, - -1.0); -} - -TEST(FlagFileTest, FilenamesOurfileInBigList) { - FLAGS_test_string = "initial"; - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_double = -1.0; - TestFlagString( - // Flag string - "-test_string=continued\n" - "# some comments are in order\n" - "# some\n" - " # comments\n" - "#are\n" - " #trickier\n" - "# than others\n" - "*first* *flags* *third*\n" - "-test_bool=true\n" - " -test_int32=1\n" - "flags\n" - "-test_double=1000.0\n", - // Expected values - "continued", - true, - 1, - -1.0); -} -#endif // defined(HAVE_FNMATCH_H) || defined(HAVE_SHLWAPI_H) - -// Tests that a failed flag-from-string read keeps flags at default values -TEST(FlagFileTest, FailReadFlagsFromString) { - FLAGS_test_int32 = 119; - string flags("# let's make sure it can update values\n" - "-test_string=non_initial\n" - "-test_bool=false\n" - "-test_int32=123\n" - "-test_double=illegal\n"); - - EXPECT_FALSE(ReadFlagsFromString(flags, - GetArgv0(), - // errors are fatal - false)); - - EXPECT_EQ(119, FLAGS_test_int32); - EXPECT_EQ("initial", FLAGS_test_string); -} - -// Tests that flags can be set to ordinary values. -TEST(SetFlagValueTest, OrdinaryValues) { - EXPECT_EQ("initial", FLAGS_test_str1); - - SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str1); // set; was default - - SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str1); // already set once - - FLAGS_test_str1 = "initial"; - SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("initial", FLAGS_test_str1); // still already set before - - SetCommandLineOptionWithMode("test_str1", "third", SET_FLAGS_VALUE); - EXPECT_EQ("third", FLAGS_test_str1); // changed value - - SetCommandLineOptionWithMode("test_str1", "fourth", SET_FLAGS_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str1); - // value not changed (already set before) - - EXPECT_EQ("initial", FLAGS_test_str2); - - SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str2); // changed (was default) - - FLAGS_test_str2 = "extra"; - EXPECT_EQ("extra", FLAGS_test_str2); - - FLAGS_test_str2 = "second"; - SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str2); // still changed (was equal to default) - - SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("fourth", FLAGS_test_str2); // changed (was default) - - EXPECT_EQ("initial", FLAGS_test_str3); - - SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str3); // changed - - FLAGS_test_str3 = "third"; - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) - - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) - - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_VALUE); - EXPECT_EQ("fourth", FLAGS_test_str3); // changed value -} - - -// Tests that flags can be set to exceptional values. -// Note: apparently MINGW doesn't parse inf and nan correctly: -// http://www.mail-archive.com/bug-gnulib@gnu.org/msg09573.html -// This url says FreeBSD also has a problem, but I didn't see that. -TEST(SetFlagValueTest, ExceptionalValues) { -#if defined(isinf) && !defined(__MINGW32__) - EXPECT_EQ("test_double set to inf\n", - SetCommandLineOption("test_double", "inf")); - EXPECT_INF(FLAGS_test_double); - - EXPECT_EQ("test_double set to inf\n", - SetCommandLineOption("test_double", "INF")); - EXPECT_INF(FLAGS_test_double); -#endif - - // set some bad values - EXPECT_EQ("", - SetCommandLineOption("test_double", "0.1xxx")); - EXPECT_EQ("", - SetCommandLineOption("test_double", " ")); - EXPECT_EQ("", - SetCommandLineOption("test_double", "")); -#if defined(isinf) && !defined(__MINGW32__) - EXPECT_EQ("test_double set to -inf\n", - SetCommandLineOption("test_double", "-inf")); - EXPECT_INF(FLAGS_test_double); - EXPECT_GT(0, FLAGS_test_double); -#endif - -#if defined(isnan) && !defined(__MINGW32__) - EXPECT_EQ("test_double set to nan\n", - SetCommandLineOption("test_double", "NaN")); - EXPECT_NAN(FLAGS_test_double); -#endif -} - -// Tests that integer flags can be specified in many ways -TEST(SetFlagValueTest, DifferentRadices) { - EXPECT_EQ("test_int32 set to 12\n", - SetCommandLineOption("test_int32", "12")); - - EXPECT_EQ("test_int32 set to 16\n", - SetCommandLineOption("test_int32", "0x10")); - - EXPECT_EQ("test_int32 set to 34\n", - SetCommandLineOption("test_int32", "0X22")); - - // Leading 0 is *not* octal; it's still decimal - EXPECT_EQ("test_int32 set to 10\n", - SetCommandLineOption("test_int32", "010")); -} - -// Tests what happens when you try to set a flag to an illegal value -TEST(SetFlagValueTest, IllegalValues) { - FLAGS_test_bool = true; - FLAGS_test_int32 = 119; - FLAGS_test_int64 = 1191; - FLAGS_test_uint32 = 11911; - FLAGS_test_uint64 = 119111; - - EXPECT_EQ("", - SetCommandLineOption("test_bool", "12")); - - EXPECT_EQ("", - SetCommandLineOption("test_uint32", "-1970")); - - EXPECT_EQ("", - SetCommandLineOption("test_int32", "7000000000000")); - - EXPECT_EQ("", - SetCommandLineOption("test_uint64", "-1")); - - EXPECT_EQ("", - SetCommandLineOption("test_int64", "not a number!")); - - // Test the empty string with each type of input - EXPECT_EQ("", SetCommandLineOption("test_bool", "")); - EXPECT_EQ("", SetCommandLineOption("test_int32", "")); - EXPECT_EQ("", SetCommandLineOption("test_int64", "")); - EXPECT_EQ("", SetCommandLineOption("test_uint32", "")); - EXPECT_EQ("", SetCommandLineOption("test_uint64", "")); - EXPECT_EQ("", SetCommandLineOption("test_double", "")); - EXPECT_EQ("test_string set to \n", SetCommandLineOption("test_string", "")); - - EXPECT_TRUE(FLAGS_test_bool); - EXPECT_EQ(119, FLAGS_test_int32); - EXPECT_EQ(1191, FLAGS_test_int64); - EXPECT_EQ(11911, FLAGS_test_uint32); - EXPECT_EQ(119111, FLAGS_test_uint64); -} - - -// Tests that we only evaluate macro args once -TEST(MacroArgs, EvaluateOnce) { - EXPECT_EQ(13, FLAGS_changeable_var); - // Make sure we don't ++ the value somehow, when evaluating the flag. - EXPECT_EQ(13, FLAGS_changeable_var); - // Make sure the macro only evaluated this var once. - EXPECT_EQ(13, changeable_var); - // Make sure the actual value and default value are the same - SetCommandLineOptionWithMode("changeable_var", "21", SET_FLAG_IF_DEFAULT); - EXPECT_EQ(21, FLAGS_changeable_var); -} - -TEST(MacroArgs, EvaluateOnceBool) { - EXPECT_TRUE(FLAGS_changeable_bool_var); - EXPECT_TRUE(FLAGS_changeable_bool_var); - EXPECT_EQ(8009, changeable_bool_var); - SetCommandLineOptionWithMode("changeable_bool_var", "false", - SET_FLAG_IF_DEFAULT); - EXPECT_FALSE(FLAGS_changeable_bool_var); -} - -TEST(MacroArgs, EvaluateOnceStrings) { - EXPECT_EQ("1", FLAGS_changeable_string_var); - EXPECT_EQ("1", FLAGS_changeable_string_var); - EXPECT_EQ(1, changeable_string_var); - SetCommandLineOptionWithMode("changeable_string_var", "different", - SET_FLAG_IF_DEFAULT); - EXPECT_EQ("different", FLAGS_changeable_string_var); -} - -// Tests that the FooFromEnv does the right thing -TEST(FromEnvTest, LegalValues) { - setenv("BOOL_VAL1", "true", 1); - setenv("BOOL_VAL2", "false", 1); - setenv("BOOL_VAL3", "1", 1); - setenv("BOOL_VAL4", "F", 1); - EXPECT_TRUE(BoolFromEnv("BOOL_VAL1", false)); - EXPECT_FALSE(BoolFromEnv("BOOL_VAL2", true)); - EXPECT_TRUE(BoolFromEnv("BOOL_VAL3", false)); - EXPECT_FALSE(BoolFromEnv("BOOL_VAL4", true)); - EXPECT_TRUE(BoolFromEnv("BOOL_VAL_UNKNOWN", true)); - EXPECT_FALSE(BoolFromEnv("BOOL_VAL_UNKNOWN", false)); - - setenv("INT_VAL1", "1", 1); - setenv("INT_VAL2", "-1", 1); - EXPECT_EQ(1, Int32FromEnv("INT_VAL1", 10)); - EXPECT_EQ(-1, Int32FromEnv("INT_VAL2", 10)); - EXPECT_EQ(10, Int32FromEnv("INT_VAL_UNKNOWN", 10)); - - setenv("INT_VAL3", "4294967295", 1); - EXPECT_EQ(1, Uint32FromEnv("INT_VAL1", 10)); - EXPECT_EQ(4294967295L, Uint32FromEnv("INT_VAL3", 30)); - EXPECT_EQ(10, Uint32FromEnv("INT_VAL_UNKNOWN", 10)); - - setenv("INT_VAL4", "1099511627776", 1); - EXPECT_EQ(1, Int64FromEnv("INT_VAL1", 20)); - EXPECT_EQ(-1, Int64FromEnv("INT_VAL2", 20)); - EXPECT_EQ(1099511627776LL, Int64FromEnv("INT_VAL4", 20)); - EXPECT_EQ(20, Int64FromEnv("INT_VAL_UNKNOWN", 20)); - - EXPECT_EQ(1, Uint64FromEnv("INT_VAL1", 30)); - EXPECT_EQ(1099511627776ULL, Uint64FromEnv("INT_VAL4", 30)); - EXPECT_EQ(30, Uint64FromEnv("INT_VAL_UNKNOWN", 30)); - - // I pick values here that can be easily represented exactly in floating-point - setenv("DOUBLE_VAL1", "0.0", 1); - setenv("DOUBLE_VAL2", "1.0", 1); - setenv("DOUBLE_VAL3", "-1.0", 1); - EXPECT_EQ(0.0, DoubleFromEnv("DOUBLE_VAL1", 40.0)); - EXPECT_EQ(1.0, DoubleFromEnv("DOUBLE_VAL2", 40.0)); - EXPECT_EQ(-1.0, DoubleFromEnv("DOUBLE_VAL3", 40.0)); - EXPECT_EQ(40.0, DoubleFromEnv("DOUBLE_VAL_UNKNOWN", 40.0)); - - setenv("STRING_VAL1", "", 1); - setenv("STRING_VAL2", "my happy string!", 1); - EXPECT_STREQ("", StringFromEnv("STRING_VAL1", "unknown")); - EXPECT_STREQ("my happy string!", StringFromEnv("STRING_VAL2", "unknown")); - EXPECT_STREQ("unknown", StringFromEnv("STRING_VAL_UNKNOWN", "unknown")); -} - -#ifdef GTEST_HAS_DEATH_TEST -// Tests that the FooFromEnv dies on parse-error -TEST(FromEnvDeathTest, IllegalValues) { - setenv("BOOL_BAD1", "so true!", 1); - setenv("BOOL_BAD2", "", 1); - EXPECT_DEATH(BoolFromEnv("BOOL_BAD1", false), "error parsing env variable"); - EXPECT_DEATH(BoolFromEnv("BOOL_BAD2", true), "error parsing env variable"); - - setenv("INT_BAD1", "one", 1); - setenv("INT_BAD2", "100000000000000000", 1); - setenv("INT_BAD3", "0xx10", 1); - setenv("INT_BAD4", "", 1); - EXPECT_DEATH(Int32FromEnv("INT_BAD1", 10), "error parsing env variable"); - EXPECT_DEATH(Int32FromEnv("INT_BAD2", 10), "error parsing env variable"); - EXPECT_DEATH(Int32FromEnv("INT_BAD3", 10), "error parsing env variable"); - EXPECT_DEATH(Int32FromEnv("INT_BAD4", 10), "error parsing env variable"); - - EXPECT_DEATH(Uint32FromEnv("INT_BAD1", 10), "error parsing env variable"); - EXPECT_DEATH(Uint32FromEnv("INT_BAD2", 10), "error parsing env variable"); - EXPECT_DEATH(Uint32FromEnv("INT_BAD3", 10), "error parsing env variable"); - EXPECT_DEATH(Uint32FromEnv("INT_BAD4", 10), "error parsing env variable"); - - setenv("BIGINT_BAD1", "18446744073709551616000", 1); - EXPECT_DEATH(Int64FromEnv("INT_BAD1", 20), "error parsing env variable"); - EXPECT_DEATH(Int64FromEnv("INT_BAD3", 20), "error parsing env variable"); - EXPECT_DEATH(Int64FromEnv("INT_BAD4", 20), "error parsing env variable"); - EXPECT_DEATH(Int64FromEnv("BIGINT_BAD1", 200), "error parsing env variable"); - - setenv("BIGINT_BAD2", "-1", 1); - EXPECT_DEATH(Uint64FromEnv("INT_BAD1", 30), "error parsing env variable"); - EXPECT_DEATH(Uint64FromEnv("INT_BAD3", 30), "error parsing env variable"); - EXPECT_DEATH(Uint64FromEnv("INT_BAD4", 30), "error parsing env variable"); - EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD1", 30), "error parsing env variable"); - // TODO(csilvers): uncomment this when we disallow negative numbers for uint64 -#if 0 - EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD2", 30), "error parsing env variable"); -#endif - - setenv("DOUBLE_BAD1", "0.0.0", 1); - setenv("DOUBLE_BAD2", "", 1); - EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD1", 40.0), "error parsing env variable"); - EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD2", 40.0), "error parsing env variable"); -} -#endif - - -// Tests that FlagSaver can save the states of string flags. -TEST(FlagSaverTest, CanSaveStringFlagStates) { - // 1. Initializes the flags. - - // State of flag test_str1: - // default value - "initial" - // current value - "initial" - // not set - true - - SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_VALUE); - // State of flag test_str2: - // default value - "initial" - // current value - "second" - // not set - false - - SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); - // State of flag test_str3: - // default value - "second" - // current value - "second" - // not set - true - - // 2. Saves the flag states. - - { - FlagSaver fs; - - // 3. Modifies the flag states. - - SetCommandLineOptionWithMode("test_str1", "second", SET_FLAGS_VALUE); - EXPECT_EQ("second", FLAGS_test_str1); - // State of flag test_str1: - // default value - "second" - // current value - "second" - // not set - true - - SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str2); - // State of flag test_str2: - // default value - "third" - // current value - "second" - // not set - false - - SetCommandLineOptionWithMode("test_str3", "third", SET_FLAGS_VALUE); - EXPECT_EQ("third", FLAGS_test_str3); - // State of flag test_str1: - // default value - "second" - // current value - "third" - // not set - false - - // 4. Restores the flag states. - } - - // 5. Verifies that the states were restored. - - // Verifies that the value of test_str1 was restored. - EXPECT_EQ("initial", FLAGS_test_str1); - // Verifies that the "not set" attribute of test_str1 was restored to true. - SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str1); - - // Verifies that the value of test_str2 was restored. - EXPECT_EQ("second", FLAGS_test_str2); - // Verifies that the "not set" attribute of test_str2 was restored to false. - SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("second", FLAGS_test_str2); - - // Verifies that the value of test_str3 was restored. - EXPECT_EQ("second", FLAGS_test_str3); - // Verifies that the "not set" attribute of test_str3 was restored to true. - SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); - EXPECT_EQ("fourth", FLAGS_test_str3); -} - - -// Tests that FlagSaver can save the values of various-typed flags. -TEST(FlagSaverTest, CanSaveVariousTypedFlagValues) { - // Initializes the flags. - FLAGS_test_bool = false; - FLAGS_test_int32 = -1; - FLAGS_test_uint32 = 2; - FLAGS_test_int64 = -3; - FLAGS_test_uint64 = 4; - FLAGS_test_double = 5.0; - FLAGS_test_string = "good"; - - // Saves the flag states. - { - FlagSaver fs; - - // Modifies the flags. - FLAGS_test_bool = true; - FLAGS_test_int32 = -5; - FLAGS_test_uint32 = 6; - FLAGS_test_int64 = -7; - FLAGS_test_uint64 = 8; - FLAGS_test_double = 8.0; - FLAGS_test_string = "bad"; - - // Restores the flag states. - } - - // Verifies the flag values were restored. - EXPECT_FALSE(FLAGS_test_bool); - EXPECT_EQ(-1, FLAGS_test_int32); - EXPECT_EQ(2, FLAGS_test_uint32); - EXPECT_EQ(-3, FLAGS_test_int64); - EXPECT_EQ(4, FLAGS_test_uint64); - EXPECT_DOUBLE_EQ(5.0, FLAGS_test_double); - EXPECT_EQ("good", FLAGS_test_string); -} - -TEST(GetAllFlagsTest, BaseTest) { - vector flags; - GetAllFlags(&flags); - bool found_test_bool = false; - vector::const_iterator i; - for (i = flags.begin(); i != flags.end(); ++i) { - if (i->name == "test_bool") { - found_test_bool = true; - EXPECT_EQ(i->type, "bool"); - EXPECT_EQ(i->default_value, "false"); - EXPECT_EQ(i->flag_ptr, &FLAGS_test_bool); - break; - } - } - EXPECT_TRUE(found_test_bool); -} - -TEST(ShowUsageWithFlagsTest, BaseTest) { - // TODO(csilvers): test this by allowing output other than to stdout. - // Not urgent since this functionality is tested via - // gflags_unittest.sh, though only through use of --help. -} - -TEST(ShowUsageWithFlagsRestrictTest, BaseTest) { - // TODO(csilvers): test this by allowing output other than to stdout. - // Not urgent since this functionality is tested via - // gflags_unittest.sh, though only through use of --helpmatch. -} - -// Note: all these argv-based tests depend on SetArgv being called -// before ParseCommandLineFlags() in main(), below. -TEST(GetArgvsTest, BaseTest) { - vector argvs = GetArgvs(); - EXPECT_EQ(4, argvs.size()); - EXPECT_EQ("/test/argv/for/gflags_unittest", argvs[0]); - EXPECT_EQ("argv 2", argvs[1]); - EXPECT_EQ("3rd argv", argvs[2]); - EXPECT_EQ("argv #4", argvs[3]); -} - -TEST(GetArgvTest, BaseTest) { - EXPECT_STREQ("/test/argv/for/gflags_unittest " - "argv 2 3rd argv argv #4", GetArgv()); -} - -TEST(GetArgv0Test, BaseTest) { - EXPECT_STREQ("/test/argv/for/gflags_unittest", GetArgv0()); -} - -TEST(GetArgvSumTest, BaseTest) { - // This number is just the sum of the ASCII values of all the chars - // in GetArgv(). - EXPECT_EQ(4904, GetArgvSum()); -} - -TEST(ProgramInvocationNameTest, BaseTest) { - EXPECT_STREQ("/test/argv/for/gflags_unittest", - ProgramInvocationName()); -} - -TEST(ProgramInvocationShortNameTest, BaseTest) { - EXPECT_STREQ("gflags_unittest", ProgramInvocationShortName()); -} - -TEST(ProgramUsageTest, BaseTest) { // Depends on 1st arg to ParseCommandLineFlags() - EXPECT_STREQ("/test/argv/for/gflags_unittest: " - " [...]\nDoes something useless.\n", - ProgramUsage()); -} - -TEST(GetCommandLineOptionTest, NameExistsAndIsDefault) { - string value("will be changed"); - bool r = GetCommandLineOption("test_bool", &value); - EXPECT_TRUE(r); - EXPECT_EQ("false", value); - - r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("-1", value); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasAssigned) { - FLAGS_test_int32 = 400; - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("400", value); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasSet) { - SetCommandLineOption("test_int32", "700"); - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("700", value); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) { - // This doesn't set the flag's value, but rather its default value. - // is_default is still true, but the 'default' value returned has changed! - SetCommandLineOptionWithMode("test_int32", "800", SET_FLAGS_DEFAULT); - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("800", value); - EXPECT_TRUE(GetCommandLineFlagInfoOrDie("test_int32").is_default); -} - -TEST(GetCommandLineOptionTest, NameExistsAndWasConditionallySet) { - SetCommandLineOptionWithMode("test_int32", "900", SET_FLAG_IF_DEFAULT); - string value("will be changed"); - const bool r = GetCommandLineOption("test_int32", &value); - EXPECT_TRUE(r); - EXPECT_EQ("900", value); -} - -TEST(GetCommandLineOptionTest, NameDoesNotExist) { - string value("will not be changed"); - const bool r = GetCommandLineOption("test_int3210", &value); - EXPECT_FALSE(r); - EXPECT_EQ("will not be changed", value); -} - -TEST(GetCommandLineFlagInfoTest, FlagExists) { - CommandLineFlagInfo info; - bool r = GetCommandLineFlagInfo("test_int32", &info); - EXPECT_TRUE(r); - EXPECT_EQ("test_int32", info.name); - EXPECT_EQ("int32", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("-1", info.current_value); - EXPECT_EQ("-1", info.default_value); - EXPECT_TRUE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); - - FLAGS_test_bool = true; - r = GetCommandLineFlagInfo("test_bool", &info); - EXPECT_TRUE(r); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("true", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_FALSE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); - - FLAGS_test_bool = false; - r = GetCommandLineFlagInfo("test_bool", &info); - EXPECT_TRUE(r); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("false", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_FALSE(info.is_default); // value is same, but flag *was* modified - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); -} - -TEST(GetCommandLineFlagInfoTest, FlagDoesNotExist) { - CommandLineFlagInfo info; - // Set to some random values that GetCommandLineFlagInfo should not change - info.name = "name"; - info.type = "type"; - info.current_value = "curr"; - info.default_value = "def"; - info.filename = "/"; - info.is_default = false; - info.has_validator_fn = true; - info.flag_ptr = NULL; - bool r = GetCommandLineFlagInfo("test_int3210", &info); - EXPECT_FALSE(r); - EXPECT_EQ("name", info.name); - EXPECT_EQ("type", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("curr", info.current_value); - EXPECT_EQ("def", info.default_value); - EXPECT_EQ("/", info.filename); - EXPECT_FALSE(info.is_default); - EXPECT_TRUE(info.has_validator_fn); - EXPECT_EQ(NULL, info.flag_ptr); -} - -TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) { - CommandLineFlagInfo info; - info = GetCommandLineFlagInfoOrDie("test_int32"); - EXPECT_EQ("test_int32", info.name); - EXPECT_EQ("int32", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("-1", info.current_value); - EXPECT_EQ("-1", info.default_value); - EXPECT_TRUE(info.is_default); - EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); - info = GetCommandLineFlagInfoOrDie("test_bool"); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("false", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_TRUE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); -} - -TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) { - FLAGS_test_int32 = 400; - CommandLineFlagInfo info; - info = GetCommandLineFlagInfoOrDie("test_int32"); - EXPECT_EQ("test_int32", info.name); - EXPECT_EQ("int32", info.type); - EXPECT_EQ("", info.description); - EXPECT_EQ("400", info.current_value); - EXPECT_EQ("-1", info.default_value); - EXPECT_FALSE(info.is_default); - EXPECT_EQ(&FLAGS_test_int32, info.flag_ptr); - FLAGS_test_bool = true; - info = GetCommandLineFlagInfoOrDie("test_bool"); - EXPECT_EQ("test_bool", info.name); - EXPECT_EQ("bool", info.type); - EXPECT_EQ("tests bool-ness", info.description); - EXPECT_EQ("true", info.current_value); - EXPECT_EQ("false", info.default_value); - EXPECT_FALSE(info.is_default); - EXPECT_FALSE(info.has_validator_fn); - EXPECT_EQ(&FLAGS_test_bool, info.flag_ptr); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(GetCommandLineFlagInfoOrDieDeathTest, FlagDoesNotExist) { - EXPECT_DEATH(GetCommandLineFlagInfoOrDie("test_int3210"), - ".*: flag test_int3210 does not exist"); -} -#endif - - -// These are lightly tested because they're deprecated. Basically, -// the tests are meant to cover how existing users use these functions, -// but not necessarily how new users could use them. -TEST(DeprecatedFunctionsTest, CommandlineFlagsIntoString) { - string s = CommandlineFlagsIntoString(); - EXPECT_NE(string::npos, s.find("--test_bool=")); -} - -TEST(DeprecatedFunctionsTest, AppendFlagsIntoFile) { - FLAGS_test_int32 = 10; // just to make the test more interesting - string filename(TmpFile("flagfile")); - unlink(filename.c_str()); // just to be safe - const bool r = AppendFlagsIntoFile(filename, "not the real argv0"); - EXPECT_TRUE(r); - - FILE* fp; - EXPECT_EQ(0, SafeFOpen(&fp, filename.c_str(), "r")); - EXPECT_TRUE(fp != NULL); - char line[8192]; - EXPECT_TRUE(fgets(line, sizeof(line)-1, fp) != NULL); // get the first line - // First line should be progname. - EXPECT_STREQ("not the real argv0\n", line); - - bool found_bool = false, found_int32 = false; - while (fgets(line, sizeof(line)-1, fp)) { - line[sizeof(line)-1] = '\0'; // just to be safe - if (strcmp(line, "--test_bool=false\n") == 0) - found_bool = true; - if (strcmp(line, "--test_int32=10\n") == 0) - found_int32 = true; - } - EXPECT_TRUE(found_int32); - EXPECT_TRUE(found_bool); - fclose(fp); -} - -TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) { - FLAGS_test_int32 = -10; // just to make the test more interesting - string filename(TmpFile("flagfile2")); - unlink(filename.c_str()); // just to be safe - bool r = AppendFlagsIntoFile(filename, GetArgv0()); - EXPECT_TRUE(r); - - FLAGS_test_int32 = -11; - r = ReadFromFlagsFile(filename, GetArgv0(), true); - EXPECT_TRUE(r); - EXPECT_EQ(-10, FLAGS_test_int32); -} // unnamed namespace - -TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) { - FLAGS_test_int32 = -20; - string filename(TmpFile("flagfile3")); - FILE* fp; - EXPECT_EQ(0, SafeFOpen(&fp, filename.c_str(), "w")); - EXPECT_TRUE(fp != NULL); - // Note the error in the bool assignment below... - fprintf(fp, "%s\n--test_int32=-21\n--test_bool=not_a_bool!\n", GetArgv0()); - fclose(fp); - - FLAGS_test_int32 = -22; - const bool r = ReadFromFlagsFile(filename, GetArgv0(), false); - EXPECT_FALSE(r); - EXPECT_EQ(-22, FLAGS_test_int32); // the -21 from the flagsfile didn't take -} - -TEST(FlagsSetBeforeInitTest, TryFromEnv) { - EXPECT_EQ("pre-set", FLAGS_test_tryfromenv); -} - -// The following test case verifies that ParseCommandLineFlags() and -// ParseCommandLineNonHelpFlags() uses the last definition of a flag -// in case it's defined more than once. - -DEFINE_int32(test_flag, -1, "used for testing gflags.cc"); - -// Parses and returns the --test_flag flag. -// If with_help is true, calls ParseCommandLineFlags; otherwise calls -// ParseCommandLineNonHelpFlags. -int32 ParseTestFlag(bool with_help, int argc, const char** const_argv) { - FlagSaver fs; // Restores the flags before returning. - - // Makes a copy of the input array s.t. it can be reused - // (ParseCommandLineFlags() will alter the array). - char** const argv_save = new char*[argc + 1]; - char** argv = argv_save; - memcpy(argv, const_argv, sizeof(*argv)*(argc + 1)); - - if (with_help) { - ParseCommandLineFlags(&argc, &argv, true); - } else { - ParseCommandLineNonHelpFlags(&argc, &argv, true); - } - - delete[] argv_save; - return FLAGS_test_flag; -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedTwiceOnCommandLine) { - const char* argv[] = { - "my_test", - "--test_flag=1", - "--test_flag=2", - NULL, - }; - - EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedTwiceInFlagFile) { - const char* argv[] = { - "my_test", - GetFlagFileFlag(), - NULL, - }; - - EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedInCommandLineAndThenFlagFile) { - const char* argv[] = { - "my_test", - "--test_flag=0", - GetFlagFileFlag(), - NULL, - }; - - EXPECT_EQ(2, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(2, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedInFlagFileAndThenCommandLine) { - const char* argv[] = { - "my_test", - GetFlagFileFlag(), - "--test_flag=3", - NULL, - }; - - EXPECT_EQ(3, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(3, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsUsesLastDefinitionTest, - WhenFlagIsDefinedInCommandLineAndFlagFileAndThenCommandLine) { - const char* argv[] = { - "my_test", - "--test_flag=0", - GetFlagFileFlag(), - "--test_flag=3", - NULL, - }; - - EXPECT_EQ(3, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(3, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgFirst) { - const char* argv[] = { - "my_test", - "--", - "--test_flag=0", - NULL, - }; - - EXPECT_EQ(-1, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(-1, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgMiddle) { - const char* argv[] = { - "my_test", - "--test_flag=7", - "--", - "--test_flag=0", - NULL, - }; - - EXPECT_EQ(7, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(7, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -TEST(ParseCommandLineFlagsAndDashArgs, OneDashArg) { - const char* argv[] = { - "my_test", - "-", - "--test_flag=0", - NULL, - }; - - EXPECT_EQ(0, ParseTestFlag(true, arraysize(argv) - 1, argv)); - EXPECT_EQ(0, ParseTestFlag(false, arraysize(argv) - 1, argv)); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(ParseCommandLineFlagsUnknownFlagDeathTest, - FlagIsCompletelyUnknown) { - const char* argv[] = { - "my_test", - "--this_flag_does_not_exist", - NULL, - }; - - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "unknown command line flag.*"); - EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), - "unknown command line flag.*"); -} - -TEST(ParseCommandLineFlagsUnknownFlagDeathTest, - BoolFlagIsCompletelyUnknown) { - const char* argv[] = { - "my_test", - "--nothis_flag_does_not_exist", - NULL, - }; - - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "unknown command line flag.*"); - EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), - "unknown command line flag.*"); -} - -TEST(ParseCommandLineFlagsUnknownFlagDeathTest, - FlagIsNotABool) { - const char* argv[] = { - "my_test", - "--notest_string", - NULL, - }; - - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "boolean value .* specified for .* command line flag"); - EXPECT_DEATH(ParseTestFlag(false, arraysize(argv) - 1, argv), - "boolean value .* specified for .* command line flag"); -} -#endif - -TEST(ParseCommandLineFlagsWrongFields, - DescriptionIsInvalid) { - // These must not be automatic variables, since command line flags - // aren't unregistered and gUnit uses FlagSaver to save and restore - // command line flags' values. If these are on the stack, then when - // later tests attempt to save and restore their values, the stack - // addresses of these variables will be overwritten... Stack smash! - static bool current_storage; - static bool defvalue_storage; - FlagRegisterer fr("flag_name", NULL, "filename", - ¤t_storage, &defvalue_storage); - CommandLineFlagInfo fi; - EXPECT_TRUE(GetCommandLineFlagInfo("flag_name", &fi)); - EXPECT_EQ("", fi.description); - EXPECT_EQ(¤t_storage, fi.flag_ptr); -} - -static bool ValidateTestFlagIs5(const char* flagname, int32 flagval) { - if (flagval == 5) - return true; - printf("%s isn't 5!\n", flagname); - return false; -} - -static bool ValidateTestFlagIs10(const char* flagname, int32 flagval) { - return flagval == 10; -} - - -TEST(FlagsValidator, ValidFlagViaArgv) { - const char* argv[] = { - "my_test", - "--test_flag=5", - NULL, - }; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_EQ(5, ParseTestFlag(true, arraysize(argv) - 1, argv)); - // Undo the flag validator setting - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, ValidFlagViaSetDefault) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", - SET_FLAG_IF_DEFAULT)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, ValidFlagViaSetValue) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - FLAGS_test_flag = 100; // doesn't trigger the validator - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", - SET_FLAGS_VALUE)); - EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", - SET_FLAGS_DEFAULT)); - EXPECT_NE("", SetCommandLineOption("test_flag", "5")); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(FlagsValidatorDeathTest, InvalidFlagViaArgv) { - const char* argv[] = { - "my_test", - "--test_flag=50", - NULL, - }; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "ERROR: failed validation of new value '50' for flag 'test_flag'"); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} -#endif - -TEST(FlagsValidator, InvalidFlagViaSetDefault) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", - SET_FLAG_IF_DEFAULT)); - EXPECT_EQ(-1, FLAGS_test_flag); // the setting-to-50 should have failed - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, InvalidFlagViaSetValue) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - FLAGS_test_flag = 100; // doesn't trigger the validator - // SetCommandLineOptionWithMode returns the empty string on error. - EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", - SET_FLAGS_VALUE)); - EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", - SET_FLAGS_DEFAULT)); - EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); - EXPECT_EQ(100, FLAGS_test_flag); // the setting-to-50 should have failed - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -#ifdef GTEST_HAS_DEATH_TEST -TEST(FlagsValidatorDeathTest, InvalidFlagNeverSet) { - // If a flag keeps its default value, and that default value is - // invalid, we should die at argv-parse time. - const char* argv[] = { - "my_test", - NULL, - }; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_DEATH(ParseTestFlag(true, arraysize(argv) - 1, argv), - "ERROR: --test_flag must be set on the commandline"); -} -#endif - -TEST(FlagsValidator, InvalidFlagPtr) { - int32 dummy; - EXPECT_FALSE(RegisterFlagValidator(NULL, &ValidateTestFlagIs5)); - EXPECT_FALSE(RegisterFlagValidator(&dummy, &ValidateTestFlagIs5)); -} - -TEST(FlagsValidator, RegisterValidatorTwice) { - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); - EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); -} - -TEST(FlagsValidator, CommandLineFlagInfo) { - CommandLineFlagInfo info; - info = GetCommandLineFlagInfoOrDie("test_flag"); - EXPECT_FALSE(info.has_validator_fn); - - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - info = GetCommandLineFlagInfoOrDie("test_flag"); - EXPECT_TRUE(info.has_validator_fn); - - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); - info = GetCommandLineFlagInfoOrDie("test_flag"); - EXPECT_FALSE(info.has_validator_fn); -} - -TEST(FlagsValidator, FlagSaver) { - { - FlagSaver fs; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // fails validation - } - EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // validator is gone - - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); - { - FlagSaver fs; - EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); - EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // no validator - } - EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // validator is back -} - - -} // unnamed namespace - -static int main(int argc, char **argv) { - - // Run unit tests only if called without arguments, otherwise this program - // is used by an "external" usage test - const bool run_tests = (argc == 1); - - // We need to call SetArgv before parsing flags, so our "test" argv will - // win out over this executable's real argv. That makes running this - // test with a real --help flag kinda annoying, unfortunately. - const char* test_argv[] = { "/test/argv/for/gflags_unittest", - "argv 2", "3rd argv", "argv #4" }; - SetArgv(arraysize(test_argv), test_argv); - - // The first arg is the usage message, also important for testing. - string usage_message = (string(GetArgv0()) + - ": [...]\nDoes something useless.\n"); - - // We test setting tryfromenv manually, and making sure - // ParseCommandLineFlags still evaluates it. - FLAGS_tryfromenv = "test_tryfromenv"; - setenv("FLAGS_test_tryfromenv", "pre-set", 1); - - // Modify flag values from declared default value in two ways. - // The recommended way: - SetCommandLineOptionWithMode("changed_bool1", "true", SET_FLAGS_DEFAULT); - - // The non-recommended way: - FLAGS_changed_bool2 = true; - - SetUsageMessage(usage_message); - SetVersionString("test_version"); - ParseCommandLineFlags(&argc, &argv, true); - MakeTmpdir(&FLAGS_test_tmpdir); - - int exit_status = 0; - if (run_tests) { - fprintf(stdout, "Running the unit tests now...\n\n"); fflush(stdout); - exit_status = RUN_ALL_TESTS(); - } else fprintf(stderr, "\n\nPASS\n"); - ShutDownCommandLineFlags(); - return exit_status; -} - -} // GFLAGS_NAMESPACE - -int main(int argc, char** argv) { - return GFLAGS_NAMESPACE::main(argc, argv); -} - diff --git a/demos/thirdparty/gflags/test/gflags_unittest_flagfile b/demos/thirdparty/gflags/test/gflags_unittest_flagfile deleted file mode 100644 index f4fa0c4d5c5..00000000000 --- a/demos/thirdparty/gflags/test/gflags_unittest_flagfile +++ /dev/null @@ -1,2 +0,0 @@ ---test_flag=1 ---test_flag=2 diff --git a/demos/thirdparty/gflags/test/nc/CMakeLists.txt b/demos/thirdparty/gflags/test/nc/CMakeLists.txt deleted file mode 100644 index d00b07d07dc..00000000000 --- a/demos/thirdparty/gflags/test/nc/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -## gflags negative compilation tests - -cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) - -if (NOT TEST_NAME) - message (FATAL_ERROR "Missing TEST_NAME CMake flag") -endif () -string (TOUPPER ${TEST_NAME} TEST_NAME_UPPER) - -project (gflags_${TEST_NAME}) - -find_package (gflags REQUIRED) -include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/..") -add_definitions (-DTEST_${TEST_NAME_UPPER}) -add_executable (gflags_${TEST_NAME} gflags_nc.cc) -target_link_libraries(gflags_${TEST_NAME} gflags) diff --git a/demos/thirdparty/gflags/test/nc/gflags_nc.cc b/demos/thirdparty/gflags/test/nc/gflags_nc.cc deleted file mode 100644 index 1990c30a6a9..00000000000 --- a/demos/thirdparty/gflags/test/nc/gflags_nc.cc +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2009, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// --- -// -// A negative comiple test for gflags. - -#include - -#if defined(TEST_NC_SWAPPED_ARGS) - -DEFINE_bool(some_bool_flag, - "the default value should go here, not the description", - false); - - -#elif defined(TEST_NC_INT_INSTEAD_OF_BOOL) - -DEFINE_bool(some_bool_flag_2, - 0, - "should have been an int32 flag but mistakenly used bool instead"); - -#elif defined(TEST_NC_BOOL_IN_QUOTES) - - -DEFINE_bool(some_bool_flag_3, - "false", - "false in in quotes, which is wrong"); - -#elif defined(TEST_NC_SANITY) - -DEFINE_bool(some_bool_flag_4, - true, - "this is the correct usage of DEFINE_bool"); - -#elif defined(TEST_NC_DEFINE_STRING_WITH_0) - -DEFINE_string(some_string_flag, - 0, - "Trying to construct a string by passing 0 would cause a crash."); - -#endif - -int main(int, char **) -{ - return 0; -} diff --git a/demos/whiteboard_inpainting_demo/python/README.md b/demos/whiteboard_inpainting_demo/python/README.md index 817e0087924..7176a7ea4fa 100644 --- a/demos/whiteboard_inpainting_demo/python/README.md +++ b/demos/whiteboard_inpainting_demo/python/README.md @@ -18,7 +18,7 @@ As an input, the demo application takes: * Path to a video file * Index of a web camera -> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Converting_Model_General.html). +> **NOTE**: By default, Open Model Zoo demos expect input with BGR channels order. If you trained your model to work with RGB order, you need to manually rearrange the default channels order in the demo application or reconvert your model using the Model Optimizer tool with the `--reverse_input_channels` argument specified. For more information about the argument, refer to **When to Reverse Input Channels** section of [Converting a Model Using General Conversion Parameters](https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model.html#general-conversion-parameters). ## Preparing to Run diff --git a/demos/whiteboard_inpainting_demo/python/cityscapes_labels.txt b/demos/whiteboard_inpainting_demo/python/cityscapes_labels.txt deleted file mode 100644 index 4f12daad9d5..00000000000 --- a/demos/whiteboard_inpainting_demo/python/cityscapes_labels.txt +++ /dev/null @@ -1,20 +0,0 @@ -road -sidewalk -building -wall -fence -pole -traffic light -traffic sign -vegetation -terrain -sky -person -rider -car -truck -bus -train -motorcycle -bicycle -ego-vehicle diff --git a/demos/whiteboard_inpainting_demo/python/coco_labels.txt b/demos/whiteboard_inpainting_demo/python/coco_labels.txt deleted file mode 100644 index 9e369434ee9..00000000000 --- a/demos/whiteboard_inpainting_demo/python/coco_labels.txt +++ /dev/null @@ -1,81 +0,0 @@ -__background__ -person -bicycle -car -motorcycle -airplane -bus -train -truck -boat -trafficlight -firehydrant -stopsign -parkingmeter -bench -bird -cat -dog -horse -sheep -cow -elephant -bear -zebra -giraffe -backpack -umbrella -handbag -tie -suitcase -frisbee -skis -snowboard -sportsball -kite -baseballbat -baseballglove -skateboard -surfboard -tennisracket -bottle -wineglass -cup -fork -knife -spoon -bowl -banana -apple -sandwich -orange -broccoli -carrot -hotdog -pizza -donut -cake -chair -couch -pottedplant -bed -diningtable -toilet -tv -laptop -mouse -remote -keyboard -cellphone -microwave -oven -toaster -sink -refrigerator -book -clock -vase -scissors -teddybear -hairdrier -toothbrush diff --git a/demos/whiteboard_inpainting_demo/python/whiteboard_inpainting.gif b/demos/whiteboard_inpainting_demo/python/whiteboard_inpainting.gif index ec3f22e800d..a5fc42017d5 100644 Binary files a/demos/whiteboard_inpainting_demo/python/whiteboard_inpainting.gif and b/demos/whiteboard_inpainting_demo/python/whiteboard_inpainting.gif differ diff --git a/demos/whiteboard_inpainting_demo/python/whiteboard_inpainting_demo.py b/demos/whiteboard_inpainting_demo/python/whiteboard_inpainting_demo.py index 4989d592b6d..49be8d356d6 100755 --- a/demos/whiteboard_inpainting_demo/python/whiteboard_inpainting_demo.py +++ b/demos/whiteboard_inpainting_demo/python/whiteboard_inpainting_demo.py @@ -103,7 +103,7 @@ def main(): raise ValueError('Set up exactly one of segmentation models: ' '--m_instance_segmentation or --m_semantic_segmentation') - root_dir = Path(__file__).resolve().parent + labels_dir = Path(__file__).resolve().parents[3] / 'data/dataset_classes' mouse = MouseClick() if not args.no_show: cv2.namedWindow(WINNAME) @@ -116,11 +116,11 @@ def main(): model_path = args.m_instance_segmentation if args.m_instance_segmentation else args.m_semantic_segmentation log.info('Reading model {}'.format(model_path)) if args.m_instance_segmentation: - labels_file = str(root_dir / 'coco_labels.txt') + labels_file = str(labels_dir / 'coco_80cl_bkgr.txt') segmentation = MaskRCNN(ie, args.m_instance_segmentation, labels_file, args.threshold, args.device, args.cpu_extension) elif args.m_semantic_segmentation: - labels_file = str(root_dir / 'cityscapes_labels.txt') + labels_file = str(labels_dir / 'cityscapes_19cl_bkgr.txt') segmentation = SemanticSegmentation(ie, args.m_semantic_segmentation, labels_file, args.threshold, args.device, args.cpu_extension) log.info('The model {} is loaded to {}'.format(model_path, args.device)) diff --git a/models/intel/action-recognition-0001/action-recognition-0001-decoder/model.yml b/models/intel/action-recognition-0001/action-recognition-0001-decoder/model.yml index b1846af54bb..e0305370902 100644 --- a/models/intel/action-recognition-0001/action-recognition-0001-decoder/model.yml +++ b/models/intel/action-recognition-0001/action-recognition-0001-decoder/model.yml @@ -19,27 +19,27 @@ task_type: action_recognition files: - name: FP32/action-recognition-0001-decoder.xml size: 192871 - sha256: d0d5de280e1deab4d7f8271630248ede831b70dbd0686a8565612aa5f2b6b00b + sha384: 68b426039f98b7471b62d77c1264dd2ceaccd937aa39cbbaf492621ae534f24c7ca228e209e80bb79cc342fe70f0ebc0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-decoder/FP32/action-recognition-0001-decoder.xml - name: FP32/action-recognition-0001-decoder.bin size: 30238732 - sha256: afa0e9d40c8ef686a23672486c881338835df27b00e88b0db433ff3521e773ea + sha384: b574c93a949be5619e53601d8c7062ce0a6c06a4b32ad9cc9fc8e40198c56838bab964a566c3485bcb1eda15563fac7c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-decoder/FP32/action-recognition-0001-decoder.bin - name: FP16/action-recognition-0001-decoder.xml size: 192819 - sha256: c17a509d16774563b6166c173e4fe3d521564b02316d91b6bf049e73d46e493e + sha384: 357050399862b19de6a9be6c089fa557748e2777b8889c04ed0eb561a2561dcdf05cb6df803e642b1d81d343d92ffc70 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-decoder/FP16/action-recognition-0001-decoder.xml - name: FP16/action-recognition-0001-decoder.bin size: 15119468 - sha256: 838ea1889c2cf6c07b87df874004318749dafb9413a7298a5adba33d3e764e72 + sha384: 9de9080d93325b20ec6de71ffe426aad16cbf4aeadbd9bf0afdcb35f77934f5db80aa024c91d363211ed98f3d0e05a35 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-decoder/FP16/action-recognition-0001-decoder.bin - name: FP16-INT8/action-recognition-0001-decoder.xml size: 309486 - sha256: fdc28c0f2ee82b1d8e127f2562bd93e842bd57c40e6f4877588f1d1424794009 + sha384: 25a16727f24c0484b10e42e23f5247c2f13164c950db7c1449448803735de8201faf11f5003a07bd7f85c87834190389 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-decoder/FP16-INT8/action-recognition-0001-decoder.xml - name: FP16-INT8/action-recognition-0001-decoder.bin size: 7406600 - sha256: 3650b7e326a8eff8ec60d65579a61db14971bba2965e53d63dda103619d40656 + sha384: 441ef1f1211736a7651d4bdc6c62dd9adfd64e9a7d41b887e18d36882e7fc5e11d27f33c5bee6e88ffccc4179630350e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-decoder/FP16-INT8/action-recognition-0001-decoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/action-recognition-0001/action-recognition-0001-encoder/model.yml b/models/intel/action-recognition-0001/action-recognition-0001-encoder/model.yml index fecd8288768..78a5c61bca4 100644 --- a/models/intel/action-recognition-0001/action-recognition-0001-encoder/model.yml +++ b/models/intel/action-recognition-0001/action-recognition-0001-encoder/model.yml @@ -19,27 +19,27 @@ task_type: action_recognition files: - name: FP32/action-recognition-0001-encoder.xml size: 105014 - sha256: 02bdadc070c08603d5347b7942a42d4bdc715ee1ec7b3b160a23311ec75fbeec + sha384: 52fd000140ccb06cd515bfb2692b60b6459bb7db0d3ca6f555212a2c0b4cfc72a924118c2f9b85dbeae1c09e5e1c2deb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-encoder/FP32/action-recognition-0001-encoder.xml - name: FP32/action-recognition-0001-encoder.bin size: 85104664 - sha256: c33e24b3f74918104eeafc106ee7f0b56804f03b87098c14ad66af6386cdb648 + sha384: 61321c5af18f4dc601e9d5d525a2013377e12d72130cbe232ff33a55f5181d8c49d07196f24be65362a7a29a11321dab source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-encoder/FP32/action-recognition-0001-encoder.bin - name: FP16/action-recognition-0001-encoder.xml size: 104974 - sha256: acbc7546a164bcbfc2f11b44d730d874477266ee19244c826a1cc04175723b12 + sha384: e6ac8c62ab80ef9240f28b154be039a4cc57af5913b87ac0c935ef372bf9602ca37f07b5d9a0c689853e67341376b9dd source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-encoder/FP16/action-recognition-0001-encoder.xml - name: FP16/action-recognition-0001-encoder.bin size: 42552332 - sha256: 57d374b873dc87c72e5baab53245d59f1b866f6e2c3e670c923537f45018782c + sha384: bb1ad5b71258ad8e9117de1fb71e928003ec39bf07e024b6d6987448047e1af37c7c0c6fa426368fad45859a9d8fbcc4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-encoder/FP16/action-recognition-0001-encoder.bin - name: FP16-INT8/action-recognition-0001-encoder.xml size: 278546 - sha256: eab591804a1acf3fe2338d4b3573c821ed2bf76605f75e4ad0076f7fb9172b93 + sha384: 40b6d4321e990f0f0ea222b68bf80ec431b20c777d2d7d2b2ea92e992b2d27f42c0f7dc80e1edbb3b26957efecca2abc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-encoder/FP16-INT8/action-recognition-0001-encoder.xml - name: FP16-INT8/action-recognition-0001-encoder.bin size: 21309656 - sha256: fddcab91569cbb215a589b045b2ebd297a89a9926a09741ab522e883f21633bf + sha384: edc7cbdb2ed6867cb37ec4d533d2c756ca6fe87addf73f2216fdfc7bde76f3d796eda5d49e857c74dbbc31d07fee9c02 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/action-recognition-0001/action-recognition-0001-encoder/FP16-INT8/action-recognition-0001-encoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/age-gender-recognition-retail-0013/model.yml b/models/intel/age-gender-recognition-retail-0013/model.yml index 5bf4277dd16..efda26c45e6 100644 --- a/models/intel/age-gender-recognition-retail-0013/model.yml +++ b/models/intel/age-gender-recognition-retail-0013/model.yml @@ -18,27 +18,27 @@ task_type: object_attributes files: - name: FP32/age-gender-recognition-retail-0013.xml size: 31536 - sha256: b65e8fd565f82f0dc4920058593d4bb0d15d3148baed5977e1ef63c599198224 + sha384: f7d042e1b5fec35ea29766f9544fac24a4fb17cd22973914310f96744afda9e582c12761766cfd218f467ac834a75e49 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/age-gender-recognition-retail-0013/FP32/age-gender-recognition-retail-0013.xml - name: FP32/age-gender-recognition-retail-0013.bin size: 8552076 - sha256: 1ca37d787eb4006630b7b7ced18e4359ad426d489055e97b44ca5e2830cb0451 + sha384: f00e708403ab7cf2a473351ec57d7fe65e15488b4baa8f8cf8fa9b5bdf90da3594bcbc689794993c1b08a51889488a13 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/age-gender-recognition-retail-0013/FP32/age-gender-recognition-retail-0013.bin - name: FP16/age-gender-recognition-retail-0013.xml size: 31526 - sha256: 54d62ce4a3c3d7f1559a22ee9524bac41101103a8dceaabec537181995eda655 + sha384: 164d57fab84782a44297bf589f9b738d75ef619da7c564d8df9c126748e0a74378d2b107f90cbb607f70d91903940a26 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/age-gender-recognition-retail-0013/FP16/age-gender-recognition-retail-0013.xml - name: FP16/age-gender-recognition-retail-0013.bin size: 4276038 - sha256: 3586df5340e9fcd73ba0e2d802631bd9e027179490635c03b273d33d582e2b58 + sha384: 0afe49d995b2b28087f8705d25d8e3e363d1833d1036de47005174637734b6c3edb789ce840098bc3fcc5e7def77723a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/age-gender-recognition-retail-0013/FP16/age-gender-recognition-retail-0013.bin - name: FP16-INT8/age-gender-recognition-retail-0013.xml size: 72552 - sha256: 17323d8876ef2d6eda6e6802db16913208280f4b7a7697dc66e7ee794b53a9f1 + sha384: fc2a4e56723ea0eac8c6d41e70e2ab858d4e9517a3daad2d37b1f27399f0d3a60ee37b40ca2f119e67e8b24d902e2921 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/age-gender-recognition-retail-0013/FP16-INT8/age-gender-recognition-retail-0013.xml - name: FP16-INT8/age-gender-recognition-retail-0013.bin size: 2150120 - sha256: 67c85c4671c894306d1f67c53f61f5501e14ae297627bdd3dfbda9ec61244b78 + sha384: bbec50f46cd0ccd798e6602da48b061ff4d41c10e666aefe566eaadf404af6569f2bba9a17a8f18702c7aa436b79334d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/age-gender-recognition-retail-0013/FP16-INT8/age-gender-recognition-retail-0013.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/asl-recognition-0004/model.yml b/models/intel/asl-recognition-0004/model.yml index d934a637ae3..f129f478756 100644 --- a/models/intel/asl-recognition-0004/model.yml +++ b/models/intel/asl-recognition-0004/model.yml @@ -18,27 +18,27 @@ task_type: action_recognition files: - name: FP32/asl-recognition-0004.xml size: 296552 - sha256: 9e625a7660a060d684d4ffbb857acdd1337a507a1e12146fbb8bd7d5727306af + sha384: 3563b1c3892b446bcf932bb6787b76b05a6a2e30d3aba997198f9a423c17572bd46e5e1aaae5ff92774796dc0cb6450a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/asl-recognition-0004/FP32/asl-recognition-0004.xml - name: FP32/asl-recognition-0004.bin size: 16530600 - sha256: 0fb8a3f15377f9961940e3391d781bd68051441e8a634699dc83739bafadf4a3 + sha384: 92b031d627246e74b13aea6eb4e3b728f15ba8ee3288b0b5e642ca07036e21065096654eb897bf14e4c3f62446644a7a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/asl-recognition-0004/FP32/asl-recognition-0004.bin - name: FP16/asl-recognition-0004.xml size: 296401 - sha256: 8c88026b08bb8bfba5fdeea3e7f51b602093539b78339db0e28f13a91011c56e + sha384: b0deda00dca26c9a7f10f7ab53bb4c19c8c672acf814bd4afe789b9da8914b2c9b77181c5d00163c03b2fca058b11e66 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/asl-recognition-0004/FP16/asl-recognition-0004.xml - name: FP16/asl-recognition-0004.bin size: 8265312 - sha256: 698ee599c9869c9b759eb52b2229fd29a5845f763a420668d914e973ce762fee + sha384: 33d518c6faceac4740280144d972c3576ae4fea64df9aa2a81625702179bfc6119f665450a66f1984632203e98943131 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/asl-recognition-0004/FP16/asl-recognition-0004.bin - name: FP16-INT8/asl-recognition-0004.xml size: 691459 - sha256: 672dc7b48dc86d1a4a994874d1afa755043f32cffe44b0070746600499bb2f4a + sha384: 4a79dc5f76d8038c16e0195bc66ff73c9a04268190253fc7a89d8a2a18881bff07bfa0869eafca0e39f822db165eeade source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/asl-recognition-0004/FP16-INT8/asl-recognition-0004.xml - name: FP16-INT8/asl-recognition-0004.bin size: 4290197 - sha256: 318f9943ec118e83d1ac1b91220f334cf8667db90e1bfffeaf957e95e1cb902d + sha384: da193cca0c03dd955edf278f2548278bb57b59b2ab0925c62185250a78f3f782aef22e90e689bfc78886928f82b0b3cd source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/asl-recognition-0004/FP16-INT8/asl-recognition-0004.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/bert-large-uncased-whole-word-masking-squad-0001/model.yml b/models/intel/bert-large-uncased-whole-word-masking-squad-0001/model.yml index 3431a616b5a..a785e33623b 100644 --- a/models/intel/bert-large-uncased-whole-word-masking-squad-0001/model.yml +++ b/models/intel/bert-large-uncased-whole-word-masking-squad-0001/model.yml @@ -19,19 +19,19 @@ task_type: question_answering files: - name: FP32/bert-large-uncased-whole-word-masking-squad-0001.xml size: 1316805 - sha256: 5ce4824e65eee791a0a791c622f4f06c2e5e7a46b4b04ac2f579f5c34f885610 + sha384: 0a8fbe4593dbf64e777e97af7cee52ad101aa2e26b1b2cf663e1c69e24ca2d8beed22cc5931a863ef0eda1753ed35c0d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-0001/FP32/bert-large-uncased-whole-word-masking-squad-0001.xml - name: FP32/bert-large-uncased-whole-word-masking-squad-0001.bin size: 1336377584 - sha256: fd0c0d26f5de9cd300ed645c6e7b665bb2df92dc24c23f8218ab9c73e4cb9576 + sha384: 0a762c4f17991d6f564fcc24ba588ab70e19c84243e6b529fc3156b91b4f55526fda0df20ac7ecc34c24c1b7d5d131a4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-0001/FP32/bert-large-uncased-whole-word-masking-squad-0001.bin - name: FP16/bert-large-uncased-whole-word-masking-squad-0001.xml size: 1315563 - sha256: f5476f3bbf8ae1d8abffa01b631d0cda9860aa03c7e3a4a1818e64c6099d1312 + sha384: 5495f01494ee5a61096beb9fd76ad55970d4e49d707a2f8943eb17709f1c84130136796967f41815c5fa99fd3b258830 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-0001/FP16/bert-large-uncased-whole-word-masking-squad-0001.xml - name: FP16/bert-large-uncased-whole-word-masking-squad-0001.bin size: 668188872 - sha256: 4dd70583d1f0d2bdfd230da38111164bf04ce570731174b2b3b4906b99307a56 + sha384: 7ec8b5ec15dac76214075add12ab88a5248ba1358f3104cf7ad8e5c0ef6bdfadb420b6864322111496706337a72d00ac source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-0001/FP16/bert-large-uncased-whole-word-masking-squad-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/bert-large-uncased-whole-word-masking-squad-emb-0001/model.yml b/models/intel/bert-large-uncased-whole-word-masking-squad-emb-0001/model.yml index 4158f466a90..084824febe6 100644 --- a/models/intel/bert-large-uncased-whole-word-masking-squad-emb-0001/model.yml +++ b/models/intel/bert-large-uncased-whole-word-masking-squad-emb-0001/model.yml @@ -20,19 +20,19 @@ task_type: question_answering files: - name: FP32/bert-large-uncased-whole-word-masking-squad-emb-0001.xml size: 1301867 - sha256: 64e9e41b08f11d909a95fe346ca603007c24ce8cce6eef435da46381f7388977 + sha384: 3873a8036617913ca66a5ec26b4a241ddb2bb0395e8440dde4307ea0e8b19fdcb20fc177e2b5163f0d0c4171e681fdc5 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-emb-0001/FP32/bert-large-uncased-whole-word-masking-squad-emb-0001.xml - name: FP32/bert-large-uncased-whole-word-masking-squad-emb-0001.bin size: 1340567764 - sha256: 071d13a1744c5c90d54e78a13f6c0dbe581128a06c996eb7b5fde4162e11f5f8 + sha384: a026cb215aea6e133f0dceb781487c05bf190412f427987bf31b57c55cf730819ccd208865d47b0ffd7f2d62f3a59b3a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-emb-0001/FP32/bert-large-uncased-whole-word-masking-squad-emb-0001.bin - name: FP16/bert-large-uncased-whole-word-masking-squad-emb-0001.xml size: 1300638 - sha256: 503148f197b04ccb8816854de298b8fc85bfed55b97df6f48866ab0907b22189 + sha384: a80f3d290900270526b8773a41e8776e91dcde600948ad6e0eb1d362f3a926b9085acfd80a8f4aca049991f572bf65b0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-emb-0001/FP16/bert-large-uncased-whole-word-masking-squad-emb-0001.xml - name: FP16/bert-large-uncased-whole-word-masking-squad-emb-0001.bin size: 670283952 - sha256: 0293b6998bd86d8c743781e10ab238d0a54019d9c45a3f780087387a574454ea + sha384: 923d86ac390cd69f86acf7b20bda7b07663a25cf72616ec303fd881f51778b215a789d7df9f9256ba5768cc1fa575895 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-emb-0001/FP16/bert-large-uncased-whole-word-masking-squad-emb-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/bert-large-uncased-whole-word-masking-squad-int8-0001/model.yml b/models/intel/bert-large-uncased-whole-word-masking-squad-int8-0001/model.yml index 06e01a87814..b45c427d8af 100644 --- a/models/intel/bert-large-uncased-whole-word-masking-squad-int8-0001/model.yml +++ b/models/intel/bert-large-uncased-whole-word-masking-squad-int8-0001/model.yml @@ -20,19 +20,19 @@ task_type: question_answering files: - name: FP32-INT8/bert-large-uncased-whole-word-masking-squad-int8-0001.xml size: 2081295 - sha256: 507243680a85395c8cbf3b72ee55733cbf2eccbbd6ac5d7c122580557bbe4358 + sha384: cdda1c70ec061237fd4a53a959ea08f389346430f480b71c9ee17e59319d955c6e2f07d28eb380f6192b47d7eac5fea1 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-int8-0001/FP32-INT8/bert-large-uncased-whole-word-masking-squad-int8-0001.xml - name: FP32-INT8/bert-large-uncased-whole-word-masking-squad-int8-0001.bin size: 430404052 - sha256: f726f4c5a89d5fa5f15491d8f9192039887fb5882a8007e49ce6673f5db7bdd2 + sha384: c24c885b3f2dddb146f73169eb005c9072ebfa72e47bc2d3669ce417d0cae25c40780faa1e99bbb9869a8ea9a3f2690b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-int8-0001/FP32-INT8/bert-large-uncased-whole-word-masking-squad-int8-0001.bin - name: FP16-INT8/bert-large-uncased-whole-word-masking-squad-int8-0001.xml size: 2079957 - sha256: 9c81b84cee05260a17925dd75fe0a8536fe73347630f579501fc279ac4605beb + sha384: 25591b1d23dfe01f6767be951da1dd434e5ceb597d745e4a6c707e773a7c4cae70c7ee887848665b401e58d6864e33c8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-int8-0001/FP16-INT8/bert-large-uncased-whole-word-masking-squad-int8-0001.xml - name: FP16-INT8/bert-large-uncased-whole-word-masking-squad-int8-0001.bin size: 366198058 - sha256: 877bd072a0622fa64f6ab84d2ed93dc948ced1f14096045f9350af9cd1ed07e4 + sha384: 584214fe1e4cad2540cb1015c2ebf4021b1262e7816f46622516b8968308cb5bb2e8a67de3684216c16f8bbf71257f4e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-large-uncased-whole-word-masking-squad-int8-0001/FP16-INT8/bert-large-uncased-whole-word-masking-squad-int8-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/bert-small-uncased-whole-word-masking-squad-0001/model.yml b/models/intel/bert-small-uncased-whole-word-masking-squad-0001/model.yml index f08a0aafa0d..66a2a1170f4 100644 --- a/models/intel/bert-small-uncased-whole-word-masking-squad-0001/model.yml +++ b/models/intel/bert-small-uncased-whole-word-masking-squad-0001/model.yml @@ -21,19 +21,19 @@ task_type: question_answering files: - name: FP32/bert-small-uncased-whole-word-masking-squad-0001.xml size: 729748 - sha256: f4de886700e641b0d55638fb598b762fd8be5f99bd0f859aeb7797132d23911f + sha384: b379300803ee659466a3da34e62da43db6abcc263d14918207cac8a5300b6a8f88207c6ec27ce3194ba32fa8ad11a1c2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-0001/FP32/bert-small-uncased-whole-word-masking-squad-0001.xml - name: FP32/bert-small-uncased-whole-word-masking-squad-0001.bin size: 232298716 - sha256: c1a548807f3d4f621f2fd34d57d1355ee72e587c83779ee1df7d0da0cf52edc7 + sha384: 0e38dd880640991f9c8e10558f31996331eacff967845903d06f208fede1eb5337794087092bdf19377fa8ad78330869 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-0001/FP32/bert-small-uncased-whole-word-masking-squad-0001.bin - name: FP16/bert-small-uncased-whole-word-masking-squad-0001.xml size: 728952 - sha256: e7b96424d2c0acb1846d182f3d04bdedbfaae5f06538fb1ddfc7225a96f3fb8c + sha384: e3617ee4e3b549faa87e164825589b5ae15e543a559e78877eb67ee42887705a8d0c3f10d72f55894e4c395c3ea33e94 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-0001/FP16/bert-small-uncased-whole-word-masking-squad-0001.xml - name: FP16/bert-small-uncased-whole-word-masking-squad-0001.bin size: 116149444 - sha256: b181b9c810810fd3f513baaf287edde19faa9e902fbd741eb2bc1437ff6339cd + sha384: 29e7591af9fad52659de14dde3fbed3bf56f770f4a4ff90c21378741bea77e1cc4bbac9a22b9da21c0c4f719ed62b908 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-0001/FP16/bert-small-uncased-whole-word-masking-squad-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/bert-small-uncased-whole-word-masking-squad-0002/model.yml b/models/intel/bert-small-uncased-whole-word-masking-squad-0002/model.yml index 8437a5505f7..e8040daf66f 100644 --- a/models/intel/bert-small-uncased-whole-word-masking-squad-0002/model.yml +++ b/models/intel/bert-small-uncased-whole-word-masking-squad-0002/model.yml @@ -21,19 +21,19 @@ task_type: question_answering files: - name: FP32/bert-small-uncased-whole-word-masking-squad-0002.xml size: 716185 - sha256: 980954e394cf98a473144faa8a5f8a70b4354177e2b2adc8f7f34bc16b828013 + sha384: ef7d8a8fce02fc7ef656251d63f575ff812315e0a8b0c46f762b9e088983fcd00ab3bf339fad70ad36a15daaf9cbcbc0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-0002/FP32/bert-small-uncased-whole-word-masking-squad-0002.xml - name: FP32/bert-small-uncased-whole-word-masking-squad-0002.bin size: 164528332 - sha256: 2789cb720ef8dc4296541af33485832397f312d2cd75abfd07bb215991bb5b9f + sha384: 0c80fbd28bfb9336722a716bdba02a39feacec0aef81bdf055a506a808899e2c191e2440f10dcd7923bfd6c91bf385e4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-0002/FP32/bert-small-uncased-whole-word-masking-squad-0002.bin - name: FP16/bert-small-uncased-whole-word-masking-squad-0002.xml size: 715930 - sha256: b601a436a77f129e766cc391168e387fd424774784cd5b80b188fb4e7a12b40c + sha384: fb200362fae9f24d1f76f681492f80d45e1f0eb2b714fe4bee1cd0607b870c5a41b49acc2be492b7d8719f2c9f189fe6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-0002/FP16/bert-small-uncased-whole-word-masking-squad-0002.xml - name: FP16/bert-small-uncased-whole-word-masking-squad-0002.bin size: 82264244 - sha256: 43e6cae76673287cd9c19dd431239f3fdc71a29a43065e5a02f4898ca691f848 + sha384: 2793b3a6df64023783cc2e5ab2ee83a9719f4417d6bb41912b2a3f67025d552a908d8e1f469d9dc2617859e52196df9a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-0002/FP16/bert-small-uncased-whole-word-masking-squad-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/bert-small-uncased-whole-word-masking-squad-emb-int8-0001/model.yml b/models/intel/bert-small-uncased-whole-word-masking-squad-emb-int8-0001/model.yml index a0e2de562fc..cbe1e411506 100644 --- a/models/intel/bert-small-uncased-whole-word-masking-squad-emb-int8-0001/model.yml +++ b/models/intel/bert-small-uncased-whole-word-masking-squad-emb-int8-0001/model.yml @@ -22,19 +22,19 @@ task_type: question_answering files: - name: FP32-INT8/bert-small-uncased-whole-word-masking-squad-emb-int8-0001.xml size: 1180008 - sha256: c390d301ebd9d397711bea55e72c3b739edce984e8b1389a17adb5e0d1c19706 + sha384: 88969417b0b7aec629eb2789c861281a2e275a9247127ca327993c6dfdc0ee483ee20d27b314759c5df6e43ae0b7b205 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-emb-int8-0001/FP32-INT8/bert-small-uncased-whole-word-masking-squad-emb-int8-0001.xml - name: FP32-INT8/bert-small-uncased-whole-word-masking-squad-emb-int8-0001.bin size: 41893204 - sha256: d827a81b21ec7df1d6d22894cc4ffa40acab93513f37a878e57a2ecb1ef72839 + sha384: c8f3d484b7464c50d4fc6e9b7089cc5fc3a0376f4a56176a975d5c0b708e76be65b00e2bd9968e6f86cf09767189225a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-emb-int8-0001/FP32-INT8/bert-small-uncased-whole-word-masking-squad-emb-int8-0001.bin - name: FP16-INT8/bert-small-uncased-whole-word-masking-squad-emb-int8-0001.xml size: 1180008 - sha256: 0eb6f7aa5c8c713ab280d3c773c3a00bb1ab7c1c76eab4099da08577a962961d + sha384: bc1cc846e1485ff2e6d716e6fd0ac688c5e56debea59727bcf73e96d712314ad705c199feea40fe8e017bdf42c722500 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-emb-int8-0001/FP16-INT8/bert-small-uncased-whole-word-masking-squad-emb-int8-0001.xml - name: FP16-INT8/bert-small-uncased-whole-word-masking-squad-emb-int8-0001.bin size: 41736942 - sha256: 9f0c59a2d272f47bf0bfe7a2e0ba401af2fdc3a45d1f9de0ef19f028db5fc28c + sha384: 96dd099688cea4b23f955c55a83026e81cf69095daaa83cab549bd108d67420bfd7690307087909d9eb73e88fe04e712 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-emb-int8-0001/FP16-INT8/bert-small-uncased-whole-word-masking-squad-emb-int8-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/bert-small-uncased-whole-word-masking-squad-int8-0002/model.yml b/models/intel/bert-small-uncased-whole-word-masking-squad-int8-0002/model.yml index e3bdafa5516..33fe6d4b651 100644 --- a/models/intel/bert-small-uncased-whole-word-masking-squad-int8-0002/model.yml +++ b/models/intel/bert-small-uncased-whole-word-masking-squad-int8-0002/model.yml @@ -21,19 +21,19 @@ task_type: question_answering files: - name: FP32-INT8/bert-small-uncased-whole-word-masking-squad-int8-0002.xml size: 1186181 - sha256: 93a42713339a80a19b7d765c6d7672ad80aa5ede96af125daffc3d5d6a76768d + sha384: 199925fee288c7e8935cf95e8db608385a0a01845c962a4ff7962a63575457494544d60bc5594b78b37b6e60bba1a214 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-int8-0002/FP32-INT8/bert-small-uncased-whole-word-masking-squad-int8-0002.xml - name: FP32-INT8/bert-small-uncased-whole-word-masking-squad-int8-0002.bin size: 41357676 - sha256: 065dedd032ed0b644d16a3182401d7c908d33d575a2d2062f7f68ec387c3e998 + sha384: 793631b516d1444bfaf8e3944ed8de2494b7a3cfce7388aaf1141fdf65c84c9dad42a9e090ea4b8b830980e8ba8422f8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-int8-0002/FP32-INT8/bert-small-uncased-whole-word-masking-squad-int8-0002.bin - name: FP16-INT8/bert-small-uncased-whole-word-masking-squad-int8-0002.xml size: 1186181 - sha256: a7d57ce8e21c0200008c2bf893b4fc6feaeecce8c9d62f65f88ea8fcdf023e71 + sha384: 90361449eed5d3659569c9a71247b75493afaac488875a2e82b650f961e291dcb7f8df4d72a181593bd972d9347e0000 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-int8-0002/FP16-INT8/bert-small-uncased-whole-word-masking-squad-int8-0002.xml - name: FP16-INT8/bert-small-uncased-whole-word-masking-squad-int8-0002.bin size: 41207550 - sha256: 46f74b6e50daa68ab5d3b5da006ddcdb234c6ec2d6bbe044b020cd69d27ea545 + sha384: 78f053153075919afc185908c64afa672e57272f2c8eae69fa4e4620d65d145b5c43b2e0ef9c39491c265180cb6b51df source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/bert-small-uncased-whole-word-masking-squad-int8-0002/FP16-INT8/bert-small-uncased-whole-word-masking-squad-int8-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/common-sign-language-0002/model.yml b/models/intel/common-sign-language-0002/model.yml index 3df51ac371b..d490932faff 100644 --- a/models/intel/common-sign-language-0002/model.yml +++ b/models/intel/common-sign-language-0002/model.yml @@ -18,27 +18,27 @@ task_type: action_recognition files: - name: FP32/common-sign-language-0002.xml size: 255979 - sha256: 59b6cc570f443e091de2587d01685a80a8dd858e28acce58b88e77cff6fc06c5 + sha384: 151ce59371d7f94d7cb6815cd53589ab15f37141f4ffa80ef7322aca4fcd38cf10c53e0b6e2119508cf4c523913366f3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/common-sign-language-0002/FP32/common-sign-language-0002.xml - name: FP32/common-sign-language-0002.bin size: 16425108 - sha256: cbf73a4596ece3cb6fcbdbfbe4ae119c59b3e072d82a6f9618238753400e038c + sha384: fd0804b77073049f985403435a10434d287901cce8dbab1a9fc4162e2b898442e62def0c42ff2ddd48bb1fb300029316 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/common-sign-language-0002/FP32/common-sign-language-0002.bin - name: FP16/common-sign-language-0002.xml size: 255847 - sha256: a38d6d81cab7c77e25f822fcca04fcef6ba19e5c05cb27ada5993e593f81a852 + sha384: 6ba10d98e0f4a43195f5c6f1efb67b06803c1712a218463344cb959c97d6abf0f22ab910836f2c6891f73d1437efd7cd source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/common-sign-language-0002/FP16/common-sign-language-0002.xml - name: FP16/common-sign-language-0002.bin size: 8212566 - sha256: b28b6bf1151f1d9feea91a221f93a2adf494c727bf53a288c53ceed58ca653ba + sha384: dbb3699f68d5098f55f0d15f47d60ee8c805d0b1dc52ce7c67501113909e01109808328151aa80f95e9313f7136b7e74 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/common-sign-language-0002/FP16/common-sign-language-0002.bin - name: FP16-INT8/common-sign-language-0002.xml size: 597327 - sha256: 60904c7c70c0d19447341ac2a48289fc197532f17f124248824c58f66632bc8e + sha384: 76dbf8b4304e0b5eec22e14beb5c3d6dcbfcd8e534ac68e93496d4f46b8406cb982eeb45081b7eff31e17e71df9ccf99 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/common-sign-language-0002/FP16-INT8/common-sign-language-0002.xml - name: FP16-INT8/common-sign-language-0002.bin size: 4214796 - sha256: 6e15a39dec872fc33ae6b1d080dfc4f41801074cfe486e2ce8c00876e8f9676c + sha384: 68316a0e6219abb601f6b8dc44acee31bd33835689f7d48bb1bfcf250b0de7fe2919a76e9e0407368390da8db43bf74b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/common-sign-language-0002/FP16-INT8/common-sign-language-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/device_support.md b/models/intel/device_support.md index 5d6ed7e1d81..3d912ea1e97 100644 --- a/models/intel/device_support.md +++ b/models/intel/device_support.md @@ -27,6 +27,7 @@ | face-detection-retail-0005 | YES | YES | YES | | face-reidentification-retail-0095 | YES | YES | YES | | facial-landmarks-35-adas-0002 | YES | YES | YES | +| facial-landmarks-98-detection-0001 | YES | YES | YES | | faster-rcnn-resnet101-coco-sparse-60-0001 | YES | YES | | | formula-recognition-medium-scan-0001-im2latex-decoder | YES | YES | | | formula-recognition-medium-scan-0001-im2latex-encoder | YES | YES | | diff --git a/models/intel/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-decoder/model.yml b/models/intel/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-decoder/model.yml index 08661cae8f1..e88066195ea 100644 --- a/models/intel/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-decoder/model.yml +++ b/models/intel/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-decoder/model.yml @@ -18,27 +18,27 @@ task_type: action_recognition files: - name: FP32/driver-action-recognition-adas-0002-decoder.xml size: 227876 - sha256: 04e2b7257b24c3228968113c6f2c05a4962d888b2b7bf65aac9df5d9b656a19e + sha384: 8e75716f38ab02777010f070e193579cfa5e1af03656f6210867c1aff15c14f75b85453fb3eb315d8a1ba3009d569d2b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-decoder/FP32/driver-action-recognition-adas-0002-decoder.xml - name: FP32/driver-action-recognition-adas-0002-decoder.bin size: 29436380 - sha256: 74c027469c0bd96192c6f7431181db59332125b1a92c707a10c27332df94d64e + sha384: 92d82e56691bdf84a0088233626fbe74a126e5737d5f08b45c8725cbc68a22c8d7b1b7c5dab7a9121dbaee107b2b501d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-decoder/FP32/driver-action-recognition-adas-0002-decoder.bin - name: FP16/driver-action-recognition-adas-0002-decoder.xml size: 227840 - sha256: 0da8370d1a0444c516eb5499900e48db14f39a145763b86fa44c24bc15a4b561 + sha384: 07da59fd88d0a78596e49734578b1fbbb8cfccc5bd472e916d2af04e5f2cc5530fa221e4c5d32c01ca14e1b84a4bb7e5 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-decoder/FP16/driver-action-recognition-adas-0002-decoder.xml - name: FP16/driver-action-recognition-adas-0002-decoder.bin size: 14718282 - sha256: ea94fa8f3d32d5258656d13f94983e4e95c56c6aa5b1cbbc0fbed668fab0e2f9 + sha384: 28107025567e706b5b18b20fe114a560c431ceafa32cdd3b1d198009ecdf2bef58e3eebb2e4eb3bc88f530a514faf08e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-decoder/FP16/driver-action-recognition-adas-0002-decoder.bin - name: FP16-INT8/driver-action-recognition-adas-0002-decoder.xml size: 344744 - sha256: 83be69ea42dce9b4d5293d00464b9a96dc71506e2077e193100979125c7f1f46 + sha384: da322c036ff69ce0594564d9c5d44ff4578672feb24a8f22d5ac696d5ff45aac56d3bfab07fea639951b118bf016ba5e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-decoder/FP16-INT8/driver-action-recognition-adas-0002-decoder.xml - name: FP16-INT8/driver-action-recognition-adas-0002-decoder.bin size: 6905290 - sha256: 3b203825f2c0a3f39a83d7765aaf9381192ed77083012d8c6ee883f93ba21886 + sha384: 7b0dccf383e21494a302cf2e40fde7d0ddeedd0963dcfd45a0fcc8e6a1e257f2e34525816a03633d86ac7314ace55b88 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-decoder/FP16-INT8/driver-action-recognition-adas-0002-decoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-encoder/model.yml b/models/intel/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-encoder/model.yml index 018571ddb80..89c76a0d207 100644 --- a/models/intel/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-encoder/model.yml +++ b/models/intel/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-encoder/model.yml @@ -18,27 +18,27 @@ task_type: action_recognition files: - name: FP32/driver-action-recognition-adas-0002-encoder.xml size: 136693 - sha256: d42e360dbb8b984335161ed3e0d298235e8c56e81adea748710836f8c7b38e0f + sha384: a416c35e01f82f8f07fcbe61f42ca1863c9e448ff5225bb3b22d91f09b7163e544731597f37062dd5390ce40b07da3bb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-encoder/FP32/driver-action-recognition-adas-0002-encoder.xml - name: FP32/driver-action-recognition-adas-0002-encoder.bin size: 11450776 - sha256: 12bf9bfebc74719d42bc2190bd00064ecf41b820df891040fcaa57f5eb4cffcb + sha384: 3f9d93fa74ad5618b58c4de02633ed3c17d242a61b3f6fdfed578be0f3b6b04f3601f2102835f7885c5c775e777aa4b8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-encoder/FP32/driver-action-recognition-adas-0002-encoder.bin - name: FP16/driver-action-recognition-adas-0002-encoder.xml size: 136633 - sha256: c080cd783c7a59a62c35c6bbcb988b6013805297a7d85f7fe93597c0736d67e4 + sha384: 9d29d08b9ddf34b21d6c9e38a6985c6c8eebd6fd76f1529727ca7ffe14ec872461f071cd68a3fde9de55638ba291d330 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-encoder/FP16/driver-action-recognition-adas-0002-encoder.xml - name: FP16/driver-action-recognition-adas-0002-encoder.bin size: 5725388 - sha256: 165b34437d1c73bf5adf356ddc18fb6bb11b4d99d8db0921dd25894d886535ef + sha384: bdf5d4e5340ff0c4ea76ed3d9883d3c513fd89c3d975f74cc79cafb77599ea56543d5ec214afeb3b64b967c80bd4337f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-encoder/FP16/driver-action-recognition-adas-0002-encoder.bin - name: FP16-INT8/driver-action-recognition-adas-0002-encoder.xml size: 394179 - sha256: b413e3aab08524ddc4bb406aefaa8262d814d7c8683d26f4739fbbe22fb0504c + sha384: adef64bd51921e4c571048eb039ce692a3ecead945f5f5e80256b3a9045a0634c7314cf743ddcaa9bdad66ccf577a00b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-encoder/FP16-INT8/driver-action-recognition-adas-0002-encoder.xml - name: FP16-INT8/driver-action-recognition-adas-0002-encoder.bin size: 2960345 - sha256: 93e1a08c5f42cfdff8583455195d676e9b59debae810baef046f0df549b743f1 + sha384: bb05153ae864307801f47e8e917a3ec29daa99fd2122d7913bb8e01ef876f9f83347b29922c3a2eb5cff5e80c5932960 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/driver-action-recognition-adas-0002/driver-action-recognition-adas-0002-encoder/FP16-INT8/driver-action-recognition-adas-0002-encoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/emotions-recognition-retail-0003/model.yml b/models/intel/emotions-recognition-retail-0003/model.yml index 3dd4f285439..abd28d59ddb 100644 --- a/models/intel/emotions-recognition-retail-0003/model.yml +++ b/models/intel/emotions-recognition-retail-0003/model.yml @@ -18,27 +18,27 @@ task_type: object_attributes files: - name: FP32/emotions-recognition-retail-0003.xml size: 40242 - sha256: 399edfedb0a90e7d2b6c92440840488351bbfd323f4deef04a8dc293d764a2ba + sha384: 09292370295354e17507f4e718b235a626680c39ee6be525656e3874d58a5e22f1a7acee55929515e5b98fcf3f8c2e08 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/emotions-recognition-retail-0003/FP32/emotions-recognition-retail-0003.xml - name: FP32/emotions-recognition-retail-0003.bin size: 9930028 - sha256: bcb9b1a910fa3cd18a638bb1dbb0597c4ef7a080d1b83008c8e8c2c3c42b99dd + sha384: 56a7e92575a3f9fede0f18f9ebc6f1fe479a7b7f826b50917eb0bbfd484b3e65693be27f61e36e3459ffeff6a6a81d16 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/emotions-recognition-retail-0003/FP32/emotions-recognition-retail-0003.bin - name: FP16/emotions-recognition-retail-0003.xml size: 40225 - sha256: 30037d0b12a2dd7f4f447a58d811fc38b5e75ab0521a3c09cf7aa20f8a25a17a + sha384: af03286b3cd2faf978f7e69f65a9a4fe4004d517156c493334d3cf5e68be82d2a252c734b8f07d42f1a2c8a4c5358389 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/emotions-recognition-retail-0003/FP16/emotions-recognition-retail-0003.xml - name: FP16/emotions-recognition-retail-0003.bin size: 4965014 - sha256: e62fb4b819b3b3ad8aafcd308d4353db2f164a1a31d78de6cf5970837aeb6f7b + sha384: 1fda2fff394cc6be6901465c793c93133faff98b1cbccd3f86869202961c9988ecb92a2fb7cef5a1ef6dd275808b65fa source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/emotions-recognition-retail-0003/FP16/emotions-recognition-retail-0003.bin - name: FP16-INT8/emotions-recognition-retail-0003.xml size: 113682 - sha256: 6744cd0eb374d9a6f8e39a567ebc046073bdb35e6016bc1e9da03cea30757279 + sha384: a66c2bd579ba8fa1d7c0608eff6f1cd565baab794e847f15e23a4f5b72d2bc7cc36e9ff8c3559ee17469859be4be86a8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/emotions-recognition-retail-0003/FP16-INT8/emotions-recognition-retail-0003.xml - name: FP16-INT8/emotions-recognition-retail-0003.bin size: 2494126 - sha256: 9f791645e2ef576bf97a3ce4fb5b0acb8a0a96347d89b444fb059779f684a1c0 + sha384: 2cb63a32656e6af79b829e59142090fd47e4a9e6000fc2f6af2f3efdea372ffe2dbdbe54a044ec4adb66b52a806279c6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/emotions-recognition-retail-0003/FP16-INT8/emotions-recognition-retail-0003.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/face-detection-0200/model.yml b/models/intel/face-detection-0200/model.yml index 53c8070e80c..8189a30a141 100644 --- a/models/intel/face-detection-0200/model.yml +++ b/models/intel/face-detection-0200/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/face-detection-0200.xml size: 200411 - sha256: d2febaf2d9a7b12fe624af356e0d4e69721183b3d243b909c70490167b712869 + sha384: b1c92f28b68c3ca9d19dd5de0695c77707ae134cf4df7814e801a5b163d85fd31db636c63617a328e72f35fac22cbe80 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0200/FP32/face-detection-0200.xml - name: FP32/face-detection-0200.bin size: 7269168 - sha256: 7d95167a92652b22e11f5894c3a089d1559f18788ac93fb4aa4f292c33e8da22 + sha384: 1fdad850782a96eb0453114ec3cd7a4ec5df570d365a07bb85738a2ed1382382abed2e88139a921d1767746ad1b21e2e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0200/FP32/face-detection-0200.bin - name: FP16/face-detection-0200.xml size: 200348 - sha256: 9be21e3c2052c0c065ead53e1752b3758f3e115f905006672869c80dbfa28540 + sha384: a0bb49fed1d17ca37e28afe464805271b98e91b07056ac59df06c9084655ca092f641a45f635826ec4f8544f94ec34d6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0200/FP16/face-detection-0200.xml - name: FP16/face-detection-0200.bin size: 3634626 - sha256: 74faab1e2d7b7133ea1141d5004b1ebb2c1f0a4bfcbfff536750dca4ed29ef0a + sha384: 5022a82f68787a6199e7fbf36fd8b1930f7c3d418cbde818b65e38adad77db43154cad6157ae87ec408ac1f71db08d44 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0200/FP16/face-detection-0200.bin - name: FP16-INT8/face-detection-0200.xml size: 482487 - sha256: 6137d4d3a12c68aefebfe521bf68847c53e395d9e0e234aadac9bfb93834c85b + sha384: 9ab49d9e7f29ca562a8074563f62714085d627fcea9625e8a1deca1a70eb052939c99870bcc06e0ef32b8ef6504355b7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0200/FP16-INT8/face-detection-0200.xml - name: FP16-INT8/face-detection-0200.bin size: 1921614 - sha256: f5ebdefda7fe9efc2ed0192ed118b3f8281cc310298bb440ce9f6b697af9ced8 + sha384: b7f8469657e300265d068e551efb56a8bb762df94c3d0df14af0cdceff296f040325d037430a12326c2d5172e1d41d0f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0200/FP16-INT8/face-detection-0200.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/face-detection-0202/model.yml b/models/intel/face-detection-0202/model.yml index 57ea70f1398..5705d56bba6 100644 --- a/models/intel/face-detection-0202/model.yml +++ b/models/intel/face-detection-0202/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/face-detection-0202.xml size: 200594 - sha256: 0b07cabcedbf57d222f22d20d708b8849a8ee400d432582b4e704ce8e090920c + sha384: 4aa6a03972c4e0dec8c1db810b7d7e0fc9e305d2664d0763a9a800bbd4495b2bd5bb65681d7b44ab632b11369da7de34 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0202/FP32/face-detection-0202.xml - name: FP32/face-detection-0202.bin size: 7269168 - sha256: 9acf390e0a36dd6f579873f92d73064c0b1528a9b05280367152d8f7121a02db + sha384: 5c1ad0d39f76f7b3b0ca65619ffc09e673dda95f4c173cc62bf71f7d7b6fc9bbe32d5ab0297e7688ec830f9a1694d201 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0202/FP32/face-detection-0202.bin - name: FP16/face-detection-0202.xml size: 200531 - sha256: 398f818f0724dd19d8ebf66963c5ed75c690e6f13fa6fb7db42e7430b5698b7b + sha384: 3853adb33376ec74ea869dac16d2a63e16f3a8929b6e0df781607cbb07bb8f56a2a8929394e4ae0db243729e0cb24657 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0202/FP16/face-detection-0202.xml - name: FP16/face-detection-0202.bin size: 3634626 - sha256: d81b09ab3740b1ce820e371a3d8bba5807edd3338aa641c06791c264391ce893 + sha384: dd1b4361bceb05db54e4237227d0ebef5ec0add8965a9ca15e3f42391a1d0c8832dfa70d67708d4773d81db2e789a9a1 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0202/FP16/face-detection-0202.bin - name: FP16-INT8/face-detection-0202.xml size: 482719 - sha256: 12e023154900251e6d629fb15ecfa478c5348e7994b19ae45e39967676207f99 + sha384: ad953355f5762581c8fe44aa7d9abec364160df81bda67885b4d43d6a64d3fcf5cb788682909c36f462e92515b4f13ea source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0202/FP16-INT8/face-detection-0202.xml - name: FP16-INT8/face-detection-0202.bin size: 1921614 - sha256: e958794882e0df772b41d774190c9781951232dd05de980f1f75378fd1ebd1c7 + sha384: ea74f45a5b7baa2319a27f9f33548eeca7da8a87c672fc654775581d36ba983ae2dc843c0e5eeca79bfb654201b61ad7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0202/FP16-INT8/face-detection-0202.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/face-detection-0204/model.yml b/models/intel/face-detection-0204/model.yml index b4e129f98d3..b265e0ffe7b 100644 --- a/models/intel/face-detection-0204/model.yml +++ b/models/intel/face-detection-0204/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/face-detection-0204.xml size: 200681 - sha256: f47eead8dc5bc990c8581f2420a592f7d1ad749f6faf6d946ee0657ddaea6123 + sha384: 987937ef2c5a1bc1daadd8f933d4353e47de17f4df926d94c11048f3a3ded74c7fc3a38f09346ca6ce121b933f55c39e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0204/FP32/face-detection-0204.xml - name: FP32/face-detection-0204.bin size: 7269168 - sha256: a44f6042503cbd206bca55164820fa924330c963ff7eccc5d1ead59255d8a9f5 + sha384: 127b95a9b31b39bbd3b270b86317c2aec1658cfcdfbd2a4ddadb2aed97abfb3e43d10280a7f3f5323505ffa5c7b12b7c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0204/FP32/face-detection-0204.bin - name: FP16/face-detection-0204.xml size: 200618 - sha256: 44431a5ae31cff085a9765c26b3b7d718122bb75f17ee2b336a356786797c3b4 + sha384: ebf0bad4f1862c41c4bf895edd264308e354669bfc1e53f3b99a3242c3584e03373b0b3264957f4bf9d6edd76f8090e0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0204/FP16/face-detection-0204.xml - name: FP16/face-detection-0204.bin size: 3634626 - sha256: 62c9cf76281da1332ac5b27d2c96a4d2104d739a9d9a8eba7f6c78e8eb7036d6 + sha384: b64bc1c04bfdf6308128c6c351f0f884e55f65d9a88f920bce39c34010291f0664730cdfce378e4dd7680ae3aae9fe8f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0204/FP16/face-detection-0204.bin - name: FP16-INT8/face-detection-0204.xml size: 482845 - sha256: 4bab702cba3bc2e529e0fb15f8b062358bb0dd1432cdbefd254afb2a7e1ab067 + sha384: 44db0a902531320d5837b5d03c13e4fe241c79de5f993a659ef14a9584a427506eb6be326943f60ce3f5ed8e6e32fcb9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0204/FP16-INT8/face-detection-0204.xml - name: FP16-INT8/face-detection-0204.bin size: 1921614 - sha256: 9e1d94a0aa2b72a777bdbdba482f01e6d4567b4023d5d698bab5f7ede004ae49 + sha384: 4c6e712c5a64ca7740add8fb69b9f78508315d6ec6adfafc3e5db7e87d40bf1771c8e080128664ba48a609a7512bbf23 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0204/FP16-INT8/face-detection-0204.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/face-detection-0205/model.yml b/models/intel/face-detection-0205/model.yml index 078560372c9..be02467a14e 100644 --- a/models/intel/face-detection-0205/model.yml +++ b/models/intel/face-detection-0205/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/face-detection-0205.xml size: 1014512 - sha256: 0d25e68e2967f0160f2c5c908e83f87e13405262c8e5cd3d6168fadd9b1aae2e + sha384: d63e119e1f4c0ade7170a7a27d929edc85a19ba64dd5f33f8e4d73516e3fbef2b5ebe3c2934d29f4c022b4116ddd749d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0205/FP32/face-detection-0205.xml - name: FP32/face-detection-0205.bin size: 8049904 - sha256: 332424abdcf8756e89eef28121fa64c25b8be670d6fa9c0f5879f7884beea75c + sha384: 65b98ab457edc1d16c3771d37e51ea63071c7a6aaf90a34cda21dd3db0907842ca5d12863d1039fb739a4a395190c1e0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0205/FP32/face-detection-0205.bin - name: FP16/face-detection-0205.xml size: 1014350 - sha256: e4b06b39ec04a32f5a9e0b105aa5b70fd37d22a992bbe239f63cda4cb531edb1 + sha384: 36de1030a33297a599c22d909b773ab754cca1937cda81aa887fc613d1ad9c0ea3f574410183a654c06798fe273507b2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0205/FP16/face-detection-0205.xml - name: FP16/face-detection-0205.bin size: 4025142 - sha256: 5b4ed6212cf41a4d7520794f21ba899b5162a019680b26a60e0601cf5f7a479a + sha384: 835e238dc25f56db0edbc9a980385945aa42102834474ce4fa30c763773e994792ae8816b1099455d0589265ed79fb94 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0205/FP16/face-detection-0205.bin - name: FP16-INT8/face-detection-0205.xml size: 1587154 - sha256: 2f5e7865f385bd4c447a1bdd4f6ce6dca3afd70614df28b64c5c0dd696809e74 + sha384: 482286808ef08cdf6a2167f93d57626f835eec069a6a632bbadcb5a4b675dbe213e4a3f2c1943fb27b618e1fc657d80b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0205/FP16-INT8/face-detection-0205.xml - name: FP16-INT8/face-detection-0205.bin size: 2115162 - sha256: b55150afb856ae0408e91829723a8c07fc1a4fceb25cfacc9610c747cf5c9aef + sha384: ebc0f89e3002249a2c694d1651cc9e3f0b69cead44a084b44c114da304b0c16623305d69588a98be64a017d6ba218fe9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0205/FP16-INT8/face-detection-0205.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/face-detection-0206/model.yml b/models/intel/face-detection-0206/model.yml index 28afe8e832a..dc7b822d0af 100644 --- a/models/intel/face-detection-0206/model.yml +++ b/models/intel/face-detection-0206/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/face-detection-0206.xml size: 1594752 - sha256: 70db6188ed2e7dacea02d535029dc55489b0adc7c35d4cd1072348c0a9c04bcb + sha384: 83067775530c1267b42373f71ab35a3fd869914fa7caf6fb630cdb1114894dad6c24d01ee4b31888eec856871707a588 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0206/FP32/face-detection-0206.xml - name: FP32/face-detection-0206.bin size: 254925016 - sha256: 62582c1f0771246bf6c85a57ffaf9cfb70473424309c3aaff7bb7dc403a4745f + sha384: 81df9f2e3c3fd2d847493badc23cb14a4ac942117eb5cc7c75f40837596bec201d8c7e0f14b0e12e2f972995a7c25104 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0206/FP32/face-detection-0206.bin - name: FP16/face-detection-0206.xml size: 1594263 - sha256: 691ea2ceee7582aee6fedb4014a646b5d45b7e1b0bf641dd86372a4283f40eac + sha384: 9db10e1f0dd048015e4fe6f29d7ceb593c73bc6001e3caa5758ba2e2fcdb1fc82cd38c508faf00144cea000a91b146d8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0206/FP16/face-detection-0206.xml - name: FP16/face-detection-0206.bin size: 127462762 - sha256: 5d021e6b729975b30bc3c06030b8a8a1320c3dba73b4150272ec2b3c27a07efd + sha384: 1482a9a716ea59bc7e5012cb69fa2cc7816335824db3bc9c7fbabb4f1c83a2ded6cc949eddd082a434c54673b68a5c42 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0206/FP16/face-detection-0206.bin - name: FP16-INT8/face-detection-0206.xml size: 2686695 - sha256: 909f92cbbf498555fced44fe1610ebfa95de5ddb266492a7743808885bd180db + sha384: ad03805146bfa9be98f7e1ebd88c6620909fcb13ddca449f6d77171721b115cbe62cea4acd5e1defecac7487bd2d29cc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0206/FP16-INT8/face-detection-0206.xml - name: FP16-INT8/face-detection-0206.bin size: 64135662 - sha256: 4a6c6bc90cb07a5348dd378a0df7521ada14ad467b69929bda0fecdf692ded23 + sha384: 750bb017c98230319b1885ebeb93efe23875a71249cc070205066646699849ef9b38f3253159f828a65eed9f816c2842 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-0206/FP16-INT8/face-detection-0206.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/face-detection-adas-0001/model.yml b/models/intel/face-detection-adas-0001/model.yml index ec04b36458e..60415e3772d 100644 --- a/models/intel/face-detection-adas-0001/model.yml +++ b/models/intel/face-detection-adas-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/face-detection-adas-0001.xml size: 237086 - sha256: 42d6c02e5ef6249980f435edc708010f56e706d62c6a1cdec92bf650ae5f97ce + sha384: 92a8608d18260929ca070a6d27cb0b8c606e22d9b9baff002efad778ff7a65a5996679b6699fe88816d237003e6146bc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-adas-0001/FP32/face-detection-adas-0001.xml - name: FP32/face-detection-adas-0001.bin size: 4212072 - sha256: 811a332d80dc1891dc8254192e03de6a6de821af1cf0c1968f7632022d340524 + sha384: cfdfcc6163881b3b18dc1c4b5cbcbb4cf3f2f224502972fd8c409f13bb7c6c193bdd8c01fe8fcba92305e4e2c84e39c6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-adas-0001/FP32/face-detection-adas-0001.bin - name: FP16/face-detection-adas-0001.xml size: 237050 - sha256: 2978e39a69dc33b61e30c5090916625ea69c79adf2cdfeaae728e30d26471d30 + sha384: 417a5a690ddf1ced27dbec6e7005ff365ff5ad77f4c92511a17bee20ee9ffef737640e3c3ee267e4c5ab2344c09c8662 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-adas-0001/FP16/face-detection-adas-0001.xml - name: FP16/face-detection-adas-0001.bin size: 2106088 - sha256: df0f5799d801c6afb355d1c4771693c782efbb58d2eb2238982eac8fe84bc821 + sha384: e5948d9a9df622432eefcc41ed2fb59bf9fcb7067f17857030ae1a542ad7e8cab270e14ab808f943ea9cdb14c2cd8b47 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-adas-0001/FP16/face-detection-adas-0001.bin - name: FP16-INT8/face-detection-adas-0001.xml size: 510708 - sha256: 9e4b824b1005ae8d23738258423c5af690a5bf3da20f2c86c491afe053a0692a + sha384: 8f8adb032cf4063e9bfc273e3247a2efc4c0c0e62537338eeeccee7314c3e28e93da071172f842a73edcb47d8bfb6094 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-adas-0001/FP16-INT8/face-detection-adas-0001.xml - name: FP16-INT8/face-detection-adas-0001.bin size: 1100294 - sha256: c57e368e292d646a0152fbe9891c182b938cd54a75852e2bc7dd27c97ffdf884 + sha384: 4ca7ffd713eb41a6c2ec00f35546f0531becde569f00da8ffae322a686a6d7033210b24e8ae364fabc8476c601ed3dc2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-adas-0001/FP16-INT8/face-detection-adas-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/face-detection-retail-0004/model.yml b/models/intel/face-detection-retail-0004/model.yml index 74ce908fb40..06e03ce96ed 100644 --- a/models/intel/face-detection-retail-0004/model.yml +++ b/models/intel/face-detection-retail-0004/model.yml @@ -19,27 +19,27 @@ task_type: detection files: - name: FP32/face-detection-retail-0004.xml size: 106213 - sha256: 4bce3a0a9e69518ae93551e4c1d7d876e00b01d3c55fd3faf4eb4ca6911af6e6 + sha384: 587b43da22f343a0e8ad1b3d5c33b830634d5aabdeb65963348ea4cb8b0c7f631c396f00c4f0bb439df45b76d56761bd source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0004/FP32/face-detection-retail-0004.xml - name: FP32/face-detection-retail-0004.bin size: 2352984 - sha256: 89349ce12dd21c5263fb302cd3ffd4b73c35ea12ed98aff863d03a2cf3a32464 + sha384: a2b4fa6dc07a37fb70d3ff11c207e19c167d45b6db5392e7e759b924df8ce16dbcdb8edff682c38820cc2e54bf6fdabf source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0004/FP32/face-detection-retail-0004.bin - name: FP16/face-detection-retail-0004.xml size: 106171 - sha256: e6d81f157c2d290e79c820f0f47dd3aebead0f76af1c1633a2326a58732e50cb + sha384: 69ad248e0009c95390806353b51d6e38eac28b7c8b199894e35b9d0572444f01682c3023926ff26d9db5e7a253864cf6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0004/FP16/face-detection-retail-0004.xml - name: FP16/face-detection-retail-0004.bin size: 1176544 - sha256: ab7def342edab22e69ba1ef4e971983ea4e0f337c43b0a49c7ef3a7627f6cf1a + sha384: 6d5482c9b4dbdc2a418c8a410138a8f64421af5c10bc6a52ee5246a2aa4db20b9374f2d50926613179fcd0411ef1b997 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0004/FP16/face-detection-retail-0004.bin - name: FP16-INT8/face-detection-retail-0004.xml size: 240650 - sha256: ad2adcf27484caf55b76ed6d9026cfdeb7bb125f18a679ca8a8bcff756e5c94b + sha384: 2c0402ce952bdeed54de08d3e83ab378b9594779ec572df9865fc070ea8507baf3fb093d74686e800796468edcb037ff source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0004/FP16-INT8/face-detection-retail-0004.xml - name: FP16-INT8/face-detection-retail-0004.bin size: 600348 - sha256: e6ce3839bc8329725a593d607e9f0318b83bd4e680e3b0959a28b7e111ff9612 + sha384: 1d531929c56712651b5b9d5b1c746d610b40200202a6055705487ea64a7a09655f9b243b29486dc5d8088fde84919ac2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0004/FP16-INT8/face-detection-retail-0004.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/face-detection-retail-0005/model.yml b/models/intel/face-detection-retail-0005/model.yml index f5cb602242e..69929046b3b 100644 --- a/models/intel/face-detection-retail-0005/model.yml +++ b/models/intel/face-detection-retail-0005/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/face-detection-retail-0005.xml size: 170193 - sha256: 83daf2770c04f6a03cc338a9ed1fc9e6e729e221df93f28b0282713e104096ae + sha384: 1f8bee41bedba141fdc6a3f4f9baf411a62bfd43ad788182ecc6c9c0ad227822b32df4af64b31e665b3cc399902b9c36 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0005/FP32/face-detection-retail-0005.xml - name: FP32/face-detection-retail-0005.bin size: 4083112 - sha256: 27965fe54915256c9f0b134a89a846df07898492659d1751ad5a4a95f7486a14 + sha384: 3d5721ecb874fe0cad5f743d4619157652c998376bd8761acd59b603ab643e008e2d903ebc348eb011a63bdcf914eb81 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0005/FP32/face-detection-retail-0005.bin - name: FP16/face-detection-retail-0005.xml size: 170112 - sha256: 892927aeedf197ced8f92f2689bc589ad0c39f5a86dda95aebd65706932c2a80 + sha384: a54b36bc02f8038acf6b315acb5d4a1abaf8c5b43d9723c921ea3e94436d056a8d6f152618cc9d80ea0a2270cbfa069e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0005/FP16/face-detection-retail-0005.xml - name: FP16/face-detection-retail-0005.bin size: 2041598 - sha256: 48a974efac09b993eaae2316466dc616c419acec0e109d6ae8e0ac061f9214f0 + sha384: da282530f1e8a72352b14cb8dd04a38e3cc160f5f6962fb17856ab62f18951f5a65302355a913cb59e97f71e8070b022 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0005/FP16/face-detection-retail-0005.bin - name: FP16-INT8/face-detection-retail-0005.xml size: 434088 - sha256: abe71f112f8a0739f8c82916189b94ed8193578fa9006f200dffc4475e106a0a + sha384: 99f3278ce19b8aef23b27b3c2be928bef05a1675a13dd1d4822d8bb399d09c2514bf174b3d0da2111bc8158d00a3a990 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0005/FP16-INT8/face-detection-retail-0005.xml - name: FP16-INT8/face-detection-retail-0005.bin size: 1098786 - sha256: 4b8e9031a8503b272a7e7e1222f4ceb51beec18eba3eccca940a4857fed42f89 + sha384: c27e650835f6f7d65c4479de791e248522439ad8487c1335499de3867b34cda198dd3f3c62ae5a11cad004c5adc0d9a6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-detection-retail-0005/FP16-INT8/face-detection-retail-0005.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/face-reidentification-retail-0095/model.yml b/models/intel/face-reidentification-retail-0095/model.yml index fbdea3e0e94..a4f0fe8177c 100644 --- a/models/intel/face-reidentification-retail-0095/model.yml +++ b/models/intel/face-reidentification-retail-0095/model.yml @@ -18,27 +18,27 @@ task_type: face_recognition files: - name: FP32/face-reidentification-retail-0095.xml size: 239537 - sha256: b16f72d8f6db556fd417c0c823c4a031f8c47e48e7797163b3de49baa7c59542 + sha384: 5fb73d37f374df3a79f1cd97db5eac4defef7c6cbddfd43de75d06cc4b7a74f63625502219056f828b347a9ba8eb5029 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-reidentification-retail-0095/FP32/face-reidentification-retail-0095.xml - name: FP32/face-reidentification-retail-0095.bin size: 4427256 - sha256: 5ac2b046dd8644be5bf26677fbe3db955a0777a777ed6767c772d665f21d89b8 + sha384: b8ddd842ded8f4113e914beab115956ecf8d7970662804a89157437d8cec5a8f2adb11ed290dc914a7da5872312355d9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-reidentification-retail-0095/FP32/face-reidentification-retail-0095.bin - name: FP16/face-reidentification-retail-0095.xml size: 239433 - sha256: c9b6c7b8cdbd4fd0a5d9e031cefa1b7a2c899ba0d6305ca77b8838686f8949f0 + sha384: 3aca3d2b1b6eaba2918a826694cc9f32bafe9cb90f74b86a6ad3944e5a5fbdb2a18430bd3eeb2131e5c65c4034083e2a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-reidentification-retail-0095/FP16/face-reidentification-retail-0095.xml - name: FP16/face-reidentification-retail-0095.bin size: 2213724 - sha256: c2f8a7b9268e5b5236574d6fda2216df43c03acaa39c078848a98fbb707ae0a3 + sha384: 5f720826829ec5cea65c2eea89b5a72563c50ac640d28f0d50558799f698d0ce5e64b2d9b24223228178319e695b187f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-reidentification-retail-0095/FP16/face-reidentification-retail-0095.bin - name: FP16-INT8/face-reidentification-retail-0095.xml size: 658847 - sha256: 36f8fc6155a830e477f15a2d8e3ac5be981222902368b0343eb847eb8d317700 + sha384: e14af86f962fdef392ad06a9b93c6d80fa3d875b9526bc2c99702527e78518b463c546039c2f2f6ff73bcd740c704f04 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-reidentification-retail-0095/FP16-INT8/face-reidentification-retail-0095.xml - name: FP16-INT8/face-reidentification-retail-0095.bin size: 1180982 - sha256: fa491a056a5ff7e286e47ef14727dcb31ac23219d826fdf82fa6fc1de9c5aa61 + sha384: a30f1859e44ddd77b214fb1152014e2bbe90410475397453d04ba53f2ed7dd40401a715a8ff24b77b3e804728a50d437 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/face-reidentification-retail-0095/FP16-INT8/face-reidentification-retail-0095.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/facial-landmarks-35-adas-0002/model.yml b/models/intel/facial-landmarks-35-adas-0002/model.yml index bdbc0dd6424..90c681554ec 100644 --- a/models/intel/facial-landmarks-35-adas-0002/model.yml +++ b/models/intel/facial-landmarks-35-adas-0002/model.yml @@ -18,27 +18,27 @@ task_type: object_attributes files: - name: FP32/facial-landmarks-35-adas-0002.xml size: 253710 - sha256: 6be69c76fc4673a2d3d7599ef38a6229684fe26f4715d82d797aa3b243431d4b + sha384: 2623123fbf26e4674edcdf48d5c02408a227743c1e53b20739d227af3267c3de82755cfc22247ea9e7cf0c9dcaa5de65 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/facial-landmarks-35-adas-0002/FP32/facial-landmarks-35-adas-0002.xml - name: FP32/facial-landmarks-35-adas-0002.bin size: 18381152 - sha256: e1a325159eb1a0a7cd918d1a1d4cde250c2f6626737aa76597fb405e37af87c6 + sha384: e06715dd84385b0446815afb60cc4bc0dabbcef38deef7ff9cd932c1ca7c39f13d56edeec43ec35c74ca362157101d05 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/facial-landmarks-35-adas-0002/FP32/facial-landmarks-35-adas-0002.bin - name: FP16/facial-landmarks-35-adas-0002.xml size: 253573 - sha256: 413d0b81a4814e82a49b662b0833a92ce65affce7d6bed8e1e61ac3e79b63d67 + sha384: 6a830e86933ec0c2c6f4dad6f617f8ea1471a04aa8eb622c3059cc964c9f5ba17bb6e414ea5db53889ef849555167ffe source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/facial-landmarks-35-adas-0002/FP16/facial-landmarks-35-adas-0002.xml - name: FP16/facial-landmarks-35-adas-0002.bin size: 9190584 - sha256: 69952f73ba3239f8692ee41514ceff793a014e2a7a777faa570f0a8aaf17278d + sha384: 4cca57a4f6ccf8d3b2a7eb6f20ddb14848c21a7e1a264ccae5f17720d29aed3445c8752d00e9bd9a8d8b27979e010727 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/facial-landmarks-35-adas-0002/FP16/facial-landmarks-35-adas-0002.bin - name: FP16-INT8/facial-landmarks-35-adas-0002.xml size: 628613 - sha256: 295e7354466f4112bcbdbbc8d9f0877284952f9083d67b40cc091806514b5999 + sha384: 12f52a898c0c7614c37205fc67186b8831704945ae28c00174545e42f94048725df2f7cd0c263f92929c869ad89443d7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/facial-landmarks-35-adas-0002/FP16-INT8/facial-landmarks-35-adas-0002.xml - name: FP16-INT8/facial-landmarks-35-adas-0002.bin size: 4634172 - sha256: 120d023cec6028aefdf0fd07213ba3cdccc863605546b3ff70f38a5a8ad8b1e2 + sha384: 8a8e5e1c97fbeaa4bb635ca549ce82491e1780e5ce92c55762e630f72b816535d5e5ef0139c453da9aa32fdb5881eebc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/facial-landmarks-35-adas-0002/FP16-INT8/facial-landmarks-35-adas-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/facial-landmarks-98-detection-0001/README.md b/models/intel/facial-landmarks-98-detection-0001/README.md new file mode 100644 index 00000000000..112a6a2af6f --- /dev/null +++ b/models/intel/facial-landmarks-98-detection-0001/README.md @@ -0,0 +1,42 @@ +# facial-landmarks-98-detection-0001 + +## Use Case and High-Level Description + +This is a 2D facial landmarks detection network based on the HRNet approach. +For face in an image, the network detects landmarks (look at image below). +The landmarks contain 98 keypoints. + +## Dataset (training and validation) - Internal + +Network is trained and validated on the custom dataset based on WiderFace and VGG2 subsets. + +## Example + +![](./assets/facial-landmarks-98-detection-0001_1.jpg) + +## Specification + +| Metric | Value | +|---------------------------------|-------------------------------------------| +| NME | 0.1323 | +| GFlops | 0.6 | +| MParams | 9.66 | +| Source framework | PyTorch\* | + + +## Inputs + +Name: `input.1`, shape: `1, 3, 64, 64`. An input image in the `B, C, H, W` format, where: + +- `B` - batch size +- `C` - number of channels +- `H` - image height +- `W` - image width +Expected color order is `BGR`. + +## Outputs + +The net outputs a blob `3851` with the shape: `1, 98, 16, 16`, containing location heatmaps for 98 keypoints. Locations that are filtered out by non-maximum suppression algorithm have negated values assigned to them. + +## Legal Information +[*] Other names and brands may be claimed as the property of others. diff --git a/models/intel/facial-landmarks-98-detection-0001/accuracy-check.yml b/models/intel/facial-landmarks-98-detection-0001/accuracy-check.yml new file mode 100644 index 00000000000..e9a7f25e0e1 --- /dev/null +++ b/models/intel/facial-landmarks-98-detection-0001/accuracy-check.yml @@ -0,0 +1,26 @@ +models: + - name: facial-landmarks-98-detection-0001 + + launchers: + - framework: dlsdk + adapter: + type: facial_landmarks_detection + output_blob: 3851 + + datasets: + - name: facial_landmarks_98_db + + preprocessing: + + - type: crop_rect + - type: resize + dst_width: 64 + dst_height: 64 + interpolation: LINEAR + + postprocessing: + - type: heatmap2keypoints + + metrics: + - type: nme + only_2d: True diff --git a/models/intel/facial-landmarks-98-detection-0001/assets/facial-landmarks-98-detection-0001_1.jpg b/models/intel/facial-landmarks-98-detection-0001/assets/facial-landmarks-98-detection-0001_1.jpg new file mode 100644 index 00000000000..581722566ee Binary files /dev/null and b/models/intel/facial-landmarks-98-detection-0001/assets/facial-landmarks-98-detection-0001_1.jpg differ diff --git a/models/intel/faster-rcnn-resnet101-coco-sparse-60-0001/model.yml b/models/intel/faster-rcnn-resnet101-coco-sparse-60-0001/model.yml index 929ca084bde..2f051196309 100644 --- a/models/intel/faster-rcnn-resnet101-coco-sparse-60-0001/model.yml +++ b/models/intel/faster-rcnn-resnet101-coco-sparse-60-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/faster-rcnn-resnet101-coco-sparse-60-0001.xml size: 351050 - sha256: 2142acf4336793fb11e496e6ba4de4f47d8ca0b76235b5b23d9623b28654aa7a + sha384: fa224f29e51134564aab1cb4124db054540efcfba0bcfb4aee5b9aab0534233a893c629a81d1c3bb83d1c4edd0e3ee32 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/faster-rcnn-resnet101-coco-sparse-60-0001/FP32/faster-rcnn-resnet101-coco-sparse-60-0001.xml - name: FP32/faster-rcnn-resnet101-coco-sparse-60-0001.bin size: 211169988 - sha256: 994444cacb3104100160ce246af687cb6aee84b58d43c24a364f39f006e4a5ef + sha384: 521b2177e450f204994bb655d454bb9b4dd619080fe6bb3b9207d81443c78a9f2bee613d4ff2811eb18c8eb3be6a5f58 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/faster-rcnn-resnet101-coco-sparse-60-0001/FP32/faster-rcnn-resnet101-coco-sparse-60-0001.bin - name: FP16/faster-rcnn-resnet101-coco-sparse-60-0001.xml size: 350890 - sha256: 1f40714dff2608d8b0f15a190ec6e9249a75e2e3bce1108af8260d5c3e6992a3 + sha384: 6e3fe4ae275ffaeb06b05f27c0906b352dcc5adf3cf7704187d7f1206581245b26dce3a18154f2f0ff85f9aa7864c138 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/faster-rcnn-resnet101-coco-sparse-60-0001/FP16/faster-rcnn-resnet101-coco-sparse-60-0001.xml - name: FP16/faster-rcnn-resnet101-coco-sparse-60-0001.bin size: 105585134 - sha256: 6bf9dd1b2a7ac9df8b34498904ab877ffaf75cb5ea70e60b61afde72b4e4b5f2 + sha384: ffe322db6d6b094a0d35d1a2b5e1bb702cbf9c7e10bd5db972181031637508283b8e2517883810599d18efd5f648a73e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/faster-rcnn-resnet101-coco-sparse-60-0001/FP16/faster-rcnn-resnet101-coco-sparse-60-0001.bin - name: FP16-INT8/faster-rcnn-resnet101-coco-sparse-60-0001.xml size: 871790 - sha256: a3581c60164dad1736393f31c821ff6284afa42e466255fef88516344d092eea + sha384: 475c8b9827e0372c552f3097e623cd5bcc566d32a44749e276d5f5685986989d93f0f600220d2d53caa8dc7a14564049 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/faster-rcnn-resnet101-coco-sparse-60-0001/FP16-INT8/faster-rcnn-resnet101-coco-sparse-60-0001.xml - name: FP16-INT8/faster-rcnn-resnet101-coco-sparse-60-0001.bin size: 54722851 - sha256: 54dd7df1f8728c21b45436cb45c7790fa0f703e3ec145e6e6423a9283487fcd9 + sha384: b03d8f11bc52c87ed33ee41dc1adf20c9629ee9ee5fc4fe6a53176842092d9496f6fdab85dfb3087d6998a68a3b17113 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/faster-rcnn-resnet101-coco-sparse-60-0001/FP16-INT8/faster-rcnn-resnet101-coco-sparse-60-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-decoder/model.yml b/models/intel/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-decoder/model.yml index d193b91dd15..e4702005d04 100644 --- a/models/intel/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-decoder/model.yml +++ b/models/intel/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-decoder/model.yml @@ -18,19 +18,19 @@ task_type: token_recognition files: - name: FP32/formula-recognition-medium-scan-0001-im2latex-decoder.xml size: 52273 - sha256: f499cb1bcce8a7620c1259326332f2f961c759b642896144905426c4e20fa381 + sha384: c85fe0474e982d407c5272e1ac3be660210e6b873fc7c35aacd8a600d107d523b29c5a9cbeb543f2d15c1b8554f2c77a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-decoder/FP32/formula-recognition-medium-scan-0001-im2latex-decoder.xml - name: FP32/formula-recognition-medium-scan-0001-im2latex-decoder.bin size: 10252352 - sha256: 47313e32aacd678ebddb01fc288e67159bad2996fa92f53fd4711bc6564defcb + sha384: 175b85d7a3b59085d64d7c0212450a51506baad1b3e9dc71dd873b1ea419e88fc4936c9b3440a4fa7b2c671ed867ea8b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-decoder/FP32/formula-recognition-medium-scan-0001-im2latex-decoder.bin - name: FP16/formula-recognition-medium-scan-0001-im2latex-decoder.xml size: 52265 - sha256: 32c20c8e1d9e712a0964de6538156eace7474f76d3014daa14e9ffa6629ffac6 + sha384: c88c163d52942c041c9b3ff6296a9c0b0f480a52fd34fcddce5e731fde2552b6a9b3da218f565987bec6a8ecce1021be source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-decoder/FP16/formula-recognition-medium-scan-0001-im2latex-decoder.xml - name: FP16/formula-recognition-medium-scan-0001-im2latex-decoder.bin size: 5126230 - sha256: 85c96b6cf2bbfaa79fc505717070e15236386d3aacc868ce044e3139eb2421ba + sha384: 2dc1387f2418b4319150e7bdc73295f20eaa07639fe6a333fc3c1a918809bdec014ac024ca38cd5ce94c7840dd4677f9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-decoder/FP16/formula-recognition-medium-scan-0001-im2latex-decoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-encoder/model.yml b/models/intel/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-encoder/model.yml index e840b43d27a..24d98a49c7c 100644 --- a/models/intel/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-encoder/model.yml +++ b/models/intel/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-encoder/model.yml @@ -18,19 +18,19 @@ task_type: feature_extraction files: - name: FP32/formula-recognition-medium-scan-0001-im2latex-encoder.xml size: 146030 - sha256: 142e4e744fb586cab40cf59d2c67cfaef857d2b0944e92ed56ddf2295b11c3ed + sha384: f42e07b17dc5f3534a70d5f9de2955a2511555c2224022e22aeb7b377de7f23b3cb23f74077bc38496ab1f9f7e1dd01f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-encoder/FP32/formula-recognition-medium-scan-0001-im2latex-encoder.xml - name: FP32/formula-recognition-medium-scan-0001-im2latex-encoder.bin size: 12977368 - sha256: 97df8c47fa7bda4909866827c07459c11caea8c6e3e5b6367fa592bd7cdc3683 + sha384: 61dbff7af6f4f2d8531b6b9ff3e73de42d0ee3d1dca9720d4f6f7be250a91a5b558c51651bfedd21c620f8b494a56b89 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-encoder/FP32/formula-recognition-medium-scan-0001-im2latex-encoder.bin - name: FP16/formula-recognition-medium-scan-0001-im2latex-encoder.xml size: 145988 - sha256: efe5047b8af24186843dfb738b8e5a010d4571f2e5fd77c0170d00b7ef2b0462 + sha384: 7023c8ac8635a330667a41a951cdf918f7b3c9810ce9b3a470659d9c4351e21a1b8dd5d02d4df0f350759aa22dce359f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-encoder/FP16/formula-recognition-medium-scan-0001-im2latex-encoder.xml - name: FP16/formula-recognition-medium-scan-0001-im2latex-encoder.bin size: 6488792 - sha256: 2eea086c738f5b18d85f7823cbc004b2218161308db1b4f1a39223345d30cca3 + sha384: d50979f19c6d08158262feb9cdf5cf9f4998b76024539bb9d38c4dc56e78ec1ad468441539df924f5865cd198dd9c97c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-medium-scan-0001/formula-recognition-medium-scan-0001-im2latex-encoder/FP16/formula-recognition-medium-scan-0001-im2latex-encoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-decoder/model.yml b/models/intel/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-decoder/model.yml index a354612b755..8ea269353c6 100644 --- a/models/intel/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-decoder/model.yml +++ b/models/intel/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-decoder/model.yml @@ -18,19 +18,19 @@ task_type: token_recognition files: - name: FP32/formula-recognition-polynomials-handwritten-0001-decoder.xml size: 52326 - sha256: b79dd2f822565fe851519e4de72e1f5cb8c092a4e3cac46363504c3515f12f73 + sha384: d6e022c6da5e904909a5d90e837c8146097e0a5dfaad538e1946c3302b7dedd0ee3f641ec4c6bc0cf0e48b4c5a86fa54 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-decoder/FP32/formula-recognition-polynomials-handwritten-0001-decoder.xml - name: FP32/formula-recognition-polynomials-handwritten-0001-decoder.bin size: 10179560 - sha256: 5bd55bf08eaee8ef5a6d516b4a7af05a49df26bc9c5f020e9c80533d90a7ca10 + sha384: 46d3bf27ea023ebfdfe0a72203cd44a7dd309f61be102b432f5a6cca8ec2a3d66dc2475798ccb594a5f1575ef6cbf637 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-decoder/FP32/formula-recognition-polynomials-handwritten-0001-decoder.bin - name: FP16/formula-recognition-polynomials-handwritten-0001-decoder.xml size: 52317 - sha256: ea2baaefe16a37a66bc2031951b7a4d22d2c5c59ed5b005ccfa9fd171ebb542c + sha384: 9f0b86226cd4c6a96a907f7286b0e7573a59a36c72a4206bea8cc4933c8e17aaa17f98594ee55b960a86384c80cf1b4c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-decoder/FP16/formula-recognition-polynomials-handwritten-0001-decoder.xml - name: FP16/formula-recognition-polynomials-handwritten-0001-decoder.bin size: 5089834 - sha256: 681683c50d62291ee1a4d50200a8462dbb00f1ea927ff43276b4b3249016df39 + sha384: 187b5050f693a025aa79e744932b9c195ebedd213e7f3373db08fac15f496d7d2c5a62b7cbc594303e9c43eb3c4ab4bb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-decoder/FP16/formula-recognition-polynomials-handwritten-0001-decoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-encoder/model.yml b/models/intel/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-encoder/model.yml index 7fefcb38a1b..0d8cbaf979b 100644 --- a/models/intel/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-encoder/model.yml +++ b/models/intel/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-encoder/model.yml @@ -18,19 +18,19 @@ task_type: feature_extraction files: - name: FP32/formula-recognition-polynomials-handwritten-0001-encoder.xml size: 197976 - sha256: 0f994c1c1dd3ba2dc75a387427011c44e852e7623da2d4172b30f7721c7af0d2 + sha384: 94f1499996ab33bd57e571dc7c6d6666a59e073cb7ff9051a7892e0b85545d6c4e412bb3952ae4291ce860ba229e530a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-encoder/FP32/formula-recognition-polynomials-handwritten-0001-encoder.xml - name: FP32/formula-recognition-polynomials-handwritten-0001-encoder.bin size: 45208792 - sha256: 38084c37f20825be26ca444edd4f2181ea2089678f7c60c079871394c2d44d79 + sha384: fb2d2067fcfb778908551e440191b89270f137d68d81e55f3ddfbb20283cccf0275d58e4314af910abdef8c9b0908e1d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-encoder/FP32/formula-recognition-polynomials-handwritten-0001-encoder.bin - name: FP16/formula-recognition-polynomials-handwritten-0001-encoder.xml size: 197933 - sha256: d68ed2dfe1626bfa3a0f50add3a8a32709a42dede15cc1acf0fd841c6579c8d9 + sha384: 0bb41c3b1b5ce80c3413621a16a666fbe48f391cbe1a5d0a5e8792689cbe103b1eb1293f92f9cadc26872a01be7c18dc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-encoder/FP16/formula-recognition-polynomials-handwritten-0001-encoder.xml - name: FP16/formula-recognition-polynomials-handwritten-0001-encoder.bin size: 22604504 - sha256: 45b91bf30c2e9e6739dc4d493edc5c6f12d96173bf292e7426aabb6717b3dc67 + sha384: a5b085127825f92f9eea55d58b94f89f76b613138c96ac26c2f661970a1e1703a13ac5941dca6ca981f6961e19015293 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/formula-recognition-polynomials-handwritten-0001/formula-recognition-polynomials-handwritten-0001-encoder/FP16/formula-recognition-polynomials-handwritten-0001-encoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/gaze-estimation-adas-0002/model.yml b/models/intel/gaze-estimation-adas-0002/model.yml index 95de8b2eed2..9772a6dc77c 100644 --- a/models/intel/gaze-estimation-adas-0002/model.yml +++ b/models/intel/gaze-estimation-adas-0002/model.yml @@ -18,27 +18,27 @@ task_type: object_attributes files: - name: FP32/gaze-estimation-adas-0002.xml size: 75302 - sha256: 75cc9b909f00f567c16c0c76d89f5334ba6961e07c6e24774ebbcf9f96c88ebf + sha384: baea08beb304fa7ca5d6ffb58ec0128ec270fdd4de50502c668f030b147dcec21167998419321e03fdf4f69ca8b4caf2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/gaze-estimation-adas-0002/FP32/gaze-estimation-adas-0002.xml - name: FP32/gaze-estimation-adas-0002.bin size: 7529480 - sha256: f9811838cc264443a845b8d5089d3cfeb2d354b832f52a96aa0ccfa5be8e8401 + sha384: 377c30aeb2b86a07dc316691f2e730015cd553c012856e1aa898fe5605d62ef96341d3db8bf9c26c51fb67ecc6ed73b2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/gaze-estimation-adas-0002/FP32/gaze-estimation-adas-0002.bin - name: FP16/gaze-estimation-adas-0002.xml size: 75261 - sha256: 86bd200d185434761b7b6c8db0cb94b1bd00b9321f10efc3ae1a31d5eb4a20fd + sha384: d8c4a20143dea665e57d0e70a6856c18cb040094f99ca61ef7c020e479d6d8f203a3e0337b12fe5e2b86c9082889f94c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/gaze-estimation-adas-0002/FP16/gaze-estimation-adas-0002.xml - name: FP16/gaze-estimation-adas-0002.bin size: 3764842 - sha256: 4aea144ee55e1c26ff81ffd006be71e581d869e76e38364fdc10c3e0d3848154 + sha384: ebc47d52fc4db9ef59e5f076776ac2660fd95d0df0c4a82babdb482a1b477892aa4916115f25474c6c88ee8785a93d3f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/gaze-estimation-adas-0002/FP16/gaze-estimation-adas-0002.bin - name: FP16-INT8/gaze-estimation-adas-0002.xml size: 147906 - sha256: 2035f0f43c13b43b3a6b0de806df1bc25bd6041dd418848a1db0118bfd188d17 + sha384: 0769733d2ddca497f62e8fd18c9276d22723826c4c6b9b18bb030552e8e7633b0f47fb99de839b6c473b071e245a5865 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/gaze-estimation-adas-0002/FP16-INT8/gaze-estimation-adas-0002.xml - name: FP16-INT8/gaze-estimation-adas-0002.bin size: 1893394 - sha256: b4632693b76e06b078c10aa0aa1d0bfa5e4fa9c253c1a4a47ead32ebf17a673b + sha384: 32be63595a71ac0383ad08c3d7a5ebc23954276ea9ebcc50d909b85d18816d5c6091db4095d874400ae08799bfa5322e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/gaze-estimation-adas-0002/FP16-INT8/gaze-estimation-adas-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/handwritten-japanese-recognition-0001/model.yml b/models/intel/handwritten-japanese-recognition-0001/model.yml index 4fd7445d21b..525936b71ad 100644 --- a/models/intel/handwritten-japanese-recognition-0001/model.yml +++ b/models/intel/handwritten-japanese-recognition-0001/model.yml @@ -18,27 +18,27 @@ task_type: optical_character_recognition files: - name: FP32/handwritten-japanese-recognition-0001.xml size: 44343 - sha256: 49e25496985dd3a69346ccf03f9781f4abc8b17f74712fda803428f96dbb497d + sha384: 7431457aff6affc7558428298c037c4ee1b447743fa85c1cb8b814ce457dacf943b6fea1b2b1cabcac2c8aefe42e3e2d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-japanese-recognition-0001/FP32/handwritten-japanese-recognition-0001.xml - name: FP32/handwritten-japanese-recognition-0001.bin size: 67969208 - sha256: be6f7eea5945af691277a1f3849f024ed6d3bb84c395bc66ed8e9da0346c063d + sha384: 7faad7843dd1cc25a589d2cbec6b73292e1dc2b796d7d3f5e6a404a334b7a7a542370660481e912c335d1a9cce634016 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-japanese-recognition-0001/FP32/handwritten-japanese-recognition-0001.bin - name: FP16/handwritten-japanese-recognition-0001.xml size: 44331 - sha256: fdeb794bdb50db7fd6faa06e94f6513c49719ffa0bace97c0329b6ab139e4e5d + sha384: d579903e5e94d9bd1cf6c6a88839fff107882f3afc0b710c0a2f4a095eea2c0d01d51a30ee0ff0408bae378702b0984e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-japanese-recognition-0001/FP16/handwritten-japanese-recognition-0001.xml - name: FP16/handwritten-japanese-recognition-0001.bin size: 33984640 - sha256: c98a73664e3e71151cad86bfb2dc434b3c2e6c6517716268d97ea0e9a3969e89 + sha384: ee27c871cd38c9c6b2b1a5858b4fcc9083ba8d0eea2ffb35e8542c6d26a9c269e8dbbbf97491adbac3bb2f5dbac3e522 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-japanese-recognition-0001/FP16/handwritten-japanese-recognition-0001.bin - name: FP16-INT8/handwritten-japanese-recognition-0001.xml size: 102268 - sha256: ff9365397dd36f970485409ceb79f12cca14012d48fd1aac8d69e2b0c8ed324a + sha384: 0e617bf3a2893396ff50e21aa8c8dca998c111508af680d528c87a8fbe37e15599da51df2ce24deaa74fa48a4f8ea1fb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-japanese-recognition-0001/FP16-INT8/handwritten-japanese-recognition-0001.xml - name: FP16-INT8/handwritten-japanese-recognition-0001.bin size: 17012014 - sha256: 7cbff0a98cf98927c834b802ecc36927dffb0ef56c7517c7f10566cfc01f8850 + sha384: 76ea9ed13eab6a704fdc15f258aa19326adb59c143d45271dca385f197d4261f6aaab8ac64a8fa52770ad3abd00fa971 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-japanese-recognition-0001/FP16-INT8/handwritten-japanese-recognition-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/handwritten-score-recognition-0003/model.yml b/models/intel/handwritten-score-recognition-0003/model.yml index b972784b139..e070328f76a 100644 --- a/models/intel/handwritten-score-recognition-0003/model.yml +++ b/models/intel/handwritten-score-recognition-0003/model.yml @@ -19,27 +19,27 @@ task_type: optical_character_recognition files: - name: FP32/handwritten-score-recognition-0003.xml size: 92625 - sha256: 2afad467be0e879c6cbe758a528cb75ea1ef86002ec2c76a9b432fdbc33d0f56 + sha384: 7a589299fcc92b4fd81136b2736f7b21797d28baebc80e2b196ef2a55c91cdb97a2135877f42548ffb1d7b860c6e4950 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-score-recognition-0003/FP32/handwritten-score-recognition-0003.xml - name: FP32/handwritten-score-recognition-0003.bin size: 41121956 - sha256: 1b84a3813c1ebaa0206fa6d4cce1c4737e961c316dfabe53ea707adc06e16041 + sha384: 1e1d50337a76ce7e5e0b535250ee51e4cce4151461e6dac71276972d6b5e3e5e14e88fb397f77bc070830cd5ccb710e7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-score-recognition-0003/FP32/handwritten-score-recognition-0003.bin - name: FP16/handwritten-score-recognition-0003.xml size: 92600 - sha256: a33705efd7f9b1782f6f192d6a030709c951f3f3c7556463b5e172cd9fc0804d + sha384: 862cf6873379e4a3f28bac4e48523635fe8c51ed4e74770eb03613cae68f6f55f2f4a6f07add5329622a960b4d2f10ed source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-score-recognition-0003/FP16/handwritten-score-recognition-0003.xml - name: FP16/handwritten-score-recognition-0003.bin size: 20561030 - sha256: a4b2a79942819d9031f8027a7e55484b83d1c5bcb95be681a8359c8eed866606 + sha384: ef63427055bcbe34bd616df0fa5fe133bc2690e0188103e3cee39ceda820e1ecc06c68e86637ecc8a971004613164fd7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-score-recognition-0003/FP16/handwritten-score-recognition-0003.bin - name: FP16-INT8/handwritten-score-recognition-0003.xml size: 128496 - sha256: 14c8b1775cfa9882ef0fb563c0f4aafac9889c55d73a940953680ef1a0b50a65 + sha384: f773af0aa8970422ef99e28b7238c6fe41b76a769a8a91152b2cfa95e3d2d542ace77be5e512a663fcd0ae0dd970b35c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-score-recognition-0003/FP16-INT8/handwritten-score-recognition-0003.xml - name: FP16-INT8/handwritten-score-recognition-0003.bin size: 15030168 - sha256: 90c174517db85188bc102dba04724fb69453adc640caa5e48493cc8800a7710a + sha384: 67e965d52290e15dedda40265493a09ef3d3d44e0ca3d1dfdf1321c231a2687db0036400e56e05e7ada609fcbf49f329 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-score-recognition-0003/FP16-INT8/handwritten-score-recognition-0003.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/handwritten-simplified-chinese-recognition-0001/model.yml b/models/intel/handwritten-simplified-chinese-recognition-0001/model.yml index 36b930ae7c8..7d1d6220e62 100644 --- a/models/intel/handwritten-simplified-chinese-recognition-0001/model.yml +++ b/models/intel/handwritten-simplified-chinese-recognition-0001/model.yml @@ -19,27 +19,27 @@ task_type: optical_character_recognition files: - name: FP32/handwritten-simplified-chinese-recognition-0001.xml size: 119599 - sha256: f3c319732e68d8ee6963081c05abbacfae10f3da4140f7429026351830b9c270 + sha384: 7a2361a9987fbe314a9b89b68243f707a94d96834a137f2c03260501af8aa7dbd9e0e5bbbd3e93505c3cdf4f40877e80 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-simplified-chinese-recognition-0001/FP32/handwritten-simplified-chinese-recognition-0001.xml - name: FP32/handwritten-simplified-chinese-recognition-0001.bin size: 69071580 - sha256: 373eefe1b612ba55d52498cc3c6bd1c90f7c32e082ced0e540056a6b7382a22c + sha384: 45c6e0ecc24730069e423402791f71b83f0e9d3d71bc58a6d8a8a2811d1e034a927fc10dd0de0bcb77c81c1af6a88726 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-simplified-chinese-recognition-0001/FP32/handwritten-simplified-chinese-recognition-0001.bin - name: FP16/handwritten-simplified-chinese-recognition-0001.xml size: 119523 - sha256: 920bf17c55bce05c154bb2f732855cbd23c6f4bf387a5c253a5efd4373fb86d3 + sha384: ebd52fc51fd94df9ea927e8dd5120392e7ef09da158754cb4e3179ced187d2cfa1f0d5cebc64aa2ddaf98e0ae0cad4b6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-simplified-chinese-recognition-0001/FP16/handwritten-simplified-chinese-recognition-0001.xml - name: FP16/handwritten-simplified-chinese-recognition-0001.bin size: 34535842 - sha256: 1bb5768c4f50502a5d76e039b04081589e36336d9f66255b17da6de3f64d67c8 + sha384: b572b3097d4fcb172660527d314973a17b4e1fa8176dbcb25e82706363ba3e6f03a7cfc85891a1ca3afbae56594a1da8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-simplified-chinese-recognition-0001/FP16/handwritten-simplified-chinese-recognition-0001.bin - name: FP16-INT8/handwritten-simplified-chinese-recognition-0001.xml size: 240459 - sha256: 4eff9324aed31e83cfcdb3c41e6a1ec2c7272574470289cde82ba35f4b26e0b4 + sha384: 5d9409003a20badb3152b6644c10dd0cb29e7969e1e5fc32a2d7b45b796d0737ceb7ed8f85d6039d182c5a13fad98b77 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-simplified-chinese-recognition-0001/FP16-INT8/handwritten-simplified-chinese-recognition-0001.xml - name: FP16-INT8/handwritten-simplified-chinese-recognition-0001.bin size: 17320954 - sha256: b81c9c33f0336f7a2469152202d8201edc6aaad1d4ba44d1e80209c46c6450cb + sha384: 91444adddff42c68d10aff669202f0072131df34500a1e4d33159de43de5ef9bdc9edf13a9dc81ce80c31906fa59fe2f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/handwritten-simplified-chinese-recognition-0001/FP16-INT8/handwritten-simplified-chinese-recognition-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/head-pose-estimation-adas-0001/model.yml b/models/intel/head-pose-estimation-adas-0001/model.yml index 76ad39a1a14..4aed7c303f7 100644 --- a/models/intel/head-pose-estimation-adas-0001/model.yml +++ b/models/intel/head-pose-estimation-adas-0001/model.yml @@ -18,27 +18,27 @@ task_type: head_pose_estimation files: - name: FP32/head-pose-estimation-adas-0001.xml size: 53353 - sha256: dbe9eae034a14e12bc3aa40f819e11318063b517e21525794977d4c24f5fe76d + sha384: 9a8214bc938fe964306b5b9c106de7dde3bab2752edab58eb35d4725ac8c8059c49221e673a27d7c080c0b115ae24247 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/head-pose-estimation-adas-0001/FP32/head-pose-estimation-adas-0001.xml - name: FP32/head-pose-estimation-adas-0001.bin size: 7647604 - sha256: e3b16435e7c23297c3365ca8e5ad0e11ae5b0e16ec74372ed4bd93c53c40a8fd + sha384: 26899d66b5c594d1f10d18b3e454462d5cd2d80d2addb9199fc81c5383d75fc0419d0d4045bc1404457245886c5dc90f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/head-pose-estimation-adas-0001/FP32/head-pose-estimation-adas-0001.bin - name: FP16/head-pose-estimation-adas-0001.xml size: 53344 - sha256: 07292d4b0c53f52fa9b23a9999b727fb4b09caa4196aa480f472e7f3af929a98 + sha384: ca7d81259b071d0eca12be8c235e9943ea16d60a1756ff5994dd464391a0cd1d7a8c39fb23bedb4c0faa7a56f796a9d8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/head-pose-estimation-adas-0001/FP16/head-pose-estimation-adas-0001.xml - name: FP16/head-pose-estimation-adas-0001.bin size: 3823810 - sha256: 848fa24e72bcb5a058a36ef74c816b3a1b99fe08d35b450be388b0f1808dbecf + sha384: 99ff8940eef5c1b1423c0ff6f50e8666072ccb71ba5737f908dc9b572535c0aebdaae714e07bb619a2ee9e5651d19ecc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/head-pose-estimation-adas-0001/FP16/head-pose-estimation-adas-0001.bin - name: FP16-INT8/head-pose-estimation-adas-0001.xml size: 89782 - sha256: 0c29b6d81359613d8390961153e06587605eae86bb6f2d829f7c722a62319f47 + sha384: d529730c242e3f08e6f8dca9eecaefe65088b96a992b0d68ce9d07754fd182b6f99034b43289f21663ce3c11b4af4197 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/head-pose-estimation-adas-0001/FP16-INT8/head-pose-estimation-adas-0001.xml - name: FP16-INT8/head-pose-estimation-adas-0001.bin size: 2074366 - sha256: 8010aaf43ef92702ca5e5441aea9a51521e438776aa18df55f719b60e9be0026 + sha384: 73ff9374b63fce5d62c8417dd58489a481d814a700da5ce12fac968c79dd8a7f7f5448c1bece2acb2afd94d50e49eaa8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/head-pose-estimation-adas-0001/FP16-INT8/head-pose-estimation-adas-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/horizontal-text-detection-0001/model.yml b/models/intel/horizontal-text-detection-0001/model.yml index d5790f0954e..40d2cb968cb 100644 --- a/models/intel/horizontal-text-detection-0001/model.yml +++ b/models/intel/horizontal-text-detection-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/horizontal-text-detection-0001.xml size: 883052 - sha256: 7959a0408ca6d161b9d0cff7518f98ba280326dcdfa9b7d6914463ef669d1f3a + sha384: 2459c5a7cad0faf125fb066d9b200b992b7b6c4256c91cdf8de6925314410d8f5d12bb9b1bf84955a15fc0c765cf7b8b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/horizontal-text-detection-0001/FP32/horizontal-text-detection-0001.xml - name: FP32/horizontal-text-detection-0001.bin size: 7753404 - sha256: 0f94f9c4a62460287369bb9567b52b17b27936771f1cdf35b226bb108fca620f + sha384: a592ba2c86fb67552467165768a53d2a34d253f2def73b7a5aa888429275d0724a326e59e01df72a312057c8a7e4d175 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/horizontal-text-detection-0001/FP32/horizontal-text-detection-0001.bin - name: FP16/horizontal-text-detection-0001.xml size: 882890 - sha256: 7821e5fa501d2f6fa9f73e26747f32eff0566b4aece449eb319ed977edb211e7 + sha384: 96f0f3c92d6d26136723e28a165ef92f5b089376ebd5100be7ac7f2cdad7b1aeecdf14f993dc9f2a5ec5ed85267eb2f8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/horizontal-text-detection-0001/FP16/horizontal-text-detection-0001.xml - name: FP16/horizontal-text-detection-0001.bin size: 3876864 - sha256: 25ef95ba512e63d78e09ecf92d33f031cbdbd16807e85a685fa809d6761efad2 + sha384: cfbf81a8a48155b6918d00784effd398e3750fdbcd4672aab10c2fddf9994c23f4773c202be6572c88488ebb5d27be10 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/horizontal-text-detection-0001/FP16/horizontal-text-detection-0001.bin - name: FP16-INT8/horizontal-text-detection-0001.xml size: 1457277 - sha256: e937fb240086cfd1f70d476f2cb1e3d2277c34da0f7c7a78c2faa2f9e4bef6cc + sha384: c4ed8f18ded06d82926bd472fa0335d6586e0d9e1063530f2e6897b035a013a5a7a800f3338076b77a683acef8100e4e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/horizontal-text-detection-0001/FP16-INT8/horizontal-text-detection-0001.xml - name: FP16-INT8/horizontal-text-detection-0001.bin size: 2038038 - sha256: 604ada3951fcf65bfd1ba7f568cc8716a242557114f17c45e9ded2631893fb2e + sha384: 66a7473dcb875c065241036823f45de5711cc66f73f86c08b58bfb01bb5a73f8fffffaf1686e495cb3b59ccd8e4a9317 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/horizontal-text-detection-0001/FP16-INT8/horizontal-text-detection-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/human-pose-estimation-0001/model.yml b/models/intel/human-pose-estimation-0001/model.yml index d7994f68a95..9e69e6fc2b5 100644 --- a/models/intel/human-pose-estimation-0001/model.yml +++ b/models/intel/human-pose-estimation-0001/model.yml @@ -18,27 +18,27 @@ task_type: human_pose_estimation files: - name: FP32/human-pose-estimation-0001.xml size: 153774 - sha256: a4312443bb77b8528080c75fff2e5b99ad46d660d5c4cc753ee218dd3deb01f5 + sha384: 2769141a37b1b8ac562f23944ccde0ae10083ca356ed53d8e4b999d9573380df2ab64f90ee7432415ef3ac38af8c1cd0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0001/FP32/human-pose-estimation-0001.xml - name: FP32/human-pose-estimation-0001.bin size: 16394712 - sha256: 746bddef69d602945f7db09401d0567176f805fa0ea2086d2b857b459e316254 + sha384: 25a546e55a683a0a548193cb43360a8cef09846aaba5f130192f93846563ec1a749a4270ff614d98952982f5c45d13f8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0001/FP32/human-pose-estimation-0001.bin - name: FP16/human-pose-estimation-0001.xml size: 153702 - sha256: 560880b45f2e58f1f4d5388000e0364c30199ef656a1b2fd07cd4cdb7b53561c + sha384: 24f853c4ed0456e988c58cbb134e15f6b0db151ef89e8ca3413fa5961488553557c572e7ff9a0021d8929cbc2f650e76 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0001/FP16/human-pose-estimation-0001.xml - name: FP16/human-pose-estimation-0001.bin size: 8197356 - sha256: 40dfef77d8216f23b83d86d8915659e3ade89abadbb9173bc9b946cffb6c1c9e + sha384: 329c69990da8eeccca7215e124bf4feb48d43c2c9013114da703b25a69fe38a15a32af589ef2903e0cdbc96658953d6f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0001/FP16/human-pose-estimation-0001.bin - name: FP16-INT8/human-pose-estimation-0001.xml size: 426156 - sha256: 581b082e749848fdfc6d4b4b70e8189c3c2bae1c2d59c6b2c1a026a5471754e3 + sha384: f2c890b36f3fd45c81b6a8c7bc952977b1b60748c036a1e48eed7bf0fcae9d8372a6d897ba65ebde27529fe1ab56ce3d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0001/FP16-INT8/human-pose-estimation-0001.xml - name: FP16-INT8/human-pose-estimation-0001.bin size: 4170034 - sha256: df2a9f41f15c3a0c8a0c5a704650338a3cc5c7bb588f2bfc14ea7093fa37b446 + sha384: c8fd0eea004648dc2e52805757c4e5ba26c5900096c71e46571ac6578e22f88f4e12c8cf07cf5f08810421821a19f6f1 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0001/FP16-INT8/human-pose-estimation-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/human-pose-estimation-0005/model.yml b/models/intel/human-pose-estimation-0005/model.yml index 9847d5be20f..f11176c7c73 100644 --- a/models/intel/human-pose-estimation-0005/model.yml +++ b/models/intel/human-pose-estimation-0005/model.yml @@ -18,19 +18,19 @@ task_type: human_pose_estimation files: - name: FP32/human-pose-estimation-0005.xml size: 1082819 - sha256: faddff73d6645c2efd581979aad84d72888bab9e798e080429052d1f8a74437d + sha384: e0346c4508053a0df64828e18635ac608941a0685f0895ad68c42f8c9f96a12758150be505f3b94e1f412fcc55f1514d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0005/FP32/human-pose-estimation-0005.xml - name: FP32/human-pose-estimation-0005.bin size: 32601740 - sha256: 51f8f34dbd3a2eab1265b8fa7aa9cbfb4a5c65c8beaadda92c9e3b4e311689ed + sha384: 5e5d7e1c1c456d1c6a40b723524f0c1171a2510680a3cdd724cda61f1ffadfc8b0a22635139ea8781ad9ccfdb26d0189 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0005/FP32/human-pose-estimation-0005.bin - name: FP16/human-pose-estimation-0005.xml size: 1082562 - sha256: a14e7de99e9edfb38c990401301e6f823032a1ed0d42bed997dc865f797fe181 + sha384: 4250714caf2f65bb7f4f8e9cba97f28a0cc582abdfb351f42e460aeaed249d0e406a233a4ac1687d15a247e2ba05770d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0005/FP16/human-pose-estimation-0005.xml - name: FP16/human-pose-estimation-0005.bin size: 16300908 - sha256: 8d99a9efaf9b5df8bcc8d25811dcd595b6461ab28b8d60a03cea0f238eb7b813 + sha384: da51ed5b8f5ce38155523ede9907ca8231b3b23cba0669304c7895a5f5e94c8de9f1b19568e8ce21698739bc89633451 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0005/FP16/human-pose-estimation-0005.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/human-pose-estimation-0006/model.yml b/models/intel/human-pose-estimation-0006/model.yml index 63b06ef4a18..1c078922dbb 100644 --- a/models/intel/human-pose-estimation-0006/model.yml +++ b/models/intel/human-pose-estimation-0006/model.yml @@ -18,19 +18,19 @@ task_type: human_pose_estimation files: - name: FP32/human-pose-estimation-0006.xml size: 1083375 - sha256: 60f853d1352a8a406108a2dfef922bc9935ca593e61f9ffa6cb631c26c7379e3 + sha384: 6bf410d96326a52869aba792eb1e02fb51d6858b0e23686f0e07565ad2c62c712a23472c204949fee5f93b76c21f294e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0006/FP32/human-pose-estimation-0006.xml - name: FP32/human-pose-estimation-0006.bin size: 32601740 - sha256: 51f8f34dbd3a2eab1265b8fa7aa9cbfb4a5c65c8beaadda92c9e3b4e311689ed + sha384: 5e5d7e1c1c456d1c6a40b723524f0c1171a2510680a3cdd724cda61f1ffadfc8b0a22635139ea8781ad9ccfdb26d0189 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0006/FP32/human-pose-estimation-0006.bin - name: FP16/human-pose-estimation-0006.xml size: 1083118 - sha256: c2e7d6ca58ded4806b6bdab150752bcf3009c9c3225b938a7e940d247782bed2 + sha384: 434434c5c7f263ea9dd380349c16dd04495a737740c283955f88390c0e8629bb7b66768d4e02e45c8d230505e0e130db source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0006/FP16/human-pose-estimation-0006.xml - name: FP16/human-pose-estimation-0006.bin size: 16300908 - sha256: 8d99a9efaf9b5df8bcc8d25811dcd595b6461ab28b8d60a03cea0f238eb7b813 + sha384: da51ed5b8f5ce38155523ede9907ca8231b3b23cba0669304c7895a5f5e94c8de9f1b19568e8ce21698739bc89633451 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0006/FP16/human-pose-estimation-0006.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/human-pose-estimation-0007/model.yml b/models/intel/human-pose-estimation-0007/model.yml index cbe31f8f09c..32a63295124 100644 --- a/models/intel/human-pose-estimation-0007/model.yml +++ b/models/intel/human-pose-estimation-0007/model.yml @@ -18,19 +18,19 @@ task_type: human_pose_estimation files: - name: FP32/human-pose-estimation-0007.xml size: 1084057 - sha256: 135107e2e20ad548e4427eb5bf31f8d8c1daa5be7b78eabe8ee3d60447245b6d + sha384: d27b276d3e04488e21dc1149f89df6680db1ba418550c7342ecfa21c069ee1587f838d5f1e4ea98b82d8680804de65e6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0007/FP32/human-pose-estimation-0007.xml - name: FP32/human-pose-estimation-0007.bin size: 32601740 - sha256: 51f8f34dbd3a2eab1265b8fa7aa9cbfb4a5c65c8beaadda92c9e3b4e311689ed + sha384: 5e5d7e1c1c456d1c6a40b723524f0c1171a2510680a3cdd724cda61f1ffadfc8b0a22635139ea8781ad9ccfdb26d0189 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0007/FP32/human-pose-estimation-0007.bin - name: FP16/human-pose-estimation-0007.xml size: 1083800 - sha256: fae71ac22a1b59d4d86a628210e9e77aea634ced154e1eab88f496dc07ea0b0d + sha384: 8f45396367bb48d4e071e729849bd62f39bb4fa08c1e3f9d7a9e1ca43f6aada9f56976703ea0e97478dd7e3ae827de4e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0007/FP16/human-pose-estimation-0007.xml - name: FP16/human-pose-estimation-0007.bin size: 16300908 - sha256: 8d99a9efaf9b5df8bcc8d25811dcd595b6461ab28b8d60a03cea0f238eb7b813 + sha384: da51ed5b8f5ce38155523ede9907ca8231b3b23cba0669304c7895a5f5e94c8de9f1b19568e8ce21698739bc89633451 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/human-pose-estimation-0007/FP16/human-pose-estimation-0007.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/icnet-camvid-ava-0001/model.yml b/models/intel/icnet-camvid-ava-0001/model.yml index 67579b797c5..944ce455b79 100644 --- a/models/intel/icnet-camvid-ava-0001/model.yml +++ b/models/intel/icnet-camvid-ava-0001/model.yml @@ -18,27 +18,27 @@ task_type: semantic_segmentation files: - name: FP32/icnet-camvid-ava-0001.xml size: 422351 - sha256: 502182ac95bd38ec7b76398137b11dcdeae0b18f77251f17b1ac9d5a5db7ddfa + sha384: 83703a022a1be193a83b929ab81b19c88fd2fcf3f3e7dad54c21cf38cc99c52fe6ba20ff22c383b534fb7177b5d30d9f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-0001/FP32/icnet-camvid-ava-0001.xml - name: FP32/icnet-camvid-ava-0001.bin size: 106816968 - sha256: fafb83ebca44418b095be5bda9dd24f7ce27cc0b2282a38106b99b11338d9f6b + sha384: f1e7bc55b0e26656265d769cc05816cf0944a22bfbe1472ea90d3f300572533b77d15624edfb558752955af78f3d7290 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-0001/FP32/icnet-camvid-ava-0001.bin - name: FP16/icnet-camvid-ava-0001.xml size: 422254 - sha256: 97b581dbcc375f2a3e7e07916dd04416a6d7ddd9ccd126290f3f44a47a01d3d7 + sha384: 1b203b3e343bca49d3e862c3a58347a2cb5f98ea600e4690617cf9d3bca8f490629a077e4822c94657d11c472413c915 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-0001/FP16/icnet-camvid-ava-0001.xml - name: FP16/icnet-camvid-ava-0001.bin size: 53408674 - sha256: 7798a9441169ccd4eee247f6b60788832ad54f689a3e75eb2eea568f98bff21f + sha384: f7efcaf04ed08b31963ec8b8b1f6cce64de1962d7aa2e5e64d4ed07c250e34df0d645f2454651f93c94124be1d5d623a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-0001/FP16/icnet-camvid-ava-0001.bin - name: FP16-INT8/icnet-camvid-ava-0001.xml size: 778002 - sha256: b472f068de73b8e9106717e75766dcfce3036d0c48bd03d7f30ebe48d64591b3 + sha384: 66fc6317ad7bdc877739664045f5b46b4e75a524ff28d5ca4afd0dc19b9c5fd1518b25680db6d3003d1b899b73d53ba8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-0001/FP16-INT8/icnet-camvid-ava-0001.xml - name: FP16-INT8/icnet-camvid-ava-0001.bin size: 26847556 - sha256: 99418f0647704351f7f920580e967b305026d1768bdf20f3e68abac0202f07dd + sha384: a24998e9d2617d1723756337b8323668d188996051feddcfa78d447136f804d7e0a73adf17ec8b24a5c6473f2cf94022 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-0001/FP16-INT8/icnet-camvid-ava-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/icnet-camvid-ava-sparse-30-0001/model.yml b/models/intel/icnet-camvid-ava-sparse-30-0001/model.yml index 3c45b65c241..cb124473fbd 100644 --- a/models/intel/icnet-camvid-ava-sparse-30-0001/model.yml +++ b/models/intel/icnet-camvid-ava-sparse-30-0001/model.yml @@ -18,27 +18,27 @@ task_type: semantic_segmentation files: - name: FP32/icnet-camvid-ava-sparse-30-0001.xml size: 422371 - sha256: a50d7283838c235bbfb63b403276e474828d70efa8ad485897813ad6b598a1e5 + sha384: 660bb11dece37800d3d5133664706d8e734ab38032843a0ce0e0f57a777be8c4b0426ac1b06183be38084ba4a96100e2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-30-0001/FP32/icnet-camvid-ava-sparse-30-0001.xml - name: FP32/icnet-camvid-ava-sparse-30-0001.bin size: 106816968 - sha256: 884c52bfbc75659abf0fd6153643e9be620bab0561bb7411753f203a9a3d0bab + sha384: edb67a6114a807e0ff65b250be4549514b6cb340871f4b79aa19bd20a7ee2eb5d51c233cd5a70232c939954a0ccb6479 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-30-0001/FP32/icnet-camvid-ava-sparse-30-0001.bin - name: FP16/icnet-camvid-ava-sparse-30-0001.xml size: 422274 - sha256: 204ce42465e1eb1995b9a2bbf3221ce45c823a56082e4c5b1efd8dffc7f49481 + sha384: 2afae8506b27e5df469ae08f1ff2ece1a48843b76f279f7538764fbd37276fe0487eddab826956c8490aec16b2ce7fdb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-30-0001/FP16/icnet-camvid-ava-sparse-30-0001.xml - name: FP16/icnet-camvid-ava-sparse-30-0001.bin size: 53408674 - sha256: 050de28f75027c97dde9e60addd332018c95ad53208aff5acfa6421fe35e98ca + sha384: 0c5a3af0cb09569ef8f46c8a8c5bcf89dcbdeece782dfb1aa16e381db35e6544dbefad6a660ebe71b18f1e8df3de1681 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-30-0001/FP16/icnet-camvid-ava-sparse-30-0001.bin - name: FP16-INT8/icnet-camvid-ava-sparse-30-0001.xml size: 778010 - sha256: 7858fd9b4696e061f31cc796eb735a26ec95c67feae3d4d9fb7201602ef5cf32 + sha384: 3badfcff679f36dddce100558d0edddad67547c0bb00f508d6d3f709e2912e01e114f548af3e7e1af7be23865a7c5977 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-30-0001/FP16-INT8/icnet-camvid-ava-sparse-30-0001.xml - name: FP16-INT8/icnet-camvid-ava-sparse-30-0001.bin size: 26847550 - sha256: ca2ba4aea945a680c43847432a212d2f97e8a6919b018869e3d7533320edf809 + sha384: 11148315fc814f03d50917f5e7e0dce5df61d5463b17e4a619fd9a396fc73e35b4ad2e636552382a2b1eb06ee3b34d12 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-30-0001/FP16-INT8/icnet-camvid-ava-sparse-30-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/icnet-camvid-ava-sparse-60-0001/model.yml b/models/intel/icnet-camvid-ava-sparse-60-0001/model.yml index 31a800271c7..a846dade9e9 100644 --- a/models/intel/icnet-camvid-ava-sparse-60-0001/model.yml +++ b/models/intel/icnet-camvid-ava-sparse-60-0001/model.yml @@ -18,27 +18,27 @@ task_type: semantic_segmentation files: - name: FP32/icnet-camvid-ava-sparse-60-0001.xml size: 422371 - sha256: 7fefc29df76053026cd3283c4ec558651254ff5ece74a0d15e49180c3613c779 + sha384: 4f463fbc62602f70fd05e8c65b53c1fa3dde483469b400e0466b7ebcb7d73b91eb6e8c46d410a4299caf408bfb73858c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-60-0001/FP32/icnet-camvid-ava-sparse-60-0001.xml - name: FP32/icnet-camvid-ava-sparse-60-0001.bin size: 106816968 - sha256: 287b20f80f2438b82d1fd3f2e4bdfc87a69236ea8c2aeaf6ec0a88bfd7057413 + sha384: ef83e9f039d9b403c423929404c7f4cfe92af59db72bd238cc8ef911cc3d719579b1e537805f7e8093a1a57810b97cb0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-60-0001/FP32/icnet-camvid-ava-sparse-60-0001.bin - name: FP16/icnet-camvid-ava-sparse-60-0001.xml size: 422274 - sha256: b0c72542c02da202c8dd64b91a95db1028653799d77a71e8c9035dee5511041b + sha384: 8efbb588decb8dd953979d71cae4675f0a51126bb29421c5d1e077a7476d5d522e8e47f0470b6f0374297c5a69072bcb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-60-0001/FP16/icnet-camvid-ava-sparse-60-0001.xml - name: FP16/icnet-camvid-ava-sparse-60-0001.bin size: 53408674 - sha256: 83d56d6236a3401877ffd382aea554db10bf8734b5e21e8f663dbca0ab73a2ee + sha384: 16358230bded0a798c894cfdb0fad2e492989496954f102c29e114c9db6722fef3f476b33e99b0d51fa495402f6ffde8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-60-0001/FP16/icnet-camvid-ava-sparse-60-0001.bin - name: FP16-INT8/icnet-camvid-ava-sparse-60-0001.xml size: 778036 - sha256: 4d994113fa6f4dc1e4054e56e309113e9fcf092a3ece4ae92e64ee19a39c7f02 + sha384: a85c5e967347ef287177897dbdc3db71286401c82dc2d0652117906af21d697e90e6928ad751ba85b73da8ef929dab49 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-60-0001/FP16-INT8/icnet-camvid-ava-sparse-60-0001.xml - name: FP16-INT8/icnet-camvid-ava-sparse-60-0001.bin size: 26847552 - sha256: c30f50b8ed2c746cab508d902edc86be4c8a3c65562e92824cfc7e070f9f44b9 + sha384: d0218b90d30bf062842685ef3de67ddd4959321d7e4df30fb26e2fa6a41388de613d5d399028d2bed2e467c3b0298d4e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/icnet-camvid-ava-sparse-60-0001/FP16-INT8/icnet-camvid-ava-sparse-60-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/image-retrieval-0001/model.yml b/models/intel/image-retrieval-0001/model.yml index 42481ab830a..1cce54176fb 100644 --- a/models/intel/image-retrieval-0001/model.yml +++ b/models/intel/image-retrieval-0001/model.yml @@ -19,27 +19,27 @@ task_type: object_attributes files: - name: FP32/image-retrieval-0001.xml size: 166236 - sha256: b7916a9e9d887522adcfd501474a7b173cc3ad81b26f2c09ee93b0a2fdd1ca04 + sha384: d2aa7e79b8be3a807445d1b8b7faf9a945623791ba170fc4c13e0e2a6c5764e8b47515da0446604dccf26ff20f0e972e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/image-retrieval-0001/FP32/image-retrieval-0001.xml - name: FP32/image-retrieval-0001.bin size: 10139232 - sha256: bfba0fcfd62a416d61c4d7d3a9c74c6cf8672ea3d03fbde925d9b275b6e9286a + sha384: 5cb8486aaeecb2a5dd22976c6019ea9952640ed14091d384e40c0bd4474c41b3cf5df8801fc39c6f0a6afa7a6e980f92 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/image-retrieval-0001/FP32/image-retrieval-0001.bin - name: FP16/image-retrieval-0001.xml size: 166167 - sha256: 91af30668a854b4e86a764f2890bc61afd9ce2d43dbd5d447f6e331f9deda868 + sha384: 10fde5b572c9e12568046556fcaf5e75e6ca2c60de0753670d0b9ad936be2f4c56b3b3b0fa3a51eb3a6fcf69b32dd94f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/image-retrieval-0001/FP16/image-retrieval-0001.xml - name: FP16/image-retrieval-0001.bin size: 5069716 - sha256: a33b6d9334b82fa470914faa24bc0d6e72ed9a11556b53ceb915c591cfda870c + sha384: f1b04cd98494d9d0a9e1ee9c3cc15f67283bfeca284e5ecc6de3aed83dc30922cc4fe409fce2c5a4edb91f8840024483 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/image-retrieval-0001/FP16/image-retrieval-0001.bin - name: FP16-INT8/image-retrieval-0001.xml size: 434759 - sha256: a722e133540217c76af721c084594f8ce511ea6f23c4e04fd5d3bc75ca69ee5c + sha384: daff4bb3de370d6c00b8488d6716bf4210fbb1c5e3600e45824bd043f562a12f14f9603ad8ec019ac8667c088510b3a6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/image-retrieval-0001/FP16-INT8/image-retrieval-0001.xml - name: FP16-INT8/image-retrieval-0001.bin size: 2640981 - sha256: fe8a63a855bd32c215975259f2868fb34e7f435eaaecf02fdcf46018cddbe2e3 + sha384: 79a4feea583ce4faa1a7b51b822c3eadfb6e7ca52d32204b85fd921b23255c8efddf60cd3ec4ed444454f3e374b965f2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/image-retrieval-0001/FP16-INT8/image-retrieval-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/index.md b/models/intel/index.md index a83b4888406..03940d60260 100644 --- a/models/intel/index.md +++ b/models/intel/index.md @@ -86,6 +86,7 @@ Age/Gender recognition after Face Detection). | [vehicle-attributes-recognition-barrier-0042](./vehicle-attributes-recognition-barrier-0042/README.md) | 0.462 | 11.177 | | [emotions-recognition-retail-0003](./emotions-recognition-retail-0003/README.md) | 0.126 | 2.483 | | [landmarks-regression-retail-0009](./landmarks-regression-retail-0009/README.md) | 0.021 | 0.191 | +| [facial-landmarks-98-detection-0001](./facial-landmarks-98-detection-0001/README.md) | 0.6 | 9.66 | | [facial-landmarks-35-adas-0002](./facial-landmarks-35-adas-0002/README.md) | 0.042 | 4.595 | | [person-attributes-recognition-crossroad-0230](./person-attributes-recognition-crossroad-0230/README.md) | 0.174 | 0.735 | | [person-attributes-recognition-crossroad-0234](./person-attributes-recognition-crossroad-0234/README.md) | 2.167 | 23.510 | @@ -200,6 +201,9 @@ Deep Learning models for text recognition in various applications. | [text-recognition-0015](./text-recognition-0015/README.md) | | | | encoder | 12.4 | 398 | | decoder | 0.03 | 4.33 | +| [text-recognition-0016](./text-recognition-0016/README.md) | | | +| encoder | 9.27 | 88.1 | +| decoder | 0.08 | 4.28 | | [handwritten-score-recognition-0003](./handwritten-score-recognition-0003/README.md) | 0.792 | 5.555 | | [handwritten-japanese-recognition-0001](./handwritten-japanese-recognition-0001/README.md) | 117.136 | 15.31 | | [handwritten-simplified-chinese-recognition-0001](./handwritten-simplified-chinese-recognition-0001/README.md) | 134.513 | 17.270 | @@ -299,6 +303,8 @@ Deep Learning models for speech synthesis (mel spectrogram generation and wave f | text-to-speech-en-multi-0001-regression | 7.81 | 5.12 | | text-to-speech-en-multi-0001-generation | 48.38 | 12.77 | +## Speech Noise Suppression + Deep Learning models for noise suppression. | Model Name | Complexity (GFLOPs) | Size (Mp) | diff --git a/models/intel/instance-segmentation-security-0002/model.yml b/models/intel/instance-segmentation-security-0002/model.yml index 221a7462e40..a39b060b92b 100644 --- a/models/intel/instance-segmentation-security-0002/model.yml +++ b/models/intel/instance-segmentation-security-0002/model.yml @@ -19,27 +19,27 @@ task_type: instance_segmentation files: - name: FP32/instance-segmentation-security-0002.xml size: 840711 - sha256: 27bb8cbba8139f7757e1d0e8ff9badf8e388f61d9b1ae2d3d7fe61d21647cfd4 + sha384: 78135fb7adbbbea5cf0b80cab259ec498d59be1c8669a12f2ff58fc0b834e3edbef015e24018d835385b000d8bc60d03 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0002/FP32/instance-segmentation-security-0002.xml - name: FP32/instance-segmentation-security-0002.bin size: 177479928 - sha256: 43df120a06790f0d623645d6cc7d8e410fca005cb8ede7f3495a972f9d701ec6 + sha384: 3e8c8715efa85469141f972512ceaba68917beae9f688ef0ba046fd5c2a7eb1af1de00c3936f5c022886df91e304e498 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0002/FP32/instance-segmentation-security-0002.bin - name: FP16/instance-segmentation-security-0002.xml size: 840311 - sha256: cd516194b08132248c06e1e149eaa700fd25cd44dd32a7b233de970bd4407ba0 + sha384: b65acf4637a3dd0e15147fc3b29d122ef7dc8826d59b16135b2a0cf7c451c6d4491396a1b1455bc21d6d78309ae497fe source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0002/FP16/instance-segmentation-security-0002.xml - name: FP16/instance-segmentation-security-0002.bin size: 88740226 - sha256: aa238d4d7a4f3f0aa98786942138a7d98672d0bb8261c6c1adfde5bb5faa7a82 + sha384: b395fa2d5136ccfb5e2dc7e7c8bd84ad90733e4043ba22ec38e7474249eb4d1bd01d64d9eede3aed99dc91388f39973b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0002/FP16/instance-segmentation-security-0002.bin - name: FP16-INT8/instance-segmentation-security-0002.xml size: 1186837 - sha256: 574d3c33a1638ff69a3d7cfc1ef65e82cc86cc4836a8c713dee15e2475ba94e6 + sha384: e6cbd0888f572a75df83c354597d495da33e9d4117701d9e9b72d2466cbd4a81da8b836f7615ccc7999cf2633aef89be source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0002/FP16-INT8/instance-segmentation-security-0002.xml - name: FP16-INT8/instance-segmentation-security-0002.bin size: 70485480 - sha256: 749264cfd5e7fc925f6d96b329e48ec5d4d147f2984cb3b0c64837b8cc98346b + sha384: 5695805c2b031cc7bedf7a8010c3d39088c7a2f0948da40ba50e8875c4a0e8046b8cb4f7703f60ed54ce1d34930a7145 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0002/FP16-INT8/instance-segmentation-security-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/instance-segmentation-security-0091/model.yml b/models/intel/instance-segmentation-security-0091/model.yml index 82c08c3b125..8bbacab9666 100644 --- a/models/intel/instance-segmentation-security-0091/model.yml +++ b/models/intel/instance-segmentation-security-0091/model.yml @@ -19,27 +19,27 @@ task_type: instance_segmentation files: - name: FP32/instance-segmentation-security-0091.xml size: 1381647 - sha256: 21e2ecec2c1e1a72558b06f2e87b2ee250fb342203d2a74af2cf27920d7db533 + sha384: 00dfe3ae4e41aa2088447577affe8a6c1cdcb5de90f4f64f4ee3c0428ae09e1eda9a1e57b9974855dd77a4e47d51f47e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0091/FP32/instance-segmentation-security-0091.xml - name: FP32/instance-segmentation-security-0091.bin size: 390233536 - sha256: 247da9b3b1b746fa4bd59fae3a5ec9546390aad5b318ab9a3853936ecbc1f65c + sha384: 554f90c40dd9601cadfb60c6132d68b418fc513308a4bdd53e4869850fe6f70b3016929b87ebbe395fba357210ec695d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0091/FP32/instance-segmentation-security-0091.bin - name: FP16/instance-segmentation-security-0091.xml size: 1380558 - sha256: 4b83f2580999a3bcc9fb8746e07706b395cb506d1f1fb504ff919c450f7e6057 + sha384: 0957ca26070417375eb3dbc354f499c2e34ee6ee5b96b33932ab1393a09bf948eb7969517db6ed8359f21ff7036649cd source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0091/FP16/instance-segmentation-security-0091.xml - name: FP16/instance-segmentation-security-0091.bin size: 195117022 - sha256: ff7e29ab72b360d0497303fad3ce971a804a8da20ccd0948f0c5c848b749b74a + sha384: b3c9813e9fc34e719bc4d928ecd28891493ab42d956d683625ea705518080083933fa25cf5e2ee9100d6253a52f1f1a8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0091/FP16/instance-segmentation-security-0091.bin - name: FP16-INT8/instance-segmentation-security-0091.xml size: 2082233 - sha256: 17fec019507a2f8cec00f2c14e65bd006c364efa8c0c9aaedd1ea353b74f7ee0 + sha384: aef66830c7f100735b67e83d9a12c7a3261fc6f6499f8780e07a006a515f846e0515575be5e7e2e96498471e273c70c9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0091/FP16-INT8/instance-segmentation-security-0091.xml - name: FP16-INT8/instance-segmentation-security-0091.bin size: 196951642 - sha256: 81a8956eb446d42b6e58b5557f0b0b4da21c73ae0043438502e65daa9599c8ff + sha384: ac5fd8b40f946ac3cce8f51e07e9bcbd47f7cb0f6334977b758755af097f1278cac3465879246140b5c07b190636ee4f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0091/FP16-INT8/instance-segmentation-security-0091.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/instance-segmentation-security-0228/model.yml b/models/intel/instance-segmentation-security-0228/model.yml index 6911bdd938d..8a2da90f007 100644 --- a/models/intel/instance-segmentation-security-0228/model.yml +++ b/models/intel/instance-segmentation-security-0228/model.yml @@ -19,27 +19,27 @@ task_type: instance_segmentation files: - name: FP32/instance-segmentation-security-0228.xml size: 985819 - sha256: 07fa70bb3ab4259c197cbd689e332199597e5458694c3e016c6a995d700a0c90 + sha384: 72e727da368775f3da151c8fc32d4b0f69851655e1cad34f4776a646b7fdb4195f5ab0ddfae798701907b7e41ca41cf7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0228/FP32/instance-segmentation-security-0228.xml - name: FP32/instance-segmentation-security-0228.bin size: 192104184 - sha256: 1cf9b39d09637ba94ae5dd5f694ce40bdee7f3d59f7bad1d0134e9e1a2a0736c + sha384: 258a8e8ebe64e399e0bdee1889dff206d9abb9501a0dfd16cb5714df33cf613cda23b943a654697578ffad247d38fd7c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0228/FP32/instance-segmentation-security-0228.bin - name: FP16/instance-segmentation-security-0228.xml size: 985032 - sha256: 1dcac985aeebb2e59fa24c33e9a635a1b0567f1f321fe71f9aae41e0d196210f + sha384: 22d4adea9138bdd0982bfc3774e9b896849c22f216977e09451fe896c33431b8c88c1451e4382dbd6cdc27d2fd292f56 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0228/FP16/instance-segmentation-security-0228.xml - name: FP16/instance-segmentation-security-0228.bin size: 96052354 - sha256: 2a03d2142f444a2eda6d022d3a81645d07800e8387624ca8103023f6c07e1afc + sha384: 5b40943fd559e7655a98e0a21c7596565db66bfc169bc5d06f7a0e8689d0db242814263389439594ca328e4abf2811cc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0228/FP16/instance-segmentation-security-0228.bin - name: FP16-INT8/instance-segmentation-security-0228.xml size: 1568012 - sha256: 2b6a4dc7fa8becc3cb033aa1e95d0ca1cf06e5128edc3db148c1aa31a861cfa7 + sha384: 54a88b1353fe80d0c9bb53d69fbf4ecc5e489cadd4e081dbbb0eb261645bd1d65cfbbfa356743723b8c26c3c9bdb462f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0228/FP16-INT8/instance-segmentation-security-0228.xml - name: FP16-INT8/instance-segmentation-security-0228.bin size: 54794552 - sha256: b8edc52599c114c7f39e9a2dde542bb8c58752cebf9758237cf12ab4c8df31d9 + sha384: 43badd3b8f208c2be7fc893cca203fe4d456157a829fc699ad6b3dee796948fce5fa645d4d36110f479373e8a90c2333 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-0228/FP16-INT8/instance-segmentation-security-0228.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/instance-segmentation-security-1039/model.yml b/models/intel/instance-segmentation-security-1039/model.yml index 63ce8479e2a..a559f9546c5 100644 --- a/models/intel/instance-segmentation-security-1039/model.yml +++ b/models/intel/instance-segmentation-security-1039/model.yml @@ -19,27 +19,27 @@ task_type: instance_segmentation files: - name: FP32/instance-segmentation-security-1039.xml size: 980470 - sha256: 1174235346e1ac9b69904ce5c943daec72a7792c9d37e54e023c5cc4fb06ff84 + sha384: 98a60dda52535cae06698a508d14cce0f5eb199b7293b5090cb5a2a46e85e3c4e50a5c81b81c8194e5081b0f9fab424e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1039/FP32/instance-segmentation-security-1039.xml - name: FP32/instance-segmentation-security-1039.bin size: 40970632 - sha256: 30f407735b38acc6ea0ad42e19b58894e12fc0bcece87108381f4a894efc093c + sha384: 640db0ffb7a76818187328362f888e59051bb93278b9678c99cf9f457108251bb1d3407994b326d0973c964a54b4959f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1039/FP32/instance-segmentation-security-1039.bin - name: FP16/instance-segmentation-security-1039.xml size: 980390 - sha256: 608728f087294da3ce1302e6a21cab94ad32fc2ce29a67581812179de5e7c999 + sha384: 673b571d6aee434ac9ad810bb6c43489908865d2ad991cca791ec1b750f5d1f6c4ec6b7f48b49d5aba9a18abfbc76118 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1039/FP16/instance-segmentation-security-1039.xml - name: FP16/instance-segmentation-security-1039.bin size: 20485598 - sha256: cad92f78cc2a5f2ca027fd120f4721978cf9d0b5780e3ead737c87135a021ef5 + sha384: 295dbbebe66800303b54ba4d8d353843fc96331cdd86f7d3ef9c66aa1822df98de10a2de18ef8f3a3c300aff912c6fe3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1039/FP16/instance-segmentation-security-1039.bin - name: FP16-INT8/instance-segmentation-security-1039.xml size: 1688277 - sha256: c4d04b2ff5f1098b31666cd122c02fef5e006a9c934c1261dc46d55b8ce40567 + sha384: 5e83f2bee4f295a2d06a6e33f538ae006b3627e8aac6c56276c0091cb8db6f6edee470d0bf9f9962d95a65246a861a93 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1039/FP16-INT8/instance-segmentation-security-1039.xml - name: FP16-INT8/instance-segmentation-security-1039.bin size: 14595052 - sha256: 812f17d4a178e9ec323cc9a3117855d60702c95337cd0da9250f3d11076608d2 + sha384: bb669e5ed556e4473bbcc5efb19960fc91bf7d5a1e71b1a33b0d261fd994b08f5357ab257bb034836c6c46bc3b56a81e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1039/FP16-INT8/instance-segmentation-security-1039.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/instance-segmentation-security-1040/model.yml b/models/intel/instance-segmentation-security-1040/model.yml index 4b69bebd462..cb2df8b85a7 100644 --- a/models/intel/instance-segmentation-security-1040/model.yml +++ b/models/intel/instance-segmentation-security-1040/model.yml @@ -19,27 +19,27 @@ task_type: instance_segmentation files: - name: FP32/instance-segmentation-security-1040.xml size: 980908 - sha256: 97882cb3da405b5dd380f66b969827a407e05635b8f88ef9a0792be9af85a6f2 + sha384: 8ded927b8542d6645e095a7570dbd92e004d21e917b900092f6ab5014c3b0a37ba3cf06f486974b0dd3f6b8f7873f5ca source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1040/FP32/instance-segmentation-security-1040.xml - name: FP32/instance-segmentation-security-1040.bin size: 52969864 - sha256: 3a64d4c321c7e9b490ea7b8d19f8143b1d521fe370a15f299de39de066429b3f + sha384: 7dd555c9daef256a216299cfd47c5cc45b521d3349c1c4d86c63b7210256a5f5f24afc48dc7b1858098cd86377080819 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1040/FP32/instance-segmentation-security-1040.bin - name: FP16/instance-segmentation-security-1040.xml size: 980828 - sha256: ff775aa45411b231ae41e37bfed78c08b0feba9ace0349c8a594269025b42ef3 + sha384: d7f89dd9b100462247dcceaa2137ee355fabea8aed9777dbd13fc318049cd16de475e2bef2b97659c512810ad6879668 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1040/FP16/instance-segmentation-security-1040.xml - name: FP16/instance-segmentation-security-1040.bin size: 26485214 - sha256: 914e5804012e6769d335f5e9c9242959634bb29d4762307425192d52ec5a671a + sha384: 1538332959f447535620f64c29a40d085784d7941c7a205961627e27b5be02e4ddc44041299cb78377e80ca632450270 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1040/FP16/instance-segmentation-security-1040.bin - name: FP16-INT8/instance-segmentation-security-1040.xml size: 1688757 - sha256: 644ef1e88d23e8f947592d897d454a38d3830d50647e6be79c0724273ced487d + sha384: 292773a3f3f094dce7cc71e92554912eb9dd8f7de6624e42dd23fe2523fe604968364b1a45623b18600943f3fef74ed0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1040/FP16-INT8/instance-segmentation-security-1040.xml - name: FP16-INT8/instance-segmentation-security-1040.bin size: 21614048 - sha256: 6230484885fcbf0b181cdcca989b9c8d7377ba24c44f366ebe098c87544f72aa + sha384: 02b3a87dabd2e767cac215b27b4387c6f37f28c3e5cafba1cbbd590e47cd6d09aea00f45b48ee7bdac3f2d8aa3d38c36 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/instance-segmentation-security-1040/FP16-INT8/instance-segmentation-security-1040.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/landmarks-regression-retail-0009/model.yml b/models/intel/landmarks-regression-retail-0009/model.yml index 94973a2216b..8d117e0d24b 100644 --- a/models/intel/landmarks-regression-retail-0009/model.yml +++ b/models/intel/landmarks-regression-retail-0009/model.yml @@ -19,27 +19,27 @@ task_type: object_attributes files: - name: FP32/landmarks-regression-retail-0009.xml size: 44890 - sha256: 7b0b5cac7cfe8bd60b1077e5b465778dd861deb8cb59896244740c6ee6edd678 + sha384: 84e5fd89c411c1128863c884818c7779184c9f551cb4e6d7f507c19f1ee0ec1fb8e76be5ed97fd006b66752e282bf651 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/landmarks-regression-retail-0009/FP32/landmarks-regression-retail-0009.xml - name: FP32/landmarks-regression-retail-0009.bin size: 762464 - sha256: 743d6045dd1c8df90649d2e19ce40ee41de18b799e261bb11682e1d9ef124b5d + sha384: 1eaf75784c7383cd39e38032dfaf29609083d2d6796ccad38e9fff4721dee847bb83d13e7e2aee25db909c692b60a3ce source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/landmarks-regression-retail-0009/FP32/landmarks-regression-retail-0009.bin - name: FP16/landmarks-regression-retail-0009.xml size: 44871 - sha256: fd488401fdb268b52cb053f326fc463a6973180e84fce58e358ffc511e9db991 + sha384: 1400847442a9b67be5c63ebca1f17e3f2b7a2e0a876519bc3700262031cf3001e312036d170764a98ee02b6b64c92db3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/landmarks-regression-retail-0009/FP16/landmarks-regression-retail-0009.xml - name: FP16/landmarks-regression-retail-0009.bin size: 381248 - sha256: 973b13e64b3576f754a690266b069438b531bc657233d09d7b382ca36e6cf1e4 + sha384: 18c5d0b980d3ca27b9a2bd1a551a69ed2d86f3fb81211a1f66b6e336fcf2c4070235ec9698673a6ac6d815229f1f144e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/landmarks-regression-retail-0009/FP16/landmarks-regression-retail-0009.bin - name: FP16-INT8/landmarks-regression-retail-0009.xml size: 88757 - sha256: f33c8a7b32bc870f8fc77b862400ae2e976e77fde50fa6dba30916a2334f7ff4 + sha384: 0333f00bcda3cf638b2643e568eb02c930e1a7d0825bf01460d8e04fe659d91a4e1b3652cd1352702d6907325709e314 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/landmarks-regression-retail-0009/FP16-INT8/landmarks-regression-retail-0009.xml - name: FP16-INT8/landmarks-regression-retail-0009.bin size: 196426 - sha256: c890951a87aec5adeedb6949a16e1928ef1843c68cacf6b34aa4b0fe35c897f5 + sha384: 5275de63086681c874f56e6818510ce4c1482fe729d46e1f0842b8d57b01c04c29a04b430ae05f0f84410318d7829822 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/landmarks-regression-retail-0009/FP16-INT8/landmarks-regression-retail-0009.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/license-plate-recognition-barrier-0001/model.yml b/models/intel/license-plate-recognition-barrier-0001/model.yml index a1dbc40688b..6099f14cd11 100644 --- a/models/intel/license-plate-recognition-barrier-0001/model.yml +++ b/models/intel/license-plate-recognition-barrier-0001/model.yml @@ -18,27 +18,27 @@ task_type: optical_character_recognition files: - name: FP32/license-plate-recognition-barrier-0001.xml size: 51681 - sha256: c87b65c54568e39374b404c82d2a077d2702741bb62d2fe4bf32d8bff1ff1315 + sha384: c3c36fbec5559bbd3c0aa195253e2dd1c55ff28c4e1a675a6068e5af6299c03ebec97f0317297466b7c446de079790ce source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/license-plate-recognition-barrier-0001/FP32/license-plate-recognition-barrier-0001.xml - name: FP32/license-plate-recognition-barrier-0001.bin size: 4871940 - sha256: 055cea6236129bebbc64852c69fdaefe07e074800251147dde0005a824bcfeba + sha384: 4ec3d6adc5e470cb8faed53c5866e45a89e745b0ee0bd81d5be7d80481c49a2fccd694435e68c1470c365eb77c7ad30d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/license-plate-recognition-barrier-0001/FP32/license-plate-recognition-barrier-0001.bin - name: FP16/license-plate-recognition-barrier-0001.xml size: 51662 - sha256: 21c51ec6e420997b2596ab5ad6aca4390748303e82d4e0e254bef7b942a3567c + sha384: 6bd38237b1b90507f341021724c05b93060458205bc4f5b1e268695496b49b9be551c617c00aaa7365a66c4b8ee09dfd source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/license-plate-recognition-barrier-0001/FP16/license-plate-recognition-barrier-0001.xml - name: FP16/license-plate-recognition-barrier-0001.bin size: 2436038 - sha256: 56da1c2f4615c8c09dd22a8074ef928d3eaf09367d6774807a90134932eb6dba + sha384: f3db84570810f4476c6cab374a7b875dc10d2b29c0a1e38ab8d4e55cf39f5d63a34b82a79417c5788681e27265390d8c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/license-plate-recognition-barrier-0001/FP16/license-plate-recognition-barrier-0001.bin - name: FP16-INT8/license-plate-recognition-barrier-0001.xml size: 116073 - sha256: 0dd851d344ef53d7c598c182f8dd858892833676e9ece4debf3d9d3bf92994e6 + sha384: 9f1cb692d8ac5eba5f07e21da2319996adc39c73e6202787cb613489769e21acbccc7b94322e5b69009f70c79ddee8f5 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/license-plate-recognition-barrier-0001/FP16-INT8/license-plate-recognition-barrier-0001.xml - name: FP16-INT8/license-plate-recognition-barrier-0001.bin size: 2041028 - sha256: 3406252850188a3e7ff1bd4ecd5c8c466d70a271018eeef8512356ba638f1a9d + sha384: 008b22ce6b4cb5298dd6cd0aa770335b6482e0388337e692721b6dbda8eb865701974d2af38f13e0fbec3cf8bb6b1466 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/license-plate-recognition-barrier-0001/FP16-INT8/license-plate-recognition-barrier-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/machine-translation-nar-de-en-0002/model.yml b/models/intel/machine-translation-nar-de-en-0002/model.yml index bdb59dba4e8..d9f5f00ddd8 100644 --- a/models/intel/machine-translation-nar-de-en-0002/model.yml +++ b/models/intel/machine-translation-nar-de-en-0002/model.yml @@ -19,19 +19,19 @@ task_type: machine_translation files: - name: FP32/machine-translation-nar-de-en-0002.xml size: 912660 - sha256: 05d22652a80cdd2c7a0af70af1a1f34baab9fc23aa38048157a92a0edc484eb2 + sha384: ccc6c83cf9b982052719040dbbdb391f5f67d795703492d315d107de4b4846fe9abd156f21d33a5801f7437b21b3a571 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-de-en-0002/FP32/machine-translation-nar-de-en-0002.xml - name: FP32/machine-translation-nar-de-en-0002.bin size: 284547188 - sha256: 04e5d748cfac36de86fd04b2b2fd290957d61b5162c03e88207e61bf75d42daf + sha384: 5c909dba9177196f5a8b459d488b08977cdc2bdfea6ba3d07f0e1f0a762652db7ef7a006c9127a444fcd6ad658308085 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-de-en-0002/FP32/machine-translation-nar-de-en-0002.bin - name: FP16/machine-translation-nar-de-en-0002.xml size: 912717 - sha256: 5d2eea704ac724dd5e654101a25368a826dc890ea35c93802bdc4d7e202c452f + sha384: 8e1873ea32ba4d9161fe30512820be45c8f7f11707cf5b0771477b783df12c308bdf05567f8c240b4a6a71e3e4ce52a5 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-de-en-0002/FP16/machine-translation-nar-de-en-0002.xml - name: FP16/machine-translation-nar-de-en-0002.bin size: 142274522 - sha256: c37f6074d11e4d84a94f01a0e9a82896cef790922c1fb46521ce59baafb95073 + sha384: 1a2f1ffd9d9fac6b78ba4d0d6b69522934be1fd488fb92584f2cf83c12919954feaa15688d8aedf6e4d8fbdbf96c2305 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-de-en-0002/FP16/machine-translation-nar-de-en-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/machine-translation-nar-en-de-0002/model.yml b/models/intel/machine-translation-nar-en-de-0002/model.yml index 0072910739a..bbf12bd6ea5 100644 --- a/models/intel/machine-translation-nar-en-de-0002/model.yml +++ b/models/intel/machine-translation-nar-en-de-0002/model.yml @@ -19,19 +19,19 @@ task_type: machine_translation files: - name: FP32/machine-translation-nar-en-de-0002.xml size: 912660 - sha256: 612a0b0cd97327798f074e585e7715c7de4b2f3be1cfa2ce58e722a0badd1014 + sha384: be85eaecee672829462e7edb18f36edbfe3edd8550b93a21a3b7042047fd5046957e59e73682add53f9ee31d77516681 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-en-de-0002/FP32/machine-translation-nar-en-de-0002.xml - name: FP32/machine-translation-nar-en-de-0002.bin size: 284547188 - sha256: bf909c837dd320f19c85c1d5b737d9cf5a13cdf81459b82f73946e20bdbf0fa7 + sha384: 83f91dbbd894f3379f156682c59a64a903e7571d481c61805115f6ac26755388215328b93bece260a49989fa0963e1c7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-en-de-0002/FP32/machine-translation-nar-en-de-0002.bin - name: FP16/machine-translation-nar-en-de-0002.xml size: 912717 - sha256: a09a5d4e2852ce1eacb55ac013834c5c2922e01e4885da36b07de3907f628020 + sha384: 15bdea70ebc32a539a76a7567cf65e37d56c09c137550e62c682ab9265d4fb5459b634a46e0ffd501aff31910aa78758 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-en-de-0002/FP16/machine-translation-nar-en-de-0002.xml - name: FP16/machine-translation-nar-en-de-0002.bin size: 142274522 - sha256: 855de4b7f6cc30daf1981d33ff50bb3412661e9c52c177e1e31d2969b0b3734f + sha384: 30485018446f624f3236a1c64d0faf3e7c8c6b4d985343f08941c24f2416a6a71df3d3cc65e21441b3df4ecb0f11ca15 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-en-de-0002/FP16/machine-translation-nar-en-de-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/machine-translation-nar-en-ru-0001/model.yml b/models/intel/machine-translation-nar-en-ru-0001/model.yml index 625e952885e..6755f5f998c 100644 --- a/models/intel/machine-translation-nar-en-ru-0001/model.yml +++ b/models/intel/machine-translation-nar-en-ru-0001/model.yml @@ -19,19 +19,19 @@ task_type: machine_translation files: - name: FP32/machine-translation-nar-en-ru-0001.xml size: 918531 - sha256: 88c7be90db7305866a128f30c66ddb63d20201ae631ac7b8e776292dbf56ce68 + sha384: 8c049d1dd1e38345c8a01bb9110b1a2745acf92adf73a52c2f096010ba2cee546bb4483e0d5bf0c89c51b67a26c08715 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-en-ru-0001/FP32/machine-translation-nar-en-ru-0001.xml - name: FP32/machine-translation-nar-en-ru-0001.bin size: 251814396 - sha256: ffc400078e7c3cb6051ebdef39ee1c92e23448c36d4b35959159a752b30721af + sha384: 8cc0315c4ecc84c5de1f89c2eacb883ef78f100b2d4995e69ffab9eab2c88adddf72e4862beea7c23324198230c3eb6d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-en-ru-0001/FP32/machine-translation-nar-en-ru-0001.bin - name: FP16/machine-translation-nar-en-ru-0001.xml size: 918582 - sha256: 2f758174a2ffc2d11585f1a97e5680c7ccff729dd3e0564f7d48b28a3b4fe4c7 + sha384: 2735ef50722c6807f0ef258c31b7abd8ec5c4e5e850005d7efdbcf43716abd9de22f51c8acf4fe035da689c9a2bc71c3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-en-ru-0001/FP16/machine-translation-nar-en-ru-0001.xml - name: FP16/machine-translation-nar-en-ru-0001.bin size: 125907314 - sha256: 87f13751fa6283f350340406bbd2ce95c538dc3e2206fd88bca1af4a0134fe8f + sha384: ddc5e03ecd2deb149c51aed28065574a5843a6c5153231d6d4b87e4c9444020a59bf10b23859b547c519ee101b89b56e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-en-ru-0001/FP16/machine-translation-nar-en-ru-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/machine-translation-nar-ru-en-0001/model.yml b/models/intel/machine-translation-nar-ru-en-0001/model.yml index bdbf7e9ac02..194a3daf931 100644 --- a/models/intel/machine-translation-nar-ru-en-0001/model.yml +++ b/models/intel/machine-translation-nar-ru-en-0001/model.yml @@ -19,19 +19,19 @@ task_type: machine_translation files: - name: FP32/machine-translation-nar-ru-en-0001.xml size: 918531 - sha256: f6d97ed0a260ea80fb8cd51b1a8300d348b9fe2a34315db09842f921138b1edc + sha384: 8ed34651a2c227bc7fe85a25bef8b74303fea0cf5555d4410600754f811d4685c641c960d7e384190118284a16ecc123 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-ru-en-0001/FP32/machine-translation-nar-ru-en-0001.xml - name: FP32/machine-translation-nar-ru-en-0001.bin size: 251814396 - sha256: 02402791b22d6621adf98d603fd22020e3f1c8291fd12cfcda51ec99d21bd40b + sha384: 23c1bad7d1608ca1715a5e77e9598fdc3ddd4f88b3860855bc5c53251ba4b85df58cfc49b478753836f9c3a63d324c39 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-ru-en-0001/FP32/machine-translation-nar-ru-en-0001.bin - name: FP16/machine-translation-nar-ru-en-0001.xml size: 918582 - sha256: 4aaa2626476b8cfb36af1c1551cf26efc339801ed169a14444bca195837b4529 + sha384: 1091343da67f5fdbaae952424f3f517de92c37a28c05617f6e0d2937a269466850378481c5f117079a4e4a501abf4049 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-ru-en-0001/FP16/machine-translation-nar-ru-en-0001.xml - name: FP16/machine-translation-nar-ru-en-0001.bin size: 125907314 - sha256: a54d6f4191439c87df3ce9a71345f96992a75ba71cb380611cc89eb8bb5b9f84 + sha384: 74c3ac24911c5b1abc52114036255217b2829670cb453664594973d8f2045e40ed7c712ff18a6004c060bd8a46b5013e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/machine-translation-nar-ru-en-0001/FP16/machine-translation-nar-ru-en-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/noise-suppression-poconetlike-0001/model.yml b/models/intel/noise-suppression-poconetlike-0001/model.yml index 874b50da669..b583c9d305a 100644 --- a/models/intel/noise-suppression-poconetlike-0001/model.yml +++ b/models/intel/noise-suppression-poconetlike-0001/model.yml @@ -19,19 +19,19 @@ task_type: noise_suppression files: - name: FP32/noise-suppression-poconetlike-0001.xml size: 1496368 - sha256: 6e541ae374b739a7daf5fbcc437adc23c8d6e05eab3fdf88efec63ae233dc25e + sha384: a178d77627473c743f1913deb79bad3ea0722cc33ced12dfc885264a793e80b1e8fedf0790c292d51fa83eccd214cda4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/4/noise-suppression-poconetlike-0001/FP32/noise-suppression-poconetlike-0001.xml - name: FP32/noise-suppression-poconetlike-0001.bin size: 29589616 - sha256: 2761132d65d43933e5eef6acf763c013a68e0ee7d097f6ec5b0293e2d1c86863 + sha384: a4fac74c9d2ca9a217464dc1e1ae8f4c8cec1187d9ec961043f6d49a11213cc1b11529d0b7d79a746cd1e05ad5af0809 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/4/noise-suppression-poconetlike-0001/FP32/noise-suppression-poconetlike-0001.bin - name: FP16/noise-suppression-poconetlike-0001.xml size: 1496238 - sha256: ee245abd973772daae2c42e24613892f0c81908050f9497721a535a68108bcdd + sha384: 3eb339ee2cc336d1cee65dfa7ad104186e57a9216b9b4a679a2384848e21e8412fabc5e98595c67c6abe4a19c9d63d5c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/4/noise-suppression-poconetlike-0001/FP16/noise-suppression-poconetlike-0001.xml - name: FP16/noise-suppression-poconetlike-0001.bin size: 14795124 - sha256: 6d6f42bb8d4efa35243385a2e7d4b3407cca13524c4946271775c7aefc06a1e5 + sha384: a7079744ba378094b2285c28eb7f79454ca9ff778f86a28fb46ac3ec93c049632b4c5a0712f9067a166290bdf36e50a7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/4/noise-suppression-poconetlike-0001/FP16/noise-suppression-poconetlike-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/pedestrian-and-vehicle-detector-adas-0001/model.yml b/models/intel/pedestrian-and-vehicle-detector-adas-0001/model.yml index 1ac052aa4b2..bc5c4afaf58 100644 --- a/models/intel/pedestrian-and-vehicle-detector-adas-0001/model.yml +++ b/models/intel/pedestrian-and-vehicle-detector-adas-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/pedestrian-and-vehicle-detector-adas-0001.xml size: 245221 - sha256: 294b5d4672b82279689c87cbf4722e13e962e297891b0227a671803390c180c7 + sha384: c0a4141e351ea8daec0e2ec471c9246d155c97475d3a03e27e00c1255136c775928171747b7a6a16108dff2b1ceaf584 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-and-vehicle-detector-adas-0001/FP32/pedestrian-and-vehicle-detector-adas-0001.xml - name: FP32/pedestrian-and-vehicle-detector-adas-0001.bin size: 6598568 - sha256: 24b06d7ecc98d1d58fead4e1c2bc30501693d17ec516119393b61a351011525c + sha384: 2c2b8c66780d5eaac5443bf42398d5bc61e326850c4db4ff5105f663180fc2db5afdd60ba2d7f0d6c909af4ce5777010 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-and-vehicle-detector-adas-0001/FP32/pedestrian-and-vehicle-detector-adas-0001.bin - name: FP16/pedestrian-and-vehicle-detector-adas-0001.xml size: 245175 - sha256: c0568aab45a8f150d043eb4e2e9c1fe4f7631d910c3a4389f7bc24acae20f273 + sha384: 390f3ba92d8d7c3cd7d9e94e78fc16b1473236e9db2140490bb4be1a639233b4db8b62ef255f5f8de3f1324c8e6eaf8b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-and-vehicle-detector-adas-0001/FP16/pedestrian-and-vehicle-detector-adas-0001.xml - name: FP16/pedestrian-and-vehicle-detector-adas-0001.bin size: 3299336 - sha256: 3f9739b91277bc916f29b17d043115c6669e113e5d60d61589063d8054c40d7d + sha384: 584f152c038fe3168dfbc7865a92e094e28265185ac1f13b48e623aa95e7493f718c70305842cbf286155c49747f64e5 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-and-vehicle-detector-adas-0001/FP16/pedestrian-and-vehicle-detector-adas-0001.bin - name: FP16-INT8/pedestrian-and-vehicle-detector-adas-0001.xml size: 478621 - sha256: a80bc898eca4260e6b62b5c0738f94f534d2714411f2f58f577b7a587b027da9 + sha384: 9ec31e25161c225cd287fd74d9b13a448f6469da80071a6df76fffbd48f87667cb256b1d3771d9851fc52e253672b833 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-and-vehicle-detector-adas-0001/FP16-INT8/pedestrian-and-vehicle-detector-adas-0001.xml - name: FP16-INT8/pedestrian-and-vehicle-detector-adas-0001.bin size: 1705674 - sha256: 17147b5074fa788db47d0cf573a2e3446e4f2d38ce08d9089320c3afb9983b28 + sha384: c062842bd776897622eadf7578e8a210e38eea57e24aff5f933cc63ad3819a5b6cf43da29f787c211a9f267977ee9b6f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-and-vehicle-detector-adas-0001/FP16-INT8/pedestrian-and-vehicle-detector-adas-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/pedestrian-detection-adas-0002/model.yml b/models/intel/pedestrian-detection-adas-0002/model.yml index edaf7c2ae43..57fb8ff8e77 100644 --- a/models/intel/pedestrian-detection-adas-0002/model.yml +++ b/models/intel/pedestrian-detection-adas-0002/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/pedestrian-detection-adas-0002.xml size: 245104 - sha256: dc4c590b351a7ce04cd8329b80cd0d72519aad7976980fc33d827825ba4775f6 + sha384: 677956f4ed5d8321d10d728eb907c6a872bb1d623e5eacbae6054f8fb0458db4639983efa5bee6a1753610f77e35ef9b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-detection-adas-0002/FP32/pedestrian-detection-adas-0002.xml - name: FP32/pedestrian-detection-adas-0002.bin size: 4660248 - sha256: 249c964cbe38135cc5f2682288978652dd93aa4918e7043f96f894790f11c265 + sha384: 73ae5a4a75e2ab2492d0bac7bd55ac55935f31c25566ebfa121248647f53e9e30f3201d7b959fbda5b002834cdff0711 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-detection-adas-0002/FP32/pedestrian-detection-adas-0002.bin - name: FP16/pedestrian-detection-adas-0002.xml size: 245055 - sha256: 39d623808956ebe550fbf3ef9837cb86dd304169e0eda79cc11ede581a935217 + sha384: 8f3666672c95527709675596fe1a8ce4f6cb0450ddb3ee9a41d46d6dc134c552b2ab35bed5b53bc89d855284ff1c091f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-detection-adas-0002/FP16/pedestrian-detection-adas-0002.xml - name: FP16/pedestrian-detection-adas-0002.bin size: 2330176 - sha256: 693753b7466da913b537016b31e3012f8ce6a885ac0897e3986eeca66d4ef8e6 + sha384: 6d13534345ed4d740eb4569c2b819ecc2e985c2740ec18914e659c9e94b29c35528b5c96162b12d5eb19109a67f9a96f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-detection-adas-0002/FP16/pedestrian-detection-adas-0002.bin - name: FP16-INT8/pedestrian-detection-adas-0002.xml size: 478256 - sha256: 0169dfc7c439f59939ea2c4de487ebeb43f20102c6f6f3800c2b6e6394c260c1 + sha384: f263e7110ffcd392b2c86e6da3c65233928c402a4277b8de935c391c84d2bd8641e7efe45a0cdb4c3d5436226fbaf8a3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-detection-adas-0002/FP16-INT8/pedestrian-detection-adas-0002.xml - name: FP16-INT8/pedestrian-detection-adas-0002.bin size: 1212524 - sha256: 2e77060797f23a539fd41951f566268ad7f0ee06b842b13a149d9d6f744077c8 + sha384: be05116c6ef364c585a6fbf33e2d9fc2caf9f3fe4219296074e73a5488541bb3b519ce24a5896fea1b994be0318c27ba source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/pedestrian-detection-adas-0002/FP16-INT8/pedestrian-detection-adas-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-attributes-recognition-crossroad-0230/model.yml b/models/intel/person-attributes-recognition-crossroad-0230/model.yml index 73342433200..3a5642201c7 100644 --- a/models/intel/person-attributes-recognition-crossroad-0230/model.yml +++ b/models/intel/person-attributes-recognition-crossroad-0230/model.yml @@ -19,27 +19,27 @@ task_type: object_attributes files: - name: FP32/person-attributes-recognition-crossroad-0230.xml size: 190069 - sha256: 871ebc205557431b7d78dacfa12a8ea88718fb83caf20dbc0eb612e814a3e4d5 + sha384: d76a47b0266b2db8e8c094314b89e19396d42bbdca75552fc5798555b4abc33c5e129a5b3a9e5684f18ad4b8fedc4e00 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0230/FP32/person-attributes-recognition-crossroad-0230.xml - name: FP32/person-attributes-recognition-crossroad-0230.bin size: 2939240 - sha256: 717aa86c9eeca18ed49931494c50967559042338203ea69362b73276b51f8a97 + sha384: 7aba696e9770272269e7f43dc3642975e0359abec20ec8e48baca6a588a8974e361a233f35fb8a4a7ac208afc1ed6c66 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0230/FP32/person-attributes-recognition-crossroad-0230.bin - name: FP16/person-attributes-recognition-crossroad-0230.xml size: 189984 - sha256: 9fc783a1234b6700d6f469b86e2d0c8a3f3059e53a07d4bcf34fe92a00296127 + sha384: 674fb2f9cb12cd01fdeb705be73b242bad6386fe9e130678f6a5cb51280444fa50a7efe1d1f1dc5dd4cdf63ecded2d6c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0230/FP16/person-attributes-recognition-crossroad-0230.xml - name: FP16/person-attributes-recognition-crossroad-0230.bin size: 1469632 - sha256: 0834f45ee09fef11fd3774005cff05bf9f14678eb7403a01cdfc0b8925f1ff3b + sha384: a61c55f76ba12feb7e47ca84634fc9e1b3c99c53687f8b0152416f96006130ed24ae2726b24f788ebf4f15530f61f4fe source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0230/FP16/person-attributes-recognition-crossroad-0230.bin - name: FP16-INT8/person-attributes-recognition-crossroad-0230.xml size: 491305 - sha256: 6128b2ff4dfede050da7e59c3eb31dd88b180d026706b79f4c3e6dd2ea074652 + sha384: d09f548bb031643ff5fde2a09cc23c9219f2e9d7cb7e11529f2635aaf3fe2e26dfb1fffc51f0c83dbc417bea2b05e384 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0230/FP16-INT8/person-attributes-recognition-crossroad-0230.xml - name: FP16-INT8/person-attributes-recognition-crossroad-0230.bin size: 753574 - sha256: b53a830c7698304f80c6f14f9fff988c9c87de249ab76fdd4d2a1fe81512756b + sha384: 124d1d7d8cfb0ab470c43a48201792eecce60f5a7770f9d51701ca3976b8b712016a968396ad2d12b9d21e1dd8abfba4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0230/FP16-INT8/person-attributes-recognition-crossroad-0230.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-attributes-recognition-crossroad-0234/model.yml b/models/intel/person-attributes-recognition-crossroad-0234/model.yml index 084d336d966..a2e5602a243 100644 --- a/models/intel/person-attributes-recognition-crossroad-0234/model.yml +++ b/models/intel/person-attributes-recognition-crossroad-0234/model.yml @@ -18,27 +18,27 @@ task_type: object_attributes files: - name: FP32/person-attributes-recognition-crossroad-0234.xml size: 192956 - sha256: 8542a8617816fc5109267ff1129b226be4b9c45ac0d2002f83805e06972269fc + sha384: 1b1974cc36a2e6cc86510b48d682f75bd1424aedbe2d210068fa2314d23793df4bd2d9fe37eb41d3c0ae11c9fa6d22fd source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0234/FP32/person-attributes-recognition-crossroad-0234.xml - name: FP32/person-attributes-recognition-crossroad-0234.bin size: 94040716 - sha256: 54fcac9e5cfbf5f3b9eda31f342af3443c2461eaf49916c3ac8a0a57c3665ab7 + sha384: e08ac2acf8b06f15417ac44e2ed6d40faaddb9ff147ef6c5c64692b10b1aa00e807e3c52769abc7bb37beb661615c5d2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0234/FP32/person-attributes-recognition-crossroad-0234.bin - name: FP16/person-attributes-recognition-crossroad-0234.xml size: 192896 - sha256: 18f2bc8207a49e0d27a8958c4201899ccedb8b47cf106800a59dd2224072dfc8 + sha384: 0eee7f11f4445d438aec71a281121f5f3a5d22a8e638eb4d00dfcd767294b9ea2bf7d3a51e5b352081ee284218bbba85 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0234/FP16/person-attributes-recognition-crossroad-0234.xml - name: FP16/person-attributes-recognition-crossroad-0234.bin size: 47020388 - sha256: 8794458d3d461a0b773abf7a41e51dfdff6140421f7d72dbedcf7e0495a1157d + sha384: ad1bd24fbedd058d72d4a7e77d374b7e1c8532b89330a61ffada0ab2dacc4ff9d2cff22e128d0e0571b35eb67daa78c7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0234/FP16/person-attributes-recognition-crossroad-0234.bin - name: FP16-INT8/person-attributes-recognition-crossroad-0234.xml size: 449259 - sha256: fcaeb416fcde64bdbe458963632a67b10a4419a75ca308870d1031b8a6c520a9 + sha384: ece2e9b754f0f5d080232ff22329eaa8632762d5b34b3cdf842071a1eb2713fcd972bbd3dcc0349f5fe3ad212379a4a7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0234/FP16-INT8/person-attributes-recognition-crossroad-0234.xml - name: FP16-INT8/person-attributes-recognition-crossroad-0234.bin size: 23651452 - sha256: 057ba895b32c1d1bd665528c811c16fb27a71fd14cad5680506b6cdf6a494f7b + sha384: 694dda90a769bdd56beb76844882699f7fb262fcd33a8d20a7bd86bc30f52c0cf5775e6d6a8787591788e947526a095e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0234/FP16-INT8/person-attributes-recognition-crossroad-0234.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-attributes-recognition-crossroad-0238/model.yml b/models/intel/person-attributes-recognition-crossroad-0238/model.yml index 47ee1c75cdd..3bb95353f24 100644 --- a/models/intel/person-attributes-recognition-crossroad-0238/model.yml +++ b/models/intel/person-attributes-recognition-crossroad-0238/model.yml @@ -18,27 +18,27 @@ task_type: object_attributes files: - name: FP32/person-attributes-recognition-crossroad-0238.xml size: 327332 - sha256: a8e55c47be7bc5deb8679aa790b9ad0259da4baa4eaf1539c0c6e763679f19a2 + sha384: dfb1cd96adf0509cc8b0086b017b321cbcf5f6fa3c4b0267e0f0a03d7a310fe9ddc0f9062b8fe59383a07d8638ca0ec6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0238/FP32/person-attributes-recognition-crossroad-0238.xml - name: FP32/person-attributes-recognition-crossroad-0238.bin size: 87188272 - sha256: b2c95309fc053fb31e33146439f60619d4909caad9722829655eb4275f240d27 + sha384: 84b00db26f24e15cdc2fec6dbdccf4a66192ceb29c0b28b8643b0a04404a25b9ff538c65dbaf264610882f1e4307837e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0238/FP32/person-attributes-recognition-crossroad-0238.bin - name: FP16/person-attributes-recognition-crossroad-0238.xml size: 327199 - sha256: 0e4ab7e54a51268c8b21d8740c4e0607345fd3290e6698565244f35b4f4b5643 + sha384: a851346bf3edf0741a5aa93912de3b8fca786e07cfb924e0f43ec59a38bb0fb8570c2e530b0eb0fdceeda8141de5ef9a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0238/FP16/person-attributes-recognition-crossroad-0238.xml - name: FP16/person-attributes-recognition-crossroad-0238.bin size: 43594182 - sha256: 39393eb6282e202566f30dde9d5e93252039fd705cacbe1646324fbe32e195d7 + sha384: 5f994148685dcf0e0710264ab37ebad6bb404e642966ddfc8d10f34dcf42e606cc148a1b55f9dabd1f2b8af61698c9e4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0238/FP16/person-attributes-recognition-crossroad-0238.bin - name: FP16-INT8/person-attributes-recognition-crossroad-0238.xml size: 734570 - sha256: 01e0f7ab3b67aa8d33f490b1f23d269b1eb58cd8435d54aabfd6fcf46114a3c2 + sha384: e8dce714b9906b949530b767245d1c0f701580a090bc7e35485d816a3374cd45120be8f896294bf239ff8651c1c2c8e6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0238/FP16-INT8/person-attributes-recognition-crossroad-0238.xml - name: FP16-INT8/person-attributes-recognition-crossroad-0238.bin size: 21891668 - sha256: 5de3a503b9f5b22d06aa536ecd11efdab2d799adca95a489291f392878b003f7 + sha384: cc86f6c064718bba7d596f812ed730849bff2ff1f760797a8f90ccb092bd2d8be5e79a0a89745c363b759cc5960e7604 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-attributes-recognition-crossroad-0238/FP16-INT8/person-attributes-recognition-crossroad-0238.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-0106/model.yml b/models/intel/person-detection-0106/model.yml index 08c7ba5e435..012f4ad7d38 100644 --- a/models/intel/person-detection-0106/model.yml +++ b/models/intel/person-detection-0106/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-detection-0106.xml size: 1450390 - sha256: c781dfe9a6dd995e28e0d58aa38b611adae8472276f6d30f1975e8868c6a93ff + sha384: bb24738ed7a90527287d34fdd3af932eeacec6ff6701e5bcb5d07730ad086fad8977c2b8e81a3330f1f47a205e7fcc95 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0106/FP32/person-detection-0106.xml - name: FP32/person-detection-0106.bin size: 276501900 - sha256: 2dc12cd86851a177b06f97c5bbd5c00bb0c7524f79ca1749be71b533b4de129a + sha384: 20ef3b23d0a1315f3edb32b771bdae537f227fb3c10b359e4b2b272e8189dcb15ebdd2584653d83e606afe1a03b4bc7a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0106/FP32/person-detection-0106.bin - name: FP16/person-detection-0106.xml size: 1449678 - sha256: d4a9d9f9ea116c55ceee5f963d64fa0651ee09d1e191dfa2e3d977ee72a057a6 + sha384: 0f8930b39fc52a71bf13481c4a08686844b8e279352a9b47c1a0beb3d18835e2b203be4574b5b28823862f91616fdd0b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0106/FP16/person-detection-0106.xml - name: FP16/person-detection-0106.bin size: 138251164 - sha256: a7b6a41125a7c814c181a1896864abf396763150e18b42fac8abbb6ea20f5b3d + sha384: 608070aabee27cbc105935e63708c2b85f35f66981c0bc25e45667e602b279ea1feaf725a3b95681167e9f2783c2bfaf source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0106/FP16/person-detection-0106.bin - name: FP16-INT8/person-detection-0106.xml size: 1781713 - sha256: 95c0fb256223e6a0f34d8b300090e9341db25f1d574713b16a8c9737a3d9fbdd + sha384: 766d2f5cf1d390bf10ee65714fd90c039a6b8a4e32fa32d9e2fa5466b3d8a58eda3f9fed015c7df76cc373ec09af3010 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0106/FP16-INT8/person-detection-0106.xml - name: FP16-INT8/person-detection-0106.bin size: 146371996 - sha256: 8f70df47bac649f5fabe4dca3412d5e7f9b7d9e8a7007d137397b0b0fe906635 + sha384: ab8e8ae498a7ba8ff88b7c3100607dab8f406a01e533fa4ac24f349c333b8c20cdf5d67545f91aff12e5c52e2d10a2f0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0106/FP16-INT8/person-detection-0106.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-0200/model.yml b/models/intel/person-detection-0200/model.yml index 81cd524503b..d06dfd8df9c 100644 --- a/models/intel/person-detection-0200/model.yml +++ b/models/intel/person-detection-0200/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-detection-0200.xml size: 200423 - sha256: 0d9d4259f0fa531bb361519e61d9bbf769c942d92f3d519150d0bc225a9f8464 + sha384: f44db5a2975a8058c015e7bcac356c8084f6bf79518885e706a2b92dfe551ab4a124d70800001845ef5bc4d92bc342ca source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0200/FP32/person-detection-0200.xml - name: FP32/person-detection-0200.bin size: 7269168 - sha256: c44a6e7ddab71fb784c599ab8325c7ccd72c8c0ab1312cd0f93924c9c2c655cb + sha384: d5a49a7a9821600ee8724860e2dcd6c22a1b14b03b238e09eb9f01ebfe34beff422cf2b15eb7d3583cbb3d4bec01aade source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0200/FP32/person-detection-0200.bin - name: FP16/person-detection-0200.xml size: 200360 - sha256: 245039b78fe6c557d8906d65d3537941249982faa00cc51f70f4bfa00bfc5cf6 + sha384: a1ca2881d623f4c111095a6931dd0c060b66feddd38634dc8e5ed2c92f666aec2f76bfc0d0b9f7e97cf19be20a1e31f3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0200/FP16/person-detection-0200.xml - name: FP16/person-detection-0200.bin size: 3634626 - sha256: aba627cdd9c6576cf6e7442191b9663811d327f2ea0ffe113fb77ba07c124b58 + sha384: 3edb6efbcd59d0606d39ae0d7ea25ca93d83ec7ffc16af97186d32e278a738f731f8f347607a388240c9a3fec28a26bd source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0200/FP16/person-detection-0200.bin - name: FP16-INT8/person-detection-0200.xml size: 482309 - sha256: e7fafee6df837c0703f8f8112c907c97f5881adbf18a1dfa5fb644b257eb195b + sha384: ab0f4131ea0a5dd4a9f83b7125be323793d3f6431b4a821ab482f2220dfbfe2c97f765119a24e72ae36f50b9317b2a76 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0200/FP16-INT8/person-detection-0200.xml - name: FP16-INT8/person-detection-0200.bin size: 1921618 - sha256: c2b563daf5b151fbb45c2154c0273bc2906b67e49da9d1033f8223c7c9fd460a + sha384: a937724b169567f0ee3cb91c0cd00ce39b1b700cc05ada14833113587442463f63ee840de5b4430284389e15e6558a7f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0200/FP16-INT8/person-detection-0200.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-0201/model.yml b/models/intel/person-detection-0201/model.yml index f8089fcb2be..4fc6e7db497 100644 --- a/models/intel/person-detection-0201/model.yml +++ b/models/intel/person-detection-0201/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-detection-0201.xml size: 200612 - sha256: ff65eb7bf275c35142ba4a9978791a8d464691d8b12f3072ac321ce792389f32 + sha384: 432dc5cb62264a1686a43632a28adde1d9cd0385cf1aec402b9b85488a8e6a4b0c767f0c577df5edf01bb49ff59c8d44 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0201/FP32/person-detection-0201.xml - name: FP32/person-detection-0201.bin size: 7269168 - sha256: e21fc97a9a28310a096a3ca6c29674f35e99016e7fcc0d5d80bce15747fdf5f3 + sha384: fc215ad9d88f2fd4af97b06b4b3025565bcd04c4f981f50631ef213328f8da880be5c784a80f3b94180bbf7db176fa84 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0201/FP32/person-detection-0201.bin - name: FP16/person-detection-0201.xml size: 200549 - sha256: 3ebeffb6ee8eeabf6182dc939c80e96462de1712047231f39fae59ed62776715 + sha384: a459efd8fa31a3a9419743d385cba9ce328a0df1781eb49a58ada070fb0e1e04e31f370bbf7cd287d08f7759c47d0d54 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0201/FP16/person-detection-0201.xml - name: FP16/person-detection-0201.bin size: 3634626 - sha256: 81ec4d0c1219ec7f00e17102c86900e4253776227137f15e12cda8c7e7994aec + sha384: 5ee11d3d5cfd360e47e146ab158a1235f88c0d03d203c442b7e49e004eecb629dd7275d30c4017aee08e6136267a8054 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0201/FP16/person-detection-0201.bin - name: FP16-INT8/person-detection-0201.xml size: 482538 - sha256: 37c8ef5494bee22aeff361a098a9948e21db49ff04add628c23668feabf9d845 + sha384: 58aa31e979e601609e05586b9cb63dfc0a9561fa8a1babcea1d13fbc246c1fc59d0efc95d3c398677d20dd8e2106397a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0201/FP16-INT8/person-detection-0201.xml - name: FP16-INT8/person-detection-0201.bin size: 1921614 - sha256: fdf8ed46ece486cc215992c70bd0ecdaba71648e3e87a56e76a5897bec21448f + sha384: 4e8b3bb3d1805e1b935f085511a68be9c9f48e309d37a008990aa0315df5833c5662f85e72d221d790655ac683a4abad source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0201/FP16-INT8/person-detection-0201.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-0202/model.yml b/models/intel/person-detection-0202/model.yml index 80df8878c5f..554f206c7ca 100644 --- a/models/intel/person-detection-0202/model.yml +++ b/models/intel/person-detection-0202/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-detection-0202.xml size: 200694 - sha256: 3f05a4204ddcf8ca7ad7ec3b863c547bb7ba73fd13f77954484ddc7b70eef8cd + sha384: 847ae840e8c780ac1fe4557ae93041e11cf752eaec3c9efb0e5172b8b7eb82a13cc8ff284308abb04d4b52cbc56574c1 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0202/FP32/person-detection-0202.xml - name: FP32/person-detection-0202.bin size: 7269168 - sha256: 51d95e643733d2a11ad830b954f8c3cc9e15c08ffab796be0c96c37e99e27e83 + sha384: 02f39b83f9cbdc5f4bb8e44d5570e6e1f4148cfac4355e114c68d6f83b929dbca027e44cf7063da487942ddbe3bafce8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0202/FP32/person-detection-0202.bin - name: FP16/person-detection-0202.xml size: 200631 - sha256: 9824b75826387941dfed131f483d0745881b916df48d4bc143325bb828cdadce + sha384: 6f1f379fad8256d6743fae2890fafcfeb26d61cf7300deace3a0c12fbafe439c0bd0e68a28018427dbe28450ed6b8508 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0202/FP16/person-detection-0202.xml - name: FP16/person-detection-0202.bin size: 3634626 - sha256: c82526a14d4c3c2d4c04e06e1173f573374fb5a2a97393b926f96adbff7b345b + sha384: 1f3033bf448786aa7239f49b5eecca69f08787e04d7ba8e37ce9413450178a4aaf8b5f090c8a9155b629319167de0c5d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0202/FP16/person-detection-0202.bin - name: FP16-INT8/person-detection-0202.xml size: 479635 - sha256: eedf3a2a80a23b4ff7b59766a31152ba5ad4bf7339650ce0b9dfed66f54da21e + sha384: a9e8fe34b58f4391fec7489323bb75f441d63c9e0a81ab1095b81409e561ce051927c5bac3ec4fbd99c2389281754ac9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0202/FP16-INT8/person-detection-0202.xml - name: FP16-INT8/person-detection-0202.bin size: 1587028 - sha256: ca18e8e681744dc4be5c56017617626893184ae6758ebeddd19a17be8566581b + sha384: 0743b95413c17b159e65640aeab841dbf52b86b250dde8562e5b8676e1f289ebffc3ef65f95414738ba0f5fced3f3210 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0202/FP16-INT8/person-detection-0202.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-0203/model.yml b/models/intel/person-detection-0203/model.yml index c172aad05c3..964d95e9eca 100644 --- a/models/intel/person-detection-0203/model.yml +++ b/models/intel/person-detection-0203/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-detection-0203.xml size: 1270918 - sha256: 52af5e82a7b1fce4fea6cd3544172b84bc799afc2d6f865050c0bc8d4375a984 + sha384: a9d557c6fa3e552895a0433e85a72a66cf774d0da4a1f7450d93a72ad69c7c447b7b8458e9d1010b9e3373ce9f616374 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0203/FP32/person-detection-0203.xml - name: FP32/person-detection-0203.bin size: 7804628 - sha256: 1ccc07ef6702756b368de97083ba29d367826b315d1872730ab37048d50dbafd + sha384: 46845765fb29bd214d0e6c5b5024915652b095e0e2833e061c97d0ad65ec5f27d682c78731f1a50584e1bf55cfa57e6c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0203/FP32/person-detection-0203.bin - name: FP16/person-detection-0203.xml size: 1270746 - sha256: 4f2f85b5dc610b32135135558658803bde67c50af894289fd3ede89e45a6d111 + sha384: b87d29b4f9be012ca5264e9f18c31fb497e594ce18c3baa6f1ad635cbae586dc27b6754d76f175808bfc0dda8337dd94 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0203/FP16/person-detection-0203.xml - name: FP16/person-detection-0203.bin size: 3902536 - sha256: fd1fa2e5352c6fe7de0e96c0b271d82b35e486d2e762ac99d18f7572ec5f7794 + sha384: ab8f7f800e701e616838db164fb521ec3d8db5f4148569d0925458b5353866e5c213e09c4e6e5d5d947725be2b98f46e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0203/FP16/person-detection-0203.bin - name: FP16-INT8/person-detection-0203.xml size: 1827991 - sha256: 517f5d59450712754ac41ee0f855518f2f54070b813bd4ef021ee2a3381ae346 + sha384: ccddba6bbdf513d66b5ee1b78e7a4331184b29fcb5125d0e81836ca9d52f4e46bc79c1a0a385f21127ad473e22174db7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0203/FP16-INT8/person-detection-0203.xml - name: FP16-INT8/person-detection-0203.bin size: 2053626 - sha256: f34491fe1942d789830e6c1e82e787dba4aa62c8a2d62b0179740fc259420830 + sha384: 0ae93e7db22ba3068047fb20c75876cb6c34716b6ca28aefd21dd38e28d6528357e22603cfab0670beb31a7c9a9a61b1 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-0203/FP16-INT8/person-detection-0203.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-action-recognition-0005/model.yml b/models/intel/person-detection-action-recognition-0005/model.yml index f725b5f121d..5bf2bb2ebcf 100644 --- a/models/intel/person-detection-action-recognition-0005/model.yml +++ b/models/intel/person-detection-action-recognition-0005/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-detection-action-recognition-0005.xml size: 707400 - sha256: 528bb6194d2ddff5b4c5537739b0dddf660c7224b745ee36d6c1ebc72ba2e6b0 + sha384: e5540277fc08d7bba03dd652cb49d549c39871159635110b4e0e5a5bc261b8bb66d5fe9c6e347951fb0c73ab0002e00c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0005/FP32/person-detection-action-recognition-0005.xml - name: FP32/person-detection-action-recognition-0005.bin size: 7800360 - sha256: 0342b34bcc8f18d45938f479345aacf18c017cc073cddd362bda9dbd1c5cc4f2 + sha384: 36aa2b7f15b3a5960bd7369e6981bb2256507fed9a42ce1ca9a53d03ae9a48ba72bf0219ea76a91c309e9feef8688043 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0005/FP32/person-detection-action-recognition-0005.bin - name: FP16/person-detection-action-recognition-0005.xml size: 707156 - sha256: 6a2fec3c5576775c4c03bd2a274a18cacb9cec1ed1439c21edb111465fb75afb + sha384: 323ddb0bb97cdc354b25ad82517f673f6e1c335d7cb2fb424ac24734c78533654c0e15e15a3ff7477fa6bc39efd34289 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0005/FP16/person-detection-action-recognition-0005.xml - name: FP16/person-detection-action-recognition-0005.bin size: 3900234 - sha256: 812b93201c96df615f8f881e3d464728027c61c6e1c0042899e728534c988e8f + sha384: d74f201413724f289205d7a623492ef2f591c6a0df08307ade843f8e7aef43ff8736868e59e384c20055c51dea40144e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0005/FP16/person-detection-action-recognition-0005.bin - name: FP16-INT8/person-detection-action-recognition-0005.xml size: 1949791 - sha256: 589ad9837710fb8e638dd53dc9dba4b469ccf821c7489795403e6ffc010b7d92 + sha384: e63ce32bc01ce38b73b4150765cf5a6c73127b9ed2263e239b85d7984da8d7e1bed8c557940224d58fb882af79cff30f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0005/FP16-INT8/person-detection-action-recognition-0005.xml - name: FP16-INT8/person-detection-action-recognition-0005.bin size: 2055112 - sha256: 839465b00ea1d1138f5b77226117b8b321386248344fd02e5af504b1830ea7ba + sha384: 9a9505db6a7f8314ea64d248a19a5577c78fc49d27d7632adaaee2cf39fb9b560df1d9d12e5db03efef5100467f2d29a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0005/FP16-INT8/person-detection-action-recognition-0005.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-action-recognition-0006/model.yml b/models/intel/person-detection-action-recognition-0006/model.yml index 2c20a4944c9..ebff3c6ee1f 100644 --- a/models/intel/person-detection-action-recognition-0006/model.yml +++ b/models/intel/person-detection-action-recognition-0006/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-detection-action-recognition-0006.xml size: 862995 - sha256: 1eb52afef77ac448232568b110cc1a624c6c4eef5278e88150a510a9b7190e7f + sha384: e31d4931c74172a527bb769d949b4fb0e2de831ba7147dd45e9dba48d8a4be6c6f7c2cec93bd0bee9475a3de95f55991 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0006/FP32/person-detection-action-recognition-0006.xml - name: FP32/person-detection-action-recognition-0006.bin size: 7458348 - sha256: ed55f9f7f04c5d2ccddd3bfeef1176d0492247608f977de9b5126066e2a7594b + sha384: 80aae816b96ec8fe06c0c7ab5b5bc3d5806f61a5d094800b6eb021740ee0931c34c7f180eea2bf3538d676c58d59b0c8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0006/FP32/person-detection-action-recognition-0006.bin - name: FP16/person-detection-action-recognition-0006.xml size: 862754 - sha256: cfcd1a4912ce1c2fcfabd062e86f5c72c362b85f344f8d1d3f43972368fcc3e8 + sha384: 7e2b2ada7a2275507f6eb34fc983c9ce31e5c35eb5c888dda705d42103564d98017a6b89e7783faed60d0845b2b69651 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0006/FP16/person-detection-action-recognition-0006.xml - name: FP16/person-detection-action-recognition-0006.bin size: 3729220 - sha256: 875d4d7a11e0f0c4c21c64f874251226ed50fd13621a2a2a6fef85e1f98f8af4 + sha384: b81ddbbe914cbb0815428c362d3c664401ff58a648e43f4a9caafcc8b147d2d86ca9bedf32c2d46d4e415a8e59e5c8ae source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0006/FP16/person-detection-action-recognition-0006.bin - name: FP16-INT8/person-detection-action-recognition-0006.xml size: 2219124 - sha256: ecd79a4409039e40298f13bd25aa067179030315da157afe2aa9e281a3014301 + sha384: 2bc91f497d159968bbd12d043f54ac32375e0ab39f7d86210654f7f46768d29c40009dccf0413dc88c16cc85e28b71ac source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0006/FP16-INT8/person-detection-action-recognition-0006.xml - name: FP16-INT8/person-detection-action-recognition-0006.bin size: 1982770 - sha256: d34937a095d57405e0c85557b335d1f0967f866ca55175084e77e82c248c062e + sha384: aa8dec743a1116483738fed5fec190fbf6aafc265dd0c775ce2c83ef53d0c2b35a22349173d996a6d4013cfdd018d9b3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-0006/FP16-INT8/person-detection-action-recognition-0006.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-action-recognition-teacher-0002/model.yml b/models/intel/person-detection-action-recognition-teacher-0002/model.yml index c5422f8ea49..e70cde04826 100644 --- a/models/intel/person-detection-action-recognition-teacher-0002/model.yml +++ b/models/intel/person-detection-action-recognition-teacher-0002/model.yml @@ -19,27 +19,27 @@ task_type: detection files: - name: FP32/person-detection-action-recognition-teacher-0002.xml size: 707408 - sha256: 1e6e2d4908dbecea9ebee5ee04646df3e4c0deb8ddcc8beaa2e6e347470f38e7 + sha384: 3b91813d9e2f9f485b9d9763a5adea5e7d0e064ada191fa8086972e8bdbb71bd035b3327442266d09139a214579d21d0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-teacher-0002/FP32/person-detection-action-recognition-teacher-0002.xml - name: FP32/person-detection-action-recognition-teacher-0002.bin size: 7800360 - sha256: 850532bec62d86aa0fb5bb10a1da9f5a80b111c758cdb444356404422f49bca4 + sha384: 71ebd437ed9e4d2b91dd49bcada2cc58b8772f7f4f911c69746d0f209e36d7e14fad450e4d6a944c3577312cf648e4ba source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-teacher-0002/FP32/person-detection-action-recognition-teacher-0002.bin - name: FP16/person-detection-action-recognition-teacher-0002.xml size: 707164 - sha256: 7097e4b17668de35460a8a66d6c5b33f34849c2e556724644544b66506a2c717 + sha384: 1fee57b9c17389400fb1a03f64cf07143799a2560717b855917f46a03680a149a47d7e992dc5bdf52e44ae27d8a4df2e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-teacher-0002/FP16/person-detection-action-recognition-teacher-0002.xml - name: FP16/person-detection-action-recognition-teacher-0002.bin size: 3900234 - sha256: 949a9fe70ce00b7fcfb1440815129e3543e173ded2ed3b0470d060ab73d31dfc + sha384: 54af2b0962fe3152160c07af8590a6fd5fac80e40ef1576a7668433988a14ffcca2cbf06993632fc777da7354dec6820 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-teacher-0002/FP16/person-detection-action-recognition-teacher-0002.bin - name: FP16-INT8/person-detection-action-recognition-teacher-0002.xml size: 1949822 - sha256: f12df4e865dda7fe5ff8022bb25e6d12e15dbbf76174cee1989147e9e8fd6cdd + sha384: 93896c4dd2a7759a7e5eb37d1778aff4d712acb230cf1d5a904787659007fe6adeac878c9f263ca2394ad3044380119f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-teacher-0002/FP16-INT8/person-detection-action-recognition-teacher-0002.xml - name: FP16-INT8/person-detection-action-recognition-teacher-0002.bin size: 2055068 - sha256: 3f74b190bdb86e2352a5ed9bd02e21e8ecdaac7a61b53dee92477c9e8b616f7c + sha384: 2f822911f38d56f7001a6ebb8377eba035c73e51163b3c7b381e8cee48b6a6d038624ff1eb463cd6eec9a18f286593cb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-action-recognition-teacher-0002/FP16-INT8/person-detection-action-recognition-teacher-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-asl-0001/model.yml b/models/intel/person-detection-asl-0001/model.yml index 9aa07380d36..cc648325c7a 100644 --- a/models/intel/person-detection-asl-0001/model.yml +++ b/models/intel/person-detection-asl-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-detection-asl-0001.xml size: 1016377 - sha256: 1b6c7254ae2a6302273980f1631fc141385060efae31d90dcac82522f4a11a47 + sha384: 7161073f6a5d7d7a9c85118cd10abf5a2d466fdf717b1c37635b66f4dd3ae7fb8e78835a9793a44ad14026bac8ba383e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-asl-0001/FP32/person-detection-asl-0001.xml - name: FP32/person-detection-asl-0001.bin size: 4026304 - sha256: 00aa84e1af2de5d971871f788946e3fbfefc6b930f7a990c032f9c8dde468367 + sha384: 93a88e414311757538e0bf0652c3cdc1013137cc7cc5f4e2b954494e11176bb905ae62f818ff0fb4f64ade58c3a3366a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-asl-0001/FP32/person-detection-asl-0001.bin - name: FP16/person-detection-asl-0001.xml size: 1016222 - sha256: a1159f22ee49f21027e3f6bec931829724aa72c349d772a41b5d2bfecc2caf29 + sha384: 6e6c8e63a68d3761102b597c2e0184ae8f657cfabeae626706f5728bee1f26199b49eae6fa8c62ecd9da3b31aeeca5a7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-asl-0001/FP16/person-detection-asl-0001.xml - name: FP16/person-detection-asl-0001.bin size: 2013336 - sha256: 62205884238d01d83c1e9faf5e1d4fe99b87dcb2bd3081ba0acb108f3be890f1 + sha384: c3daaca936d19e7282f0aa949ca8e42efb80ec7cb90cfb46f1473cd2cea7ea7f48f2841ce8331512a1427d98a2594c4f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-asl-0001/FP16/person-detection-asl-0001.bin - name: FP16-INT8/person-detection-asl-0001.xml size: 1581814 - sha256: 8d66642e3158c72d811a02686072ef0468d32923ce88923e3641218d3eed7ef2 + sha384: 6eb03c5b82c1fcf0d771c4303fb9df00a512c2f32f8fb0e4fd5d7c2fc9235f2f3285ae2590f826c85a4472fcfc7921e3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-asl-0001/FP16-INT8/person-detection-asl-0001.xml - name: FP16-INT8/person-detection-asl-0001.bin size: 1055666 - sha256: eee6679787bc9910b5c711034e28392b035248381881815ad6ce94aa82aec102 + sha384: fe1f63b73aa2eca383c66f1abfedb5e072b66c4e8b78266f81cd3dd63d2b49106a73c8ba01154aeb9fc1a53a4e67f072 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-asl-0001/FP16-INT8/person-detection-asl-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-raisinghand-recognition-0001/model.yml b/models/intel/person-detection-raisinghand-recognition-0001/model.yml index 5c508ba4d4f..86f8c3e354c 100644 --- a/models/intel/person-detection-raisinghand-recognition-0001/model.yml +++ b/models/intel/person-detection-raisinghand-recognition-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-detection-raisinghand-recognition-0001.xml size: 707405 - sha256: a8d6a74c14a7d4709633c24005022c7b41d9140576fec636f5dc2561d968aa54 + sha384: 92f25cf7f8531a4cdb8e56a5a1f11ef3a2f9e09c4f2619bcc9e7e3021f2d694f9c6253d14388a04fa8136e77acc33d5f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-raisinghand-recognition-0001/FP32/person-detection-raisinghand-recognition-0001.xml - name: FP32/person-detection-raisinghand-recognition-0001.bin size: 7799848 - sha256: e449a68363324cd15adc4738e7ae4c16920b7564444f98c1da8a82e90183a0ae + sha384: dd7106ca149b42b8a995842fac18d7c3ca89bce8bb1de0235f2a1c3c306858cdf92571f8d726c24f3c792edd93763538 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-raisinghand-recognition-0001/FP32/person-detection-raisinghand-recognition-0001.bin - name: FP16/person-detection-raisinghand-recognition-0001.xml size: 707161 - sha256: ecbdf9606a3df17aa91ed29a0e08a30ab7fd9d3cbe837d578f439225938ca74a + sha384: f74cf09d0335231c454fd3aeee6124542b6cf60c79816ef0a42f58c97e37e881301f1378bec2623008dac271573cd1b7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-raisinghand-recognition-0001/FP16/person-detection-raisinghand-recognition-0001.xml - name: FP16/person-detection-raisinghand-recognition-0001.bin size: 3899978 - sha256: 5ed448a746d083eaa65290306a18362fe191f931725707fdb3ad6386361c3cb9 + sha384: 0527ecac1b503953ff7655cde7428a164a44c961c44cb769cfb28229b411282302e4e834904092205ab56ee64a7ff0a7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-raisinghand-recognition-0001/FP16/person-detection-raisinghand-recognition-0001.bin - name: FP16-INT8/person-detection-raisinghand-recognition-0001.xml size: 1797554 - sha256: c6c75d13393bf7822aada90e2bab27be3733007b4b61e0eb0f8d099a756bd737 + sha384: 54d0ce6f85f08e41d98abe51c866813116d81bbce1d0f4108080ec072ce2a4cf48bacc2f24689cbe11e263ec86fc1eaa source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-raisinghand-recognition-0001/FP16-INT8/person-detection-raisinghand-recognition-0001.xml - name: FP16-INT8/person-detection-raisinghand-recognition-0001.bin size: 2054944 - sha256: 0c5a333e4991835eca6029e33931a0084d65d878c4e3a3f952c977559b0484a1 + sha384: 9ecb0eada22d8738b1eb359d2983c2cbc0851bfcd8f359fd79fedc0584580a75137c2bafa54d66e7757953b9b14591c8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-raisinghand-recognition-0001/FP16-INT8/person-detection-raisinghand-recognition-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-retail-0002/model.yml b/models/intel/person-detection-retail-0002/model.yml index 5ea0f6fc254..ad675cc9715 100644 --- a/models/intel/person-detection-retail-0002/model.yml +++ b/models/intel/person-detection-retail-0002/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-detection-retail-0002.xml size: 285234 - sha256: 8ce6673827de9a535909921ff556740d0c9f2de745c1680593a1778e7def4878 + sha384: a8c4c8ee9ad2e94e70b9e6978afbcd64d228811db23502eccb6dc82dfe226bb65d3dc049063bd2253bffea772359325e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0002/FP32/person-detection-retail-0002.xml - name: FP32/person-detection-retail-0002.bin size: 12976100 - sha256: 8150eb7ea3352abb272276deb3ce64d0414464e9f4bf02739ec4f2770b8acb75 + sha384: 1caf321bbb4f4e8ac2f6ecbd1e184938a3fa4fe8d2a04ae8930e4467590a14fc6e6c79942903ae729a6c647f842d4758 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0002/FP32/person-detection-retail-0002.bin - name: FP16/person-detection-retail-0002.xml size: 285111 - sha256: 6110b27dd28249cc31d47edd71f08b8f0085005832d2de40b9e5394d298171a9 + sha384: 100e0f0b41c5e31ac0b8313841030d0bd7c03b0260882a458a46dafdd0900d061b512c82c658e7a1e048c58a41bced74 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0002/FP16/person-detection-retail-0002.xml - name: FP16/person-detection-retail-0002.bin size: 6488130 - sha256: 32008b134ea50eb70a4f97d74562a0a2c542d3c30f19a5d7ef1b57e8615d7039 + sha384: 3db936c591df3125df3a541b0d2d94ac2b63564d7680851c095dd6aceea92af7638d4af965dd9a04a00e5b8f55c06d19 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0002/FP16/person-detection-retail-0002.bin - name: FP16-INT8/person-detection-retail-0002.xml size: 720318 - sha256: 6955dc0672f85019957b3f6c27e7e1a262928ce31a535d307c89b64ca5b55ac3 + sha384: 68eb2b0941cffdd993b19c012785ac0bdfc66c17a78c7b60d6bf6fe0c3cb02d4359be59d5717dfdc0cbcc9047d2e6449 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0002/FP16-INT8/person-detection-retail-0002.xml - name: FP16-INT8/person-detection-retail-0002.bin size: 3298354 - sha256: ee3239eee4e038ff269866863c4f3684543048029464b378d4a7c500eb7ef8e1 + sha384: 8f737b7d7741c10deab8f78cac69589775c1ca2a70fc6de319a2e87c9e5009f387238d779988eeb47d63f6c4a6c52c73 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0002/FP16-INT8/person-detection-retail-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-detection-retail-0013/model.yml b/models/intel/person-detection-retail-0013/model.yml index a83c2b15883..753311a2329 100644 --- a/models/intel/person-detection-retail-0013/model.yml +++ b/models/intel/person-detection-retail-0013/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-detection-retail-0013.xml size: 382996 - sha256: 1d41bac670ece033c5be9c5c3025e3c61080b6e36f32019ef68c654384a2542b + sha384: cf011606b06e5f293ab572715225d6f536077c32c35296c54d8d0bcb9f6a92695a7960a6cd8deb15b89641ef71045406 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0013/FP32/person-detection-retail-0013.xml - name: FP32/person-detection-retail-0013.bin size: 2891364 - sha256: 6f09cb7061328942f9d5e9fc81631a4234be66a26daa50cd672d4077ee82ad44 + sha384: e26fbd0ec879ea7de5338e7cb4b3607128a4b9c690e07c17c9ee89d3a5c686e0e9d1d05b8654f08ff227435d8c6e8169 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0013/FP32/person-detection-retail-0013.bin - name: FP16/person-detection-retail-0013.xml size: 382841 - sha256: 21f3e382674f1587d2677a97f25e7e1555b8b6f90fec036d752daac086c3183b + sha384: ac4e5f267cd91b7254487d7e7effde4bbbc56f69bd66fabd017c55fe8a7675009255bae12315caef61e0e33cc78fbb29 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0013/FP16/person-detection-retail-0013.xml - name: FP16/person-detection-retail-0013.bin size: 1445736 - sha256: 56eeccbeb3f27144046edacb95b459d60f3930f54051ef5b9e5253923c07b672 + sha384: c6c66dcb8e24b5d87c553477ecd006dc679ece3ec03137b079e0fe3084b4acda2fc570330d6dbc6844dbbc03f289106e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0013/FP16/person-detection-retail-0013.bin - name: FP16-INT8/person-detection-retail-0013.xml size: 971255 - sha256: 9ea547535cb9120af10bee5474d559b9f7f656bd4397349cdb798bd6af7c1593 + sha384: 1f05b6971a5e742e39beacc1dd5a51fe68c6675cf26c2204351e3346a014f16b0b42c6540082b7da2cc49c7458e5c03d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0013/FP16-INT8/person-detection-retail-0013.xml - name: FP16-INT8/person-detection-retail-0013.bin size: 770360 - sha256: 68f0bb364e3642912d2f8bbfb8bba89e4c750a4f81b7abd3a110ca759fb6b24e + sha384: d022f70657a423618edc9998b48c77f4fb88d85dc2c1d0ec6ac88ec17af738217076549286fe424afdf1af81e1e4c767 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-detection-retail-0013/FP16-INT8/person-detection-retail-0013.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-reidentification-retail-0277/model.yml b/models/intel/person-reidentification-retail-0277/model.yml index 8ae8b10c007..5b9cff87be6 100644 --- a/models/intel/person-reidentification-retail-0277/model.yml +++ b/models/intel/person-reidentification-retail-0277/model.yml @@ -18,27 +18,27 @@ task_type: object_attributes files: - name: FP32/person-reidentification-retail-0277.xml size: 573033 - sha256: 22d6e13c6ba856416e23ab033bfde051c6e89696d21be2a7e98670d90a6140b4 + sha384: 1e41950f7dc353ea131a29ffd3586e40933984b9b5bab67b64ce1f4a4cf140469f353f96b64a6fcf03085fdce25cf488 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0277/FP32/person-reidentification-retail-0277.xml - name: FP32/person-reidentification-retail-0277.bin size: 8357560 - sha256: d3f1959a6c6411ff3b24246f9e4b5c1510a827f3f51fb56143bc8c399853ac92 + sha384: 72f904eb6d7a93c258937c42f840390c40375053c0a0c9462db8e72ae285529fcb3af0b7ff0bd1cec7a749ab835e41a2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0277/FP32/person-reidentification-retail-0277.bin - name: FP16/person-reidentification-retail-0277.xml size: 572915 - sha256: 6663176b9e908c52e3392b881651fff6ccfea8c7ba2558135134b90c975e92c3 + sha384: 7d57fc4e211b739316164d9417e6bd0dd254e3af14e1864086142ccb7c75f06e1a355f5416816ecb1786138e26b4a88e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0277/FP16/person-reidentification-retail-0277.xml - name: FP16/person-reidentification-retail-0277.bin size: 4178812 - sha256: f809b4a16f6105d69eaa8c709894d0103064fe5322c333cde763fcab09d1647e + sha384: 05aa0bc7be2f7121f38e8c26105797b6dae966cf5d44eed89cd16af3d81937447cd9dfe8e07f149f09f4b64982a079d9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0277/FP16/person-reidentification-retail-0277.bin - name: FP16-INT8/person-reidentification-retail-0277.xml size: 1449896 - sha256: 59514c514b452050939fce539be9aaa2cfc6f76016098ef1a3fc73cb62554fe0 + sha384: 917d7b5c128c7ed4f0f63633c5654a39350dfeb183adf1a7883e49ff7cf421ac422ca807f9704cbd843da912fcdcaf19 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0277/FP16-INT8/person-reidentification-retail-0277.xml - name: FP16-INT8/person-reidentification-retail-0277.bin size: 2201582 - sha256: bd4d2b2d1eec968c2cc2975df417e38b953c542f9ca6326e274e87bf5ad7b2fe + sha384: 1ca76d99f894ebc7347951c128008a9a2c0313dda9938554a56107c9c1160ba052a3a6963c0245efcdc22b98274fc054 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0277/FP16-INT8/person-reidentification-retail-0277.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-reidentification-retail-0286/model.yml b/models/intel/person-reidentification-retail-0286/model.yml index d2cb9899d6a..d56bd442824 100644 --- a/models/intel/person-reidentification-retail-0286/model.yml +++ b/models/intel/person-reidentification-retail-0286/model.yml @@ -18,27 +18,27 @@ task_type: object_attributes files: - name: FP32/person-reidentification-retail-0286.xml size: 572273 - sha256: bb191ac080e1f902236d3bb301c0596f26d683692090e599d1e0cd6b8253ade4 + sha384: 22f4ed1319d8dc3fc17683794e1d3ec024401e2f194bc4591c3313ccb89bc41cc997b3c66a9b1a415307f69fbdeb5911 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0286/FP32/person-reidentification-retail-0286.xml - name: FP32/person-reidentification-retail-0286.bin size: 4905116 - sha256: be19e341eeb0f0fc7651ab87be521efbbc387d81898b86b6e2168930b4776211 + sha384: 13e4ad7def9e200af035c655846609aaa311cc540af86d4a6073f917abcfafa93feb170fdcdf0bb889c780faa60aa8f2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0286/FP32/person-reidentification-retail-0286.bin - name: FP16/person-reidentification-retail-0286.xml size: 572088 - sha256: a4d0d80f3045af4d18998c703a331483b20e0820568ad328a45613c176968762 + sha384: a2d7ae21b62ff75f8164310e6688cd74adf20b2a033b9ceb7b0841b34ba8464b5915e7f7d939255b2222f35e8df683d2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0286/FP16/person-reidentification-retail-0286.xml - name: FP16/person-reidentification-retail-0286.bin size: 2452594 - sha256: 932b00afe4dabc559b2a431a7e1b5adcb52ab64a48453ebdd995213e44c70f3d + sha384: 0e24cbbd346ade3957373a63b61d500f33aa30f831c16aa8a09b483d95db66828a33be30e48845b90f976677bc6a9602 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0286/FP16/person-reidentification-retail-0286.bin - name: FP16-INT8/person-reidentification-retail-0286.xml size: 1447924 - sha256: e153becf45a013aea068ab24cbd48b7ef81131bfefe69a966387588f5e02c84b + sha384: 2bae2f8ca8e33b2c1d843b2945ef038d7ad1e32ab766d7b97c3a6d8db3f06748e1517a5e9e4ea07ee8e594556f9a469a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0286/FP16-INT8/person-reidentification-retail-0286.xml - name: FP16-INT8/person-reidentification-retail-0286.bin size: 1311266 - sha256: 0ee557caf365042ecfaf906f9f31e114b3a51739993923dea635435db958b494 + sha384: f4844b2415bea1e62289fce565248f3d44f481cde0b1bd4ec0323642d7e106d3c2fb4effe9597837b70ef66f36d48b69 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0286/FP16-INT8/person-reidentification-retail-0286.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-reidentification-retail-0287/model.yml b/models/intel/person-reidentification-retail-0287/model.yml index 2baf14698a4..ee5487c3ff9 100644 --- a/models/intel/person-reidentification-retail-0287/model.yml +++ b/models/intel/person-reidentification-retail-0287/model.yml @@ -18,27 +18,27 @@ task_type: object_attributes files: - name: FP32/person-reidentification-retail-0287.xml size: 572188 - sha256: e1e583d2b6c37257c1133e2836b184078bd468cca7479381b873f519a92486d5 + sha384: e6406234a4b60873a64fd8040bbf88c5bd34ddaa288ffb35187e5847a7bd6a9fecfca48e047822f431f02ec97809252a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0287/FP32/person-reidentification-retail-0287.xml - name: FP32/person-reidentification-retail-0287.bin size: 2362196 - sha256: 10cdb177152f2d7629f78dff0a523c4b04ecb1ddf096dece3dec2b9f92031ce0 + sha384: 9b69111320fea37b8da122f259354425fc86694854c14721d2e4bf9bc2c2c69d983f9acf0e22f46b9793ac356270b8b3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0287/FP32/person-reidentification-retail-0287.bin - name: FP16/person-reidentification-retail-0287.xml size: 571871 - sha256: efc30944e5d2fad1ea2771148c5cb5591fff85534f131bfb1444b994669a301c + sha384: 8d3b6b361bee42ce668859986638c657abb75b99ef4a52bcbd41d32b069d68590ce1b6a1a5479f1af31307f965e7441f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0287/FP16/person-reidentification-retail-0287.xml - name: FP16/person-reidentification-retail-0287.bin size: 1181130 - sha256: e4e49935a94975081ce410ba52dc67b01fec6fd326e6cfece3545e9fe78e196b + sha384: 0fa762c24000263aa867cfbee7651d68d32e8020a5d89f7889d0a766ed756b7cf21cfc0419fdc1183b1f1deeba3f0fe3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0287/FP16/person-reidentification-retail-0287.bin - name: FP16-INT8/person-reidentification-retail-0287.xml size: 1447358 - sha256: e904ea56d03088c75659433a60b9bdd42e4cdc7d9f2f206015af1aeb13cc48ab + sha384: 41e634d28e693cd66cfbae0f8609bfd4600b45e7279bba52d58c61e0495d5a4cb1d1515df5848928ecc5cc8d6b7c3f82 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0287/FP16-INT8/person-reidentification-retail-0287.xml - name: FP16-INT8/person-reidentification-retail-0287.bin size: 647530 - sha256: 25ebf0d2fca208e4bfcf62957b838314ee3f0ce483d8b8b71cbc8f4bf168f810 + sha384: 623c1d2d3e2cd6a882dc7bc4204f5e77143d81635e729c114099e884183718d59677fd957713e05490aeb6d535ded3ce source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0287/FP16-INT8/person-reidentification-retail-0287.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-reidentification-retail-0288/model.yml b/models/intel/person-reidentification-retail-0288/model.yml index ee97e06b278..715847c246f 100644 --- a/models/intel/person-reidentification-retail-0288/model.yml +++ b/models/intel/person-reidentification-retail-0288/model.yml @@ -18,19 +18,19 @@ task_type: object_attributes files: - name: FP32/person-reidentification-retail-0288.xml size: 571633 - sha256: 59652440ca5c2dc67a20abfeb66b5e2497644c4f463ea5a9079b36f5bce021f6 + sha384: c37bb53b5c535d516719c6f90157b3b88cdb9103957f2a25fff82e41b7c1393d7b56e43b71120f83e8bb7e9e1a3b6efb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0288/FP32/person-reidentification-retail-0288.xml - name: FP32/person-reidentification-retail-0288.bin size: 728120 - sha256: af7c8cfd585292ca319e8828b8e6bcfa4ccde415b2049a080158ae6013cce648 + sha384: 58b3715a3138c5ff16cb3027ae09ac26041857b127292783da37ba598f6b37602895335b687e4e406930bc8d4dbd2b26 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0288/FP32/person-reidentification-retail-0288.bin - name: FP16/person-reidentification-retail-0288.xml size: 571438 - sha256: 8808a213b83fcac3adca378c74e916058a59d5ea2e89f987afb5d01d08506aea + sha384: d84071e53e92c3672076d98f5260b6619aefd4e7bcde8c4283f79bed3f78ab02ad9fa39f0bc74a14913c9447ecd60f8c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0288/FP16/person-reidentification-retail-0288.xml - name: FP16/person-reidentification-retail-0288.bin size: 364104 - sha256: 76df9fe3e18c90bb282677cc0b051165f4f76ebbe0908ef2b1e41a5572901dd9 + sha384: 3473e599658614cef8e37713e86dd02f9f1c54f2ff52e09e99a0c950a3442e38c548c0d827a1450565507bdaf08e953d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-reidentification-retail-0288/FP16/person-reidentification-retail-0288.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-vehicle-bike-detection-2000/model.yml b/models/intel/person-vehicle-bike-detection-2000/model.yml index e5627be513c..32c850c9933 100644 --- a/models/intel/person-vehicle-bike-detection-2000/model.yml +++ b/models/intel/person-vehicle-bike-detection-2000/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-vehicle-bike-detection-2000.xml size: 200461 - sha256: 7eae5a292edb1f59e37656e98d56b70089f6dd19f181dfb07f9eac5ea2a98d24 + sha384: 999e6dd3faff4da201103371f25013a57cd04076f49e64bdc247e2a277126a40353879d86fbada1e0e84f1d8abdf3d7a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2000/FP32/person-vehicle-bike-detection-2000.xml - name: FP32/person-vehicle-bike-detection-2000.bin size: 7285112 - sha256: 765e81e9ed490acdaa24d65e1124946b0254cb392717a743774cfd493d3e5fef + sha384: 48e38d99835259df617ce55e4a0eeba8e19b7bfe7ae2752cc228926336222e459d0a4da4629eea0ec6e8361e21dff224 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2000/FP32/person-vehicle-bike-detection-2000.bin - name: FP16/person-vehicle-bike-detection-2000.xml size: 200399 - sha256: cce93611ff07aceea0c07c20faa42caec5ee1837eb558a36e7509fc5dacdbc8c + sha384: 8595565dfa30e2493ca85c72a4131ae7a754286c12bdcb4e7437e0ce1da23e161b6023e5c1466c3f966b31d70d39e259 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2000/FP16/person-vehicle-bike-detection-2000.xml - name: FP16/person-vehicle-bike-detection-2000.bin size: 3642598 - sha256: c64141e1f48ac75c5a4b1bac40b5400fdac8c4aaeae386eae73bc2bc9168c312 + sha384: a0e3f342b6877781e8700ebc5217cc1a772a32b0f16227d8f6c5834a32bfc3dee22f34720c03e9cf4554a7c9d9005e1b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2000/FP16/person-vehicle-bike-detection-2000.bin - name: FP16-INT8/person-vehicle-bike-detection-2000.xml size: 454058 - sha256: 29ea3386b56112e54a636f52bf3ccd5d40430421ba9703097cc5989a4e4bfd94 + sha384: 0594fe4cb3142b6ebd73f83895840670319d6f37fc1f8f42fbdbe760e0a15924481a0bab02188aae8a487345d59eb0e6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2000/FP16-INT8/person-vehicle-bike-detection-2000.xml - name: FP16-INT8/person-vehicle-bike-detection-2000.bin size: 1932488 - sha256: 9aada313d051475fa0e6dbfff2301d35d03ff5e510b8c78a78134383bdb81b17 + sha384: 2e2208aeebbcf1b0ccff4c09ea5954e572771270d5ae4358424eae9b3d582951bff2309e2c39511962799c6f1f217331 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2000/FP16-INT8/person-vehicle-bike-detection-2000.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-vehicle-bike-detection-2001/model.yml b/models/intel/person-vehicle-bike-detection-2001/model.yml index 4a9bb8603ab..32ed1697fe8 100644 --- a/models/intel/person-vehicle-bike-detection-2001/model.yml +++ b/models/intel/person-vehicle-bike-detection-2001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-vehicle-bike-detection-2001.xml size: 200654 - sha256: 978f2b0da9238ff2d4fc09b22342544d6fa2adfbb9cee772e36d9e595f7a0dd8 + sha384: b00452bf0c3bd927a182f924e8ec48c22ca0810d0810c2dba1447957468864b8a708b608bbb25895a039b918aceb0401 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2001/FP32/person-vehicle-bike-detection-2001.xml - name: FP32/person-vehicle-bike-detection-2001.bin size: 7285112 - sha256: 3c91bc0b7013ed9d4b077f4aefb0c5929776ecd34f7e8906e4bf1dcedf48eee7 + sha384: 194b3585d3f24e4aeba9c0873d3b16c7a39945f63810add14bfd91ced537bcf7afc0548f1be159fc388024fa37c37702 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2001/FP32/person-vehicle-bike-detection-2001.bin - name: FP16/person-vehicle-bike-detection-2001.xml size: 200592 - sha256: adc7c4f8f57ba1c9175989275146180641aff40b92f68098e3fa28969d2ddad3 + sha384: 60deb4599d89d301c9fe59086d4fe9c97d191cb422f5688e80d34f9c3119e947b2bf5984a3b9726eafbf6414b2d90c11 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2001/FP16/person-vehicle-bike-detection-2001.xml - name: FP16/person-vehicle-bike-detection-2001.bin size: 3642598 - sha256: 1e3089a94f70387281499594b9b769d4c0a64d1fd158184e7a04a98f031fe4fa + sha384: a2f845c675e9bd75410114abcad1f89d7e7f72d7457d28a22f1c764ec879e9672d2be68fb0d51fb02284206c93a76985 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2001/FP16/person-vehicle-bike-detection-2001.bin - name: FP16-INT8/person-vehicle-bike-detection-2001.xml size: 396681 - sha256: 6b5ccf5655a2b6c6efbf4f8bd8d72b12799ad531772667cb819d14dacb827b63 + sha384: 687f6e9dbf460278fa449db942abfe4359a4106b01c8e8d595fd91642ca3a76586e39bea2f47a05416876d05d0cf6f5f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2001/FP16-INT8/person-vehicle-bike-detection-2001.xml - name: FP16-INT8/person-vehicle-bike-detection-2001.bin size: 2097373 - sha256: ca67eeee73886e22bbade40eb7d20e53e6c7ac6874290d4026b10dcf7216786f + sha384: 89cd6d08fe2573a05174a10ef2629199af7f3261cc9843eee4ea8562590230fe9ee65033d9de886f6fe28a47d9aeac86 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2001/FP16-INT8/person-vehicle-bike-detection-2001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-vehicle-bike-detection-2002/model.yml b/models/intel/person-vehicle-bike-detection-2002/model.yml index a4e03d6fdf2..4bf295f3682 100644 --- a/models/intel/person-vehicle-bike-detection-2002/model.yml +++ b/models/intel/person-vehicle-bike-detection-2002/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-vehicle-bike-detection-2002.xml size: 200730 - sha256: 0c933a414afecf5f2df76650bc760907bb65a4014ea033d83a8877f17e77d585 + sha384: f6ab86e3993261df6743f9ea485cbb0dd29fa9db039e32111d82658fa9be5d604a4d8d46b9c301336d820b689fa4c83a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2002/FP32/person-vehicle-bike-detection-2002.xml - name: FP32/person-vehicle-bike-detection-2002.bin size: 7285112 - sha256: 2bf525c551a9a0625bfe7f2fc462b1c1f4bb1218d06472b03c9424d0dc2ea684 + sha384: d248f123c0904b526d185b8baa5106367e9cf4cd8c84f668749a2b9175231a99e309074e3deedc85d08f8d0e7e103e2f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2002/FP32/person-vehicle-bike-detection-2002.bin - name: FP16/person-vehicle-bike-detection-2002.xml size: 200668 - sha256: 5f5488628a13174de038adfa766b44f061b60779b91b1bbd60d67f41bdcea8f4 + sha384: eb9cd13a29d1c964fd1ca75940899b62dd77fac35f9e87685283ed324bc5da57ff2cb54b6cebaf9dbcb09247c95c920a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2002/FP16/person-vehicle-bike-detection-2002.xml - name: FP16/person-vehicle-bike-detection-2002.bin size: 3642598 - sha256: 5f1d98f95cdf46dab234d70754a6e8f5b3d770465f8050b9643e3c4fe4bd22d4 + sha384: ff9d4dd213693b56d324ea4e67f0d386b177550b2bf9bcc112424991df19a90f75998866c57b0dedec324cbe325da6fe source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2002/FP16/person-vehicle-bike-detection-2002.bin - name: FP16-INT8/person-vehicle-bike-detection-2002.xml size: 479369 - sha256: 2f37b305068e026c5a246c04f756cde4a4bce2b8beb942dbaeedb5c4b993db5a + sha384: bb743db60229aee72fd892115ac7184382d42b15ee0b83ed83449c347edae26701310f0dfd76cb0c0d1b4b7b782cb6dc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2002/FP16-INT8/person-vehicle-bike-detection-2002.xml - name: FP16-INT8/person-vehicle-bike-detection-2002.bin size: 1290337 - sha256: cd91476962a106ca9447dcf6e61ab3d1ace0e4208d6ee90227cd476b9a5b934c + sha384: 3a20877c5871d1b0c2efe4604cc9eae8af8f98cce5ff39f0d65ea2ebcdc99bd1d0b908417f8a10859239ff409655772d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2002/FP16-INT8/person-vehicle-bike-detection-2002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-vehicle-bike-detection-2003/model.yml b/models/intel/person-vehicle-bike-detection-2003/model.yml index 7397dcdec7e..dde49c785ae 100644 --- a/models/intel/person-vehicle-bike-detection-2003/model.yml +++ b/models/intel/person-vehicle-bike-detection-2003/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-vehicle-bike-detection-2003.xml size: 1298136 - sha256: 58ec99dceb3e1e889330126f07c37f92d90054c5ac6fc8d89aa76f0280d312c7 + sha384: d3445634db157b0222a31408b2ab969b8ab48087570a40d5b956e6f5b46f3e5b05de93406f650b530a8d4a917df23a78 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2003/FP32/person-vehicle-bike-detection-2003.xml - name: FP32/person-vehicle-bike-detection-2003.bin size: 7811564 - sha256: e5f2f410119b6ef7f0964125c71731c4f00ddc464a56e493004b6e97c745f924 + sha384: d70950d55be7eae22d9f989f5388119ab7b8521cc190da20eadcb8e47fc74271e45fdbcc18a517cf17fb321162683c80 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2003/FP32/person-vehicle-bike-detection-2003.bin - name: FP16/person-vehicle-bike-detection-2003.xml size: 1297964 - sha256: 916c6079ec6ab1c99b2b9a65d64a89c03885b6142916086b2cdfe0969c28efca + sha384: f9ab6d097b4098af9cb642acbc90d2b182f3d38c8cc4ea76f22bf4d645f3e283bc89b679c012f04c0ff8723915ce81e8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2003/FP16/person-vehicle-bike-detection-2003.xml - name: FP16/person-vehicle-bike-detection-2003.bin size: 3906004 - sha256: 3f99483cdc8090c38d39dc9fe75ed26692224797ea72c376a8ee082dd1e92dd4 + sha384: e92caeb7a2996f5ef974138b4fa10055ec0baf651f743f5fbffac95257ac5fd2e92fadd1d3cb02e23fa54d22bfbd62a7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2003/FP16/person-vehicle-bike-detection-2003.bin - name: FP16-INT8/person-vehicle-bike-detection-2003.xml size: 1859739 - sha256: d02b2e6cf49fd78d455fe1baee37ce5cf764e8952a9eba06df58bbc59baef285 + sha384: f44983fd513055aa1026c92daa1ad16c81926080a3da73fb873223936911c773b0906c3300e9e6f6fff9b997a36e9388 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2003/FP16-INT8/person-vehicle-bike-detection-2003.xml - name: FP16-INT8/person-vehicle-bike-detection-2003.bin size: 2055446 - sha256: 0bcd133dbec3cb17ac5f9756d8d858a5c3ba023a654d86e9a5496d007560bec7 + sha384: 22fd1a174a704c4742fea07ba72df33753927719df81e6ca80a804343975c286014392975807790c4b9a3152a1c3061f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2003/FP16-INT8/person-vehicle-bike-detection-2003.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-vehicle-bike-detection-2004/model.yml b/models/intel/person-vehicle-bike-detection-2004/model.yml index 2b443ce20de..d4a2b58a9b7 100644 --- a/models/intel/person-vehicle-bike-detection-2004/model.yml +++ b/models/intel/person-vehicle-bike-detection-2004/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-vehicle-bike-detection-2004.xml size: 1296909 - sha256: 1a6beb3dd7f42960636e4eebad9046abc9666a340058745c04dffa9f129546a8 + sha384: 4068510f2d5bce04b440d4a576062a861d364163bdd7b6a72c3d66ac31db5eb69bf541a2ac0ec7e81221d831a55a6f32 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2004/FP32/person-vehicle-bike-detection-2004.xml - name: FP32/person-vehicle-bike-detection-2004.bin size: 7811564 - sha256: b9670aeea2b738fcaa36d3a399b45bb131a8990b7fdd3b864d8bc993fc1781e6 + sha384: 2256a40e90f9c0778dae01187ebc5abaf9eb6ebc4c88352bb12ce7b0212b943f8a299061139ca1586bc1e45266824f43 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2004/FP32/person-vehicle-bike-detection-2004.bin - name: FP16/person-vehicle-bike-detection-2004.xml size: 1296737 - sha256: 4600662a26bb34c828a12942cbc37a4d4b55d99ee42f4c28070cf39a273b9c17 + sha384: 8c61102021677d0e02e185356e494bf9552ece535d2a80cd2d76f65e695518627462009cccc245dc1b0a3842b455d1a0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2004/FP16/person-vehicle-bike-detection-2004.xml - name: FP16/person-vehicle-bike-detection-2004.bin size: 3906004 - sha256: b49072fef26ccb5d7d8fd3a64a3d8938c9f938510e2c391ca697bde54bc8fc9a + sha384: 4b7fe5676e3593411b259c26c6384682b1ead9bde50acc935cd00294442bee61dcc4ef38140c19c5c4d00d56630b9109 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2004/FP16/person-vehicle-bike-detection-2004.bin - name: FP16-INT8/person-vehicle-bike-detection-2004.xml size: 1858288 - sha256: bf4f244d8e308e81f995c7ead3e644bb369acc1e650e8d8d1a96a9a0ba4a2da0 + sha384: 63a0c6a797455fb5ed505fd723b26e6936b3d8e85f33412dc2432b8962165e216e20cdf3b8c59b56c3b4edae792c8e45 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2004/FP16-INT8/person-vehicle-bike-detection-2004.xml - name: FP16-INT8/person-vehicle-bike-detection-2004.bin size: 2055438 - sha256: ebeedb8c98a43fed577aac85749c04ba4e29001874cc53ef4448fcbbfd037bf3 + sha384: fd28f40790051abf63b7ddff5bb22a974988c6452d7b56f46b623868f1be944e8fb47fdc60ef63cf1b57bc9dd89e67f8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-2004/FP16-INT8/person-vehicle-bike-detection-2004.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-vehicle-bike-detection-crossroad-0078/model.yml b/models/intel/person-vehicle-bike-detection-crossroad-0078/model.yml index 83b295d75ae..217c9a01d74 100644 --- a/models/intel/person-vehicle-bike-detection-crossroad-0078/model.yml +++ b/models/intel/person-vehicle-bike-detection-crossroad-0078/model.yml @@ -20,27 +20,27 @@ task_type: detection files: - name: FP32/person-vehicle-bike-detection-crossroad-0078.xml size: 381374 - sha256: 47b8c773b2c6b753626a1e414c10521c33fa49577d3831b761d176e9ef0bee96 + sha384: 70b10a6fe7a5c7c791aaffde5998e3e0f8a4d6c6c56a327e9e115dd3fcbc86ee0e144001918a9700a52cea85a11c48fd source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-0078/FP32/person-vehicle-bike-detection-crossroad-0078.xml - name: FP32/person-vehicle-bike-detection-crossroad-0078.bin size: 4713980 - sha256: 178e05f0635b0ee35b577a9dd31ea6da2a2a842635793f1ad18907d00f3a966a + sha384: f0c205b70420030d701583631f21d8edfd1a611b9806d7440c231f8b9a0358a31a194f0da3e6355eced4b31af68c8ad8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-0078/FP32/person-vehicle-bike-detection-crossroad-0078.bin - name: FP16/person-vehicle-bike-detection-crossroad-0078.xml size: 381204 - sha256: ba311c4f044f125dea942200765f058360045c5aa261d8a5e31be1f677a383da + sha384: 6e2db79fa89019cbf922afb7be6573cfae1d32013df4660a32f375a34dd2f06e76aab4b3fd6c1796f3cf14e11f735c20 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-0078/FP16/person-vehicle-bike-detection-crossroad-0078.xml - name: FP16/person-vehicle-bike-detection-crossroad-0078.bin size: 2357042 - sha256: a074ff0cad298ed9c35d0ce6ed58e09ee05216b907c97e6bb50f1b77a046bcfd + sha384: 2a88f518fcf75987ad065fd35d95e30af824b9168d9aba4b1b9a0eb0f97eb6a4ec1995fc5c603c5ca23afe2f5510dbab source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-0078/FP16/person-vehicle-bike-detection-crossroad-0078.bin - name: FP16-INT8/person-vehicle-bike-detection-crossroad-0078.xml size: 1082089 - sha256: 3bfbd02ea0b29383408757f53e5ca4c867d2707ad9d77dd198424142346c4fd1 + sha384: 563dbeb9c8d4d38c5cf6fc5fde137978e8d1262fca2a6cbd97003e58625c5e464edf3a08485c869c102590ff2b1faa5f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-0078/FP16-INT8/person-vehicle-bike-detection-crossroad-0078.xml - name: FP16-INT8/person-vehicle-bike-detection-crossroad-0078.bin size: 1228693 - sha256: a4f012de1ed47866f0feeb98c779dc2206f6811234a1ae93434fb0853ac6736a + sha384: 1f5d5d3663455e1134e7840b731e74844aaed8ebd87af2789574d578207d91262e89e73dd116d29979eb65fafca1bcf0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-0078/FP16-INT8/person-vehicle-bike-detection-crossroad-0078.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-vehicle-bike-detection-crossroad-1016/model.yml b/models/intel/person-vehicle-bike-detection-crossroad-1016/model.yml index f5aaa74d9a5..d3248ceb9b5 100644 --- a/models/intel/person-vehicle-bike-detection-crossroad-1016/model.yml +++ b/models/intel/person-vehicle-bike-detection-crossroad-1016/model.yml @@ -19,27 +19,27 @@ task_type: detection files: - name: FP32/person-vehicle-bike-detection-crossroad-1016.xml size: 226808 - sha256: 8f4cd557062d06e8bc8a56e1ece77b8901c1b4d1b043ad789cfa98fe84f15a8b + sha384: a4aa57c8baa6a68b939fdae300ac919c10e5709ee70bda1d7749bb21a858b6aa29a17482f5d443b21315216c21189c0a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-1016/FP32/person-vehicle-bike-detection-crossroad-1016.xml - name: FP32/person-vehicle-bike-detection-crossroad-1016.bin size: 11547984 - sha256: 9fe2f12857921c8a3705ac586677c4a01bce8f6187086855615e067e9ee4f441 + sha384: eaf13dd5e4dc4e9dd62a906436cda443603d76c123f7aba9cb6a2d6a4064500dc2ea054584c3df9eb487bec59ace4af3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-1016/FP32/person-vehicle-bike-detection-crossroad-1016.bin - name: FP16/person-vehicle-bike-detection-crossroad-1016.xml size: 226695 - sha256: a91c216f9d113c791bfd18df11754bf1071d1a9832e3d3f078c84274eb009bed + sha384: 1fb40d030bc9a836fe29042c5064ec7d8c06a1a3e0a4426dc41a7c656f504b4e21c248f256c616256cdf8a4b3223aa5e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-1016/FP16/person-vehicle-bike-detection-crossroad-1016.xml - name: FP16/person-vehicle-bike-detection-crossroad-1016.bin size: 5774034 - sha256: fe54eff5ee188117b4c38a82b3a684e5699f0cfa09d1fafb7db351726b8d32b8 + sha384: 86d74775d2dbb5de2aadd3ac1fd896f6c9bccf62e1aa96993e6c1f05d1e9343b0401957f0ecf5a4246eb0bb5f4a51f6b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-1016/FP16/person-vehicle-bike-detection-crossroad-1016.bin - name: FP16-INT8/person-vehicle-bike-detection-crossroad-1016.xml size: 539155 - sha256: a2c0041142d1264be24a532d759687e0eb4961580407b9349709f110aa73e814 + sha384: 9d690bc61b2020cb9353e83d72b3698f6abc31a9d8323ab0934a6b40d5a77645fa441c7ec269f26b392623410dc20a7a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-1016/FP16-INT8/person-vehicle-bike-detection-crossroad-1016.xml - name: FP16-INT8/person-vehicle-bike-detection-crossroad-1016.bin size: 3024898 - sha256: 6ce0b7a1e819bfa9c11959d2dc739d1160c9450fd723c94b37cd7ccae2100dbe + sha384: ccf8800fdb4d24ae2ccbdf90b1675eccc0dfcbf36d34372d4135d7a082348efa7d1e59b4638d8e1c5d13782dbd40d9dd source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-1016/FP16-INT8/person-vehicle-bike-detection-crossroad-1016.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/person-vehicle-bike-detection-crossroad-yolov3-1020/model.yml b/models/intel/person-vehicle-bike-detection-crossroad-yolov3-1020/model.yml index 6c258e110bb..f5dd98e8229 100644 --- a/models/intel/person-vehicle-bike-detection-crossroad-yolov3-1020/model.yml +++ b/models/intel/person-vehicle-bike-detection-crossroad-yolov3-1020/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/person-vehicle-bike-detection-crossroad-yolov3-1020.xml size: 281150 - sha256: 6ed810e182ebcdc0dcf7fdcf723dbf6ed477fc291eab12f9557b23f8d99e3758 + sha384: a16cddc7a11e27ed68bceeb203b9379181fd1729bf1a39f896862b11ec52f6ad453577b8312e8c1fa3df8699955c0429 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-yolov3-1020/FP32/person-vehicle-bike-detection-crossroad-yolov3-1020.xml - name: FP32/person-vehicle-bike-detection-crossroad-yolov3-1020.bin size: 247688456 - sha256: 16eae6d44861b9ec6d7181a5b9b83b26ab072f7e42a0857c6ab5d352ef7d53c6 + sha384: 71f72f63da3e52256c8429f70b488f5a33efd2d331ebed5d3b0ba54508cae85d0cd3b045bd7c1347f2a315062663826c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-yolov3-1020/FP32/person-vehicle-bike-detection-crossroad-yolov3-1020.bin - name: FP16/person-vehicle-bike-detection-crossroad-yolov3-1020.xml size: 281055 - sha256: 4cc0cd78d7ad833608e1eb3a023e9a3e5f593719a3d1b880ba3b5e1f71c4a094 + sha384: 3ae82536813f60c23076513d5b11fb493e87e50350232112ec759952ad51276a42629a1751c552c4e4db7682d1b7d284 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-yolov3-1020/FP16/person-vehicle-bike-detection-crossroad-yolov3-1020.xml - name: FP16/person-vehicle-bike-detection-crossroad-yolov3-1020.bin size: 123844294 - sha256: cf3c34eaa235685ee5fdd4fb63ff281820ac60f4ce1980eacc0eee68ffe0869d + sha384: 336707edfb3e1e592571a508ea003ed0d749d99d0b91c0967157ab70af14859591d8246171f53912a019950f8ccd1990 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-yolov3-1020/FP16/person-vehicle-bike-detection-crossroad-yolov3-1020.bin - name: FP16-INT8/person-vehicle-bike-detection-crossroad-yolov3-1020.xml size: 630267 - sha256: d0889dfb7c624f8cca83abac1aaccc867147b5cc83933f162775ca55cca7b049 + sha384: 7d1a223146f3a2d4b1144965c9de320bf71f30e0666be14ae4d8cd3de40d559aa77c39f5b5ad690c9f0b5600c44d5582 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-yolov3-1020/FP16-INT8/person-vehicle-bike-detection-crossroad-yolov3-1020.xml - name: FP16-INT8/person-vehicle-bike-detection-crossroad-yolov3-1020.bin size: 62057678 - sha256: ed3afe21ce64c83f3d1bfe34d6c349bc39ac8910a551aa37cf06afaacf598768 + sha384: 87a5464d3d3cefaf52a03ae92d3d5409a791b7ddc5bb688634865afb396014ce379ef14c06d12c71f48b15a088e0863d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/person-vehicle-bike-detection-crossroad-yolov3-1020/FP16-INT8/person-vehicle-bike-detection-crossroad-yolov3-1020.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/product-detection-0001/model.yml b/models/intel/product-detection-0001/model.yml index 972ee3ea1c3..2b07e81df16 100644 --- a/models/intel/product-detection-0001/model.yml +++ b/models/intel/product-detection-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/product-detection-0001.xml size: 323305 - sha256: 042dd5c526b60f7c76c60c4fa969e40d7f0ef597f670a47fc80ca58c4dc64969 + sha384: 731c73f3cef19694238ae8a0c7ce6c1e60cc7c6ebe78d5ff8cb01e1fe65da2f767be75e5643e2c8b087f71f69debee99 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/product-detection-0001/FP32/product-detection-0001.xml - name: FP32/product-detection-0001.bin size: 12850024 - sha256: 49a49dfdbff2f7a794fcad60e872fa2e2b3f95c1f12e33fd49b975f3fa91439d + sha384: dc3e6fa2805627a6b96a4734a899bee296e6e7feed419764b7264deb4d686a29cc25730fbc1309456ccc1f77957bad49 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/product-detection-0001/FP32/product-detection-0001.bin - name: FP16/product-detection-0001.xml size: 323127 - sha256: a217c33a208d61606b1b18f8481fc29c6cc832b4c7abc622d7336494cccfc19a + sha384: 525bd3f072620785415bcbe5649564f75e3fc3db6525592fffc1fd29e4f131873d1e0f350f67220fc4f59ec146f2b58d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/product-detection-0001/FP16/product-detection-0001.xml - name: FP16/product-detection-0001.bin size: 6425058 - sha256: 4952708beb67fb5c8ea97f28358045a31d358af22dd0b82431d649b2ee4e0f95 + sha384: 5e1c57999d4dc26c6a097b97af3a698f38664ecf96455253683536444853843f9e9615f17f7ec8885894136a59070fd8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/product-detection-0001/FP16/product-detection-0001.bin - name: FP16-INT8/product-detection-0001.xml size: 716994 - sha256: a79257a7fc5d560d76969d4403caee174cbeaf9823aea77b8e311465a55e4cda + sha384: 2dd5695452d68bf0fc5c7836ac281f8266fb42525b2bc45f3ae884ff7be801c01c20d5bf008e1583055f75659e632fcc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/product-detection-0001/FP16-INT8/product-detection-0001.xml - name: FP16-INT8/product-detection-0001.bin size: 3364170 - sha256: 4fd5a44c98a68bb7b46cae5020c1ac94272407b010d615b02290dc918f23b936 + sha384: 44dabe31d4e9907f3506556a0baf61bee1e1167fe1f1ff2ff81571368e2ca73bdb1b74667e6b9d814c6b06ada0299096 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/product-detection-0001/FP16-INT8/product-detection-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/resnet18-xnor-binary-onnx-0001/README.md b/models/intel/resnet18-xnor-binary-onnx-0001/README.md index 97adde82504..ba96f69a680 100644 --- a/models/intel/resnet18-xnor-binary-onnx-0001/README.md +++ b/models/intel/resnet18-xnor-binary-onnx-0001/README.md @@ -37,7 +37,7 @@ It is supposed that input is `BGR` in 0..255 range The output is a blob with the shape `1, 1000` in the format `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ## Legal Information [*] Other names and brands may be claimed as the property of others. diff --git a/models/intel/resnet18-xnor-binary-onnx-0001/model.yml b/models/intel/resnet18-xnor-binary-onnx-0001/model.yml index 66f077f6f31..75b0ec2a90f 100644 --- a/models/intel/resnet18-xnor-binary-onnx-0001/model.yml +++ b/models/intel/resnet18-xnor-binary-onnx-0001/model.yml @@ -18,19 +18,19 @@ task_type: classification files: - name: FP32-INT1/resnet18-xnor-binary-onnx-0001.xml size: 103162 - sha256: fd7c1791bc4b7deb88a0651b97af839bc87f135d5f6799e964065f81cdd3cee5 + sha384: 0f81610cfff20a91e8a4f7caacc9ab90a2b786ad0ef7c8bb876c68a9e00c04d23cf3a7042c10e921ac70e5fc8a305bdf source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/resnet18-xnor-binary-onnx-0001/FP32-INT1/resnet18-xnor-binary-onnx-0001.xml - name: FP32-INT1/resnet18-xnor-binary-onnx-0001.bin size: 4190944 - sha256: 810f1b27051c187daa34dad9898104edaf2808aff0ffd1fb482c08df5c743860 + sha384: ded916dd2f4915c08fa1cff7b2a0c44ccb37515a5858e8134862808d032e262d6bcd8212650257e97f0b86e83aaf914d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/resnet18-xnor-binary-onnx-0001/FP32-INT1/resnet18-xnor-binary-onnx-0001.bin - name: FP16-INT1/resnet18-xnor-binary-onnx-0001.xml size: 103138 - sha256: d84559e859079b3a2033d2e269226940ca559b0a851a3beb6e4f22fc11616ebf + sha384: 82b503e28562483daecaa843c499b12d660272c1f045d36c1b9afc1755825251879f29d8bdd44f6ae5ddb8730f6aade6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/resnet18-xnor-binary-onnx-0001/FP16-INT1/resnet18-xnor-binary-onnx-0001.xml - name: FP16-INT1/resnet18-xnor-binary-onnx-0001.bin size: 2782084 - sha256: 031e74abeddc9330a052d7b6719bec8d620263c5dd37f15f51fc9883726874ef + sha384: 3780755d60d1a6ca62ed971b0b223f5db2bb7f42c0fdfd3cd0f168e6e977b99d00d4d854ac21bb6692b7354310b62da3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/resnet18-xnor-binary-onnx-0001/FP16-INT1/resnet18-xnor-binary-onnx-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/resnet50-binary-0001/README.md b/models/intel/resnet50-binary-0001/README.md index 1d894ce6576..d341d6a2f8c 100644 --- a/models/intel/resnet50-binary-0001/README.md +++ b/models/intel/resnet50-binary-0001/README.md @@ -40,7 +40,7 @@ It is supposed that input is `BGR` in 0..255 range The output is a blob with the shape `1, 1000` in the format `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ## Legal Information [*] Other names and brands may be claimed as the property of others. diff --git a/models/intel/resnet50-binary-0001/model.yml b/models/intel/resnet50-binary-0001/model.yml index dde4f175052..0130bfb914e 100644 --- a/models/intel/resnet50-binary-0001/model.yml +++ b/models/intel/resnet50-binary-0001/model.yml @@ -18,19 +18,19 @@ task_type: classification files: - name: FP32-INT1/resnet50-binary-0001.xml size: 243387 - sha256: 144c78e8208a4cc3f25af857854bc46baade92ae39743a8eb787829a7875387c + sha384: 563cbcf87a60e5865f2e44bc0e942be13d64d7715572daddf22c429526a3ca6cb9b462ed38640c89c3fb5baaaf01601a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/resnet50-binary-0001/FP32-INT1/resnet50-binary-0001.xml - name: FP32-INT1/resnet50-binary-0001.bin size: 22112984 - sha256: e1b2cd17644699369284e7a0c6113b0ae1d6411ddca6ceba2423a4cbe139072c + sha384: cd1b5da6852e14d62daf6223db87799bd722651f46448164f61a8a71041956cad8a5897339d1714154523cbef1843a27 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/resnet50-binary-0001/FP32-INT1/resnet50-binary-0001.bin - name: FP16-INT1/resnet50-binary-0001.xml size: 243288 - sha256: 47d990e905281145cb8ad8f308d8033067d84b54181c4041afab7b255c8c0940 + sha384: 6113d30f0f72cbb6930332d16361955fa72067c11e84db1ef62301da89dae2747d5e942e7ab4147ea39368321956c430 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/resnet50-binary-0001/FP16-INT1/resnet50-binary-0001.xml - name: FP16-INT1/resnet50-binary-0001.bin size: 12348792 - sha256: fcc76148a770e81bfbb3c2af30397ee54a52532bdbc97c3bd5a29e9f7836ba58 + sha384: bf03f7f722af21afbeeb315218d3d311a8a0a64780e3e122f45ea78a7b4c21d75f79c972b80f5244d21607934d63530a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/resnet50-binary-0001/FP16-INT1/resnet50-binary-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/road-segmentation-adas-0001/model.yml b/models/intel/road-segmentation-adas-0001/model.yml index 644bc353850..ada93bfdb9f 100644 --- a/models/intel/road-segmentation-adas-0001/model.yml +++ b/models/intel/road-segmentation-adas-0001/model.yml @@ -19,27 +19,27 @@ task_type: semantic_segmentation files: - name: FP32/road-segmentation-adas-0001.xml size: 401509 - sha256: 700f0691a10ef665e7af0c19823f521a58022cd03d55080fb884049709f4ee4a + sha384: 4ef4d0946949829b615766977fcab52459f1fe1012459e2c1110274208c748c01650a003a09557c75dfd5d8c74ea42af source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/road-segmentation-adas-0001/FP32/road-segmentation-adas-0001.xml - name: FP32/road-segmentation-adas-0001.bin size: 737192 - sha256: 3c1847f6f62ed91b8ca2d94b4242b833bfcfb9be6dfdb007e83d13084fb15e0b + sha384: 79f494aff63c53e76692aa14b7d5bf7df8cb8dd0c2e815dd5136c0462ba33e8604fc67424d47ba560b80b6b45d53e16c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/road-segmentation-adas-0001/FP32/road-segmentation-adas-0001.bin - name: FP16/road-segmentation-adas-0001.xml size: 401354 - sha256: d59b147705a21c3e37c2e1890ac9e4cbf40b67bd3896887dab8d9f41efa6f213 + sha384: 2d0848ee5233402af72e8edd3dce48b14281f7a7a37e55f6da17757931613e43990d419fec602e8a93b0fad5b7e3b728 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/road-segmentation-adas-0001/FP16/road-segmentation-adas-0001.xml - name: FP16/road-segmentation-adas-0001.bin size: 368620 - sha256: 056718eb78682a144eae1b037c7dba84f4f30013fca193fe83263ee3cda10bad + sha384: 776b06a7b1d83ff4e0fd670b6189a71dda77c0f6ab6d4efb2a371a965fb026ea3fb47ad918c9a85cf658745adce857d3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/road-segmentation-adas-0001/FP16/road-segmentation-adas-0001.bin - name: FP16-INT8/road-segmentation-adas-0001.xml size: 1114191 - sha256: 3f51da777e4060ece82a6cbd096dde9d4b1861ac265580e24fc70f96dbfd9a0b + sha384: d7666e74bdafd067544367a7c385fc84b0ba90063882abf3dd848910d2d7e4f3651a56a605e05c953960e0ba7af4c99f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/road-segmentation-adas-0001/FP16-INT8/road-segmentation-adas-0001.xml - name: FP16-INT8/road-segmentation-adas-0001.bin size: 188927 - sha256: 8587472ff5a457f20f6d6cb84c9785ded88d1122f6137dccfb121c5f6629a846 + sha384: b8cc16cd85f320b853cfc1777f0f3a36b12331f74957e106e305fecb9569a33891aad5797424a053fdc17250a1e63d83 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/road-segmentation-adas-0001/FP16-INT8/road-segmentation-adas-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/semantic-segmentation-adas-0001/model.yml b/models/intel/semantic-segmentation-adas-0001/model.yml index ff7be91397d..4d3b2f83dfe 100644 --- a/models/intel/semantic-segmentation-adas-0001/model.yml +++ b/models/intel/semantic-segmentation-adas-0001/model.yml @@ -20,27 +20,27 @@ task_type: semantic_segmentation files: - name: FP32/semantic-segmentation-adas-0001.xml size: 214195 - sha256: 80a9fc172a69fe90df011e04c92ec7de56e87efa3881a36f9d6db785be348096 + sha384: 856f3c9d4d033ce190d667d93940868160e691b65d636e09201590923aeda10b25354691d0d7ec8ff1a03f4e33d7d655 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/semantic-segmentation-adas-0001/FP32/semantic-segmentation-adas-0001.xml - name: FP32/semantic-segmentation-adas-0001.bin size: 26743556 - sha256: 44065ad7c7116ca4ef3cda9940fe7f04aaf45c61e30d2c2ae9b04b175b27a29d + sha384: 7b1bf43cdd4b12c3f86d88e98407be64113720e96dc56d5b1f893b4004897afef97082659cb1da48f276093aaee772ad source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/semantic-segmentation-adas-0001/FP32/semantic-segmentation-adas-0001.bin - name: FP16/semantic-segmentation-adas-0001.xml size: 214114 - sha256: e23c86d0923fba99311bbd1a55019ccf007b3fb91db9f3ea90d2e178d7e3c27e + sha384: 92ad3e8cf14beec01af5f919eeb1dcee4d6aef99f094bf7fafe07ce2a693060533942895c6ce99909621312331ebb961 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/semantic-segmentation-adas-0001/FP16/semantic-segmentation-adas-0001.xml - name: FP16/semantic-segmentation-adas-0001.bin size: 13371812 - sha256: 61f3a8c70cfb2038a3a8b5fe5608a33312fe28a967b39c76ad45f57152d0272c + sha384: 97707e34ab3db3dacbf3216fedc249608ce418e143d1a86750a3ee90809dfd59c311ff757a6354274d1c0ae513293143 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/semantic-segmentation-adas-0001/FP16/semantic-segmentation-adas-0001.bin - name: FP16-INT8/semantic-segmentation-adas-0001.xml size: 536811 - sha256: f980c27e92355e5a8dc02525342a1d3e2b979fe4aade6f6b7ff11d21eba7d831 + sha384: 8db2b38745da8e6a7ad62b2ce69146e4dd498cd66ba97f4c0d4689be0f37beda3a3cd3501290a1ff6d7cd92ba4428754 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/semantic-segmentation-adas-0001/FP16-INT8/semantic-segmentation-adas-0001.xml - name: FP16-INT8/semantic-segmentation-adas-0001.bin size: 6757670 - sha256: 90c02ce7075759a23b5d622e9fd0cde6dcf44cd799dcdf090dc00e9420a257d1 + sha384: 8e35daf848f2dcec5d328bf8b02d88a81b5461b28fee4aba5998ebd128006c1df75a17474f7f6e53a45f1c8a5747a9dc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/semantic-segmentation-adas-0001/FP16-INT8/semantic-segmentation-adas-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/single-image-super-resolution-1032/model.yml b/models/intel/single-image-super-resolution-1032/model.yml index f3773223938..bcd00d978df 100644 --- a/models/intel/single-image-super-resolution-1032/model.yml +++ b/models/intel/single-image-super-resolution-1032/model.yml @@ -18,27 +18,27 @@ task_type: image_processing files: - name: FP32/single-image-super-resolution-1032.xml size: 82030 - sha256: e4b8881cce1dd2ce2e14dbda75150d1aba9b5ab54531f82ecb7a2f6413d285d7 + sha384: 7d8b48361204fa6da774af855f80fcdb40d3caa5907062a4fcc3127a97c28a8fd34b2a848a03d337ff61bae5c7fc9fb3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1032/FP32/single-image-super-resolution-1032.xml - name: FP32/single-image-super-resolution-1032.bin size: 119436 - sha256: d09c215077e7a95d15636c79d006039ffaacfaf1889ea07668cbf21120295287 + sha384: 5b03e4f2095df69bddb041da7dba7c8126223f5ac8e73c9a12c4627598f5a14447a7efd2effa21278026e3ead8756e6d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1032/FP32/single-image-super-resolution-1032.bin - name: FP16/single-image-super-resolution-1032.xml size: 81953 - sha256: fd0b648583d32fcda7892a225c5bcfc6e79628e5cacd711fec18ddf5a2ca6fef + sha384: 3a8d7b1f16d2cfd60a8ad10c4628018204e34830bbdf6c7fc9cfb5f5d160f3a259d29be60d78602c406bd40a50f05b9d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1032/FP16/single-image-super-resolution-1032.xml - name: FP16/single-image-super-resolution-1032.bin size: 59762 - sha256: a52a4549011480d90246bbe6118718ee485c130480bbf5f7befdb3d5a2a1f057 + sha384: 4cee28140fe9e171c023690dec8376eff8937d7cae39998ebcad317b96268fa8c9e8ec226af088ea45a7664a920a7d92 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1032/FP16/single-image-super-resolution-1032.bin - name: FP16-INT8/single-image-super-resolution-1032.xml size: 166898 - sha256: 8dcdcdd114a25eda9ddedf9eb2cd226f47ed4c4f2f6e545d2bb2ff2c49c2de2d + sha384: 2830fd4871555e73b6f6a241f2bcc5d81986a0313b69d070be2c6fd40c9ea92dd64c50003b7ee6d33e4847608054deb7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1032/FP16-INT8/single-image-super-resolution-1032.xml - name: FP16-INT8/single-image-super-resolution-1032.bin size: 31042 - sha256: 7f3b8e47b157810a82b135577d410df9f2d39edc081d9d64fcec644de12a9083 + sha384: f05a3b99b40380f857a8e05c03d6e1755063ad087a2c5e2e460687f90a6c5e323bcbd305b1ca498c9e7816c7f7f28b4e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1032/FP16-INT8/single-image-super-resolution-1032.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/single-image-super-resolution-1033/model.yml b/models/intel/single-image-super-resolution-1033/model.yml index 4119d57ca06..af6f7b01664 100644 --- a/models/intel/single-image-super-resolution-1033/model.yml +++ b/models/intel/single-image-super-resolution-1033/model.yml @@ -18,27 +18,27 @@ task_type: image_processing files: - name: FP32/single-image-super-resolution-1033.xml size: 57397 - sha256: d8bcb26ba2d6bf5065ad78aa177c40a4383ff64ec0c4445c33c16f927b5721c7 + sha384: 900fe4dbf9cba6ecc9c6fcebfb2dd918df5860a6bc4c12ae0bc7eaa5566eb2beea3af064371d5b7c7325817f0ee9164d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1033/FP32/single-image-super-resolution-1033.xml - name: FP32/single-image-super-resolution-1033.bin size: 121780 - sha256: ba6247c93395bc0649986f28dec0c745d543afcf667c732877b712e05564fb16 + sha384: 7395229a259f7371276750d1c43ee62240ee999f7272c84d7136377d3eb61feab649b4b32ad1c03a2d46e0f67822d32e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1033/FP32/single-image-super-resolution-1033.bin - name: FP16/single-image-super-resolution-1033.xml size: 57354 - sha256: 3c54e36dc59dfe97738b85fc3d8070edf5ff244aa607f0a5a39a2d6b58c96759 + sha384: 1775e9e3d85b0a144fad10029d8a2e0976ccd8d0539b4ccc92a7b4049ff125452a58b813cc49b5df7994e51bab313ef2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1033/FP16/single-image-super-resolution-1033.xml - name: FP16/single-image-super-resolution-1033.bin size: 60938 - sha256: 9a9d5a8cbd9520e4c282600feea95b31228d7de9716e8807acb53c572bd9cd31 + sha384: a944b9287810c9d054a1fe7614f6e827fca275c956c1c0e1f32e17bb1daf9a32463bbc1a13f6f2dca1c8b9ccb0334795 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1033/FP16/single-image-super-resolution-1033.bin - name: FP16-INT8/single-image-super-resolution-1033.xml size: 139173 - sha256: 61d300cfc847d40fdeb8faeef7a6ab8f845872c5ae0d69e6ae37cd038a029ffd + sha384: 8f2d2e65b37e99d0fcd559d86fbf7e56ec04c22e6ffd46816ecc3f569b4f955eb9a21e716f779c67d77070015ae8fe6b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1033/FP16-INT8/single-image-super-resolution-1033.xml - name: FP16-INT8/single-image-super-resolution-1033.bin size: 31672 - sha256: 375b9854f11a4a9a51dd9b0a7081fca9e9009ea019ad9a96c7df592fc58f7505 + sha384: 871e869422db03f938ef603093f808f46a2f41b6940788de1e76ed09b76ab56ef99c3e43497547627e03f549876559d9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/single-image-super-resolution-1033/FP16-INT8/single-image-super-resolution-1033.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-detection-0003/model.yml b/models/intel/text-detection-0003/model.yml index d40ef59598d..da6e798376f 100644 --- a/models/intel/text-detection-0003/model.yml +++ b/models/intel/text-detection-0003/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/text-detection-0003.xml size: 256837 - sha256: f8a23b4edcacdc2902ff151dd63585577ba031b53d1b28ea5104a4e6a4558ac1 + sha384: 31e613b695783a0e0fc3ff64eb74d6be8b50fbbc09e030a214edd5519b332d2f2c64bc78833c7cffb16bee676c09c1f1 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0003/FP32/text-detection-0003.xml - name: FP32/text-detection-0003.bin size: 26986296 - sha256: 39aeca6f1607ba8f67c7c5a3e25d34bca04ef11fbdc8aa32309999fa0751d94c + sha384: 2899e851dd4a3aed189d245e9768471ef04450669819b3bf2e936ddf5eb5ace0057c96ba11e0e95d0c742052356e80b8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0003/FP32/text-detection-0003.bin - name: FP16/text-detection-0003.xml size: 256757 - sha256: aabb17576497e551557873a8fd5051d7c4810bb52303bc14cb0e9c2f593857fd + sha384: 1eebcb3ee6d4ae3d1a3abadac9da7bea45d109b45a63258d6c08425264b1b06be775786033d479ff88ec87840928aa42 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0003/FP16/text-detection-0003.xml - name: FP16/text-detection-0003.bin size: 13493072 - sha256: 1a79e41ba34b5280b2d9db23478efd22425411902e49b9d0072d4526194b8755 + sha384: 66fb9f9b1f895923c78578990facc15238ec317b17cb50383a66cd77592d44025cb9c33447ab5b436d61ab65f123241f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0003/FP16/text-detection-0003.bin - name: FP16-INT8/text-detection-0003.xml size: 659532 - sha256: f7dd4d33daf0b5beead8b5945da216b3ff6197287e3f1dd7c51c82f1d0ddbf38 + sha384: ff2b9d0a5da184337367e480c2d3b4cc03f17b013444f4f8503d9e0aa2bdc236420eab48b7c8dc9c1ce51fa8e8493643 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0003/FP16-INT8/text-detection-0003.xml - name: FP16-INT8/text-detection-0003.bin size: 6894808 - sha256: 18b5ff8fbe1a99c4a9d148f4439ed806387abfb66530dc54dcac8f926541b0bd + sha384: 917185a72c900080ec8d3e4d9c23fdb513e485a933ff5cbe09a1de1c2a59745a589986321a699030de2c1d1ae2458abc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0003/FP16-INT8/text-detection-0003.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-detection-0004/model.yml b/models/intel/text-detection-0004/model.yml index 772b91efb74..2ae0e79c7ce 100644 --- a/models/intel/text-detection-0004/model.yml +++ b/models/intel/text-detection-0004/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/text-detection-0004.xml size: 246789 - sha256: 5dc65404f9ec6ec2b5a5f72e7d7189f58ed8b8886f735f1b1dfa2f9411ca8a37 + sha384: 9500ffb2f778e2f1c1252b061929dea2160f73f906ea6c70bb5190b32586fb5248304364f9983e8601e630f02d0f1037 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0004/FP32/text-detection-0004.xml - name: FP32/text-detection-0004.bin size: 17312244 - sha256: 06ba951bd0f11844c54116a7989218a27c02af9c483c40b0e63e6304a59e2a9e + sha384: 0bf757ac6f3c18c2e2532ebb4fda5fd368d73ad5f81ae7b534ea1b9d8b28c6fd3c9829961fbb207c6d51a7e123f319ce source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0004/FP32/text-detection-0004.bin - name: FP16/text-detection-0004.xml size: 246648 - sha256: 8b0b3f29660c24a444c49f5f30a8c85294eb2aa8e8115b3b910429e5689b1a6b + sha384: 45be5d6a88eff3feaaa37067142dddccaaa6cbf4accf3e47f75a5b94ab74f5d3eabef51357a61ae880d7add1840d0d23 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0004/FP16/text-detection-0004.xml - name: FP16/text-detection-0004.bin size: 8656078 - sha256: 9ac8b29a5d89b9bdc845b4224de692f78acb86e5f8aedffba56f092a4133f618 + sha384: e5d7cbb190500406629942f656c285d02caa59ea5d82a1a955cbfda8729e4f2aa3f922ea574b1195faa866b6ee98c3a4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0004/FP16/text-detection-0004.bin - name: FP16-INT8/text-detection-0004.xml size: 555082 - sha256: 152392d3c7b367179bfee7f7f1a448e65705db7cf89b28eb387dc438bc724e69 + sha384: e20abae947b675283eab0a5433dd5ad8732372036b0723fac0eab50d482780b0f82e6514c59748ec4b7aad18afebf81a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0004/FP16-INT8/text-detection-0004.xml - name: FP16-INT8/text-detection-0004.bin size: 4475586 - sha256: 14e591bbda0656afe6754df750a728d5a368ca262b2dfb07636262009a317f92 + sha384: 907db8401406443d37cb9e30f3abf070a20341341e15913571301300d323b153ceec65cbbaea68d88623f013b04692b6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-detection-0004/FP16-INT8/text-detection-0004.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-image-super-resolution-0001/model.yml b/models/intel/text-image-super-resolution-0001/model.yml index 3df55c6c9bd..6971b6345c9 100644 --- a/models/intel/text-image-super-resolution-0001/model.yml +++ b/models/intel/text-image-super-resolution-0001/model.yml @@ -18,27 +18,27 @@ task_type: image_processing files: - name: FP32/text-image-super-resolution-0001.xml size: 11701 - sha256: e196c762a07fe7bae6f515f636672349bd51fa157daf7aeab556f5922a9ced87 + sha384: d99cfa351334e7ec53f1f70acd6f99d357a381342428aec083bfd4e7b89247f67368d18ddcbaa857d8763835808e39fa source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-image-super-resolution-0001/FP32/text-image-super-resolution-0001.xml - name: FP32/text-image-super-resolution-0001.bin size: 10836 - sha256: b9405f0bce254c61f0487b0fa53c89621dc440cbc560c7dc92506900b62d6af5 + sha384: 985a5cbb9dcb529188f79e3f4e80e5d26828cba04a77b908321dcc8647ada5b97d72a8e1a9fd915bd9f3bca527e3b570 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-image-super-resolution-0001/FP32/text-image-super-resolution-0001.bin - name: FP16/text-image-super-resolution-0001.xml size: 11691 - sha256: 6f53e6285c967b4e8d0ec2c3d248c5eea10163a33cecce291d18907e31a263d9 + sha384: e96d6c883e3ca8cff8955570d6bd70d51ba76b446220f4955ce5b4494de7bd6036700c79be9e007da2993c5c10ddb8c2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-image-super-resolution-0001/FP16/text-image-super-resolution-0001.xml - name: FP16/text-image-super-resolution-0001.bin size: 5418 - sha256: f203818d73b933e5004aff85aeb84783dbf0be9e5c296d2995fc0678ff719e9c + sha384: 3403c611e626cf9e647f0cc7674e5379129af4385c4fe747cec9556fbb114708a7a6793a321e2d072a7e3cd4c0190cb7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-image-super-resolution-0001/FP16/text-image-super-resolution-0001.bin - name: FP16-INT8/text-image-super-resolution-0001.xml size: 25162 - sha256: 20167c77e4895f0ebfd37d5e22bcbbb600e254850a7d9fb802a0201789ce8250 + sha384: 39d8a717ae6c3f2ede2f2e7ba06fa6d30dee7e7c668cea6829bcb72c7c96925b0be66cfbd9966ef16b1ee1bcffcb9d1b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-image-super-resolution-0001/FP16-INT8/text-image-super-resolution-0001.xml - name: FP16-INT8/text-image-super-resolution-0001.bin size: 4222 - sha256: 3009240101e51f60850844075740fa2e71d363696bfe3ed63c9d43b4c4bedbf4 + sha384: 73d5bc184cef993f27c5910082f566cb70d0fe0464f42e8e87773d8079105c3b0e7a088ba5b38d31db28102fc14b5015 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-image-super-resolution-0001/FP16-INT8/text-image-super-resolution-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-recognition-0012/model.yml b/models/intel/text-recognition-0012/model.yml index 4f35a6c6e3a..3b2b673e4d8 100644 --- a/models/intel/text-recognition-0012/model.yml +++ b/models/intel/text-recognition-0012/model.yml @@ -19,27 +19,27 @@ task_type: optical_character_recognition files: - name: FP32/text-recognition-0012.xml size: 112650 - sha256: 822e27d80acb329aff981d702dc9146d50753b91bfce3b2b976383a736d62145 + sha384: c3a796d348f687bc3389f2e6843d9db16b5f4b8b1b211b920a7175b142255711f70aa7c107bc0ce871511b867ec6bbdc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0012/FP32/text-recognition-0012.xml - name: FP32/text-recognition-0012.bin size: 47470852 - sha256: 45cbfb77ee2d2f4e7b6b4182f48938e12fdb69b87a39586673394412f5316908 + sha384: aac0d9c1b32cb526d8287b10733009625282bba3934318b9898978172c45e0e5022069b9fd954310bf13aa308cfb9cd5 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0012/FP32/text-recognition-0012.bin - name: FP16/text-recognition-0012.xml size: 112618 - sha256: 5f973ddfba50124b338f064c90ada5eb7f1988833113371db75c025a9cdfde43 + sha384: 49b64f5ae7140e47c6f785bc8c10820beee3ca2271c5281f76e14324ca18fa4d1ab1007f8e715d108723aa75de61935f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0012/FP16/text-recognition-0012.xml - name: FP16/text-recognition-0012.bin size: 23735478 - sha256: 080c4c68b9b47ab02af197c41d16136e61ba43ea086ec92c2d14bb281f0232d4 + sha384: 93ae52ee585409f4450dbc7946a6ddfaa5678f0bcbc7baa08f6111de6e21da17ee4166ecc46c7fce6edef71843677f8b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0012/FP16/text-recognition-0012.bin - name: FP16-INT8/text-recognition-0012.xml size: 147892 - sha256: 90983a9620204d7b2407ecc80d5355cb32bdba1c4e144bea6959a5a8049db571 + sha384: 247dbd3d6444b8b67bdee04aedbd959543b3cfa3e2b98738ffd5bea201a6a28dea2c3ceaa99b9bfd557b6e5cdc32e9cb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0012/FP16-INT8/text-recognition-0012.xml - name: FP16-INT8/text-recognition-0012.bin size: 18217000 - sha256: 5f17f20ce33f5db58ae4c5b15f27ba4076646ef1a2aad32d97d6bcdc367508f5 + sha384: 885625e0d64828d2633a910be7f9012a48a748218276f53a6330078b495630a221389018ba63403a7fdb9a8f559b0351 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0012/FP16-INT8/text-recognition-0012.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-recognition-0014/model.yml b/models/intel/text-recognition-0014/model.yml index d311b466cdb..a049995cfa8 100644 --- a/models/intel/text-recognition-0014/model.yml +++ b/models/intel/text-recognition-0014/model.yml @@ -19,27 +19,27 @@ task_type: optical_character_recognition files: - name: FP32/text-recognition-0014.xml size: 220869 - sha256: 468afc78bb9406ed75eee5fa351ee9a48e4d7c61f528e4a4362e12d32d01a82d + sha384: 7bdb7f11588aca22656014e096b10b98bdf204c90a2557da25cea52f9955b2b6ff858df111ac9bc25627c73b7cdee512 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0014/FP32/text-recognition-0014.xml - name: FP32/text-recognition-0014.bin size: 36555752 - sha256: 9ba8eb0d0e1349aced468557cfbc5b71f56f65d619f97fdbe8658237743e4c8c + sha384: 270e5a11e9a73c1f72df468c6acf60cfeda87bcbf4f2876584e0ce5fd5cd9740cd0edba4762dc45859ad8598ce044338 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0014/FP32/text-recognition-0014.bin - name: FP16/text-recognition-0014.xml size: 220711 - sha256: 36979a919341ccf9eaf0ed2d30deb61c8b7a8a80023954bdd2579e7f3f5e5b8c + sha384: 14c4ed52cf9a178e951cdbb298c21628d4e8b6873ce2f4eda72f1379b9d07e3ef3bcd38a1d77ef36f98ac60a115984c0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0014/FP16/text-recognition-0014.xml - name: FP16/text-recognition-0014.bin size: 18278038 - sha256: 1555bb0481dcd0c9a0d2ae92196b2a3a57505de46874d1132f0de12881649fba + sha384: a0be445dcca932082f26c5db40f96b263f86c17ef14826fe647c3cede719f6fffd57057be8a52921c7c5011b51c15da4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0014/FP16/text-recognition-0014.bin - name: FP16-INT8/text-recognition-0014.xml size: 346571 - sha256: 60cd35ce26288ec429f26edafc4128c80b6a410fe72b1030fa669139fa734d32 + sha384: 005376c823635b302109c688e5f02b71683a7147c26990cc6b14ee39f735c481ead60a247564045b6afdd496ea5737ee source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0014/FP16-INT8/text-recognition-0014.xml - name: FP16-INT8/text-recognition-0014.bin size: 15485590 - sha256: 06d587d2bccd540b4371443b37193bf05344a89c7b318f357fc3d67aa00d8ff8 + sha384: 215d50460e102c089c9c78fbc6975ff3d6f2737d2c43cf42aa5354630a0bf3e8670bfe105a1d350527ec7cc8dfba69ae source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0014/FP16-INT8/text-recognition-0014.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-recognition-0015/composite-model.yml b/models/intel/text-recognition-0015/composite-model.yml index be45b764c8e..c12e98ccb83 100644 --- a/models/intel/text-recognition-0015/composite-model.yml +++ b/models/intel/text-recognition-0015/composite-model.yml @@ -1 +1 @@ -task_type: token_recognition +task_type: optical_character_recognition diff --git a/models/intel/text-recognition-0015/text-recognition-0015-decoder/model.yml b/models/intel/text-recognition-0015/text-recognition-0015-decoder/model.yml index ff532e65615..0ab0df87a5c 100644 --- a/models/intel/text-recognition-0015/text-recognition-0015-decoder/model.yml +++ b/models/intel/text-recognition-0015/text-recognition-0015-decoder/model.yml @@ -18,19 +18,19 @@ task_type: token_recognition files: - name: FP32/text-recognition-0015-decoder.xml size: 55509 - sha256: 3374853a92a2557e45438985195ffbf8edf6e02504ddebeb5c200e220c471a1e + sha384: 20d747e5724c6286f8542c908b343b766c8605fa6448daeaaf791f582ceb496e07865d6a23bf44589bbecae1ec1dd662 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0015/text-recognition-0015-decoder/FP32/text-recognition-0015-decoder.xml - name: FP32/text-recognition-0015-decoder.bin size: 42516860 - sha256: 74e5a8101eec7ae9931f9958948b0c0c6c9607f2566c0b06188cbd7e1874b5f5 + sha384: be2fdb03cb98748790b1268512f2406c0d90fd603cd436f30434da2476e053c227282702fa51ccc684bb71caccf3f550 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0015/text-recognition-0015-decoder/FP32/text-recognition-0015-decoder.bin - name: FP16/text-recognition-0015-decoder.xml size: 55504 - sha256: f79875212c0e6c7dcb38c8c732a5c169b586afc70fd06f6e8a917fd54fde8d88 + sha384: 12e1ca286909963860795dcbbef3c8d37a3d91b5eccbc4d6119579c48441f9c656c7b39396ece3405f2a0e6ab396c693 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0015/text-recognition-0015-decoder/FP16/text-recognition-0015-decoder.xml - name: FP16/text-recognition-0015-decoder.bin size: 21258488 - sha256: b9a8cc30a2f6e2dc086566cc7d4183789b893d3bc262a45755f4c0f5e4249db4 + sha384: 4aff6e7905aab6f6f50daba44c58faceae6487595f84414e535dd11acad7930f0ffde60677bd5440e6815b73bd7037e3 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0015/text-recognition-0015-decoder/FP16/text-recognition-0015-decoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-recognition-0015/text-recognition-0015-encoder/model.yml b/models/intel/text-recognition-0015/text-recognition-0015-encoder/model.yml index 6e695d8dd10..f7a583c2431 100644 --- a/models/intel/text-recognition-0015/text-recognition-0015-encoder/model.yml +++ b/models/intel/text-recognition-0015/text-recognition-0015-encoder/model.yml @@ -18,19 +18,19 @@ task_type: feature_extraction files: - name: FP32/text-recognition-0015-encoder.xml size: 326445 - sha256: b8fc719de6ccbd6f7b2e72ebb43ef498ae948e8268eb8b1f09662bc365e1fc43 + sha384: 27441bbe12dee3d4c9dff93d25516883915ff89f1095cbc6674b0897d8d22da4ff986a809eaa5f79dccc2550a67f8dba source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0015/text-recognition-0015-encoder/FP32/text-recognition-0015-encoder.xml - name: FP32/text-recognition-0015-encoder.bin size: 1592248036 - sha256: 33c650eea2d900f9666f7b2bbc38511d8d6b0d4ea4d15fe7b443a7382976610a + sha384: 8e54bd82adf517bb3e08a45d673a4b1626698819ce4b90c8a0cf702ffad1e89853327cc16e9e44b8a8d8dce58ee5dbdc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0015/text-recognition-0015-encoder/FP32/text-recognition-0015-encoder.bin - name: FP16/text-recognition-0015-encoder.xml size: 326304 - sha256: d8cd929eeb0e8f82bb28e34cb56a9e22839dc27a15aa1200ccb0f27fe93a9430 + sha384: 3871c35a68ebe3f4f93e3c763cfe0c8a06b2e6d23c583e976eee57e79f0316587df9524448fdceafbf9f1bd579cad2d2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0015/text-recognition-0015-encoder/FP16/text-recognition-0015-encoder.xml - name: FP16/text-recognition-0015-encoder.bin size: 796124044 - sha256: f89705a9654f12ce52d976331b6000ca93032cd769032427d63b33f55583e024 + sha384: b34ab56d2ff2fb80a6fac649aede61d382bb81543531ea4f0a24001c0cce698de2b31eebd381dc3861c96657df1b9bd9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-recognition-0015/text-recognition-0015-encoder/FP16/text-recognition-0015-encoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-recognition-0016/README.md b/models/intel/text-recognition-0016/README.md new file mode 100644 index 00000000000..75ed60c1980 --- /dev/null +++ b/models/intel/text-recognition-0016/README.md @@ -0,0 +1,89 @@ +# text-recognition-0016 (composite) + +## Use Case and High-Level Description + +This is a text-recognition composite model that recognizes scene text. +The model uses predefined set of alphanumeric symbols (case-insensitive) to predict words. +The model is built on the ResNeXt-101 backbone with [TPS](https://arxiv.org/abs/1603.03915) module and additional 2d attention-based text recognition head. + +## Example of the input data + +![](./assets/text-recognition-0016.jpg) + +## Example of the output + +`openvino` + +## Composite model specification + +| Metric | Value | +| ---------------------------------------------- | ------------------ | +| Text location requirements | Tight aligned crop | +| Source framework | PyTorch\* | +| Accuracy on the alphanumeric subset of ICDAR13 | 0.9685 | +| Accuracy on the alphanumeric subset of ICDAR03 | 0.9712 | +| Accuracy on the alphanumeric subset of ICDAR15 | 0.8675 | +| Accuracy on the alphanumeric subset of SVT | 0.9474 | +| Accuracy on the alphanumeric subset of IIIT5K | 0.9347 | + +## Encoder model specification + +The text-recognition-0016-encoder model is a ResNeXt-101 like backbone with TPS network and convolutional encoder part of the text recognition. + +| Metric | Value | +| ------- | ----- | +| GFlops | 9.27 | +| MParams | 88.1 | + +### Inputs + +Image, name: `imgs`, shape: `1, 1, 64, 256` in the `B, C, H, W` format, where: + +- `B` - batch size +- `C` - number of channels +- `H` - image height +- `W` - image width + + +### Outputs + +1. Name: `decoder_hidden`, shape: `1, 1, 1024`. Initial context state of the GRU cell. +2. Name: `features`, shape: `1, 36, 1024`. Features from encoder part of text recognition head. + +## Decoder model specification + +The text-recognition-0016-decoder model is a GRU based decoder with 2d attention module. + +| Metric | Value | +| ------- | ----- | +| GFlops | 0.08 | +| MParams | 4.28 | + +### Inputs + +1. Name: `decoder_input`, shape: `1`. Previous predicted letter. +2. Name: `features`, shape: `1, 36, 1024`. Encoded features. +3. Name: `hidden`, shape: `1, 1, 1024`. Current state of the decoder. + +### Outputs + +1. Name: `decoder_hidden`, shape: `1, 1, 1024`. Current context state of the GRU cell. +2. Name: `decoder_output`, shape: `1, 40`. Classification confidence scores in the [0, 1] range + for every letter. + +Particularly, decoder output in every step is the probability distribution of the symbol on this timestamp. The model supports 40 symbols: 10 digits, 26 English alphabet letters and 4 special symbols(start of sequence symbol, end of sequence symbol, pad symbol and unknown symbol). +> Note: that start and end symbols are not passed in the supported symbol set in the demo, as well as pad symbol. See parameter `-m_tr_ss` in the demo section for details. +## Use text-detection demo + +Model is supported by [text-detection c++ demo](../../../demos/text_detection_demo/cpp/README.md). In order to use this model in the demo, user should pass the following options: +``` +-tr_pt_first +-m_tr_ss "?0123456789abcdefghijklmnopqrstuvwxyz" +-tr_o_blb_nm "logits" +-tr_composite +-dt simple -lower +``` + +For more information, please, see documentation of the demo. +## Legal Information +[*] Other names and brands may be claimed as the property of others. diff --git a/models/intel/text-recognition-0016/accuracy-check.yml b/models/intel/text-recognition-0016/accuracy-check.yml new file mode 100644 index 00000000000..e8cbf803cc7 --- /dev/null +++ b/models/intel/text-recognition-0016/accuracy-check.yml @@ -0,0 +1,108 @@ +evaluations: + - name: text-recognition-0016 + module: custom_evaluators.custom_text_recognition_evaluator.TextRecognitionWithAttentionEvaluator + module_config: + model_type: SequentialTextRecognitionModel + lowercase: true + network_info: + max_seq_len: "24" + custom_label_map: + 0: "" + 1: "" + 2: "" + 3: "?" + 4: "0" + 5: "1" + 6: "2" + 7: "3" + 8: "4" + 9: "5" + 10: "6" + 11: "7" + 12: "8" + 13: "9" + 14: "a" + 15: "b" + 16: "c" + 17: "d" + 18: "e" + 19: "f" + 20: "g" + 21: "h" + 22: "i" + 23: "j" + 24: "k" + 25: "l" + 26: "m" + 27: "n" + 28: "o" + 29: "p" + 30: "q" + 31: "r" + 32: "s" + 33: "t" + 34: "u" + 35: "v" + 36: "w" + 37: "x" + 38: "y" + 39: "z" + + launchers: + - framework: dlsdk + + datasets: + - name: SVT_recognition + preprocessing: + - type: bgr_to_gray + cast_to_float: false + - type: resize + dst_width: 256 + dst_height: 64 + metrics: + - type: character_recognition_accuracy + reference: 0.9474 + + - name: IIIT5K + preprocessing: + - type: bgr_to_gray + cast_to_float: false + - type: resize + dst_width: 256 + dst_height: 64 + metrics: + - type: character_recognition_accuracy + reference: 0.9347 + + - name: ICDAR2015_recognition + preprocessing: + - type: bgr_to_gray + cast_to_float: false + - type: resize + dst_width: 256 + dst_height: 64 + metrics: + - type: character_recognition_accuracy + reference: 0.8675 + + - name: ICDAR03_recognition + preprocessing: + - type: bgr_to_gray + cast_to_float: false + - type: resize + dst_width: 256 + dst_height: 64 + metrics: + - type: character_recognition_accuracy + reference: 0.9712 + + - name: ICDAR2013 + preprocessing: + - type: bgr_to_gray + cast_to_float: false + - type: resize + dst_width: 256 + dst_height: 64 + metrics: + - type: character_recognition_accuracy + reference: 0.9685 diff --git a/models/intel/text-recognition-0016/assets/text-recognition-0016.jpg b/models/intel/text-recognition-0016/assets/text-recognition-0016.jpg new file mode 100644 index 00000000000..e1338e07630 Binary files /dev/null and b/models/intel/text-recognition-0016/assets/text-recognition-0016.jpg differ diff --git a/models/intel/text-recognition-0016/composite-model.yml b/models/intel/text-recognition-0016/composite-model.yml new file mode 100644 index 00000000000..c12e98ccb83 --- /dev/null +++ b/models/intel/text-recognition-0016/composite-model.yml @@ -0,0 +1 @@ +task_type: optical_character_recognition diff --git a/models/intel/text-spotting-0005/text-spotting-0005-detector/model.yml b/models/intel/text-spotting-0005/text-spotting-0005-detector/model.yml index 743378d347e..354181987c7 100644 --- a/models/intel/text-spotting-0005/text-spotting-0005-detector/model.yml +++ b/models/intel/text-spotting-0005/text-spotting-0005-detector/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/text-spotting-0005-detector.xml size: 787322 - sha256: 584bb6d01ffc5b23779ee734f90698aa5b21fd5ff74ec9f603407e13a38e3dc2 + sha384: 2bf03b8bd98b1feb1daab5af6a678cdaf765e346e4a4d714db32be4f424fd2d466826bcf8da10ff6c77974314960fdf1 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-detector/FP32/text-spotting-0005-detector.xml - name: FP32/text-spotting-0005-detector.bin size: 103797576 - sha256: d3d09bf2fbad9e81d604b6ae8a94e72f4f774f7ba777be4fbbda5bc91a5fece4 + sha384: 159e28ee53a290ee166d126c0ea988f3883d0672e5e0a9921877f706831c07bc7d46dcb718faf77d772cc19984469f93 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-detector/FP32/text-spotting-0005-detector.bin - name: FP16/text-spotting-0005-detector.xml size: 787207 - sha256: de238d81c911abc56dd4a6b04bab5b1d94957694532f5caed3be50428fc79119 + sha384: d31dfb7bf3990c067590ec5759dc968735f644f73b921a56a846420d3cf23c3572326fdbc8ab1d672a580dfca58199ef source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-detector/FP16/text-spotting-0005-detector.xml - name: FP16/text-spotting-0005-detector.bin size: 51899008 - sha256: 9c313a6d6b253b738dfaa93ced284d38acc68fceef1458d2b96cc0c8cf2ba363 + sha384: 923c409f4f8fc26c15026a1e2cfb6d5b4b5cd225a437a73d6d448858e1f42fdf910a1e6c27f1b0a6788562404f48f35f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-detector/FP16/text-spotting-0005-detector.bin - name: FP16-INT8/text-spotting-0005-detector.xml size: 1141663 - sha256: 58ac8cf896e7c598dd46c726446e3ffb84f146044fcd72a1a2b790dac9933b31 + sha384: 880ae56c5a3a7c9099a3a76ba7aa89d0ca399068dbf789daf4ec85e0ae7bf02ad800a72d837e55f046576c612055861f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-detector/FP16-INT8/text-spotting-0005-detector.xml - name: FP16-INT8/text-spotting-0005-detector.bin size: 15611019 - sha256: 8750d89a62b28fd48828a76d3cb454c87177408eb13a1963391c0002f0f1e18e + sha384: 0f5fc06a2377bff04b4fe110e255bfa429a55ff13e9af3d6a0c65591d6f8163a69a2e0525abedaa47af3ad942251134c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-detector/FP16-INT8/text-spotting-0005-detector.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-spotting-0005/text-spotting-0005-recognizer-decoder/model.yml b/models/intel/text-spotting-0005/text-spotting-0005-recognizer-decoder/model.yml index 6aa4cfcc7b6..2afc4184e6a 100644 --- a/models/intel/text-spotting-0005/text-spotting-0005-recognizer-decoder/model.yml +++ b/models/intel/text-spotting-0005/text-spotting-0005-recognizer-decoder/model.yml @@ -19,27 +19,27 @@ task_type: optical_character_recognition files: - name: FP32/text-spotting-0005-recognizer-decoder.xml size: 52801 - sha256: a0307653701bee62b602b3cb543a6c9150f0ddf6213699121b7332c10fcb672f + sha384: ef3525ed3b211d76be6e431d1de9baf0d1505ce432bd79549f3b4034be3231317e2db2b04570f857f68618a430580b35 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-decoder/FP32/text-spotting-0005-recognizer-decoder.xml - name: FP32/text-spotting-0005-recognizer-decoder.bin size: 2707724 - sha256: 7c78bc3fd99924fb467d11e6b63b5e91e0ee4bbec5b330ec6aefcf028bc80777 + sha384: 4a0edc8073e167328870e098e82e40bded9a993af805ad7e19a9ee57dd14de49811292698358f7bf06ed6ff04ba6d6b4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-decoder/FP32/text-spotting-0005-recognizer-decoder.bin - name: FP16/text-spotting-0005-recognizer-decoder.xml size: 52793 - sha256: 809d22fab87fa9b45ef44b182e66609294dc3a9e0d3603bfde6e01cf83bf0205 + sha384: e3166251c48e54bb713ef64ddf0dc99db5a0e42b65519ff131703fbe911273c5a0fc12bfbb3d86e63d50e16ee6df0dc4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-decoder/FP16/text-spotting-0005-recognizer-decoder.xml - name: FP16/text-spotting-0005-recognizer-decoder.bin size: 1353920 - sha256: 6e5ea2b18df8ef7e43f8ceace2532adfc3b974dd765d2be7fa21fa4bbf6e49a9 + sha384: dbb69793304dcd4d49a91b6a193859127e4b05b4cb01e227a0c3dd8ac6217f3966f54fda5d6121136c8f5b241d51fbca source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-decoder/FP16/text-spotting-0005-recognizer-decoder.bin - name: FP16-INT8/text-spotting-0005-recognizer-decoder.xml size: 80802 - sha256: 2042ef2d1c1a9daf73bb22e5bcfa90109196e1a29450ef0a592065c2ab2d0b54 + sha384: b7887e00d558fa7b81e808bba5ed0f2014cdef5ede3471e577e3deec060fb8c4e9da5ad003a29b27593b7e3bb12ea7d6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-decoder/FP16-INT8/text-spotting-0005-recognizer-decoder.xml - name: FP16-INT8/text-spotting-0005-recognizer-decoder.bin size: 1085540 - sha256: 191f0f9d50409de2e49f67a7cba1524965d09ac3c91d70eba3fe48207867af13 + sha384: 6e145f52addd1294d43c50bef5a5d1c7f02891d5171411048c0be9229a355cc9f48f33a397c841767efab17f8062d3cb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-decoder/FP16-INT8/text-spotting-0005-recognizer-decoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-spotting-0005/text-spotting-0005-recognizer-encoder/model.yml b/models/intel/text-spotting-0005/text-spotting-0005-recognizer-encoder/model.yml index 6e0e26c78eb..82f7298f530 100644 --- a/models/intel/text-spotting-0005/text-spotting-0005-recognizer-encoder/model.yml +++ b/models/intel/text-spotting-0005/text-spotting-0005-recognizer-encoder/model.yml @@ -19,27 +19,27 @@ task_type: feature_extraction files: - name: FP32/text-spotting-0005-recognizer-encoder.xml size: 10223 - sha256: 53cf2e047e2c2db1b767da0cf857d92a62a49a9e8a462fe5751fd48066a7e5b6 + sha384: f3a7415851daf8651b605c854afe237963e8baecd4b33eed8388ec172cb2b6139568206c360c8c3f24e448aaef5a1f2c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-encoder/FP32/text-spotting-0005-recognizer-encoder.xml - name: FP32/text-spotting-0005-recognizer-encoder.bin size: 5311488 - sha256: 309e50791fb875387d95ece0cb3de580b97c66e6ce59af29315f26cc5e69851c + sha384: c39b30d4c4ab709a183104daff4d033d003be3f71f33404ef66b948cb5a60b19d1e1028909f4bf197ab48d68ccc48bc0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-encoder/FP32/text-spotting-0005-recognizer-encoder.bin - name: FP16/text-spotting-0005-recognizer-encoder.xml size: 10220 - sha256: 5174253eae9ce3a0a022f48774d33412be8079b60abb153380476daa8a88d50a + sha384: 745566b3e17ccddb291aeb005b9180a257dbb4f8c672640f3214d294e8691ed5f078fef9703d2bf2f9d43d7745b55b19 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-encoder/FP16/text-spotting-0005-recognizer-encoder.xml - name: FP16/text-spotting-0005-recognizer-encoder.bin size: 2655744 - sha256: b11b352863aa425d8f6fcc38f177d7256c29954708011474682930753dfe22f5 + sha384: cbd2231d9080903deccd16711eb79d30add22f60f314f0a5c37f4207d12f7260b67a335cacd92c95aa682128c2697065 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-encoder/FP16/text-spotting-0005-recognizer-encoder.bin - name: FP16-INT8/text-spotting-0005-recognizer-encoder.xml size: 25295 - sha256: 1daba3d70a209578a1c01349a0322ff88a96ef1b6899f6b2a5bb07a70fad834f + sha384: b7651fc064862c3b24de8e529c16058d9f5babf82d7ca9de9091b9c017823447a41639c9ebd4729e7f58ef30ebf3d73b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-encoder/FP16-INT8/text-spotting-0005-recognizer-encoder.xml - name: FP16-INT8/text-spotting-0005-recognizer-encoder.bin size: 1317880 - sha256: 33e1d1790c4e5de00004d99c9f5663d4f1350cec90ffde563c59e5d2dcec88a4 + sha384: 6b88c969521742dfb47fe18a241d3b1092d69f3f5887be0831e768050b0052b0ed2c061ea8e0d487607441b0a9ab14e5 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-spotting-0005/text-spotting-0005-recognizer-encoder/FP16-INT8/text-spotting-0005-recognizer-encoder.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-duration-prediction/model.yml b/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-duration-prediction/model.yml index 72b187c22cb..03990d17a11 100644 --- a/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-duration-prediction/model.yml +++ b/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-duration-prediction/model.yml @@ -19,19 +19,19 @@ task_type: text_to_speech files: - name: FP32/text-to-speech-en-0001-duration-prediction.xml size: 562415 - sha256: 4cf1f83b0314cf3b8e507b16096dbd81e2420611cc30d710073759091032d74d + sha384: b2fe945cadb40f6563142eb889c67377dddb985d878abf3a0cc412c103f642be64023003707f48227cb3a17e7af0f238 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-duration-prediction/FP32/text-to-speech-en-0001-duration-prediction.xml - name: FP32/text-to-speech-en-0001-duration-prediction.bin size: 54275772 - sha256: c8c5a2d7928b5edc61d534b080e0f5ef40e0ae6dd9dea64d36ba3643290a7448 + sha384: 08188f25e553273ff47da4c5999bc9a8a84ba4365d7d6b26755843e0ec11a3462bf642abf6470c28e1a6df19348ed083 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-duration-prediction/FP32/text-to-speech-en-0001-duration-prediction.bin - name: FP16/text-to-speech-en-0001-duration-prediction.xml size: 562152 - sha256: 9dd225a263987da61affac35d2200fe8e4def83a79d33b83864ddff0e6708c68 + sha384: 6bdb2eef76fa8551154cb11cf56fd21b22ad8e4eb8889dbfa6912642e1ded13cc874b9dd090d7207fcd07ac72b11ac7c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-duration-prediction/FP16/text-to-speech-en-0001-duration-prediction.xml - name: FP16/text-to-speech-en-0001-duration-prediction.bin size: 27137958 - sha256: a6b40e0be55d6624c96e516209694d69c80a6d9d6396bfa91501a7b7aee2b528 + sha384: f19ccade135499b4ded95e5348332b3f05ee6339fa900d66a8378babbecb1b398dc2c63223478c532ef2f14478f6efef source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-duration-prediction/FP16/text-to-speech-en-0001-duration-prediction.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-generation/model.yml b/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-generation/model.yml index 8aa86e27811..867dab3d6f6 100644 --- a/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-generation/model.yml +++ b/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-generation/model.yml @@ -19,19 +19,19 @@ task_type: text_to_speech files: - name: FP32/text-to-speech-en-0001-generation.xml size: 219853 - sha256: e027452aab814ffb4e7639f49506af718121c8202023f732fa67463b54973d6e + sha384: 9fe0946358b75854dc0b457bb6089c73808d2bcc85e033d979f2559faba6634dfe3887a985c4a20612867eeb0e17adcb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-generation/FP32/text-to-speech-en-0001-generation.xml - name: FP32/text-to-speech-en-0001-generation.bin size: 51082868 - sha256: e103cb16cbef9008a211ceaee2cebd43a7aa365ef87bd250e34867f40564c6b9 + sha384: f67813865d59c12af57110a668619a3572a304db0912cbd29ee7d4984d4e2bfb4c8d4472916758f5261bc3b6a858927d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-generation/FP32/text-to-speech-en-0001-generation.bin - name: FP16/text-to-speech-en-0001-generation.xml size: 219850 - sha256: 8536decb255496fe8355eaa0b6e44a13008b684827f635679a5e1556f77a120f + sha384: 4b7f879bf8bbdd8336ae3e9061dc9e24f8b4fcbc5478d7ea552a0a25573c86ec46950608c7cd044e5b1d23c3de34f088 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-generation/FP16/text-to-speech-en-0001-generation.xml - name: FP16/text-to-speech-en-0001-generation.bin size: 25541548 - sha256: 1717221b9526088ad128736d57d25c884476ece4737577d716a957df12b3ae3a + sha384: 13d7a863b5b433aeed4c328fc94f59c3079c26d20e0876ac7b8a8f35c933490f27ce7b42961f631c147119fff0f215a0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-generation/FP16/text-to-speech-en-0001-generation.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-regression/model.yml b/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-regression/model.yml index 5c97db4e05b..2ed4c25ed39 100644 --- a/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-regression/model.yml +++ b/models/intel/text-to-speech-en-0001/text-to-speech-en-0001-regression/model.yml @@ -19,19 +19,19 @@ task_type: text_to_speech files: - name: FP32/text-to-speech-en-0001-regression.xml size: 573812 - sha256: 2fb090bd9b092f70250334b86948f8a0abb94509073b7ff8dafc414b15b22aba + sha384: f1e74e0a4ee58b9ae8ffb192f7d9d40f588e442b08e2c2032dbabb4e6be11838fef5dfdd4739cbdf402fb44c6b70477c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-regression/FP32/text-to-speech-en-0001-regression.xml - name: FP32/text-to-speech-en-0001-regression.bin size: 19851412 - sha256: a9d31ead9743872334a5234e578ba68d89913e34170cf8730116a9b31a7274eb + sha384: f1e0327eda382eaf181281658a8c6c07d9113a50e2a6246b7d1b6efe4caf0e5c96d01bbb3057520ac4d7ada0642adc58 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-regression/FP32/text-to-speech-en-0001-regression.bin - name: FP16/text-to-speech-en-0001-regression.xml size: 573558 - sha256: 444be84ad5e950330f437b7eea51f2b50fc9c6fb29e87affa9ed4f5b043b9426 + sha384: 1b2034169aca7a74c421634aa2721ed107c41030783da16ed6660d170cd12992145c94e814b731c9a6a7d870e3675649 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-regression/FP16/text-to-speech-en-0001-regression.xml - name: FP16/text-to-speech-en-0001-regression.bin size: 9925782 - sha256: 1a49ea264fe1f63caea922bc37168f4f5d6770077a532f6ab475ff8520f20dcb + sha384: 19169015055c826107816009a1f5467939ffd39aa01b2930b75432e13a93511080bcd4bf82884c33c2228811f2086ae2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-0001/text-to-speech-en-0001-regression/FP16/text-to-speech-en-0001-regression.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-duration-prediction/model.yml b/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-duration-prediction/model.yml index c43280aa765..2ef39ce844e 100644 --- a/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-duration-prediction/model.yml +++ b/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-duration-prediction/model.yml @@ -19,19 +19,19 @@ task_type: text_to_speech files: - name: FP32/text-to-speech-en-multi-0001-duration-prediction.xml size: 650961 - sha256: 5fe49dcd2384b24324a90e53016fe663131edb95deb164abdd36694489e00750 + sha384: 34eb221cef25ffd33d2faeb772d7c9a778d5285fec2622e136e6994b28832b4a5c4e68ac3d10009004e62329c1a070d5 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-duration-prediction/FP32/text-to-speech-en-multi-0001-duration-prediction.xml - name: FP32/text-to-speech-en-multi-0001-duration-prediction.bin size: 104707900 - sha256: 5f8ea26062796fcffe1ecfa00c12c27a830d8a7fd18479fcdb8e1b82959551b4 + sha384: 2e68205d17f202a294a98e966918e0d4af73f323dda7de5823a61b92fa81cc19ee62aa09b789cd56c28590b849733632 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-duration-prediction/FP32/text-to-speech-en-multi-0001-duration-prediction.bin - name: FP16/text-to-speech-en-multi-0001-duration-prediction.xml size: 650523 - sha256: 529e11b6eff429fb96e2138724d944c19f358f02f5c7a60d9df8b67b2e457109 + sha384: e4b259dd9da771a3757e449db417c4dfc81d14f9be643cb69faa7b134b0eefdc7e180cba5a41e47fe097752c1aeba7e6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-duration-prediction/FP16/text-to-speech-en-multi-0001-duration-prediction.xml - name: FP16/text-to-speech-en-multi-0001-duration-prediction.bin size: 52354022 - sha256: 666423308bd632768e2e95d5a8d6f7fe8dcae271bfe151a3be34e0026e364a15 + sha384: f66571d2063aed0ad598e14f971afa8b0c3306089e1274647915d180d4c1bc84362997fad4d5ecc6770bb937552896f4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-duration-prediction/FP16/text-to-speech-en-multi-0001-duration-prediction.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-generation/model.yml b/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-generation/model.yml index e1684f04f11..b5b5faac0fe 100644 --- a/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-generation/model.yml +++ b/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-generation/model.yml @@ -19,19 +19,19 @@ task_type: text_to_speech files: - name: FP32/text-to-speech-en-multi-0001-generation.xml size: 232924 - sha256: c4c67949991e3d5f69c97f072afcbb5c0672d6c258b78a4f27dce076e2b6a5b3 + sha384: a1dd56f33d09b6ee1c745788e626dbf5846688a28f62eafd58050737ce47a9f8070a19654803e4d45ed14a9b70a2f5f9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-generation/FP32/text-to-speech-en-multi-0001-generation.xml - name: FP32/text-to-speech-en-multi-0001-generation.bin size: 51082860 - sha256: 85b709e49e2bfcdf6e5f519d593658a47ee28a0a0dd2719a398bc60c88bd5edd + sha384: 34f69abdc93df984c7771149b2bc127509649230f7ef41fe9ea8f4eaea3ecbe1fd3856ac005079339fc89b071c46b08c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-generation/FP32/text-to-speech-en-multi-0001-generation.bin - name: FP16/text-to-speech-en-multi-0001-generation.xml size: 232908 - sha256: 2168f46f9c5e0a3f7ceb143a04285c8d839cdbfe43893294a84880586886df75 + sha384: 56eb0e3a7fd49e1defbcfdff565df95342a696abc591f3312f9af2303563fe3b938cf590215fe082c77a88e64b4c79cf source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-generation/FP16/text-to-speech-en-multi-0001-generation.xml - name: FP16/text-to-speech-en-multi-0001-generation.bin size: 25541540 - sha256: 688ec9f7a883b1b805c0f1e5dd69c366cff7454622c44b108f107146fcbc0b33 + sha384: 0a36ab0702b9fc6cfc1a2023b9ef46f1aa0d01d01e87c0bc011fbdf4b3806ed9f57448976e6658835b7c8d6f9d49de9b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-generation/FP16/text-to-speech-en-multi-0001-generation.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-regression/model.yml b/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-regression/model.yml index a5518d12849..23e13720c55 100644 --- a/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-regression/model.yml +++ b/models/intel/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-regression/model.yml @@ -19,19 +19,19 @@ task_type: text_to_speech files: - name: FP32/text-to-speech-en-multi-0001-regression.xml size: 604296 - sha256: d1a12d9657c131d817e645a2a6156519c0e17026f74658e2e885345863c9743c + sha384: 6920d3ace9a6280c310e489cfc173d3e11bfad69d54c1dcadd19344f9960b00819fb9c670a1fea6cf7105a687517f755 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-regression/FP32/text-to-speech-en-multi-0001-regression.xml - name: FP32/text-to-speech-en-multi-0001-regression.bin size: 20493524 - sha256: ab3495c7cb0df6866e1a53792df64e32a4fe412ce74cb8aa2e4b5d40453b747e + sha384: 9a3af6ac6fecc2ae930633fdec371b4e3924fb97dc52fc1af8f927b5a123a88beaa84e412b2ead226e162410ec2b2ea4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-regression/FP32/text-to-speech-en-multi-0001-regression.bin - name: FP16/text-to-speech-en-multi-0001-regression.xml size: 604045 - sha256: 4a48981293cbfa53090c126eb41c391d2f43bb80a2d911f7d2a95c9fb8dee971 + sha384: 914ed67a0cb152d032e481f64e8dfbcb4b7253368e96bb49aff4140796df8d4d99fc49146a98b108e001ff5495972018 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-regression/FP16/text-to-speech-en-multi-0001-regression.xml - name: FP16/text-to-speech-en-multi-0001-regression.bin size: 10246838 - sha256: 2d0d6ca7dc2b0eab36d3fd404a20c08ae386ff8309a6c0b627df307b46443963 + sha384: f8193bf84b91e15e3d6de6af07d0a2d6be4eb8065ba2ad359839d03c258f894fbec70ed0933f59aaa7a0e0e0c19bb6d9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/text-to-speech-en-multi-0001/text-to-speech-en-multi-0001-regression/FP16/text-to-speech-en-multi-0001-regression.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/time-series-forecasting-electricity-0001/model.yml b/models/intel/time-series-forecasting-electricity-0001/model.yml index 0f42162f385..d2227f7b127 100644 --- a/models/intel/time-series-forecasting-electricity-0001/model.yml +++ b/models/intel/time-series-forecasting-electricity-0001/model.yml @@ -19,19 +19,19 @@ task_type: time_series files: - name: FP32/time-series-forecasting-electricity-0001.xml size: 408392 - sha256: 7b3a49bd10fcf732bd25b734331b0a51ec169d527b4ec69a4f57b1de0740e075 + sha384: 86d30b897c606aafabb18801b29930aec5cdf8a34d23e01d8ddad59fd0d6ac41f996026346d20f940dadbf82022c5832 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/time-series-forecasting-electricity-0001/FP32/time-series-forecasting-electricity-0001.xml - name: FP32/time-series-forecasting-electricity-0001.bin size: 10054892 - sha256: fc2916cec4076a369ad2b054ea8b39d60fe1d2df2200dc4789f945308421f05a + sha384: 5a1128c2365fa81acca926e032fce199d33b9f3b9a982e3fe7985e6a9f6d289bbedbc12620a65667873b124ccb6a4eb1 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/time-series-forecasting-electricity-0001/FP32/time-series-forecasting-electricity-0001.bin - name: FP16/time-series-forecasting-electricity-0001.xml size: 408243 - sha256: 417786477958222b8d7116966f0cea29013451bc2a4f997d890e176dd213d6a3 + sha384: 7c4e6da2e7534aac33d6dc8dfe6ed925e5234de1a32b1ca11e84eb7275296904be9f12002638147ee9d7f23fab90ff4f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/time-series-forecasting-electricity-0001/FP16/time-series-forecasting-electricity-0001.xml - name: FP16/time-series-forecasting-electricity-0001.bin size: 5046088 - sha256: e41ed6d16760a114d22c5076e6802b8f9b6c95323b2a99eb7df1904255dbc6bf + sha384: 1dfc3af25e4e38bf7863ef7156893378a5afc75cd1cc8cdbebbe3631e6d2e536609469974e4ff13bc85de483032a5e7c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/time-series-forecasting-electricity-0001/FP16/time-series-forecasting-electricity-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/unet-camvid-onnx-0001/model.yml b/models/intel/unet-camvid-onnx-0001/model.yml index b54b918b49b..9f11fcd702d 100644 --- a/models/intel/unet-camvid-onnx-0001/model.yml +++ b/models/intel/unet-camvid-onnx-0001/model.yml @@ -18,27 +18,27 @@ task_type: semantic_segmentation files: - name: FP32/unet-camvid-onnx-0001.xml size: 68693 - sha256: 21e1a7b1a954b698542d6c8dbf82ba7195355e9705cb90f8a71c116a9f1e7018 + sha384: 421ae16926146770eb17b8394c6a1a191c6b32035cbd532033d4cbaca9d1f3f63357d9021ecfe587d97d7248703414f9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/unet-camvid-onnx-0001/FP32/unet-camvid-onnx-0001.xml - name: FP32/unet-camvid-onnx-0001.bin size: 124129876 - sha256: cf996b45dadfa397f16aad5a7264787e3666a7645eba3653e5c48d42076e86d7 + sha384: f6163e1f896b6745c2e47c75b288a57937978227c8639085666cf5fbbeca4a39f575f1192b47cdce4733fdd58130f88c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/unet-camvid-onnx-0001/FP32/unet-camvid-onnx-0001.bin - name: FP16/unet-camvid-onnx-0001.xml size: 68647 - sha256: 9d23b61642a03e277e6230a516ac57cdbbbd63df6ded9b57c92d806a17e56bb8 + sha384: ef3109735adb5be3415bf69c30de77a4ddc960f438ba24c930ec6488908d04f8b10209003b0d7272b779710545c06b6d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/unet-camvid-onnx-0001/FP16/unet-camvid-onnx-0001.xml - name: FP16/unet-camvid-onnx-0001.bin size: 62064942 - sha256: 0c8dda21bc6ad71f6e78dea15d228f1bb293efeb2e97dff8d91ea91d357ca080 + sha384: 1f235fb2ee5720d07ed795a0ab15ac6929d219f2ca5876b690b5030d42b46d1f79b3a4220e0e2493667b8ef08f986cac source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/unet-camvid-onnx-0001/FP16/unet-camvid-onnx-0001.bin - name: FP16-INT8/unet-camvid-onnx-0001.xml size: 146408 - sha256: b78bb4fcf1b63c6f75f3535e65ca785ffe19ac25ab11c01e4da2ea45ef577e53 + sha384: 7e0630b00fbffd25ff0305304b418d1700c1181355ee8a05ece11187d498b959b7aeb797c39209bdb50f1ce46e548553 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/unet-camvid-onnx-0001/FP16-INT8/unet-camvid-onnx-0001.xml - name: FP16-INT8/unet-camvid-onnx-0001.bin size: 28699774 - sha256: 841c71ab50dd8d610b441214478e846dbc194cdfe8a4770e6e438fb1082a5e04 + sha384: 59d79662ebbe0ded23086935087aa24665a38f8df40042ed62233f76d75232b6e92552198e9b7032dfa3c5f6d6dc6e15 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/unet-camvid-onnx-0001/FP16-INT8/unet-camvid-onnx-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/vehicle-attributes-recognition-barrier-0039/model.yml b/models/intel/vehicle-attributes-recognition-barrier-0039/model.yml index 1e4b7baacac..cf6b7b36c69 100644 --- a/models/intel/vehicle-attributes-recognition-barrier-0039/model.yml +++ b/models/intel/vehicle-attributes-recognition-barrier-0039/model.yml @@ -18,27 +18,27 @@ task_type: object_attributes files: - name: FP32/vehicle-attributes-recognition-barrier-0039.xml size: 39740 - sha256: 3ed1d4cc6fc1becf763a39c95154917a7b81eda2d77f7bcd6ee56b0e7409e6ad + sha384: fa1e30c9d9d351f80fd85585fbb1f81a34fd1935a884c149fcc0c305811bdacdcdab4f581b5531d7bacc57fec7cd367b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0039/FP32/vehicle-attributes-recognition-barrier-0039.xml - name: FP32/vehicle-attributes-recognition-barrier-0039.bin size: 2504028 - sha256: fc556ae02cecb5c19d7bed84f8b4b289144dde11509d2ad12f38eee3cdba43d9 + sha384: ba8839771af476bb32aadcff6defb07169016f148e5c8b12dd3cd15a4d9b6c79ee26ef40b7c1c5f84b8fe8a169e53020 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0039/FP32/vehicle-attributes-recognition-barrier-0039.bin - name: FP16/vehicle-attributes-recognition-barrier-0039.xml size: 39727 - sha256: 5d830e98b0415f5c30fb922c0accb0b970408cc8dca35289353eca500aedba3a + sha384: 94183fc503a928a2d8b21799031405bf72c555378c4b27955dcb44f57a8077dee19c7370224e4ac00333a6004eb7f300 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0039/FP16/vehicle-attributes-recognition-barrier-0039.xml - name: FP16/vehicle-attributes-recognition-barrier-0039.bin size: 1252026 - sha256: 251687d7a28abb7d7808e79bdaa675927616d24aec2eea88c50f923f3199f18f + sha384: b706f6671c035f6529ba8a13fd8cec59779e80eef57accffbb29064281e19d97a04374de4ae660e7aff27245b276d223 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0039/FP16/vehicle-attributes-recognition-barrier-0039.bin - name: FP16-INT8/vehicle-attributes-recognition-barrier-0039.xml size: 100522 - sha256: 516bb58deaf5f7319d3db04d34306bb10f75c3b47c57102463a4be0bab588605 + sha384: 1d8a1dd78b3181a6247d2c6d9106ffc025112d759680ef468eeb537a5db8af6e4728daf9be7da648d64f0779de46264f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0039/FP16-INT8/vehicle-attributes-recognition-barrier-0039.xml - name: FP16-INT8/vehicle-attributes-recognition-barrier-0039.bin size: 631140 - sha256: 7ded2a18467752ee84ff96d309f16cd2b373f6c809b9bf45d962175612d60e81 + sha384: 77e7e693dd22961b63d4b6293e0ac03aa30a9f5e43492690319017ede1c1428074aa647dea958276299646cb94d6a872 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0039/FP16-INT8/vehicle-attributes-recognition-barrier-0039.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/vehicle-attributes-recognition-barrier-0042/model.yml b/models/intel/vehicle-attributes-recognition-barrier-0042/model.yml index ddefb225966..6547d7b3b17 100644 --- a/models/intel/vehicle-attributes-recognition-barrier-0042/model.yml +++ b/models/intel/vehicle-attributes-recognition-barrier-0042/model.yml @@ -18,27 +18,27 @@ task_type: object_attributes files: - name: FP32/vehicle-attributes-recognition-barrier-0042.xml size: 71368 - sha256: 10a204e57e962a7e266fd937f49a86a28ebb1b7d11e3ee71afdd57b343df486f + sha384: 611ea88b55868c85177fa7e29f4cf6b668b0244d52010ab924a2ed4b02a8bc1beb3b3065245e54cc57abe83119d3fdb6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0042/FP32/vehicle-attributes-recognition-barrier-0042.xml - name: FP32/vehicle-attributes-recognition-barrier-0042.bin size: 44709500 - sha256: 8e1deef0ecc0f01ebaa1bc973c56455c31678bd0fcfa7c405fdc4eb5d2d06034 + sha384: ee20edb45203dd7e6543ee903d285875cef47ed71702d25af93f1634b43b65115964db5d89cfcd3838e2e8e35e810d83 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0042/FP32/vehicle-attributes-recognition-barrier-0042.bin - name: FP16/vehicle-attributes-recognition-barrier-0042.xml size: 71342 - sha256: dce3a3fd01b834a910b143e224093a8795421536c8fbe59948e46e37ea2a442b + sha384: 9d0222795c1a66a4c0a4bf420c137f6069716543e8e5287cdbf98ede65b5e3d70d3a1b524688bbfb26d9c50d77d6b42b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0042/FP16/vehicle-attributes-recognition-barrier-0042.xml - name: FP16/vehicle-attributes-recognition-barrier-0042.bin size: 22354778 - sha256: 017515c493cecd76a00b6d89a5a3a9503bf6d6103f4a702d126c1aadb6824e8d + sha384: 181fee3d2e46be561c75135de0c299419322ea374bdb778b962d9f19e7518fca5368521f3fa4313819f7ef2a89f7872e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0042/FP16/vehicle-attributes-recognition-barrier-0042.bin - name: FP16-INT8/vehicle-attributes-recognition-barrier-0042.xml size: 174799 - sha256: 36f662838918ae1b7773833c2d2c2b55fc18d244ea28355257c037ade3600a34 + sha384: 60e9db666d37b2d55a0da5704247e4eb4632efaa061b79de0ef6a41898154dd9fee79c18fde3954c82cb3c1b705f2062 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0042/FP16-INT8/vehicle-attributes-recognition-barrier-0042.xml - name: FP16-INT8/vehicle-attributes-recognition-barrier-0042.bin size: 11208728 - sha256: fd0ee54a082f08e02545286990ed325ec05f309ff98adaa26d737de6f0199e49 + sha384: df329c622a4e61b33c89a965a66409c363d03749577059bf1b307bc2371a7d43274ef85b9ef307a1e923167bf45f3e93 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-attributes-recognition-barrier-0042/FP16-INT8/vehicle-attributes-recognition-barrier-0042.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/vehicle-detection-0200/model.yml b/models/intel/vehicle-detection-0200/model.yml index e2065496608..636e4742b89 100644 --- a/models/intel/vehicle-detection-0200/model.yml +++ b/models/intel/vehicle-detection-0200/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/vehicle-detection-0200.xml size: 200422 - sha256: 53bca8446f6b50dec3017258140d8e2c47af28386d47f9cadf3cb5d1cfff9c42 + sha384: 11f190a2676ef7e57166bd6dcc3767517db783289dfda9982aa89c6c13c595a393a8cce70d3b63b40471f762cc4fd425 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0200/FP32/vehicle-detection-0200.xml - name: FP32/vehicle-detection-0200.bin size: 7269168 - sha256: 22968dd07f17738f11e61cd956976e5ae4789c00635e0418155a0da8ba8146fd + sha384: 8a1ed6e7aa1860ae52ab11143b1f034a33d869bcfaf975312e07739c26571ab059324c8aafc7a56059cfbf88fb35172b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0200/FP32/vehicle-detection-0200.bin - name: FP16/vehicle-detection-0200.xml size: 200359 - sha256: 25994cafe800089d7915a4395fcd465be934cccb44ea47addc9a43c6fffa487c + sha384: 76dd41714e87ec0967d146bbb071e3a7ea858317d757ac2bd32f74b203f2087d1fa5ae19c7f3b24fb059e457065bb2e7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0200/FP16/vehicle-detection-0200.xml - name: FP16/vehicle-detection-0200.bin size: 3634626 - sha256: 8e2779dd1bbed6f08a923ed8a2d581ab5bec6de487849726708f9e8b18c3556f + sha384: 8d1487683f9ca2a570f4b2ed4ac2c29ce8add11ccd6fc01180380adf4a997f42385b160d18e8e712a730586910519dbf source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0200/FP16/vehicle-detection-0200.bin - name: FP16-INT8/vehicle-detection-0200.xml size: 482340 - sha256: bbaaa0dd0c111a0904082a9354989c6e137c33934f31c17db621da2fd06fd3ee + sha384: 4205b249e71e1ca586bdf97b59a862ab0d100fe78e71f4326e2d2d05091adbb46924b131feb691e41b6f02d36b7104bb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0200/FP16-INT8/vehicle-detection-0200.xml - name: FP16-INT8/vehicle-detection-0200.bin size: 1921618 - sha256: b4e8a2187d17f9ac952583cd5ef362bf7ff5b3bbbf1f300c46ddfae3e80d1840 + sha384: 8d3227b5f9c4286ca13bde56bd4c8a65c2632320bebeed4460bb73e2b61c2730eb340c7ea91a91e961b513e0e6bc96b6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0200/FP16-INT8/vehicle-detection-0200.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/vehicle-detection-0201/model.yml b/models/intel/vehicle-detection-0201/model.yml index e8c986b075a..eade39dae47 100644 --- a/models/intel/vehicle-detection-0201/model.yml +++ b/models/intel/vehicle-detection-0201/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/vehicle-detection-0201.xml size: 200613 - sha256: fc18e38f0859c533d7398a4be6b50f716bf0e149d61884f8388a8a7d1597dfa5 + sha384: 16aaa4d1643977a783df4d100762865ae1570f361da50150174e4fc5ca93f5185b80ce6508e66f97ddd33b4aaad65d47 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0201/FP32/vehicle-detection-0201.xml - name: FP32/vehicle-detection-0201.bin size: 7269168 - sha256: 6ad77363ad7b4071d9a16f171cf4d6b08fab80ebbac395cb36e095223671d22f + sha384: 32d4a9904743351b0e6509869c1138b30792cdd7d8352431c9abb37f2c61031786359ef90f796663305b05859ac12b55 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0201/FP32/vehicle-detection-0201.bin - name: FP16/vehicle-detection-0201.xml size: 200550 - sha256: dce856c50ad70c3f2c6276eb0d4301459afaef50fd58daf69c641d87553017b4 + sha384: 6f41497e388b16a47483d9a1b97ebff6614ab580df36b9bd2ae7f87d060e0139b201631522038da268627d86f536963a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0201/FP16/vehicle-detection-0201.xml - name: FP16/vehicle-detection-0201.bin size: 3634626 - sha256: 25c70860906bc9bc1470b95983c7638ec704205094a1716eacfe3b7eb413c046 + sha384: 380a4f18299e78a76733230d9598f2197c1c427ec23af6f9dceb58be8bc8a2eadab6950602b9b8f742f87c0fa8ee8a94 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0201/FP16/vehicle-detection-0201.bin - name: FP16-INT8/vehicle-detection-0201.xml size: 482561 - sha256: c8fd94d25bbb617987be4c39d56a135a30b7e1ecd434a9828014196d4256d45d + sha384: 45a7fd48dc9b494b2194d9baff92e8b449318647536274403f9c2d08718d4dfc8477c033eaaab76cb6c2ece91b53d501 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0201/FP16-INT8/vehicle-detection-0201.xml - name: FP16-INT8/vehicle-detection-0201.bin size: 1921618 - sha256: 4b63df1e98481a959316ca9461a6bb37322db6e476f7555d47e00bd0abed22fa + sha384: 138e630fb89370810d876ea59bcf6513624e1697314d0d6aa734694344d2624d9afa53f13ed7565564e95b2544e585c5 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0201/FP16-INT8/vehicle-detection-0201.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/vehicle-detection-0202/model.yml b/models/intel/vehicle-detection-0202/model.yml index 82de7bfeaca..669de633831 100644 --- a/models/intel/vehicle-detection-0202/model.yml +++ b/models/intel/vehicle-detection-0202/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/vehicle-detection-0202.xml size: 200694 - sha256: 7a0a66e34b2b66c4a50291e5e4f638c36d844c4b49347cde829f3ec411c665e9 + sha384: 7ec74bd0d96e71ac51f13f9efaed35fe3b0f4f088a0f4cb4350d120c58c98f0999fb48ec52e74a1545085e04d1ca0e4d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0202/FP32/vehicle-detection-0202.xml - name: FP32/vehicle-detection-0202.bin size: 7269168 - sha256: 5b9c9d0f5d6543fd6c27df7c09d2adc0fd0ae2fb67d803cbfaeabba6861d3de4 + sha384: b14356dcfefb87d913bb85d35e697a118cc3d0837944d672a6dbea36ed02cc116d32f636a08c36a7d62eb8f41c0103fe source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0202/FP32/vehicle-detection-0202.bin - name: FP16/vehicle-detection-0202.xml size: 200631 - sha256: 978c8c2bf77ee02f1a7ea920ceb4bdb3db99493fd0de24dd461102c57c25e782 + sha384: 13219e91027dd83bea5f9eaba5e963d05214dfd672246ec579871b6c588ea32b8408af3650f4b9be2e31c0887a9cf0a0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0202/FP16/vehicle-detection-0202.xml - name: FP16/vehicle-detection-0202.bin size: 3634626 - sha256: 6e612af65dd992a3013ffff91739a70b93230ac7a98646a1c274daf93f056edc + sha384: add1d413846fdaa02eb0e8aea96d3bb0c25d4d75cbc11986ade7911aa19bad7d03fdae7afc83f52322681308dedf0b5e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0202/FP16/vehicle-detection-0202.bin - name: FP16-INT8/vehicle-detection-0202.xml size: 482673 - sha256: 899b9508a3fe2cadf9cd7021765cbc93ac1969369f968d26939217f6eae9a18f + sha384: f6682cc137cd795c52b42577b66c73745567a214c4850b7a33b17b8e4ae8271726d76c848391b0da8750d6fbd278ce1b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0202/FP16-INT8/vehicle-detection-0202.xml - name: FP16-INT8/vehicle-detection-0202.bin size: 1921616 - sha256: 8ea4bab6809ad081ae7b9b93e03b99bed1ffee547d4615cdf18898e56c0e9a8b + sha384: 4c47ab4ebc0c896b41e2f2d75061421fca539b8dd9a9f68908d22c7a43f1fb1cd12d21e65e72c8d9a280ad4259d9c252 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-0202/FP16-INT8/vehicle-detection-0202.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/vehicle-detection-adas-0002/model.yml b/models/intel/vehicle-detection-adas-0002/model.yml index b7eb5eec475..5ee9c284682 100644 --- a/models/intel/vehicle-detection-adas-0002/model.yml +++ b/models/intel/vehicle-detection-adas-0002/model.yml @@ -19,27 +19,27 @@ task_type: detection files: - name: FP32/vehicle-detection-adas-0002.xml size: 217197 - sha256: 6fd5a47bdac0f629df82671d211ff3d9381b856ea83accf7a8f0f30ddc19009f + sha384: a6366d033c85aa559cd6c3167cc818cdfe0e61a1b5db3a4f7714d87d87d6db9f463370f61c12063000aaa75ca85daa6b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-adas-0002/FP32/vehicle-detection-adas-0002.xml - name: FP32/vehicle-detection-adas-0002.bin size: 4314552 - sha256: dbe837dc1628ede3da0f4fe1e3a5f9a0457ef55c8bc050ba9ca257cd75d01929 + sha384: 369480a4c62856db8d10585f556c03df2fc75dd58077ef5e0e74f188d52fff91aec4792d2c94c7ca036803a527fbe676 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-adas-0002/FP32/vehicle-detection-adas-0002.bin - name: FP16/vehicle-detection-adas-0002.xml size: 217151 - sha256: c1fb417f6ce3d37b711d40942872818f222ceb038b5979094c5d0e2459025507 + sha384: 9ed86f48be6f5918c25f856fb02931a2801a18ee622151a0b6fd7ab93cc09d7ff0227412bf85d0f5edab8efec82323ed source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-adas-0002/FP16/vehicle-detection-adas-0002.xml - name: FP16/vehicle-detection-adas-0002.bin size: 2157328 - sha256: e119b3bec50bc836f2eb26a56a40a6d5e3c33bde819f3e6d00f829978092742b + sha384: 85053fee25588f780040ad6897804632e53b28dfec643dc8ff49e99c5f4722e70fbcacb4240159a69aaa6003e913e8e6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-adas-0002/FP16/vehicle-detection-adas-0002.bin - name: FP16-INT8/vehicle-detection-adas-0002.xml size: 440420 - sha256: 1db004b51b45366a5be99afed9dd857ddaf8424c17d1020efbb01490d3084e16 + sha384: a926b2d083558d9810a4dc3d08167a896dc466d276cae0111b189fe04ca6f25897273d6efb0d0c426942de9ec9c57b84 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-adas-0002/FP16-INT8/vehicle-detection-adas-0002.xml - name: FP16-INT8/vehicle-detection-adas-0002.bin size: 1123348 - sha256: 4a3a61c14e9b0531f2013aad3b07f06c6d962a7734e0f9f671ac6620bf05405c + sha384: 58a9b1f0435321d79eb9e95744fdac21f512fe8d901cad7d23b43a434eae4696ae4d4ceaa9fdefbcf037b4a58f83c012 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-detection-adas-0002/FP16-INT8/vehicle-detection-adas-0002.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/vehicle-license-plate-detection-barrier-0106/model.yml b/models/intel/vehicle-license-plate-detection-barrier-0106/model.yml index 3a567c2144c..2702d5b53ee 100644 --- a/models/intel/vehicle-license-plate-detection-barrier-0106/model.yml +++ b/models/intel/vehicle-license-plate-detection-barrier-0106/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/vehicle-license-plate-detection-barrier-0106.xml size: 242320 - sha256: 74fecd516d990371613330e4386d66879c7fbb445e45a6abeb043f022f323a45 + sha384: 29d5d667e0b21e67d6da7632c0b624f744752cd862f5c4045697700fc25e59831bbf1062cfb7b9a6d3767ce6d955aab0 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-license-plate-detection-barrier-0106/FP32/vehicle-license-plate-detection-barrier-0106.xml - name: FP32/vehicle-license-plate-detection-barrier-0106.bin size: 2573373 - sha256: 7b19141e631acd08b16d5940144343d4afeae66c13f9daeb2cd3215ece6cfba0 + sha384: 3a22679505ee688ce30e91e3649268130606e972b18b5fe19be7be575c13ca19907bd81d77e12222c3d83e57ee474a4b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-license-plate-detection-barrier-0106/FP32/vehicle-license-plate-detection-barrier-0106.bin - name: FP16/vehicle-license-plate-detection-barrier-0106.xml size: 242253 - sha256: 8177274a661f4e4e250828e9adaf5b48d23c033afb792b9c3fc6e051b0dbeb6e + sha384: 5e5130e891bfcbc84d7324821ea24a305174376ffc0d8f9cb664078e0a56d1b34e75ef51d176daceacf1ca4a179dad46 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-license-plate-detection-barrier-0106/FP16/vehicle-license-plate-detection-barrier-0106.xml - name: FP16/vehicle-license-plate-detection-barrier-0106.bin size: 1286755 - sha256: 81ebfad23ceb6cb366a9b8bb44666c2ab2cb8366ca029c56f8c12b2fb5a2e14e + sha384: f5182f5b913dbe1bc1f2ecf11633c94c779a3548d7d71580e7ff4f78101f1ad51eb276c0cc654e471de8b57c2ce85c72 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-license-plate-detection-barrier-0106/FP16/vehicle-license-plate-detection-barrier-0106.bin - name: FP16-INT8/vehicle-license-plate-detection-barrier-0106.xml size: 565981 - sha256: afe6eca7bd5506f2bc81506de459cb2c25cfd774e2fa052d8177d88df05155df + sha384: f4dfd8206e67f93312a55d74a836cf0e2384550698f747f97ccdc8917e77381615e124c6b1cbc45765830d7a9c14fa2c source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-license-plate-detection-barrier-0106/FP16-INT8/vehicle-license-plate-detection-barrier-0106.xml - name: FP16-INT8/vehicle-license-plate-detection-barrier-0106.bin size: 693931 - sha256: 94bf328341b7dade027a702ae30427604b4c64bd176284c207e4437752c8c5e4 + sha384: 6385cb3ed52f001c12eb06d57ad925f26510ecb9663d17f707b782efd7b42434c7b3e8bc5ebcc09218181aea2ed45f4d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/vehicle-license-plate-detection-barrier-0106/FP16-INT8/vehicle-license-plate-detection-barrier-0106.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/weld-porosity-detection-0001/model.yml b/models/intel/weld-porosity-detection-0001/model.yml index 220653ec45a..1ae4a26bb37 100644 --- a/models/intel/weld-porosity-detection-0001/model.yml +++ b/models/intel/weld-porosity-detection-0001/model.yml @@ -18,27 +18,27 @@ task_type: action_recognition files: - name: FP32/weld-porosity-detection-0001.xml size: 63294 - sha256: d40ef26673ad7e588a89e7e3ad29c041502357beffd8feb567f319a9c12b0409 + sha384: 714957312fd633b31c437c05300577c0f5a4a975484769c407faf258c6609f5f2d3d2dce8e0edc42a20e74c2846d0cf4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/weld-porosity-detection-0001/FP32/weld-porosity-detection-0001.xml - name: FP32/weld-porosity-detection-0001.bin size: 44693044 - sha256: 91fd5057ce1213c705518648dbf62e16a59061e8f2dcd02b83a9137d66ba6327 + sha384: 34b2decb3f381810b706083da42fad6462c96d98a1447df4e332fd2dc3f7208991bb16dd4167cee965fee7845e097035 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/weld-porosity-detection-0001/FP32/weld-porosity-detection-0001.bin - name: FP16/weld-porosity-detection-0001.xml size: 63269 - sha256: 43ab4b9138187ac5592ea72006d0f8bf70dfe3303dceacb92661c756f71f5f73 + sha384: 5fbab58adb5b24453c2c7636ed2ee1d2a359f9ff9b51b48a2b26c318cbbe5d79d7b28cb428599b8ad2d149d8485ef456 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/weld-porosity-detection-0001/FP16/weld-porosity-detection-0001.xml - name: FP16/weld-porosity-detection-0001.bin size: 22346530 - sha256: 157c06cd80929fc4abec9ffa760345e0dae536a98034e0f45a3b247d285d13cf + sha384: e7aa38cf7377e709280f353a2949029c220edfa9a0141e13ec0466669d73de00174d59820b4de107af0a0358f0bcf48d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/weld-porosity-detection-0001/FP16/weld-porosity-detection-0001.bin - name: FP16-INT8/weld-porosity-detection-0001.xml size: 162672 - sha256: aae1b1666844a28e50ca121cd1d018b0b0cc6253a528510c626d72f4da82bc6a + sha384: edb0137a41e63c40fce55e83dbf110716a999dcba79df97b0174b6483e3d44c1de3098708d600231ec211df5f87360b1 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/weld-porosity-detection-0001/FP16-INT8/weld-porosity-detection-0001.xml - name: FP16-INT8/weld-porosity-detection-0001.bin size: 11197380 - sha256: cdc129afbb26bf6d5fb5f7dffd32e6425bd41dbe5c6097fda7c7270f32ad47bc + sha384: 7b879ca13c8bb8e913400b645ef476652d4ada31bcac512b05c6b7b4969aacdde616be3dd4f4a5f5e3f08e635cc253af source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/weld-porosity-detection-0001/FP16-INT8/weld-porosity-detection-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/yolo-v2-ava-0001/model.yml b/models/intel/yolo-v2-ava-0001/model.yml index bc11da6bd21..bbc4330f000 100644 --- a/models/intel/yolo-v2-ava-0001/model.yml +++ b/models/intel/yolo-v2-ava-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/yolo-v2-ava-0001.xml size: 84732 - sha256: 88b3a5ab21e2a1eb6078834d91e4607d80246568141c9f748b5717aa8b63517a + sha384: 94fa2b370a9367d9e1f609b775f2bd6a901a81e7d8e8484bde35bb130700194c0f80f44a4853268c29788f67ec4a366a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-0001/FP32/yolo-v2-ava-0001.xml - name: FP32/yolo-v2-ava-0001.bin size: 202580240 - sha256: ec32cd3d02e629685dc818a8af5734630c1f778a8a715cef93444aeb1bc88132 + sha384: 4d25c6def4815cfc68261ea8b646b3995db8d374f8e11760f21eeb026addab87c2ab0e751458f2a5dbd9ccee9d05a5dc source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-0001/FP32/yolo-v2-ava-0001.bin - name: FP16/yolo-v2-ava-0001.xml size: 84703 - sha256: 124dfec7f7b8bedc55ae4adef87f388ba02ae56f41fc54c8570bd1d8895e770a + sha384: b3fa31cb8dbbea60cb465ddf3de2db07feb76350b2625823be23ece9db05ea676fd450fb76bc083d47eab5ed39104a35 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-0001/FP16/yolo-v2-ava-0001.xml - name: FP16/yolo-v2-ava-0001.bin size: 101290122 - sha256: 3d64e39d4c0378eaf870834a072725bc9e7320a5cc4ffa3422f13d0dcd170ddf + sha384: a687bb2b57479b05595bef2c0d2515766128271535f3c078178e533bfb08fd6982362121bb2ee44f3d68af67bfcce103 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-0001/FP16/yolo-v2-ava-0001.bin - name: FP16-INT8/yolo-v2-ava-0001.xml size: 182973 - sha256: a0ecd3a86f760a706732f62bc25d543c1df43679a154e85cce3647c2a19c2109 + sha384: cba03125b8a09e4cc14bfc23f2a417514bc3aa75c1658ae00155d71431a47d425c000f2fadf6f2d807ed0a1caa4bde84 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-0001/FP16-INT8/yolo-v2-ava-0001.xml - name: FP16-INT8/yolo-v2-ava-0001.bin size: 50697466 - sha256: 5ff7998ee1139a19a3765cc4e2fb672022fbaf5007791dca657a3e0a339231b9 + sha384: 1e799cff915cc09cd01026ee322ad70f10551e12c00f3fd3699cd8711a604214588743e78690b60392fafc31f6b5c790 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-0001/FP16-INT8/yolo-v2-ava-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/yolo-v2-ava-sparse-35-0001/model.yml b/models/intel/yolo-v2-ava-sparse-35-0001/model.yml index 7d22a9b13f3..9f044279988 100644 --- a/models/intel/yolo-v2-ava-sparse-35-0001/model.yml +++ b/models/intel/yolo-v2-ava-sparse-35-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/yolo-v2-ava-sparse-35-0001.xml size: 84752 - sha256: 46c3f75b12eb3e90ba05398994f4354bf630466acd79aaa91ffad6513ded1a02 + sha384: cc76a7d7da8bd188cca4ac6fdce586d6779cb9eea9446aee5ed7a93e35c9ba909b98aedf23deaf17b4940d4ad1c5a50d source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-35-0001/FP32/yolo-v2-ava-sparse-35-0001.xml - name: FP32/yolo-v2-ava-sparse-35-0001.bin size: 202580240 - sha256: 3ba29689fd746d99e758ba15e6285d4d6e10e06616ca3113f2f7fbb2c0f85511 + sha384: d887541ef0f13745d3e6052ef8b553b0e9ccfa716890c761ead59a614075751f14c2312fb2a2f90ffdec29c58d0d7da7 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-35-0001/FP32/yolo-v2-ava-sparse-35-0001.bin - name: FP16/yolo-v2-ava-sparse-35-0001.xml size: 84723 - sha256: c2a876bced92cac057c4349d1e5c7cff33824580a3c5940aad62b39c26846191 + sha384: 9789afffec6bd72644773d97f62f1b9f9a80411f80c50f1ce0876680ec0929b7b09850304b28445ef212a6f51d74a873 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-35-0001/FP16/yolo-v2-ava-sparse-35-0001.xml - name: FP16/yolo-v2-ava-sparse-35-0001.bin size: 101290122 - sha256: 70b6f76b11edb38761d707555ed50183b36eece352bd01af5d10fdcda7a6ff3b + sha384: 44c744390d7179672f71bac0ef36f9ef4ed9091b907cdc0dc5585e5834995868c00f49a8e5a0a6bd90676a3d023d219b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-35-0001/FP16/yolo-v2-ava-sparse-35-0001.bin - name: FP16-INT8/yolo-v2-ava-sparse-35-0001.xml size: 183003 - sha256: 117b0cea29168890198c8901122b443c93839d2b7e4179245f4c9b42f9d28dd3 + sha384: 36cb9f586d6b548714caf8016439fc642874cb967b8a511162bbc122460417586f77c1da8cc522a8d8392165df2c27b2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-35-0001/FP16-INT8/yolo-v2-ava-sparse-35-0001.xml - name: FP16-INT8/yolo-v2-ava-sparse-35-0001.bin size: 50697466 - sha256: 874f467f1b8919a7efb56891a8202e5adf23dffe8c4bc1ef1997b42390ff9cfc + sha384: 764f84bb97efc85f2be904126eb7affef17edfd45c2ae1a2bf2628e1280895019d122c1a98b03aa5ad2427580525df6e source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-35-0001/FP16-INT8/yolo-v2-ava-sparse-35-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/yolo-v2-ava-sparse-70-0001/model.yml b/models/intel/yolo-v2-ava-sparse-70-0001/model.yml index f2efbebf832..199ab1de63c 100644 --- a/models/intel/yolo-v2-ava-sparse-70-0001/model.yml +++ b/models/intel/yolo-v2-ava-sparse-70-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/yolo-v2-ava-sparse-70-0001.xml size: 84752 - sha256: c3553a1174610c87feee03e2259c05492248069f06dad0f9b693a7242285e580 + sha384: 78ff7a5c752cd03f36c3b0e01cd2b80dc0e9454312ff615ec90b6992514d247922c665aa707647beb22bb6ddc2e4af5f source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-70-0001/FP32/yolo-v2-ava-sparse-70-0001.xml - name: FP32/yolo-v2-ava-sparse-70-0001.bin size: 202580240 - sha256: 8af740a7af01a06561f599f4a0b0c9d7e423437bc6acab0f123bce170978e420 + sha384: 1af872f5720415517836565506c6ca1fe5de3625e03ba7bded0ce9703801f40e1e5a98d66c9ae3f2c13632f8cf984dad source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-70-0001/FP32/yolo-v2-ava-sparse-70-0001.bin - name: FP16/yolo-v2-ava-sparse-70-0001.xml size: 84723 - sha256: a9dcb2df2bd789044da00ca863dab5d545712186bbb65c2103dc5a741d0937f5 + sha384: 5ffe79d15a41c9ff5b5b93bffd96a34fd8c6b704f2e79ab7885178266f03f7d5db6e068a88dc3137b3710ea92b863456 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-70-0001/FP16/yolo-v2-ava-sparse-70-0001.xml - name: FP16/yolo-v2-ava-sparse-70-0001.bin size: 101290122 - sha256: 4e377e55053fa15b52d8e4012418143c7430b8a337353ef1aeb88cbe9c50a7ff + sha384: 18c05dae73e8b21e1f4dbdd0b5727ff45bf90950b4270fbda98db2a44fb93ffb937389b9ac01b3ae339441be22a41688 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-70-0001/FP16/yolo-v2-ava-sparse-70-0001.bin - name: FP16-INT8/yolo-v2-ava-sparse-70-0001.xml size: 183003 - sha256: e539c704804144bbe867b5b068f21065ceb47e0cd4a386398b82e1362755f6b4 + sha384: 0ba687281bac1d4405f36e369c6de3e7c0abaf7b0c7a016cee305df94da1672b7fd1a970fa76f708b801f2164900da46 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-70-0001/FP16-INT8/yolo-v2-ava-sparse-70-0001.xml - name: FP16-INT8/yolo-v2-ava-sparse-70-0001.bin size: 50697466 - sha256: 7f8b10e0980e5e3832a60a1ada99cf0f145598d8180707a16541c941fbf21a5b + sha384: 789c868b3d616016ab5af2d57f2c180dbab7fb7622a83a46c5da69e01046ede5d6717dc508fad626f2e819e34bd1e7a4 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-ava-sparse-70-0001/FP16-INT8/yolo-v2-ava-sparse-70-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/yolo-v2-tiny-ava-0001/model.yml b/models/intel/yolo-v2-tiny-ava-0001/model.yml index 4e127359628..8581e1a12a6 100644 --- a/models/intel/yolo-v2-tiny-ava-0001/model.yml +++ b/models/intel/yolo-v2-tiny-ava-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/yolo-v2-tiny-ava-0001.xml size: 37012 - sha256: 27749dbcbc6cd1bcbd3f6329a16c20887b868f1f7fadeb58e960237f2c8a4dbf + sha384: 56b7f9c4d5f062b431fe81449b86057f4dfff728cd1d2488b7aeacf42b308eb6e5bc281f1defce2b50a3bbb68edbe408 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-0001/FP32/yolo-v2-tiny-ava-0001.xml - name: FP32/yolo-v2-tiny-ava-0001.bin size: 63434896 - sha256: d7d0219f039d9621efccc3c43e6c74ad6222ee7ba526901e9975ba5661433322 + sha384: fb44b2ca04828542ea80c0f31f9c5f6e86627d448296f34435bc485c1a0210542f64a8d40acd4309b05d83da31894c78 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-0001/FP32/yolo-v2-tiny-ava-0001.bin - name: FP16/yolo-v2-tiny-ava-0001.xml size: 36991 - sha256: 52b15a4352d3c9f99c62ab5654751021f977ab8ebbe08296d625e53d57a005dc + sha384: 2a404227ff6c1a4087c0d3e1113f84eb955e8f76cdba120cdae05e5aa7257e639aef0afb9f452392a391841b4c4314c1 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-0001/FP16/yolo-v2-tiny-ava-0001.xml - name: FP16/yolo-v2-tiny-ava-0001.bin size: 31717450 - sha256: a28d0eced820152c696375390124d6e63ed56048190f29982a0d5fd2ce8d2cf4 + sha384: 0b40d67bf5c5b8bbfd8d821eadd07a51c652bbeb28003f1fbdc833dda35c172e055c0bec9d832a1369fb820d084de151 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-0001/FP16/yolo-v2-tiny-ava-0001.bin - name: FP16-INT8/yolo-v2-tiny-ava-0001.xml size: 76415 - sha256: efd6dd66ecc968a976b72aa350d7a453265f40ad6232e1e3e63f3a5b98f71d18 + sha384: 1d995298cf8db513a4196be5b02f13fec5905fefe9056c7f38fbe6c14f6f1ebe0464a3b6b98832221392616e2ac34a92 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-0001/FP16-INT8/yolo-v2-tiny-ava-0001.xml - name: FP16-INT8/yolo-v2-tiny-ava-0001.bin size: 15874674 - sha256: 223f50d7864e84341882cff69783974d37f96d17aabb3057d8e8df34f160719b + sha384: 88919d7d8d1ef93b8cc68e163a42bca1b021a72cd3247f73af60fa3f489f0e3d7bb6de5d8a4b0f4ae0ad718c625fb30a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-0001/FP16-INT8/yolo-v2-tiny-ava-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/yolo-v2-tiny-ava-sparse-30-0001/model.yml b/models/intel/yolo-v2-tiny-ava-sparse-30-0001/model.yml index 5271dea0ff4..1b4f67d0b54 100644 --- a/models/intel/yolo-v2-tiny-ava-sparse-30-0001/model.yml +++ b/models/intel/yolo-v2-tiny-ava-sparse-30-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/yolo-v2-tiny-ava-sparse-30-0001.xml size: 37032 - sha256: 33232ad89a1e6931032c47159997afa40b160c32fd36f86e8c988835071c2ebe + sha384: ec9f653e58f9c2be0fd43f3da8267c82f6397f8620003211101b17b2703d83caddcb566de14013b7a5843d271f056fbb source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-30-0001/FP32/yolo-v2-tiny-ava-sparse-30-0001.xml - name: FP32/yolo-v2-tiny-ava-sparse-30-0001.bin size: 63434896 - sha256: 89199208d5a6491141f1dc469b8b98d0c9d43de22b10f8ab57cbbc656c57d200 + sha384: ae614e7ce18287f93b9c27deb0920cc8b815faaab6a37ffd4e3fb993d4c30374af8f837a875194622576057d17ab2b2a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-30-0001/FP32/yolo-v2-tiny-ava-sparse-30-0001.bin - name: FP16/yolo-v2-tiny-ava-sparse-30-0001.xml size: 37011 - sha256: c9f1ffd9035f6d901b0a96031cbf5c5850eebd2f21424f6fba60d36ca24cd822 + sha384: db2a0dea5a858eb1d245ef56741668c830b96a56042d776cb55cdb690b4b57399757702e803190ac8f3672d1517859ab source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-30-0001/FP16/yolo-v2-tiny-ava-sparse-30-0001.xml - name: FP16/yolo-v2-tiny-ava-sparse-30-0001.bin size: 31717450 - sha256: 026eaff315755ad66f7dca256f99b02e2aed68dcf3fcc2641d403dfd88d21f2d + sha384: 7646bf6fe56fb975aa0210db9457cd30edc427561dee28563c930ecb082600018a5fcdb314ec480053dafca5d60da1e5 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-30-0001/FP16/yolo-v2-tiny-ava-sparse-30-0001.bin - name: FP16-INT8/yolo-v2-tiny-ava-sparse-30-0001.xml size: 76445 - sha256: 960e9900a95bf2cb7bde04adc321a1e8ed94a5ee8c9151245dc24b087328f4dd + sha384: 3d11074660107c4eae6b7bb0c28ad3eb58dc211bff85a3925c0619c44c53d2740d5264365360e75ef59ba4c5d889f83b source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-30-0001/FP16-INT8/yolo-v2-tiny-ava-sparse-30-0001.xml - name: FP16-INT8/yolo-v2-tiny-ava-sparse-30-0001.bin size: 15874674 - sha256: e30c12412c99ebe98973ddb908bfa33b4226f747aa46b50f561cf6f07425a445 + sha384: 5b9ec78732eeae55b5fd949a4cc1e63b2d3554ed1d3c7bb21d6d1960d4ac47342b50dc5d916eef47a4ad066165fb46e8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-30-0001/FP16-INT8/yolo-v2-tiny-ava-sparse-30-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/yolo-v2-tiny-ava-sparse-60-0001/model.yml b/models/intel/yolo-v2-tiny-ava-sparse-60-0001/model.yml index 3978a490835..5b7e687e0f8 100644 --- a/models/intel/yolo-v2-tiny-ava-sparse-60-0001/model.yml +++ b/models/intel/yolo-v2-tiny-ava-sparse-60-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/yolo-v2-tiny-ava-sparse-60-0001.xml size: 37080 - sha256: 0f842e479b852c873a9fe5827968b05dacfebe0325efc213ce479a3f78142cde + sha384: d0316986a52946358b2473c9c1efa4ef6d456591fb8592571e9675ff2f8b17044e90a79b990004acd091d5576b1a540a source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-60-0001/FP32/yolo-v2-tiny-ava-sparse-60-0001.xml - name: FP32/yolo-v2-tiny-ava-sparse-60-0001.bin size: 63434896 - sha256: a75760129ebfa1954aa8f244020193bab0a7f6f85450435f696f602155eb80b6 + sha384: 0c7d167da77164fd6cf35cd10d5e8b356188c0fc5d7d03d4b7f2ce408dd894aff3b9a1f957122311b258dcb2c74ad1b6 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-60-0001/FP32/yolo-v2-tiny-ava-sparse-60-0001.bin - name: FP16/yolo-v2-tiny-ava-sparse-60-0001.xml size: 37059 - sha256: 9737ecd67ee790cf052dbbf8a41502e205983fe749ac97c75355ae9cd578d190 + sha384: a6eb2657893eb1b0b1db74cf9c5bda60ee4a0b88a99923610b21df4ea059959ed2ade512097f14d7ab872bb3f766c8a2 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-60-0001/FP16/yolo-v2-tiny-ava-sparse-60-0001.xml - name: FP16/yolo-v2-tiny-ava-sparse-60-0001.bin size: 31717450 - sha256: df0df94838247c45b8cd1918b52140aff0ffaa1cdecd5450e0f8ee261adaf757 + sha384: 6050cfe35a1d2b857e48651fbc3692080cba3b14e16c879d1fdeb33b016721ac3d35796166a79ccb38fb6a4f77b569c9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-60-0001/FP16/yolo-v2-tiny-ava-sparse-60-0001.bin - name: FP16-INT8/yolo-v2-tiny-ava-sparse-60-0001.xml size: 76509 - sha256: 3c24baf064e857ebd78304ca3014f4f9b664ea9270334318316364b3dfa4c2b3 + sha384: 8d72483a8cd1dbfdbc6cec6bb5a713bc6e2b06b2e09dbe7b7986716e2c9dfdb026da1ebf6ab8a44f6ba8cea67aa06213 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-60-0001/FP16-INT8/yolo-v2-tiny-ava-sparse-60-0001.xml - name: FP16-INT8/yolo-v2-tiny-ava-sparse-60-0001.bin size: 15874674 - sha256: 6ce0618f5b0aed6d74bada19dd61d6b0793eddae631dca0338fe5772aea3b70e + sha384: d90339e40377336df1b50a818bca85925d12dd96db239cdd96f16c7dd5933e7cb67b79349992fc460a6dc9ad5cf059f1 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-ava-sparse-60-0001/FP16-INT8/yolo-v2-tiny-ava-sparse-60-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/intel/yolo-v2-tiny-vehicle-detection-0001/model.yml b/models/intel/yolo-v2-tiny-vehicle-detection-0001/model.yml index e15c027e195..e26e5a88cc2 100644 --- a/models/intel/yolo-v2-tiny-vehicle-detection-0001/model.yml +++ b/models/intel/yolo-v2-tiny-vehicle-detection-0001/model.yml @@ -18,27 +18,27 @@ task_type: detection files: - name: FP32/yolo-v2-tiny-vehicle-detection-0001.xml size: 33885 - sha256: 78bb7e9bcadd8ff36637d7b657fc4f32513de4a64b7ebc454e58cf4df19350a3 + sha384: e761b69a6bb2319f600e238d5fa020ce270de6c35e149f4c95daa3cf2bdef550fe3d19187c6309951543074a3f77f5e9 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-vehicle-detection-0001/FP32/yolo-v2-tiny-vehicle-detection-0001.xml - name: FP32/yolo-v2-tiny-vehicle-detection-0001.bin size: 44918056 - sha256: b15e36bcc6763676fd25db67c328242875f0257ef7faf2d3bd8cebfb032151f5 + sha384: 89248f734724ec0653b50b688b661f9036949045a2cc977e06436800609b0d87df861c94b5c349b04bf3d0a837ac5cf8 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-vehicle-detection-0001/FP32/yolo-v2-tiny-vehicle-detection-0001.bin - name: FP16/yolo-v2-tiny-vehicle-detection-0001.xml size: 33865 - sha256: 075722bfa39adc32ce42ed65bd655bb3d26a9dfcfa627400347b242e12a03cec + sha384: 1d73ecdbcd4a1f7d75e2bbe642bf1f78cf29da981a4f1473745ba7e2f4e0bb2a809d7503e5356923e26863da8a32e456 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-vehicle-detection-0001/FP16/yolo-v2-tiny-vehicle-detection-0001.xml - name: FP16/yolo-v2-tiny-vehicle-detection-0001.bin size: 22459030 - sha256: 15aee0ac39cdfeff0f8dfdb85e8b3152331df42d879ba76e9d3c5e7548ca3007 + sha384: f37ede7420c148684f95daae1fc2dce4dac74f05dbf3f551670051098690759bf0dce1d141e462ce78c7f1d3986899ac source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-vehicle-detection-0001/FP16/yolo-v2-tiny-vehicle-detection-0001.bin - name: FP16-INT8/yolo-v2-tiny-vehicle-detection-0001.xml size: 72378 - sha256: a912fbced15e54144a2c7b982fd5a3e5061d240d1176eafdf691c1398e25550a + sha384: 5a2550af977c2705dd028a7fb5cd3fb8a02937bd3c273c590ec3fb6bbbf0451aca459c677a055ae0ec167813422fc060 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-vehicle-detection-0001/FP16-INT8/yolo-v2-tiny-vehicle-detection-0001.xml - name: FP16-INT8/yolo-v2-tiny-vehicle-detection-0001.bin size: 11244398 - sha256: 1de4268f37b86042c321bcbd310b20772da6ccdb5fb5a5e20dd0a30e46a2df33 + sha384: 6e0157516c54008bd28bc91c5aede1fa0cec7b5f168666611aaee2862efd66c72baecced96fe42dc52c3990c4f12e987 source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/2021.4/models_bin/3/yolo-v2-tiny-vehicle-detection-0001/FP16-INT8/yolo-v2-tiny-vehicle-detection-0001.bin framework: dldt license: https://raw.githubusercontent.com/openvinotoolkit/open_model_zoo/master/LICENSE diff --git a/models/public/Sphereface/model.yml b/models/public/Sphereface/model.yml index 26f435eb6e1..61c9b3dcde1 100644 --- a/models/public/Sphereface/model.yml +++ b/models/public/Sphereface/model.yml @@ -18,14 +18,12 @@ task_type: face_recognition files: - name: Sphereface.prototxt size: 11090 - sha256: 7cf5808fd0561db20daae862b83677b7437e788420fae68ab8d97c935e67d82c + sha384: 93065b7dd5a6683a96a9d9906ab2add3e7548b9d5043986476d8e1b8a45df021495c2a564d006fb8598f7995f332aaff source: https://raw.githubusercontent.com/wy1iu/sphereface/7f9acb157c78a99dbefd041fce9f188400bbb4e5/train/code/sphereface_deploy.prototxt - name: Sphereface.caffemodel size: 90688218 - sha256: 092d8fb00291d80ed7e43f7c9323693581cd75e734be3c52764525043288a20d - source: - $type: google_drive - id: 0B_geeR2lTMegb2F6dmlmOXhWaVk + sha384: 52c285241df28b9b2da263ff272d4b97d3a47d3e0c82881a0693097f286e9e53342650b0b8fc6cfef8202ab399b4bfdd + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/Sphereface/sphereface_model.caffemodel model_optimizer_args: - --input_shape=[1,3,112,96] - --input=data diff --git a/models/public/aclnet-int8/model.yml b/models/public/aclnet-int8/model.yml index a653fd5389c..1b83c292c4f 100644 --- a/models/public/aclnet-int8/model.yml +++ b/models/public/aclnet-int8/model.yml @@ -28,7 +28,7 @@ task_type: sound_classification files: - name: aclnet_des_53_int8.onnx size: 10988855 - sha256: 3a4b57b62616a1b3cb2a220b21e1a3c520371d84d3f884df721677dcaefbd1c5 + sha384: 5ea7239032a690b408c0d4e730beae2d6cd49afa918c5e7e374f3fc4c8c34ab0091725fd3de281e83c0560c717e51443 source: https://storage.openvinotoolkit.org/models_contrib/sound_classification/aclnet/2021-02-04/aclnet_des_53_int8.onnx model_optimizer_args: - --input_shape=[1,1,1,16000] diff --git a/models/public/aclnet/model.yml b/models/public/aclnet/model.yml index 3702d50aadc..cbf9e593b23 100644 --- a/models/public/aclnet/model.yml +++ b/models/public/aclnet/model.yml @@ -26,7 +26,7 @@ task_type: sound_classification files: - name: aclnet_des_53.onnx size: 10966521 - sha256: e708aafe0bf5435ffdff7947ce2b66f8b89b3380e4ea901d87b11ebc0f80445c + sha384: 966d8b3e0eb46d7946b7b52baae2e38795a8b892bc9eb8ec6511c28c32caf6f230f0d32a1d4f3a5db97eac31475e990c source: https://storage.openvinotoolkit.org/models_contrib/sound_classification/aclnet/2021-02-04/aclnet_des_53_fp32.onnx model_optimizer_args: - --input_shape=[1,1,1,16000] diff --git a/models/public/alexnet/model.yml b/models/public/alexnet/model.yml index 3420065c59b..e0ccc10832b 100644 --- a/models/public/alexnet/model.yml +++ b/models/public/alexnet/model.yml @@ -27,11 +27,11 @@ task_type: classification files: - name: alexnet.prototxt size: 3629 - sha256: b564ba76416b4ac1e062c6621cbd80d9c19304ba152d9d791c75870f3182c4fa + sha384: 6d620598b210369b6d33c0575b5ec2bd2dc7bce522591d80631b75f854a0324b8f30c4bb7f53dd3346aaf229510e9f2e source: https://raw.githubusercontent.com/BVLC/caffe/88c96189bcbf3853b93e2b65c7b5e4948f9d5f67/models/bvlc_alexnet/deploy.prototxt - name: alexnet.caffemodel size: 243862414 - sha256: 4bff209a9837298157915ef50a4831a59636a6ca1a6b8ebacd990c3a5f3053e0 + sha384: f102235bc9d8f422a04d5254a21fd1862986eae91c7337714fd5d78dcf37f835d05ed7943e80056ae19ca9e9c054c181 source: http://dl.caffe.berkeleyvision.org/bvlc_alexnet.caffemodel postprocessing: - $type: regex_replace diff --git a/models/public/anti-spoof-mn3/model.yml b/models/public/anti-spoof-mn3/model.yml index 5b4d22cb044..580064acbe5 100644 --- a/models/public/anti-spoof-mn3/model.yml +++ b/models/public/anti-spoof-mn3/model.yml @@ -22,7 +22,7 @@ task_type: classification files: - name: anti-spoof-mn3.onnx size: 12270179 - sha256: c4c99af04603b62d7e44f6f4daeb33e0daeccc696008c0b1d62f6f5cebbb3262 + sha384: 6de4534964b723397b3e8c995cadcf43bc007cc2f9930b95ae25f76adccece5d1d4d058d0b15117b9e4a9f758424f92a source: $type: google_drive id: 1KmM2vwGBuKxy7RE9hz1m5D0yyh2N9Amo diff --git a/models/public/bert-base-ner/model.yml b/models/public/bert-base-ner/model.yml index b18c28cd090..7f5dc2e48f0 100644 --- a/models/public/bert-base-ner/model.yml +++ b/models/public/bert-base-ner/model.yml @@ -31,23 +31,23 @@ task_type: named_entity_recognition files: - name: transformers-4.5.1-py3-none-any.whl size: 2060589 - sha256: 0a57d1cd9301a617c7015d7184228984abdfb1ae2158c29cfb32582219756d23 + sha384: e9cb161eef172deac1068d491ed9f7918f5aaa087c9170f8d6356924ade6fd3f2be580c47cef37aa419a2be64db42a28 source: https://files.pythonhosted.org/packages/d8/b2/57495b5309f09fa501866e225c84532d1fd89536ea62406b2181933fb418/transformers-4.5.1-py3-none-any.whl - name: bert-base-ner/pytorch_model.bin size: 433316646 - sha256: 4c0b01790e435da1337ea519d76e747427f2d3ee9c0e49b4952caa06298021f6 + sha384: 59e6fefd0f29534cab9681891a15e9762b1d2dd8d047f55a792b39243631a008ac91a0e354f2ca2aa942be443540a8cb source: https://huggingface.co/dslim/bert-base-NER/resolve/main/pytorch_model.bin - name: bert-base-ner/config.json size: 829 - sha256: a5dc77a0d60dadf5645103017f3c7b8ece4ef1b450bc1ea68e17da1d3ae7e515 + sha384: 66d217d33ba89085a56afc3b485b4e997d278d5253519e6a536c234fce3e065fb80ef39d27894df176148cb457c1cfcb source: https://huggingface.co/dslim/bert-base-NER/resolve/main/config.json - name: bert-base-ner/vocab.txt size: 213450 - sha256: eeaa9875b23b04b4c54ef759d03db9d1ba1554838f8fb26c5d96fa551df93d02 + sha384: b13bb7bd69958cf6d486a291894d90a8693adcea0cb177d1fbe652000def2b169dc82b292ef51736d1f6f15fee1ab486 source: https://huggingface.co/dslim/bert-base-NER/resolve/main/vocab.txt - name: packaging-20.9-py2.py3-none-any.whl size: 40870 - sha256: 67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a + sha384: 422fac4cb009bed3eae42e9688b1712ee15dde1799c888f33c802792e925373dee046602d1d31c460d9d2af3ff6b93a1 source: https://files.pythonhosted.org/packages/3e/89/7ea760b4daa42653ece2380531c90f64788d979110a2ab51049d92f408af/packaging-20.9-py2.py3-none-any.whl postprocessing: - $type: unpack_archive diff --git a/models/public/brain-tumor-segmentation-0001/model.yml b/models/public/brain-tumor-segmentation-0001/model.yml index 04fd9c1c5c6..609a7c96e30 100644 --- a/models/public/brain-tumor-segmentation-0001/model.yml +++ b/models/public/brain-tumor-segmentation-0001/model.yml @@ -26,13 +26,13 @@ task_type: semantic_segmentation files: - name: brain-tumor-segmentation-0001-symbol.json size: 100106 - sha256: 2e75c659c6cab619bda9d5f039619eb12d71949c9c171b247faebe63d2ea7a39 + sha384: 2a36d9609896409eb47268316b5b0ec23bd6f4db1c98cbb69e9dfd34cbf5e9fdfad9d286b1a675fe58c8aec547aaa14c source: $type: google_drive id: 1HaExnmHtF2nl2PkcLfKJDzA_7IMmLyKJ - name: brain-tumor-segmentation-0001-0000.params size: 152788159 - sha256: d73acc63151f96341184ce54dd59c8285ee7cbb744a8ca9ffd7d3e181ffae417 + sha384: f418f3565b8d9c755ad6f407c979a12f2b2a7327170c881477bb75cac70d77f69d5613aaa06bed6a7913e14df5119c36 source: $type: google_drive id: 1T2ldCISt5N2TEUfv6ggRB1dw0cucTqT2 diff --git a/models/public/brain-tumor-segmentation-0002/model.yml b/models/public/brain-tumor-segmentation-0002/model.yml index 0e468f84287..ea640943963 100644 --- a/models/public/brain-tumor-segmentation-0002/model.yml +++ b/models/public/brain-tumor-segmentation-0002/model.yml @@ -20,7 +20,7 @@ task_type: semantic_segmentation files: - name: brain-tumor-segmentation-0002.onnx size: 21735156 - sha256: 97726901bc4f0f2c5e583d38d0ff4631d92ebcdb18bf5e2e859c3703a9b86d2d + sha384: 3c7b1b9c2444b93bfc25e0e32b9ef588a1fed8ed0e367655300008e86959b1413717bff02794a58af96760df7fc293c0 source: $type: google_drive id: 1NhH51NgKJKhu0Bax_IKQ_Byvoe2bItPX diff --git a/models/public/caffenet/model.yml b/models/public/caffenet/model.yml index fe2dc3aad27..99e5b77fa4d 100644 --- a/models/public/caffenet/model.yml +++ b/models/public/caffenet/model.yml @@ -18,11 +18,11 @@ task_type: classification files: - name: bvlc_reference_caffenet.caffemodel size: 243862418 - sha256: 472d4a06035497b180636d8a82667129960371375bd10fcb6df5c6c7631f25e0 + sha384: 6677844301d6c7f68f5b6a299cf41c4f0955bab7d1fb8719375fae6d05b6173db9deccf3ac4aaa4225bf6c6e99d81a68 source: http://dl.caffe.berkeleyvision.org/bvlc_reference_caffenet.caffemodel - name: deploy.prototxt size: 2878 - sha256: 922248a4d2f6aac1cc8e7e5dbd996cc2ecd3356480d67c198f6cf96b12311a04 + sha384: 0d8510160bffd5a656022173a962cdd5e73d857015d0911f4ec1b73e1a7a2f9a1e979170e55baf8830b16379c6b75340 source: https://raw.githubusercontent.com/BVLC/caffe/2cc3844cb2a4a72de10d321781dc8f994bef95c7/models/bvlc_reference_caffenet/deploy.prototxt model_optimizer_args: - --input_shape=[1,3,227,227] diff --git a/models/public/cocosnet/model.yml b/models/public/cocosnet/model.yml index 6daad0a669c..5f838c10d30 100644 --- a/models/public/cocosnet/model.yml +++ b/models/public/cocosnet/model.yml @@ -21,65 +21,65 @@ task_type: image_translation files: - name: model_files/util/__init__.py size: 72 - sha256: 12b307709a025b0afdfdd9e7ad584fbf21d9170be7c0a3f8432e24abae471af7 + sha384: dfc6f539e037c1d6a8a1747c8a64f20431a0847874461c845a60aa686936d51163d7db6a56fc5086558512f544051fac source: https://raw.githubusercontent.com/microsoft/CoCosNet/33f98d092407094a15a08b0555d6f5359490cd3e/util/__init__.py - name: model_files/util/util.py size: 17551 - sha256: 9816d52d4d347be3d7006a0399d82414c1bfd514999355478617fcd4aac730d2 + sha384: ada7dfbea39ed1a0bc97f03dab894fe1eac065bc0e0c7361def8e7a9e5bac75627eaa38d3c176ac6aa391945e0e221b3 source: https://raw.githubusercontent.com/microsoft/CoCosNet/33f98d092407094a15a08b0555d6f5359490cd3e/util/util.py - name: model_files/models/networks/__init__.py size: 2676 - sha256: c720d3133dc08052acd4c8005d2ac76b5db5b2d0d82bc616221e4251b4e3d299 + sha384: 9f1dae79e5600f33da16268485852627fe12bb62695f2c320abb12852f3232d6e76cfc9745fa5bc04994766d9e488114 source: https://raw.githubusercontent.com/microsoft/CoCosNet/33f98d092407094a15a08b0555d6f5359490cd3e/models/networks/__init__.py - name: model_files/models/networks/architecture.py size: 7985 - sha256: 22295c075be850b08d0aa46b8c6af2fc0dfdf59930281bfe63a60b8c2445c050 + sha384: 4be0416ec80decdcdc177b31197794c6c683a05e74690b780ec8db85b8f47c3a03dfa8dbfde58e72aa4c6e4a49ed1204 source: https://raw.githubusercontent.com/microsoft/CoCosNet/33f98d092407094a15a08b0555d6f5359490cd3e/models/networks/architecture.py - name: model_files/models/networks/base_network.py size: 2466 - sha256: 52d078a9e6c97586a373708e9de8be57c0636c6ab02a5ae0f01d7c4140894b82 + sha384: 2bd2cc5d29b71387dc4a756c7e3b8931c019d6a1e765bf71fa28443e34686716dacf77f1b5f58460517886148518332d source: https://raw.githubusercontent.com/microsoft/CoCosNet/33f98d092407094a15a08b0555d6f5359490cd3e/models/networks/base_network.py - name: model_files/models/networks/correspondence.py size: 18453 - sha256: 99815130c1fb335595a8a9cba365f8d191aceb971f4c7ac8763620b75e799dd8 + sha384: 6a4aef47693a292715f8986ccc994e2e932db5d9d54dea790a3df9be34471ed7645f0fff6d1cbde87a26831a7b339c39 source: https://raw.githubusercontent.com/microsoft/CoCosNet/33f98d092407094a15a08b0555d6f5359490cd3e/models/networks/correspondence.py - name: model_files/models/networks/generator.py size: 10874 - sha256: bc25f3d7eb0023558ea9b5bd99f6d4eed4b2577295f0812c69c394faf78c4433 + sha384: 24a4fe9c52345aba6c161930bda8d27692ad511f00711b62c2aef97157d36a648c2439c27d2e15d52271ae87f5d1f339 source: https://raw.githubusercontent.com/microsoft/CoCosNet/33f98d092407094a15a08b0555d6f5359490cd3e/models/networks/generator.py - name: model_files/models/networks/normalization.py size: 11279 - sha256: 87c1fd63375380d6a1521a333c8b2fc7f5d21b312172955fb7526e3542951f6a + sha384: 6b95b80690a0ff4f79f72669132763876c855631b662a0f9a089ffde1597341a1e3f823ea90ba6b7be963272378b295c source: https://raw.githubusercontent.com/microsoft/CoCosNet/33f98d092407094a15a08b0555d6f5359490cd3e/models/networks/normalization.py - name: model_files/models/__init__.py size: 1417 - sha256: 67f5b50d89b7f90e1afabc96c2d6498ab99973d2c6d1c69909ac20f7459629f0 + sha384: 307d0718d8268d5f27dc5b394a756d7910f9f2f36792d78e718295966208bdaed0055e3ca224db506baab7c847857a9a source: https://raw.githubusercontent.com/microsoft/CoCosNet/33f98d092407094a15a08b0555d6f5359490cd3e/models/__init__.py - name: model_files/models/networks/sync_batchnorm/__init__.py size: 507 - sha256: 50083d11a5c9710f9b7dbd4ca012f8e3721fd0c78f63a36a6a0a1a0d82a13ede + sha384: e5e64b8365cbfbb1c1dc5379cd6230ae468c38cde59c294e67e0103e4add0744ed658ac7f246efcc7abfc601463bc29b source: https://raw.githubusercontent.com/vacancy/Synchronized-BatchNorm-PyTorch/5768ead395820b8a625cbe0da0bb9f949748a5dd/sync_batchnorm/__init__.py - name: model_files/models/networks/sync_batchnorm/batchnorm.py size: 15944 - sha256: 9e474102c34cede3e08663acefbbd898eebd3c93fcf3312f82053950fad05e9e + sha384: 8a282cac42d4a9e970c26deb8251c7e7ea30bc55ffbcba13f1a0e02cb78763a6b993c6c91e1ed6a90074ca6899242136 source: https://raw.githubusercontent.com/vacancy/Synchronized-BatchNorm-PyTorch/5768ead395820b8a625cbe0da0bb9f949748a5dd/sync_batchnorm/batchnorm.py - name: model_files/models/networks/sync_batchnorm/replicate.py size: 3226 - sha256: 4498b873404fce05202d4f891262e249a95733816d3877e3aee3d2401138a6af + sha384: 9f662572ba39a396b98116ee8a4fe1b08fb5905fb2ba88cef3965a0827f6917409e7f25a5d1dcbf06acc986acea87d56 source: https://raw.githubusercontent.com/vacancy/Synchronized-BatchNorm-PyTorch/5768ead395820b8a625cbe0da0bb9f949748a5dd/sync_batchnorm/replicate.py - name: model_files/models/networks/sync_batchnorm/comm.py size: 4449 - sha256: 9d2e776a0398e5ac29ce13d43b7475300f70f409e56f3c38428029000557a57a + sha384: 985fb49fbc665ecef6de44ba10c8e547b27733a2301d10ce47da78c7152dd14c78645baae5cd6c042a987bad59ec86dc source: https://raw.githubusercontent.com/vacancy/Synchronized-BatchNorm-PyTorch/5768ead395820b8a625cbe0da0bb9f949748a5dd/sync_batchnorm/comm.py - name: model_files/ckpt/latest_net_Corr.pth size: 237624725 - sha256: 5deef28927dfc56e18c8510ffcdf0280b558987a38a2b455cda62242ecbe7971 + sha384: f756f61b5b4d7ca0e23b7a3208ec8c8d5307fd834cef0dbeea7b7d8bc051eda9ecee2b71a378a2ecc5086a769242fc9a source: $type: google_drive id: 1yNCapBY7YqMoKeyVWwTwceqrEKHpUzYN - name: model_files/ckpt/latest_net_G.pth size: 387069636 - sha256: 9a77b52d0c34a279d6b4e7eff4bd00077543f7ffc2806b5b2a32222cfbccc655 + sha384: 25b790181bbb30c5bd09627756bd70c8bd528431c57c8508ea48f3f352fda987203f19cc129b5706927bd68878d46e0d source: $type: google_drive id: 1zVG4SnR1uI8bC8fagZrgxNYCI5GRmJuR diff --git a/models/public/colorization-siggraph/model.yml b/models/public/colorization-siggraph/model.yml index 4edc8e70bd8..d9281963e85 100644 --- a/models/public/colorization-siggraph/model.yml +++ b/models/public/colorization-siggraph/model.yml @@ -25,19 +25,19 @@ task_type: colorization files: - name: ckpt/colorization-siggraph.pth size: 136787426 - sha256: df00044c0a4d7c3edcecf6f75437ce346a66e7a42612d9b968e1a7e17dbc6f66 + sha384: f6c42249eb7c51f6127ed14a06fdd8ade7bae810a1021c3db1f026a4751846577eff44e9da580677ae668c17d853fa13 source: https://colorizers.s3.us-east-2.amazonaws.com/siggraph17-df00044c.pth - name: model/__init__.py size: 96 - sha256: 245a5ac3e1cb1705438355f9d9b05b408d796c559d89c8f6d2741799f1b74000 + sha384: 04b2675bb9d47bd3f05cb786ec74abd67b4118b6d3b424c0bc85d5136939605c39da443740d9b98b1e7f3f0ada05c885 source: https://raw.githubusercontent.com/richzhang/colorization/4f6009ed1495b1300231ebeb41cc4015557ddef7/colorizers/__init__.py - name: model/base_color.py size: 454 - sha256: 81cea88bb484866478138440f08cc8d6c3e3731652fe57592900e418b278da1d + sha384: 73f4fdae2d975c533530da98efc3c8a7089202492293b28fef447408d054cd59bdff0befc7f38b8336b1a001ce6f9e8d source: https://raw.githubusercontent.com/richzhang/colorization/4f6009ed1495b1300231ebeb41cc4015557ddef7/colorizers/base_color.py - name: model/siggraph17.py size: 7339 - sha256: c78e3f2af8dd13d5fb7a9c7fc95f580f728f86a183b5ad2e12f6a48b282511bd + sha384: 9ae0be2f05ef6776f4d3fb801d2b3a1408196e4ff22c01e5977f38617f38918fec234fdd306bb957ba69b84493566f02 source: https://raw.githubusercontent.com/richzhang/colorization/4f6009ed1495b1300231ebeb41cc4015557ddef7/colorizers/siggraph17.py postprocessing: - $type: regex_replace diff --git a/models/public/colorization-v2/model.yml b/models/public/colorization-v2/model.yml index 8d0504c375f..3073e1b78ea 100644 --- a/models/public/colorization-v2/model.yml +++ b/models/public/colorization-v2/model.yml @@ -24,19 +24,19 @@ task_type: colorization files: - name: ckpt/colorization-v2-eccv16.pth size: 128976165 - sha256: 9b330a0bae53f4ded77b1e23defbf78beaa09c10ebc4c4999e8e4f4a160b93f9 + sha384: 65bc890b145efde14f6847e707ba49fe8a026a02d5dc91bdfa9708893a954547256935b997904280a7ae991da1aac53e source: https://colorizers.s3.us-east-2.amazonaws.com/colorization_release_v2-9b330a0b.pth - name: model/__init__.py size: 96 - sha256: 245a5ac3e1cb1705438355f9d9b05b408d796c559d89c8f6d2741799f1b74000 + sha384: 04b2675bb9d47bd3f05cb786ec74abd67b4118b6d3b424c0bc85d5136939605c39da443740d9b98b1e7f3f0ada05c885 source: https://raw.githubusercontent.com/richzhang/colorization/4f6009ed1495b1300231ebeb41cc4015557ddef7/colorizers/__init__.py - name: model/base_color.py size: 454 - sha256: 81cea88bb484866478138440f08cc8d6c3e3731652fe57592900e418b278da1d + sha384: 73f4fdae2d975c533530da98efc3c8a7089202492293b28fef447408d054cd59bdff0befc7f38b8336b1a001ce6f9e8d source: https://raw.githubusercontent.com/richzhang/colorization/4f6009ed1495b1300231ebeb41cc4015557ddef7/colorizers/base_color.py - name: model/eccv16.py size: 4613 - sha256: 524179cbf9676809a17eead0a5cf72bbc5de962db6bbbd1064407cfd315ae2a4 + sha384: 121ed60312afef4c2d460298c78390714b3417914a82218185520ea6ae5a23da3bda99d5fffba3b586d54988a4919684 source: https://raw.githubusercontent.com/richzhang/colorization/4f6009ed1495b1300231ebeb41cc4015557ddef7/colorizers/eccv16.py postprocessing: - $type: regex_replace diff --git a/models/public/common-sign-language-0001/model.yml b/models/public/common-sign-language-0001/model.yml index dc8bff60092..30bb02e66c7 100644 --- a/models/public/common-sign-language-0001/model.yml +++ b/models/public/common-sign-language-0001/model.yml @@ -24,7 +24,7 @@ task_type: action_recognition files: - name: s3d-rgb-mobilenet-v3-large-stream-jester.onnx size: 16647750 - sha256: af11997c274cd61637535638460b98fbfd602c2b8f57686f6235897b6a2cc20f + sha384: 4ed07ac7d6dc24c9c3369fbbd13e4539dd3803735440f460776715a904c5efd43fb740d4d6cfe7f61ce319ae7a25ab22 source: $type: google_drive id: 1ZrqF1vp71WVi7SMo6QNa14mqyrhpuu2Q diff --git a/models/public/ctdet_coco_dlav0_384/model.yml b/models/public/ctdet_coco_dlav0_384/model.yml index 541cc8f5ea5..4caf0254c55 100644 --- a/models/public/ctdet_coco_dlav0_384/model.yml +++ b/models/public/ctdet_coco_dlav0_384/model.yml @@ -22,21 +22,21 @@ task_type: detection files: - name: ctdet_coco_dlav0_1x.pth size: 221889662 - sha256: 23a4ff7102c47c427bc1f24cec2059b8d837a0253363978d467a70e643b699d3 + sha384: 74565ead2d6c42738f90c0c23abaca04048c9156fdd548130a6b9df94786a6d964b8d6f548a0a44208885243314eea64 source: $type: google_drive id: 18yBxWOlhTo32_swSug_HM4q3BeWgxp_N - name: CenterNet/src/lib/models/model.py size: 3415 - sha256: 29f17e75eb1fb3f6a9f5ca632922bcf932b1f6c63732eb1cdd043b5f8f849d30 + sha384: 470f5591048628d23768d9422d9f960855190d092e31370c0dcdcb73d200adbfa9fa64ab5836ed83d171f1b6a6041147 source: https://github.com/xingyizhou/CenterNet/raw/8ef87b433529ac8f8bd4f95707f6bc05052c55e9/src/lib/models/model.py - name: CenterNet/src/lib/models/networks/dlav0.py size: 22682 - sha256: 44abd35b6e37fad46c4626d9eb0f5ea29f7b0ef539bd21e685f70e6e89fb398e + sha384: 7b8ced5f89807a8a662917b105a26e5c8107ead638ba9f9ef8bc3e4b893ae10e3c69506960c4602ba5188ff70a7cb075 source: https://github.com/xingyizhou/CenterNet/raw/8ef87b433529ac8f8bd4f95707f6bc05052c55e9/src/lib/models/networks/dlav0.py - name: CenterNet/src/lib/opts.py size: 18696 - sha256: 71a7cdc93eb3a9520a1b23a69e5166cff56b45300f162608cb4eeb77ba1116ec + sha384: d002e405f083412de4e5f9b4df56aab695ca6efde9ba1e8d2230dcbee4e64b171d87ab344fe324530ff547cbcc5fbbd2 source: https://github.com/xingyizhou/CenterNet/raw/8ef87b433529ac8f8bd4f95707f6bc05052c55e9/src/lib/opts.py postprocessing: # disable imports and usages of components we don't need diff --git a/models/public/ctdet_coco_dlav0_512/model.yml b/models/public/ctdet_coco_dlav0_512/model.yml index 25f531ba0d5..40a82101913 100644 --- a/models/public/ctdet_coco_dlav0_512/model.yml +++ b/models/public/ctdet_coco_dlav0_512/model.yml @@ -22,21 +22,21 @@ task_type: detection files: - name: ctdet_coco_dlav0_1x.pth size: 221889662 - sha256: 23a4ff7102c47c427bc1f24cec2059b8d837a0253363978d467a70e643b699d3 + sha384: 74565ead2d6c42738f90c0c23abaca04048c9156fdd548130a6b9df94786a6d964b8d6f548a0a44208885243314eea64 source: $type: google_drive id: 18yBxWOlhTo32_swSug_HM4q3BeWgxp_N - name: CenterNet/src/lib/models/model.py size: 3415 - sha256: 29f17e75eb1fb3f6a9f5ca632922bcf932b1f6c63732eb1cdd043b5f8f849d30 + sha384: 470f5591048628d23768d9422d9f960855190d092e31370c0dcdcb73d200adbfa9fa64ab5836ed83d171f1b6a6041147 source: https://github.com/xingyizhou/CenterNet/raw/8ef87b433529ac8f8bd4f95707f6bc05052c55e9/src/lib/models/model.py - name: CenterNet/src/lib/models/networks/dlav0.py size: 22682 - sha256: 44abd35b6e37fad46c4626d9eb0f5ea29f7b0ef539bd21e685f70e6e89fb398e + sha384: 7b8ced5f89807a8a662917b105a26e5c8107ead638ba9f9ef8bc3e4b893ae10e3c69506960c4602ba5188ff70a7cb075 source: https://github.com/xingyizhou/CenterNet/raw/8ef87b433529ac8f8bd4f95707f6bc05052c55e9/src/lib/models/networks/dlav0.py - name: CenterNet/src/lib/opts.py size: 18696 - sha256: 71a7cdc93eb3a9520a1b23a69e5166cff56b45300f162608cb4eeb77ba1116ec + sha384: d002e405f083412de4e5f9b4df56aab695ca6efde9ba1e8d2230dcbee4e64b171d87ab344fe324530ff547cbcc5fbbd2 source: https://github.com/xingyizhou/CenterNet/raw/8ef87b433529ac8f8bd4f95707f6bc05052c55e9/src/lib/opts.py postprocessing: # disable imports and usages of components we don't need diff --git a/models/public/ctpn/model.yml b/models/public/ctpn/model.yml index c234532ce55..ccf0b5b8de7 100644 --- a/models/public/ctpn/model.yml +++ b/models/public/ctpn/model.yml @@ -19,7 +19,7 @@ task_type: detection files: - name: ctpn.pb size: 71638063 - sha256: 09b3a0cc57eb826dd6b6fa95a03e078ad435b7b5fb0186dad2abdb98a4fdf64a + sha384: edc59e0375fb56fc51e0333f4cd2377494d50ef3b86cb64b81e801a6d1ed3256dce068fce80bb7b7fd665258fae76cb4 source: https://github.com/eragonruan/text-detection-ctpn/releases/download/untagged-48d74c6337a71b6b5f87/ctpn.pb model_optimizer_args: - --input_shape=[1,600,600,3] diff --git a/models/public/deblurgan-v2/model.yml b/models/public/deblurgan-v2/model.yml index 984b9066e83..ed25138deb0 100644 --- a/models/public/deblurgan-v2/model.yml +++ b/models/public/deblurgan-v2/model.yml @@ -23,23 +23,23 @@ task_type: image_processing files: - name: models/__init__.py size: 0 - sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + sha384: 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b source: https://raw.githubusercontent.com/VITA-Group/DeblurGANv2/a95d6a7e003fc98e786cd26937e1e20814f533b0/models/__init__.py - name: models/fpn_mobilenet.py size: 5688 - sha256: 1b24574ed94f6bb037b91208c5bcde9da243d2a175493ca942e448176c529efe + sha384: c3d9317a425bc848802ccaaa5cf22dcb434f9d1ae8b67461d476406290caf6ab1b0169e408ad98406bf7f503501b8a45 source: https://raw.githubusercontent.com/VITA-Group/DeblurGANv2/a95d6a7e003fc98e786cd26937e1e20814f533b0/models/fpn_mobilenet.py - name: models/mobilenet_v2.py size: 4214 - sha256: 16801e691c8bdaf16d57c00d3511fe1357d0a6fe63cf221f7c48dbc491383bc7 + sha384: d704ddc6535f18f23edec4bd924977afa6cd1735efb96d52d60a0ddf236a5ec73df310050d742521dff398ec8336beae source: https://raw.githubusercontent.com/VITA-Group/DeblurGANv2/a95d6a7e003fc98e786cd26937e1e20814f533b0/models/mobilenet_v2.py - name: models/networks.py size: 12779 - sha256: 3857345de80c42dedc5162d3e82a173160041cf4e0b307fd7e29680a1115d097 + sha384: 512fa90092d4a3edfd243cbcb74aec6d5c57b23fdbbdb290d3fe6629429dcbf49c260f5bfb37e4191e5895628655ef65 source: https://raw.githubusercontent.com/VITA-Group/DeblurGANv2/a95d6a7e003fc98e786cd26937e1e20814f533b0/models/networks.py - name: ckpt/fpn_mobilenet.h5 size: 13505344 - sha256: 6d1b6d9807da3ae8987021c063a5cb6ca0131e76388cdb5164404ee1b1bf522b + sha384: 93bd1ef8e8d6cc190a3310db6b556aee2df42a294b7015f689237cb1a1cad1f9327b9369e530804f8369195d4b286386 source: $type: google_drive id: 1JhnT4BBeKBBSLqTo6UsJ13HeBXevarrU diff --git a/models/public/deeplabv3/model.yml b/models/public/deeplabv3/model.yml index 1b2b4f20f1d..b2e99828f5b 100644 --- a/models/public/deeplabv3/model.yml +++ b/models/public/deeplabv3/model.yml @@ -19,7 +19,7 @@ task_type: semantic_segmentation files: - name: deeplabv3.tar.gz size: 23882985 - sha256: cd506941e4f88fd053903913761df2e76ea00c01079cecfd35855304a4a5fb48 + sha384: d3f2b27bb00c485ca45d68731f7198a23926cb865dd010fc444bcad9158e33413cd60da2588a9be3ff1e8c9b4557362b source: http://download.tensorflow.org/models/deeplabv3_mnv2_pascal_train_aug_2018_01_29.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/densenet-121-caffe2/model.yml b/models/public/densenet-121-caffe2/model.yml index 3a41e81bccf..e4dfd0055f8 100644 --- a/models/public/densenet-121-caffe2/model.yml +++ b/models/public/densenet-121-caffe2/model.yml @@ -21,11 +21,11 @@ task_type: classification files: - name: predict_net.pb size: 77239 - sha256: 820772d4e7b907599cba93ab0e7d2db0dc0b6e313e842a8729a0ea0354e4a719 + sha384: c2bb28b1680d948ae273ea35e33ddddaccc4892e2db2e57a9869d26f877888d9495a7f806152738edc9168caeea38ce2 source: https://s3.amazonaws.com/download.caffe2.ai/models/densenet121/predict_net.pb - name: init_net.pb size: 40785727 - sha256: a3650579bc883a1755750994507c48d84d0f75d193e304eb8caf5031acb5f028 + sha384: 90176032f71fb6928f3ef71147895809e0a3874a7948900eeb3d15aca69df701a4cca146ef97a402bd0183745dc7f5fe source: https://s3.amazonaws.com/download.caffe2.ai/models/densenet121/init_net.pb framework: caffe2 quantizable: yes diff --git a/models/public/densenet-121-tf/model.yml b/models/public/densenet-121-tf/model.yml index 21da9fb13e4..f9ae4df382e 100644 --- a/models/public/densenet-121-tf/model.yml +++ b/models/public/densenet-121-tf/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: densenet121_weights_tf_dim_ordering_tf_kernels.h5 size: 33188688 - sha256: 86cf891d8ce2a713e59a1c6bfa9d3c006c7fdbb4355e8962482caa6d27daead7 + sha384: dcd6d36f6b07e0843ee35b1dce2c587204c8816d6ba25b7e1dbf2dc25fe2b51f49a2b9327579ce07904575f9325be8b6 source: https://storage.googleapis.com/tensorflow/keras-applications/densenet/densenet121_weights_tf_dim_ordering_tf_kernels.h5 model_optimizer_args: - --reverse_input_channels diff --git a/models/public/densenet-121/model.yml b/models/public/densenet-121/model.yml index 678eba8421d..c95083c3abb 100644 --- a/models/public/densenet-121/model.yml +++ b/models/public/densenet-121/model.yml @@ -22,14 +22,12 @@ task_type: classification files: - name: densenet-121.prototxt size: 76474 - sha256: baeed2a423794c2c8dc1a80ad96e961112224fa1d319d535735ba93a2b535170 + sha384: e385fcce6416abba5b3c55f39df1392edc6d0c740f0905d923b4746ea2026812790fb2666e4b8729e15e5d3a6b505886 source: https://raw.githubusercontent.com/shicai/DenseNet-Caffe/a68651c0b91d8dcb7c0ecd39d1fc76da523baf8a/DenseNet_121.prototxt - name: densenet-121.caffemodel size: 32303870 - sha256: c6a6ec988d76c468c3f67501a23a39ec7bf6ebe6729fd99496a15d0e845478b2 - source: - $type: google_drive - id: 0B7ubpZO7HnlCcHlfNmJkU2VPelE + sha384: 6ecb7d9f607c817152a39ccdfcb4caa798bcdbe6a38150dba90ef0822b02907026c89157fa9088aa28173e9c98690ec6 + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/densenet-121/DenseNet_121.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] - --input=data diff --git a/models/public/densenet-161-tf/model.yml b/models/public/densenet-161-tf/model.yml index ba0c32dd024..ea4a84a0d91 100644 --- a/models/public/densenet-161-tf/model.yml +++ b/models/public/densenet-161-tf/model.yml @@ -21,10 +21,8 @@ task_type: classification files: - name: tf-densenet161.tar.gz size: 110578586 - sha256: f4745258b9fe2f234711a70e4192368f169bf0c1956087a210b08270dbe96ca7 - source: - $type: google_drive - id: 0B_fUSpodN0t0NmZvTnZZa2plaHc + sha384: 656d4d945bb8ea94baeba1c07089c4045e3b58a629bcb13427a1d84f8c0ac775d12b2cb6e752894fcabb1ba7b9c17359 + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/densenet-161-tf/tf-densenet161.tar.gz postprocessing: - $type: unpack_archive format: gztar diff --git a/models/public/densenet-161/model.yml b/models/public/densenet-161/model.yml index 93368b73072..8ff5e767c83 100644 --- a/models/public/densenet-161/model.yml +++ b/models/public/densenet-161/model.yml @@ -32,14 +32,12 @@ task_type: classification files: - name: densenet-161.prototxt size: 101955 - sha256: a193e029d66112b077ed29e8b8d36d0bae0593a7f3c64125a433937b5f035b69 + sha384: 5b2975947130026e7fcbc7986f3279e804f02f74575b1ff81d48e0d6b218d33abaf7be256bd6faab0faed9d61487bae7 source: https://raw.githubusercontent.com/shicai/DenseNet-Caffe/a68651c0b91d8dcb7c0ecd39d1fc76da523baf8a/DenseNet_161.prototxt - name: densenet-161.caffemodel size: 115676075 - sha256: e124d9a8f2284f4ab160569139217f709f21be6fc132c865b6a55cb8cae7d6b5 - source: - $type: google_drive - id: 0B7ubpZO7HnlCa0phRGJIRERoTXM + sha384: fd6fd842cb7c4d3d384b35d3153fcfa3d27110aafe483524cf78c9bd0ef5b2351fbeef32b2a82c09aacbe3dca80168eb + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/densenet-161/DenseNet_161.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] - --input=data diff --git a/models/public/densenet-169-tf/model.yml b/models/public/densenet-169-tf/model.yml index 73dfd2d2279..8882e2d895c 100644 --- a/models/public/densenet-169-tf/model.yml +++ b/models/public/densenet-169-tf/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: densenet169_weights_tf_dim_ordering_tf_kernels.h5 size: 58541896 - sha256: ae45d067431199a76e935bfa14a8becf0a77724f203ad07ce6bb1721236391cc + sha384: ce016db1b892e52fc784d96ec296b33ec94473d4c73b977175c2fb21bbcfbcf4f269ef15616a635ad337173ca3d0e813 source: https://storage.googleapis.com/tensorflow/keras-applications/densenet/densenet169_weights_tf_dim_ordering_tf_kernels.h5 model_optimizer_args: - --reverse_input_channels diff --git a/models/public/densenet-169/model.yml b/models/public/densenet-169/model.yml index e42670cc652..9e672b2cf15 100644 --- a/models/public/densenet-169/model.yml +++ b/models/public/densenet-169/model.yml @@ -32,14 +32,12 @@ task_type: classification files: - name: densenet-169.prototxt size: 107050 - sha256: dfb577c17d67327be70dba8f2810dbeec4f7edb836779c8055ec8f408b0a2cbc + sha384: 5600c42b2135cf05b5e4769f5753e4f430ee951f47735ada01a4edcea9b76016c91d2cd7eedc403cd302799d222940e4 source: https://raw.githubusercontent.com/shicai/DenseNet-Caffe/a68651c0b91d8dcb7c0ecd39d1fc76da523baf8a/DenseNet_169.prototxt - name: densenet-169.caffemodel size: 57307526 - sha256: 8d45f2ab15f6329e2f80004692c58129cc4875ffe43ddf59433ebc2216189f15 - source: - $type: google_drive - id: 0B7ubpZO7HnlCRWVVdUJjVVAyQXc + sha384: 653bacbd9bfbe84d400faea8bf6cf0c8c0bbe1b0883fe7129baa093984cb013e00cdd2604ec335bd3ec3d98c11489555 + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/densenet-169/DenseNet_169.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] - --input=data diff --git a/models/public/densenet-201-tf/model.yml b/models/public/densenet-201-tf/model.yml index 4923dd8ef51..b41182385a1 100644 --- a/models/public/densenet-201-tf/model.yml +++ b/models/public/densenet-201-tf/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: densenet201_weights_tf_dim_ordering_tf_kernels.h5 size: 82524592 - sha256: 1cbd33a37b0b14afad2ff7f578e1ccaa123427d9b9d6923a2ceacaef49210536 + sha384: 25ed149b2cb09d4d3715ac4f16f520a747c9091c1ed2355eca07684e95266eee732ea5d33875fe0f644e010ec77d3365 source: https://storage.googleapis.com/tensorflow/keras-applications/densenet/densenet201_weights_tf_dim_ordering_tf_kernels.h5 model_optimizer_args: - --reverse_input_channels diff --git a/models/public/densenet-201/model.yml b/models/public/densenet-201/model.yml index e7370a83fa7..41160cebfa7 100644 --- a/models/public/densenet-201/model.yml +++ b/models/public/densenet-201/model.yml @@ -32,14 +32,12 @@ task_type: classification files: - name: densenet-201.prototxt size: 127588 - sha256: 8edf61f867491315bc3780a41f74392c2a31042d20932eb145424a2dc8c6f8f7 + sha384: 93e208a3973cdd94ced115c7de65851d80ebad1da0be9063ed8f0507c4b23a201646205051ccd37b286c6cae33cd18d5 source: https://raw.githubusercontent.com/shicai/DenseNet-Caffe/a68651c0b91d8dcb7c0ecd39d1fc76da523baf8a/DenseNet_201.prototxt - name: densenet-201.caffemodel size: 81062969 - sha256: ba464965293d4dd5557085d57ec810bf353de362dd90e1b8293e6f0707978e4a - source: - $type: google_drive - id: 0B7ubpZO7HnlCV3pud2oyR3lNMWs + sha384: 477c169366ba6575646184bd6799f9ca814401cddc5282ab31f45b0bf1801e3d40914e327900d733237ee0f8252610bf + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/densenet-201/DenseNet_201.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] - --input=data diff --git a/models/public/detr-resnet50/model.yml b/models/public/detr-resnet50/model.yml index 5dab645af3e..211b800fd62 100644 --- a/models/public/detr-resnet50/model.yml +++ b/models/public/detr-resnet50/model.yml @@ -28,27 +28,27 @@ task_type: detection files: - name: detr-r50-e632da11.pth size: 166618694 - sha256: e632da11ec76ae67bac2f8579fbed3724e08dead7d200ca13e019b197784eadc + sha384: cba2c4acb7c6ec60e0d56dbd7bfb0dab73aef5ac86bf9819bc4e176fd943114fb1e5567e5046dc6d6a18b7e490dce680 source: https://dl.fbaipublicfiles.com/detr/detr-r50-e632da11.pth - name: models/detr.py size: 17089 - sha256: b5a584ada4d074d16852f9ad87ebc75bbdc91386b630755f993cb3fbf2290d42 + sha384: ae1d9cc2b2b483dbd8fd095137e27bf1ec1d596ede1be55e842f771f02725a958763358631e7c8e69fecfe34059fb393 source: https://raw.githubusercontent.com/facebookresearch/detr/a54b77800eb8e64e3ad0d8237789fcbf2f8350c5/models/detr.py - name: models/backbone.py size: 4437 - sha256: 6ee87cdb91ca3df38550336c4f5d5b297a5db8e4be8f6c2c0e96e0d88c96d918 + sha384: 2935015de1399c9b2037da55de0e8d90fa6c1d19739821df3aa9d986fdcb1c861a6b8d494165bfdb68ff52ab87494ad6 source: https://raw.githubusercontent.com/facebookresearch/detr/a54b77800eb8e64e3ad0d8237789fcbf2f8350c5/models/backbone.py - name: models/transformer.py size: 12162 - sha256: 730677b5e9b6127d502e39cf42b0292856e6432815491050dcbaf84b4a6b4f6e + sha384: ae5bd31653d7b0a5809e71adec72b5e002a63ec95af8660c4c73310f040b01e0920816ce3ef8078131a4f1f35c406077 source: https://raw.githubusercontent.com/facebookresearch/detr/a54b77800eb8e64e3ad0d8237789fcbf2f8350c5/models/transformer.py - name: models/position_encoding.py size: 3336 - sha256: c50834d862a3f7970a3dee3f71ca70f0455bb7e7e627aa2587d2dc8e8b6bd1c8 + sha384: 9729adf8750340fcb730e26b688a925abbf934d2f0200a7aded338f512090f77be2327441f3b97da6cab5def77b8f767 source: https://raw.githubusercontent.com/facebookresearch/detr/a54b77800eb8e64e3ad0d8237789fcbf2f8350c5/models/position_encoding.py - name: util/misc.py size: 15284 - sha256: 222b236db1e9a7de614a5ae16e17b77051495ac43c151c91b06fb477b4aa1017 + sha384: 257e7a29d01882b709542bae492ef187796f08691cfaec3c141efedd77597eeca2ec9f549b0fc2794b260a19f3196098 source: https://raw.githubusercontent.com/facebookresearch/detr/a54b77800eb8e64e3ad0d8237789fcbf2f8350c5/util/misc.py postprocessing: - $type: regex_replace diff --git a/models/public/device_support.md b/models/public/device_support.md index 1faf584b02e..a171ccfe1e9 100644 --- a/models/public/device_support.md +++ b/models/public/device_support.md @@ -52,6 +52,7 @@ | faster_rcnn_resnet50_coco | YES | YES | YES | | fastseg-large | YES | YES | | | fastseg-small | YES | YES | | +| fbcnn | YES | YES | YES | | fcrn-dp-nyu-depth-v2-tf | YES | YES | | | forward-tacotron-duration-prediction | YES | | | | forward-tacotron-regression | YES | | | @@ -165,9 +166,11 @@ | yolo-v1-tiny-tf | YES | YES | YES | | yolo-v2-tf | YES | YES | YES | | yolo-v2-tiny-tf | YES | YES | YES | +| yolo-v3-onnx | YES | | YES | | yolo-v3-tf | YES | YES | YES | +| yolo-v3-tiny-onnx | YES | | | | yolo-v3-tiny-tf | YES | YES | YES | | yolo-v4-tf | YES | YES | YES | -| yolo-v4-tiny-tf | YES | YES | | +| yolo-v4-tiny-tf | YES | YES | YES | | yolof | YES | YES | | | yolox-tiny | YES | YES | | diff --git a/models/public/dla-34/README.md b/models/public/dla-34/README.md index 2823be6284d..50fcc549fda 100644 --- a/models/public/dla-34/README.md +++ b/models/public/dla-34/README.md @@ -53,14 +53,14 @@ Channel order is `BGR` Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/dla-34/model.yml b/models/public/dla-34/model.yml index 1176bc4f6c0..9f8e02d75e5 100644 --- a/models/public/dla-34/model.yml +++ b/models/public/dla-34/model.yml @@ -22,15 +22,15 @@ task_type: classification files: - name: dla.py size: 14499 - sha256: cd3ea73af97f3456034f58392cc695fd6961f939adf9c80c1977e721efd7f8bc + sha384: ceaa3db3e90e5edff2a644738e93a00bf3688499e670dde1e771055362ff4ec0ba087fc0af35bdaf175871f893e54511 source: https://raw.githubusercontent.com/ucbdrive/dla/master/dla.py - name: dataset.py size: 1776 - sha256: 6821c636a1a955417fc2beade5d73409a9eceb546ca004c993f913a818cbfb90 + sha384: 4fb6ed8cb467074f7b0229c7a623f7f27c5ec184c8fe5ef2d84ed70168c10f6c6019d228b80fd1022c8884bc5cf8c38c source: https://raw.githubusercontent.com/ucbdrive/dla/master/dataset.py - name: ckpt/dla34.pth size: 63228658 - sha256: ba72cf86426e6333d9e8c6c7a8cae5549879212e48ae3aaad4bc8a7d009c34e1 + sha384: 38c035736538b6c67f2539bf1ca1cc1349c3691f41321bd58de9e97aa9eb83ea6f52c4aeef7c4cd54c92b6f8c3f3e89b source: http://dl.yf.io/dla/models/imagenet/dla34-ba72cf86.pth conversion_to_onnx_args: - --model-path=$dl_dir diff --git a/models/public/drn-d-38/model.yml b/models/public/drn-d-38/model.yml index 170c0bfb1a3..51c31b8af94 100644 --- a/models/public/drn-d-38/model.yml +++ b/models/public/drn-d-38/model.yml @@ -29,17 +29,17 @@ task_type: semantic_segmentation files: - name: drn_d_38_cityscapes.pth size: 104117210 - sha256: 2d237561233af3fb36042686be54784c49a36c21159c7ecc7fbd7910f37ca8fa + sha384: 090859278d373c8ce160a21b256f6dcfa2a5d07b6d2aebbd18e598a1d3f2c48a97e188d13f1bc16751859a8ed8f8ec1a source: $type: google_drive - id: 0B_4LoEXGO1TwT3g5SGtrVGRSYkU + id: 1Ck5cE5o6wsS5ITjeyBkvUYHnw4bIR6eg - name: models/drn.py size: 14175 - sha256: debb567a8563100aff203196b2efebeb2e5366f7e5848c4c17b568b3fb044ff1 + sha384: 065d2584b6fc9528138f94fe60244e24669ca2b9870143e252f5e78684d037bff7971c3afacf22b8d481672fe4ab6f55 source: https://raw.githubusercontent.com/fyu/drn/d75db2ee7070426db7a9264ee61cf489f8cf178c/drn.py - name: models/segment.py size: 26909 - sha256: e39099d6bb2303240e3a2f5bd9ac753456b0d5dd2b96aae94db14a478f0504f3 + sha384: d30346421bf9aee14fd72806fda6cc3acb857398b72b7e12715626e91eef4f39798fdde3bfea8c3f52a8cabd8bb32ffa source: https://raw.githubusercontent.com/fyu/drn/d75db2ee7070426db7a9264ee61cf489f8cf178c/segment.py postprocessing: - $type: regex_replace diff --git a/models/public/efficientdet-d0-tf/model.yml b/models/public/efficientdet-d0-tf/model.yml index 283c184a08d..66869388932 100644 --- a/models/public/efficientdet-d0-tf/model.yml +++ b/models/public/efficientdet-d0-tf/model.yml @@ -22,67 +22,67 @@ task_type: detection files: - name: efficientdet-d0.tar.gz size: 28828936 - sha256: 74794c937aa1fa2f559c2393d22b251b1f7135a49b108bd0414bc4f4800ca15d + sha384: 4107802535b036f846d856e55d0035f871bf900f28b25874874bcb72631f666d9f3a0ff8239c73e28a5fe9a0f816ac9f source: https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d0.tar.gz - name: model/model_inspect.py size: 20388 - sha256: 6c68fe02f10d62dd87c2fc550b41c3df5cce52f0449be22e0699fbf209e3cbc1 + sha384: d67e6eb34695a2ed0ab0c7444ecc763ff111834b4e7bb7183ec5bd66bc8b95443c5538b7322da2ffe589db8c4d4091f3 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/model_inspect.py - name: model/hparams_config.py size: 13750 - sha256: a7f9a3215a864e2f393addefc997ceba1d78ccba4909390310c453e391c9710b + sha384: 39b00fda7c2355fcb2849f440738a987b34e969d93961e6551e8e7092a8e08425cf4122c2af38173469ad3058f37f54b source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/hparams_config.py - name: model/inference.py size: 25076 - sha256: 1f0a633de186f9b786979ead00921b910e9853bb33717328f76c1f71af8be997 + sha384: 19aa8af0aacb45c3fee226a010b567358d08637ef7775fc93676046fcc0a3e133219475e6e5bfa198269eae0679435ce source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/inference.py - name: model/dataloader.py size: 19251 - sha256: 5e4bdfc1a746dd2fffe6a0d7bd83ea6422b2883fce5e8e7fb7ed381e919c11a9 + sha384: f764232d17c4c7c3289bcf846fe63b922194c7e89f33a5fbdc599bbe350afa534ff420477a3097af6773264a100f58f3 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/dataloader.py - name: model/nms_np.py size: 11404 - sha256: e72ffbab850f9a267f9cc5ae480a4ee0936402fd109dfd3c2fa7b5644e71245f + sha384: 20daf2a0a40df70441cd6cffbcffa7fabfaa8ddce617191311a5c7f27c4328d46516403ce0efb4f6945edd3942ebaef0 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/nms_np.py - name: model/utils.py size: 25677 - sha256: eb68091efcf989a908225c2af6d7f632f90c6602659ab06dea628cbdcabdd403 + sha384: 2cca479ebab14f9b2974076649d09e4069cab4870609eb47f7ec7a18d993be2bb44cd61f61e423dc70a4407b65a8dce5 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/utils.py - name: model/keras/__init__.py size: 0 - sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + sha384: 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/__init__.py - name: model/keras/efficientdet_keras.py size: 32414 - sha256: 4b60b29aabae4365bb9d77b40698a974de9fd4d998f9be94df12b184c0e09ca9 + sha384: 50b8d1fd9500da82158f8edeec7b4e909c7c4910e1e59f2f4c92db516edea62acb7444c779ec722fd6eaefac460d4bde source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/efficientdet_keras.py - name: model/backbone/efficientnet_builder.py size: 11609 - sha256: 868b9b4cd06c39e1ec15ea1005c36771676f30003c034a0bed4d06e00932905c + sha384: fc75ab0fa3969111211958d06549afcb61ba4d4393b360ceaf05f225efa0190371b056aa2062645658445a0fae96d8d3 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/backbone/efficientnet_builder.py - name: model/backbone/efficientnet_model.py size: 27419 - sha256: 0a488e70c46bfa6d98fec66b4c518e0b3a25eedd8ca836123f4ef335dd12bf0c + sha384: b4f23f043c5d84bf6770087c89ec82b5e09f55e18f7a280b47b34ce831bef48444f42c840ad3a2c471536e4ab810e072 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/backbone/efficientnet_model.py - name: model/backbone/backbone_factory.py size: 2963 - sha256: 3babe95f1bd104fdb1f54e49e68e2a12478933058d6a09c2a46401e80fab06c9 + sha384: 8a19848f09bfa0ffe955eaecb4076e6c7158bb7b72eca61f6c850d53e4b9f2ea4407bd2e000d0618e746528cbd07a00f source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/backbone/backbone_factory.py - name: model/keras/anchors.py size: 9175 - sha256: a88000a453e1ec1194cff2155a1148ef1c2ca87ad563cff2f412f1a597c3ffd7 + sha384: 4163b87f2b41e9bedcd82fe023af7eb1d5a9129c4ce4f71929ee87695c15ec3ae92123649614828e120f417fce203fa8 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/anchors.py - name: model/keras/util_keras.py size: 2198 - sha256: 81e21202054018d7616ab1d0f41eceaf8b4e31a6d6ee88cb53c251abea9fa582 + sha384: 333b8e217b327ca853bb55e5b470486a19aa0fc3a5707b425873eee2eac3e7acc434af1cf485efb2824600864dce884a source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/util_keras.py - name: model/keras/fpn_configs.py size: 6120 - sha256: 245cdd3308141fbb6d2b04b850d45fabb56a0f8ac74c857c7dd0d38238664f0d + sha384: edd2e1d3d139bda797bad1a7403c88397b9f355c1e809b089ffe83931629844a68c613e31f35ab9ba2c333b5bc29917e source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/fpn_configs.py - name: model/keras/postprocess.py size: 17677 - sha256: 7ca776128887a813089dfc81a61cd4e82b4c3add100a5bafc1951f7dedd1fb4b + sha384: 0ed3354ce9f09281ac3ab176a629fdb95109bf1c0c18b1fff3439f488069a56a9f73776d6cf5ccde489d6bbc57566cd8 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/postprocess.py postprocessing: # disable imports that aren't needed for this model and code that uses them diff --git a/models/public/efficientdet-d1-tf/model.yml b/models/public/efficientdet-d1-tf/model.yml index dbdfbb6b68c..33e7ac68d02 100644 --- a/models/public/efficientdet-d1-tf/model.yml +++ b/models/public/efficientdet-d1-tf/model.yml @@ -22,67 +22,67 @@ task_type: detection files: - name: efficientdet-d1.tar.gz size: 48828228 - sha256: 31d8741da9840ab8bddfaa041d395d84a8c1e4e54db01cf8d277471afad5d6e0 + sha384: 0178799e293b54bb7a478b1671accfe5fb14d947cc196434db829dae216f55fff5de972a0291a71b7d3b3186aed8dfe9 source: https://storage.googleapis.com/cloud-tpu-checkpoints/efficientdet/coco2/efficientdet-d1.tar.gz - name: model/model_inspect.py size: 20388 - sha256: 6c68fe02f10d62dd87c2fc550b41c3df5cce52f0449be22e0699fbf209e3cbc1 + sha384: d67e6eb34695a2ed0ab0c7444ecc763ff111834b4e7bb7183ec5bd66bc8b95443c5538b7322da2ffe589db8c4d4091f3 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/model_inspect.py - name: model/hparams_config.py size: 13750 - sha256: a7f9a3215a864e2f393addefc997ceba1d78ccba4909390310c453e391c9710b + sha384: 39b00fda7c2355fcb2849f440738a987b34e969d93961e6551e8e7092a8e08425cf4122c2af38173469ad3058f37f54b source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/hparams_config.py - name: model/inference.py size: 25076 - sha256: 1f0a633de186f9b786979ead00921b910e9853bb33717328f76c1f71af8be997 + sha384: 19aa8af0aacb45c3fee226a010b567358d08637ef7775fc93676046fcc0a3e133219475e6e5bfa198269eae0679435ce source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/inference.py - name: model/dataloader.py size: 19251 - sha256: 5e4bdfc1a746dd2fffe6a0d7bd83ea6422b2883fce5e8e7fb7ed381e919c11a9 + sha384: f764232d17c4c7c3289bcf846fe63b922194c7e89f33a5fbdc599bbe350afa534ff420477a3097af6773264a100f58f3 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/dataloader.py - name: model/nms_np.py size: 11404 - sha256: e72ffbab850f9a267f9cc5ae480a4ee0936402fd109dfd3c2fa7b5644e71245f + sha384: 20daf2a0a40df70441cd6cffbcffa7fabfaa8ddce617191311a5c7f27c4328d46516403ce0efb4f6945edd3942ebaef0 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/nms_np.py - name: model/utils.py size: 25677 - sha256: eb68091efcf989a908225c2af6d7f632f90c6602659ab06dea628cbdcabdd403 + sha384: 2cca479ebab14f9b2974076649d09e4069cab4870609eb47f7ec7a18d993be2bb44cd61f61e423dc70a4407b65a8dce5 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/utils.py - name: model/keras/__init__.py size: 0 - sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + sha384: 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/__init__.py - name: model/keras/efficientdet_keras.py size: 32414 - sha256: 4b60b29aabae4365bb9d77b40698a974de9fd4d998f9be94df12b184c0e09ca9 + sha384: 50b8d1fd9500da82158f8edeec7b4e909c7c4910e1e59f2f4c92db516edea62acb7444c779ec722fd6eaefac460d4bde source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/efficientdet_keras.py - name: model/backbone/efficientnet_builder.py size: 11609 - sha256: 868b9b4cd06c39e1ec15ea1005c36771676f30003c034a0bed4d06e00932905c + sha384: fc75ab0fa3969111211958d06549afcb61ba4d4393b360ceaf05f225efa0190371b056aa2062645658445a0fae96d8d3 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/backbone/efficientnet_builder.py - name: model/backbone/efficientnet_model.py size: 27419 - sha256: 0a488e70c46bfa6d98fec66b4c518e0b3a25eedd8ca836123f4ef335dd12bf0c + sha384: b4f23f043c5d84bf6770087c89ec82b5e09f55e18f7a280b47b34ce831bef48444f42c840ad3a2c471536e4ab810e072 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/backbone/efficientnet_model.py - name: model/backbone/backbone_factory.py size: 2963 - sha256: 3babe95f1bd104fdb1f54e49e68e2a12478933058d6a09c2a46401e80fab06c9 + sha384: 8a19848f09bfa0ffe955eaecb4076e6c7158bb7b72eca61f6c850d53e4b9f2ea4407bd2e000d0618e746528cbd07a00f source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/backbone/backbone_factory.py - name: model/keras/anchors.py size: 9175 - sha256: a88000a453e1ec1194cff2155a1148ef1c2ca87ad563cff2f412f1a597c3ffd7 + sha384: 4163b87f2b41e9bedcd82fe023af7eb1d5a9129c4ce4f71929ee87695c15ec3ae92123649614828e120f417fce203fa8 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/anchors.py - name: model/keras/util_keras.py size: 2198 - sha256: 81e21202054018d7616ab1d0f41eceaf8b4e31a6d6ee88cb53c251abea9fa582 + sha384: 333b8e217b327ca853bb55e5b470486a19aa0fc3a5707b425873eee2eac3e7acc434af1cf485efb2824600864dce884a source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/util_keras.py - name: model/keras/fpn_configs.py size: 6120 - sha256: 245cdd3308141fbb6d2b04b850d45fabb56a0f8ac74c857c7dd0d38238664f0d + sha384: edd2e1d3d139bda797bad1a7403c88397b9f355c1e809b089ffe83931629844a68c613e31f35ab9ba2c333b5bc29917e source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/fpn_configs.py - name: model/keras/postprocess.py size: 17677 - sha256: 7ca776128887a813089dfc81a61cd4e82b4c3add100a5bafc1951f7dedd1fb4b + sha384: 0ed3354ce9f09281ac3ab176a629fdb95109bf1c0c18b1fff3439f488069a56a9f73776d6cf5ccde489d6bbc57566cd8 source: https://raw.githubusercontent.com/google/automl/341af7d4da7805c3a874877484e133f33c420ec5/efficientdet/keras/postprocess.py postprocessing: # disable imports that aren't needed for this model and code that uses them diff --git a/models/public/efficientnet-b0-pytorch/model.yml b/models/public/efficientnet-b0-pytorch/model.yml index 9f71ea9fc5f..8d4686510f6 100644 --- a/models/public/efficientnet-b0-pytorch/model.yml +++ b/models/public/efficientnet-b0-pytorch/model.yml @@ -30,27 +30,27 @@ task_type: classification files: - name: model/gen_efficientnet.py size: 40997 - sha256: 8613d48ca74611d3566d8c02cbf7c92aad6b16a708ffcf21183a7014fecdec09 + sha384: b2868eed99002c95a8f54b0f20a975486d47dd0a4d8fda2fbeed68e0f83330b4617d6a09d60a08eaaf660f490a5906a9 source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/gen_efficientnet.py - name: model/efficientnet_builder.py size: 18446 - sha256: 69bb2adc49dc79c8860f36acca910bad6733e23b46ed80551248b90141d5e1b5 + sha384: 5dbc9484139e3f23504508b63416a10251590c0f84e056e78830351d104a67f215fd6e180d7f22d20ad1eadd803c8bd6 source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/efficientnet_builder.py - name: model/helpers.py size: 1097 - sha256: 0415f198b8a87cb34c9f9aed79f267043010fbd197e27df805bab9d070da82ed + sha384: b1adc8c85422236df810c36de5333bd80f516f948be894633448ea9f12c098aba61be8bb6663cdedb0bd545b6ae986a6 source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/helpers.py - name: model/conv2d_helpers.py size: 6175 - sha256: e6ba7e878dd28c6d0ccc9707205bf6b58bea664d7fee820d7101a6a8e48990a9 + sha384: cac2642f90d160a9f338bc83c423fd9cfa044a27f74c97726dc70b86adca7b6db32041676c64954ecac7acd5240975de source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/conv2d_helpers.py - name: model/__init__.py size: 32 - sha256: e0bedda5f5e949b8ace7d4f5cdf80e7e664c0b0a935486b6152078fa61c80c1b + sha384: 56056cd865f696313e48aa09cc4d6dd334dd5aa71ba9495bdc443ac209c42485d864c31c216ee3befd8dd03e723c2113 source: https://github.com/rwightman/gen-efficientnet-pytorch/raw/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/__init__.py - name: efficientnet-b0.pth size: 21376958 - sha256: d6904d92f92ccdca67c9717f9d119392d658577f99e5ce021b57d157985783db + sha384: f44c3ff7ceeeda4ccf95a6720483cf2bee89f2db59d47e8349d2a7d46024e006b76e92105b6723060b898505312e70ff source: https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/efficientnet_b0-d6904d92.pth conversion_to_onnx_args: - --model-path=$dl_dir diff --git a/models/public/efficientnet-b0/model.yml b/models/public/efficientnet-b0/model.yml index b4446594de4..0d13904539e 100644 --- a/models/public/efficientnet-b0/model.yml +++ b/models/public/efficientnet-b0/model.yml @@ -22,7 +22,7 @@ task_type: classification files: - name: efficientnet-b0.tar.gz size: 47390720 - sha256: b82d670255bd48b0a122d571e5766091048a503209caf15e2cda58a41118c613 + sha384: 9e9f607453d154c3ca08a3bbc39e59cc0ab99da7647beb5a20b0bffe5da5399a48e0407b68fa3ee14f4acc81b18714ce source: https://storage.googleapis.com/cloud-tpu-checkpoints/efficientnet/ckpts/efficientnet-b0.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/efficientnet-b0_auto_aug/model.yml b/models/public/efficientnet-b0_auto_aug/model.yml index 1fa0a7fed0d..747efeca2f4 100644 --- a/models/public/efficientnet-b0_auto_aug/model.yml +++ b/models/public/efficientnet-b0_auto_aug/model.yml @@ -23,7 +23,7 @@ task_type: classification files: - name: efficientnet-b0.tar.gz size: 39302973 - sha256: c1109c4842c2294d9df2de9fcebc28692d1fe48ff4447e265a5d8e2f74e0fe65 + sha384: 2e75646e36cb65046b205166e5f6f5a78daffcd81310899a0690492a591e23d6075fffc55585c1daf7d3279357991912 source: https://storage.googleapis.com/cloud-tpu-checkpoints/efficientnet/ckptsaug/efficientnet-b0.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/efficientnet-b5-pytorch/model.yml b/models/public/efficientnet-b5-pytorch/model.yml index e43ee0c0948..9583378e0a2 100644 --- a/models/public/efficientnet-b5-pytorch/model.yml +++ b/models/public/efficientnet-b5-pytorch/model.yml @@ -30,27 +30,27 @@ task_type: classification files: - name: model/gen_efficientnet.py size: 40997 - sha256: 8613d48ca74611d3566d8c02cbf7c92aad6b16a708ffcf21183a7014fecdec09 + sha384: b2868eed99002c95a8f54b0f20a975486d47dd0a4d8fda2fbeed68e0f83330b4617d6a09d60a08eaaf660f490a5906a9 source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/gen_efficientnet.py - name: model/efficientnet_builder.py size: 18446 - sha256: 69bb2adc49dc79c8860f36acca910bad6733e23b46ed80551248b90141d5e1b5 + sha384: 5dbc9484139e3f23504508b63416a10251590c0f84e056e78830351d104a67f215fd6e180d7f22d20ad1eadd803c8bd6 source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/efficientnet_builder.py - name: model/helpers.py size: 1097 - sha256: 0415f198b8a87cb34c9f9aed79f267043010fbd197e27df805bab9d070da82ed + sha384: b1adc8c85422236df810c36de5333bd80f516f948be894633448ea9f12c098aba61be8bb6663cdedb0bd545b6ae986a6 source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/helpers.py - name: model/conv2d_helpers.py size: 6175 - sha256: e6ba7e878dd28c6d0ccc9707205bf6b58bea664d7fee820d7101a6a8e48990a9 + sha384: cac2642f90d160a9f338bc83c423fd9cfa044a27f74c97726dc70b86adca7b6db32041676c64954ecac7acd5240975de source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/conv2d_helpers.py - name: model/__init__.py size: 32 - sha256: e0bedda5f5e949b8ace7d4f5cdf80e7e664c0b0a935486b6152078fa61c80c1b + sha384: 56056cd865f696313e48aa09cc4d6dd334dd5aa71ba9495bdc443ac209c42485d864c31c216ee3befd8dd03e723c2113 source: https://github.com/rwightman/gen-efficientnet-pytorch/raw/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/__init__.py - name: tf-efficientnet-b5.pth size: 122398414 - sha256: 99018a74e61e5948a955ebfaa2b02ba9abe7bb2e6b7f3d2dfe100e07e103bbdb + sha384: 3226227ffa80fb1006873455a21f33060e98f0c3c2d6d0470355ece92d9ac7d01e3e41b636ead551cf43874a483d5d82 source: https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_efficientnet_b5_aa-99018a74.pth postprocessing: - $type: regex_replace diff --git a/models/public/efficientnet-b5/model.yml b/models/public/efficientnet-b5/model.yml index d3ba67f8494..9a79abb1177 100644 --- a/models/public/efficientnet-b5/model.yml +++ b/models/public/efficientnet-b5/model.yml @@ -22,7 +22,7 @@ task_type: classification files: - name: efficientnet-b5.tar.gz size: 255918080 - sha256: 088c222266c64608da87d8730b3f5bf22da7677fd128357d8040a0389aab338e + sha384: 7792544648d3ed72378345ea41c609b246ed5eabff366e01b693c35feef3831b7b0ac2839f18fa001b1d6983f7cb93fe source: https://storage.googleapis.com/cloud-tpu-checkpoints/efficientnet/ckpts/efficientnet-b5.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/efficientnet-b7-pytorch/model.yml b/models/public/efficientnet-b7-pytorch/model.yml index 468e9965223..12ed00e4fda 100644 --- a/models/public/efficientnet-b7-pytorch/model.yml +++ b/models/public/efficientnet-b7-pytorch/model.yml @@ -30,27 +30,27 @@ task_type: classification files: - name: model/gen_efficientnet.py size: 40997 - sha256: 8613d48ca74611d3566d8c02cbf7c92aad6b16a708ffcf21183a7014fecdec09 + sha384: b2868eed99002c95a8f54b0f20a975486d47dd0a4d8fda2fbeed68e0f83330b4617d6a09d60a08eaaf660f490a5906a9 source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/gen_efficientnet.py - name: model/efficientnet_builder.py size: 18446 - sha256: 69bb2adc49dc79c8860f36acca910bad6733e23b46ed80551248b90141d5e1b5 + sha384: 5dbc9484139e3f23504508b63416a10251590c0f84e056e78830351d104a67f215fd6e180d7f22d20ad1eadd803c8bd6 source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/efficientnet_builder.py - name: model/helpers.py size: 1097 - sha256: 0415f198b8a87cb34c9f9aed79f267043010fbd197e27df805bab9d070da82ed + sha384: b1adc8c85422236df810c36de5333bd80f516f948be894633448ea9f12c098aba61be8bb6663cdedb0bd545b6ae986a6 source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/helpers.py - name: model/conv2d_helpers.py size: 6175 - sha256: e6ba7e878dd28c6d0ccc9707205bf6b58bea664d7fee820d7101a6a8e48990a9 + sha384: cac2642f90d160a9f338bc83c423fd9cfa044a27f74c97726dc70b86adca7b6db32041676c64954ecac7acd5240975de source: https://raw.githubusercontent.com/rwightman/gen-efficientnet-pytorch/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/conv2d_helpers.py - name: model/__init__.py size: 32 - sha256: e0bedda5f5e949b8ace7d4f5cdf80e7e664c0b0a935486b6152078fa61c80c1b + sha384: 56056cd865f696313e48aa09cc4d6dd334dd5aa71ba9495bdc443ac209c42485d864c31c216ee3befd8dd03e723c2113 source: https://github.com/rwightman/gen-efficientnet-pytorch/raw/a36e2b2cd1bd122a508a6fffeaa7606890f8c882/gen_efficientnet/__init__.py - name: tf-efficientnet-b7.pth size: 266843942 - sha256: 076e3472fb198ec7c3091aecc73ff205bcca4a114f5862e2297a4c2720c91826 + sha384: 56fd1ed71e016e7dabac6b92882a4e12a16640da790442d5f16923dd39eee124fdeca396d4e422cb8c3a0cecc8aba814 source: https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_efficientnet_b7_aa-076e3472.pth postprocessing: - $type: regex_replace diff --git a/models/public/efficientnet-b7_auto_aug/model.yml b/models/public/efficientnet-b7_auto_aug/model.yml index c77ecd472ae..59c78fd51ad 100644 --- a/models/public/efficientnet-b7_auto_aug/model.yml +++ b/models/public/efficientnet-b7_auto_aug/model.yml @@ -23,7 +23,7 @@ task_type: classification files: - name: efficientnet-b7.tar.gz size: 492077218 - sha256: b5705cc53da6fa3e953f8509063695ed50f7adebb2488144783e20df71d0fca8 + sha384: 43ab0eb7f7bfd1f50610996608668de6b502ada5846698bdcacc0c0e22025f01958e278774c4f2eaddcab1a6355c71ea source: https://storage.googleapis.com/cloud-tpu-checkpoints/efficientnet/ckptsaug/efficientnet-b7.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/f3net/model.yml b/models/public/f3net/model.yml index c4f4e6418d6..239b90bbba0 100644 --- a/models/public/f3net/model.yml +++ b/models/public/f3net/model.yml @@ -19,15 +19,15 @@ task_type: salient_object_detection files: - name: f3net/net.py size: 8656 - sha256: e2afbe93d900a518c1e46ba260a73810641f174a80fd7fa022d3f514166b5a6e + sha384: 17947bb60281d99ed16a5f646d0476a1fb439e21c70a8efbdd12151aad271599e4951bff546a89ac5fddf5058af7d6cb source: https://raw.githubusercontent.com/weijun88/F3Net/eecace3adf1e8946b571a4f4397681252f9dc1b8/src/net.py - name: f3net/dataset.py size: 4497 - sha256: 9394eb1efc31d20610c31408fd08a567d7c89f394ceffcd745b6aad18ff0b7a9 + sha384: 0a741a171f3faf065af323de147165bee85f627e572aad00529cfcddcf26c34b212e223c0da3d8d45ffa760c79ba4712 source: https://raw.githubusercontent.com/weijun88/F3Net/eecace3adf1e8946b571a4f4397681252f9dc1b8/src/dataset.py - name: f3net/model-32 size: 102506472 - sha256: 88e567f915fb7d22db6922102e147d0401123d3600cd0de6c74a200c4fc69b36 + sha384: 6476078ef447502af76f214b96161f6295662ccef6d412aec90d0aca03fc5d7759fdd880c9ddec146e656114805acfc2 source: $type: google_drive id: 1jcsmxZHL6DGwDplLp93H4VeN2ZjqBsOF diff --git a/models/public/face-detection-retail-0044/model.yml b/models/public/face-detection-retail-0044/model.yml index 3146a6c1b21..39eb9fdb15e 100644 --- a/models/public/face-detection-retail-0044/model.yml +++ b/models/public/face-detection-retail-0044/model.yml @@ -21,11 +21,11 @@ task_type: detection files: - name: face-detection-retail-0044.prototxt size: 27995 - sha256: 89ea5bb9c293ebabb56b9f6dfb4cfc6c46cd146cdce307a2f5a2755bf904fc79 + sha384: 308dd708e34a0993fdd2d41781c360972e12e5560f2e58fe67172a187df74fa072986142d7faeec7058d024d28f5c43a source: https://raw.githubusercontent.com/opencv/training_toolbox_caffe/63ccbbc328f0c1f414f459c284293b3929b09339/models/face_detection/deploy.prototxt - name: face-detection-retail-0044.caffemodel size: 2410177 - sha256: 10f68b73f3b68db89fab151be51fc90a0bc1e2a18a87ac642e88aa9e94d53f8f + sha384: a86e975a6cad2ca8d0a28d8e9492cffbf45e3a9210baa456761e0c4708f09c024ac6c5f174c190e86b31a8bef77932fc source: https://github.com/opencv/training_toolbox_caffe/raw/63ccbbc328f0c1f414f459c284293b3929b09339/models/face_detection/face-detection-retail-0044.caffemodel model_optimizer_args: - --input_shape=[1,3,300,300] diff --git a/models/public/face-recognition-resnet100-arcface-onnx/model.yml b/models/public/face-recognition-resnet100-arcface-onnx/model.yml index ee81dc3398b..e5886dd4f2e 100644 --- a/models/public/face-recognition-resnet100-arcface-onnx/model.yml +++ b/models/public/face-recognition-resnet100-arcface-onnx/model.yml @@ -23,7 +23,7 @@ task_type: face_recognition files: - name: arcfaceresnet100-8.onnx size: 261036388 - sha256: f0a2e278b430372d308fef67c1aea308c2baf37f32e8908d9bfce035c26a3fb4 + sha384: 4bceb34ee96c7c0b544012be53870d757f332d9d2972962065618de6942cf60f63b94f702f85fcc31844b21de326ec72 source: https://media.githubusercontent.com/media/onnx/models/bb0d4cf3d4e2a5f7376c13a08d337e86296edbe8/vision/body_analysis/arcface/model/arcfaceresnet100-8.onnx model_optimizer_args: - --reverse_input_channels diff --git a/models/public/faceboxes-pytorch/model.yml b/models/public/faceboxes-pytorch/model.yml index c2068bd8a25..0ef54225926 100644 --- a/models/public/faceboxes-pytorch/model.yml +++ b/models/public/faceboxes-pytorch/model.yml @@ -19,11 +19,11 @@ task_type: detection files: - name: faceboxes.py size: 4999 - sha256: dadc02f4324565999f19affcdb26456b854b6ddbcba3892262fbee18b783c874 + sha384: 8ccecee302e753231d12db65c8bf8f872561b9f1fd2879dca6078ed04ec144fcd792b4ea507381b24b0fe620e684a0f6 source: https://raw.githubusercontent.com/zisianw/FaceBoxes.PyTorch/ab8478c22627690899114950cae27f8093424c95/models/faceboxes.py - name: FaceBoxesProd.pth size: 4072492 - sha256: c0cb2b1e40710c0aa5fc32a8759b1496a0fe0a126c907ca0ffe35b4bd0709d09 + sha384: 1277eb9bc0e94639b88be1a6455f80a7feeaeec2fed6bb979bf721004d5de5ff43b93c3c4f7d76f8e4f188301ae0a103 source: $type: google_drive id: 1tRVwOlu0QtjvADQ2H7vqrRwsWEmaqioI diff --git a/models/public/facenet-20180408-102900/model.yml b/models/public/facenet-20180408-102900/model.yml index 8448849073f..de12ed73ed8 100644 --- a/models/public/facenet-20180408-102900/model.yml +++ b/models/public/facenet-20180408-102900/model.yml @@ -19,7 +19,7 @@ task_type: face_recognition files: - name: 20180408-102900.zip size: 195479980 - sha256: 2a32a4d6b797b0e35e065c674dfa2d60e9eb2372aa10728bd0b221abe12490ac + sha384: f394011bacf7b191bdc7fd0157a0f6cb5a34c46d1cae2074ff3e8e9917f3eef79a6eeaed5d25395cf2dcad9854b7f8ee source: $type: google_drive id: 1R77HmFADxe87GmoLwzfgMu_HY0IhcyBz diff --git a/models/public/fast-neural-style-mosaic-onnx/model.yml b/models/public/fast-neural-style-mosaic-onnx/model.yml index 019f42f181c..4a379f263bd 100644 --- a/models/public/fast-neural-style-mosaic-onnx/model.yml +++ b/models/public/fast-neural-style-mosaic-onnx/model.yml @@ -21,7 +21,7 @@ description: >- task_type: "style_transfer" files: - name: fast-neural-style-mosaic-onnx.onnx - sha256: fa646dedade881243f8d5a2ceb7de2b93675b21fc24f7482894ac4851a9a0a47 + sha384: 3333259b6f7014ecdcc6be4863322988935e23c9ae6bf9668aa6208a5991d2c603cd342881bab0a064f365e929eeb4d4 source: https://media.githubusercontent.com/media/onnx/models/111fab38a5757c8fc8db0aa13e73fb330e516c42/vision/style_transfer/fast_neural_style/model/mosaic-9.onnx size: 6728029 model_optimizer_args: diff --git a/models/public/faster_rcnn_inception_resnet_v2_atrous_coco/model.yml b/models/public/faster_rcnn_inception_resnet_v2_atrous_coco/model.yml index cb08750494c..8003483ed22 100644 --- a/models/public/faster_rcnn_inception_resnet_v2_atrous_coco/model.yml +++ b/models/public/faster_rcnn_inception_resnet_v2_atrous_coco/model.yml @@ -19,7 +19,7 @@ task_type: detection files: - name: faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28.tar.gz size: 672221478 - sha256: d615532f464532620d742be6564bddaaaba3e5f9670c245c6309eb7842876c62 + sha384: 4b44a30cd9b989bc1c0d2f247977389a7daab590a0154b333d80a23fafa9570de6a4bc38226ee67c5cdd5549d8ea96d5 source: http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/faster_rcnn_inception_v2_coco/model.yml b/models/public/faster_rcnn_inception_v2_coco/model.yml index 0b286c293b3..360db31e13b 100644 --- a/models/public/faster_rcnn_inception_v2_coco/model.yml +++ b/models/public/faster_rcnn_inception_v2_coco/model.yml @@ -19,7 +19,7 @@ task_type: detection files: - name: faster_rcnn_inception_v2_coco.tar.gz size: 149119618 - sha256: db3295e9a52d406540e84bdd056edeedbf938782a7bc4af7918aaa5dc30f0df5 + sha384: d140529e5782595943a6910e5a918ecd6b9871dc615a37545db5dcfe6c304636ee2dc62e60a806c5c06028602dc1203a source: http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_v2_coco_2018_01_28.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/faster_rcnn_resnet101_coco/model.yml b/models/public/faster_rcnn_resnet101_coco/model.yml index 627062e053b..b325bd39be3 100644 --- a/models/public/faster_rcnn_resnet101_coco/model.yml +++ b/models/public/faster_rcnn_resnet101_coco/model.yml @@ -19,7 +19,7 @@ task_type: detection files: - name: faster_rcnn_resnet101_coco.tar.gz size: 593445323 - sha256: ef3b36b3bc3c4057362a62e40b89dbdbef3dbb0c91f2f7df43967920d24821e5 + sha384: d39799f52422740e78f66b9f8df2c360b232fb39a1d895d89dbebf71c4a9e65369b8d42f52e442552f13d11fe23ca758 source: http://download.tensorflow.org/models/object_detection/faster_rcnn_resnet101_coco_2018_01_28.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/faster_rcnn_resnet50_coco/model.yml b/models/public/faster_rcnn_resnet50_coco/model.yml index 168e0d7b01f..6933ca17772 100644 --- a/models/public/faster_rcnn_resnet50_coco/model.yml +++ b/models/public/faster_rcnn_resnet50_coco/model.yml @@ -19,7 +19,7 @@ task_type: detection files: - name: faster_rcnn_resnet50_coco_2018_01_28.tar.gz size: 381355771 - sha256: 0f898f96d6c416de192c516fb6fa773ae9f5ee253eb2ab4015445fbd6eb0ab76 + sha384: 905eb0e51f1894a02bb8391ed436601450df67e092a9aaee72fc3868d556bbf7410af97a18a06223b389bb818e489999 source: http://download.tensorflow.org/models/object_detection/faster_rcnn_resnet50_coco_2018_01_28.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/fastseg-large/model.yml b/models/public/fastseg-large/model.yml index 360d98a09ba..e74012019bd 100644 --- a/models/public/fastseg-large/model.yml +++ b/models/public/fastseg-large/model.yml @@ -25,31 +25,31 @@ task_type: semantic_segmentation files: - name: mobilev3large-lraspp-f128-9cbabfde.pt size: 26476800 - sha256: 9cbabfde06332879ebb2ef344506099f363efd377afdebdbdf548298ce18557e + sha384: f30098181481da6b3c4b2bc59896986e905e75768f5f454515dfd2a36433f11d292e503b1c9d0a7b05a8cfdcc2d58a3f source: https://github.com/ekzhang/fastseg/releases/download/v0.1-weights/mobilev3large-lraspp-f128-9cbabfde.pt - name: model/geffnet-1.0.0-py3-none-any.whl size: 39902 - sha256: baca506fb5f95936c2428afaf875731a7185391b577e04790446ee1f06aac5fc + sha384: 5f52af3fe57f79f9b24198fea8a8beddd1f53f6333feb2beeb8616abdad2b753dd26c8b1af97be5eee04970ded28e299 source: https://files.pythonhosted.org/packages/52/a2/d3f39e1e8c7f9717dd3195811b33238211b65e67c577abe23db49fecc654/geffnet-1.0.0-py3-none-any.whl - name: model/fastseg/model/mobilenetv3.py size: 4106 - sha256: d9bb38212cb574387570baf2c949bd1e8075a76c6b87ef771c01d76f1b9dde95 + sha384: ba0d92274dabf4372ee7ce523abe2d634525cc9863b81ddc0c7bb880f91552dbeca9b27001fa814effbab88e83a2677e source: https://raw.githubusercontent.com/ekzhang/fastseg/91238cdf2251a82f3fe4d35e28873cf84f602c0a/fastseg/model/mobilenetv3.py - name: model/fastseg/model/lraspp.py size: 4882 - sha256: 75e2b171a83ca54f5326f03dfe3f8fd370e49dcb9923e033c443dad4a396a50a + sha384: f2a9f10e7bf348690cb35a087fb255b6b822eb639b4fb4ad0ebab717efe4f4f423e10542a9fe6c48dd7c403ad54c059f source: https://raw.githubusercontent.com/ekzhang/fastseg/91238cdf2251a82f3fe4d35e28873cf84f602c0a/fastseg/model/lraspp.py - name: model/fastseg/model/utils.py size: 1792 - sha256: 29c4ee2054abf686ecabce30205cfe054a111d58cf7708595b5e9c08b038568e + sha384: df493f8e69a576a1ba4e428e56b0893418ee37bf09baade5186a202ff6f4e757879a2fbfb1275da90fec970f84369108 source: https://raw.githubusercontent.com/ekzhang/fastseg/91238cdf2251a82f3fe4d35e28873cf84f602c0a/fastseg/model/utils.py - name: model/fastseg/model/base.py size: 4236 - sha256: 14a3997ad3cbc816b77df7df63338540ac7a57b07dc9b8c23428f749190f38cb + sha384: b0c919107bb436150b428977dd5ba1b8b1c1d5a76913a2be77cb6387796ae9f09f5f3801a2c587af08dc1e64a9d9f20d source: https://raw.githubusercontent.com/ekzhang/fastseg/91238cdf2251a82f3fe4d35e28873cf84f602c0a/fastseg/model/base.py - name: model/fastseg/__init__.py size: 55 - sha256: 160c9a92f85fbdb01bc22c41325b971778190917b4a6fecbffd6c355b862b57c + sha384: 365d191d43379f5b4b0de21b466743c22eb385b00f4156404396f58905f9ec479250bd5f01fa1a927a2d1f997d5d2251 source: https://raw.githubusercontent.com/ekzhang/fastseg/91238cdf2251a82f3fe4d35e28873cf84f602c0a/fastseg/__init__.py postprocessing: - $type: unpack_archive diff --git a/models/public/fastseg-small/model.yml b/models/public/fastseg-small/model.yml index 464bc3c93bc..b7bf95d0b26 100644 --- a/models/public/fastseg-small/model.yml +++ b/models/public/fastseg-small/model.yml @@ -25,31 +25,31 @@ task_type: semantic_segmentation files: - name: mobilev3small-lraspp-f128-a39a1e4b.pt size: 9256712 - sha256: a39a1e4b33a049fee6baa1139e911e71acd04f1c37c0038721ec1ef87507cd14 + sha384: 2620fcf3ffeea09ea5bc1a50f3ccbae8a15aa22bcdaca02aa7c581fa1d6a1fef7ef43732b5baf58ec30c25df8ec042c8 source: 'https://github.com/ekzhang/fastseg/releases/download/v0.1-weights/mobilev3small-lraspp-f128-a39a1e4b.pt' - name: model/geffnet-1.0.0-py3-none-any.whl size: 39902 - sha256: baca506fb5f95936c2428afaf875731a7185391b577e04790446ee1f06aac5fc + sha384: 5f52af3fe57f79f9b24198fea8a8beddd1f53f6333feb2beeb8616abdad2b753dd26c8b1af97be5eee04970ded28e299 source: https://files.pythonhosted.org/packages/52/a2/d3f39e1e8c7f9717dd3195811b33238211b65e67c577abe23db49fecc654/geffnet-1.0.0-py3-none-any.whl - name: model/fastseg/model/mobilenetv3.py size: 4106 - sha256: d9bb38212cb574387570baf2c949bd1e8075a76c6b87ef771c01d76f1b9dde95 + sha384: ba0d92274dabf4372ee7ce523abe2d634525cc9863b81ddc0c7bb880f91552dbeca9b27001fa814effbab88e83a2677e source: https://raw.githubusercontent.com/ekzhang/fastseg/91238cdf2251a82f3fe4d35e28873cf84f602c0a/fastseg/model/mobilenetv3.py - name: model/fastseg/model/lraspp.py size: 4882 - sha256: 75e2b171a83ca54f5326f03dfe3f8fd370e49dcb9923e033c443dad4a396a50a + sha384: f2a9f10e7bf348690cb35a087fb255b6b822eb639b4fb4ad0ebab717efe4f4f423e10542a9fe6c48dd7c403ad54c059f source: https://raw.githubusercontent.com/ekzhang/fastseg/91238cdf2251a82f3fe4d35e28873cf84f602c0a/fastseg/model/lraspp.py - name: model/fastseg/model/utils.py size: 1792 - sha256: 29c4ee2054abf686ecabce30205cfe054a111d58cf7708595b5e9c08b038568e + sha384: df493f8e69a576a1ba4e428e56b0893418ee37bf09baade5186a202ff6f4e757879a2fbfb1275da90fec970f84369108 source: https://raw.githubusercontent.com/ekzhang/fastseg/91238cdf2251a82f3fe4d35e28873cf84f602c0a/fastseg/model/utils.py - name: model/fastseg/model/base.py size: 4236 - sha256: 14a3997ad3cbc816b77df7df63338540ac7a57b07dc9b8c23428f749190f38cb + sha384: b0c919107bb436150b428977dd5ba1b8b1c1d5a76913a2be77cb6387796ae9f09f5f3801a2c587af08dc1e64a9d9f20d source: https://raw.githubusercontent.com/ekzhang/fastseg/91238cdf2251a82f3fe4d35e28873cf84f602c0a/fastseg/model/base.py - name: model/fastseg/__init__.py size: 55 - sha256: 160c9a92f85fbdb01bc22c41325b971778190917b4a6fecbffd6c355b862b57c + sha384: 365d191d43379f5b4b0de21b466743c22eb385b00f4156404396f58905f9ec479250bd5f01fa1a927a2d1f997d5d2251 source: https://raw.githubusercontent.com/ekzhang/fastseg/91238cdf2251a82f3fe4d35e28873cf84f602c0a/fastseg/__init__.py postprocessing: - $type: unpack_archive diff --git a/models/public/fbcnn/README.md b/models/public/fbcnn/README.md new file mode 100644 index 00000000000..113232f137c --- /dev/null +++ b/models/public/fbcnn/README.md @@ -0,0 +1,91 @@ +# fbcnn + +## Use Case and High-Level Description + +The `fbcnn` model is a flexible blind convolutional neural network to remove JPEG artifacts. Model based on ["Towards Flexible Blind JPEG Artifacts Removal"](https://arxiv.org/abs/2109.14573) paper. It was implemented in PyTorch* framework. Model works with color jpeg images. For details about this model and other jpeg artifacts removal models (for grayscale images and double jpeg restoration), check out the ["Towards Flexible Blind JPEG Artifacts Removal (FBCNN, ICCV 2021)"](https://github.com/jiaxi-jiang/FBCNN). + +## Specification + +| Metric | Value | +| ---------------- | --------------- | +| Type | Image Processing| +| GFLOPs | 1420.78235 | +| MParams | 71.922 | +| Source framework | PyTorch\* | + +## Accuracy + +Model was tested on [LIVE_1](https://live.ece.utexas.edu/research/quality/subjective.htm) dataset. + +| Metric | Original model | Converted model | +| ------ | -------------- | --------------- | +| PSNR | 34.34Db | 34.34Db | +| SSIM | 0.99 | 0.99 | + +## Input + +### Original model + +Image, name - `image_lq`, shape - `1, 3, 512, 512`, format is `B, C, H, W`, where: + +- `B` - batch size +- `C` - channel +- `H` - height +- `W` - width + +Channel order is `RGB`. +Scale value - 255. + +### Converted model + +Image, name - `image_lq`, shape - `1, 3, 512, 512`, format is `B, C, H, W`, where: + +- `B` - batch size +- `C` - channel +- `H` - height +- `W` - width + +Channel order is `BGR` + +## Output + +### Original Model + +Restored image, name - `image_result`, shape - `1, 3, 512, 512`, output data format is `B, C, H, W`, where: + +- `B` - batch size +- `C` - channel +- `H` - height +- `W` - width + +Channel order is `RGB`. + +### Converted Model + +Restored image, name - `image_result`, shape - `1, 3, 512, 512`, output data format is `B, C, H, W`, where: + +- `B` - batch size +- `C` - channel +- `H` - height +- `W` - width + +Channel order is `BGR`. + +## Download a Model and Convert it into Inference Engine Format + +You can download models and if necessary convert them into Inference Engine format using the [Model Downloader and other automation tools](../../../tools/model_tools/README.md) as shown in the examples below. + +An example of using the Model Downloader: +``` +omz_downloader --name +``` + +An example of using the Model Converter: +``` +omz_converter --name +``` + +## Legal Information + +The original model is distributed under the following +[license](https://raw.githubusercontent.com/jiaxi-jiang/FBCNN/main/LICENSE). diff --git a/models/public/fbcnn/accuracy-check.yml b/models/public/fbcnn/accuracy-check.yml new file mode 100644 index 00000000000..327bfd577ef --- /dev/null +++ b/models/public/fbcnn/accuracy-check.yml @@ -0,0 +1,33 @@ +models: + - name: fbcnn + + launchers: + - framework: dlsdk + adapter: + type: image_processing + reverse_channels: True + allow_reshape_input: True + + datasets: + - name: LIVE_1 + preprocessing: + - type: jpeg_compression + quality_factor: 40 + - type: padding + stride: 8 + pad_type: right_bottom + use_numpy: True + numpy_pad_mode: symmetric + postprocessing: + - type: corner_crop_image + apply_to: prediction + metrics: + - type: psnr + scale_border: 0 + presenter: print_vector + reference: + mean: 34.34 + - type: ssim + presenter: print_vector + reference: + mean: 0.99 diff --git a/models/public/fbcnn/model.yml b/models/public/fbcnn/model.yml new file mode 100644 index 00000000000..a584d79bfd3 --- /dev/null +++ b/models/public/fbcnn/model.yml @@ -0,0 +1,61 @@ +# Copyright (c) 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +description: >- + The "fbcnn" model is a flexible blind convolutional neural network to remove JPEG + artifacts. Model based on "Towards Flexible Blind JPEG Artifacts Removal" + paper. It was implemented in PyTorch* framework. Model works with color jpeg images. + For details about this model and other jpeg artifacts removal models (for grayscale + images and double jpeg restoration), check out the "Towards Flexible Blind JPEG + Artifacts Removal (FBCNN, ICCV 2021)" . +task_type: image_processing +files: + - name: net.py + size: 14063 + sha384: 993649cebed4f249b35f92a64d797916bba297e6ff58c1f0081402d6c61cf63b661a3388f67c74eafc6ca9e587bd5b5b + source: https://raw.githubusercontent.com/jiaxi-jiang/FBCNN/f599bc58e1e2ebe1ab473350ce3c887f491143e1/models/network_fbcnn.py + - name: ckpt/fbcnn_color.pth + size: 287755111 + sha384: 11610eb602aa0b3f53568d572fadff03be04854dbc952d49a9b24d4edcba1eb42475b31c1496d669e0b549c431379128 + source: https://github.com/jiaxi-jiang/FBCNN/releases/download/v1.0/fbcnn_color.pth +postprocessing: + - $type: regex_replace + file: net.py + pattern: 'x = x\[..., :h, :w\]|x = nn.ReplicationPad2d\(\(0, paddingRight, 0, + paddingBottom\)\)\(x\)' + replacement: '# \g<0>' + # add channels reversing to BGR to model output + - $type: regex_replace + file: net.py + pattern: 'return x,' + replacement: 'return x[:, [2, 1, 0], :, :],' +conversion_to_onnx_args: + - --model-path=$config_dir + - --model-path=$dl_dir + - --import-module=net + - --model-name=FBCNN + - --weights=$dl_dir/ckpt/fbcnn_color.pth + - --input-shape=1,3,512,512 + - --input-names=image_lq + - --output-names=image_result + - --output-file=$conv_dir/fbcnn_color.onnx +model_optimizer_args: + - --reverse_input_channels + - --input_shape=[1,3,512,512] + - --input=image_lq + - --scale_values=image_lq[255] + - --output=image_result + - --input_model=$conv_dir/fbcnn_color.onnx +framework: pytorch +license: https://raw.githubusercontent.com/jiaxi-jiang/FBCNN/main/LICENSE diff --git a/models/public/fcrn-dp-nyu-depth-v2-tf/model.yml b/models/public/fcrn-dp-nyu-depth-v2-tf/model.yml index c6ef398769d..230d433303d 100644 --- a/models/public/fcrn-dp-nyu-depth-v2-tf/model.yml +++ b/models/public/fcrn-dp-nyu-depth-v2-tf/model.yml @@ -24,7 +24,7 @@ framework: tf files: - name: NYU_FCRN-checkpoint.zip size: 472588519 - sha256: 9d97ed165c4a5b3f085eb83b8814de1e883c6348da60da4b2568ddd64bb2d5c4 + sha384: a7e281b3c8ed500f6d3d759febbb3c5a72ae66a8b432ca4e68b45d4defed0f9ca1f3606cbc34a136203283b9a5370122 source: http://campar.in.tum.de/files/rupprecht/depthpred/NYU_FCRN-checkpoint.zip postprocessing: - $type: unpack_archive diff --git a/models/public/forward-tacotron/forward-tacotron-duration-prediction/model.yml b/models/public/forward-tacotron/forward-tacotron-duration-prediction/model.yml index 9c9bec20d3e..195691795ca 100644 --- a/models/public/forward-tacotron/forward-tacotron-duration-prediction/model.yml +++ b/models/public/forward-tacotron/forward-tacotron-duration-prediction/model.yml @@ -18,7 +18,7 @@ task_type: text_to_speech files: - name: forward-tacotron-duration-prediction.zip size: 54840281 - sha256: bab718d6bb997f7b0dd807f98647cd8958cf9b811571301a34865a623af25bb1 + sha384: abaa75849759d344010c2e549b140b22241e6c4f72fcf482ad3f47f84b5b992c8d622d95312f3b0a34db67744981f7f2 source: https://download.01.org/opencv/public_models/102020/forward-tacotron/forward-tacotron-duration-prediction.zip postprocessing: - $type: unpack_archive diff --git a/models/public/forward-tacotron/forward-tacotron-regression/model.yml b/models/public/forward-tacotron/forward-tacotron-regression/model.yml index cf93170ea46..e4d9331f920 100644 --- a/models/public/forward-tacotron/forward-tacotron-regression/model.yml +++ b/models/public/forward-tacotron/forward-tacotron-regression/model.yml @@ -18,7 +18,7 @@ task_type: text_to_speech files: - name: forward-tacotron-regression.zip size: 29948456 - sha256: 4a087de0f6126335f804bd4b15b672778d824e0f3538f6cc08710291c753ad29 + sha384: c58dc63650b2f1b45a30891ff2669cf205f7b5fbafff65a4a2a37ddebb2ba4521110dabf27752121ce3ef8369439004e source: https://download.01.org/opencv/public_models/102020/forward-tacotron/forward-tacotron-regression.zip postprocessing: - $type: unpack_archive diff --git a/models/public/gmcnn-places2-tf/model.yml b/models/public/gmcnn-places2-tf/model.yml index 988ad9ab493..24959258439 100644 --- a/models/public/gmcnn-places2-tf/model.yml +++ b/models/public/gmcnn-places2-tf/model.yml @@ -22,7 +22,7 @@ task_type: image_inpainting files: - name: gmcnn-places2-tf.zip size: 46187310 - sha256: 18df63c6e244029691a4ad0d33760d92d346df71fe2c5cafe228d1c39e23eb3d + sha384: 35fbd27cfab9f23fe0e5cf87cce3bb6b200af657f3a21054f0d430b1a2b430a004a128a9acd19e0ee3bb6983d48cbbba source: https://download.01.org/opencv/public_models/092020/gmcnn-places2-tf/gmcnn-places2-tf.zip postprocessing: - $type: unpack_archive diff --git a/models/public/googlenet-v1-tf/model.yml b/models/public/googlenet-v1-tf/model.yml index 4b0666f0dea..265e7e4dccb 100644 --- a/models/public/googlenet-v1-tf/model.yml +++ b/models/public/googlenet-v1-tf/model.yml @@ -21,27 +21,27 @@ task_type: classification files: - name: inception_v1_2016_08_28.tar.gz size: 24642554 - sha256: 7a620c430fcaba8f8f716241f5148c4c47c035cce4e49ef02cfbe6cd1adf96a6 + sha384: d5e2af5f481cb99256ebf66e24b96cafa39a9d4088b63975ed108264596af3a49f927fb79419e068db95ee20504bf692 source: http://download.tensorflow.org/models/inception_v1_2016_08_28.tar.gz - name: models/research/slim/nets/inception.py size: 1676 - sha256: 626dc8ed0bd747d9f523062bdb0301b9740a4a31363c1601c9157834ac4ea3e9 + sha384: 1500832b0ca4ea2a8e70b7f865bc154162a01a496fb9d654d680bfe27bcc83c8c7140f60e1f2484904d1945d5906370b source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/inception.py - name: models/research/slim/nets/inception_utils.py size: 3079 - sha256: 746d308f90dd3feae2b46298bcc64a836a999c617e10523310416ce6ec275659 + sha384: 6b903694f0763da63a8108e8ffb8d26a7cc25c8b5f2a4a6ed21372ed2e5ffe19238d1107820ee941dfd97b05dd369a28 source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/inception_utils.py - name: models/research/slim/nets/inception_v1.py size: 16875 - sha256: af1613056b50df10da13be66a859c35d72886facd07d175be47ccd5c9380a8ce + sha384: 3532f7cf94cf0ea7de26972c3117d01eb939b13220413112c7e2766fc67ea94e7b6d0a9380ff80062b9ea9c856c74564 source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/inception_v1.py - name: models/research/slim/nets/nets_factory.py size: 7253 - sha256: ec4ea091ece9ad0f89fdc1da05397ae0a0be7c46ebefa02834d59a5c908d426a + sha384: 4941e0ba7991b80a03b7a8aedcf7d954e0b692e3c53cec2a4d06c0a7d576f704f0d7668d0cccb3d55567bc860c024ab6 source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/nets_factory.py - name: models/research/slim/tf_slim-1.1.0-py2.py3-none-any.whl size: 352133 - sha256: fa2bab63b3925bd42601102e7f178dce997f525742596bf404fa8a6918e146ff + sha384: eac0abda0ef71025cc4785a2b24cdb8a7ec9479b97ce12334e27711f92f2a2407945308ce3d5d2b0b1b0daa6212ee02f source: https://files.pythonhosted.org/packages/02/97/b0f4a64df018ca018cc035d44f2ef08f91e2e8aa67271f6f19633a015ff7/tf_slim-1.1.0-py2.py3-none-any.whl postprocessing: - $type: unpack_archive diff --git a/models/public/googlenet-v1/model.yml b/models/public/googlenet-v1/model.yml index a3406ba04fe..89e636a7835 100644 --- a/models/public/googlenet-v1/model.yml +++ b/models/public/googlenet-v1/model.yml @@ -28,11 +28,11 @@ task_type: classification files: - name: googlenet-v1.prototxt size: 35862 - sha256: fa36cd4112a3240a29600a5aa35333f31bec33daa1a6085b0af308a9f50f0c50 + sha384: 762e0669b2b1974cf5b544edb9dcf4e98203d35cdbb3f9f28363993712dece4b8d72def02b5b36c098a5a23b40f2c275 source: https://raw.githubusercontent.com/BVLC/caffe/88c96189bcbf3853b93e2b65c7b5e4948f9d5f67/models/bvlc_googlenet/deploy.prototxt - name: googlenet-v1.caffemodel size: 53533754 - sha256: 6f7101e3a2183738a7125a0c5021ba82a1feb4228c5ca0924d991b6daf6f6fad + sha384: c95413cd55c390f439ccc9842ec5953b31f85090d5f262e3093e38c78f378acdfb069fa28da2f49dbb8b9e5c8a816276 source: http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel postprocessing: - $type: regex_replace diff --git a/models/public/googlenet-v2-tf/model.yml b/models/public/googlenet-v2-tf/model.yml index d2702ec81be..d04cc27152a 100644 --- a/models/public/googlenet-v2-tf/model.yml +++ b/models/public/googlenet-v2-tf/model.yml @@ -21,27 +21,27 @@ task_type: classification files: - name: inception_v2_2016_08_28.tar.gz size: 41577079 - sha256: 3b9d269984402003d8330affc4e1463c0b4cfd536339ad12446a48d72477480a + sha384: c0b2efbae8fc5e237ae67637dca3f311d4b4f7da576b56067e83d95c398a2fccd50baff9cc0de64335f4d7b78e1adb07 source: http://download.tensorflow.org/models/inception_v2_2016_08_28.tar.gz - name: models/research/slim/nets/inception.py size: 1676 - sha256: 626dc8ed0bd747d9f523062bdb0301b9740a4a31363c1601c9157834ac4ea3e9 + sha384: 1500832b0ca4ea2a8e70b7f865bc154162a01a496fb9d654d680bfe27bcc83c8c7140f60e1f2484904d1945d5906370b source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/inception.py - name: models/research/slim/nets/inception_utils.py size: 3079 - sha256: 746d308f90dd3feae2b46298bcc64a836a999c617e10523310416ce6ec275659 + sha384: 6b903694f0763da63a8108e8ffb8d26a7cc25c8b5f2a4a6ed21372ed2e5ffe19238d1107820ee941dfd97b05dd369a28 source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/inception_utils.py - name: models/research/slim/nets/inception_v2.py size: 26623 - sha256: 918e9eb16f05e83365d6f34354f523f9f0815adf61b6bcc640fb3165b43c012e + sha384: 9f49cd1c9ff2590538018887502ad4c3b2b5e32b75dc5723a34db0262e1da2a6a3385d5e75f7533e7453bb3e6c2dde44 source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/inception_v2.py - name: models/research/slim/nets/nets_factory.py size: 7253 - sha256: ec4ea091ece9ad0f89fdc1da05397ae0a0be7c46ebefa02834d59a5c908d426a + sha384: 4941e0ba7991b80a03b7a8aedcf7d954e0b692e3c53cec2a4d06c0a7d576f704f0d7668d0cccb3d55567bc860c024ab6 source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/nets_factory.py - name: models/research/slim/tf_slim-1.1.0-py2.py3-none-any.whl size: 352133 - sha256: fa2bab63b3925bd42601102e7f178dce997f525742596bf404fa8a6918e146ff + sha384: eac0abda0ef71025cc4785a2b24cdb8a7ec9479b97ce12334e27711f92f2a2407945308ce3d5d2b0b1b0daa6212ee02f source: https://files.pythonhosted.org/packages/02/97/b0f4a64df018ca018cc035d44f2ef08f91e2e8aa67271f6f19633a015ff7/tf_slim-1.1.0-py2.py3-none-any.whl postprocessing: - $type: unpack_archive diff --git a/models/public/googlenet-v2/model.yml b/models/public/googlenet-v2/model.yml index 33e2d6edecd..62840b2401c 100644 --- a/models/public/googlenet-v2/model.yml +++ b/models/public/googlenet-v2/model.yml @@ -28,11 +28,11 @@ task_type: classification files: - name: googlenet-v2.prototxt size: 60274 - sha256: 18c77f01cca83c4cee973bfd8739968210dd6a1e5af1b857faaec230c5aa7d5a + sha384: 47eca6e38cc06c3313ce9f1361abdc6e5f0344e6becdc22f367147a6ba7783cab9858bc70b5e4807974fac96531bcbc3 source: https://raw.githubusercontent.com/lim0606/caffe-googlenet-bn/d19caf526b7d8cad873ff91ba4cea602eadd58b3/deploy.prototxt - name: googlenet-v2.caffemodel size: 64445495 - sha256: c6581a8e60e5ae8962183ff019986fc9dfacc5e5bd5247d76a0ff7fae8e0409a + sha384: f3357581220899740821f9f2bfe8e68915df06204bcf14fb7e27c81f16879698b6c36fae937ead32d216a6744b0f1aa9 source: https://github.com/lim0606/caffe-googlenet-bn/raw/d19caf526b7d8cad873ff91ba4cea602eadd58b3/snapshots/googlenet_bn_stepsize_6400_iter_1200000.caffemodel postprocessing: - $type: regex_replace diff --git a/models/public/googlenet-v3-pytorch/README.md b/models/public/googlenet-v3-pytorch/README.md index 75c8489751c..994c21057cb 100644 --- a/models/public/googlenet-v3-pytorch/README.md +++ b/models/public/googlenet-v3-pytorch/README.md @@ -59,7 +59,7 @@ Expected color order - `BGR`. Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000` in `B, C` format, where: - `B` - batch size -- `C` - vector of probabilities for each class in [0, 1] range +- `C` - vector of probabilities for each class in logits format ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/googlenet-v3-pytorch/model.yml b/models/public/googlenet-v3-pytorch/model.yml index ddc559d7b73..b856f018095 100644 --- a/models/public/googlenet-v3-pytorch/model.yml +++ b/models/public/googlenet-v3-pytorch/model.yml @@ -26,7 +26,7 @@ description: >- task_type: classification files: - name: inception_v3_google-1a9a5a14.pth - sha256: 1a9a5a14f40645a370184bd54f4e8e631351e71399112b43ad0294a79da290c8 + sha384: 6e4a35647ef131a8e109fd922ac16216a324a73b77429cf8af2b8e4ddb05ef50a529e9407f9eb1b59b24e5e9ad22c3e5 size: 108857766 source: https://download.pytorch.org/models/inception_v3_google-1a9a5a14.pth framework: pytorch diff --git a/models/public/googlenet-v3/README.md b/models/public/googlenet-v3/README.md index d1aceab7807..fa8bea0a3f2 100644 --- a/models/public/googlenet-v3/README.md +++ b/models/public/googlenet-v3/README.md @@ -50,7 +50,7 @@ Expected color order: `BGR`. Object classifier according to ImageNet classes, name: `InceptionV3/Predictions/Softmax`, shape: `1, 1001` in `B, C` format, where: - `B` - batch size -- `C` - vector of probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. +- `C` - vector of probabilities for all dataset classes in [0, 1] range (0 class is background). ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/googlenet-v3/model.yml b/models/public/googlenet-v3/model.yml index 9b489025bbe..e6323b2865b 100644 --- a/models/public/googlenet-v3/model.yml +++ b/models/public/googlenet-v3/model.yml @@ -20,7 +20,7 @@ task_type: classification files: - name: googlenet-v3.tar.gz size: 88668554 - sha256: 7045b72a954af4dce36346f478610acdccbf149168fa25c78e54e32f0c723d6d + sha384: 5438688088e7610248f3bf09c36bb9225ca85efd5df11ed16c8ba446ced39ee5602bb2e84b077f9fb4d044ff18181e34 source: https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/googlenet-v4-tf/model.yml b/models/public/googlenet-v4-tf/model.yml index 17750ab775b..ff905d07777 100644 --- a/models/public/googlenet-v4-tf/model.yml +++ b/models/public/googlenet-v4-tf/model.yml @@ -22,27 +22,27 @@ task_type: classification files: - name: inception_v4_2016_09_09.tar.gz size: 171177982 - sha256: 272a2b24f68b2e51f3081479df075dd62b019ccda630e998fb7f6cf314c0f304 + sha384: 97765872563bf059728f96faa4aef86fa20ffe10c099f7bc2990adacc9a41a73549c45e939441a7e4f1dc2f45127a2d2 source: http://download.tensorflow.org/models/inception_v4_2016_09_09.tar.gz - name: models/research/slim/nets/inception.py size: 1676 - sha256: 626dc8ed0bd747d9f523062bdb0301b9740a4a31363c1601c9157834ac4ea3e9 + sha384: 1500832b0ca4ea2a8e70b7f865bc154162a01a496fb9d654d680bfe27bcc83c8c7140f60e1f2484904d1945d5906370b source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/inception.py - name: models/research/slim/nets/inception_utils.py size: 3079 - sha256: 746d308f90dd3feae2b46298bcc64a836a999c617e10523310416ce6ec275659 + sha384: 6b903694f0763da63a8108e8ffb8d26a7cc25c8b5f2a4a6ed21372ed2e5ffe19238d1107820ee941dfd97b05dd369a28 source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/inception_utils.py - name: models/research/slim/nets/inception_v4.py size: 16519 - sha256: 6d17559d084293080a597dca031c994454737f35937cf04901fc271de36170f4 + sha384: b4fa85412733b0800914ce2af14b9b3b340b9982fc1f491ba124d1b18d47751bf22e38cf8f902115ae6aca192028d7a6 source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/inception_v4.py - name: models/research/slim/nets/nets_factory.py size: 7253 - sha256: ec4ea091ece9ad0f89fdc1da05397ae0a0be7c46ebefa02834d59a5c908d426a + sha384: 4941e0ba7991b80a03b7a8aedcf7d954e0b692e3c53cec2a4d06c0a7d576f704f0d7668d0cccb3d55567bc860c024ab6 source: https://github.com/tensorflow/models/raw/d4a6670ade6ebd007b7974f85d70c4c879ba99d6/research/slim/nets/nets_factory.py - name: models/research/slim/tf_slim-1.1.0-py2.py3-none-any.whl size: 352133 - sha256: fa2bab63b3925bd42601102e7f178dce997f525742596bf404fa8a6918e146ff + sha384: eac0abda0ef71025cc4785a2b24cdb8a7ec9479b97ce12334e27711f92f2a2407945308ce3d5d2b0b1b0daa6212ee02f source: https://files.pythonhosted.org/packages/02/97/b0f4a64df018ca018cc035d44f2ef08f91e2e8aa67271f6f19633a015ff7/tf_slim-1.1.0-py2.py3-none-any.whl postprocessing: - $type: unpack_archive diff --git a/models/public/gpt-2/model.yml b/models/public/gpt-2/model.yml index 17842f84c33..2f7b1897134 100644 --- a/models/public/gpt-2/model.yml +++ b/models/public/gpt-2/model.yml @@ -27,27 +27,27 @@ task_type: text_prediction files: - name: transformers-4.9.1-py3-none-any.whl size: 2586799 - sha256: 86f3c46efecf114c6886d361c1d6cca14738f0e9d1effadb1e9252770cba55a0 + sha384: 6bafef459543eba13c7952082bfe89e4b969fc5a8e0524d0c7f659845bd3449586f13102e06cec85906be40d6a76a7c2 source: https://files.pythonhosted.org/packages/38/39/5238c128cef0f4405c568b1e8c9c7423202109dcbb1622333918d8de1cd3/transformers-4.9.1-py3-none-any.whl - name: gpt2/pytorch_model.bin size: 548118077 - sha256: 7c5d3f4b8b76583b422fcb9189ad6c89d5d97a094541ce8932dce3ecabde1421 + sha384: da7d73f86e4aaa2ea10ae5cca81af55f1914ad27a65127a8fe171c30fda2addb035bb81e02855c9ff7e4c0c411330d3d source: https://huggingface.co/gpt2/resolve/main/pytorch_model.bin - name: gpt2/config.json size: 665 - sha256: 0daed7749b4f02b8f76240d5444551d7b08712dab4d0adb8239c56ba823bb7b4 + sha384: 7a725057662831dd8db64fa85aa42426d26a667f2357546bb674388f5598ee5169f653429aff8a2e48819dc251f7648f source: https://huggingface.co/gpt2/resolve/main/config.json - name: gpt2/vocab.json size: 1042301 - sha256: 196139668be63f3b5d6574427317ae82f612a97c5d1cdaf36ed2256dbf636783 + sha384: 43e578a41ade90c90c71fdc4bfc1457c2e288c0450b872f3fb4a27e9521cadcf881aa6f24e5fae208277d4134991c7b0 source: https://huggingface.co/gpt2/resolve/main/vocab.json - name: gpt2/merges.txt size: 456318 - sha256: 1ce1664773c50f3e0cc8842619a93edc4624525b728b188a9e0be33b7726adc5 + sha384: f91aa09e8551d2e001b4d6d0bf9a350a194ffe19397b913094c5ad8da940093894fd4064fce8edde9792b3474c107038 source: https://huggingface.co/gpt2/resolve/main/merges.txt - name: packaging-21.0-py3-none-any.whl size: 40357 - sha256: c86254f9220d55e31cc94d69bade760f0847da8000def4dfe1c6b872fd14ff14 + sha384: 1c96c2a22c453058086c807e681af38377d9a78baeb79d9b189f82db2b04055a27b9748b7a24db9aa3e82786019c2182 source: https://files.pythonhosted.org/packages/3c/77/e2362b676dc5008d81be423070dd9577fa03be5da2ba1105811900fda546/packaging-21.0-py3-none-any.whl postprocessing: - $type: unpack_archive diff --git a/models/public/hbonet-0.25/README.md b/models/public/hbonet-0.25/README.md index 9159c0f3ffb..c1e89be4308 100644 --- a/models/public/hbonet-0.25/README.md +++ b/models/public/hbonet-0.25/README.md @@ -50,7 +50,7 @@ Expected color order: `BGR`. Object classifier according to ImageNet classes, shape: `1, 1000` in `B, C` format, where: - `B` - batch size -- `C` - vector of probabilities for all dataset classes. +- `C` - vector of probabilities for all dataset classes in logits format. ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/hbonet-0.25/model.yml b/models/public/hbonet-0.25/model.yml index bcbb9f52d93..5850b1801f7 100644 --- a/models/public/hbonet-0.25/model.yml +++ b/models/public/hbonet-0.25/model.yml @@ -19,10 +19,10 @@ task_type: classification files: - name: hbonet.py size: 12548 - sha256: f272c67c5910cabca576a6001089b050ae995f6e340d9b3033a2e787c5fbc1ad + sha384: 7b069ad80839ed050c9ce5a10d389db1bd529a74b77858648ca168976bc9736fc30715d946e54e55445a5cb23edc4342 source: https://raw.githubusercontent.com/d-li14/HBONet/e9a76c15e3847b0f032a7000fe0c8138d6f2eb10/models/imagenet/hbonet.py - name: hbonet_0_25.pth - sha256: a69228ef353765879e929ada789a5c74dfd14fedaff931103ee1e285019dd3a0 + sha384: 836c1fe7b0e1ba55db92e7e1deb15641afac1f3ac7975d8a7bfa7bd08e407d4a7664b2eb7149553f1e241cd424adb5fc size: 7863957 source: https://raw.githubusercontent.com/d-li14/HBONet/master/pretrained/hbonet_0_25.pth framework: pytorch diff --git a/models/public/hbonet-0.5/README.md b/models/public/hbonet-0.5/README.md index bc7b6493ead..9aa78786279 100644 --- a/models/public/hbonet-0.5/README.md +++ b/models/public/hbonet-0.5/README.md @@ -50,7 +50,7 @@ Expected color order: `BGR`. Object classifier according to ImageNet classes, shape: `1, 1000` in `B, C` format, where: - `B` - batch size -- `C` - vector of probabilities for all dataset classes. +- `C` - vector of probabilities for all dataset classes in logits format. ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/hbonet-0.5/model.yml b/models/public/hbonet-0.5/model.yml index 9e78c5ecbc3..22dd2936bc1 100644 --- a/models/public/hbonet-0.5/model.yml +++ b/models/public/hbonet-0.5/model.yml @@ -19,10 +19,10 @@ task_type: classification files: - name: hbonet.py size: 12548 - sha256: f272c67c5910cabca576a6001089b050ae995f6e340d9b3033a2e787c5fbc1ad + sha384: 7b069ad80839ed050c9ce5a10d389db1bd529a74b77858648ca168976bc9736fc30715d946e54e55445a5cb23edc4342 source: https://raw.githubusercontent.com/d-li14/HBONet/e9a76c15e3847b0f032a7000fe0c8138d6f2eb10/models/imagenet/hbonet.py - name: hbonet_0_5.pth - sha256: 8b4ecae3dbdb93174115ad01f99af563b8ea940db0bcbfd1d4302419c6f859e1 + sha384: 3aeecf2621a52826a166bb9c7b0fb300964da0af407b63e3cf979e775510144fc38931fd9a08cf724fe3139fc878d4db size: 10307426 source: https://raw.githubusercontent.com/d-li14/HBONet/master/pretrained/hbonet_0_5.pth framework: pytorch diff --git a/models/public/hbonet-1.0/README.md b/models/public/hbonet-1.0/README.md index 3f1c200f9aa..d235889edd6 100644 --- a/models/public/hbonet-1.0/README.md +++ b/models/public/hbonet-1.0/README.md @@ -50,7 +50,7 @@ Expected color order: `BGR`. Object classifier according to ImageNet classes, shape: `1, 1000` in `B, C` format, where: - `B` - batch size -- `C` - vector of probabilities for all dataset classes. +- `C` - vector of probabilities for all dataset classes in logits format. ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/hbonet-1.0/model.yml b/models/public/hbonet-1.0/model.yml index fa7d86c389b..f644785ae40 100644 --- a/models/public/hbonet-1.0/model.yml +++ b/models/public/hbonet-1.0/model.yml @@ -19,10 +19,10 @@ task_type: classification files: - name: hbonet.py size: 12548 - sha256: f272c67c5910cabca576a6001089b050ae995f6e340d9b3033a2e787c5fbc1ad + sha384: 7b069ad80839ed050c9ce5a10d389db1bd529a74b77858648ca168976bc9736fc30715d946e54e55445a5cb23edc4342 source: https://raw.githubusercontent.com/d-li14/HBONet/e9a76c15e3847b0f032a7000fe0c8138d6f2eb10/models/imagenet/hbonet.py - name: hbonet_1_0.pth - sha256: cfbbac21420a6190fccd97b04ee6bff0dffe9d770b9a3cafb47656e5ab1b5235 + sha384: 27ea1715505128c6dd1cf22cc57e629b0f8c2acf7f9246894c5c003091b415e3f494cee156c7dbd330f5d6affce700ab size: 18467748 source: https://raw.githubusercontent.com/d-li14/HBONet/master/pretrained/hbonet_1_0.pth framework: pytorch diff --git a/models/public/higher-hrnet-w32-human-pose-estimation/model.yml b/models/public/higher-hrnet-w32-human-pose-estimation/model.yml index daaa68f522e..bd9f5999b72 100644 --- a/models/public/higher-hrnet-w32-human-pose-estimation/model.yml +++ b/models/public/higher-hrnet-w32-human-pose-estimation/model.yml @@ -28,31 +28,31 @@ task_type: human_pose_estimation files: - name: models/__init__.py size: 412 - sha256: 36696727c5c12c5e7c1da7f55fd3db6c0baf07c3c5e8ee6ea4f784422ccc49ce + sha384: fe099091a8545442577baf0886860846c2485fb991ce358e8632eeb10cc6a3827c54a64b1f0150c1fcb12ebeb103f625 source: https://raw.githubusercontent.com/HRNet/HigherHRNet-Human-Pose-Estimation/f97496fdaa5365ee33d44c7872da21375fb1a39c/lib/models/__init__.py - name: models/pose_higher_hrnet.py size: 21313 - sha256: d70a711df60f4faca7ff16540d532f54579a7ac9fea26ea745dcfff7fe49bd57 + sha384: 2772ce487f9c3407b814e67c6b017ea107caafc23a1cb64f9b8f855239d16dbd2ad3030825e04c29ba81b8a31f80e034 source: https://raw.githubusercontent.com/HRNet/HigherHRNet-Human-Pose-Estimation/f97496fdaa5365ee33d44c7872da21375fb1a39c/lib/models/pose_higher_hrnet.py - name: config/__init__.py size: 370 - sha256: 33aae6902c6cff66d4e687f3503bbcb0fe1d9537b8cd0b2476d07ad9fa82ed3e + sha384: b1c2faece903938d66f5969981daee79fb2322c9e9998189ab92ede8e3a2c08a9b2d2c0e257e118938e5bf1c4cf7bffd source: https://raw.githubusercontent.com/HRNet/HigherHRNet-Human-Pose-Estimation/f97496fdaa5365ee33d44c7872da21375fb1a39c/lib/config/__init__.py - name: config/default.py size: 6075 - sha256: ef62dcabd4c3ef40b8634e8b1735b2c09d8b231b89d84a52d96b374f8db9c737 + sha384: ad03d7165998982d22b8d7cdc3604f3b0bbbcebe8de4f1ff8d6897e8e297c3bffa0b83099c3ff1290407da5f29434220 source: https://raw.githubusercontent.com/HRNet/HigherHRNet-Human-Pose-Estimation/f97496fdaa5365ee33d44c7872da21375fb1a39c/lib/config/default.py - name: config/models.py size: 2518 - sha256: 960e26c10b96d8c1648f4db81870e47b69ea727bdc51a98fdd449087f70f9c5e + sha384: 2ae3fc62047e9838e8d1fbc59d2d127979f55a0672a5a2f43088447dabaa5f3d4039eb2f196c59f7f38d4e0d853ff58d source: https://raw.githubusercontent.com/HRNet/HigherHRNet-Human-Pose-Estimation/f97496fdaa5365ee33d44c7872da21375fb1a39c/lib/config/models.py - name: experiments/higher_hrnet.yaml size: 2326 - sha256: ec602f3383fa355834c82a229a68cbfb70b1a2a9b0ce607c05b34e0e8d6dbe40 + sha384: 1a8c79097c602a777ec1182a081258562844bfe98f9b4aadecbcb56e25f2f3ffed9db285121f9d819514eee4319228d4 source: https://raw.githubusercontent.com/HRNet/HigherHRNet-Human-Pose-Estimation/f97496fdaa5365ee33d44c7872da21375fb1a39c/experiments/coco/higher_hrnet/w32_512_adam_lr1e-3.yaml - name: ckpt/pose_higher_hrnet_w32_512.pth size: 115172215 - sha256: ef4c99ab8341b5d8c0437b3ea44aec6bd13b82f49b3b2c5e7696ce06c04777f5 + sha384: d344fcc4e426308139397bd708be1c59500e038a540ea0979b6a10556b5f3530701d86c0cab276fc5710419f91879e3d source: $type: google_drive id: 1V9Iz0ZYy9m8VeaspfKECDW0NKlGsYmO1 diff --git a/models/public/hrnet-v2-c1-segmentation/model.yml b/models/public/hrnet-v2-c1-segmentation/model.yml index 96f2530eb52..4c8c2ff5342 100644 --- a/models/public/hrnet-v2-c1-segmentation/model.yml +++ b/models/public/hrnet-v2-c1-segmentation/model.yml @@ -25,75 +25,75 @@ task_type: semantic_segmentation files: - name: mit_semseg/lib/__init__.py size: 0 - sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + sha384: 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/lib/__init__.py - name: mit_semseg/lib/nn/__init__.py size: 110 - sha256: 2600acab3ede0102ff0bd8e8f8d62b21e4fff97f99a95996aa14679b6ec30d01 + sha384: 4050fd70a8d21b8aea922c6c0d73569cff84b28f66046ccb2113e83c8f12bf8f95db694b9a2bb42a08ad09a870dab9e7 source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/lib/nn/__init__.py - name: mit_semseg/lib/nn/parallel/__init__.py size: 92 - sha256: fa04ce76f0e4d7a130a7cefca60690b53238010bb11d65b1c305221c36d1aaa1 + sha384: 7ca260234675a323f56408bea9267de912266a50093b1e0bfb189e0bfa7b5974c9fbf30df6d68e6c9277ef6c884a98eb source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/lib/nn/parallel/__init__.py - name: mit_semseg/lib/nn/parallel/data_parallel.py size: 3399 - sha256: 3e4075dc485b063be061c308d88134a644d0b3bc1507f42f40abd3fc69977ee4 + sha384: 410429adfdd581eecff4c6759a9fab2417812575459a06e43204fe7142347f31b0684fca9a16c112eeb399840751c4e9 source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/lib/nn/parallel/data_parallel.py - name: mit_semseg/lib/nn/modules/batchnorm.py size: 13813 - sha256: 42258e18cef5fb033e63f6e1a06c2897432c095a7177606ac6bb1119f5f2c856 + sha384: 74a7edde7fabc84ce35f54b723010c5240e39182fa992b709cff57222b4c93eb191f736f225323cce18947b88b0a9039 source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/lib/nn/modules/batchnorm.py - name: mit_semseg/lib/nn/modules/comm.py size: 4278 - sha256: a480d504d651eef51b8419254f00d97d5f0b2d9a4af590713605c0148725b234 + sha384: 6d6bee53d49e2c8c1e6b41f4c66d4cb71aaffcd0b7ba1772822c555f5820138a50d3381186ea96098b7149606582eaaa source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/lib/nn/modules/comm.py - name: mit_semseg/lib/nn/modules/__init__.py size: 449 - sha256: 0701e2062245ab6c90b3df6934a21be5c942b44b13c2ebb70695433599af7a15 + sha384: d206b7e26cd614aaea3b7fe4112b1d58a638c9ae71d4de479563f6fc60072899275b52454aa95875e65c039ebe97e51c source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/lib/nn/modules/__init__.py - name: mit_semseg/lib/nn/modules/replicate.py size: 3226 - sha256: 4498b873404fce05202d4f891262e249a95733816d3877e3aee3d2401138a6af + sha384: 9f662572ba39a396b98116ee8a4fe1b08fb5905fb2ba88cef3965a0827f6917409e7f25a5d1dcbf06acc986acea87d56 source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/lib/nn/modules/replicate.py - name: mit_semseg/models/__init__.py size: 53 - sha256: 9117afeac26d724bdba6f9f35d54b7ddab81e33847e717071c6ed789a458d84b + sha384: 072644401a4048275a5d5a6ee354254b648a30ff3ad4a5e9c08f69bc75ef304f634d0346ce6389459969f993f63ca291 source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/models/__init__.py - name: mit_semseg/models/hrnet.py size: 16811 - sha256: f6e07d7448746b101a30f7b250896a9651b99fa6e02820afcfa69b93a8dd9a1d + sha384: 5399e58e38d4547dd44b37f36dce7acfe8a1eec323b0a64c58b94bc89164e7803b57feb0b218150811a099aa33f57f14 source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/models/hrnet.py - name: mit_semseg/models/mobilenet.py size: 4938 - sha256: 2462300b9863d40da75d2cbcf785015e53930c3ce37219cb9d4c24b468b63a34 + sha384: cc215b3f04289d458cc59a4be74cbb4fbe225dce8069dad35bae8953ca39fd4319e540050eae4f0fccebf572fd832ead source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/models/mobilenet.py - name: mit_semseg/models/models.py size: 21185 - sha256: fea2849abca35a260a64e852397bcccad64e2fd495fad668ad1622b5080033eb + sha384: 3f2710e28e9169a69aa553220c18038bda7ea4509114bae0b27e326680effe61c154fa47f86604a59e2f85a639644511 source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/models/models.py - name: mit_semseg/models/resnet.py size: 6770 - sha256: 685bb02446ce28eb1b110f3dfa9f6534a2ea34f50f09be0d7c165bd2c5c6c899 + sha384: d1eb13b7aa05bbba2ef6b91094c183a6dbaca1a2df6ec1a93a6aae4015c63d086ba931f3670de1422ac0855f2f4047b7 source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/models/resnet.py - name: mit_semseg/models/resnext.py size: 5367 - sha256: 271a95bdabb9e2c00ecc2e6765b7521f708cda5312b4d78bfb895374f3509044 + sha384: a4a6aa9c445c4e111a565456633e41946085e7dee4e16eb83389e6bf47e3d556d0b864921b9ce3759ece267d345ae91e source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/models/resnext.py - name: mit_semseg/models/utils.py size: 577 - sha256: 55a8f41269be28c17e456e5ae1f246bf71354765739dceca1e45becd58cba5e2 + sha384: 966c87730a8883fa54adcd1b3147c9ddd4e5a1a8aca51213e58029bf1dfba19ee976d67b93ae8ff7acb1e4d6f4e6b906 source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/models/utils.py - name: mit_semseg/__init__.py size: 63 - sha256: 7e58a465dbf83903f13d94ffce5b3353bcc8eb2154cd568bb405341f8a02ce5e + sha384: 6d7e00aba39cfd252198183cfcd63a51afb6bf841abb5d60b14316aa0ca7138f4c2e340480d30f2175a21c7b485db85f source: https://raw.githubusercontent.com/CSAILVision/semantic-segmentation-pytorch/9aff40de31ee4b21f18514d31e5d6e4ba056924d/mit_semseg/__init__.py - name: ckpt/decoder_epoch_30.pth size: 4780389 - sha256: 6060764940b620804befaca4df916de019c82c4e96ace00916991e223af37d1e + sha384: 943a8e1974c5f678fec59b3eb5d5859c9c95f82be607f10aac5261730d2e813274440b177970fb55a08f29f2bc5bdf89 source: http://sceneparsing.csail.mit.edu/model/pytorch/ade20k-hrnetv2-c1/decoder_epoch_30.pth - name: ckpt/encoder_epoch_30.pth size: 262518297 - sha256: 0bba1a5da1484b21a42f89e05459e434119c829d6aae64d1c6d3ae0c38d2b43c + sha384: e01539688455d218c189c41381f58e2d1e6383d7dad057cc921cada06fb3c0f014f6f72e7a44e4a082356d98417fddfb source: http://sceneparsing.csail.mit.edu/model/pytorch/ade20k-hrnetv2-c1/encoder_epoch_30.pth conversion_to_onnx_args: - --model-path=$config_dir diff --git a/models/public/human-pose-estimation-3d-0001/accuracy-check.yml b/models/public/human-pose-estimation-3d-0001/accuracy-check.yml index 0d24b517920..db76d15b05d 100644 --- a/models/public/human-pose-estimation-3d-0001/accuracy-check.yml +++ b/models/public/human-pose-estimation-3d-0001/accuracy-check.yml @@ -26,4 +26,4 @@ models: metrics: - type: mpjpe_multiperson - reference: 100.45 + reference: 10.045 diff --git a/models/public/human-pose-estimation-3d-0001/model.yml b/models/public/human-pose-estimation-3d-0001/model.yml index 544bd748715..b5ffb471da7 100644 --- a/models/public/human-pose-estimation-3d-0001/model.yml +++ b/models/public/human-pose-estimation-3d-0001/model.yml @@ -19,7 +19,7 @@ description: >- task_type: human_pose_estimation files: - name: human-pose-estimation-3d-0001.tar.gz - sha256: d2b158f07bd2f3d921bde1215829ac99afc7e63868d2d6738b24c7079db54efc + sha384: 14d1b70eb2d4102969b29c7716cbcdf9d1acd35839e044d2e62d69fbce4b98aa06cb954bb703d411cf991ffd809c6ea9 size: 18421831 source: https://download.01.org/opencv/openvino_training_extensions/models/human_pose_estimation/human-pose-estimation-3d.tar.gz postprocessing: diff --git a/models/public/hybrid-cs-model-mri/model.yml b/models/public/hybrid-cs-model-mri/model.yml index 02f3ff66034..c6865fcdade 100644 --- a/models/public/hybrid-cs-model-mri/model.yml +++ b/models/public/hybrid-cs-model-mri/model.yml @@ -24,15 +24,15 @@ description: >- task_type: image_inpainting files: - name: wnet_20.hdf5 - sha256: e901dacad8dd1e709a97668cc46bb21085e25546b8746e7599397f970ce66861 + sha384: d52fc1fd1d698443041db4837551c787a0fd3da78d76b3ab1d6794b47a1da1f6ce8edb6014b4a52f1453f85cef48c2e9 size: 45478680 source: https://raw.githubusercontent.com/rmsouza01/Hybrid-CS-Model-MRI/2ede2f96161ce70dcdc922371fe6b6b254aafcc8/Models/wnet_20.hdf5 - name: stats_fs_unet_norm_20.npy - sha256: f14ef5d46b202f89b8b2e7fb3c13926ff15703dce0df3a8b06d7c8e4c7829614 + sha384: acf3e20ce39e94588981cbd7b6d9a642216c3ac2f689bb2a17a73819a3d2058705de6456d1a78d24df8dcb8fafab1f31 size: 160 source: https://raw.githubusercontent.com/rmsouza01/Hybrid-CS-Model-MRI/2ede2f96161ce70dcdc922371fe6b6b254aafcc8/Data/stats_fs_unet_norm_20.npy - name: frequency_spatial_network.py - sha256: 5fb3bf346587a9ed0de66b27f347da046a64064708cdd25b587ec34b43c6a569 + sha384: 6b2b2542144617e3787ae6e3d1298a04b7171add0afe6fe2490bcb0a42a7af8a952454246071eb589f98ebfbad89cf88 size: 9735 source: https://raw.githubusercontent.com/rmsouza01/Hybrid-CS-Model-MRI/2ede2f96161ce70dcdc922371fe6b6b254aafcc8/Modules/frequency_spatial_network.py framework: tf diff --git a/models/public/i3d-rgb-tf/model.yml b/models/public/i3d-rgb-tf/model.yml index dd4a9429bc3..d42d79aecab 100644 --- a/models/public/i3d-rgb-tf/model.yml +++ b/models/public/i3d-rgb-tf/model.yml @@ -23,7 +23,7 @@ description: >- task_type: action_recognition files: - name: i3d-rgb.frozen.pb - sha256: 77b3239c74c78be2c4c6747edd803deef8d4c8c3cf466c4c402a3db4f9d4b3a0 + sha384: 8f1c32cc56cc1ca6880b7725430ae8ec369485e60f9bcce9724042ecb6e5bd97d25a04148c38bfde60b0ed00c918bc96 size: 51046552 source: https://download.01.org/opencv/public_models/032020/i3d-rgb/rgb.frozen.pb framework: tf diff --git a/models/public/inception-resnet-v2-tf/model.yml b/models/public/inception-resnet-v2-tf/model.yml index 835dc7cfe88..dcd9045f709 100644 --- a/models/public/inception-resnet-v2-tf/model.yml +++ b/models/public/inception-resnet-v2-tf/model.yml @@ -20,7 +20,7 @@ task_type: classification files: - name: inception_resnet_v2_2018_04_27.tgz size: 225882079 - sha256: fb16b93ff2b2bcda0da5cdfd25a8d5b8b74438943dae738db659bad0d3d48ff1 + sha384: 865828b072abc3b5e9d55d7949d39f8df59453f4673de0745182ea5c2489b1901f74e9288863052a2d4249a814952b07 source: https://storage.googleapis.com/download.tensorflow.org/models/tflite/model_zoo/upload_20180427/inception_resnet_v2_2018_04_27.tgz postprocessing: - $type: unpack_archive diff --git a/models/public/index.md b/models/public/index.md index 22a63dbcbfc..585d7909643 100644 --- a/models/public/index.md +++ b/models/public/index.md @@ -156,8 +156,8 @@ SSD-based and provide reasonable accuracy/performance trade-offs. | YOLO v1 Tiny | TensorFlow.js\* | [yolo-v1-tiny-tf](./yolo-v1-tiny-tf/README.md) | 54.79% | 6.9883 | 15.8587 | | YOLO v2 Tiny | Keras\* | [yolo-v2-tiny-tf](./yolo-v2-tiny-tf/README.md) | 27.3443%/29.1184%| 5.4236 | 11.2295 | | YOLO v2 | Keras\* | [yolo-v2-tf](./yolo-v2-tf/README.md) | 53.1453%/56.483% | 63.0301 | 50.9526 | -| YOLO v3 | Keras\* | [yolo-v3-tf](./yolo-v3-tf/README.md) | 62.2759%/67.7221% | 65.9843 | 61.9221 | -| YOLO v3 Tiny | Keras\* | [yolo-v3-tiny-tf](./yolo-v3-tiny-tf/README.md) | 35.9%/39.7% | 5.582 | 8.848 | +| YOLO v3 | Keras\*
ONNX\* | [yolo-v3-tf](./yolo-v3-tf/README.md)
[yolo-v3-onnx](./yolo-v3-onnx/README.md) | 62.2759%/67.7221%
48.30%/47.07%| 65.9843~65.998 | 61.9221~61.930 | +| YOLO v3 Tiny | Keras\*
ONNX\* | [yolo-v3-tiny-tf](./yolo-v3-tiny-tf/README.md)
[yolo-v3-tiny-onnx](./yolo-v3-tiny-onnx/README.md) | 35.9%/39.7%
17.07%/13.64%| 5.582 | 8.848~8.8509 | | YOLO v4 | Keras\* | [yolo-v4-tf](./yolo-v4-tf/README.md) | 71.23%/77.40%/50.26% | 129.5567 | 64.33 | | YOLO v4 Tiny | Keras\* | [yolo-v4-tiny-tf](./yolo-v4-tiny-tf/README.md) | | 6.9289 | 6.0535 | | YOLOF | PyTorch\* | [yolof](./yolof/README.md) | 60.69%/66.23%/43.63% | 175.37942 | 48.228 | @@ -284,6 +284,14 @@ The task of image deblurring. | -------------- | -------------- | ---------------------------------------------- | -------- | ------- | -------- | | DeblurGAN-v2 | PyTorch\* | [deblurgan-v2](./deblurgan-v2/README.md) | 28.25Db | 80.8919 | 2.1083 | +## JPEG artifacts removal + +The task of restoration images from jpeg format. + +| Model Name | Implementation | OMZ Model Name | Accuracy | GFlops | mParams | +| -------------- | -------------- | ---------------------------------------------- | -------- | ---------- | -------- | +| FBCNN | PyTorch\* | [fbcnn](./fbcnn/README.md) | 34.34Db | 1420.78235 | 71.922 | + ## Salient object detection Salient object detection is a task-based on a visual attention mechanism, diff --git a/models/public/license-plate-recognition-barrier-0007/model.yml b/models/public/license-plate-recognition-barrier-0007/model.yml index 89d5d991f77..dc8b50680cf 100644 --- a/models/public/license-plate-recognition-barrier-0007/model.yml +++ b/models/public/license-plate-recognition-barrier-0007/model.yml @@ -19,7 +19,7 @@ task_type: optical_character_recognition files: - name: license-plate-recognition-barrier-0007.tar.gz size: 20821887 - sha256: 6c0b8651f0eead6de43e07491fd41809a4a7da141f1b5002dfd8dd207bdb1018 + sha384: cc57198a711592c865333bc6b86402a9b225e6e83470415b71ff8f91d6fe3e1c24e0ccc7f7758b4fdbd48fef3e0a0bcc source: https://download.01.org/openvinotoolkit/training_toolbox_tensorflow/models/lpr/chinese_lp/license-plate-recognition-barrier-0007.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/mask_rcnn_inception_resnet_v2_atrous_coco/model.yml b/models/public/mask_rcnn_inception_resnet_v2_atrous_coco/model.yml index 66b8e606199..1efbb8083ff 100644 --- a/models/public/mask_rcnn_inception_resnet_v2_atrous_coco/model.yml +++ b/models/public/mask_rcnn_inception_resnet_v2_atrous_coco/model.yml @@ -20,7 +20,7 @@ task_type: instance_segmentation files: - name: mask_rcnn_inception_resnet_v2_atrous_coco_2018_01_28.tar.gz size: 727390102 - sha256: 816afc8987c2152cbd0e24af3a6fb82086cea0645a38778884bd166c0d016bb5 + sha384: fe7871a3b291e30b299b859ffddc2b73f25890c259aedcd5bde6fb6dd6b5507a24e7d370365e3bdd3497f1786a0f4d36 source: http://download.tensorflow.org/models/object_detection/mask_rcnn_inception_resnet_v2_atrous_coco_2018_01_28.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/mask_rcnn_inception_v2_coco/model.yml b/models/public/mask_rcnn_inception_v2_coco/model.yml index ba455745d5b..4c8e9846a20 100644 --- a/models/public/mask_rcnn_inception_v2_coco/model.yml +++ b/models/public/mask_rcnn_inception_v2_coco/model.yml @@ -20,7 +20,7 @@ task_type: instance_segmentation files: - name: mask_rcnn_inception_v2_coco_2018_01_28.tar.gz size: 177817887 - sha256: 4f57861c2ff1c87e92495789ee266e41a7dc79a038521d93a153be403b0b601f + sha384: 37702fbafdb4fcf37df60c9dde834dd2bb602cbe11e87b7bd83a0a1cabc23035703bddf086e42dc32866102d06b7f13d source: http://download.tensorflow.org/models/object_detection/mask_rcnn_inception_v2_coco_2018_01_28.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/mask_rcnn_resnet101_atrous_coco/model.yml b/models/public/mask_rcnn_resnet101_atrous_coco/model.yml index 047d535d15a..b4d10c8d24a 100644 --- a/models/public/mask_rcnn_resnet101_atrous_coco/model.yml +++ b/models/public/mask_rcnn_resnet101_atrous_coco/model.yml @@ -19,7 +19,7 @@ task_type: instance_segmentation files: - name: mask_rcnn_resnet101_atrous_coco_2018_01_28.tar.gz size: 661899639 - sha256: 67ac8d5f0974753e9a5b04d36376e20b3be55b5dcd6ce43bc25aed6c5583709d + sha384: f8124e219d2a7bb92a8d8227ac23f2555cf1fc5f4fa268e6d16c8409b436e6dd97ee78bfcc137c723f43638b7c6efc18 source: http://download.tensorflow.org/models/object_detection/mask_rcnn_resnet101_atrous_coco_2018_01_28.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/mask_rcnn_resnet50_atrous_coco/model.yml b/models/public/mask_rcnn_resnet50_atrous_coco/model.yml index 8ee45472d35..6a796378292 100644 --- a/models/public/mask_rcnn_resnet50_atrous_coco/model.yml +++ b/models/public/mask_rcnn_resnet50_atrous_coco/model.yml @@ -20,7 +20,7 @@ task_type: instance_segmentation files: - name: mask_rcnn_resnet50_atrous_coco_2018_01_28.tar.gz size: 449505463 - sha256: f3741f099bdb414e172cc8cc41370213a41afd04d7aa970f7854f09a75172481 + sha384: a61ae308c03f9b9554851f5d564b3cc09659a2d8d2a4dd2f4e57be92669fe4bdc9c505839eaa075b44926466e4073299 source: http://download.tensorflow.org/models/object_detection/mask_rcnn_resnet50_atrous_coco_2018_01_28.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/midasnet/model.yml b/models/public/midasnet/model.yml index 134ccc8cede..4a959cec476 100644 --- a/models/public/midasnet/model.yml +++ b/models/public/midasnet/model.yml @@ -26,19 +26,19 @@ task_type: monocular_depth_estimation files: - name: models/midas_net.py size: 2662 - sha256: 0bf2e5295b69b3af9adafaf97e154186d29a808325435440aa68c7aa4d25f753 + sha384: ad8d94e07cfb60e463f383057763a0faa29e7547fe3b4482c787a5948050f37f0878c6f307d455f6759928237e43b78c source: https://raw.githubusercontent.com/intel-isl/MiDaS/ffb70fd13361434114383ce7eb898c2f5bec6176/models/midas_net.py - name: models/base_model.py size: 355 - sha256: a05c91a037f85ebc07f39b269f0784df577c25fb46f84b27b5fcbbd1e44236ff + sha384: cf959343ae280093bb38eb225f4d3b1de791ef7e245c35f02315bd984065379e7a29b5830010aad34d3ac38ca77bfa04 source: https://raw.githubusercontent.com/intel-isl/MiDaS/ffb70fd13361434114383ce7eb898c2f5bec6176/models/base_model.py - name: models/blocks.py size: 3596 - sha256: ba87812d0b5b247966471511d2d1a47fd6f492afb372bc49af6de3a46f4cf6c7 + sha384: 3bca3aadb2e7fc5990e4d909740e2c8c6cbedd326fc49ea858e06ebe97269d6410d2f28e0cec3ca2b5b466928c84fa2e source: https://raw.githubusercontent.com/intel-isl/MiDaS/ffb70fd13361434114383ce7eb898c2f5bec6176/models/blocks.py - name: model.pt size: 422509849 - sha256: 933c46ec14e4041122852d8d0acf822ff9f4b94fd07f0ff42fa593f135d57cab + sha384: 22219f664a4b235e797585d56a398c25e7cbb3cdb46f61bdc0e0596dc713495ece860ac57df8b22f7b530ea00c21b049 source: https://github.com/intel-isl/MiDaS/releases/download/v2_1/model-openvino.pt framework: pytorch postprocessing: diff --git a/models/public/mixnet-l/model.yml b/models/public/mixnet-l/model.yml index c4aa4850171..7fe2a37f988 100644 --- a/models/public/mixnet-l/model.yml +++ b/models/public/mixnet-l/model.yml @@ -26,7 +26,7 @@ task_type: classification files: - name: mixnet-l.tar.gz size: 54302843 - sha256: feb487ed76e46c4a19604172b4227a84db6bfd9449b022e310606525b2bb221f + sha384: 6207ab87851c7e2c8f3dafe716a596b2f52dd88c6c5db0d51795e312f3cad62c715a35c1f03311084f43566660ac691b source: https://storage.googleapis.com/cloud-tpu-checkpoints/mixnet/mixnet-l.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/mobilefacedet-v1-mxnet/model.yml b/models/public/mobilefacedet-v1-mxnet/model.yml index c010f360711..18f69279fed 100644 --- a/models/public/mobilefacedet-v1-mxnet/model.yml +++ b/models/public/mobilefacedet-v1-mxnet/model.yml @@ -20,11 +20,11 @@ task_type: detection files: - name: mobilefacedet_v1_mxnet-symbol.json size: 143406 - sha256: ad7aa5dcc6aa7d21aa34564dc6245e378957ec85088614b6bb8e2e2560067a60 + sha384: 010114c232811b4d79cad6535ce0688a412950cc0f65788b212487ec125f8657e2aeccc51245cbcee994ed09deea4d1e source: https://raw.githubusercontent.com/becauseofAI/MobileFace/128cea33b928dc9bb6d1963202b57a97f5661ccf/MobileFace_Detection/model/mobilefacedet_v1_mxnet-symbol.json - name: mobilefacedet_v1_mxnet-0000.params size: 31229887 - sha256: 8cd238beec821ea8a11a6de4a5c4816b209add37c7d8fe77f4a349943dba75b8 + sha384: 729fd402458eb997c47b1f1fdada9c3f056bfc146df5be147854bd6241fc3c99980a162297633fd8eef2a43db76e64dd source: https://raw.githubusercontent.com/becauseofAI/MobileFace/128cea33b928dc9bb6d1963202b57a97f5661ccf/MobileFace_Detection/model/mobilefacedet_v1_mxnet-0000.params model_optimizer_args: - --input_shape=[1,256,256,3] diff --git a/models/public/mobilenet-ssd/model.yml b/models/public/mobilenet-ssd/model.yml index 12c17af85c0..7cb002a52e3 100644 --- a/models/public/mobilenet-ssd/model.yml +++ b/models/public/mobilenet-ssd/model.yml @@ -28,14 +28,12 @@ task_type: detection files: - name: mobilenet-ssd.prototxt size: 29353 - sha256: e781559c4f5beaec2a486ccd952af5b6fa408e9498761bf5f4fb80b4e9f0d25e + sha384: 71b465ac516f06b713807b850febe933547b741be15b3382723e7d4503a4d135ce8b13376d66b3bb1e4793cdd3338742 source: https://raw.githubusercontent.com/chuanqi305/MobileNet-SSD/ba00fc987b3eb0ba87bb99e89bf0298a2fd10765/MobileNetSSD_deploy.prototxt - name: mobilenet-ssd.caffemodel size: 23147564 - sha256: 761c86fbae3d8361dd454f7c740a964f62975ed32f4324b8b85994edec30f6af - source: - $type: google_drive - id: 0B3gersZ2cHIxRm5PMWRoTkdHdHc + sha384: 21726b46b567b1d81241d8378305cf32185e03e0fc71c36ca85ccf34ad76f0ec7688494172a9e39139cd04fde50643af + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/mobilenet-ssd/MobileNetSSD_deploy.caffemodel model_optimizer_args: - --input_shape=[1,3,300,300] - --input=data diff --git a/models/public/mobilenet-v1-0.25-128/README.md b/models/public/mobilenet-v1-0.25-128/README.md index 0f8a3b7eaf2..bb736f9d9a7 100644 --- a/models/public/mobilenet-v1-0.25-128/README.md +++ b/models/public/mobilenet-v1-0.25-128/README.md @@ -49,11 +49,11 @@ Expected color order: `BGR`. ### Original Model -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. Name: `MobilenetV1/Predictions/Reshape_1`. +Probabilities for all dataset classes in [0, 1] range (0 class is background). Name: `MobilenetV1/Predictions/Reshape_1`. ### Converted Model -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. Name: `MobilenetV1/Predictions/Softmax`, shape: `1, 1001`, format: `B, C`, where: +Probabilities for all dataset classes in [0, 1] range (0 class is background). Name: `MobilenetV1/Predictions/Softmax`, shape: `1, 1001`, format: `B, C`, where: - `B` - batch size - `C` - vector of probabilities. diff --git a/models/public/mobilenet-v1-0.25-128/model.yml b/models/public/mobilenet-v1-0.25-128/model.yml index 85453198b4d..4468747f364 100644 --- a/models/public/mobilenet-v1-0.25-128/model.yml +++ b/models/public/mobilenet-v1-0.25-128/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: mobilenet_v1_0.25_128.tgz size: 10800019 - sha256: 879ddc3e0857f3611b5cf248e36de2288c7a11ea8c2ed8a8bdded635e6010dfe + sha384: 274f37d5b52f2291d78e438a9d780b19a8f379a1bb83d649c27780ce38e33365ca331405b06f103edc1852e214235169 source: http://download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_0.25_128.tgz postprocessing: - $type: unpack_archive diff --git a/models/public/mobilenet-v1-0.50-160/README.md b/models/public/mobilenet-v1-0.50-160/README.md index cba39f734ea..97ad8be8baa 100644 --- a/models/public/mobilenet-v1-0.50-160/README.md +++ b/models/public/mobilenet-v1-0.50-160/README.md @@ -49,11 +49,11 @@ Expected color order: `BGR`. ### Original Model -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. Name: `MobilenetV1/Predictions/Reshape_1`. +Probabilities for all dataset classes in [0, 1] range (0 class is background). Name: `MobilenetV1/Predictions/Reshape_1`. ### Converted Model -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. Name: `MobilenetV1/Predictions/Softmax`, shape: `1, 1001`, format: `B, C`, where: +Probabilities for all dataset classes in [0, 1] range (0 class is background). Name: `MobilenetV1/Predictions/Softmax`, shape: `1, 1001`, format: `B, C`, where: - `B` - batch size - `C` - vector of probabilities. diff --git a/models/public/mobilenet-v1-0.50-160/model.yml b/models/public/mobilenet-v1-0.50-160/model.yml index c5b5c1d5817..3802b1e1492 100644 --- a/models/public/mobilenet-v1-0.50-160/model.yml +++ b/models/public/mobilenet-v1-0.50-160/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: mobilenet_v1_0.5_160.tgz size: 29958343 - sha256: 6bbc9dd7892433e49b4b6ff6af2952183eaa6c1c0cb862868465377a29c77b0d + sha384: 7023a17e0f7dd48ffb3607ef1d7712702b1eb110d1a2c14f80bdf41b08148a07f9521a22250b5ef214b59a0bf62ef88b source: http://download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_0.5_160.tgz postprocessing: - $type: unpack_archive diff --git a/models/public/mobilenet-v1-0.50-224/README.md b/models/public/mobilenet-v1-0.50-224/README.md index 99910cb6c4a..d8750269a41 100644 --- a/models/public/mobilenet-v1-0.50-224/README.md +++ b/models/public/mobilenet-v1-0.50-224/README.md @@ -49,11 +49,11 @@ Expected color order: `BGR`. ### Original Model -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. Name: `MobilenetV1/Predictions/Reshape_1`. +Probabilities for all dataset classes in [0, 1] range (0 class is background). Name: `MobilenetV1/Predictions/Reshape_1`. ### Converted Model -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. Name: `MobilenetV1/Predictions/Softmax`, shape: `1, 1001`, format: `B, C`, where: +Probabilities for all dataset classes in [0, 1] range (0 class is background). Name: `MobilenetV1/Predictions/Softmax`, shape: `1, 1001`, format: `B, C`, where: - `B` - batch size - `C` - vector of probabilities. diff --git a/models/public/mobilenet-v1-0.50-224/model.yml b/models/public/mobilenet-v1-0.50-224/model.yml index 562b12cb9d3..a0cd08d806d 100644 --- a/models/public/mobilenet-v1-0.50-224/model.yml +++ b/models/public/mobilenet-v1-0.50-224/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: mobilenet_v1_0.5_224.tgz size: 29969407 - sha256: 98cf7a39552f73920cb99617cfa9b88d5732a87abf9ec14f7cc7f3ade1db0aaa + sha384: 643989e61ae03d2e956a4bc222082534c44ac1bcce06450aafd5d30537dc5080fcf2f1d16a9ebbcbc613122e55759673 source: http://download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_0.5_224.tgz postprocessing: - $type: unpack_archive diff --git a/models/public/mobilenet-v1-1.0-224-tf/README.md b/models/public/mobilenet-v1-1.0-224-tf/README.md index 1458bff3a07..b49007cb008 100644 --- a/models/public/mobilenet-v1-1.0-224-tf/README.md +++ b/models/public/mobilenet-v1-1.0-224-tf/README.md @@ -49,11 +49,11 @@ Expected color order: `BGR`. ### Original Model -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. Name: `MobilenetV1/Predictions/Reshape_1`. +Probabilities for all dataset classes in [0, 1] range (0 class is background). Name: `MobilenetV1/Predictions/Reshape_1`. ### Converted Model -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. Name: `MobilenetV1/Predictions/Softmax`, shape: `1, 1001`, format: `B, C`, where: +Probabilities for all dataset classes in [0, 1] range (0 class is background). Name: `MobilenetV1/Predictions/Softmax`, shape: `1, 1001`, format: `B, C`, where: - `B` - batch size - `C` - vector of probabilities. diff --git a/models/public/mobilenet-v1-1.0-224-tf/model.yml b/models/public/mobilenet-v1-1.0-224-tf/model.yml index 1e54c1234e2..e3ca6b8c212 100644 --- a/models/public/mobilenet-v1-1.0-224-tf/model.yml +++ b/models/public/mobilenet-v1-1.0-224-tf/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: mobilenet_v1_1.0_224.tgz size: 94321559 - sha256: 2fadeabb9968ec6833bee903900dda6e61b3947200535874ce2fe42a8493abc0 + sha384: 20383a8a25a1f2dc0e9b72176a5cc93f662fd513be6e7153061045a635e88dbfe7e6b72880f60a1dfbec7cdd57f91641 source: http://download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224.tgz postprocessing: - $type: unpack_archive diff --git a/models/public/mobilenet-v1-1.0-224/model.yml b/models/public/mobilenet-v1-1.0-224/model.yml index 9aba17a0efa..1e92e930b21 100644 --- a/models/public/mobilenet-v1-1.0-224/model.yml +++ b/models/public/mobilenet-v1-1.0-224/model.yml @@ -22,11 +22,11 @@ task_type: classification files: - name: mobilenet-v1-1.0-224.prototxt size: 28105 - sha256: 8e6a26b8f2c7cf7a066d571660cfd8a1544a5a25399df33ad499f3d733f16729 + sha384: 06dab8ee44af147320578ee54217e5d428b0525df8efd8d9ffb133e16822e274e1a8e257e3894a9ad23659ce56556b46 source: https://raw.githubusercontent.com/shicai/MobileNet-Caffe/26a8b8c0afb6114a07c1c9e4f550e4e0dd8cced1/mobilenet_deploy.prototxt - name: mobilenet-v1-1.0-224.caffemodel size: 17027058 - sha256: 8d6edcd3dbd1356f2f19dd220c362c2ba8f44233a9b6c12ca6d0351cb0c446b6 + sha384: 9a7b8bed738806e9e5a330410b301f5ce105e0a51c260499f07c6740eb6fe343cdc815673f4f62f60305a72fe1a194d1 source: https://github.com/shicai/MobileNet-Caffe/raw/26a8b8c0afb6114a07c1c9e4f550e4e0dd8cced1/mobilenet.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] diff --git a/models/public/mobilenet-v2-1.0-224/README.md b/models/public/mobilenet-v2-1.0-224/README.md index 917d87190b3..df2fb3698fa 100644 --- a/models/public/mobilenet-v2-1.0-224/README.md +++ b/models/public/mobilenet-v2-1.0-224/README.md @@ -50,12 +50,12 @@ Expected color order: `BGR`. ### Original Model Name: `MobilenetV2/Predictions/Reshape_1`. -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. +Probabilities for all dataset classes in [0, 1] range (0 class is background). ### Converted Model Name: `MobilenetV2/Predictions/Softmax`. -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. +Probabilities for all dataset classes in [0, 1] range (0 class is background). Shape: `1, 1001`, format: `B, C`, where: - `B` - batch size diff --git a/models/public/mobilenet-v2-1.0-224/model.yml b/models/public/mobilenet-v2-1.0-224/model.yml index 1f3e1690bfb..9da4150c1cb 100644 --- a/models/public/mobilenet-v2-1.0-224/model.yml +++ b/models/public/mobilenet-v2-1.0-224/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: mobilenet_v2_1.0_224.tgz size: 78306834 - sha256: 318084bc1b63d6d7b854553e09cdf77078b1c0168be27c59a0d44253b5ed49dc + sha384: 061da971be19c9fa185be494c7cd567ac8798bd14847f80c83afd9f4ffb2096343b4f5911fa227fe659c8d6684478822 source: https://storage.googleapis.com/mobilenet_v2/checkpoints/mobilenet_v2_1.0_224.tgz postprocessing: - $type: unpack_archive diff --git a/models/public/mobilenet-v2-1.4-224/README.md b/models/public/mobilenet-v2-1.4-224/README.md index ede8fba1c8d..f4a0d8d01b5 100644 --- a/models/public/mobilenet-v2-1.4-224/README.md +++ b/models/public/mobilenet-v2-1.4-224/README.md @@ -49,11 +49,11 @@ Expected color order: `BGR`. ### Original Model -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. Name: `MobilenetV1/Predictions/Reshape_1`. +Probabilities for all dataset classes in [0, 1] range (0 class is background).Name: `MobilenetV1/Predictions/Reshape_1`. ### Converted Model -Probabilities for all dataset classes (0 class is background). Probabilities are represented in logits format. Name: `MobilenetV1/Predictions/Softmax`, shape: `1, 1001`, format: `B, C`, where: +Probabilities for all dataset classes in [0, 1] range (0 class is background). Name: `MobilenetV1/Predictions/Softmax`, shape: `1, 1001`, format: `B, C`, where: - `B` - batch size - `C` - vector of probabilities. diff --git a/models/public/mobilenet-v2-1.4-224/model.yml b/models/public/mobilenet-v2-1.4-224/model.yml index a846563388f..d58d6c83991 100644 --- a/models/public/mobilenet-v2-1.4-224/model.yml +++ b/models/public/mobilenet-v2-1.4-224/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: mobilenet-v2-1.4-224.tar.gz size: 135977516 - sha256: a20d0c8d698502dc6a620528871c97a588885df7737556243a3412b39fce85e0 + sha384: fd257f73e8ee5280328903afa6bbd646dcf4e8ae7c090e3424cf05d973c0940fe02ee220a3a5a20ea51cb9caacbf4961 source: https://storage.googleapis.com/mobilenet_v2/checkpoints/mobilenet_v2_1.4_224.tgz postprocessing: - $type: unpack_archive diff --git a/models/public/mobilenet-v2-pytorch/README.md b/models/public/mobilenet-v2-pytorch/README.md index 92f312c7f21..5dc5daaf4f4 100644 --- a/models/public/mobilenet-v2-pytorch/README.md +++ b/models/public/mobilenet-v2-pytorch/README.md @@ -61,14 +61,14 @@ Channel order is `BGR` Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/mobilenet-v2-pytorch/model.yml b/models/public/mobilenet-v2-pytorch/model.yml index a8165acdcd8..2e8d93b0ecf 100644 --- a/models/public/mobilenet-v2-pytorch/model.yml +++ b/models/public/mobilenet-v2-pytorch/model.yml @@ -27,7 +27,7 @@ task_type: classification files: - name: mobilenet_v2-b0353104.pth size: 14212972 - sha256: b03531047ffacf1e2488318dcd2aba1126cde36e3bfe1aa5cb07700aeeee9889 + sha384: ca1be3e2eb8015c2876bfa6da5f35c9db9e2167281f972adfef6de332688d11ebe649f646e88f7410d8694e554a27613 source: https://download.pytorch.org/models/mobilenet_v2-b0353104.pth framework: pytorch conversion_to_onnx_args: diff --git a/models/public/mobilenet-v2/README.md b/models/public/mobilenet-v2/README.md index 1a06ddc34d4..ef098153fc9 100644 --- a/models/public/mobilenet-v2/README.md +++ b/models/public/mobilenet-v2/README.md @@ -2,7 +2,7 @@ ## Use Case and High-Level Description -[MobileNet V2](https://arxiv.org/abs/1801.04381) +[MobileNet V2](https://arxiv.org/abs/1801.04381) is image classification model. ## Specification diff --git a/models/public/mobilenet-v2/model.yml b/models/public/mobilenet-v2/model.yml index a6b3ccc9dbe..ca3e318842b 100644 --- a/models/public/mobilenet-v2/model.yml +++ b/models/public/mobilenet-v2/model.yml @@ -18,11 +18,11 @@ task_type: classification files: - name: mobilenet-v2.prototxt size: 51551 - sha256: 06a0820a5edc6d2c24e83e0b95824d0dae464ced3d5db82f51e461098a03b887 + sha384: 62accf1c3389d496848ffac2fa0544f5c1311dcf5e16dba596ed517fb8e2175055f77100e64cb08314df2750e2461041 source: https://raw.githubusercontent.com/shicai/MobileNet-Caffe/26a8b8c0afb6114a07c1c9e4f550e4e0dd8cced1/mobilenet_v2_deploy.prototxt - name: mobilenet-v2.caffemodel size: 14186496 - sha256: a3124ce7abd258c7f35a2c586576bee8116934fa2a8556e4e528041859dd753f + sha384: da548763d0f93c8c0ac2187ae23c217038afb5ede540e4bc1853e9c806c2b5be16b8b5fadca292976c104e3e21ea00ba source: https://github.com/shicai/MobileNet-Caffe/raw/26a8b8c0afb6114a07c1c9e4f550e4e0dd8cced1/mobilenet_v2.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] diff --git a/models/public/mobilenet-v3-large-1.0-224-tf/model.yml b/models/public/mobilenet-v3-large-1.0-224-tf/model.yml index 30fcc5eee8e..f80fb4050cd 100644 --- a/models/public/mobilenet-v3-large-1.0-224-tf/model.yml +++ b/models/public/mobilenet-v3-large-1.0-224-tf/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: weights_mobilenet_v3_large_224_1.0_float.h5 size: 22661472 - sha256: 9bd517bb07585a1c9ae70654e21b8384827e9aa9cbd1ca47721eb0f3d0fad33c + sha384: 4e7e0ecab69b15ecde1e3f4c494826cece07169bdc14d7da29eb07bef718c32f532d952d0b3113ffaca95c2d6d9577b5 source: https://storage.googleapis.com/tensorflow/keras-applications/mobilenet_v3/weights_mobilenet_v3_large_224_1.0_float.h5 model_optimizer_args: - --reverse_input_channels diff --git a/models/public/mobilenet-v3-small-1.0-224-tf/model.yml b/models/public/mobilenet-v3-small-1.0-224-tf/model.yml index e102bc26490..ee73d38b9c6 100644 --- a/models/public/mobilenet-v3-small-1.0-224-tf/model.yml +++ b/models/public/mobilenet-v3-small-1.0-224-tf/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: weights_mobilenet_v3_small_224_1.0_float.h5 size: 10734624 - sha256: bb828f93ae32afb89c2df190a39c06deaa63ea1d95fec93bceb52264f5bf61e8 + sha384: d342c446ceecbcf76edf94f7a51bb94d26296fea8d91e0b28287143eff569118c98a950df3258f37a94c06f0adc4d31b source: https://storage.googleapis.com/tensorflow/keras-applications/mobilenet_v3/weights_mobilenet_v3_small_224_1.0_float.h5 model_optimizer_args: - --reverse_input_channels diff --git a/models/public/mobilenet-yolo-v4-syg/model.yml b/models/public/mobilenet-yolo-v4-syg/model.yml index 7110cff297f..0bb7923d3ff 100644 --- a/models/public/mobilenet-yolo-v4-syg/model.yml +++ b/models/public/mobilenet-yolo-v4-syg/model.yml @@ -21,11 +21,11 @@ task_type: detection files: - name: mobilenet-yolo-v4-syg.pb size: 42004202 - sha256: 47bd93b04b2dd1e29b985bbc9fc6f126342c8e8e140102b875946a3463528569 + sha384: 8f931bc5bc0adcfaaaa2ddbad8c13838725fe61bfef24ff5ff23ad9268b392c40b3ecb2bbe736152060c7014ced80e6b source: https://github.com/legendary111/mobilenet-yolo-v4-syg/releases/download/files/mobilenet-yolo-v4-syg.pb - name: yolo_pb2ir.json size: 414 - sha256: 0014370f7236a59cacdbc74bfea83327e0e99f1811f97a1ff6e2b9c70ce67618 + sha384: 2c5236e29566a0d198e972630941840a98f2fcedce6d39b05dc61980166c29a7da9b55883c5dc8b568d682529c18430f source: https://github.com/legendary111/mobilenet-yolo-syg/releases/download/mobilenet-yolo-v4-syg/yolo_pb2ir.json model_optimizer_args: - --input_model=$dl_dir/mobilenet-yolo-v4-syg.pb diff --git a/models/public/mozilla-deepspeech-0.6.1/model.yml b/models/public/mozilla-deepspeech-0.6.1/model.yml index 90d40549931..bb9d936025b 100644 --- a/models/public/mozilla-deepspeech-0.6.1/model.yml +++ b/models/public/mozilla-deepspeech-0.6.1/model.yml @@ -24,7 +24,7 @@ task_type: speech_recognition files: - name: deepspeech-0.6.1-models.tar.gz size: 1229020343 - sha256: 5d51fb06c531511b8a86b2d738262647d48fe008364f9936b2e52732e323892a + sha384: ad9ceb672c21ccb93f6c16432c172d1d08e403a9925a9466552538de9642878af7c459c863bbe721483f644385c5677d source: https://github.com/mozilla/DeepSpeech/releases/download/v0.6.1/deepspeech-0.6.1-models.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/mozilla-deepspeech-0.8.2/model.yml b/models/public/mozilla-deepspeech-0.8.2/model.yml index d0d753abecd..445c3e2c3e0 100644 --- a/models/public/mozilla-deepspeech-0.8.2/model.yml +++ b/models/public/mozilla-deepspeech-0.8.2/model.yml @@ -24,11 +24,11 @@ task_type: speech_recognition files: - name: deepspeech-0.8.2-models.pbmm size: 188915984 - sha256: f1ad4347b276b7f0f35bc47954feb7240fad913f3a1b85605628ab6d6209b0c9 + sha384: 5ab0759fcace311c36c5322321463ad171458102230df4db83435c1c337f3c7deeba1344057cc9d158e23dd42268b298 source: https://github.com/mozilla/DeepSpeech/releases/download/v0.8.2/deepspeech-0.8.2-models.pbmm - name: deepspeech-0.8.2-models.scorer size: 953363776 - sha256: d0cf926ab9cab54a8a7d70003b931b2d62ebd9105ed392d1ec9c840029867799 + sha384: 2694ef52d092ab7ddf9f913a8cf2f6b958a0ae38790080a37eb3be3453961ecc96d225095d3ae505e22dd6ba41fd27d5 source: https://github.com/mozilla/DeepSpeech/releases/download/v0.8.2/deepspeech-0.8.2-models.scorer model_optimizer_args: - --input_model=$conv_dir/deepspeech-0.8.2-models.pb diff --git a/models/public/mtcnn/mtcnn-o/model.yml b/models/public/mtcnn/mtcnn-o/model.yml index 9ecee64c7d3..f71c674b1a5 100644 --- a/models/public/mtcnn/mtcnn-o/model.yml +++ b/models/public/mtcnn/mtcnn-o/model.yml @@ -31,11 +31,11 @@ task_type: detection files: - name: mtcnn-o.prototxt size: 3931 - sha256: a8385a3aad241acf5902b79466f9a359ea9f03a3b6dcbe1e1efa050908cf7d04 + sha384: 403ad213827dfb0b6201ae3de7cc160be2f4d6ca59de0dbad7147d2cca1077f26ae38ba239bc8a2023cffbb0b90925b7 source: https://raw.githubusercontent.com/DuinoDu/mtcnn/db5bd8f02023f8d37913140fd2bf2749c2dbf266/model/det3.prototxt - name: mtcnn-o.caffemodel size: 1558412 - sha256: 9d6098829a4d6d318f37cec42142465637fafe4c673f2e93b69495bf7ca23d2d + sha384: 77bb0c7ec10017793e903e73a70b33b3f9e9bb36569c39e87eec0b8ac7ff58ec7a4ed813822467dceb8549cb1e3c03e0 source: https://github.com/DuinoDu/mtcnn/raw/db5bd8f02023f8d37913140fd2bf2749c2dbf266/model/det3.caffemodel model_optimizer_args: - --input_shape=[1,3,48,48] diff --git a/models/public/mtcnn/mtcnn-p/model.yml b/models/public/mtcnn/mtcnn-p/model.yml index e43ed81b899..d77bcdd73c4 100644 --- a/models/public/mtcnn/mtcnn-p/model.yml +++ b/models/public/mtcnn/mtcnn-p/model.yml @@ -31,11 +31,11 @@ task_type: detection files: - name: mtcnn-p.prototxt size: 2353 - sha256: adc1756d8515d3ca3a6a186c0fadab66fcae04bd8d3c6388e2fe8797a626dde4 + sha384: 372af5af8ba5c1820b587b64670ef957e40c5118f7775381d46e4eb88ec8f9cadb7abdeadfa3863459e17bf7b87318fd source: https://raw.githubusercontent.com/DuinoDu/mtcnn/db5bd8f02023f8d37913140fd2bf2749c2dbf266/model/det1.prototxt - name: mtcnn-p.caffemodel size: 28163 - sha256: d6085e7f48ba7e6b6f1b58964595f6bce5b97bcc4866751f7b4bdc98f920c096 + sha384: abf640a47ec5b87724564741121a235581dd15f3782cf0b9380acfa45ef665974b97d8e8122114a66d9973696ae3b35e source: https://github.com/DuinoDu/mtcnn/raw/db5bd8f02023f8d37913140fd2bf2749c2dbf266/model/det1.caffemodel postprocessing: - $type: regex_replace diff --git a/models/public/mtcnn/mtcnn-r/model.yml b/models/public/mtcnn/mtcnn-r/model.yml index d4d5ff4bced..ed2c57588aa 100644 --- a/models/public/mtcnn/mtcnn-r/model.yml +++ b/models/public/mtcnn/mtcnn-r/model.yml @@ -32,11 +32,11 @@ task_type: detection files: - name: mtcnn-r.prototxt size: 3159 - sha256: 077686e89e606354f425366afdb2018777d93c6450b50e2c12301f8a97f6bb47 + sha384: c75ed855e1129678d3947455ebf78c4ffa8f8757dac72eda0987650bb7c447b3a8462d797b7916f45b847d9d37040d26 source: https://raw.githubusercontent.com/DuinoDu/mtcnn/db5bd8f02023f8d37913140fd2bf2749c2dbf266/model/det2.prototxt - name: mtcnn-r.caffemodel size: 407910 - sha256: 39b20f7a57bb8176cc9466cea4dfd52da6a6f876de60c7ab222a309f2d0ca08c + sha384: 87b9a7262724688cb5825e2584b623110b1df2e44308abe5be1800cbcd7a37940e44547466cd016ce9141733b62fbd8f source: https://github.com/DuinoDu/mtcnn/raw/db5bd8f02023f8d37913140fd2bf2749c2dbf266/model/det2.caffemodel model_optimizer_args: - --input_shape=[1,3,24,24] diff --git a/models/public/netvlad-tf/model.yml b/models/public/netvlad-tf/model.yml index 52730e12ad0..7f52787d022 100644 --- a/models/public/netvlad-tf/model.yml +++ b/models/public/netvlad-tf/model.yml @@ -25,15 +25,15 @@ task_type: place_recognition files: - name: netvlad.zip size: 1108966217 - sha256: a6849eb7e2f9236c8ba87b89c1cf6ce97142296ce71683d8fc843f0569c022ea + sha384: 2aacb2110402ee5c2c1dd5ccfdade0ca3da8df94d1f5eb5441d929beb031877909a399cb7268fef95fd1a8f251ccbd85 source: http://rpg.ifi.uzh.ch/datasets/netvlad/vd16_pitts30k_conv5_3_vlad_preL2_intra_white.zip - name: netvlad_tf/layers.py size: 1492 - sha256: 701fd91892d3ca71316504c088c33c47e7bcd6a091f3157171ed3a0caf1f07b2 + sha384: 0cc24ff1de4a28c5d0c93da0958043145583d2ff9dc2e0209cf405d8d033dc95ad2caa071a2b1e0e1461946480ef31ab source: https://github.com/uzh-rpg/netvlad_tf_open/raw/abe37fe9d656bf781cff32caf738efca525b7889/python/netvlad_tf/layers.py - name: netvlad_tf/nets.py size: 2613 - sha256: c3baa73bd57ac2e83cd24ab8332af93dd66a7b7b950ad6435222c5f4e3b937b4 + sha384: 01d2aade49c07a389e3f906c7157a5bbe7c1c7685873e81dbdc7ef5d1a44c796dfc7d53808ae05445ae9d0529f70e9ef source: https://github.com/uzh-rpg/netvlad_tf_open/raw/abe37fe9d656bf781cff32caf738efca525b7889/python/netvlad_tf/nets.py postprocessing: - $type: unpack_archive diff --git a/models/public/nfnet-f0/README.md b/models/public/nfnet-f0/README.md index df225851442..6b5b1dd81c1 100644 --- a/models/public/nfnet-f0/README.md +++ b/models/public/nfnet-f0/README.md @@ -60,14 +60,14 @@ Channel order is `BGR`. Object classifier according to ImageNet classes, name - `probs`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model Object classifier according to ImageNet classes, name - `probs`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/nfnet-f0/model.yml b/models/public/nfnet-f0/model.yml index a3776ee79a3..1d31ec51a9b 100644 --- a/models/public/nfnet-f0/model.yml +++ b/models/public/nfnet-f0/model.yml @@ -34,11 +34,11 @@ task_type: classification files: - name: timm-0.4.5-py3-none-any.whl size: 287415 - sha256: 8699f644a60527005db07f31ceffef5349c4d144749e1243733c64220a7d6f92 + sha384: 0956e380ed9d2a00697bbb8bba8c2c741dd426671a92de220e2e46c673ec86643071f2264b411a929578609ff1d94ad1 source: https://files.pythonhosted.org/packages/9e/89/d94f59780b5dd973154bf506d8ce598f6bfe7cc44dd445d644d6d3be8c39/timm-0.4.5-py3-none-any.whl - name: dm_nfnet_f0-604f9c3a.pth size: 285993610 - sha256: 604f9c3a436da9ef5652b7d940efc40c026015552a0fda759acf6ba7e386cfae + sha384: dd903d64b8b6404e9b33b5fb664ac803916d51e1d4a03ff5c9f286084dd2240d29472e2dacff5768f731780ce2102da5 source: https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-dnf-weights/dm_nfnet_f0-604f9c3a.pth postprocessing: - $type: unpack_archive diff --git a/models/public/octave-densenet-121-0.125/model.yml b/models/public/octave-densenet-121-0.125/model.yml index f64324c7511..74a28cce3ba 100644 --- a/models/public/octave-densenet-121-0.125/model.yml +++ b/models/public/octave-densenet-121-0.125/model.yml @@ -30,7 +30,7 @@ task_type: classification files: - name: a01_densenet-121_alpha-0.125.tar size: 32983040 - sha256: 93fcdf376c2ee7e9278e2c4a9d8a0a30e35d92051ad4889fb5d5c1855ea31ca4 + sha384: 3893ca9f4dc2d352734e1d077beaed086743a83583080668870eb4436f221a3e25175a7d7e1231e0c96814e46faa79e2 source: https://dl.fbaipublicfiles.com/octconv/ablation/a01_densenet-121_alpha-0.125.tar postprocessing: - $type: unpack_archive diff --git a/models/public/octave-resnet-101-0.125/model.yml b/models/public/octave-resnet-101-0.125/model.yml index 34b7c38a30c..0b1910e5b53 100644 --- a/models/public/octave-resnet-101-0.125/model.yml +++ b/models/public/octave-resnet-101-0.125/model.yml @@ -30,7 +30,7 @@ task_type: classification files: - name: a06_resnet-101_alpha-0.125.tar size: 179302400 - sha256: 28fe5741d60232fa303292c632f8665cb10ed2f7c32617dae575bad14d4ac45a + sha384: 4df4304f787888b4dcf1e56b4ef8d33cf42b0c8010c18571a915bf5847178cfa807ad8a3266938a07e450f22649dbb46 source: https://dl.fbaipublicfiles.com/octconv/ablation/a06_resnet-101_alpha-0.125.tar postprocessing: - $type: unpack_archive diff --git a/models/public/octave-resnet-200-0.125/model.yml b/models/public/octave-resnet-200-0.125/model.yml index d79dd65b36d..56fe1d0727c 100644 --- a/models/public/octave-resnet-200-0.125/model.yml +++ b/models/public/octave-resnet-200-0.125/model.yml @@ -30,7 +30,7 @@ task_type: classification files: - name: a08_resnet-200_alpha-0.125.tar size: 260812800 - sha256: d9ce49aa73e3f0f31ac659ddf812ff8a79242a058e6b53a7140c756d83413e58 + sha384: d12ff6032906d051bd2c99ca1153a9a25443a60aaa8bba35dd5a5dab09091e296a3d1fda72f2afa29ca6440a5872a20f source: https://dl.fbaipublicfiles.com/octconv/ablation/a08_resnet-200_alpha-0.125.tar postprocessing: - $type: unpack_archive diff --git a/models/public/octave-resnet-26-0.25/model.yml b/models/public/octave-resnet-26-0.25/model.yml index f1589bd25d9..b348f55fe0a 100644 --- a/models/public/octave-resnet-26-0.25/model.yml +++ b/models/public/octave-resnet-26-0.25/model.yml @@ -30,7 +30,7 @@ task_type: classification files: - name: a02_resnet-26_alpha-0.250.tar size: 64256000 - sha256: 29fba1f4f421f86bebcc5bd99c0d1936c20c63b3e5bb20b48665106469bd54b0 + sha384: ac368af08afd64c646ad3bb467b2957b687675914c6e064b18957a2744f4a75c0ba7bc07153ec2dbc24e4c207a791fb1 source: https://dl.fbaipublicfiles.com/octconv/ablation/a02_resnet-26_alpha-0.250.tar postprocessing: - $type: unpack_archive diff --git a/models/public/octave-resnet-50-0.125/model.yml b/models/public/octave-resnet-50-0.125/model.yml index 8fc346dc1aa..fe26a9794cd 100644 --- a/models/public/octave-resnet-50-0.125/model.yml +++ b/models/public/octave-resnet-50-0.125/model.yml @@ -31,7 +31,7 @@ task_type: classification files: - name: a03_resnet-50_alpha-0.125.tar size: 102748160 - sha256: 1ad2c754a5569d6c297c10601fd62feed4d5fe36354167697315e644f5c913d4 + sha384: 97066f9e044af8b58430f5eace265295515a893670ac7c6629ed7574b10589fd1b6de21155266bfa5363754325dd9ad9 source: https://dl.fbaipublicfiles.com/octconv/ablation/a03_resnet-50_alpha-0.125.tar postprocessing: - $type: unpack_archive diff --git a/models/public/octave-resnext-101-0.25/model.yml b/models/public/octave-resnext-101-0.25/model.yml index 132a1d937d5..204f394a6bd 100644 --- a/models/public/octave-resnext-101-0.25/model.yml +++ b/models/public/octave-resnext-101-0.25/model.yml @@ -30,7 +30,7 @@ task_type: classification files: - name: a07_resnext-101_32x4d_alpha-0.250.tar size: 177950720 - sha256: 00c2c7d7048eb0c07509414b4aff845cd1cc6f92b8414a2837b2344e6c6400d3 + sha384: 1ecb5bdfbeea64b21ac17b6d7fc293a93c7096e29b403e6a3287517542c0cf8fa58bc5ad624fcb8fb36058573b4bf001 source: https://dl.fbaipublicfiles.com/octconv/ablation/a07_resnext-101_32x4d_alpha-0.250.tar postprocessing: - $type: unpack_archive diff --git a/models/public/octave-resnext-50-0.25/model.yml b/models/public/octave-resnext-50-0.25/model.yml index eae37faf841..317beb2ad01 100644 --- a/models/public/octave-resnext-50-0.25/model.yml +++ b/models/public/octave-resnext-50-0.25/model.yml @@ -30,7 +30,7 @@ task_type: classification files: - name: a04_resnext-50_32x4d_alpha-0.250.tar size: 100700160 - sha256: e4f4d8438cb1cf6e349eb0e583e5cc6bf2754fe6093dc24471e893eb3b8c3944 + sha384: cd7de5d38afa2e8cc6e73819f1a5fc27b9742c4e21787db5713e031e8acd7ade334011c3448693fbb8b141b2ea629ced source: https://dl.fbaipublicfiles.com/octconv/ablation/a04_resnext-50_32x4d_alpha-0.250.tar postprocessing: - $type: unpack_archive diff --git a/models/public/octave-se-resnet-50-0.125/model.yml b/models/public/octave-se-resnet-50-0.125/model.yml index 7e7bd5ebb04..97a74d843ac 100644 --- a/models/public/octave-se-resnet-50-0.125/model.yml +++ b/models/public/octave-se-resnet-50-0.125/model.yml @@ -31,7 +31,7 @@ task_type: classification files: - name: a05_se-resnet-50_alpha-0.125.tar size: 112947200 - sha256: a080ed21c747b877697ca8a91843d2d83b15d1ad4702a09cd74126a3fcdffc52 + sha384: b255678de9198207c71f81395af431cc0f86edf3ff24b471b9a57a1121d0e048fe9a027fefed8f49343403b95c656586 source: https://dl.fbaipublicfiles.com/octconv/ablation/a05_se-resnet-50_alpha-0.125.tar postprocessing: - $type: unpack_archive diff --git a/models/public/open-closed-eye-0001/model.yml b/models/public/open-closed-eye-0001/model.yml index 99eeac2d7dd..9dfc1b985b9 100644 --- a/models/public/open-closed-eye-0001/model.yml +++ b/models/public/open-closed-eye-0001/model.yml @@ -18,7 +18,7 @@ task_type: classification files: - name: open-closed-eye.onnx size: 46164 - sha256: 4daa100034482525a26c9afb9297c16580a531189e66e3d2b2ac7d32becfd593 + sha384: 2615bce53b55620c629db21b043057600ccc53466f053c0a8277c43577c2db21e48f330cf9b15213016d17cddb8cba27 source: https://download.01.org/opencv/openvino_training_extensions/models/open_closed_eye/open_closed_eye.onnx framework: onnx model_optimizer_args: diff --git a/models/public/pelee-coco/model.yml b/models/public/pelee-coco/model.yml index 12b03820e5e..72e6a825716 100644 --- a/models/public/pelee-coco/model.yml +++ b/models/public/pelee-coco/model.yml @@ -21,7 +21,7 @@ task_type: detection files: - name: pelee_coco.tar.gz size: 22501897 - sha256: 7718e47fd0838faad6db5c79d7480cd20b9e80b1f6be39b8fcfb10c64c814122 + sha384: 40b5113a6811e6f52d91c72a1b67b7a4c3117ca22e7079d7d440308c5f1b6cd9a4a6c77ad5214a449765027e16399243 source: $type: google_drive id: 1NXfmytr_55Njg8h6MXVflo3-tvhxYdm8 diff --git a/models/public/pspnet-pytorch/model.yml b/models/public/pspnet-pytorch/model.yml index 7cf6636e189..b38d9812ffe 100644 --- a/models/public/pspnet-pytorch/model.yml +++ b/models/public/pspnet-pytorch/model.yml @@ -23,39 +23,39 @@ task_type: semantic_segmentation files: - name: pspnet_r50-d8_512x512_20k_voc12aug_20200617_101958-ed5dfbd9.pth size: 196212259 - sha256: ed5dfbd939dd2e4f78a0c2e6726a57150f3aec95e07f2cf64aeffea68a712c5b + sha384: be24b179a6b45e794a03dc153dcfa854cc9f3ee5beefad70072b47902d720d9d1d0ed6dfefb1a43412ed356e2f44fa98 source: https://download.openmmlab.com/mmsegmentation/v0.5/pspnet/pspnet_r50-d8_512x512_20k_voc12aug/pspnet_r50-d8_512x512_20k_voc12aug_20200617_101958-ed5dfbd9.pth - name: models/configs/pspnet/pspnet_r50-d8_512x512_20k_voc12aug.py size: 263 - sha256: 0a36424a1dec8d068fc5676c90106a0b15914b474e36e91aad4621e26aa56aae + sha384: 08bf47369c9070d3f8685a587801335ee894a73de38e4c71f913813ad0d4b7584528d0640e06efcf904f1b3f2cd7d223 source: https://raw.githubusercontent.com/open-mmlab/mmsegmentation/993be2523b908d1e0cb45bc68e92d210b5b2cda1/configs/pspnet/pspnet_r50-d8_512x512_20k_voc12aug.py - name: models/configs/_base_/models/pspnet_r50-d8.py size: 1261 - sha256: 8ac435c6388d9896dacde51e0f24d3d3c27f4972dad88f1eba9327341b689c25 + sha384: ed36f85e10894f27cd6df46fb9242467e712ecc8f3f877da55e7d145660f896588b7dcedcb88be195501cae3ea5f45d8 source: https://raw.githubusercontent.com/open-mmlab/mmsegmentation/993be2523b908d1e0cb45bc68e92d210b5b2cda1/configs/_base_/models/pspnet_r50-d8.py - name: models/configs/_base_/datasets/pascal_voc12_aug.py size: 261 - sha256: b61d01edccac1a2622944761a50772a54b4848cd9e4817c25551f2cccdd05a08 + sha384: 722791c001f6c9f4e0ce124e7903fa69bf32ceed81f6966ecf4e50506e414f39455192e412b7489048b32ba95663a485 source: https://raw.githubusercontent.com/open-mmlab/mmsegmentation/993be2523b908d1e0cb45bc68e92d210b5b2cda1/configs/_base_/datasets/pascal_voc12_aug.py - name: models/configs/_base_/datasets/pascal_voc12.py size: 1930 - sha256: b9fac8609d3c8d8a3536803b53a1222ba2d6f02af6b1638b7e78af4ab233805b + sha384: e90c60f80e0893f8362ab2ee5ec0cfe69d7e9d40475fa9c52f533990778614a8661c64777e2b213886aeea37aaf847cc source: https://raw.githubusercontent.com/open-mmlab/mmsegmentation/993be2523b908d1e0cb45bc68e92d210b5b2cda1/configs/_base_/datasets/pascal_voc12.py - name: models/configs/_base_/default_runtime.py size: 321 - sha256: 27e0d1e40cf3956e2af35b8de32436eb78f91715570ba435144b29b515b1b5a1 + sha384: 76c434ea40497b787f1aa2cc8f2ece8da3fedd17d30e26f61baf16b8b464506c7d0e7a3d9b96a5ad16acb34749f6fd6a source: https://raw.githubusercontent.com/open-mmlab/mmsegmentation/993be2523b908d1e0cb45bc68e92d210b5b2cda1/configs/_base_/default_runtime.py - name: models/mmsegmentation-0.11.0-py3-none-any.whl size: 147357 - sha256: 5b28a1b1c84fef8a28ac6852ef72dfab6f56dc13c33b4b24ebb358f4ea003a4a + sha384: beddc80a37db7be119e1dc94a79c7a824ffcc01c7c5ca19712ddc3b07bc217868d97bd97c4de457ea518078a0b87774c source: https://files.pythonhosted.org/packages/b4/f9/4722a9dfc9bf2d6d6f5cabb90cd61d549ae316ccbe226fc6e245b586d5f9/mmsegmentation-0.11.0-py3-none-any.whl - name: models/addict-2.4.0-py3-none-any.whl size: 3832 - sha256: 249bb56bbfd3cdc2a004ea0ff4c2b6ddc84d53bc2194761636eb314d5cfa5dfc + sha384: 0b3d7c226551078ffcd70e4d512194f2cb67c6c06dc8c7a7b8001752b842b934990817f9236f73fb7c38cba5573205ab source: https://files.pythonhosted.org/packages/6a/00/b08f23b7d7e1e14ce01419a467b583edbb93c6cdb8654e54a9cc579cd61f/addict-2.4.0-py3-none-any.whl - name: models/mmcv-1.2.0.tar.gz size: 241987 - sha256: 2e34bcacd977f101f98447be08e565c19aedeedadc155e97f8f75efe356b7ca9 + sha384: 23b888f6b727372b2f61047bb5b068bd1a06cef9884b7c9a5e3976e6a1b542eef4d3f37cbbbad2e0bf657f320d18a529 source: https://files.pythonhosted.org/packages/d4/a0/01de45397c6222a29cf088bf54d4fb5038a4a524340eef0f923335a23116/mmcv-1.2.0.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/quartznet-15x5-en/model.yml b/models/public/quartznet-15x5-en/model.yml index 2b63d6960bd..58f71202d99 100644 --- a/models/public/quartznet-15x5-en/model.yml +++ b/models/public/quartznet-15x5-en/model.yml @@ -23,15 +23,15 @@ task_type: speech_recognition files: - name: models/ruamel.yaml-0.17.2-py3-none-any.whl size: 101631 - sha256: 0850def9ebca23b3a8c64c4b4115ebb6b364a10d49f89d289a26ee965e1e7d9d + sha384: 1f0f8622be5cb6018836ebba71b1eb137a088ff5617f5f1013c1fa0503af0c1933410915e85c76b4a1468ae22a63a115 source: https://files.pythonhosted.org/packages/82/b8/d5bc68c849d0a60b1acb3ad20fec5d23534733701f5db6b2cc029076bf72/ruamel.yaml-0.17.2-py3-none-any.whl - name: models/nemo_toolkit-0.11.0-py3-none-any.whl size: 622593 - sha256: 627a14093d22e538b4e6962ebfd43ce4479a1f5710e54e96623762ebd8140fce + sha384: da6f83fce1342dac73b05b09c2590bc48ba5aa8242c9cca723f5baf19441b6052eb7b5d3c4e5c02b869d5fc097ebb4cd source: https://files.pythonhosted.org/packages/70/68/7392874cb5fcb8a0317671a03a7b7f51cf7f2648614ef2546fc0f00726bc/nemo_toolkit-0.11.0-py3-none-any.whl - name: models/QuartzNet15x5-En-Base.nemo size: 71083664 - sha256: 99020d0d844054c467f8107e1c6fb77db5cd4c5a0499b577031e62095e391082 + sha384: 74e8284e77098906afb7a15a861ef60ec14db1a4acb206fa719492fa43050ad69a91c245652c05c5f0ded38b5903ed55 source: https://api.ngc.nvidia.com/v2/models/nvidia/multidataset_quartznet15x5/versions/2/files/QuartzNet15x5-En-Base.nemo postprocessing: - $type: unpack_archive diff --git a/models/public/regnetx-3.2gf/README.md b/models/public/regnetx-3.2gf/README.md index ef4f628dd92..1c721cc46ef 100644 --- a/models/public/regnetx-3.2gf/README.md +++ b/models/public/regnetx-3.2gf/README.md @@ -54,14 +54,14 @@ Channel order is `BGR` Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/regnetx-3.2gf/model.yml b/models/public/regnetx-3.2gf/model.yml index cf9ce461da4..dc3a67b9727 100644 --- a/models/public/regnetx-3.2gf/model.yml +++ b/models/public/regnetx-3.2gf/model.yml @@ -23,59 +23,59 @@ task_type: classification files: - name: configs/dds_baselines/regnetx/RegNetX-3.2GF_dds_8gpu.yaml size: 362 - sha256: 166491e53c668ecc181692dde27221b4358f1b889e7726396690c24547e53f5f + sha384: 63516817df084ebde1d6014e60f8aa108ce6cc83254ef8984413d15d2a100de89ec1e39b09b5a67f19ea664ebdc48004 source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/configs/dds_baselines/regnetx/RegNetX-3.2GF_dds_8gpu.yaml - name: pycls/__init__.py size: 0 - sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + sha384: 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/__init__.py - name: pycls/core/__init__.py size: 0 - sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + sha384: 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/core/__init__.py - name: pycls/core/checkpoint.py size: 3497 - sha256: 4b2e2221b17cc50e93c4f952fe447de419dbd605429ffb5cade44322a66bc019 + sha384: 8187a1e75ec52dabdfc0d8cb823fe59e4f865e9feaf3b69975a119d72a1ea651fc3fa22fab8304c1ec6c953845595dbe source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/core/checkpoint.py - name: pycls/core/net.py size: 3924 - sha256: 40f39e68d462d9d001177a54966d8f63f8ebd9172e70df1916841119442b0f0a + sha384: f78a59516a98467783b879601f8eec777d4f01621e5acc6b7e03c02f437b598d490df7cbe25738fe40a2ab7289ac8d56 source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/core/net.py - name: pycls/core/distributed.py size: 5410 - sha256: a56e582f13999f1ec48413abad6538199389997c2e0fa9e1ea2189cbffe598ab + sha384: cec9732ace81ccc16deca956fd5ea0eb490c32b3582ff30aa0c8a6d91ffb1167de571a375124b086ac192b28ad586aec source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/core/distributed.py - name: pycls/core/config.py size: 10502 - sha256: 88262db4930481b217baa9469ac347e49255866e010c3721a2b0dacd25d7af50 + sha384: c1eab6f5e3bd91d38b0264cb6da2ef78f3ba0213d0716cc85982b5438f4768eb14a9bc42bfe27b255813b61957eaad2d source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/core/config.py - name: pycls/core/io.py size: 2603 - sha256: c1e5463515448b26b3d946b0ae2d09dd25d79b4d77a64c7b6e06c5ff4423cc2b + sha384: 4a854e5a9a7e3b2bdbd84172d3a5d46c58df0a1459936997b7a49d95782d3be8afe6517b82ed1b3703200ee4e255b4df source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/core/io.py - name: pycls/models/__init__.py size: 317 - sha256: d6ec4228397f264cad1b2731620a17f5c7e5312dde6ae38c5d2168c4e287c063 + sha384: ebac105e1fb95d363ea917090295ac833e46cf1a4fabb30fe9009dd569990dd40695cc4d708ea1ca56e446980bc3f5f8 source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/models/__init__.py - name: pycls/models/blocks.py size: 6752 - sha256: af87685d354323f7c8762f0682573e7b43b6e19d242f5f43d1d20eeadb4321cd + sha384: fbf2f518dde241316e3920a289a6b8a1f7796e25544342981dd2f63ef1f4217f5f93a1525e7882792ffbfb7bae317594 source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/models/blocks.py - name: pycls/models/anynet.py size: 11457 - sha256: 93c69e0983e7020e2b14cf03b97f50d7c54cde3036bd5c7edd17367e5c1b32b5 + sha384: 3be01cc1376256b9795356aa7e484b8e06673ef6ec323e7c68d9b5ca41e9ed625c549fe3b9f11af232877b86fea48e32 source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/models/anynet.py - name: pycls/models/regnet.py size: 2602 - sha256: 3204c754001e69acbc127feef56099fc4bc9a38852a198a70d577a5f079276c2 + sha384: 2ffbd0689ba2efabd906f1c4685055db70e83f6f777fc3e41e2610ee625b94d99973f21a9bb865d6ef0ebb77a00ce880 source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/models/regnet.py - name: pycls/models/model_zoo.py size: 8982 - sha256: 1e7298b43cb21a2843b163f9861393b9fafc1e5104a3ed892dff6fe22ea45d3b + sha384: a4529d529aeed36a2f90bb91e3e5d8ba820ba5ca6078f0188dd4c454b55e667e1fd586e4819ff8194cb2134c916d05dc source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/pycls/models/model_zoo.py - name: ckpt/regnetx-3.2gf.pyth size: 122749825 - sha256: 371c9802319a59857ec9829890963f704436b170921ce88e6d3eb1ba4fe6ee2c + sha384: 5757be265470b77fa83a26b256d7ee0f49dea765f97b1e6254e87951a2d77079f34b750a5bc4df1f156cf658bc07c6fe source: https://dl.fbaipublicfiles.com/pycls/dds_baselines/160906139/RegNetX-3.2GF_dds_8gpu.pyth postprocessing: - $type: regex_replace diff --git a/models/public/repvgg-a0/README.md b/models/public/repvgg-a0/README.md index 0ee8c902f51..f49e0412f1b 100644 --- a/models/public/repvgg-a0/README.md +++ b/models/public/repvgg-a0/README.md @@ -58,14 +58,14 @@ Channel order is `BGR`. Object classifier according to ImageNet classes, name - `output`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model Object classifier according to ImageNet classes, name - `output`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/repvgg-a0/model.yml b/models/public/repvgg-a0/model.yml index c789a4917d0..c7226b94644 100644 --- a/models/public/repvgg-a0/model.yml +++ b/models/public/repvgg-a0/model.yml @@ -32,11 +32,11 @@ task_type: classification files: - name: repvgg.py size: 12745 - sha256: a0ab4476f4fe6711e4f7cb394bd9e11879cc83bfa1cd6f1d190af53db6a9a464 + sha384: 3d41d82d256eb4bb8b0216e177bcf84458cf4cb0dcd15809fee1e4c30d304bce7f3136caedc717e863c7e67b97c0d87d source: https://raw.githubusercontent.com/DingXiaoH/RepVGG/faba6fb5cbc27a3956e2e0522e27e065b824c757/repvgg.py - name: RepVGG-A0-train.pth size: 36588855 - sha256: e538bfe8639d53a8cbeb4b580aac3dad8ecc304d71eddcb169f660a24fa80bb7 + sha384: 7efb6b28b0376d80753c86b43687b38f2a7ae94f3ef58552b602a55767b4187dbb7b1fe8770b16133427c93e6cf137d7 source: $type: google_drive id: 13Gn8rq1PztoMEgK7rCOPMUYHjGzk-w11 diff --git a/models/public/repvgg-b1/README.md b/models/public/repvgg-b1/README.md index 55a0812e738..189bcf01629 100644 --- a/models/public/repvgg-b1/README.md +++ b/models/public/repvgg-b1/README.md @@ -58,14 +58,14 @@ Channel order is `BGR`. Object classifier according to ImageNet classes, name - `output`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model Object classifier according to ImageNet classes, name - `output`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/repvgg-b1/model.yml b/models/public/repvgg-b1/model.yml index 03be9e8e8ce..9c030029273 100644 --- a/models/public/repvgg-b1/model.yml +++ b/models/public/repvgg-b1/model.yml @@ -32,11 +32,11 @@ task_type: classification files: - name: repvgg.py size: 12745 - sha256: a0ab4476f4fe6711e4f7cb394bd9e11879cc83bfa1cd6f1d190af53db6a9a464 + sha384: 3d41d82d256eb4bb8b0216e177bcf84458cf4cb0dcd15809fee1e4c30d304bce7f3136caedc717e863c7e67b97c0d87d source: https://raw.githubusercontent.com/DingXiaoH/RepVGG/faba6fb5cbc27a3956e2e0522e27e065b824c757/repvgg.py - name: RepVGG-B1-train.pth size: 230009223 - sha256: fef08fb7dbe34966de425a4d1936c523d67bc05fadfe5228ea39514cbc62e1f5 + sha384: 23d9bea60e7bf0c184e0ec273ac228cda6ee8afcd4abe734cd1b02ca48253143000b41e299124601252a4498fe6ba379 source: $type: google_drive id: 1VlCfXXiaJjNjzQBy3q7C3H2JcxoL0fms diff --git a/models/public/repvgg-b3/README.md b/models/public/repvgg-b3/README.md index 6fb06dabe11..98743259a9f 100644 --- a/models/public/repvgg-b3/README.md +++ b/models/public/repvgg-b3/README.md @@ -58,14 +58,14 @@ Channel order is `BGR`. Object classifier according to ImageNet classes, name - `output`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model Object classifier according to ImageNet classes, name - `output`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/repvgg-b3/model.yml b/models/public/repvgg-b3/model.yml index 93974bb32a2..cf0b970aa52 100644 --- a/models/public/repvgg-b3/model.yml +++ b/models/public/repvgg-b3/model.yml @@ -32,11 +32,11 @@ task_type: classification files: - name: repvgg.py size: 12745 - sha256: a0ab4476f4fe6711e4f7cb394bd9e11879cc83bfa1cd6f1d190af53db6a9a464 + sha384: 3d41d82d256eb4bb8b0216e177bcf84458cf4cb0dcd15809fee1e4c30d304bce7f3136caedc717e863c7e67b97c0d87d source: https://raw.githubusercontent.com/DingXiaoH/RepVGG/faba6fb5cbc27a3956e2e0522e27e065b824c757/repvgg.py - name: RepVGG-B3-200epochs-train.pth size: 492817293 - sha256: ddb6ba07d090d7369486e7c90a2ebbd706af399cf40c619812fa52f6d91d928d + sha384: 647371bdfad380c1001d16c2dae0cd244974b11b2464933f7508c1ae3e82976eab2e0f940a5192a3a75db7363d0e8db4 source: $type: google_drive id: 1wBpq5317iPKk3-qblBHnx35bY_WumAlU diff --git a/models/public/resnest-50-pytorch/README.md b/models/public/resnest-50-pytorch/README.md index c1fee917b9a..32019f89c3a 100644 --- a/models/public/resnest-50-pytorch/README.md +++ b/models/public/resnest-50-pytorch/README.md @@ -58,7 +58,7 @@ Channel order is `BGR`. Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model diff --git a/models/public/resnest-50-pytorch/model.yml b/models/public/resnest-50-pytorch/model.yml index 701506d3003..708845b7bd6 100644 --- a/models/public/resnest-50-pytorch/model.yml +++ b/models/public/resnest-50-pytorch/model.yml @@ -28,20 +28,20 @@ description: >- task_type: classification files: - name: resnest50-528c19ca.pth - sha256: 528c19ca6509420548c8359f63ff37975e7d92f42eaf72a7af152a015c8ef48c + sha384: c08c80b6c826ea76eda8f638b1c06535aed947cf8ccc26c027dbda917fb1afad72191f753a7a6029d6126360973f0a06 size: 110273258 source: https://github.com/zhanghang1989/ResNeSt/releases/download/weights_step1/resnest50-528c19ca.pth - name: model/resnest.py size: 2908 - sha256: ef4629dca658fb7b52dff05ca6b4cdd2f62eae387a67c8f3036e58aaf23955d1 + sha384: 00a948bbe8a8aeb671724cc2ddca21de34ede1d9908b5f22ac05681518b7f929eb89eddcd23694aaea7999a0e9808477 source: https://raw.githubusercontent.com/zhanghang1989/ResNeSt/c4ea0c083fe4308eda92bd7d4140a248914bead5/resnest/torch/resnest.py - name: model/resnet.py size: 13205 - sha256: c826ebc85827e85669d244884242105dd6b9491e94cea8ecd799bf6bc1d665bd + sha384: 1191368d697bb05970ace761740bfe4e3c8b3d15ab487260f56169db7321ea8b505f33779817eb96bdb51f9c07548f0d source: https://raw.githubusercontent.com/zhanghang1989/ResNeSt/c4ea0c083fe4308eda92bd7d4140a248914bead5/resnest/torch/resnet.py - name: model/splat.py size: 3620 - sha256: 4321cf23ca112a4eac287454ba267c22aa52f416352f0de9dcd3a9576908b397 + sha384: f3fdd36cab53e2f3ff1819391246ab9738426758ee5f6af01d5e8c22a8f662a49164e738be6574a4cae03fac76d47259 source: https://raw.githubusercontent.com/zhanghang1989/ResNeSt/c4ea0c083fe4308eda92bd7d4140a248914bead5/resnest/torch/splat.py framework: pytorch conversion_to_onnx_args: diff --git a/models/public/resnet-18-pytorch/README.md b/models/public/resnet-18-pytorch/README.md index 3a93ec16049..2c412e022f4 100644 --- a/models/public/resnet-18-pytorch/README.md +++ b/models/public/resnet-18-pytorch/README.md @@ -61,14 +61,14 @@ Channel order is `BGR` Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/resnet-18-pytorch/model.yml b/models/public/resnet-18-pytorch/model.yml index dce2919d7fc..7a10181ec0f 100644 --- a/models/public/resnet-18-pytorch/model.yml +++ b/models/public/resnet-18-pytorch/model.yml @@ -26,7 +26,7 @@ description: >- task_type: classification files: - name: resnet18-5c106cde.pth - sha256: 5c106cde386e87d4033832f2996f5493238eda96ccf559d1d62760c4de0613f8 + sha384: 5d513c0e73ad03072938d37c0f973ef96719db2ceee80d827b89b74a30a499b1b86f0e0e47d20f3965889577c1d854dd size: 46827520 source: https://download.pytorch.org/models/resnet18-5c106cde.pth framework: pytorch diff --git a/models/public/resnet-34-pytorch/README.md b/models/public/resnet-34-pytorch/README.md index 0e31f4a3051..9ee3b1c1aaf 100644 --- a/models/public/resnet-34-pytorch/README.md +++ b/models/public/resnet-34-pytorch/README.md @@ -61,14 +61,14 @@ Channel order is `BGR` Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ## Download a Model and Convert it into Inference Engine Format diff --git a/models/public/resnet-34-pytorch/model.yml b/models/public/resnet-34-pytorch/model.yml index 16ed4d44f0a..2ca14d02ab7 100644 --- a/models/public/resnet-34-pytorch/model.yml +++ b/models/public/resnet-34-pytorch/model.yml @@ -26,7 +26,7 @@ description: >- task_type: classification files: - name: resnet34-333f7ec4.pth - sha256: 333f7ec4c6338da2cbed37f1fc0445f9624f1355633fa1d7eab79a91084c6cef + sha384: 857b461359759d30b1eed4a5bd6e0db499b8c6e6eaff38b456ee980c834b62035c4ac53b6005ecef7150b15b23828c71 size: 87306240 source: https://download.pytorch.org/models/resnet34-333f7ec4.pth framework: pytorch diff --git a/models/public/resnet-50-caffe2/model.yml b/models/public/resnet-50-caffe2/model.yml index 16dea9a55fe..9dea873bfda 100644 --- a/models/public/resnet-50-caffe2/model.yml +++ b/models/public/resnet-50-caffe2/model.yml @@ -20,11 +20,11 @@ task_type: classification files: - name: predict_net.pb size: 31649 - sha256: 657081428cd8a8d9f1a6b20a8b6dba51725d3fc1eaabf0f19747a3b843e18a16 + sha384: 5d21f314c72263f17734e0ebab5fdb0d6f0d6107a2b7ea40842193e8f1fc430db4935b3f4cfc1e26794260edb420168d source: https://s3.amazonaws.com/download.caffe2.ai/models/resnet50/predict_net.pb - name: init_net.pb size: 128070759 - sha256: 97046c44ecd15b3c8806f609a15d0cc52af7bdc8aa19c720f8a1f6abe68e9a74 + sha384: 3f0dff89a72b22a460fb55b3e42699f2a40e89b525a21443282532422fa7f4c7e5ae7e82761117382e01b4d8b0afce81 source: https://s3.amazonaws.com/download.caffe2.ai/models/resnet50/init_net.pb framework: caffe2 quantizable: yes diff --git a/models/public/resnet-50-pytorch/README.md b/models/public/resnet-50-pytorch/README.md index 478e3815351..7f91f466fda 100644 --- a/models/public/resnet-50-pytorch/README.md +++ b/models/public/resnet-50-pytorch/README.md @@ -61,7 +61,7 @@ Channel order is `BGR` Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model diff --git a/models/public/resnet-50-pytorch/model.yml b/models/public/resnet-50-pytorch/model.yml index 06dfb487c17..263dadc764a 100644 --- a/models/public/resnet-50-pytorch/model.yml +++ b/models/public/resnet-50-pytorch/model.yml @@ -26,7 +26,7 @@ description: >- task_type: classification files: - name: resnet50-19c8e357.pth - sha256: 19c8e3572231adff6824a2da93fd67b5986919a2e65f8b6007eab4edee220097 + sha384: de63f5f0157c6781341f7b8e6cca587b462a0d80425b51b7a333d3f38a9be0ff198df25bf6ce107112c0136ce5b9ee50 size: 102502400 source: https://download.pytorch.org/models/resnet50-19c8e357.pth framework: pytorch diff --git a/models/public/resnet-50-tf/model.yml b/models/public/resnet-50-tf/model.yml index 26dd8912b13..fb08e02adcc 100644 --- a/models/public/resnet-50-tf/model.yml +++ b/models/public/resnet-50-tf/model.yml @@ -21,7 +21,7 @@ task_type: classification files: - name: resnet_v1-50.pb size: 102170160 - sha256: 7c186a471a30682cdee02b246eeb0bfd93fc71d9fa53834d69f8101e664d12f8 + sha384: d1097f41df917e56e927b38867bc0748a7b136b8a3441ce7d2002bbb6894b2bc167835146d0a9fc10b5c94b9d7f6f156 source: https://download.01.org/opencv/public_models/012020/resnet-50-tf/resnet_v1-50.pb model_optimizer_args: - --input_shape=[1,224,224,3] diff --git a/models/public/retinaface-resnet50-pytorch/model.yml b/models/public/retinaface-resnet50-pytorch/model.yml index a71f105ac41..c488e2c66c1 100644 --- a/models/public/retinaface-resnet50-pytorch/model.yml +++ b/models/public/retinaface-resnet50-pytorch/model.yml @@ -21,19 +21,19 @@ task_type: detection files: - name: models/retinaface.py size: 4865 - sha256: 367da7b58830d340952b5676504b25d3af3b05992793fc29e100d6ebe17a24c9 + sha384: def46f34640a3f597838f48a6defe1a08e2eb624251dde189cac46a3148bf9f1159bf259308fb74b0ba8a8a4f24a02e4 source: https://raw.githubusercontent.com/biubug6/Pytorch_Retinaface/b984b4b775b2c4dced95c1eadd195a5c7d32a60b/models/retinaface.py - name: models/net.py size: 4598 - sha256: dbb885c0d7bd02865c38f6c9f06a03b0c586201a824f797c57ce87ca466a896f + sha384: 6d7791ce8526ddc9068552dff37023a048ef39b25c491e67ee91b0ef780ddba86d895cf88cae5ffc4a181e4849e8383a source: https://raw.githubusercontent.com/biubug6/Pytorch_Retinaface/b984b4b775b2c4dced95c1eadd195a5c7d32a60b/models/net.py - name: data/config.py size: 928 - sha256: 70a8c14459ee47637785b1537da839e03e30d6500dec89e42fb646447d1349ba + sha384: 2c139b1b41adf97f09437959fdc24490c7febfa886d4eeb017e63b8f08bda0407735e54de4c8c1ce14be12a18304cd3d source: https://raw.githubusercontent.com/biubug6/Pytorch_Retinaface/b984b4b775b2c4dced95c1eadd195a5c7d32a60b/data/config.py - name: Resnet50_Final.pth size: 109497761 - sha256: 6d1de9c2944f2ccddca5f5e010ea5ae64a39845a86311af6fdf30841b0a5a16d + sha384: 80453e582f22ff7786b1392fb0ffb54e0e220ffb71a1381ca05de77673b0da3afeae70540076776a448b0972976c7a3c source: $type: google_drive id: 14KX6VqF69MdSPk3Tr9PlDYbq7ArpdNUW diff --git a/models/public/retinanet-tf/model.yml b/models/public/retinanet-tf/model.yml index 15af01cd47c..d20f18a59e2 100644 --- a/models/public/retinanet-tf/model.yml +++ b/models/public/retinanet-tf/model.yml @@ -20,7 +20,7 @@ task_type: detection files: - name: retinanet_resnet50_coco_best_v2.1.0.pb size: 152890076 - sha256: 0bc291e3217afac2aaafc0801d9e9dba02c292f01d6298ce04ba3cdd13dd3490 + sha384: 0f51df51f4a58c5e0fe65e9ed69f7bb07819e73ebf975c86783e7a176634357b15c212a839c80a31f99a751c88d21683 source: https://download.01.org/opencv/public_models/052020/retinanet-tf/retinanet_resnet50_coco_best_v2.1.0.pb model_optimizer_args: - --input_shape=[1,1333,1333,3] diff --git a/models/public/rexnet-v1-x1.0/README.md b/models/public/rexnet-v1-x1.0/README.md index 30d7115d347..9a159acb717 100644 --- a/models/public/rexnet-v1-x1.0/README.md +++ b/models/public/rexnet-v1-x1.0/README.md @@ -58,7 +58,7 @@ Channel order is `BGR`. Object classifier according to ImageNet classes, name - `prob`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model diff --git a/models/public/rexnet-v1-x1.0/model.yml b/models/public/rexnet-v1-x1.0/model.yml index cb72fd46d4b..3204960c85a 100644 --- a/models/public/rexnet-v1-x1.0/model.yml +++ b/models/public/rexnet-v1-x1.0/model.yml @@ -28,13 +28,13 @@ task_type: classification files: - name: rexnetv1_1.0x.pth size: 19428695 - sha256: 30b1700f2cda11f6d07eb1c414bab30879b8eb0d8c6571254fc3e65bf911ee46 + sha384: 5ffbf929993b597825907077194d24f9bac496d0e652d6f11a8ef75ae8e1a583c66acedf67767085dcafc437355e63be source: $type: google_drive id: 1xeIJ3wb83uOowU008ykYj6wDX2dsncA9 - name: rexnetv1.py size: 6335 - sha256: 26ed1b143947f2d10198c7dba515c313719400daf05ea1efea434d8e61779331 + sha384: e53d67fae9ac700e0d8ff412f0e2397fb9f63fd49cb6e34233f11596dee25e6911965c2988784b40f7c2ea97fd7a098c source: https://raw.githubusercontent.com/clovaai/rexnet/104f2184754d97b8050f24bdf39f650b3e80cad8/rexnetv1.py postprocessing: - $type: regex_replace diff --git a/models/public/rfcn-resnet101-coco-tf/model.yml b/models/public/rfcn-resnet101-coco-tf/model.yml index 23959907bd7..b7a96b7a511 100644 --- a/models/public/rfcn-resnet101-coco-tf/model.yml +++ b/models/public/rfcn-resnet101-coco-tf/model.yml @@ -19,7 +19,7 @@ task_type: detection files: - name: rfcn_resnet101_coco_2018_01_28.tar.gz size: 652955004 - sha256: e10d71260515cc0240d53ea8fc9e61669bc10c2df5e67ace682832113ac17205 + sha384: 23641344acd2eacc6da60af24e62271b6e3b878b8a085d25321e40b64141e295c37cd7559ff47b1695850acbb48d4a24 source: http://download.tensorflow.org/models/object_detection/rfcn_resnet101_coco_2018_01_28.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/se-inception/model.yml b/models/public/se-inception/model.yml index 4a6e6455381..fc3e27b8c75 100644 --- a/models/public/se-inception/model.yml +++ b/models/public/se-inception/model.yml @@ -18,14 +18,12 @@ task_type: classification files: - name: se-inception.prototxt size: 66438 - sha256: 57813dfc27113ce1bc714b069d574f80643ad58480e6f35bdf1dec690075c6b3 + sha384: 7c98df55b4d53dc435a792f624442b5276cb61947937775ef3ee31a8362980ebfe90af05d133511f22cf24f8a1e45963 source: https://raw.githubusercontent.com/hujie-frank/SENet/369374b0678907a0e45c6f267256c7c34203177e/models/SE-BN-Inception.prototxt - name: se-inception.caffemodel size: 47855246 - sha256: 0660aa2b867f7353794d3ac02081d9178ac0709e8d8d75c29290dba4bc10ce03 - source: - $type: google_drive - id: 0BwHV3BlNKkWlTWRRbDZYbVB2WWc + sha384: b5d3a92296b83cb5c706140a1d2855903906c6c2176766bdd58303643c28a6aa9950cec2f318cb4f97778705c394d5d1 + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/se-inception/SE-BN-Inception.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] - --input=data diff --git a/models/public/se-resnet-101/model.yml b/models/public/se-resnet-101/model.yml index 7007635faf0..9d58e06ad7d 100644 --- a/models/public/se-resnet-101/model.yml +++ b/models/public/se-resnet-101/model.yml @@ -18,14 +18,12 @@ task_type: classification files: - name: se-resnet-101.prototxt size: 98677 - sha256: c97375db60ad04e1196966c7149bd5cc98fbb9a34bdde511c26c922ba791903d + sha384: c661a0960ce1fb36121ce0edd636e3fc080f973b0a5f07f72b4a9809df2c9adacad2ac04b16ab7cb2612c0875c09d8a9 source: https://raw.githubusercontent.com/hujie-frank/SENet/369374b0678907a0e45c6f267256c7c34203177e/models/SE-ResNet-101.prototxt - name: se-resnet-101.caffemodel size: 197806200 - sha256: 09777ce1202087954ee34ae2566cf611d03d2d8195ced0fe51b612ebf951d729 - source: - $type: google_drive - id: 0BwHV3BlNKkWlTEg4YmcwQ0FoZFU + sha384: 76e8d87cf23deb013ba8c03c05e66919477ecd1a1bf2ebe2d43e4539947d12f4eb22593b8bc4bc3cc00e9783071a52db + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/se-resnet-101/SE-ResNet-101.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] - --input=data diff --git a/models/public/se-resnet-152/model.yml b/models/public/se-resnet-152/model.yml index 2b91ec90fa1..1ca6978175c 100644 --- a/models/public/se-resnet-152/model.yml +++ b/models/public/se-resnet-152/model.yml @@ -18,14 +18,12 @@ task_type: classification files: - name: se-resnet-152.prototxt size: 148017 - sha256: 9cfe789f971c3418e50e435f494d6479a5a0f263a07bf9c13e434a0e5919b2f2 + sha384: 5d958315940c93ef26d9902798d5e58ace08089c43e7e83e58f2e0c8ef435a2b6d1f6a13a90d9e44692ff36df611cbe1 source: https://raw.githubusercontent.com/hujie-frank/SENet/369374b0678907a0e45c6f267256c7c34203177e/models/SE-ResNet-152.prototxt - name: se-resnet-152.caffemodel size: 268009578 - sha256: bbe7fc5b5068b7cd4b12ce1bb78f61bd3f48238a372e70ab9c0724afa778e5d1 - source: - $type: google_drive - id: 0BwHV3BlNKkWlcFE0Q2NTcWl3WUE + sha384: 0b5a987c1f07119a50610b20405c02b83eb09db0bc86cdd63719f306717be72922c131eba1cb30ce609c9c1eeed9f55d + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/se-resnet-152/SE-ResNet-152.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] - --input=data diff --git a/models/public/se-resnet-50/model.yml b/models/public/se-resnet-50/model.yml index db0c978d162..007a3a88f57 100644 --- a/models/public/se-resnet-50/model.yml +++ b/models/public/se-resnet-50/model.yml @@ -18,14 +18,12 @@ task_type: classification files: - name: se-resnet-50.prototxt size: 49272 - sha256: eebbe3c64201f34492caf501498f6031152edbd4a44ed106de69441060ff117c + sha384: 7110ff9a57008b8487f05e678ee3510bbf9b550f461f714c0a829dfb6a3503fc5935d676078d7e353668561d23ec213a source: https://raw.githubusercontent.com/hujie-frank/SENet/369374b0678907a0e45c6f267256c7c34203177e/models/SE-ResNet-50.prototxt - name: se-resnet-50.caffemodel size: 112602669 - sha256: 72880fde3bd29b324bb302c80f49a098b8970597494c56525fd410a8d2ed5993 - source: - $type: google_drive - id: 0BwHV3BlNKkWlS2QwZHFzM3RjNzg + sha384: 3f093acba237185b50fb354e3841b4d01f50328d9f381937af5e836e808b4ce2671b0b44ca808df8911dba81a3e9d97c + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/se-resnet-50/SE-ResNet-50.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] - --input=data diff --git a/models/public/se-resnext-101/model.yml b/models/public/se-resnext-101/model.yml index 095345191e7..22b282b97ab 100644 --- a/models/public/se-resnext-101/model.yml +++ b/models/public/se-resnext-101/model.yml @@ -18,14 +18,12 @@ task_type: classification files: - name: se-resnext-101.prototxt size: 99162 - sha256: 8a23f1488f5dad2bc4e11b3e7733bc95783301d8c426677989fb11eb7ea2de8b + sha384: 4b3e9c8992e2b9c5b691e32181f9c79b3e466e7322f455117d53317e5a6c422cb106a8bd6bcb0f23e928bc2135b7cf20 source: https://raw.githubusercontent.com/hujie-frank/SENet/369374b0678907a0e45c6f267256c7c34203177e/models/SE-ResNeXt-101.prototxt - name: se-resnext-101.caffemodel size: 196447403 - sha256: 78dc95c9b768fdb32a0a3981a686edaf655df82973b051d818bae523c9a93c90 - source: - $type: google_drive - id: 0BwHV3BlNKkWleklsNzBiZlprblk + sha384: 7c3000c0b24236b75a2eee4222ac971185229614d49eb896e340409392f31b539ae62fde2df1d0b1024184b829316f28 + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/se-resnext-101/SE-ResNeXt-101.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] - --input=data diff --git a/models/public/se-resnext-50/model.yml b/models/public/se-resnext-50/model.yml index 40855dc75bd..ec9469c3d45 100644 --- a/models/public/se-resnext-50/model.yml +++ b/models/public/se-resnext-50/model.yml @@ -18,14 +18,12 @@ task_type: classification files: - name: se-resnext-50.prototxt size: 49519 - sha256: a44865802483b8e20fcc712540c4995ef27c3dc809d9235f5882a13ef5c16e67 + sha384: 5a87782d5f79f2b12df90bd6f61310a552aa4f2fa8df2573e7ab654f01dda44137620cebfc08717f57e76a17909a7844 source: https://raw.githubusercontent.com/hujie-frank/SENet/369374b0678907a0e45c6f267256c7c34203177e/models/SE-ResNeXt-50.prototxt - name: se-resnext-50.caffemodel size: 110550637 - sha256: f12c6b53c2dcd0f38f388d3d5f98cbfc039357e84842e661f28a49719dd52219 - source: - $type: google_drive - id: 0BwHV3BlNKkWlQ2Z0Q204V1RITjA + sha384: cbc0b1da5a2a21ba1398fa1e79b143f637c5dc0248262ab6cf936ef783a3a1cd23943bf5f19f03f19000d7e7d3baf700 + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/se-resnext-50/SE-ResNeXt-50.caffemodel model_optimizer_args: - --input_shape=[1,3,224,224] - --input=data diff --git a/models/public/shufflenet-v2-x0.5/model.yml b/models/public/shufflenet-v2-x0.5/model.yml index e3a312bd86c..0dee4a6a190 100644 --- a/models/public/shufflenet-v2-x0.5/model.yml +++ b/models/public/shufflenet-v2-x0.5/model.yml @@ -29,11 +29,11 @@ task_type: classification files: - name: shufflenet-v2-x0.5.prototxt size: 68502 - sha256: a47c84c54dec7843dda759d41fa70a2b34d27e230e85ab6b75101137956615fa + sha384: a22e8fec3f60b313b4853d4beff651dfc856786974f3b888db967ddd1e943e42d7576a50b7bee7e14288498ff8f7155b source: https://github.com/miaow1988/ShuffleNet_V2_pytorch_caffe/releases/download/v0.1.1/shufflenet_v2_x0.5.prototxt - name: shufflenet-v2-x0.5.caffemodel size: 5529092 - sha256: 0510d78dff391d0776f7302e5c6c074f9093c2357e5e6c62f6ee667eb99e6c98 + sha384: b19fbc18030a80580c9fc1e67626486368b0090c283456e00f4e98cd5cdd66ebf942fec591a465b248b50e18e24d81a9 source: https://github.com/miaow1988/ShuffleNet_V2_pytorch_caffe/releases/download/v0.1.1/shufflenet_v2_x0.5.caffemodel model_optimizer_args: - --reverse_input_channels diff --git a/models/public/shufflenet-v2-x1.0/README.md b/models/public/shufflenet-v2-x1.0/README.md index 90b6607b1e7..c281729180e 100644 --- a/models/public/shufflenet-v2-x1.0/README.md +++ b/models/public/shufflenet-v2-x1.0/README.md @@ -56,7 +56,7 @@ Channel order is `BGR` Object classifier according to ImageNet classes, name - `output`, shape - `1, 1000`, output data format is `B, C`, where: - `B` - batch size -- `C` - predicted probabilities for each class in [0, 1] range +- `C` - predicted probabilities for each class in logits format ### Converted model diff --git a/models/public/shufflenet-v2-x1.0/model.yml b/models/public/shufflenet-v2-x1.0/model.yml index 29e1df9fa01..5f1eb0e5332 100644 --- a/models/public/shufflenet-v2-x1.0/model.yml +++ b/models/public/shufflenet-v2-x1.0/model.yml @@ -27,7 +27,7 @@ description: >- task_type: classification files: - name: shufflenetv2_x1-5666bf0f80.pth - sha256: 5666bf0f80d1e7f8fb61f6a65742b9c27c37f3208c1f087cdcd7c1ec1aa8b848 + sha384: 95dbe93b68849d149e4964cfc2cef9d847da6da6f6d2618c661eaddaebc29772a9becad45a455d80cf59aab1d35b411e size: 9218294 source: https://download.pytorch.org/models/shufflenetv2_x1-5666bf0f80.pth framework: pytorch diff --git a/models/public/single-human-pose-estimation-0001/model.yml b/models/public/single-human-pose-estimation-0001/model.yml index 194f5b806cd..4dc8b60a6fd 100644 --- a/models/public/single-human-pose-estimation-0001/model.yml +++ b/models/public/single-human-pose-estimation-0001/model.yml @@ -17,7 +17,7 @@ description: >- task_type: human_pose_estimation files: - name: single-human-pose-estimation-0001.tar.gz - sha256: 182c51075502643ada303a5f3a081b6adf943b711e5eddf80635582369588d34 + sha384: 440a3e299edf8f474bd974f124416dcd2f6b3121993b6b176bfb0da52a615b0f69d7b22b56ccc912fa04c2ccf96ca632 size: 151979155 source: https://download.01.org/opencv/openvino_training_extensions/models/human_pose_estimation/single-human-pose-estimation-0001.tar.gz postprocessing: diff --git a/models/public/squeezenet1.0/model.yml b/models/public/squeezenet1.0/model.yml index 5642bdf21e0..3385a58b8ba 100644 --- a/models/public/squeezenet1.0/model.yml +++ b/models/public/squeezenet1.0/model.yml @@ -28,11 +28,11 @@ task_type: classification files: - name: squeezenet1.0.prototxt size: 9640 - sha256: 6e4ecef2a27347e226a5ef8be31d6d1b9d19f5a40afa1986ec259fd5fa3bd91c + sha384: 4091e21776a51767811cfb469017af5ee1ee4d1b42cdac0902b6cab41367f01864e72cd2df371f8472694ca521196fc0 source: https://raw.githubusercontent.com/forresti/SqueezeNet/a47b6f13d30985279789d08053d37013d67d131b/SqueezeNet_v1.0/deploy.prototxt - name: squeezenet1.0.caffemodel size: 5001403 - sha256: 9ff8035aada1f9ffa880b35252680d971434b141ec9fbacbe88309f0f9a675ce + sha384: b8dc96393e093b4f23390b70f01fe37330d629759db59c1da3c15f846d0b1b1751b6ad841570c2e303c86829c750a745 source: https://github.com/forresti/SqueezeNet/raw/a47b6f13d30985279789d08053d37013d67d131b/SqueezeNet_v1.0/squeezenet_v1.0.caffemodel postprocessing: - $type: regex_replace diff --git a/models/public/squeezenet1.1-caffe2/model.yml b/models/public/squeezenet1.1-caffe2/model.yml index 93db00a882e..9536d7b5cf7 100644 --- a/models/public/squeezenet1.1-caffe2/model.yml +++ b/models/public/squeezenet1.1-caffe2/model.yml @@ -20,11 +20,11 @@ task_type: classification files: - name: predict_net.pb size: 6175 - sha256: d20be00eb448d3952265620357132916aba8744b027937b56c469b001b46472b + sha384: 39d0085c126407c20d5e4823c6fa9294442fc714142c21b3d8e2bf4b23a83a933d78b62b5d4318f51b757389e15c6b1e source: https://s3.amazonaws.com/download.caffe2.ai/models/squeezenet/predict_net.pb - name: init_net.pb size: 6181001 - sha256: d8115221de899d081a1a83785bf0dbaeea19463cdf7dbddba662cc7abb4f32dc + sha384: 5a4324a7778480b3c57e41a5c6c5cf03b9b6a2c08d7e995358a4d2192619eebeb041f6f925874f9a790fd2c53138e863 source: https://s3.amazonaws.com/download.caffe2.ai/models/squeezenet/init_net.pb framework: caffe2 conversion_to_onnx_args: diff --git a/models/public/squeezenet1.1/model.yml b/models/public/squeezenet1.1/model.yml index 160dfcf9366..89552d323aa 100644 --- a/models/public/squeezenet1.1/model.yml +++ b/models/public/squeezenet1.1/model.yml @@ -29,11 +29,11 @@ task_type: classification files: - name: squeezenet1.1.prototxt size: 9678 - sha256: d041bfb2ab4b32fda4ff6c6966684132f2924e329916aa5bfe9285c6b23e3d1c + sha384: 04e07f1f70210300959388d675b613ebc002464a4508dbcee7784f3bb1b55542f9ee1d191b79838d82dcf14ddac27485 source: https://raw.githubusercontent.com/forresti/SqueezeNet/a47b6f13d30985279789d08053d37013d67d131b/SqueezeNet_v1.1/deploy.prototxt - name: squeezenet1.1.caffemodel size: 4950080 - sha256: 72b912ace512e8621f8ff168a7d72af55910d3c7c9445af8dfbff4c2ee960142 + sha384: 1ffe0f38d605c2c83b51cfea5fa34a4d60744ebeac5655d317146a0ce5ccf39fc40daa1a7798e3c6dc4f67c11ddb9245 source: https://github.com/forresti/SqueezeNet/raw/a47b6f13d30985279789d08053d37013d67d131b/SqueezeNet_v1.1/squeezenet_v1.1.caffemodel postprocessing: - $type: regex_replace diff --git a/models/public/ssd-resnet34-1200-onnx/model.yml b/models/public/ssd-resnet34-1200-onnx/model.yml index cf6836e79e3..acf56b00668 100644 --- a/models/public/ssd-resnet34-1200-onnx/model.yml +++ b/models/public/ssd-resnet34-1200-onnx/model.yml @@ -22,7 +22,7 @@ task_type: detection files: - name: resnet34-ssd1200.onnx size: 80363696 - sha256: b417a8186967f1e78670b0075aa72a10e5c7d1a6d5c08af9d13dc97f3d29ef0d + sha384: 754dd59fdb244e6a93f6173efe26c45bce804305f71b1d0a8a3eb555b3a120894658a0b97475840b93f3c2a30c5efd99 source: https://zenodo.org/record/3228411/files/resnet34-ssd1200.onnx model_optimizer_args: - --reverse_input_channels diff --git a/models/public/ssd300/model.yml b/models/public/ssd300/model.yml index c4492b33099..3fa368a8c99 100644 --- a/models/public/ssd300/model.yml +++ b/models/public/ssd300/model.yml @@ -37,10 +37,8 @@ task_type: detection files: - name: ssd300.tar.gz size: 97789219 - sha256: e3eb9794a33eb77e6798f396df453123c249a1df554e42a3302eb4aa20a8f2ee - source: - $type: google_drive - id: 0BzKzrI_SkD1_TkFPTEQ1Z091SUE + sha384: 2c96cb2aeb08044b1475b5e80523f956317e764ceea8d603d12adebe00951ec25d38f5c060c1bf6d215792a355559c3c + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/ssd300/models_VGGNet_VOC0712Plus_SSD_300x300_ft.tar.gz postprocessing: - $type: unpack_archive format: gztar diff --git a/models/public/ssd512/model.yml b/models/public/ssd512/model.yml index 8fcfe1a39af..c13a419271e 100644 --- a/models/public/ssd512/model.yml +++ b/models/public/ssd512/model.yml @@ -37,10 +37,8 @@ task_type: detection files: - name: ssd512.tar.gz size: 100991061 - sha256: 2d98a6ddd5b4cb0ba59a37fe5d50020457cfe104d45873c3ea43d1e6dcddd12d - source: - $type: google_drive - id: 0BzKzrI_SkD1_MjFjNTlnempHNWs + sha384: 569b25de77ebd11c19fd9934dff148251505414cd3eec0f7419c60f5efc27666b20fc64df1131bc755f61d77335ad0e0 + source: https://storage.openvinotoolkit.org/repositories/open_model_zoo/public/2021.4/ssd512/models_VGGNet_VOC0712Plus_SSD_512x512.tar.gz postprocessing: - $type: unpack_archive format: gztar diff --git a/models/public/ssd_mobilenet_v1_coco/model.yml b/models/public/ssd_mobilenet_v1_coco/model.yml index 36653a97064..a15fccb3472 100644 --- a/models/public/ssd_mobilenet_v1_coco/model.yml +++ b/models/public/ssd_mobilenet_v1_coco/model.yml @@ -21,7 +21,7 @@ task_type: detection files: - name: ssd_mobilenet_v1_coco.tar.gz size: 76541073 - sha256: 8788f89108519fd1102b8a5c2ac861cf6d86603571b6ce5bbd1c245b7fe005e3 + sha384: 95d7ad978aef6fa7fded5fac04f2cdc286f82ee8e59e2ed638de6d0000dbed051c409ed276b56672d17b5b79fe6ba78c source: http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_2018_01_28.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/ssd_mobilenet_v1_fpn_coco/model.yml b/models/public/ssd_mobilenet_v1_fpn_coco/model.yml index 633aa4103a5..c8b0618481f 100644 --- a/models/public/ssd_mobilenet_v1_fpn_coco/model.yml +++ b/models/public/ssd_mobilenet_v1_fpn_coco/model.yml @@ -18,7 +18,7 @@ task_type: detection files: - name: ssd_mobilenet_v1_fpn_shared_box_predictor_640x640_coco14_sync_2018_07_03.tar.gz size: 135664441 - sha256: e8886ece7f3a0993678440305a98f5be649a90b314c95ca94565c23ed20b1fb0 + sha384: e89adbaf822f508c30e77b9aa6e9a0a566493466617064c3ee7203d9210756f6d5cd5740140ce2c0df46514d37bb5023 source: http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_fpn_shared_box_predictor_640x640_coco14_sync_2018_07_03.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/ssd_mobilenet_v2_coco/model.yml b/models/public/ssd_mobilenet_v2_coco/model.yml index 9e9b689654a..ddb2ecdd543 100644 --- a/models/public/ssd_mobilenet_v2_coco/model.yml +++ b/models/public/ssd_mobilenet_v2_coco/model.yml @@ -27,7 +27,7 @@ task_type: detection files: - name: ssd_mobilenet_v2_coco.tar.gz size: 187925923 - sha256: b9380178b2e35333f1a735e39745928488bdabeb9ed20bc6fa07af8172cb5adc + sha384: 86ecb3ed519ba4d766ad84b2ff4586b83b81f999169a45cfede500a5ad22f8f9c8e93a2d2d6e772c515daa0af61154ee source: http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v2_coco_2018_03_29.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/ssd_resnet50_v1_fpn_coco/model.yml b/models/public/ssd_resnet50_v1_fpn_coco/model.yml index fd6ee69efe0..5792215e3e1 100644 --- a/models/public/ssd_resnet50_v1_fpn_coco/model.yml +++ b/models/public/ssd_resnet50_v1_fpn_coco/model.yml @@ -21,7 +21,7 @@ task_type: detection files: - name: ssd_resnet50_v1_fpn_coco.tar.gz size: 366947246 - sha256: b5ff24a4a013130ebbbf5da71fbbd05a5df27825184632899650f45833ffb66b + sha384: 74abd247b05b1d3beaba831f088f479cc886fcdd30c636a417ed19a79adace3b65fcc02e019fa40364e48bee172adc0b source: http://download.tensorflow.org/models/object_detection/ssd_resnet50_v1_fpn_shared_box_predictor_640x640_coco14_sync_2018_07_03.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/ssdlite_mobilenet_v2/model.yml b/models/public/ssdlite_mobilenet_v2/model.yml index f5182755585..0085aae9206 100644 --- a/models/public/ssdlite_mobilenet_v2/model.yml +++ b/models/public/ssdlite_mobilenet_v2/model.yml @@ -20,7 +20,7 @@ task_type: detection files: - name: ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz size: 51025348 - sha256: 542445cce834dbfbb7df1991425d475e85a2d7ec68c60a4f262bb18aac10c8b2 + sha384: 8e205630237f1913ac0ed623d48798f1fa03a9e95c467bd149eb5f6107e704a8131cdb0a72fcf6517dafa0ff47d32a4e source: http://download.tensorflow.org/models/object_detection/ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/swin-tiny-patch4-window7-224/model.yml b/models/public/swin-tiny-patch4-window7-224/model.yml index 5ddc88eb3c6..027aec3ab78 100644 --- a/models/public/swin-tiny-patch4-window7-224/model.yml +++ b/models/public/swin-tiny-patch4-window7-224/model.yml @@ -27,11 +27,11 @@ task_type: classification files: - name: timm-0.4.12-py3-none-any.whl size: 376973 - sha256: dba6b1702b7d24bf9f0f1c2fc394b4ee28f93cde5404f1dc732d63ccd00533b6 + sha384: e5030b792501314113ca804b3b00d35d89c40d0a92d53aa0c41e2a83697d11ef5ea8c73ed1c0bec28c4791047c9dd1b3 source: https://files.pythonhosted.org/packages/90/fc/606bc5cf46acac3aa9bd179b3954433c026aaf88ea98d6b19f5d14c336da/timm-0.4.12-py3-none-any.whl - name: swin_tiny_patch4_window7_224.pth size: 114342173 - sha256: 9f71c168d837d1b99dd1dc29e14990a7a9e8bdc5f673d46b04fe36fe15590ad3 + sha384: 210021216e1f205617d885836b1ac59d725b8c41dbff8dc4c513e838911436b0b75e06529737e472d3167519a7c1a6ad source: https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_tiny_patch4_window7_224.pth postprocessing: - $type: unpack_archive diff --git a/models/public/text-recognition-resnet-fc/accuracy-check.yml b/models/public/text-recognition-resnet-fc/accuracy-check.yml index e3680965177..edcb5b56fb2 100644 --- a/models/public/text-recognition-resnet-fc/accuracy-check.yml +++ b/models/public/text-recognition-resnet-fc/accuracy-check.yml @@ -88,7 +88,7 @@ models: metrics: - type: character_recognition_accuracy - refernce: 0.9296 + reference: 0.9296 - name: ICDAR2013 preprocessing: diff --git a/models/public/text-recognition-resnet-fc/model.yml b/models/public/text-recognition-resnet-fc/model.yml index d9476f5bee6..403d4970a64 100644 --- a/models/public/text-recognition-resnet-fc/model.yml +++ b/models/public/text-recognition-resnet-fc/model.yml @@ -21,197 +21,197 @@ task_type: optical_character_recognition files: - name: vedastr/models/__init__.py size: 88 - sha256: 10f9fb1203ffcae15aa44c200e23bac060b72da385a148fc77a9d3f0b223caf9 + sha384: 825c2e21b6b2cbf346c7d34fad9f5342ef302ee582183af33ebaddcfaec8857925dcf518a74ae23becef8c289caa0009 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/__init__.py - name: vedastr/models/builder.py size: 179 - sha256: 6363f67b2277be15bb788968e81fcb011fe604dcc7d1972e8f51147e54016f99 + sha384: 959e9d7da38edaba0282d2d50d63b489a1d57618f6d18270ab3c91a08c43c2b41036d72257a13f49f0dc082a263630f7 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/builder.py - name: vedastr/models/model.py size: 644 - sha256: 8ccf6696d4c7f3e7a2e6e4899a69f38a379a75adfa22fb0122a7dee5a678c820 + sha384: d22fa2c8c3ad3daf0210e2da0737cf3ef197100edcefaca4d42e28caa8c9c6fb7ab82db7b3700e10aeb2adb8138f57d2 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/model.py - name: vedastr/models/weight_init.py size: 3445 - sha256: e73e87b39a492cb577d21a381a8f272fea032238a7348759ae95589353cac0bd + sha384: f6f2ae7183bffb9382ad378c45bbc9d3b87de5a37b236722bd41cf6b2f021f834403b94081ccd248f5bf13cc4f3bf138 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/weight_init.py - name: vedastr/models/registry.py size: 57 - sha256: 774fe640214e92913f401eaff3864a6f5b1cb0abdad09298918bf4c3eae49a0d + sha384: 5b10880eb49b899469306459acee721e64c2a7ab8ac2f5934a6778d9b7ad0cdfc3ee1f6e0658203bd98973184cf6fd5d source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/registry.py - name: vedastr/models/heads/__init__.py size: 189 - sha256: 363939c2cdf06bcbeccc02d135afb032f014568cb399b562379ed5ade6ee38cd + sha384: a29856d56efd6da99f7d63647a9cc81506844caa1e5e48cd4f6eebf55e3210f68076b9cb9ef0d8bb335b113fef15b343 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/heads/__init__.py - name: vedastr/models/heads/builder.py size: 179 - sha256: a87f40273929bc21759ed31589a23eaf48a26ad26e1d26693cfda8c4c767a2b7 + sha384: ed99623bddee8359523edec9c1616cb894c0ec301e1d86c9eed7b57e92c25b70a0ae4418e6c0c7be9d509c45f10dbe00 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/heads/builder.py - name: vedastr/models/heads/fc_head.py size: 1801 - sha256: c77276a7313b71cab95542ce40bff750226f2af4a1386082376952a5828f7adb + sha384: 05136410ed697d7d61d063b2457bb8277d6fe7d57da76e486d52d3f84aae9c94cec03ea81240eafb970a994ae6dee9f2 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/heads/fc_head.py - name: vedastr/models/heads/registry.py size: 70 - sha256: 2eff1459b0b012fdc0b1dc94b3af64d71ed4c144e7d84ad3c77723862892357c + sha384: 52439fa05b738bdb170b64ebcf3fd705ca9125be1357a0887bfa15325ffe4a7d0dd5bdc5b00eadc33c5503222af382bc source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/heads/registry.py - name: vedastr/models/bodies/__init__.py size: 357 - sha256: 11b13a0dd04d48b6a1676064ee1a8ff366db3c9cf5cf4ffb53acf17f88b46ac4 + sha384: c935e6d7859bc27029ad3374ceed26b8238b082cfcb9e58b48fffe7b90e52f885b24dc66944527a0bfcfeb8aa6e11ac4 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/__init__.py - name: vedastr/models/bodies/builder.py size: 324 - sha256: 66c480109d69796d6ae2fda1c5846940ea66036c6c7c00950710c915834497da + sha384: 6f5998f70a27efb04122df68b18945f02437d1a45b10f228f817d6e1a7c4ccc223a7798d3e426e0d6558d925fb0e2783 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/builder.py - name: vedastr/models/bodies/registry.py size: 96 - sha256: 017db0e0859185b8952e02d5a081c5da06188dc84a738039df73022b0a074b6e + sha384: 9ebec8b3c481611b95aca0f037516950cc90959887b2f65f416af4cfd4430f97ba7f4fbc26f29622be5b139b91010073 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/registry.py - name: vedastr/models/bodies/body.py size: 1207 - sha256: 31663127c4048cf1a5629fee4ed1b858d831bc873a05576ae3377919fc300f97 + sha384: dae2ff54a52dff55a9a372734b83046f4e35d0c376bde36746e26f40e216a4cfa6fb963133b2c9dce5166c5199383bbe source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/body.py - name: vedastr/models/bodies/component.py size: 1421 - sha256: d4616cbee25677fe8da35a46f6db0bf767d89bbd297c3ead72c312adb65f1f53 + sha384: 0cf81b22eff798932a51e4335af9dd6cafb591167cffce9e0eaeafe26b4946ab2a06d7164bc9b1cc99a0b0de89459a6e source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/component.py - name: vedastr/models/bodies/sequences/__init__.py size: 142 - sha256: d26166700f80fc9f1afc3cfdc28aec046670718150c9b74bdb357a365b9b0c0b + sha384: 9b3e08021436c6fbe2538f7a7368f8f80c87f4ef6f29c180f91175eeaf557d619e80ff47a4db4ea489fb98aaf5359e9a source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/sequences/__init__.py - name: vedastr/models/bodies/sequences/builder.py size: 418 - sha256: b352eaaebdeb8a74e047b9cb3b32ca4a5b2f9b7327061d0c88ae0f0757b14f61 + sha384: 71f08b22dabcb4033a1e722473c282ed0b2467f4196c98337be7909f359a99b51c9fc03ccd50f1ad12e233a2f3b4dde7 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/sequences/builder.py - name: vedastr/models/bodies/sequences/registry.py size: 134 - sha256: 20cfe613351986b742fa8a3ee413cde2a2df1322a598a9c247d08048cb9ce3af + sha384: 23d5732c4dea15424e0ee5dc15a7c0e7d7ffdcd32237d21b247e851da3f037ac73fa632538bf071a6a992ef0bdd1756e source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/sequences/registry.py - name: vedastr/models/bodies/feature_extractors/__init__.py size: 182 - sha256: 03bcf0d49385de5eb3bab3c821585c9f466a6c921165752ac2cb2b3eb53a1f43 + sha384: a285af4b7aa62e1eb00fdc848b8e684d0764f5953c9d04d40f01ddd94484569e37ec829ef9f9c45597cc893e7ca16e10 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/__init__.py - name: vedastr/models/bodies/feature_extractors/builder.py size: 717 - sha256: 61ce84fa879b5a17c6b9389848e7b6123e38a38a49b181e3ab10c1e83442306c + sha384: 29bb67edf9f83953f87fdebd46a99314f7dcbf96c7c4dc97df1d92edbb556750460e8c1e796775bde82305aa5e9ef1d3 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/builder.py - name: vedastr/models/bodies/feature_extractors/decoders/__init__.py size: 104 - sha256: 35f48af973d9c7bd90ab12b38d8fa23953380e673dfed01dfb86a5bbe57bd97d + sha384: ca0a256a4307ebcf156c2762fece70f8ca09d413c23939da64ec1fd7c463d7f1d4be082fab6de5a951367faf333bfffc source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/decoders/__init__.py - name: vedastr/models/bodies/feature_extractors/decoders/builder.py size: 194 - sha256: d6be419533d8bb610e06ed6185cfd5b7ff689410cb7f6dbe518e466f794805cc + sha384: 412a7be4a76e23c9e7a5380a4b6829dd6b51a661eac944471c92d80ccdc46a228c04505989ee0d2ff636b19becd7f841 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/decoders/builder.py - name: vedastr/models/bodies/feature_extractors/decoders/registry.py size: 67 - sha256: dac5681aa9fab180b89fd8a908b90d61b70509144a94f6f4b310e5635d11ec3f + sha384: 68a3816e984c561f62a2efc88a36c777828ac26a0fb3a9b453b9fadb0d65c118a3a874cf0e7445398bf265d9e609db81 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/decoders/registry.py - name: vedastr/models/bodies/feature_extractors/decoders/bricks/__init__.py size: 154 - sha256: a56ec8f9286616eaef664a02e08d0920a086a73ec62f44bdf432a9133c0c2fac + sha384: f66787789b1de49dafe59315a14001c73e73ad81c0d2e1b483e1536beadefa4993c5f5f7f48a16404a12a8405336feec source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/decoders/bricks/__init__.py - name: vedastr/models/bodies/feature_extractors/decoders/bricks/bricks.py size: 6933 - sha256: 57ceaf2b71a29a7ba6acd468d361ab379e38552dc4eb242e62b2e7ff9c1eeaad + sha384: a13fe3ac2e365e6d09e58f9437dc3e3e2c62aa06c24c539f39287a4167cb73f4b7e7af5187516675043c195262a385f0 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/decoders/bricks/bricks.py - name: vedastr/models/bodies/feature_extractors/decoders/bricks/builder.py size: 353 - sha256: 4fa170e81acbce61d37339cdb0b960cb49f34ec21451ee3358799f20a358f123 + sha384: 1b50ca0f1411ad3207b14d9196bfae6bdfd5e44b54c84e6fa8a10d52d8fe5b10219a227b4044ddc34902986ec778ccd3 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/decoders/bricks/builder.py - name: vedastr/models/bodies/feature_extractors/decoders/bricks/registry.py size: 63 - sha256: d582690f5bd56e4e1b06ff4928ab03571976ba217e02918dcdaa75af46830d30 + sha384: b2bf466aaa2ca81c57b0542ae7192324019223b081a7efb3ea22baa950669486d4fdde75cf07f34e0898c5b5e8cd6e59 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/decoders/bricks/registry.py - name: vedastr/models/bodies/feature_extractors/encoders/__init__.py size: 123 - sha256: ffad6a4bc0d1dfa307045876aab5a2b932ba63529de8a2b0473675b9c7ce07bd + sha384: be4f67f4d58333fa6af14bfd8582f2f5ea14e3c8248d1bb34ee34b7fd08a288044252d609cf4d4fec15383200acff7ab source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/encoders/__init__.py - name: vedastr/models/bodies/feature_extractors/encoders/builder.py size: 435 - sha256: 092c32f6735e93efd4fa405ed8d5ff6e5abcdf0967ae223e7ad6d2654598e3b3 + sha384: fa291a26fa93a7649e046ef11e19c3bf013e4f1e969bfa903b7b66c882a232f27dea0231b1bd8fcd243283d4050ff634 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/encoders/builder.py - name: vedastr/models/bodies/feature_extractors/encoders/backbones/__init__.py size: 94 - sha256: 049f37e63986f0aa10d89663bf001fb1b4ce389bcd6c3b301b8a791cc3736b26 + sha384: ebff8db1aede61eec6b1770842e179f5963f7d21193cc65aa8e5319ae52e6e52ac7b4bce1b5e21adf485eddc5060ec98 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/encoders/backbones/__init__.py - name: vedastr/models/bodies/feature_extractors/encoders/backbones/builder.py size: 200 - sha256: 376fc32fd5571dab6889e47dbf6035e89179d95a229891855198f98fe664399e + sha384: e739ecebb0a62ad19333adc2bfe028e7f6b2e6e841ef9f6459de51e28808fa043afc5343794978831e68d828bfea8e30 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/encoders/backbones/builder.py - name: vedastr/models/bodies/feature_extractors/encoders/backbones/registry.py size: 69 - sha256: 4600194f8acccc2445fa49b0397e88d5af333142e4deddca802d865af05bec67 + sha384: 922150d8af98734d4dd6057f6c0baed67ee02696d07cb53a81e4ac1bcc427a6d94fcd5c2b3f41bba9b9add037e7f120e source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/encoders/backbones/registry.py - name: vedastr/models/bodies/feature_extractors/encoders/backbones/resnet.py size: 9147 - sha256: 49f68e5d22ebd3964cc9b0cd02ee103d6e25d01816f1e0812ff271bb4e598c85 + sha384: 8a81940db53bc762a75b94794d80f46e9b34a3076386614b201060b7b1f35c04ffb6d8c28f8d73ffef7c41cc0743c5d7 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/encoders/backbones/resnet.py - name: vedastr/models/bodies/feature_extractors/encoders/enhance_modules/__init__.py size: 86 - sha256: eb65f9be2aa9399c401fe688b6571a0504fcc2678d1e07fdf4f0ace0e3276828 + sha384: 87cc8901a0fe0ae44f8d37a3fc04c9a9ac364b1f20babe2807783c7f98618b1c9f24c10d2415d79f18e39e518112b953 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/encoders/enhance_modules/__init__.py - name: vedastr/models/bodies/feature_extractors/encoders/enhance_modules/builder.py size: 230 - sha256: 94761fa992c375b027884c6b93626cc4edb32e9dbcac542381aefff9c2adbf4c + sha384: 4d7574643c3df5364c25e120a97e21d6baedcbe20ecaf546e2d00b7411db517025eab74353db3c3547bccc893e966fb0 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/encoders/enhance_modules/builder.py - name: vedastr/models/bodies/feature_extractors/encoders/enhance_modules/registry.py size: 81 - sha256: fb9e4b4c2f45a31e1ba0ac010c79d5e766bfd98b9e03df15f87d729f90d801a4 + sha384: df139c3acbc88a8dd2d9cadbb314469624e3d17dd0d8d069185fa5cbaa4b0d265f285f9b7fd11a4375cc9edf8a8a6142 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/bodies/feature_extractors/encoders/enhance_modules/registry.py - name: vedastr/models/utils/__init__.py size: 208 - sha256: d6dfeefc0abf7313ff56682bffacb65f997608c9563e6075264502294a5cec64 + sha384: cfec04ffec33171fbc9cd5bcc4a3852f659ebe0411c8e031e24423138e1b6dcae04e425ed665f4de80d69e14f66ac292 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/utils/__init__.py - name: vedastr/models/utils/builder.py size: 329 - sha256: 58639f420f133679db0418ac87c0625200072a9b26bed561c725a80006d0ab94 + sha384: 812796d176490712d3e6b0b3f29fe57db3528c7422dd64841c3fe3b9c54d9f4d157ce23123b8b18c88653b4f06ea2d2d source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/utils/builder.py - name: vedastr/models/utils/conv_module.py size: 7325 - sha256: 91b6a18682905c7b1ed677e87ef97d0584761d8ea3abc93aa28aefbc5978a779 + sha384: 3fba038a67857c3dd7587f958d17bdafdebcd622843d60af24f8d59dfc0f1b9d6f17c14750dfe8d3fd1c179d1377cc79 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/utils/conv_module.py - name: vedastr/models/utils/fc_module.py size: 2650 - sha256: 372f45f7ef3be7fe93215675ea16afab33406555688b7f0461af4bc2d1431be2 + sha384: 7ee9dc75269987659a4de418784efd8549fbcfa78b801a75e4e365bf10c833c20a8a03f83584a2e99182ac7531d87018 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/utils/fc_module.py - name: vedastr/models/utils/norm.py size: 1688 - sha256: 550aec86a72ba818d160d882b82d90790511496d3409b888dad4fa5326eee0d3 + sha384: 3bb4e47aacf3e850ea728365fb42e6c0d5f62661e3ca4da97fe1e20a25eacd2bc20f97cc652071a533ae7735569e2d82 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/utils/norm.py - name: vedastr/models/utils/registry.py size: 62 - sha256: df49a5d64a8312fc995f04c029d6ffd28c1ee6d1c1516833da5e44bd5b36e0c4 + sha384: f40331526d0c838c7d858259d3d7e4a13f040d316dc3ed5ae6cf618f60e42675a8cbcb68ddac31952bf366baf0c21999 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/models/utils/registry.py - name: vedastr/utils/__init__.py size: 255 - sha256: 8d900ac9b39d9a4fe3a98a6cb035276501d5030fa655c73f0eccb174cd43b14b + sha384: 5688acebc5e6389c6eb726769ae99421c43ead7d616693f66b0e824deed01f0d314ef33eb3a008f053639a8144c56500 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/utils/__init__.py - name: vedastr/utils/common.py size: 3255 - sha256: e539de533549841e63c75fa71c18ac36051717e61636c67bbfa3013a4979e976 + sha384: 4b517fc8d3e90b236acd7898f2dcf476e2737541e7df3881146d2006376ad467eca5f66441ce254ac010b75dc7e64c8c source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/utils/common.py - name: vedastr/utils/registry.py size: 1226 - sha256: 991e2c92a2b382ab331c6381ac8cd983a597c85c3c6a9c986931fd191e2f5a61 + sha384: ddf95b80d2f1bc0250635f65b37b8ac20bb477995c249ec5cea26c422cd6ece66a117b269b0bff62161729381f60c0ef source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/utils/registry.py - name: vedastr/utils/config.py size: 5232 - sha256: 03bf002f59877a92624bb1deb0ce3529ebed58f8a476256f2a4561196d1e5594 + sha384: f1a4d00bdc6cde100ae7203644ffa56701aec0e431ff0b2008c20954230e6e94272d695feab52d604e3ae602c3d1ac8d source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/vedastr/utils/config.py - name: vedastr/configs/resnet_fc.py size: 8247 - sha256: a218461bff427aeedf8bf93d2099947361a62ffc5c66e245a19a63e10ac14a77 + sha384: d42ae06175fca6a117fc3e51cb94d04bf2b062ba49611366c4f6eca1500ad07a769ee631927cab1414f86d4b29cc7b30 source: https://raw.githubusercontent.com/Media-Smart/vedastr/0fd2a0bd7819ae4daa2a161501e9f1c2ac67e96a/configs/resnet_fc.py - name: vedastr/ckpt/resnet_fc.pth size: 712199075 - sha256: 4c78128cb1aae415cf17c51aab3d6047f6fd3756cc9e9b25ee110cdda0fa0c52 + sha384: 731cfa8125b4176f3ee668dd78d8f4dc964dc2e60bd1959e07931804a59292c10c94bee6548ee50b8626b09b8f442d07 source: $type: google_drive id: 1OnUGdv9RFhFbQGXUUkWMcxUZg0mPV0kK - name: vedastr/addict-2.4.0-py3-none-any.whl size: 3832 - sha256: 249bb56bbfd3cdc2a004ea0ff4c2b6ddc84d53bc2194761636eb314d5cfa5dfc + sha384: 0b3d7c226551078ffcd70e4d512194f2cb67c6c06dc8c7a7b8001752b842b934990817f9236f73fb7c38cba5573205ab source: https://files.pythonhosted.org/packages/6a/00/b08f23b7d7e1e14ce01419a467b583edbb93c6cdb8654e54a9cc579cd61f/addict-2.4.0-py3-none-any.whl postprocessing: - $type: regex_replace diff --git a/models/public/ultra-lightweight-face-detection-rfb-320/model.yml b/models/public/ultra-lightweight-face-detection-rfb-320/model.yml index e7c92611d2e..eca3f319699 100644 --- a/models/public/ultra-lightweight-face-detection-rfb-320/model.yml +++ b/models/public/ultra-lightweight-face-detection-rfb-320/model.yml @@ -23,7 +23,7 @@ task_type: detection files: - name: ultra-lightweight-face-detection-rfb-320.onnx size: 1270727 - sha256: 34cd7e60aeff28744c657de7a3dc64e872d506741de66987f3426f2b79f88017 + sha384: c3f6a4f672d157dbed29d1757e8f72c8b66c357f2b321b7869b92b983d47d1f0af448e7ea1b6eefd4c41c2780377d153 source: https://raw.githubusercontent.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB/3cb8d7f9a9e418ab594b5b0bb349756a49699517/models/onnx/version-RFB-320.onnx model_optimizer_args: - --input_shape=[1,3,240,320] diff --git a/models/public/ultra-lightweight-face-detection-slim-320/model.yml b/models/public/ultra-lightweight-face-detection-slim-320/model.yml index 9e0a4b1ab52..aba6937d931 100644 --- a/models/public/ultra-lightweight-face-detection-slim-320/model.yml +++ b/models/public/ultra-lightweight-face-detection-slim-320/model.yml @@ -23,7 +23,7 @@ task_type: detection files: - name: ultra-lightweight-face-detection-slim-320.onnx size: 1195330 - sha256: e9adbd0f920ddcce9368434c4d34d72520dc0c19b526fd44b4ef49bde2c3b1a8 + sha384: c6d986113c002b0b8758ba717cff298f7731220e142dd7301bc2349028820fb8dd8942386ab70668b0999bf17d8b818c source: https://raw.githubusercontent.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB/3cb8d7f9a9e418ab594b5b0bb349756a49699517/models/onnx/version-slim-320.onnx model_optimizer_args: - --input_shape=[1,3,240,320] diff --git a/models/public/vehicle-license-plate-detection-barrier-0123/model.yml b/models/public/vehicle-license-plate-detection-barrier-0123/model.yml index 6675ed02793..4771dc64136 100644 --- a/models/public/vehicle-license-plate-detection-barrier-0123/model.yml +++ b/models/public/vehicle-license-plate-detection-barrier-0123/model.yml @@ -19,7 +19,7 @@ task_type: detection files: - name: ssd-mobilenet-v2-0.35.1-barrier-256x256-0123.tar.gz size: 4387714 - sha256: de6744bc72339f29109f595bc51b47383595ffb06ed15a7438f2ae9cb8a2a77c + sha384: 71a1b74e9612204e4533d44a8eff105490bb3248043d22ef894c19d5da4fb135a989946307b86191ba4ec2ce391b34bf source: https://download.01.org/opencv/openvino_training_extensions/models/ssd_detector/ssd-mobilenet-v2-0.35.1-barrier-256x256-0123.tar.gz postprocessing: - $type: unpack_archive diff --git a/models/public/vehicle-reid-0001/model.yml b/models/public/vehicle-reid-0001/model.yml index 2bf229c673f..429d82624e8 100644 --- a/models/public/vehicle-reid-0001/model.yml +++ b/models/public/vehicle-reid-0001/model.yml @@ -22,7 +22,7 @@ task_type: object_attributes files: - name: osnet_ain_x1_0_vehicle_reid.onnx size: 8836743 - sha256: 4aaad3e5db648618b0df3d2ff21c61323985ff9e50194c3d2edd4fb87c92d91f + sha384: 0515ce72f653c39780d5b87dfed7255d396dd2b1e8b6e91fbaacdfad1da189166343157273c02f3b0fede3050ef7abb7 source: $type: google_drive id: 1MEtaIr_9mWuntGD9edydFl_T5waloNRm diff --git a/models/public/vgg16/model.yml b/models/public/vgg16/model.yml index 4372d1ef6c3..d13ec305808 100644 --- a/models/public/vgg16/model.yml +++ b/models/public/vgg16/model.yml @@ -26,11 +26,11 @@ task_type: classification files: - name: vgg16.prototxt size: 4776 - sha256: 9fdb04e3f5b9224af473e82441b05b76368dfa6dc841e80655303823e9770962 + sha384: 02ecff319e3fab8e68232ad5a8a5a4d91f2f49b00f15b868674cd59ef33a4b0c216d751ae60c07411fa3fdf3af795faa source: https://gist.githubusercontent.com/ksimonyan/211839e770f7b538e2d8/raw/0067c9b32f60362c74f4c445a080beed06b07eb3/VGG_ILSVRC_16_layers_deploy.prototxt - name: vgg16.caffemodel size: 553432081 - sha256: a6196bc498e45ea4cb2637114ae8db9410cf1556fd60a55ae93272371beba197 + sha384: 8ed7890af721fa22a9a356c00ec8360984f572b37991d1a5d70993ece85a0d25d675f02ff27c443523be1b61b9bb3d15 source: http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_16_layers.caffemodel postprocessing: - $type: regex_replace diff --git a/models/public/vgg19-caffe2/model.yml b/models/public/vgg19-caffe2/model.yml index fa3fd05a90d..ecace79f254 100644 --- a/models/public/vgg19-caffe2/model.yml +++ b/models/public/vgg19-caffe2/model.yml @@ -20,11 +20,11 @@ task_type: classification files: - name: predict_net.pb size: 2862 - sha256: ebb8608fe80ee8bce096a60ecf3e6e8442eb118aaa0fa77d5d58b5dcff7dfb5f + sha384: c7f106946b34ddfa05cb71b0a8d46dbc608b07796e1b0182e1f0acd5fa5607338c552115381e78cebaf8fcd0d188dbc6 source: https://s3.amazonaws.com/download.caffe2.ai/models/vgg19/predict_net.pb - name: init_net.pb size: 718338501 - sha256: 492dbbbc7dd23cb052c66964714759f88370f3fa8542aa32556e93abc7beb69f + sha384: f68fded92d0c949a881a581bb0f697fc2c51936065444811aaf69047adb5cfbf473cb246fbce86239d38a7786eeb917c source: https://s3.amazonaws.com/download.caffe2.ai/models/vgg19/init_net.pb framework: caffe2 quantizable: yes diff --git a/models/public/vgg19/model.yml b/models/public/vgg19/model.yml index d81c3af20fd..bf1b4df44dd 100644 --- a/models/public/vgg19/model.yml +++ b/models/public/vgg19/model.yml @@ -26,11 +26,11 @@ task_type: classification files: - name: vgg19.prototxt size: 5499 - sha256: e7c9da46d837dd91049ddab46a57933a488e3d8a42162cdef51ab1edeff99725 + sha384: f3c8a34cbaba8c92fbd7744f4a26d244555e1b9a541fef3294622483b316465dad2363bdbab548dfd6733da66213a2d3 source: https://gist.githubusercontent.com/ksimonyan/3785162f95cd2d5fee77/raw/f02f8769e64494bcd3d7e97d5d747ac275825721/VGG_ILSVRC_19_layers_deploy.prototxt - name: vgg19.caffemodel size: 574671192 - sha256: 31b4c627c40c6ee151325f079b7ac557fddbd1f79af932888796127a4f4f6954 + sha384: 86b83739d448a81ddc927922d4d7581e06113478106b59480097b02cc63ff51c9da7c3cd8a865b08946d07d0281d5b2e source: http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_19_layers.caffemodel postprocessing: - $type: regex_replace diff --git a/models/public/vitstr-small-patch16-224/model.yml b/models/public/vitstr-small-patch16-224/model.yml index 57110f09517..4f48fa3240f 100644 --- a/models/public/vitstr-small-patch16-224/model.yml +++ b/models/public/vitstr-small-patch16-224/model.yml @@ -25,15 +25,15 @@ task_type: optical_character_recognition files: - name: timm-0.4.12-py3-none-any.whl size: 376973 - sha256: dba6b1702b7d24bf9f0f1c2fc394b4ee28f93cde5404f1dc732d63ccd00533b6 + sha384: e5030b792501314113ca804b3b00d35d89c40d0a92d53aa0c41e2a83697d11ef5ea8c73ed1c0bec28c4791047c9dd1b3 source: https://files.pythonhosted.org/packages/90/fc/606bc5cf46acac3aa9bd179b3954433c026aaf88ea98d6b19f5d14c336da/timm-0.4.12-py3-none-any.whl - name: modules/vitstr.py size: 8363 - sha256: 6087e15cebb765987adba7c225393e11dd74375e15b29d7e3e221070958ee37b + sha384: 90e14135b5a23aad667fbde7581f0142a572b096d3ef6fb4d969f6b6069ce1369eebad916b24e11a1b57768b197d7244 source: https://raw.githubusercontent.com/roatienza/deep-text-recognition-benchmark/c937d69388dbaa1c4a776badb2670344b39d0942/modules/vitstr.py - name: vitstr_small_patch16_224.pth size: 86086343 - sha256: 88812f6d9508fb6fcb58ead5329c02d82cfc5f9268e35471991ade5ba610d069 + sha384: 529c216830a23a2b9d7f6782515deca4a2f99aa42a22440e1997182d092b8db5a64718dda0df47cdc6ca3d51ecec5a97 source: https://github.com/roatienza/deep-text-recognition-benchmark/releases/download/v0.1.0/vitstr_small_patch16_224.pth postprocessing: - $type: unpack_archive diff --git a/models/public/wav2vec2-base/model.yml b/models/public/wav2vec2-base/model.yml index 48729be3cc8..f04eed2004a 100644 --- a/models/public/wav2vec2-base/model.yml +++ b/models/public/wav2vec2-base/model.yml @@ -28,23 +28,23 @@ task_type: named_entity_recognition files: - name: transformers-4.8.2-py3-none-any.whl size: 2499371 - sha256: a81a7683013fb48690c47e4e2d12a6c6e744b4261ae085f9a98d09f6c3e61d98 + sha384: 91713fbb6bf46b5a216c3336260cc03e7d2c7cbd031e810d22feeed0865f9e0f5d7a87c45f7d60669587cbc9548c30c1 source: https://files.pythonhosted.org/packages/fd/1a/41c644c963249fd7f3836d926afa1e3f1cc234a1c40d80c5f03ad8f6f1b2/transformers-4.8.2-py3-none-any.whl - name: wav2vec2-base-960h/pytorch_model.bin size: 377667514 - sha256: c34f9827b034a1b9141dbf6f652f8a60eda61cdf5771c9e05bfa99033c92cd96 + sha384: 647658a0fc4376ddccb8430207fd50f22a59f607f821ddb6e7dfec7bf2f41d3bbe4d6e62c2779530f1a2e20ec75acf9b source: https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/pytorch_model.bin - name: wav2vec2-base-960h/config.json size: 1596 - sha256: d3ec255c063d9f95057b553b19c20135b259875834a4fe9deb218a6be25b4cf3 + sha384: 1c28d7ba60f46b0212c73afde1ff9a77a0bc2801c3dc6bcac77835ed147e0df49a28bc627c0a76b1f6b8959170e7627b source: https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json - name: wav2vec2-base-960h/vocab.json size: 291 - sha256: 19727f8944fe6459fc3f240ae2c198395b740f6a029bd23e06656266b83bcf64 + sha384: 87dc62dd416ca1d37674e5169d701d443b0644f23c0584d52b5813d025ebb5cecf9ea64850c4c09fe10766e7b2e8435c source: https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/vocab.json - name: packaging-20.9-py2.py3-none-any.whl size: 40870 - sha256: 67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a + sha384: 422fac4cb009bed3eae42e9688b1712ee15dde1799c888f33c802792e925373dee046602d1d31c460d9d2af3ff6b93a1 source: https://files.pythonhosted.org/packages/3e/89/7ea760b4daa42653ece2380531c90f64788d979110a2ab51049d92f408af/packaging-20.9-py2.py3-none-any.whl postprocessing: - $type: unpack_archive diff --git a/models/public/wavernn/wavernn-rnn/model.yml b/models/public/wavernn/wavernn-rnn/model.yml index 7ccac4fbff9..f6436c513df 100644 --- a/models/public/wavernn/wavernn-rnn/model.yml +++ b/models/public/wavernn/wavernn-rnn/model.yml @@ -18,7 +18,7 @@ task_type: text_to_speech files: - name: wavernn-rnn.zip size: 14297518 - sha256: bcde8bb9cda28092e2356d38856c35a2ca33531294b65fcb7ea9f432f041960c + sha384: 77186c83348d404c547d5706af7541d9a5cb430ed4236595d4f5b5f5e034d01ee5a74e3d39307324d5cdac5007cd013a source: https://download.01.org/opencv/public_models/102020/wavernn/wavernn-rnn.zip postprocessing: - $type: unpack_archive diff --git a/models/public/wavernn/wavernn-upsampler/model.yml b/models/public/wavernn/wavernn-upsampler/model.yml index 21dde0564d4..483dc8f6970 100644 --- a/models/public/wavernn/wavernn-upsampler/model.yml +++ b/models/public/wavernn/wavernn-upsampler/model.yml @@ -18,7 +18,7 @@ task_type: text_to_speech files: - name: wavernn-upsampler.zip size: 1496559 - sha256: f6f3982f785ab2d78a30d8c08fef952c2bfaa89a835c15cd7c27798ff0b6d2c9 + sha384: 7d27cf5e68dd9e66a5a6cf800a4f6114819eb1cd8e103cea4b9cf15e1dd0b163ce382f76aaa19e24033fa09e347ba2ef source: https://download.01.org/opencv/public_models/102020/wavernn/wavernn-upsampler.zip postprocessing: - $type: unpack_archive diff --git a/models/public/yolact-resnet50-fpn-pytorch/model.yml b/models/public/yolact-resnet50-fpn-pytorch/model.yml index 092501c940a..cd6c6f77a8b 100644 --- a/models/public/yolact-resnet50-fpn-pytorch/model.yml +++ b/models/public/yolact-resnet50-fpn-pytorch/model.yml @@ -23,31 +23,31 @@ task_type: instance_segmentation files: - name: yolact/yolact.py size: 31516 - sha256: b8d43734955dbcedddaa781643000d49309a10d7a3113d8333891d879459f8bb + sha384: 8e3b27af4ba4d68600fa37dc9c3716890f41306904c92da4a6f5ff1ee9447d1301835d62d33710a6833d7e8e02c744a1 source: https://raw.githubusercontent.com/dbolya/yolact/57b8f2d95e62e2e649b382f516ab41f949b57239/yolact.py - name: yolact/backbone.py size: 17286 - sha256: 66e53aa5bd7ad35f978a13f3f5c82728a7c073c463c2a2b22a67f924008ed6a7 + sha384: 9f507122dfe8c164343d7f302668afc671f3d730e14a454d859e7ccff77e92a77ecf027cccce6eba9ae76f4a3f98594c source: https://raw.githubusercontent.com/dbolya/yolact/57b8f2d95e62e2e649b382f516ab41f949b57239/backbone.py - name: yolact/data/config.py size: 31172 - sha256: f1386cb5787eb260638f127a8bb6d04843506c527aa85c655574967819238139 + sha384: f7f77e46e09d6b2912dee1b9f4bde3a16e79b769eba43b0cac0c53070345bcf3d169752ae60159f134ee44d7a5d70670 source: https://raw.githubusercontent.com/dbolya/yolact/57b8f2d95e62e2e649b382f516ab41f949b57239/data/config.py - name: yolact/utils/timer.py size: 3508 - sha256: 082ecd0fdd58a9e66fa7e8e9618e22ed3886ca1ceef286aa9e265d98bf35cfd2 + sha384: 4b2161e5216da3be3089b3d391da206ad3f69b596c9d55353e399de99fa69f17e42803b6a65ac1cbebd62910e6a90dc5 source: https://raw.githubusercontent.com/dbolya/yolact/57b8f2d95e62e2e649b382f516ab41f949b57239/utils/timer.py - name: yolact/utils/functions.py size: 6503 - sha256: e3adc9e8121c0a20c95539bee00045f541427d883fdbbb8ca05a0d160203c902 + sha384: 1940ef89ddc62704f1508673c81ed289689644f5c58b23bd1ccbbc2f29fddafd105c0f0f84c6ca2182a1c7343ae99def source: https://raw.githubusercontent.com/dbolya/yolact/57b8f2d95e62e2e649b382f516ab41f949b57239/utils/functions.py - name: yolact/layers/interpolate.py size: 412 - sha256: e502fdd29086933d3a5aa10cfaa19b3063d97609e0aed217771001d9b87251a3 + sha384: f8780a33988fb04c0408f22735f72eb0780295ebc5f5c3a316fabdc1985e957b007deeb525f2980169c46c7e0bfcf407 source: https://raw.githubusercontent.com/dbolya/yolact/57b8f2d95e62e2e649b382f516ab41f949b57239/layers/interpolate.py - name: yolact/yolact_resnet50_54_800000.pth size: 127300392 - sha256: c12bb7a7e0343281db7f1407b376970bb52651f121d0b60bc4a49207acb6d6d7 + sha384: 7ef5b5367fd30871c77814500bbecbaf32f0a9e5721bba0a1cc4479e78e4d6ed25363ebfe6982b94189a11da1e45cf78 source: $type: google_drive id: 1yp7ZbbDwvMiFJEq4ptVKTYTI2VeRDXl0 diff --git a/models/public/yolo-v1-tiny-tf/model.yml b/models/public/yolo-v1-tiny-tf/model.yml index 1eceab97e41..a8f1dd97dc6 100644 --- a/models/public/yolo-v1-tiny-tf/model.yml +++ b/models/public/yolo-v1-tiny-tf/model.yml @@ -19,7 +19,7 @@ task_type: detection files: - name: yolo-v1-tiny.pb size: 63501195 - sha256: b0643910184ea5efbb93f708339eee3e0bc8c9c6b8bf67d51c5cfc32f329a507 + sha384: b25e5dfb0c140e06d97ac8c0cf8c44f167a6287f1d4a883d41897973643628efd41621389fb1a27dda7cb404400688e9 source: https://download.01.org/opencv/public_models/022020/tiny_yolo_v1/saved_model.pb model_optimizer_args: - --input_shape=[1,416,416,3] diff --git a/models/public/yolo-v2-tf/model.yml b/models/public/yolo-v2-tf/model.yml index 67d8bf6b75e..abe7bc170ca 100644 --- a/models/public/yolo-v2-tf/model.yml +++ b/models/public/yolo-v2-tf/model.yml @@ -21,7 +21,7 @@ task_type: detection files: - name: yolo-v2.pb size: 203970473 - sha256: 37163e414a912ecc44ebdcf40ff172c748cfb08264141eadad1fdaf3f96ba369 + sha384: d97d0e4736a210879c1e3db84e19a7b9cf8dd138350d66ef65715514a1ce361ec822133789020b6adca9bd25f0d73817 source: https://download.01.org/opencv/public_models/102020/yolo-v2-tf/yolo-v2.pb model_optimizer_args: - --input_shape=[1,608,608,3] diff --git a/models/public/yolo-v2-tiny-tf/model.yml b/models/public/yolo-v2-tiny-tf/model.yml index 0f31a395fca..897ead5e35f 100644 --- a/models/public/yolo-v2-tiny-tf/model.yml +++ b/models/public/yolo-v2-tiny-tf/model.yml @@ -21,23 +21,23 @@ task_type: detection files: - name: yolov2-tiny.weights size: 44948600 - sha256: 16f4e870f1aed83f0089cb69bfda6b53cb7b2a4a01721be56eaf5c899dfac45f + sha384: 48109100a3414fce39d57c8dd1feaee8714423e473f9d4dfd2cf8e1aa23f7e0e5920b9362ad7e3c804f24522e06fe536 source: https://pjreddie.com/media/files/yolov2-tiny.weights - name: keras-YOLOv3-model-set/tools/model_converter/convert.py size: 12937 - sha256: 12350fbfa942b66fad8a80af100bc14605c9cdcd8508f3eb5cf26647f64d733e + sha384: fd6d1550e3843bc4ae27d1cf53ade56606a01c2162d149bc58ed8d654dfbbe59754a2bfd8e8ca508ecee663b38f6e7bf source: https://github.com/david8862/keras-YOLOv3-model-set/raw/d38c3d865f7190ee9b19a30e91f2b750a31320c1/tools/model_converter/convert.py - name: keras-YOLOv3-model-set/tools/model_converter/keras_to_tensorflow.py size: 8370 - sha256: 1cc02cf4ec76760c05bc1635654247ba56b9a1864b63fd05534b836bc93e44e7 + sha384: 1be7f22eafa2c9fd54457938bebbe4d572b7b2abdfed9a1fd720bbb52cdc96151839726957aa8c7dde9cd3abb332807e source: https://github.com/david8862/keras-YOLOv3-model-set/raw/d38c3d865f7190ee9b19a30e91f2b750a31320c1/tools/model_converter/keras_to_tensorflow.py - name: keras-YOLOv3-model-set/common/utils.py size: 5002 - sha256: 90146775879f294e1f1a82c7e35a5be29d815b7a9b14dbe12ba29dd16b3d10a8 + sha384: 7acd0f55fb4c1a0f00df46c2383309bc12715d66c09adb9bcb22d6aea2555ef0478d2d7147fe5cd8de770a23008e4958 source: https://github.com/david8862/keras-YOLOv3-model-set/raw/d38c3d865f7190ee9b19a30e91f2b750a31320c1/common/utils.py - name: keras-YOLOv3-model-set/cfg/yolov2-tiny.cfg size: 1488 - sha256: 58e8f4390c8080a90a40f3b7ec5868ee9ae32519f3c08f57d104e494de04b34d + sha384: bb52511d6b3c33a066bcd2e41a86d300c854e73b74b9064bb5bfe510ef8801315228abc5e5a89e7dacb3e0c330ed07cd source: https://github.com/david8862/keras-YOLOv3-model-set/raw/d38c3d865f7190ee9b19a30e91f2b750a31320c1/cfg/yolov2-tiny.cfg postprocessing: # disable imports that aren't needed for this model and code that uses them diff --git a/models/public/yolo-v3-onnx/README.md b/models/public/yolo-v3-onnx/README.md new file mode 100644 index 00000000000..4f7e245cafc --- /dev/null +++ b/models/public/yolo-v3-onnx/README.md @@ -0,0 +1,130 @@ +# yolo-v3-onnx + +## Use Case and High-Level Description + +YOLO v3 is a real-time object detection model in ONNX\* format from the [repository](https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/yolov3) which is converted from Keras\* model [repository](https://github.com/qqwweee/keras-yolo3) using keras2onnx [converter](https://github.com/onnx/keras-onnx). This model was pre-trained on [Common Objects in Context (COCO)](https://cocodataset.org/#home) dataset with 80 classes. + +## Specification + +| Metric | Value | +|-------------------|---------------| +| Type | Detection | +| GFLOPs | 65.998 | +| MParams | 61.930 | +| Source framework | ONNX\* | + +## Accuracy + +Accuracy metrics obtained on [Common Objects in Context (COCO)](https://cocodataset.org/#home) validation dataset for converted model. + +| Metric | Value | +| ----------------------------------------------------- | -------| +| mAP | 48.30% | +| [COCO mAP](https://cocodataset.org/#detection-eval) | 47.07% | + +## Input + +### Original model + +1. Image, name - `input_1`, shape - `1, 3, 416, 416`, format is `B, C, H, W`, where: + + - `B` - batch size + - `C` - channel + - `H` - height + - `W` - width + + Channel order is `RGB`. + Scale value - 255. + +2. Information of input image size, name: `image_shape`, shape: `1, 2`, format: `B, C`, where: + + - `B` - batch size + - `C` - vector of 2 values in format `H, W`, where `H` is an image height, `W` is an image width. + +### Converted model + +1. Image, name - `input_1`, shape - `1, 3, 416, 416`, format is `B, C, H, W`, where: + + - `B` - batch size + - `C` - channel + - `H` - height + - `W` - width + + Channel order is `BGR`. + +2. Information of input image size, name: `image_shape`, shape: `1, 2`, format: `B, C`, where: + + - `B` - batch size + - `C` - vector of 2 values in format `H, W`, where `H` is an image height, `W` is an image width. + +## Output + +### Original model + +1. Boxes coordinates, name - `yolonms_layer_1/ExpandDims_1:0`, shape - `1, 10647, 4`, format - `B, N, 4`, where: + + - `B` - batch size + - `N` - number of candidates + +2. Scores of boxes per class, name - `yolonms_layer_1/ExpandDims_3:0`, shape - `1, 80, 10647`, format - `B, 80, N`, where: + + - `B` - batch size + - `N` - number of candidates + +3. Selected indices from the boxes tensor, name - `yolonms_layer_1/concat_2:0`, shape - `1, 1600, 3`, format - `B, N, 3`, where: + + - `B` - batch size + - `N` - number of detection boxes + +Each index has format [`b_idx`, `cls_idx`, `box_idx`], where: + +- `b_idx` - batch index +- `cls_idx` - class_index +- `box_idx`- box_index + +The model was trained on [Common Objects in Context (COCO)](https://cocodataset.org/#home) dataset version with 80 categories of object. Mapping to class names provided in `/data/dataset_classes/coco_80cl.txt` file. + +### Converted model + +1. Boxes coordinates, name - `yolonms_layer_1/ExpandDims_1:0`, shape - `1, 10647, 4`, format - `B, N, 4`, where: + + - `B` - batch size + - `N` - number of candidates + +2. Scores of boxes per class, name - `yolonms_layer_1/ExpandDims_3:0`, shape - `1, 80, 10647`, format - `B, 80, N`, where: + + - `B` - batch size + - `N` - number of candidates + +3. Selected indices from the boxes tensor, name - `yolonms_layer_1/concat_2:0`, shape - `1, 1600, 3`, format - `B, N, 3`, where: + + - `B` - batch size + - `N` - number of detection boxes + +Each index has format [`b_idx`, `cls_idx`, `box_idx`], where: + +- `b_idx` - batch index +- `cls_idx` - class_index +- `box_idx`- box_index + +The model was trained on [Common Objects in Context (COCO)](https://cocodataset.org/#home) dataset version with 80 categories of object. Mapping to class names provided in `/data/dataset_classes/coco_80cl.txt` file. + +## Download a Model and Convert it into Inference Engine Format + +You can download models and if necessary convert them into Inference Engine format using the [Model Downloader and other automation tools](../../../tools/model_tools/README.md) as shown in the examples below. + +An example of using the Model Downloader: +``` +omz_downloader --name +``` + +An example of using the Model Converter: +``` +omz_converter --name +``` + +## Legal Information + +The original model is distributed under the +[Apache License, Version 2.0](https://raw.githubusercontent.com/onnx/models/master/LICENSE). +A copy of the license is provided in `/models/public/licenses/APACHE-2.0.txt`. diff --git a/models/public/yolo-v3-onnx/accuracy-check.yml b/models/public/yolo-v3-onnx/accuracy-check.yml new file mode 100644 index 00000000000..8a6dc6486a0 --- /dev/null +++ b/models/public/yolo-v3-onnx/accuracy-check.yml @@ -0,0 +1,72 @@ +models: + - name: yolo-v3-onnx + launchers: + - framework: onnx_runtime + model: yolov3-10.onnx + adapter: + type: yolo_v3_onnx + boxes_out: yolonms_layer_1/ExpandDims_1:0 + scores_out: yolonms_layer_1/ExpandDims_3:0 + indices_out: yolonms_layer_1/concat_2:0 + inputs: + - name: image_shape + type: ORIG_IMAGE_INFO + datasets: + - name: ms_coco_detection_80_class_without_background + reader: pillow_imread + preprocessing: + - type: resize + size: 416 + interpolation: BICUBIC + use_pillow: True + aspect_ratio_scale: fit_to_window + - type: padding + pad_value: 128, 128, 128 + size: 416 + - type: normalization + std: 255 + metrics: + - type: map + integral: 11point + ignore_difficult: true + presenter: print_scalar + reference: 0.483 + - type: coco_precision + max_detections: 100 + threshold: 0.5 + reference: 0.4707 + + - name: yolo-v3-onnx + launchers: + - framework: dlsdk + adapter: + type: yolo_v3_onnx + boxes_out: yolonms_layer_1/ExpandDims_1:0 + scores_out: yolonms_layer_1/ExpandDims_3:0 + indices_out: yolonms_layer_1/concat_2:0 + inputs: + - name: image_shape + type: ORIG_IMAGE_INFO + datasets: + - name: ms_coco_detection_80_class_without_background + reader: pillow_imread + preprocessing: + - type: rgb_to_bgr + - type: resize + size: 416 + interpolation: BICUBIC + use_pillow: True + aspect_ratio_scale: fit_to_window + - type: padding + pad_value: 128, 128, 128 + size: 416 + metrics: + - type: map + integral: 11point + ignore_difficult: true + presenter: print_scalar + reference: 0.483 + - type: coco_precision + max_detections: 100 + threshold: 0.5 + reference: 0.4707 diff --git a/models/public/yolo-v3-onnx/model.yml b/models/public/yolo-v3-onnx/model.yml new file mode 100644 index 00000000000..2b2143e24be --- /dev/null +++ b/models/public/yolo-v3-onnx/model.yml @@ -0,0 +1,35 @@ +# Copyright (c) 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +description: >- + YOLO v3 is a real-time object detection model in ONNX* format from the repository + + which is converted from Keras* model repository + using keras2onnx converter . This model was + pre-trained on Common Objects in Context + dataset with 80 classes. +task_type: detection +files: + - name: yolov3-10.onnx + sha384: 832bb4c2be2f9a0eb3e69c426ceaadf472ef260802995fc694b5e8e36a63f0bdfe005058d16e18f091bfdefde3489746 + size: 247908721 + source: https://media.githubusercontent.com/media/onnx/models/41ccf18ba5a815dab714899ac234e9b1e4293c20/vision/object_detection_segmentation/yolov3/model/yolov3-10.onnx +model_optimizer_args: + - --input_shape=[1,3,416,416],[1,2] + - --input=input_1,image_shape + - --scale_values=input_1[255] + - --reverse_input_channels + - --input_model=$dl_dir/yolov3-10.onnx +framework: onnx +license: https://raw.githubusercontent.com/onnx/models/master/LICENSE diff --git a/models/public/yolo-v3-tf/model.yml b/models/public/yolo-v3-tf/model.yml index 34ca472d161..261918954ad 100644 --- a/models/public/yolo-v3-tf/model.yml +++ b/models/public/yolo-v3-tf/model.yml @@ -21,11 +21,11 @@ task_type: detection files: - name: yolo-v3.pb size: 248128731 - sha256: 8ed66d597a936924e98102a5fa16b38569452e17dbb52ddf2877e0f550f57952 + sha384: 169977adef481096e57b73d0602ec9f0a85bd692ad90bd46afcf97d1d808ccfa3d1beb719d91cfd22e6e463e0b27a2bd source: https://download.01.org/opencv/public_models/022020/yolo_v3/yolov3.pb - name: yolo-v3.json size: 384 - sha256: 90f3ea735a2a8908b66dab744b9ec0425fd2564f7b9be6ebd1564dd38d28ec5c + sha384: 9367c59fbd1208675cfa40fc6ebe1c73c1d316e14d59fc7226d2773ed6d0e9d83b276a294db705ace92f60c7a83e1ad6 source: https://download.01.org/opencv/public_models/022020/yolo_v3/yolo_v3_new.json model_optimizer_args: - --input_shape=[1,416,416,3] diff --git a/models/public/yolo-v3-tiny-onnx/README.md b/models/public/yolo-v3-tiny-onnx/README.md new file mode 100644 index 00000000000..31debfbcc73 --- /dev/null +++ b/models/public/yolo-v3-tiny-onnx/README.md @@ -0,0 +1,130 @@ +# yolo-v3-tiny-onnx + +## Use Case and High-Level Description + +Tiny YOLO v3 is a smaller version of real-time object detection YOLO v3 model in ONNX\* format from the [repository](https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/yolov3) which is converted from Keras\* model [repository](https://github.com/qqwweee/keras-yolo3) using keras2onnx [converter](https://github.com/onnx/keras-onnx). This model was pre-trained on [Common Objects in Context (COCO)](https://cocodataset.org/#home) dataset with 80 classes. + +## Specification + +| Metric | Value | +|-------------------|---------------| +| Type | Detection | +| GFLOPs | 5.582 | +| MParams | 8.8509 | +| Source framework | ONNX\* | + +## Accuracy + +Accuracy metrics obtained on [Common Objects in Context (COCO)](https://cocodataset.org/#home) validation dataset for converted model. + +| Metric | Value | +| ----------------------------------------------------- | -------| +| mAP | 17.07% | +| [COCO mAP](https://cocodataset.org/#detection-eval) | 13.64% | + +## Input + +### Original model + +1. Image, name - `input_1`, shape - `1, 3, 416, 416`, format is `B, C, H, W`, where: + + - `B` - batch size + - `C` - channel + - `H` - height + - `W` - width + + Channel order is `RGB`. + Scale value - 255. + +2. Information of input image size, name: `image_shape`, shape: `1, 2`, format: `B, C`, where: + + - `B` - batch size + - `C` - vector of 2 values in format `H, W`, where `H` is an image height, `W` is an image width. + +### Converted model + +1. Image, name - `input_1`, shape - `1, 3, 416, 416`, format is `B, C, H, W`, where: + + - `B` - batch size + - `C` - channel + - `H` - height + - `W` - width + + Channel order is `BGR`. + +2. Information of input image size, name: `image_shape`, shape: `1, 2`, format: `B, C`, where: + + - `B` - batch size + - `C` - vector of 2 values in format `H, W`, where `H` is an image height, `W` is an image width. + +## Output + +### Original model + +1. Boxes coordinates, name - `yolonms_layer_1`, shape - `1, 2535, 4`, format - `B, N, 4`, where: + + - `B` - batch size + - `N` - number of candidates + +2. Scores of boxes per class, name - `yolonms_layer_1:1`, shape - `1, 80, 2535`, format - `B, 80, N`, where: + + - `B` - batch size + - `N` - number of candidates + +3. Selected indices from the boxes tensor, name - `yolonms_layer_1:2`, shape - `1, 1600, 3`, format - `B, N, 3`, where: + + - `B` - batch size + - `N` - number of detection boxes + +Each index has format [`b_idx`, `cls_idx`, `box_idx`], where: + +- `b_idx` - batch index +- `cls_idx` - class_index +- `box_idx`- box_index + +The model was trained on [Common Objects in Context (COCO)](https://cocodataset.org/#home) dataset version with 80 categories of object. Mapping to class names provided in `/data/dataset_classes/coco_80cl.txt` file. + +### Converted model + +1. Boxes coordinates, name - `yolonms_layer_1`, shape - `1, 2535, 4`, format - `B, N, 4`, where: + + - `B` - batch size + - `N` - number of candidates + +2. Scores of boxes per class, name - `yolonms_layer_1:1`, shape - `1, 80, 2535`, format - `B, 80, N`, where: + + - `B` - batch size + - `N` - number of candidates + +3. Selected indices from the boxes tensor, name - `yolonms_layer_1:2`, shape - `1, 1600, 3`, format - `B, N, 3`, where: + + - `B` - batch size + - `N` - number of detection boxes + +Each index has format [`b_idx`, `cls_idx`, `box_idx`], where: + +- `b_idx` - batch index +- `cls_idx` - class_index +- `box_idx`- box_index + +The model was trained on [Common Objects in Context (COCO)](https://cocodataset.org/#home) dataset version with 80 categories of object. Mapping to class names provided in `/data/dataset_classes/coco_80cl.txt` file. + +## Download a Model and Convert it into Inference Engine Format + +You can download models and if necessary convert them into Inference Engine format using the [Model Downloader and other automation tools](../../../tools/model_tools/README.md) as shown in the examples below. + +An example of using the Model Downloader: +``` +omz_downloader --name +``` + +An example of using the Model Converter: +``` +omz_converter --name +``` + +## Legal Information + +The original model is distributed under the +[Apache License, Version 2.0](https://raw.githubusercontent.com/onnx/models/master/LICENSE). +A copy of the license is provided in `/models/public/licenses/APACHE-2.0.txt`. diff --git a/models/public/yolo-v3-tiny-onnx/accuracy-check.yml b/models/public/yolo-v3-tiny-onnx/accuracy-check.yml new file mode 100644 index 00000000000..341e2d57b1c --- /dev/null +++ b/models/public/yolo-v3-tiny-onnx/accuracy-check.yml @@ -0,0 +1,72 @@ +models: + - name: yolo-v3-tiny-onnx + launchers: + - framework: onnx_runtime + model: tiny-yolov3-11.onnx + adapter: + type: yolo_v3_onnx + boxes_out: yolonms_layer_1 + scores_out: yolonms_layer_1:1 + indices_out: yolonms_layer_1:2 + inputs: + - name: image_shape + type: ORIG_IMAGE_INFO + datasets: + - name: ms_coco_detection_80_class_without_background + reader: pillow_imread + preprocessing: + - type: resize + size: 416 + interpolation: BICUBIC + use_pillow: True + aspect_ratio_scale: fit_to_window + - type: padding + pad_value: 128, 128, 128 + size: 416 + - type: normalization + std: 255 + metrics: + - type: map + integral: 11point + ignore_difficult: true + presenter: print_scalar + reference: 0.1707 + - type: coco_precision + max_detections: 100 + threshold: 0.5 + reference: 0.1364 + + - name: yolo-v3-tiny-onnx + launchers: + - framework: dlsdk + adapter: + type: yolo_v3_onnx + boxes_out: yolonms_layer_1 + scores_out: yolonms_layer_1:1 + indices_out: yolonms_layer_1:2 + inputs: + - name: image_shape + type: ORIG_IMAGE_INFO + datasets: + - name: ms_coco_detection_80_class_without_background + reader: pillow_imread + preprocessing: + - type: rgb_to_bgr + - type: resize + size: 416 + interpolation: BICUBIC + use_pillow: True + aspect_ratio_scale: fit_to_window + - type: padding + pad_value: 128, 128, 128 + size: 416 + metrics: + - type: map + integral: 11point + ignore_difficult: true + presenter: print_scalar + reference: 0.1707 + - type: coco_precision + max_detections: 100 + threshold: 0.5 + reference: 0.1364 diff --git a/models/public/yolo-v3-tiny-onnx/model.yml b/models/public/yolo-v3-tiny-onnx/model.yml new file mode 100644 index 00000000000..38cc3a28f6f --- /dev/null +++ b/models/public/yolo-v3-tiny-onnx/model.yml @@ -0,0 +1,35 @@ +# Copyright (c) 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +description: >- + Tiny YOLO v3 is a smaller version of real-time object detection YOLO v3 model in + ONNX* format from the repository + which is converted from Keras* model repository + using keras2onnx converter . This model was + pre-trained on Common Objects in Context + dataset with 80 classes. +task_type: detection +files: + - name: tiny-yolov3-11.onnx + sha384: 997714d4731fd00d6bc8c5deb3b9f6ce5b43a21b3eade03bc636f9347c6daa6df9a6e27cc3ff22cbc5d0572eab57314e + size: 35511756 + source: https://media.githubusercontent.com/media/onnx/models/41ccf18ba5a815dab714899ac234e9b1e4293c20/vision/object_detection_segmentation/tiny-yolov3/model/tiny-yolov3-11.onnx +model_optimizer_args: + - --input_shape=[1,3,416,416],[1,2] + - --input=input_1,image_shape + - --scale_values=input_1[255] + - --reverse_input_channels + - --input_model=$dl_dir/tiny-yolov3-11.onnx +framework: onnx +license: https://raw.githubusercontent.com/onnx/models/master/LICENSE diff --git a/models/public/yolo-v3-tiny-tf/model.yml b/models/public/yolo-v3-tiny-tf/model.yml index 5c074e7dec0..5a0aa2f2f50 100644 --- a/models/public/yolo-v3-tiny-tf/model.yml +++ b/models/public/yolo-v3-tiny-tf/model.yml @@ -21,7 +21,7 @@ task_type: detection files: - name: yolo-v3-tiny-tf.zip size: 32836256 - sha256: b872207db53b592de64c2a1f04420278a23707aa9a05549efd78778a947fc854 + sha384: 675da89d10e73f2f5150b914ebb840fb9ef6901c08505ef02d141d64dd98c1a0d1ddc5ecd4ede6e1f9a8573ce1abee9f source: https://download.01.org/opencv/public_models/082020/yolo-v3-tiny-tf/yolo-v3-tiny-tf.zip postprocessing: - $type: unpack_archive diff --git a/models/public/yolo-v4-tf/model.yml b/models/public/yolo-v4-tf/model.yml index 830300e3787..02bbaeb54a8 100644 --- a/models/public/yolo-v4-tf/model.yml +++ b/models/public/yolo-v4-tf/model.yml @@ -23,19 +23,19 @@ task_type: detection files: - name: yolov4.weights size: 257717640 - sha256: e8a4f6c62188738d86dc6898d82724ec0964d0eb9d2ae0f0a9d53d65d108d562 + sha384: bb55bc319c21cde4546f86cee1ad7a74e1056bbe38edcd1da74e754b9a9081d0bd8834e15f7e4f7b46a3e38ce336ada9 source: https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights - name: keras-YOLOv3-model-set/tools/model_converter/convert.py size: 16704 - sha256: 677a3bdf2758d239ead8b12d8bf928c266ac476d461cbc9ed8f22b70e144464d + sha384: 176b20235fbe2d55faf78e6437693c194a3a989b8c11ad78afe2313926edbabadef1323bc5bbb2bf4c6fb81ff2ba6ccd source: https://github.com/david8862/keras-YOLOv3-model-set/raw/6c9aff7bb0c1660704ad07c85739e95885676e5b/tools/model_converter/convert.py - name: keras-YOLOv3-model-set/yolo4/models/layers.py size: 15535 - sha256: 22823e18615467b23eb9312584156a43e2f2870add758dc20cf48148efaf6a25 + sha384: f8d67ea5f2d293c00a967b7aa85efb03100e2420d0dc702cb38cd49c31d1b6e367469bd455c1870828184268d94007b7 source: https://github.com/david8862/keras-YOLOv3-model-set/raw/6c9aff7bb0c1660704ad07c85739e95885676e5b/yolo4/models/layers.py - name: keras-YOLOv3-model-set/cfg/yolov4.cfg size: 12208 - sha256: a15524ec710005add4eb672140cf15cbfe46dea0561f1aea90cb1140b466073e + sha384: ccd87e37a99bf98582ceb39af3cd3b9ddb550c382f433f177c86f896fc1ad621ef0e5e51da6318415c853bf2311e5b9b source: https://github.com/david8862/keras-YOLOv3-model-set/raw/6c9aff7bb0c1660704ad07c85739e95885676e5b/cfg/yolov4.cfg postprocessing: # disable imports that aren't needed for this model and code that uses them diff --git a/models/public/yolo-v4-tiny-tf/model.yml b/models/public/yolo-v4-tiny-tf/model.yml index a224578159b..a47c8730d4f 100644 --- a/models/public/yolo-v4-tiny-tf/model.yml +++ b/models/public/yolo-v4-tiny-tf/model.yml @@ -23,27 +23,27 @@ task_type: detection files: - name: yolov4-tiny.weights size: 24251276 - sha256: cf9fbfd0f6d4869b35762f56100f50ed05268084078805f0e7989efe5bb8ca87 + sha384: ee417b9217aa806b93110e8c688c06f7d75778645372667712f989fc961175244162d9a74f402dfedc64b80b3a21e58d source: https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.weights - name: keras-YOLOv3-model-set/tools/model_converter/convert.py size: 16060 - sha256: 3604f84547ce4fd3073cb6283f9d66e249526b0ad22da1a46c27ce1caf5a9b5f + sha384: 6a72c81fce395d3d7f16b713fa70e539aabe53403baac7f6f1e7a51ad11e50cc37a708b96d9b239c89d1a1210d8edd7d source: https://github.com/david8862/keras-YOLOv3-model-set/raw/6b4a0ee63771262363e8224b0ee915cad6c5e93e/tools/model_converter/convert.py - name: keras-YOLOv3-model-set/tools/model_converter/keras_to_tensorflow.py size: 8370 - sha256: 1cc02cf4ec76760c05bc1635654247ba56b9a1864b63fd05534b836bc93e44e7 + sha384: 1be7f22eafa2c9fd54457938bebbe4d572b7b2abdfed9a1fd720bbb52cdc96151839726957aa8c7dde9cd3abb332807e source: https://github.com/david8862/keras-YOLOv3-model-set/raw/d38c3d865f7190ee9b19a30e91f2b750a31320c1/tools/model_converter/keras_to_tensorflow.py - name: keras-YOLOv3-model-set/common/utils.py size: 5002 - sha256: 90146775879f294e1f1a82c7e35a5be29d815b7a9b14dbe12ba29dd16b3d10a8 + sha384: 7acd0f55fb4c1a0f00df46c2383309bc12715d66c09adb9bcb22d6aea2555ef0478d2d7147fe5cd8de770a23008e4958 source: https://github.com/david8862/keras-YOLOv3-model-set/raw/d38c3d865f7190ee9b19a30e91f2b750a31320c1/common/utils.py - name: keras-YOLOv3-model-set/yolo4/models/layers.py size: 15171 - sha256: 569f5d4353c2a514a1fe63442a3f891cd83614c28cdd2d5cfb25b2bfcaf56286 + sha384: b949a66aeac84fe0ff6990961c8b39d1dc6585e4ce206c2fbafa5ee5f1063f7a55424beeacf55932bf8afe621c308a3e source: https://github.com/david8862/keras-YOLOv3-model-set/raw/d38c3d865f7190ee9b19a30e91f2b750a31320c1/yolo4/models/layers.py - name: keras-YOLOv3-model-set/cfg/yolov4-tiny.cfg size: 3028 - sha256: 92e2805d3fa67ffef969f44281714c96cd5ce7968425003948b7bcd0d03e6871 + sha384: 387ffb240df5f9c81355145a72a5d6bba085db3118b0f61ad214d3d3491e957f3b3ab9498eb8b873c098404fa5235cb7 source: https://github.com/david8862/keras-YOLOv3-model-set/raw/6b4a0ee63771262363e8224b0ee915cad6c5e93e/cfg/yolov4-tiny.cfg postprocessing: # disable imports that aren't needed for this model and code that uses them diff --git a/models/public/yolof/model.yml b/models/public/yolof/model.yml index c0e5ef8f219..b10b4baa0ac 100644 --- a/models/public/yolof/model.yml +++ b/models/public/yolof/model.yml @@ -24,86 +24,86 @@ files: # cvpods - name: cvpods/__init__.py size: 274 - sha256: c1c2f703477719e084c1fe13d168cbe0ed0a6ddc7cb991b3287966f2c31c9c56 + sha384: 89d7d3a6a8a220f9c6eb3420bfe93ee29f486051ee65cb0957fc9eb7422179f1a1d3574638e26a6006041ff3a8f6bab8 source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/__init__.py # layers - name: cvpods/layers/__init__.py size: 1276 - sha256: f2786a15562fe0468461e35ba0477eae2bbdc68deeaea03c441f50a83fa0a003 + sha384: b5b34410c514a1e7b4e7c203b4b183b30b3a35fc18e6516da7b54b83ae236c6bdaea6b439f2c563171dc015c48287ce4 source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/layers/__init__.py - name: cvpods/layers/batch_norm.py size: 9872 - sha256: 6da202a9db1b88019fbee82589e661b1e0ad533d0a750c0c2e13088d86f4e53f + sha384: b331702dfac0c680870e1c164442ab647be88e54258f6a4e3c7f777e471a4719ffa8ebd8fcdc7e4e8f8a1f15a726c005 source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/layers/batch_norm.py - name: cvpods/layers/shape_spec.py size: 672 - sha256: 827b5758ba58addbd1f5d8a535202d4c6110a0e4f9c06dbaa5a53caeb8265a8d + sha384: ac251409d116121ee0acd10cd86a6c367d003169fd581e4f9c562bb20359e69642d8a720cf39bfd16cc2909782108172 source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/layers/shape_spec.py - name: cvpods/layers/wrappers.py size: 15619 - sha256: 565e52061590ce0dbf41a4dedb7e31453e9c7e374256e6f0a45822fd9dc4a130 + sha384: f6caf877a6c1c593f911240eaf28e71880ab220b80653796455effa0d7d38d5241bcfd0357171fddd0431d65364b6920 source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/layers/wrappers.py # modeling - name: cvpods/modeling/anchor_generator.py size: 15718 - sha256: 3042a02614b94da05796299d94717347ac493f347c3185e6e07c2f603a0ba299 + sha384: e55872f196946705bc66b82234a91d8b893810fe8f94bc72ef1be211334772904ed81aa0e3d89275dd3f93524dfe2b5e source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/modeling/anchor_generator.py - name: cvpods/modeling/backbone/__init__.py size: 905 - sha256: bf4fe28c492998b044c31ba7d35af3a39125039731b3582f7a2ac3975bd99cc0 + sha384: d95a02c8a1bf4549892b3082ea0199902cdd9a614107c9042d48ed150b33eeecab8a199a7e40da337c42dff874efde2c source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/modeling/backbone/__init__.py - name: cvpods/modeling/backbone/backbone.py size: 1632 - sha256: ca6570234053322c3894ce3b8656351ba896c898d22c4469a7424a74c92a8e29 + sha384: ade8d08b8f1d53a3c0f5ccbe40da905fc4f9222eab9955fa05246fc3bba309b40a17b9f63e7a199683f73aa5c1f433ea source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/modeling/backbone/backbone.py - name: cvpods/modeling/nn_utils/__init__.py size: 0 - sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + sha384: 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/modeling/nn_utils/__init__.py - name: cvpods/modeling/nn_utils/weight_init.py size: 3756 - sha256: 71e5b5872bdbbfd72e335a80114ce77e42a7e88d9cd1ee9dad47f257daa65873 + sha384: 6b6982835f798c5e48077b3cc5cbda8ce1232742d2b360ef0b967dbb509e6f0dd5f496b4bd57c89f03b7d4477553dca0 source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/modeling/nn_utils/weight_init.py # structures - name: cvpods/structures/__init__.py size: 520 - sha256: 1bb7c30fa43ee378c84e0b3d720ef8bb9522c37fdd1dee4921e387bb93392ee5 + sha384: 1fa10738d59a77e09c3df06ed2ed2c3f5943122daaf020a8d24db3754bf855e3c1a3687bc6ffc3320e2d18152dcefc97 source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/structures/__init__.py - name: cvpods/structures/boxes.py size: 15620 - sha256: e8b20ba9b70203d4ec0dec93272da16799b5877006caa5b075d2b7beef086add + sha384: faa7e2927da6eafee119acfa14b0b72ba312d9114dd7235388fbd86d900bbb1ac29595fe7038017588ae43986778e78e source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/cvpods/structures/boxes.py # models - name: models/cspdarknet.py size: 11889 - sha256: 6eae2826c76a51faf34744495c82d79d3680772775fbc603929749c1a1eee63b + sha384: 8cf272cdcf6296bfc06271e0d113908b086a4242a50c777d6acfcfcbdf827351cae347983aa44d876461f613ab344da9 source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/playground/detection/coco/yolof/yolof.cspdarknet53.DC5.9x.stage2.3x/cspdarknet.py # yolof_base - name: yolof_base/__init__.py size: 156 - sha256: 32a4e9e7cbafa0ba6a4a968294bf9bb431809f2684fe188a1448fe0250426a9f + sha384: f9a49cf1ba3eb106ba5d71f9c425e41410fb72e35b69cf38a1d0573b04926f9ee2af073bb548ba11f4fa422e0698894c source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/playground/detection/coco/yolof/yolof_base/__init__.py - name: yolof_base/decoder.py size: 4473 - sha256: db2c11620dcd42d9cb628c5cea60d7b498310662b52b8c5835c6384dcec89ad0 + sha384: c0c5c894887812b088919f2194bfc7a096c674760095afdff30a624f482073d7f1801930f12fae626fb96f3ea5976126 source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/playground/detection/coco/yolof/yolof_base/decoder.py - name: yolof_base/encoder.py size: 4588 - sha256: 352a22cbf911d7ed2553fe72e31206b254c9f7f6200a7d1a3ebffc6cc079c176 + sha384: a2ed22ceefac9c93e07e8a18936248b389856d0b7bbc8b048368eb2313726934b0c74656efd18049b89cb7a510d27e41 source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/playground/detection/coco/yolof/yolof_base/encoder.py - name: yolof_base/utils.py size: 1615 - sha256: e3608f20bf1d5d685d56c822f1963531168d65a2c499d537545188787d497765 + sha384: 5b21efa0002bd3b44f3af8cd85f021037110ef32ff5cd8e6418a512da57d2c2f7b9e381288acac086ed68293f164cadd source: https://raw.githubusercontent.com/megvii-model/YOLOF/d09c5a64ff354e6f4141c26d68574f9f9f0b84a2/playground/detection/coco/yolof/yolof_base/utils.py # ckpt - name: ckpt/YOLOF_CSP_D_53_DC5_9x.pth size: 385559524 - sha256: 5aac157a091993f9c54471f6a8c365b5aa1e7ca3e8f360517edd36bdd3a9fcfc + sha384: 8bc639e0ce4825b0891e9ea50c4e7898c9eb7548de725490a135a2368162e637dc43658eb696e27f1d4a1649c2108e03 source: https://upzqqa.bn.files.1drv.com/y4mwk1QklsZktMCS8X9bmTcxB8cqyMbouGOKV_8fjN0-nISdWdiRAoZwkzOqKHSq7bOmFchzhWz52mHMRvXC6sa-rjEPwP_QqVxjc9dePvpE-7X3Lr5sDyV0zlLky_MClBOSfcpWPd_Fro-BKaE9KDC20_eukQJRREXf5uWp8w0CHHMZ2JN9wv38W17KkSy-EspmHSLvPrkw2BysFTeOTJJ6A # addict - name: lib/addict-2.4.0-py3-none-any.whl size: 3832 - sha256: 249bb56bbfd3cdc2a004ea0ff4c2b6ddc84d53bc2194761636eb314d5cfa5dfc + sha384: 0b3d7c226551078ffcd70e4d512194f2cb67c6c06dc8c7a7b8001752b842b934990817f9236f73fb7c38cba5573205ab source: https://files.pythonhosted.org/packages/6a/00/b08f23b7d7e1e14ce01419a467b583edbb93c6cdb8654e54a9cc579cd61f/addict-2.4.0-py3-none-any.whl postprocessing: # unpack diff --git a/models/public/yolox-tiny/model.yml b/models/public/yolox-tiny/model.yml index d43763a00a3..a8302575c3a 100644 --- a/models/public/yolox-tiny/model.yml +++ b/models/public/yolox-tiny/model.yml @@ -24,35 +24,35 @@ task_type: detection files: - name: models/yolox.py size: 1374 - sha256: a4d70f5ef75dfbb1da5394d886dc348c68cdfbb27ab725f36c313e981ba605ee + sha384: eb0fe479a6b65b1292644955e7c3717dab1271d5854a4ec5b3d671f18805848cbddd8541b779394daeb96acb7e3fba06 source: https://raw.githubusercontent.com/Megvii-BaseDetection/YOLOX/69f1173a569f1e0cc41025146a32b5d5fa06dd26/yolox/models/yolox.py - name: models/yolo_head.py size: 23223 - sha256: 84bed77f74ce74de49f713a558729df1fac35f506a01f6b390313be9e24c9ba8 + sha384: d48caa0874839ca3d45e5209db339733ecdafeb02af7216278544c995539beda6a07549a317cca0055ecba13c2b0ee50 source: https://raw.githubusercontent.com/Megvii-BaseDetection/YOLOX/69f1173a569f1e0cc41025146a32b5d5fa06dd26/yolox/models/yolo_head.py - name: models/yolo_pafpn.py size: 3540 - sha256: bfeb522c87fc076659c804927751b503ef0185fe1cf8f9f7153369e9177a9627 + sha384: 9037b1ec330b8071e9e8984410ebfc54119385a47fde1f02b9831a50f0383d5701b4e778a49be37d5252da029e956322 source: https://raw.githubusercontent.com/Megvii-BaseDetection/YOLOX/69f1173a569f1e0cc41025146a32b5d5fa06dd26/yolox/models/yolo_pafpn.py - name: models/darknet.py size: 6028 - sha256: 37fd32ae7f7de29df646f7c457837834fcc0e4e08ce83034a6397092fbae6a62 + sha384: 77cb6df3b46d6d9d98c4bdccaba8faeab817110a8133b2a57595e3028697076ecea604724c71a983d1d37b930d5ab671 source: https://raw.githubusercontent.com/Megvii-BaseDetection/YOLOX/69f1173a569f1e0cc41025146a32b5d5fa06dd26/yolox/models/darknet.py - name: models/network_blocks.py size: 6102 - sha256: 250982431c53a5ed49c3e465266baeabe3e21a41eac941a8e5345c2e71e14a7d + sha384: 96f7f932abae06f57589c30e2e460a0c10064ca095c6a4a687271a19f0d38977dab1897db8f902c6883ba65477e6463d source: https://raw.githubusercontent.com/Megvii-BaseDetection/YOLOX/69f1173a569f1e0cc41025146a32b5d5fa06dd26/yolox/models/network_blocks.py - name: models/losses.py size: 1663 - sha256: 60e8d8586484c5e211e69e41588340c8160774d6b03d097a96662dd98a641d4e + sha384: 0c1373e269a1e99f9c77eb88cb9fc279f72cd4d0146d01ff108c10f3fd999a2fe15c1e56e31deeae92d26e5190d0c24c source: https://raw.githubusercontent.com/Megvii-BaseDetection/YOLOX/69f1173a569f1e0cc41025146a32b5d5fa06dd26/yolox/models/losses.py - name: utils/boxes.py size: 4481 - sha256: 1619780dc9b0c008880af3bf0ce498e43675688658c43fd2e5772622a747b992 + sha384: 6f92071f17c19f8bcac4cf7d38901b4d48e40cbba81ca53c455bd2e17895b3c98c03de6dbb8be9bd12f2ab34cfa7fa0c source: https://raw.githubusercontent.com/Megvii-BaseDetection/YOLOX/69f1173a569f1e0cc41025146a32b5d5fa06dd26/yolox/utils/boxes.py - name: yolox_tiny.pth size: 40726661 - sha256: cc9aa3fa13339df8417cbce77432960ed44225ed040c7fcb6068f023792551fd + sha384: 9083e8c9e2388c0c1ddde44a97f0304a10f8ffc2219943a4b5280d9791b96d9998129c8ba34b5dd2902cfd715fcd8138 source: https://github.com/Megvii-BaseDetection/storage/releases/download/0.0.1/yolox_tiny.pth postprocessing: - $type: regex_replace diff --git a/tools/accuracy_checker/.pylintrc b/tools/accuracy_checker/.pylintrc index 133fc9cfef1..262f991b3f3 100644 --- a/tools/accuracy_checker/.pylintrc +++ b/tools/accuracy_checker/.pylintrc @@ -16,12 +16,13 @@ disable = C0103, C0204, W0201, W0107, - R0401 + R0401, + R0801 max-line-length = 120 ignore-docstrings = yes extension-pkg-whitelist=inference_engine,cv2,numpy,mxnet,tensorflow,pycocotools,onnxruntime,kenlm,paddle,torchvision -ignored-modules = numpy,cv2,openvino.inference_engine,caffe,mxnet,tensorflow,pycocotools,onnxruntime,torch,kenlm,paddle.fluid.core,torchvision +ignored-modules = numpy,cv2,openvino.inference_engine,caffe,mxnet,tensorflow,pycocotools,onnxruntime,torch,kenlm,paddle.fluid.core,torchvision,openvino.pyopenvino,openvino.ie_api,openvino.impl load-plugins = pylint_checkers ignored-classes = pathlib.PurePath jobs=0 diff --git a/tools/accuracy_checker/README.md b/tools/accuracy_checker/README.md index ac616c5f3fd..87f7dd885e6 100644 --- a/tools/accuracy_checker/README.md +++ b/tools/accuracy_checker/README.md @@ -121,7 +121,6 @@ You may refer to `-h, --help` to full list of command line options. Some argumen - `-a, --annotations` specifies directory in which annotation and meta files will be searched. - `-d, --definitions` path to the global configuration file. - `-e, --extensions` directory with InferenceEngine extensions. -- `-b, --bitstreams` directory with bitstream (for Inference Engine with fpga plugin). - `-C, '--converted_models` directory to store Model Optimizer converted models (used for DLSDK launcher only). - `-tf, --target_framework` framework for infer. - `-td, --target_devices` devices for infer. You can specify several devices using space as a delimiter. @@ -139,7 +138,6 @@ You are also able to replace some command line arguments with environment variab * `MODELS_DIR` - equivalent of `-m`, `--models`. * `EXTENSIONS` - equivalent of `-e`, `--extensions`. * `ANNOTATIONS_DIR` - equivalent of `-a`, `--annotations`. -* `BITSTREAMS_DIR` - equivalent of `-b`, `--bitstreams`. * `MODEL_ATTRIBUTES_DIR` - equivalent of `--model_attributes`. #### Configuration diff --git a/tools/accuracy_checker/configs/fbcnn.yml b/tools/accuracy_checker/configs/fbcnn.yml new file mode 120000 index 00000000000..65abf4323e7 --- /dev/null +++ b/tools/accuracy_checker/configs/fbcnn.yml @@ -0,0 +1 @@ +../../../models/public/fbcnn/accuracy-check.yml \ No newline at end of file diff --git a/tools/accuracy_checker/configs/yolo-v3-onnx.yml b/tools/accuracy_checker/configs/yolo-v3-onnx.yml new file mode 120000 index 00000000000..9067c5ee218 --- /dev/null +++ b/tools/accuracy_checker/configs/yolo-v3-onnx.yml @@ -0,0 +1 @@ +../../../models/public/yolo-v3-onnx/accuracy-check.yml \ No newline at end of file diff --git a/tools/accuracy_checker/configs/yolo-v3-tiny-onnx.yml b/tools/accuracy_checker/configs/yolo-v3-tiny-onnx.yml new file mode 120000 index 00000000000..7777e9fa620 --- /dev/null +++ b/tools/accuracy_checker/configs/yolo-v3-tiny-onnx.yml @@ -0,0 +1 @@ +../../../models/public/yolo-v3-tiny-onnx/accuracy-check.yml \ No newline at end of file diff --git a/tools/accuracy_checker/data/test_models/pytorch_model/samplenet.py b/tools/accuracy_checker/data/test_models/pytorch_model/samplenet.py index 2ae47482a2c..ef4baffebb3 100644 --- a/tools/accuracy_checker/data/test_models/pytorch_model/samplenet.py +++ b/tools/accuracy_checker/data/test_models/pytorch_model/samplenet.py @@ -14,13 +14,13 @@ limitations under the License. """ -import torch.nn as nn +from torch import nn import torch.nn.functional as F class SampLeNet(nn.Module): def __init__(self): - super(SampLeNet, self).__init__() + super(SampLeNet, self).__init__() # pylint: disable=R1725 self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) diff --git a/tools/accuracy_checker/openvino/tools/__init__.py b/tools/accuracy_checker/openvino/tools/__init__.py index e69de29bb2d..69e3be50dac 100644 --- a/tools/accuracy_checker/openvino/tools/__init__.py +++ b/tools/accuracy_checker/openvino/tools/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/README.md b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/README.md index 2b2419c135f..81b3c5bcb06 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/README.md +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/README.md @@ -37,8 +37,10 @@ AccuracyChecker supports following set of adapters: * `threshold` - minimum probability threshold for valid class belonging. * `tiny_yolo_v1` - converting output of Tiny YOLO v1 model to `DetectionPrediction` representation. * `reid` - converting output of reidentification model to `ReIdentificationPrediction` representation. - * `grn_workaround` - enabling processing output with adding Global Region Normalization layer. + * `grn_workaround` - enabling processing output with adding Global Region Normalization layer (Optional, default `True`). * `joining_method` - method used to join embeddings (optional, supported methods are `sum` and `concatenation`, default - `sum`). + * `target_out` - target output layer name (Optional, if not provided first in the model will be used). + * `keep_shape` - allow keeping initial shape for predicted embedding (Optional, default `False`, it means that model output will be flattenized). * `yolo_v2` - converting output of YOLO v2 family models to `DetectionPrediction` representation. * `classes` - number of detection classes (default 20). * `anchors` - anchor values provided as comma-separated list or one of precomputed: @@ -249,6 +251,7 @@ AccuracyChecker supports following set of adapters: * `max_candidates` - maximum detected candidates for considering (Optional, default 1000). * `unclip_ratio` - unclip ratio (Optional, default 2). * `min_size` - minimum box size (Optional, default 3). +* `facial_landmarks_detection` - converting output of model for face landmark detection to `FacialLandmarksHeatMapPrediction`. * `human_pose_estimation` - converting output of model for human pose estimation to `PoseEstimationPrediction`. * `part_affinity_fields_out` - name of output layer with keypoints pairwise relations (part affinity fields). * `keypoints_heatmap_out` - name of output layer with keypoints heatmaps. @@ -272,6 +275,7 @@ AccuracyChecker supports following set of adapters: * `blank_label` - index of the CTC blank label (default 0). * `custom_label_map` - Alphabet as a dict of strings. Must include blank symbol for CTC algorithm (Optional, if provided in dataset_meta or vocabulary_file). * `vocabulary_file` - file with model vocab, represented as txt file, where each label is located on own line (Optional). + * `shift_labels` - shift label map ids on 1 if it represented without blank label on zero position (Optional, default False). * `simple_decoder` - the easiest decoder for text recognition models, converts indices of classes to given letters, slices output on the first entry of `eos_label` * `eos_label` - label which should finish decoding (Optional, default `[s]`). * `start_label` - label which should start decoding (Optional). @@ -438,7 +442,10 @@ AccuracyChecker supports following set of adapters: * `boxes_out` - output with bounding boxes in the format BxNx[x_min, y_min, width, height], where B - network batch size, N - number of detected boxes. * `cls_out` - output with classification probabilities in format [BxNxC], where B - network batch size, N - number of detected boxes, C - number of classed. * `dumb_decoder` - converts audio recognition model output to `CharacterRecognitionPrediction`. - * `alphabet` - model alphabet. + * `alphabet`- list of supported tokens. You can also use `vocabulary_file` if vocabulary is very large, txt file with accepted tokens list (each token should be located on own line represented as token_id). + * `blank_token_id` - token_id for blank token (Optional, used for blank label filtering after decoding). + * `eos_token_id` - token_id for end of string (Optional, used for eos token filtering after decoding). + * `replace_underscore` - allow replacing undescrore symbol to white space after decoding. * `uppercase` - produce prediction in uppercase, default is `True`. * `detr` - converts output of DETR models family to `DetectionPrediction`. * `scores_out` - output layer name with detection scores logits. diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/__init__.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/__init__.py index c5c7d161e5a..175822227c0 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/__init__.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/__init__.py @@ -51,7 +51,6 @@ from .reidentification import ReidAdapter from .detection import ( TFObjectDetectionAPIAdapter, - MTCNNPAdapter, ClassAgnosticDetectionAdapter, FaceBoxesAdapter, FaceDetectionAdapter, @@ -62,6 +61,7 @@ UltraLightweightFaceDetectionAdapter, PPDetectionAdapter ) +from .mtcnn import MTCNNPAdapter from .detection_person_vehicle import ( PersonVehicleDetectionAdapter, PersonVehicleDetectionRefinementAdapter @@ -77,6 +77,7 @@ from .segmentation import ( SegmentationAdapter, BrainTumorSegmentationAdapter, DUCSegmentationAdapter, BackgroundMattingAdapter ) +from .facial_landmarks_98_detection import FacialLandmarksAdapter from .pose_estimation import HumanPoseAdapter, SingleHumanPoseAdapter, StackedHourGlassNetworkAdapter from .pose_estimation_openpose import OpenPoseAdapter from .pose_estimation_associative_embedding import AssociativeEmbeddingAdapter @@ -132,7 +133,6 @@ 'ClassificationAdapter', 'TFObjectDetectionAPIAdapter', - 'MTCNNPAdapter', 'CTDETAdapter', 'RetinaNetAdapter', 'RetinaNetTF2', @@ -150,6 +150,8 @@ 'DETRAdapter', 'UltraLightweightFaceDetectionAdapter', 'PPDetectionAdapter', + 'FacialLandmarksAdapter', + 'MTCNNPAdapter', 'TinyYOLOv1Adapter', 'YoloV2Adapter', diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/action_recognition.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/action_recognition.py index dadbbd90396..2ce34c803ab 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/action_recognition.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/action_recognition.py @@ -117,9 +117,9 @@ def configure(self): self.add_conf_outs = [] self.glob_layer_id_map = [] - for head_id in range(len(self.head_sizes)): + for head_id, head_size in enumerate(self.head_sizes): glob_layer_ids = [] - for anchor_id in np.arange(start=1, stop=self.head_sizes[head_id] + 1): + for anchor_id in np.arange(start=1, stop=head_size + 1): self.add_conf_outs.append( '{}{}{}{}'.format(add_conf_out_prefix, head_id + 1, add_conf_out_suffix, anchor_id) ) @@ -297,8 +297,18 @@ def find_layer(regex, output_name, all_outputs): self.loc_out = find_layer(loc_out_regex, 'loc', raw_outputs) self.main_conf_out = find_layer(main_conf_out_regex, 'main confidence', raw_outputs) + self.outputs_verified = True + if contains_all(raw_outputs, self.add_conf_outs): + return + add_conf_result = [layer_name + '/sink_port_0' for layer_name in self.add_conf_outs] + if contains_all(raw_outputs, add_conf_result): + self.add_conf_outs = add_conf_result + return add_conf_with_bias = [layer_name + '/add_' for layer_name in self.add_conf_outs] - if not contains_all(raw_outputs, self.add_conf_outs) and contains_all(raw_outputs, add_conf_with_bias): + if contains_all(raw_outputs, add_conf_with_bias): self.add_conf_outs = add_conf_with_bias - - self.outputs_verified = True + return + add_conf_with_bias_result = [layer_name + '/add_/sink_port_0' for layer_name in self.add_conf_outs] + if contains_all(raw_outputs, add_conf_with_bias_result): + self.add_conf_outs = add_conf_with_bias_result + return diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/adapter.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/adapter.py index 5f8022cbceb..4e7915611de 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/adapter.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/adapter.py @@ -51,6 +51,19 @@ def process(self, raw, identifiers, frame_meta): def configure(self): pass + @staticmethod + def check_output_name(output_name, outputs, suffix='/sink_port_0'): + outputs = outputs[0] if isinstance(outputs, list) else outputs + if output_name in outputs: + return output_name + if suffix in output_name: + preprocessed_output_name = output_name.replace(suffix, '') + else: + preprocessed_output_name = '{}{}'.format(output_name, suffix) + if preprocessed_output_name in outputs: + return preprocessed_output_name + return output_name + @classmethod def validate_config(cls, config, fetch_only=False, uri_prefix='', **kwargs): if cls.__name__ == Adapter.__name__: @@ -107,17 +120,17 @@ def release(self): pass class AdapterField(BaseField): - def validate(self, entry, field_uri_=None, fetch_only=False, validation_scheme=None): - errors_stack = super().validate(entry, field_uri_, fetch_only, validation_scheme) + def validate(self, entry, field_uri=None, fetch_only=False, validation_scheme=None): + errors_stack = super().validate(entry, field_uri, fetch_only, validation_scheme) if entry is None: return errors_stack - field_uri_ = field_uri_ or self.field_uri + field_uri = field_uri or self.field_uri if isinstance(entry, str): errors_stack.extend( StringField(choices=Adapter.providers).validate( - entry, field_uri_ or 'adapter', fetch_only=fetch_only, validation_scheme=validation_scheme + entry, field_uri or 'adapter', fetch_only=fetch_only, validation_scheme=validation_scheme ) ) elif isinstance(entry, dict): @@ -125,19 +138,19 @@ class DictAdapterValidator(ConfigValidator): type = StringField(choices=Adapter.providers) dict_adapter_validator = DictAdapterValidator( - field_uri_ or 'adapter', on_extra_argument=DictAdapterValidator.IGNORE_ON_EXTRA_ARGUMENT + field_uri or 'adapter', on_extra_argument=DictAdapterValidator.IGNORE_ON_EXTRA_ARGUMENT ) errors_stack.extend(dict_adapter_validator.validate( - entry, field_uri_ or 'adapter', fetch_only=fetch_only, validation_scheme=validation_scheme + entry, field_uri or 'adapter', fetch_only=fetch_only, validation_scheme=validation_scheme )) else: if not fetch_only: errors_stack.append( self.build_error( - entry, field_uri_ or 'adapter', 'adapter must be either string or dictionary', validation_scheme + entry, field_uri or 'adapter', 'adapter must be either string or dictionary', validation_scheme )) else: - self.raise_error(entry, field_uri_ or 'adapter', 'adapter must be either string or dictionary') + self.raise_error(entry, field_uri or 'adapter', 'adapter must be either string or dictionary') return errors_stack diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/attribute_classification.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/attribute_classification.py index ee161737c84..017c2c77967 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/attribute_classification.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/attribute_classification.py @@ -42,6 +42,7 @@ def parameters(cls): def configure(self): super().configure() self.output_layers = self.get_value_from_config('output_layer_map') + self.outputs_verified = False @classmethod def validate_config(cls, config, fetch_only=False, **kwargs): @@ -49,6 +50,13 @@ def validate_config(cls, config, fetch_only=False, **kwargs): config, fetch_only=fetch_only, on_extra_argument=ConfigValidator.ERROR_ON_EXTRA_ARGUMENT ) + def select_output_blob(self, outputs): + new_output_layers = {} + for attr, layer_name in self.output_layers.items(): + new_output_layers[attr] = self.check_output_name(layer_name, outputs) + self.output_layers = new_output_layers + self.outputs_verified = True + def process(self, raw, identifiers, frame_meta): """ Args: @@ -61,6 +69,8 @@ def process(self, raw, identifiers, frame_meta): result = [] if isinstance(raw, dict): raw = [raw] + if not self.outputs_verified: + self.select_output_blob(raw) for identifier, raw_output in zip(identifiers, raw): container_dict = {} for layer_name, attribute in self.output_layers.items(): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/attributes_recognition.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/attributes_recognition.py index 31d467a18a5..d7f89e48295 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/attributes_recognition.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/attributes_recognition.py @@ -59,6 +59,7 @@ def configure(self): self.angle_yaw = self.get_value_from_config('angle_yaw') self.angle_pitch = self.get_value_from_config('angle_pitch') self.angle_roll = self.get_value_from_config('angle_roll') + self.outputs_verified = False def process(self, raw, identifiers, frame_meta): """ @@ -71,6 +72,8 @@ def process(self, raw, identifiers, frame_meta): """ result = [] raw_output = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_output) for identifier, yaw, pitch, roll in zip( identifiers, raw_output[self.angle_yaw], @@ -86,6 +89,12 @@ def process(self, raw, identifiers, frame_meta): return result + def select_output_blob(self, outputs): + self.check_output_name(self.angle_yaw, outputs) + self.check_output_name(self.angle_pitch, outputs) + self.check_output_name(self.angle_roll, outputs) + self.outputs_verified = True + class VehicleAttributesRecognitionAdapter(Adapter): __provider__ = 'vehicle_attributes' @@ -112,10 +121,13 @@ def configure(self): """ self.color_out = self.get_value_from_config('color_out') self.type_out = self.get_value_from_config('type_out') + self.outputs_verified = False def process(self, raw, identifiers=None, frame_meta=None): res = [] raw_output = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_output) for identifier, colors, types in zip(identifiers, raw_output[self.color_out], raw_output[self.type_out]): res.append(ContainerPrediction({ 'color': ClassificationPrediction(identifier, colors.reshape(-1)), @@ -124,6 +136,11 @@ def process(self, raw, identifiers=None, frame_meta=None): return res + def select_output_blob(self, outputs): + self.check_output_name(self.color_out, outputs) + self.check_output_name(self.type_out, outputs) + self.outputs_verified = True + class AgeGenderAdapter(Adapter): __provider__ = 'age_gender' @@ -141,6 +158,7 @@ def parameters(cls): def configure(self): self.age_out = self.get_value_from_config('age_out') self.gender_out = self.get_value_from_config('gender_out') + self.outputs_verified = False @classmethod def validate_config(cls, config, fetch_only=False, **kwargs): @@ -166,6 +184,8 @@ def get_age_scores(age): def process(self, raw, identifiers=None, frame_meta=None): result = [] raw_output = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_output) for identifier, age, gender in zip(identifiers, raw_output[self.age_out], raw_output[self.gender_out]): gender = gender.reshape(-1) age = age.reshape(-1)[0]*100 @@ -178,6 +198,11 @@ def process(self, raw, identifiers=None, frame_meta=None): return result + def select_output_blob(self, outputs): + self.age_out = self.check_output_name(self.age_out, outputs) + self.gender_out = self.check_output_name(self.gender_out, outputs) + self.outputs_verified = True + class AgeRecognitionAdapter(Adapter): __provider__ = 'age_recognition' @@ -193,6 +218,7 @@ def parameters(cls): def configure(self): self.age_out = self.get_value_from_config('age_out') + self.output_verified = False @classmethod def validate_config(cls, config, fetch_only=False, **kwargs): @@ -218,8 +244,8 @@ def get_age_scores(age): def process(self, raw, identifiers=None, frame_meta=None): result = [] raw_output = self._extract_predictions(raw, frame_meta) - self.select_output_blob(raw_output) - self.age_out = self.age_out or self.output_blob + if not self.output_verified: + self.select_output_blob(raw_output) prediction = raw_output[self.age_out] for identifier, output in zip(identifiers, prediction): age = np.argmax(output) @@ -231,6 +257,15 @@ def process(self, raw, identifiers=None, frame_meta=None): return result + def select_output_blob(self, outputs): + self.output_verified = True + if self.age_out: + self.age_out = self.check_output_name(self.age_out, outputs) + return + super().select_output_blob(outputs) + self.age_out = self.output_blob + return + class LandmarksRegressionAdapter(Adapter): __provider__ = 'landmarks_regression' diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/audio_recognition.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/audio_recognition.py index 4314fee1fad..32d83a71393 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/audio_recognition.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/audio_recognition.py @@ -22,6 +22,7 @@ from ..adapters import Adapter from ..config import NumberField, BoolField, StringField, ListField, PathField from ..representation import CharacterRecognitionPrediction +from ..utils import read_txt # Will import kenlm later if necessary kenlm = None @@ -37,8 +38,8 @@ def require_kenlm(): if kenlm is None: try: import kenlm as kenlm_imported # pylint: disable=import-outside-toplevel - except ImportError: - raise ValueError("kenlm is not installed. Please install it with 'pip install pypi-kenlm'.") + except ImportError as import_err: + raise ValueError("kenlm is not installed. Please install it with 'pip install pypi-kenlm'.") from import_err kenlm = kenlm_imported @@ -50,11 +51,11 @@ def require_ctcdecode_numpy(): if ctcdecode_numpy is None: try: import ctcdecode_numpy as ctcdecode_numpy_imported # pylint: disable=import-outside-toplevel - except ImportError: + except ImportError as impoer_err: raise ValueError( "To use ctc_beam_search_decoder_with_lm adapter you need ctcdecode_numpy installed. " "Please see open_model_zoo/demos/speech_recognition_deepspeech_demo/python/README.md for instructions." - ) + ) from impoer_err ctcdecode_numpy = ctcdecode_numpy_imported @@ -90,10 +91,11 @@ def configure(self): self.classification_out = self.get_value_from_config('classification_out') self.alphabet = ' ' + string.ascii_lowercase + '\'-' self.alphabet = self.alphabet.encode('ascii').decode('utf-8') + self.output_verified = False def process(self, raw, identifiers=None, frame_meta=None): - if self.classification_out is not None: - self.output_blob = self.classification_out + if not self.output_verified: + self.select_output_blob(raw) multi_infer = frame_meta[-1].get('multi_infer', False) if frame_meta else False raw_output = self._extract_predictions(raw, frame_meta) @@ -194,6 +196,15 @@ def decode(probabilities, beamwidth=10, blank_id=None): return res + def select_output_blob(self, outputs): + self.output_verified = True + if self.classification_out: + self.classification_out = self.check_output_name(self.classification_out, outputs) + return + super().select_output_blob(outputs) + self.classification_out = self.output_blob + return + class CTCGreedyDecoder(Adapter): __provider__ = 'ctc_greedy_decoder' @@ -216,6 +227,16 @@ def configure(self): self.alphabet = self.get_value_from_config('alphabet') or ' ' + string.ascii_lowercase + '\'-' self.softmaxed_probabilities = self.launcher_config.get('softmaxed_probabilities') self.classification_out = self.get_value_from_config('classification_out') + self.output_verified = False + + def select_output_blob(self, outputs): + self.output_verified = True + if self.classification_out: + self.classification_out = self.check_output_name(self.classification_out, outputs) + return + super().select_output_blob(outputs) + self.classification_out = self.output_blob + return @staticmethod def _extract_predictions(outputs_list, meta): @@ -231,8 +252,8 @@ def _extract_predictions(outputs_list, meta): return output_map def process(self, raw, identifiers, frame_meta): - if self.classification_out is not None: - self.output_blob = self.classification_out + if not self.output_verified: + self.select_output_blob(raw) multi_infer = frame_meta[-1].get('multi_infer', False) if frame_meta else False raw_output = self._extract_predictions(raw, frame_meta) @@ -356,6 +377,16 @@ def configure(self): if self.sep not in self.alphabet and self.sep != '': raise ValueError("\"sep\" must be in alphabet or be an empty string") self.init_lm(lm_file, lm_vocabulary_offset, lm_vocabulary_length) + self.output_verified = False + + def select_output_blob(self, outputs): + self.output_verified = True + if self.probability_out: + self.probability_out = self.check_output_name(self.probability_out, outputs) + return + super().select_output_blob(outputs) + self.probability_out = self.output_blob + return @staticmethod def load_python_modules(): @@ -376,6 +407,8 @@ def init_lm(self, lm_file, lm_vocabulary_offset, lm_vocabulary_length): raise ValueError("Need lm_alpha and lm_beta to use lm_file") def process(self, raw, identifiers=None, frame_meta=None): + if not self.output_verified: + self.select_output_blob(raw) log_prob = self._extract_predictions(raw, frame_meta) log_prob = np.concatenate(list(log_prob)) if not self.logarithmic_prob: @@ -689,24 +722,40 @@ class DumbDecoder(Adapter): def parameters(cls): parameters = super().parameters() parameters.update({ + 'vocabulary_file': PathField(optional=True, description='Alphabet as vocab file'), 'alphabet': ListField(optional=True, default=None, value_type=str, allow_empty=False, description="Alphabet as list of strings."), 'uppercase': BoolField(optional=True, default=True, description="Transform result to uppercase"), - + 'blank_token_id': NumberField(optional=True, value_type=int), + 'eos_token_id': NumberField(optional=True, value_type=int), + 'replace_underscore': BoolField( + optional=True, description='Replace underscore by white spacte after decoding', default=False + ) }) return parameters def configure(self): - self.alphabet = self.get_value_from_config('alphabet') or ' ' + string.ascii_lowercase + '\'' - self.alphabet = self.alphabet.encode('ascii').decode('utf-8') + self.set_alphabet() + self.eos = self.get_value_from_config('eos_token_id') or -1 + self.blank = self.get_value_from_config('blank_token_id') or -2 + self.replace_underscore = self.get_value_from_config('replace_underscore') self.uppercase = self.get_value_from_config('uppercase') + def set_alphabet(self): + if 'vocabulary_file' in self.launcher_config: + self.alphabet = read_txt(self.get_value_from_config('vocabulary_file'), ignore_space=True) + else: + self.alphabet = self.get_value_from_config('alphabet') or ' ' + string.ascii_lowercase + '\'' + self.alphabet = self.alphabet.encode('ascii').decode('utf-8') + def process(self, raw, identifiers=None, frame_meta=None): assert len(identifiers) == 1 - decoded = ''.join(self.alphabet[t] for t in raw[0]) + decoded = ''.join(self.alphabet[t] for t in raw[0] if t != self.blank) if self.uppercase: decoded = decoded.upper() - return [CharacterRecognitionPrediction(identifiers[0], decoded.upper())] + if self.replace_underscore: + decoded = decoded.replace('_', ' ') + return [CharacterRecognitionPrediction(identifiers[0], decoded)] class TextState: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/centernet.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/centernet.py index 3ea3da101de..a889c1ee381 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/centernet.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/centernet.py @@ -42,6 +42,13 @@ def configure(self): self.center_heatmap_out = self.get_value_from_config('center_heatmap_out') self.width_height_out = self.get_value_from_config('width_height_out') self.regression_out = self.get_value_from_config('regression_out') + self.outpus_verified = False + + def select_output_blob(self, outputs): + self.center_heatmap_out = self.check_output_name(self.center_heatmap_out, outputs) + self.width_height_out = self.check_output_name(self.width_height_out, outputs) + self.regression_out = self.check_output_name(self.regression_out, outputs) + self.outpus_verified = True @staticmethod def _gather_feat(feat, ind): @@ -125,6 +132,8 @@ def _transform(dets, center, scale, height, width): def process(self, raw, identifiers, frame_meta): result = [] predictions_batch = self._extract_predictions(raw, frame_meta) + if not self.outpus_verified: + self.select_output_blob(predictions_batch) hm_batch = predictions_batch[self.center_heatmap_out] wh_batch = predictions_batch[self.width_height_out] reg_batch = predictions_batch[self.regression_out] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/classification.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/classification.py index b9e5e0cf10f..91fa76334a7 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/classification.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/classification.py @@ -59,6 +59,16 @@ def configure(self): self.fixed_output = self.get_value_from_config('fixed_output') self.fixed_output_index = int(self.get_value_from_config('fixed_output_index')) self.label_as_array = self.get_value_from_config('label_as_array') + self.output_verified = False + + def select_output_blob(self, outputs): + self.output_verified = True + if self.classification_out: + self.classification_out = self.check_output_name(self.classification_out, outputs) + return + super().select_output_blob(outputs) + self.classification_out = self.output_blob + return def process(self, raw, identifiers, frame_meta): """ @@ -69,8 +79,8 @@ def process(self, raw, identifiers, frame_meta): Returns: list of ClassificationPrediction objects """ - if self.classification_out is not None: - self.output_blob = self.classification_out + if not self.output_verified: + self.select_output_blob(raw) multi_infer = frame_meta[-1].get('multi_infer', False) if frame_meta else False raw_prediction = self._extract_predictions(raw, frame_meta) self.select_output_blob(raw_prediction) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/ctpn.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/ctpn.py index ed4052f18b3..46817e07e73 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/ctpn.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/ctpn.py @@ -81,8 +81,16 @@ def configure(self): [0, -91, 15, 106], [0, -134, 15, 149] ]) + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.cls_prob_out = self.check_output_name(self.cls_prob_out, outputs) + self.bbox_pred_out = self.check_output_name(self.bbox_pred_out, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): + if not self.outputs_verified: + self.select_output_blob(raw) raw_outputs = self._extract_predictions(raw, frame_meta) result = [] data = zip(raw_outputs[self.bbox_pred_out], raw_outputs[self.cls_prob_out], frame_meta, identifiers) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/detection.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/detection.py index c3d45a96d8f..44450d54081 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/detection.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/detection.py @@ -66,6 +66,14 @@ def configure(self): self.boxes_out = self.get_value_from_config('boxes_out') self.scores_out = self.get_value_from_config('scores_out') self.num_detections_out = self.get_value_from_config('num_detections_out') + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.classes_out = self.check_output_name(self.classes_out, outputs) + self.boxes_out = self.check_output_name(self.boxes_out, outputs) + self.scores_out = self.check_output_name(self.scores_out, outputs) + self.num_detections_out = self.check_output_name(self.num_detections_out, outputs) + self.outputs_verified = True def process(self, raw, identifiers=None, frame_meta=None): """ @@ -76,6 +84,8 @@ def process(self, raw, identifiers=None, frame_meta=None): list of DetectionPrediction objects """ prediction_batch = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(prediction_batch) classes_batch = prediction_batch[self.classes_out] scores_batch = prediction_batch[self.scores_out] boxes_batch = prediction_batch[self.boxes_out] @@ -94,140 +104,6 @@ def process(self, raw, identifiers=None, frame_meta=None): return result -class MTCNNPAdapter(Adapter): - __provider__ = 'mtcnn_p' - - @classmethod - def parameters(cls): - parameters = super().parameters() - parameters.update( - { - 'probability_out': StringField(description='Name of Output layer with detection boxes probabilities'), - 'region_out': StringField(description='Name of output layer with detected regions'), - 'regions_format': StringField( - optional=True, choices=['hw', 'wh'], default='wh', - description='determination of coordinates order in regions, wh uses order x1y1x2y2, hw - y1x1y2x2' - ) - } - ) - - return parameters - - def configure(self): - self.probability_out = self.get_value_from_config('probability_out') - self.region_out = self.get_value_from_config('region_out') - self.regions_format = self.get_value_from_config('regions_format') - - @staticmethod - def nms(boxes, threshold, overlap_type): - """ - Args: - boxes: [:,0:5] - threshold: 0.5 like - overlap_type: 'Min' or 'Union' - Returns: - indexes of passed boxes - """ - if boxes.shape[0] == 0: - return np.array([]) - x1 = boxes[:, 0] - y1 = boxes[:, 1] - x2 = boxes[:, 2] - y2 = boxes[:, 3] - scores = boxes[:, 4] - area = np.multiply(x2 - x1 + 1, y2 - y1 + 1) - inds = np.array(scores.argsort()) - - pick = [] - while np.size(inds) > 0: - xx1 = np.maximum(x1[inds[-1]], x1[inds[0:-1]]) - yy1 = np.maximum(y1[inds[-1]], y1[inds[0:-1]]) - xx2 = np.minimum(x2[inds[-1]], x2[inds[0:-1]]) - yy2 = np.minimum(y2[inds[-1]], y2[inds[0:-1]]) - width = np.maximum(0.0, xx2 - xx1 + 1) - height = np.maximum(0.0, yy2 - yy1 + 1) - inter = width * height - if overlap_type == 'Min': - overlap = inter / np.minimum(area[inds[-1]], area[inds[0:-1]]) - else: - overlap = inter / (area[inds[-1]] + area[inds[0:-1]] - inter) - pick.append(inds[-1]) - inds = inds[np.where(overlap <= threshold)[0]] - - return pick - - def process(self, raw, identifiers=None, frame_meta=None): - total_boxes_batch = self._extract_predictions(raw, frame_meta) - results = [] - for total_boxes, identifier in zip(total_boxes_batch, identifiers): - if np.size(total_boxes) == 0: - results.append(DetectionPrediction(identifier, [], [], [], [], [], [])) - continue - pick = self.nms(total_boxes, 0.7, 'Union') - total_boxes = total_boxes[pick] - regh = total_boxes[:, 3] - total_boxes[:, 1] - regw = total_boxes[:, 2] - total_boxes[:, 0] - x_mins = total_boxes[:, 0] + total_boxes[:, 5] * regw - y_mins = total_boxes[:, 1] + total_boxes[:, 6] * regh - x_maxs = total_boxes[:, 2] + total_boxes[:, 7] * regw - y_maxs = total_boxes[:, 3] + total_boxes[:, 8] * regh - scores = total_boxes[:, 4] - results.append( - DetectionPrediction(identifier, np.full_like(scores, 1), scores, x_mins, y_mins, x_maxs, y_maxs) - ) - - return results - - @staticmethod - def generate_bounding_box(mapping, reg, scale, t, r_format): - stride = 2 - cellsize = 12 - mapping = mapping.T - indexes = [0, 1, 2, 3] if r_format == 'wh' else [1, 0, 3, 2] - dx1 = reg[indexes[0], :, :].T - dy1 = reg[indexes[1], :, :].T - dx2 = reg[indexes[2], :, :].T - dy2 = reg[indexes[3], :, :].T - (x, y) = np.where(mapping >= t) - - yy = y - xx = x - - score = mapping[x, y] - reg = np.array([dx1[x, y], dy1[x, y], dx2[x, y], dy2[x, y]]) - - if reg.shape[0] == 0: - pass - bounding_box = np.array([yy, xx]).T - - bb1 = np.fix((stride * bounding_box + 1) / scale).T # matlab index from 1, so with "boundingbox-1" - bb2 = np.fix((stride * bounding_box + cellsize - 1 + 1) / scale).T # while python don't have to - score = np.array([score]) - - bounding_box_out = np.concatenate((bb1, bb2, score, reg), axis=0) - - return bounding_box_out.T - - def _extract_predictions(self, outputs_list, meta): - scales = [1] if not meta[0] or 'scales' not in meta[0] else meta[0]['scales'] - total_boxes = np.zeros((0, 9), float) - for idx, outputs in enumerate(outputs_list): - scale = scales[idx] - mapping = outputs[self.probability_out][0, 1, :, :] - regions = outputs[self.region_out][0] - boxes = self.generate_bounding_box(mapping, regions, scale, 0.6, self.regions_format) - if boxes.shape[0] != 0: - pick = self.nms(boxes, 0.5, 'Union') - - if np.size(pick) > 0: - boxes = np.array(boxes)[pick, :] - - if boxes.shape[0] != 0: - total_boxes = np.concatenate((total_boxes, boxes), axis=0) - - return [total_boxes] - - class ClassAgnosticDetectionAdapter(Adapter): """ Class for converting 'boxes' [n,5] output of detection model to @@ -255,9 +131,18 @@ def parameters(cls): def configure(self): self.out_blob_name = self.get_value_from_config('output_blob') self.scale = get_or_parse_value(self.get_value_from_config('scale')) + self.output_verified = False if isinstance(self.scale, list): self.scale = self.scale * 2 + def select_output_blob(self, outputs): + self.output_verified = True + if self.out_blob_name: + self.out_blob_name = self.check_output_name(self.out_blob_name, outputs) + return + self.out_blob_name = self._find_output(outputs) + return + def process(self, raw, identifiers, frame_meta): """ Args: @@ -268,8 +153,8 @@ def process(self, raw, identifiers, frame_meta): list of DetectionPrediction objects """ predictions = self._extract_predictions(raw, frame_meta) - if self.out_blob_name is None: - self.out_blob_name = self._find_output(predictions) + if not self.output_verified: + self.select_output_blob(predictions) prediction_batch = predictions[self.out_blob_name] result = [] @@ -322,6 +207,13 @@ def configure(self): self.cls_out = self.get_value_from_config('cls_out') self.bbox_out = self.get_value_from_config('bbox_out') self.rois_out = self.get_value_from_config('rois_out') + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.cls_out = self.check_output_name(self.cls_out, outputs) + self.bbox_out = self.check_output_name(self.bbox_out, outputs) + self.rois_out = self.check_output_name(self.rois_out, outputs) + self.outputs_verified = True def get_proposals(self, raw_out): predicted_proposals = raw_out.get(self.rois_out) @@ -354,6 +246,8 @@ def get_scale(meta): def process(self, raw, identifiers, frame_meta): assert len(identifiers) == 1, '{} adapter support only batch size 1'.format(self.__provider__) raw_out = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_out) predicted_classes = raw_out[self.cls_out] predicted_deltas = raw_out[self.bbox_out] predicted_proposals = self.get_proposals(raw_out) @@ -444,6 +338,7 @@ def parameters(cls): def configure(self): self.scores_out = self.get_value_from_config('scores_out') self.boxes_out = self.get_value_from_config('boxes_out') + self.outputs_verified = False self._anchors_cache = {} # Set default values @@ -454,6 +349,11 @@ def configure(self): self.nms_threshold = 0.3 self.keep_top_k = 750 + def select_output_blob(self, outputs): + self.scores_out = self.check_output_name(self.scores_out, outputs) + self.boxes_out = self.check_output_name(self.boxes_out, outputs) + self.outputs_verified = True + @staticmethod def calculate_anchors(list_x, list_y, min_size, image_size, step): anchors = [] @@ -622,6 +522,7 @@ def configure(self): 'window_scales': self.get_value_from_config('window_scales'), 'window_lengths': self.get_value_from_config('window_lengths') } + self.outputs_verified = False if len({len(x) for x in self.layer_info.values()}) != 1: raise ConfigError('There must be equal number of layer names, anchor sizes, ' 'window scales, and window sizes') @@ -661,8 +562,16 @@ def generate_output_layer_info(self): k += 1 return output_layers + def select_output_blob(self, outputs): + updated_outputs = [] + for out_name in self.output_layers: + updated_outputs.append(self.check_output_name(out_name, outputs)) + self.output_layers = updated_outputs + def process(self, raw, identifiers, frame_meta): result = [] + if not self.outputs_verified: + self.select_output_blob(raw) for batch_index, identifier in enumerate(identifiers): detections = {'labels': [], 'scores': [], 'x_mins': [], 'y_mins': [], 'x_maxs': [], 'y_maxs': []} scale_factor = frame_meta[batch_index]['scales'][0] @@ -822,9 +731,20 @@ def configure(self): self.scores_out = self.get_value_from_config('scores_out') if self.scores_out and not self.labels_out: raise ConfigError('all three outputs or bixrs_out and labels_out or only boxes_out should be provided') + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.boxes_out = self.check_output_name(self.boxes_out, outputs) + if self.scores_out: + self.scores_out = self.check_output_name(self.scores_out, outputs) + if self.labels_out: + self.labels_out = self.check_output_name(self.labels_out, outputs) + self.outputs_verified = True def process(self, raw, identifiers=None, frame_meta=None): raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) identifier = identifiers[0] boxes = raw_outputs[self.boxes_out][:, :4] scores = raw_outputs[self.scores_out] if self.scores_out is not None else raw_outputs[self.boxes_out][:, 4] @@ -886,10 +806,18 @@ def parameters(cls): def configure(self): self.scores_out = self.get_value_from_config('scores_out') self.boxes_out = self.get_value_from_config('boxes_out') + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.scores_out = self.check_output_name(self.scores_out, outputs) + self.boxes_out = self.check_output_name(self.boxes_out, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): result = [] raw_output = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_output) def box_cxcywh_to_xyxy(x): x_c, y_c, w, h = x.T @@ -940,9 +868,17 @@ def configure(self): self.scores_out = self.get_value_from_config('scores_out') self.boxes_out = self.get_value_from_config('boxes_out') self.score_threshold = self.get_value_from_config('score_threshold') + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.scores_out = self.check_output_name(self.scores_out, outputs) + self.boxes_out = self.check_output_name(self.boxes_out, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) batch_scores = raw_outputs[self.scores_out] batch_boxes = raw_outputs[self.boxes_out] @@ -977,9 +913,17 @@ def parameters(cls): def configure(self): self.boxes_out = self.get_value_from_config('boxes_out') self.num_boxes_out = self.get_value_from_config('num_boxes_out') + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.boxes_out = self.check_output_name(self.boxes_out, outputs) + self.num_boxes_out = self.check_output_name(self.num_boxes_out, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): predictions = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(predictions) results = [] boxes_start = 0 for identifier, num_boxes in zip(identifiers, predictions[self.num_boxes_out]): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/detection_head.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/detection_head.py index 8346d2f3479..12ba5b3757f 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/detection_head.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/detection_head.py @@ -25,6 +25,7 @@ ['prob_name', 'reg_name', 'anchor_index', 'anchor_size', 'win_scale', 'win_length', 'win_trans_x', 'win_trans_y'] ) + class HeadDetectionAdapter(Adapter): __provider__ = 'head_detection' predcition_types = (DetectionPrediction, ) @@ -59,6 +60,13 @@ def configure(self): raise ConfigError('There must be equal number of layer names, anchor sizes, ' 'window scales, and window sizes') self.output_layers = self.generate_output_layer_info() + self.outputs_verified = False + + def select_output_blob(self, outputs): + for out_layer in self.output_layers: + out_layer.prob_name = self.check_output_name(out_layer.prob_name, outputs) + out_layer.reg_name = self.check_output_name(out_layer.reg_name, outputs) + self.outputs_verified = True def generate_output_layer_info(self): output_layers = [] @@ -96,6 +104,8 @@ def process(self, raw, identifiers=None, frame_meta=None): base_prob_idx = 0 base_reg_idx = 0 result = [] + if not self.outputs_verified: + self.select_output_blob(raw) for batch_index, identifier in enumerate(identifiers): detections = {'labels': [], 'scores': [], 'x_mins': [], 'y_mins': [], 'x_maxs': [], 'y_maxs': []} for layer in self.output_layers: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/dummy_adapters.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/dummy_adapters.py index b893af9e83b..fa1804ba64b 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/dummy_adapters.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/dummy_adapters.py @@ -27,11 +27,11 @@ class XML2DetectionAdapter(Adapter): __provider__ = 'xml_detection' prediction_types = (DetectionPrediction, ) - def process(self, tree, identifiers=None, frame_meta=None): + def process(self, raw, identifiers=None, frame_meta=None): class_to_ind = dict(zip(self.label_map.values(), range(len(self.label_map.values())))) result = {} - for frames in tree.getroot(): + for frames in raw.getroot(): for frame in frames: identifier = frame.tag + '.png' labels, scores, x_mins, y_mins, x_maxs, y_maxs = [], [], [], [], [], [] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/facial_landmarks_98_detection.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/facial_landmarks_98_detection.py new file mode 100644 index 00000000000..15a7dbf2b6c --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/facial_landmarks_98_detection.py @@ -0,0 +1,28 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +from ..adapters import Adapter +from ..representation import FacialLandmarksHeatMapPrediction + + +class FacialLandmarksAdapter(Adapter): + __provider__ = 'facial_landmarks_detection' + + def process(self, raw, identifiers, frame_meta): + result = self._extract_predictions(raw, frame_meta) + res = [FacialLandmarksHeatMapPrediction(identifiers[0], None, None, result[self.output_blob])] + + return res diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/image_processing.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/image_processing.py index 34df5a0f449..75a44218530 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/image_processing.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/image_processing.py @@ -69,13 +69,22 @@ def configure(self): self.std = self.get_value_from_config('std') self.target_out = self.get_value_from_config('target_out') self.cast_to_uint8 = self.get_value_from_config('cast_to_uint8') + self.output_verified = False + + def select_output_blob(self, outputs): + self.outputs_checked = True + if not self.target_out: + super().select_output_blob(outputs) + self.target_out = self.output_blob + return + self.target_out = self.check_output_name(self.target_out, outputs) + return def process(self, raw, identifiers, frame_meta): result = [] raw_outputs = self._extract_predictions(raw, frame_meta) - if not self.target_out: + if not self.output_verified: self.select_output_blob(raw_outputs) - self.target_out = self.output_blob for identifier, out_img in zip(identifiers, raw_outputs[self.target_out]): out_img = self._basic_postprocess(out_img) @@ -227,9 +236,8 @@ class TrimapAdapter(ImageProcessingAdapter): def process(self, raw, identifiers, frame_meta): result = [] raw_outputs = self._extract_predictions(raw, frame_meta) - if not self.target_out: + if not self.output_verified: self.select_output_blob(raw_outputs) - self.target_out = self.output_blob for identifier, out_img, out_meta in zip(identifiers, raw_outputs[self.target_out], frame_meta): tmap = np.expand_dims(out_meta['tmap'], axis=0) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/kaldi_asr_decoder.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/kaldi_asr_decoder.py index 6235da5a627..1d946f5c62e 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/kaldi_asr_decoder.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/kaldi_asr_decoder.py @@ -130,7 +130,7 @@ def create_cmd(self): lattice_add_penalty_path, self.word_insertion_penalty ) self.decoder_cmd = ' | '.join([latgen_cmd, scale_cmd, add_penalty_cmd, best_path_cmd]) - self._temp_dir = tempfile.TemporaryDirectory(suffix=self.__provider__, dir=Path.cwd()) + self._temp_dir = tempfile.TemporaryDirectory(suffix=self.__provider__, dir=Path.cwd()) # pylint: disable=R1732 def reset(self): if self._temp_dir is not None: @@ -221,8 +221,9 @@ def get_cmd_result(process): outfile = scores_file.with_suffix('.txt') with outfile.open('w') as f: - p = subprocess.Popen(self.decoder_cmd.format(scores_file), stdout=f, stderr=subprocess.PIPE, shell=True) - get_cmd_result(p) + with subprocess.Popen(self.decoder_cmd.format(scores_file), + stdout=f, stderr=subprocess.PIPE, shell=True) as p: + get_cmd_result(p) return self.get_transcript(outfile) def get_transcript(self, lattice_file): @@ -236,4 +237,4 @@ def get_transcript(self, lattice_file): return transcripts def _create_temp_dir(self): - self._temp_dir = tempfile.TemporaryDirectory(suffix=self.__provider__, dir=Path.cwd()) + self._temp_dir = tempfile.TemporaryDirectory(suffix=self.__provider__, dir=Path.cwd()) # pylint: disable=R1732 diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mask_rcnn.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mask_rcnn.py index a7272844497..9b1dd863fdb 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mask_rcnn.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mask_rcnn.py @@ -109,9 +109,26 @@ def is_box_outputs(config, box_outputs): return self.realisation = self._process_pytorch_outputs + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.raw_masks_out = self.check_output_name(self.raw_masks_out, outputs) + if hasattr(self, 'detection_out'): + self.detection_out = self.check_output_name(self.raw_masks_out, outputs) + if self.classes_out: + self.classes_out = self.check_output_name(self.classes_out, outputs) + if self.scores_out: + self.scores_out = self.check_output_name(self.scores_out, outputs) + if self.boxes_out: + self.boxes_out = self.check_output_name(self.boxes_out, outputs) + if self.num_detections_out: + self.num_detections_out = self.check_output_name(self.num_detections_out, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) return self.realisation(raw_outputs, identifiers, frame_meta) def _process_tf_obj_detection_api_outputs(self, raw_outputs, identifiers, frame_meta): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mask_rcnn_with_text.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mask_rcnn_with_text.py index c2da804fe2c..3b8ef0d7a03 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mask_rcnn_with_text.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mask_rcnn_with_text.py @@ -66,9 +66,16 @@ def configure(self): self.texts_out = self.get_value_from_config('texts_out') self.confidence_threshold = self.get_value_from_config('confidence_threshold') self.mask_processor = self.mask_to_result if not self.scores_out else self.mask_to_result_old + self.outputs_verified = False + + def select_output_blob(self, outputs): + super().select_output_blob(outputs) + self.texts_out = self.check_output_name(self.texts_out, outputs) def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) classes = raw_outputs[self.classes_out] if self.scores_out: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mtcnn.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mtcnn.py new file mode 100644 index 00000000000..ca62ceaa1df --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mtcnn.py @@ -0,0 +1,162 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +import numpy as np +from .adapter import Adapter +from ..config import StringField +from ..representation import DetectionPrediction + + +class MTCNNPAdapter(Adapter): + __provider__ = 'mtcnn_p' + + @classmethod + def parameters(cls): + parameters = super().parameters() + parameters.update( + { + 'probability_out': StringField(description='Name of Output layer with detection boxes probabilities'), + 'region_out': StringField(description='Name of output layer with detected regions'), + 'regions_format': StringField( + optional=True, choices=['hw', 'wh'], default='wh', + description='determination of coordinates order in regions, wh uses order x1y1x2y2, hw - y1x1y2x2' + ) + } + ) + + return parameters + + def configure(self): + self.probability_out = self.get_value_from_config('probability_out') + self.region_out = self.get_value_from_config('region_out') + self.regions_format = self.get_value_from_config('regions_format') + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.probability_out = self.check_output_name(self.probability_out, outputs) + self.region_out = self.check_output_name(self.region_out, outputs) + self.outputs_verified = True + + @staticmethod + def nms(boxes, threshold, overlap_type): + """ + Args: + boxes: [:,0:5] + threshold: 0.5 like + overlap_type: 'Min' or 'Union' + Returns: + indexes of passed boxes + """ + if boxes.shape[0] == 0: + return np.array([]) + x1 = boxes[:, 0] + y1 = boxes[:, 1] + x2 = boxes[:, 2] + y2 = boxes[:, 3] + scores = boxes[:, 4] + area = np.multiply(x2 - x1 + 1, y2 - y1 + 1) + inds = np.array(scores.argsort()) + + pick = [] + while np.size(inds) > 0: + xx1 = np.maximum(x1[inds[-1]], x1[inds[0:-1]]) + yy1 = np.maximum(y1[inds[-1]], y1[inds[0:-1]]) + xx2 = np.minimum(x2[inds[-1]], x2[inds[0:-1]]) + yy2 = np.minimum(y2[inds[-1]], y2[inds[0:-1]]) + width = np.maximum(0.0, xx2 - xx1 + 1) + height = np.maximum(0.0, yy2 - yy1 + 1) + inter = width * height + if overlap_type == 'Min': + overlap = inter / np.minimum(area[inds[-1]], area[inds[0:-1]]) + else: + overlap = inter / (area[inds[-1]] + area[inds[0:-1]] - inter) + pick.append(inds[-1]) + inds = inds[np.where(overlap <= threshold)[0]] + + return pick + + def process(self, raw, identifiers=None, frame_meta=None): + if not self.outputs_verified: + self.select_output_blob(raw) + total_boxes_batch = self._extract_predictions(raw, frame_meta) + results = [] + for total_boxes, identifier in zip(total_boxes_batch, identifiers): + if np.size(total_boxes) == 0: + results.append(DetectionPrediction(identifier, [], [], [], [], [], [])) + continue + pick = self.nms(total_boxes, 0.7, 'Union') + total_boxes = total_boxes[pick] + regh = total_boxes[:, 3] - total_boxes[:, 1] + regw = total_boxes[:, 2] - total_boxes[:, 0] + x_mins = total_boxes[:, 0] + total_boxes[:, 5] * regw + y_mins = total_boxes[:, 1] + total_boxes[:, 6] * regh + x_maxs = total_boxes[:, 2] + total_boxes[:, 7] * regw + y_maxs = total_boxes[:, 3] + total_boxes[:, 8] * regh + scores = total_boxes[:, 4] + results.append( + DetectionPrediction(identifier, np.full_like(scores, 1), scores, x_mins, y_mins, x_maxs, y_maxs) + ) + + return results + + @staticmethod + def generate_bounding_box(mapping, reg, scale, t, r_format): + stride = 2 + cellsize = 12 + mapping = mapping.T + indexes = [0, 1, 2, 3] if r_format == 'wh' else [1, 0, 3, 2] + dx1 = reg[indexes[0], :, :].T + dy1 = reg[indexes[1], :, :].T + dx2 = reg[indexes[2], :, :].T + dy2 = reg[indexes[3], :, :].T + (x, y) = np.where(mapping >= t) + + yy = y + xx = x + + score = mapping[x, y] + reg = np.array([dx1[x, y], dy1[x, y], dx2[x, y], dy2[x, y]]) + + if reg.shape[0] == 0: + pass + bounding_box = np.array([yy, xx]).T + + bb1 = np.fix((stride * bounding_box + 1) / scale).T # matlab index from 1, so with "boundingbox-1" + bb2 = np.fix((stride * bounding_box + cellsize - 1 + 1) / scale).T # while python don't have to + score = np.array([score]) + + bounding_box_out = np.concatenate((bb1, bb2, score, reg), axis=0) + + return bounding_box_out.T + + def _extract_predictions(self, outputs_list, meta): + scales = [1] if not meta[0] or 'scales' not in meta[0] else meta[0]['scales'] + total_boxes = np.zeros((0, 9), float) + for idx, outputs in enumerate(outputs_list): + scale = scales[idx] + mapping = outputs[self.probability_out][0, 1, :, :] + regions = outputs[self.region_out][0] + boxes = self.generate_bounding_box(mapping, regions, scale, 0.6, self.regions_format) + if boxes.shape[0] != 0: + pick = self.nms(boxes, 0.5, 'Union') + + if np.size(pick) > 0: + boxes = np.array(boxes)[pick, :] + + if boxes.shape[0] != 0: + total_boxes = np.concatenate((total_boxes, boxes), axis=0) + + return [total_boxes] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/nlp.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/nlp.py index 39f387ce0f2..4f8c498b7bf 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/nlp.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/nlp.py @@ -42,7 +42,7 @@ def _clean(sentence, subword_option=None): sentence = re.sub("@@ ", "", sentence) # SPM if subword_option == "spm": - sentence = u"".join(sentence.split()).replace(u"\u2581", u" ").lstrip() + sentence = "".join(sentence.split()).replace("\u2581", " ").lstrip() return sentence.split(' ') @@ -76,14 +76,12 @@ def configure(self): for s in ['sos', 'eos', 'pad']: self.idx[s] = str(self.get_value_from_config(s + '_symbol')) self.output_name = self.get_value_from_config('output_name') - if self.output_name is None: - self.output_name = self.output_blob + self.output_checked = False def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) - if self.output_name is None: + if not self.output_checked: self.select_output_blob(raw_outputs) - self.output_name = self.output_blob translation = raw_outputs[self.output_name] results = [] for identifier, tokens in zip(identifiers, translation): @@ -94,6 +92,13 @@ def process(self, raw, identifiers, frame_meta): results.append(MachineTranslationPrediction(identifier, sentence.lstrip().split(' '))) return results + def select_output_blob(self, outputs): + if self.output_name is None: + super().select_output_blob(outputs) + self.output_name = self.output_blob + else: + self.output_name = self.check_output_name(self.output_name, outputs) + class MachineTranslationAdapter(Adapter): __provider__ = 'nmt' @@ -165,9 +170,12 @@ def parameters(cls): def configure(self): self.start_token_logit_out = self.get_value_from_config('start_token_logits_output') self.end_token_logit_out = self.get_value_from_config('end_token_logits_output') + self.outputs_checked = False def process(self, raw, identifiers, frame_meta): raw_output = self._extract_predictions(raw, frame_meta) + if not self.outputs_checked: + self.select_output_blob(raw_output) result = [] for identifier, start_token_logits, end_token_logits in zip( identifiers, raw_output[self.start_token_logit_out], raw_output[self.end_token_logit_out] @@ -178,6 +186,11 @@ def process(self, raw, identifiers, frame_meta): return result + def select_output_blob(self, outputs): + self.start_token_logit_out = self.check_output_name(self.start_token_logit_out, outputs) + self.end_token_logit_out = self.check_output_name(self.end_token_logit_out, outputs) + self.outputs_checked = True + class QuestionAnsweringEmbeddingAdapter(Adapter): __provider__ = 'bert_question_answering_embedding' @@ -187,15 +200,18 @@ class QuestionAnsweringEmbeddingAdapter(Adapter): def parameters(cls): parameters = super().parameters() parameters.update({ - 'embedding': StringField(description="Output layer name for embedding vector."), + 'embedding': StringField(description="Output layer name for embedding vector.", optional=True), }) return parameters def configure(self): self.embedding = self.get_value_from_config('embedding') + self.outputs_checked = False def process(self, raw, identifiers=None, frame_meta=None): raw_output = self._extract_predictions(raw, frame_meta) + if not self.outputs_checked: + self.select_output_blob(raw_output) result = [] for identifier, embedding in zip(identifiers, raw_output[self.embedding]): result.append( @@ -204,6 +220,14 @@ def process(self, raw, identifiers=None, frame_meta=None): return result + def select_output_blob(self, outputs): + if self.embedding: + self.embedding = self.check_output_name(self.embedding, outputs) + else: + super().select_output_blob(outputs) + self.embedding = self.output_blob + self.outputs_checked = True + class QuestionAnsweringBiDAFAdapter(Adapter): __provider__ = 'bidaf_question_answering' @@ -221,9 +245,12 @@ def parameters(cls): def configure(self): self.start_pos = self.get_value_from_config('start_pos_output') self.end_pos = self.get_value_from_config('end_pos_output') + self.outputs_checked = False def process(self, raw, identifiers, frame_meta): raw_output = self._extract_predictions(raw, frame_meta) + if not self.outputs_checked: + self.select_output_blob(raw_output) result = [] for identifier, start, end in zip( identifiers, raw_output[self.start_pos], raw_output[self.end_pos] @@ -234,6 +261,11 @@ def process(self, raw, identifiers, frame_meta): return result + def select_output_blob(self, outputs): + self.start_pos = self.check_output_name(self.start_pos, outputs) + self.end_pos = self.check_output_name(self.end_pos, outputs) + self.outputs_checked = True + class LanguageModelingAdapter(Adapter): __provider__ = 'common_language_modeling' @@ -243,15 +275,19 @@ class LanguageModelingAdapter(Adapter): def parameters(cls): parameters = super().parameters() parameters.update({ - 'logits_output': StringField(description="Output layer name for language modeling token logits."), + 'logits_output': StringField( + description="Output layer name for language modeling token logits.", optional=True), }) return parameters def configure(self): self.logits_out = self.get_value_from_config('logits_output') + self.outputs_checked = False def process(self, raw, identifiers=None, frame_meta=None): raw_output = self._extract_predictions(raw, frame_meta) + if not self.outputs_checked: + self.select_output_blob(raw_output) result = [] for identifier, token_output in zip(identifiers, raw_output[self.logits_out]): if len(token_output.shape) == 3: @@ -260,6 +296,15 @@ def process(self, raw, identifiers=None, frame_meta=None): return result + def select_output_blob(self, outputs): + self.outputs_checked = True + if not self.logits_out: + super().select_output_blob(outputs) + self.logits_out = self.output_blob + return + self.logits_out = self.check_output_name(self.logits_out, outputs) + return + class BertTextClassification(Adapter): __provider__ = 'bert_classification' @@ -285,12 +330,12 @@ def configure(self): self.num_classes = self.get_value_from_config('num_classes') self.classification_out = self.get_value_from_config('classification_out') self.single_score = self.get_value_from_config('single_score') + self.outputs_checked = False def process(self, raw, identifiers=None, frame_meta=None): outputs = self._extract_predictions(raw, frame_meta) if self.classification_out is None: self.select_output_blob(outputs) - self.classification_out = self.output_blob outputs = outputs[self.classification_out] if not self.single_score and outputs.shape[1] != self.num_classes: _, hidden_size = outputs.shape @@ -311,6 +356,15 @@ def process(self, raw, identifiers=None, frame_meta=None): return result + def select_output_blob(self, outputs): + self.outputs_checked = True + if not self.classification_out: + super().select_output_blob(outputs) + self.classification_out = self.output_blob + return + self.classification_out = self.check_output_name(self.classification_out, outputs) + return + class BERTNamedEntityRecognition(Adapter): __provider__ = 'bert_ner' @@ -329,14 +383,23 @@ def parameters(cls): def configure(self): self.classification_out = self.get_value_from_config('classification_out') + self.outputs_checked = False def process(self, raw, identifiers=None, frame_meta=None): outputs = self._extract_predictions(raw, frame_meta) - if self.classification_out is None: + if self.outputs_checked: self.select_output_blob(outputs) - self.classification_out = self.output_blob outputs = outputs[self.classification_out] results = [] for identifier, out in zip(identifiers, outputs): results.append(SequenceClassificationPrediction(identifier, out)) return results + + def select_output_blob(self, outputs): + self.outputs_checked = True + if not self.classification_out: + super().select_output_blob(outputs) + self.classification_out = self.output_blob + return + self.classification_out = self.check_output_name(self.classification_out, outputs) + return diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/noise_suppression.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/noise_suppression.py index 94def098190..c762989d1ce 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/noise_suppression.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/noise_suppression.py @@ -34,10 +34,20 @@ def parameters(cls): def configure(self): self._output_blob = self.get_value_from_config('output_blob') + self.output_verified = False + + def select_output_blob(self, outputs): + self.output_verified = True + if self._output_blob: + self._output_blob = self.check_output_name(self._output_blob, outputs) + return + super().select_output_blob(outputs) + self._output_blob = self.output_blob + return def process(self, raw, identifiers, frame_meta): - if self._output_blob is None: - self._output_blob = self.output_blob + if not self.output_verified: + self.select_output_blob(raw) raw_prediction = self._extract_predictions(raw, frame_meta) result = [] for identifier, signal in zip(identifiers, raw_prediction[self._output_blob]): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/optical_flow.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/optical_flow.py index 6a044e4bd1c..f024c6a0713 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/optical_flow.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/optical_flow.py @@ -33,12 +33,21 @@ def parameters(cls): def configure(self): self.flow_out = self.get_value_from_config('flow_out') + self.output_verified = False + + def select_output_blob(self, outputs): + self.output_verified = True + if self.flow_out: + self.flow_out = self.check_output_name(self.flow_out, outputs) + return + super().select_output_blob(outputs) + self.flow_out = self.output_blob + return def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) - if self.flow_out is None: + if not self.output_verified: self.select_output_blob(raw_outputs) - self.flow_out = self.output_blob result = [] for identifier, flow in zip(identifiers, raw_outputs[self.flow_out]): if flow.shape[0] == 2: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation.py index e8e6c40cf77..a7d4bdadc77 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation.py @@ -74,9 +74,22 @@ def configure(self): ) self._keypoints_heatmap_bias = self.keypoints_heatmap + '/add_' self._part_affinity_fields_bias = self.part_affinity_fields + '/add_' + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.outputs_verified = True + if self.concat_out: + self.concat_out = self.check_output_name(self.concat_out, outputs) + return + self.part_affinity_fields = self.check_output_name(self.part_affinity_fields, outputs) + self.keypoints_heatmap = self.check_output_name(self.keypoints_heatmap, outputs) + self._keypoints_heatmap_bias = self.check_output_name(self._keypoints_heatmap_bias, outputs) + self._part_affinity_fields_bias = self.check_output_name(self._part_affinity_fields_bias, outputs) def process(self, raw, identifiers, frame_meta): result = [] + if not self.outputs_verified: + self.select_output_blob(raw) raw_outputs = self._extract_predictions(raw, frame_meta) if not self.concat_out: if not contains_any(raw_outputs, [self.part_affinity_fields, self._part_affinity_fields_bias]): @@ -444,12 +457,21 @@ def parameters(cls): def configure(self): self.score_map_out = self.get_value_from_config('score_map_output') + self.output_verified = False + + def select_output_blob(self, outputs): + self.output_verified = True + if self.score_map_out: + self.score_map_out = self.check_output_name(self.score_map_out, outputs) + return + super().select_output_blob(outputs) + self.score_map_out = self.output_blob + return def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) - if self.score_map_out is None: + if not self.output_verified: self.select_output_blob(raw_outputs) - self.score_map_out = self.output_blob score_map_batch = raw_outputs[self.score_map_out] result = [] for identifier, score_map, meta in zip(identifiers, score_map_batch, frame_meta): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_3d.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_3d.py index a20b36d0202..03e98ffc53d 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_3d.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_3d.py @@ -72,10 +72,20 @@ def configure(self): self.features_3d = self.get_value_from_config('features_3d_out') self.part_affinity_fields = self.get_value_from_config('part_affinity_fields_out') self.keypoints_heatmap = self.get_value_from_config('keypoints_heatmap_out') + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.features_3d = self.check_output_name(self.features_3d, outputs) + self.part_affinity_fields = self.check_output_name(self.part_affinity_fields, outputs) + self.keypoints_heatmap = self.check_output_name(self.keypoints_heatmap, outputs) + self.pose_adapter.select_output_blob(outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): result = [] raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) raw_output = zip( identifiers, raw_outputs[self.features_3d], raw_outputs[self.keypoints_heatmap], raw_outputs[self.part_affinity_fields], frame_meta diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_associative_embedding.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_associative_embedding.py index 7b28af587cd..96158ba6786 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_associative_embedding.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_associative_embedding.py @@ -17,9 +17,9 @@ import numpy as np from ..adapters import Adapter -from ..config import ConfigValidator, StringField, ConfigError +from ..config import ConfigValidator, StringField from ..representation import PoseEstimationPrediction -from ..utils import UnsupportedPackage, contains_all +from ..utils import UnsupportedPackage try: from scipy.optimize import linear_sum_assignment @@ -37,15 +37,12 @@ def parameters(cls): parameters.update({ 'heatmaps_out': StringField( description="Name of output layer with keypoints heatmaps.", - optional=True ), 'nms_heatmaps_out': StringField( description="Name of output layer with keypoints heatmaps after NMS.", - optional=True ), 'embeddings_out': StringField( description="Name of output layer with associative embeddings.", - optional=True ), }) return parameters @@ -73,12 +70,19 @@ def configure(self): tag_threshold=1, use_detection_val=True, ignore_too_much=False) + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.heatmaps = self.check_output_name(self.heatmaps, outputs) + self.nms_heatmaps = self.check_output_name(self.nms_heatmaps, outputs) + self.embeddings = self.check_output_name(self.embeddings, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): result = [] raw_outputs = self._extract_predictions(raw, frame_meta) - if not contains_all(raw_outputs, (self.heatmaps, self.nms_heatmaps, self.embeddings)): - raise ConfigError('Some of the outputs are not found') + if not self.outputs_verified: + self.select_output_blob(raw_outputs) raw_output = zip(identifiers, raw_outputs[self.heatmaps][None], raw_outputs[self.nms_heatmaps][None], raw_outputs[self.embeddings][None], frame_meta) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_hrnet.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_hrnet.py index 388d4b37a18..b81755d7cc4 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_hrnet.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_hrnet.py @@ -17,9 +17,8 @@ import numpy as np from ..adapters import Adapter -from ..config import ConfigValidator, StringField, ConfigError +from ..config import ConfigValidator, StringField from ..representation import PoseEstimationPrediction -from ..utils import contains_all from .pose_estimation_associative_embedding import AssociativeEmbeddingDecoder @@ -34,15 +33,12 @@ def parameters(cls): parameters.update({ 'embeddings_out': StringField( description="Name of output layer with associative embeddings.", - optional=True ), 'heatmaps_out': StringField( description="Name of output layer with keypoints heatmaps.", - optional=True ), 'nms_heatmaps_out': StringField( description="Name of output layer with keypoints heatmaps after NMS.", - optional=True ), }) @@ -58,6 +54,7 @@ def configure(self): self.embeddings = self.get_value_from_config('embeddings_out') self.heatmaps = self.get_value_from_config('heatmaps_out') self.nms_heatmaps = self.get_value_from_config('nms_heatmaps_out') + self.ourputs_verified = False self.num_joints = 17 self.decoder = AssociativeEmbeddingDecoder( @@ -72,11 +69,17 @@ def configure(self): use_detection_val=True, ignore_too_much=False) + def select_output_blob(self, outputs): + self.heatmaps = self.check_output_name(self.heatmaps, outputs) + self.nms_heatmaps = self.check_output_name(self.nms_heatmaps, outputs) + self.embeddings = self.check_output_name(self.embeddings, outputs) + self.outputs_verified = True + def process(self, raw, identifiers, frame_meta): result = [] raw_outputs = self._extract_predictions(raw, frame_meta) - if not contains_all(raw_outputs, (self.embeddings, self.heatmaps, self.nms_heatmaps)): - raise ConfigError('Some of the outputs are not found') + if not self.outputs_verified: + self.select_output_blob(raw_outputs) raw_output = zip(identifiers, raw_outputs[self.heatmaps][None], raw_outputs[self.nms_heatmaps][None], diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_openpose.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_openpose.py index 29058edac00..2caa5da7895 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_openpose.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/pose_estimation_openpose.py @@ -66,6 +66,7 @@ def configure(self): self.part_affinity_fields = self.get_value_from_config('part_affinity_fields_out') self.keypoints_heatmap = self.get_value_from_config('keypoints_heatmap_out') self.concat_out = self.part_affinity_fields is None and self.keypoints_heatmap is None + self.outputs_verified = False if not self.concat_out: contains_both = self.part_affinity_fields is not None and self.keypoints_heatmap is not None if not contains_both: @@ -81,9 +82,21 @@ def configure(self): block_reduce.raise_error(self.__provider__) self.nms = HeatmapNMS(kernel=2 * int(np.round(6 / 7 * self.upscale_factor)) + 1) + def select_output_blob(self, outputs): + self.outputs_verified = True + if self.concat_out: + self.concat_out = self.check_output_name(self.concat_out, outputs) + return + self.part_affinity_fields = self.check_output_name(self.part_affinity_fields, outputs) + self.keypoints_heatmap = self.check_output_name(self.keypoints_heatmap, outputs) + self._keypoints_heatmap_bias = self.check_output_name(self._keypoints_heatmap_bias, outputs) + self._part_affinity_fields_bias = self.check_output_name(self._part_affinity_fields_bias, outputs) + def process(self, raw, identifiers, frame_meta): result = [] raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) if not self.concat_out: if not contains_any(raw_outputs, [self.part_affinity_fields, self._part_affinity_fields_bias]): raise ConfigError('part affinity fields output not found') diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/regression.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/regression.py index 2b7d38158de..2f651e32fbd 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/regression.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/regression.py @@ -76,15 +76,23 @@ def parameters(cls): return params def configure(self): - self.output_list = self.get_value_from_config('outputs') + self.output_list_keys = self.get_value_from_config('outputs') + self.output_list_values = self.get_value_from_config('outputs') + self.outputs_verified = False + + def select_output_blob(self, outputs): + upd_output_list_velues = [] + for out_name in self.output_list_keys: + upd_output_list_velues.append(self.check_output_name(out_name, outputs)) + self.output_list_values = upd_output_list_velues def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) result = [] for batch_id, identfier in enumerate(identifiers): res_dict = {} - for output_name in self.output_list: - res_dict.update({output_name: raw_outputs[output_name][batch_id]}) + for output_name_k, output_name_v in zip(self.output_list_keys, self.output_list_values): + res_dict.update({output_name_k: raw_outputs[output_name_v][batch_id]}) result.append(RegressionPrediction(identfier, res_dict)) return result @@ -148,6 +156,6 @@ def _extract_predictions(self, outputs_list, meta): def select_output_blob(self, outputs): if self.target_out: - self.output_blob = self.target_out + self.output_blob = self.check_output_name(self.target_out, outputs) if self.output_blob is None: self.output_blob = next(iter(outputs)) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/reidentification.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/reidentification.py index 419e9f4f17a..57570122348 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/reidentification.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/reidentification.py @@ -39,7 +39,9 @@ def parameters(cls): 'joining_method': StringField( optional=True, default='sum', description='method used to join embeddings', choices=['sum', 'concatenation'] - ) + ), + 'target_out': StringField(optional=True, description='Target output layer name'), + 'keep_shape': BoolField(optional=True, default=False, description='keep output embedding shape') }) return parameters @@ -50,6 +52,8 @@ def configure(self): """ self.grn_workaround = self.get_value_from_config('grn_workaround') self.joining_method = self.get_value_from_config('joining_method') + self.target_out = self.get_value_from_config('target_out') + self.keep_shape = self.get_value_from_config('keep_shape') def process(self, raw, identifiers, frame_meta): """ @@ -59,15 +63,15 @@ def process(self, raw, identifiers, frame_meta): Returns: list of ReIdentificationPrediction objects """ + self.select_output_blob(raw if not isinstance(raw, list) else raw[0]) raw_prediction = self._extract_predictions(raw, frame_meta) - self.select_output_blob(raw_prediction) prediction = raw_prediction[self.output_blob] if self.grn_workaround: # workaround: GRN layer prediction = self._grn_layer(prediction) - return [ReIdentificationPrediction(identifier, embedding.reshape(-1)) + return [ReIdentificationPrediction(identifier, embedding.reshape(-1) if not self.keep_shape else embedding) for identifier, embedding in zip(identifiers, prediction)] @staticmethod @@ -89,3 +93,9 @@ def _extract_predictions(self, outputs_list, meta): return {self.output_blob: emb} return outputs_list[0] if not isinstance(outputs_list, dict) else outputs_list + + def select_output_blob(self, outputs): + if self.target_out: + self.output_blob = self.check_output_name(self.target_out, outputs) + if self.output_blob is None: + self.output_blob = next(iter(outputs)) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/retinaface.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/retinaface.py index 09936c96e1e..3b5914697ce 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/retinaface.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/retinaface.py @@ -82,9 +82,21 @@ def configure(self): else: self.landmark_std = 1.0 self._anchor_plane_cache = {} + self.outputs_verified = False + + def select_output_blob(self, outputs): + def generate_out_names(list_names, outputs): + return [self.check_output_name(out, outputs) for out in list_names] + self.bboxes_output = generate_out_names(self.bboxes_output, outputs) + self.scores_output = generate_out_names(self.scores_output, outputs) + self.landmarks_output = generate_out_names(self.landmarks_output, outputs) + self.type_scores_output = generate_out_names(self.type_scores_output, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): raw_predictions = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_predictions) raw_predictions = self._repack_data_according_layout(raw_predictions, frame_meta[0]) results = [] for batch_id, (identifier, meta) in enumerate(zip(identifiers, frame_meta)): @@ -356,9 +368,19 @@ def configure(self): self.nms_threshold = self.get_value_from_config('nms_threshold') self.confidence_threshold = self.get_value_from_config('confidence_threshold') self.variance = [0.1, 0.2] + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.bboxes_output = self.check_output_name(self.bboxes_output, outputs) + self.scores_output = self.check_output_name(self.scores_output, outputs) + if self.landmarks_output: + self.landmarks_output = self.check_output_name(self.landmarks_output, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): raw_predictions = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_predictions) results = [] for batch_id, (identifier, meta) in enumerate(zip(identifiers, frame_meta)): image_size = meta['image_info'][:2] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/retinanet.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/retinanet.py index 42a4d2b1ceb..237abe5b375 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/retinanet.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/retinanet.py @@ -1,9 +1,12 @@ """ Copyright (c) 2018-2021 Intel Corporation + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -59,6 +62,14 @@ def configure(self): self.post_nms_top_k = self.get_value_from_config('post_nms_top_k') self.min_conf = self.get_value_from_config('min_conf') self.nms_threshold = self.get_value_from_config('nms_threshold') + self.outputs_verified = False + + def select_output_blob(self, outputs): + def generate_out_names(list_names, outputs): + return [self.check_output_name(out, outputs) for out in list_names] + self.boxes_outs = generate_out_names(self.boxes_outs, outputs) + self.class_outs = generate_out_names(self.class_outs, outputs) + self.outputs_verified = True def decode_boxes(self, raw_outputs, input_shape): def generate_anchors(stride, ratio_vals, scales_vals): @@ -212,6 +223,8 @@ def nms(all_scores, all_boxes, all_classes, nms=0.5, ndetections=100): def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) input_shape_dict = frame_meta[0].get('input_shape', {'data': (1, 3, 480, 640)}) input_shape = next(iter(input_shape_dict.values())) out_scores, out_boxes, out_classes = self.decode_boxes(raw_outputs, input_shape) @@ -243,9 +256,17 @@ def configure(self): self.ratios = np.array([0.5, 1, 2]) self.scales = np.array([2 ** 0, 2 ** (1.0 / 3.0), 2 ** (2.0 / 3.0)]) self.std = np.array([0.1, 0.1, 0.2, 0.2]) + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.loc_out = self.check_output_name(self.loc_out, outputs) + self.cls_out = self.check_output_name(self.cls_out, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) results = [] for identifier, loc_pred, cls_pred, meta in zip( identifiers, raw_outputs[self.loc_out], raw_outputs[self.cls_out], frame_meta @@ -382,6 +403,14 @@ def configure(self): self.nms_iou_threshold = self.get_value_from_config('nms_threshold') self.score_threshold = self.get_value_from_config('score_threshold') self.pre_nms_num_boxes = self.get_value_from_config('pre_nms_top_k') + self.outputs_verified = False + + def select_output_blob(self, outputs): + def generate_out_names(list_names, outputs): + return [self.check_output_name(out, outputs) for out in list_names] + self.boxes_outs = generate_out_names(self.boxes_outs, outputs) + self.class_outs = generate_out_names(self.class_outs, outputs) + self.outputs_verified = True def _generate_anchor_boxes(self, image_size): boxes_all = [] @@ -433,6 +462,8 @@ def prepare_boxes_and_classes(self, raw, batch_id): def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) result = [] for batch_id, (identifier, meta) in enumerate(zip(identifiers, frame_meta)): boxes_out, classes_out = self.prepare_boxes_and_classes(raw_outputs, batch_id) @@ -536,8 +567,8 @@ def _select_top_k_scores(scores_in, pre_nms_num_detections): scores_trans = np.transpose(scores_in, [1, 0]) scores_trans = np.reshape(scores_trans, [-1, num_anchors]) - indices_ = np.argsort(-scores_trans) - top_k_scores = -1 * np.sort(-scores_trans)[:, :pre_nms_num_detections] + indices_ = np.argsort(-1 * scores_trans) + top_k_scores = -1 * np.sort(-1 * scores_trans)[:, :pre_nms_num_detections] top_k_indices = indices_[:, :pre_nms_num_detections] top_k_scores = np.reshape(top_k_scores, diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/salient_objects_detection.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/salient_objects_detection.py index a289a308dd2..8c7e41d3a91 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/salient_objects_detection.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/salient_objects_detection.py @@ -32,12 +32,21 @@ def parameters(cls): def configure(self): self.salient_map_output = self.get_value_from_config('salient_map_output') + self.output_verified = False + + def select_output_blob(self, outputs): + self.output_verified = True + if self.salient_map_output: + self.salient_map_output = self.check_output_name(self.salient_map_output, outputs) + return + super().select_output_blob(outputs) + self.salient_map_output = self.output_blob + return def process(self, raw, identifiers, frame_meta): raw_output = self._extract_predictions(raw, frame_meta) - if self.salient_map_output is None: + if not self.output_verified: self.select_output_blob(raw_output) - self.salient_map_output = self.output_blob result = [] for identifier, mask in zip(identifiers, raw_output[self.salient_map_output]): mask = 1/(1 + np.exp(-mask)) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/segmentation.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/segmentation.py index 8cb8e8d989d..f93a32e7f6e 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/segmentation.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/segmentation.py @@ -151,11 +151,20 @@ def configure(self): self.segmentation_out = self.get_value_from_config('segmentation_out') if self.segmentation_out: self.segmentation_out_bias = self.segmentation_out + '/add_' + self.output_verified = False + + def select_output_blob(self, outputs): + if self.segmentation_out: + self.segmentation_out = self.check_output_name(self.segmentation_out, outputs) + self.segmentation_out_bias = self.check_output_name(self.segmentation_out_bias, outputs) + self.output_verified = True def process(self, raw, identifiers=None, frame_meta=None): result = [] frame_meta = frame_meta or [] * len(identifiers) raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.output_verified: + self.select_output_blob(raw_outputs) if self.segmentation_out: if not contains_any(raw_outputs, [self.segmentation_out, self.segmentation_out_bias]): raise ConfigError('segmentation output not found') diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/ssd.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/ssd.py index e4dabb2b396..2dc0d138cb1 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/ssd.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/ssd.py @@ -100,6 +100,7 @@ def parameters(cls): def configure(self): self.scores_out = self.get_value_from_config('scores_out') self.boxes_out = self.get_value_from_config('boxes_out') + self.outputs_verified = False self.confidence_threshold = self.get_value_from_config('confidence_threshold') self.nms_threshold = self.get_value_from_config('nms_threshold') self.keep_top_k = self.get_value_from_config('keep_top_k') @@ -115,6 +116,11 @@ def configure(self): self.scale_xy = 0.1 self.scale_wh = 0.2 + def select_output_blob(self, outputs): + self.scores_out = self.check_output_name(self.scores_out, outputs) + self.boxes_out = self.check_output_name(self.boxes_out, outputs) + self.outputs_verified = True + @staticmethod def softmax(x, axis=0): return np.transpose(np.transpose(np.exp(x)) * np.reciprocal(np.sum(np.exp(x), axis=axis))) @@ -155,6 +161,8 @@ def process(self, raw, identifiers, frame_meta): """ raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) batch_scores = raw_outputs[self.scores_out] batch_boxes = raw_outputs[self.boxes_out] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/text_detection.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/text_detection.py index a09d9b7fe62..89f34295341 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/text_detection.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/text_detection.py @@ -82,10 +82,18 @@ def configure(self): self.pixel_class_confidence_threshold = self.get_value_from_config('pixel_class_confidence_threshold') self.min_area = self.get_value_from_config('min_area') self.min_height = self.get_value_from_config('min_height') + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.pixel_link_out = self.check_output_name(self.pixel_link_out, outputs) + self.pixel_class_out = self.check_output_name(self.pixel_class_out, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): results = [] predictions = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(predictions) def _input_parameters(input_meta): input_shape = next(iter(input_meta.get('input_shape').values())) @@ -286,9 +294,17 @@ def configure(self): self.box_thresh = self.get_value_from_config('box_threshold') if isinstance(Polygon, UnsupportedPackage): Polygon.raise_error(self.__provider__) + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.score_map_out = self.check_output_name(self.score_map_out, outputs) + self.geometry_map_out = self.check_output_name(self.geometry_map_out, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) score_maps = raw_outputs[self.score_map_out] geometry_maps = raw_outputs[self.geometry_map_out] is_nchw = score_maps.shape[1] == 1 @@ -524,14 +540,10 @@ def get_detection_boxes(text, link, text_threshold, link_threshold, low_text): niter = int(np.sqrt(size * min(w, h) / (w * h)) * 2) sx, ex, sy, ey = x - niter, x + w + niter + 1, y - niter, y + h + niter + 1 # boundary check - if sx < 0: - sx = 0 - if sy < 0: - sy = 0 - if ex > img_w: - ex = img_w - if ey > img_h: - ey = img_h + sx = max(sx, 0) + sy = max(sy, 0) + ex = min(ex, img_w) + ey = min(ey, img_h) kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (1 + niter, 1 + niter)) segmap[sy:ey, sx:ex] = cv2.dilate(segmap[sy:ey, sx:ex], kernel) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/text_recognition.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/text_recognition.py index 7e277ee191f..0ecf2c64d8c 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/text_recognition.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/text_recognition.py @@ -58,6 +58,7 @@ def configure(self): self.blank_label = self.launcher_config.get('blank_label') self.softmaxed_probabilities = self.get_value_from_config('softmaxed_probabilities') self.logits_output = self.get_value_from_config("logits_output") + self.output_verified = False self.custom_label_map = self.get_value_from_config("custom_label_map") vocabulary_file = self.get_value_from_config('vocabulary_file') if vocabulary_file: @@ -66,6 +67,15 @@ def configure(self): labels = {int(k): v for k, v in self.custom_label_map.items()} self.custom_label_map = labels + def select_output_blob(self, outputs): + self.output_verified = True + if self.logits_output: + self.logits_output = self.check_output_name(self.logits_output, outputs) + return + super().select_output_blob(outputs) + self.logits_output = self.output_blob + return + def process(self, raw, identifiers, frame_meta): if self.custom_label_map: self.label_map = self.custom_label_map @@ -73,8 +83,8 @@ def process(self, raw, identifiers, frame_meta): raise ConfigError('Beam Search Decoder requires dataset label map for correct decoding.') if self.blank_label is None: self.blank_label = len(self.label_map) - if self.logits_output: - self.output_blob = self.logits_output + if not self.output_verified: + self.select_output_blob(raw) raw_output = self._extract_predictions(raw, frame_meta) self.select_output_blob(raw_output) output = raw_output[self.output_blob] @@ -174,8 +184,9 @@ def parameters(cls): ), 'logits_output': StringField(optional=True, description='Logits output layer name'), 'custom_label_map': DictField(optional=True, description='Label map'), - 'vocabulary_file': PathField(optional=True, description='Vocabulary file') - + 'vocabulary_file': PathField(optional=True, description='Vocabulary file'), + 'shift_labels': BoolField( + optional=True, default=False, description='shift labels taking into account blank label') }) return parameters @@ -195,6 +206,16 @@ def configure(self): if self.custom_label_map: labels = {int(k): v for k, v in self.custom_label_map.items()} self.custom_label_map = labels + self.shift = int(self.get_value_from_config('shift_labels')) + + def select_output_blob(self, outputs): + self.output_verified = True + if self.logits_output: + self.logits_output = self.check_output_name(self.logits_output, outputs) + return + super().select_output_blob(outputs) + self.logits_output = self.output_blob + return def process(self, raw, identifiers=None, frame_meta=None): if self.custom_label_map: @@ -203,8 +224,8 @@ def process(self, raw, identifiers=None, frame_meta=None): raise ConfigError('CTCGreedy Search Decoder requires dataset label map for correct decoding.') if self.blank_label is None: self.blank_label = 0 - if self.logits_output: - self.output_blob = self.logits_output + if not self.output_verified: + self.select_output_blob(raw) raw_output = self._extract_predictions(raw, frame_meta) self.select_output_blob(raw_output) output = raw_output[self.output_blob] @@ -214,7 +235,7 @@ def process(self, raw, identifiers=None, frame_meta=None): result = [] for identifier, data in zip(identifiers, preds_index): seq = self.decode(data, self.blank_label) - decoded = ''.join(str(self.label_map[char]) for char in seq) + decoded = ''.join(str(self.label_map[char - self.shift]) for char in seq) result.append(CharacterRecognitionPrediction(identifier, decoded)) return result diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/time_series.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/time_series.py index b18a465b43d..f1ace602581 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/time_series.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/time_series.py @@ -30,16 +30,28 @@ def parameters(cls): allow_empty=False, description="preds[i]->quantile[i] mapping." ), - "output_name": StringField() + "output_name": StringField(optional=True, description='name of target output layer') }) return parameters def configure(self): self.quantiles = self.get_value_from_config('quantiles') self.output_name = str(self.get_value_from_config('output_name')) + self.output_verified = False + + def select_output_blob(self, outputs): + self.output_verified = True + if self.output_name: + self.check_output_name(self.output_name, outputs) + return + super().select_output_blob(outputs) + self.output_name = self.output_blob + return def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.output_verified: + self.select_output_blob(raw_outputs) output = raw_outputs[self.output_name] preds = TimeSeriesForecastingQuantilesPrediction(identifiers[0]) for k, v in self.quantiles.items(): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/yolact.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/yolact.py index 3b0fd1b89a2..eab3ff184aa 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/yolact.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/yolact.py @@ -62,14 +62,29 @@ def configure(self): self.proto_out = self.get_value_from_config('proto_out') self.conf_thresh = self.get_value_from_config('confidence_threshold') self.max_num_detections = self.get_value_from_config('max_detections') + self.outputs_verified = False if not self.loc_out and not self.prior_out and not self.boxes_out: raise ConfigError('loc_out and prior_out or boxes_out should be provided') if not self.boxes_out and not (self.prior_out and self.loc_out): raise ConfigError('both loc_out and prior_out should be provided') + def select_output_blob(self, outputs): + if self.loc_out: + self.loc_out = self.check_output_name(self.loc_out, outputs) + self.conf_out = self.check_output_name(self.conf_out, outputs) + if self.prior_out: + self.prior_out = self.check_output_name(self.prior_out, outputs) + if self.boxes_out: + self.boxes_out = self.check_output_name(self.boxes_out, outputs) + self.mask_out = self.check_output_name(self.mask_out, outputs) + self.proto_out = self.check_output_name(self.proto_out, outputs) + self.outputs_verified = True + def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) result = [] + if not self.outputs_verified: + self.select_output_blob(raw_outputs) for batch_id, (identifier, conf, masks, proto, meta) in enumerate(zip( identifiers, raw_outputs[self.conf_out], raw_outputs[self.mask_out], raw_outputs[self.proto_out], frame_meta diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/yolo.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/yolo.py index 29ba84016ba..6bd41534803 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/yolo.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/yolo.py @@ -1,9 +1,12 @@ """ Copyright (c) 2018-2021 Intel Corporation + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -388,6 +391,7 @@ def configure(self): self.anchors = get_or_parse_value(self.get_value_from_config('anchors'), YoloV3Adapter.PRECOMPUTED_ANCHORS) self.threshold = self.get_value_from_config('threshold') self.outputs = self.get_value_from_config('outputs') + self.outputs_verified = False anchor_masks = self.get_value_from_config('anchor_masks') self.masked_anchors = None if anchor_masks is not None: @@ -423,6 +427,11 @@ def configure(self): else: self.processor = YoloOutputProcessor() + def select_output_blob(self, outputs): + upd_outputs = [self.check_output_name(out, outputs) for out in self.outputs] + self.outputs = upd_outputs + self.outputs_verified = True + def process(self, raw, identifiers, frame_meta): """ Args: @@ -435,6 +444,8 @@ def process(self, raw, identifiers, frame_meta): result = [] raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) batch = len(identifiers) out_precision = frame_meta[0].get('output_precision', {}) out_layout = frame_meta[0].get('output_layout', {}) @@ -455,9 +466,11 @@ def process(self, raw, identifiers, frame_meta): if self.do_reshape or len(p.shape) != 3: try: cells = self.cells[layer_id] - except IndexError: - raise ConfigError('Number of output layers ({}) is more than detection grid size ({}). ' - 'Check "cells" option.'.format(len(prediction), len(self.cells))) + except IndexError as index_err: + raise ConfigError( + 'Number of output layers ({}) is more than detection grid size ({}). ' + 'Check "cells" option.'.format(len(prediction), len(self.cells)) + ) from index_err if self.output_format == 'BHW': new_shape = (-1, cells, cells) else: @@ -529,9 +542,18 @@ def configure(self): self.boxes_out = self.get_value_from_config('boxes_out') self.scores_out = self.get_value_from_config('scores_out') self.indices_out = self.get_value_from_config('indices_out') + self.outputs_verified = False + + def select_output_blob(self, outputs): + self.boxes_out = self.check_output_name(self.boxes_out, outputs) + self.scores_out = self.check_output_name(self.scores_out, outputs) + self.indices_out = self.check_output_name(self.indices_out, outputs) + self.outputs_verified = True def process(self, raw, identifiers, frame_meta): raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) result = [] indicies_out = raw_outputs[self.indices_out] if len(indicies_out.shape) == 2: @@ -572,14 +594,22 @@ def parameters(cls): def configure(self): self.outputs = self.get_value_from_config('outputs') + self.outputs_verified = False self.score_threshold = self.get_value_from_config('score_threshold') + def select_output_blob(self, outputs): + upd_outs = [self.check_output_name(out, outputs) for out in self.outputs] + self.outputs = upd_outs + self.outputs_verified = True + def process(self, raw, identifiers, frame_meta): result = [] input_shape = list(frame_meta[0].get('input_shape', {'data': (1, 416, 416, 3)}).values())[0] is_nchw = input_shape[1] == 3 input_size = min(input_shape[1], input_shape[2]) if not is_nchw else min(input_shape[2], input_shape[3]) raw_outputs = self._extract_predictions(raw, frame_meta) + if not self.outputs_verified: + self.select_output_blob(raw_outputs) batch = len(identifiers) predictions = [[] for _ in range(batch)] for blob in self.outputs: @@ -671,7 +701,7 @@ def parameters(cls): description="Minimal objectiveness score value for valid detections."), 'num': NumberField(value_type=int, optional=True, min_value=1, default=5, description="Num parameter from DarkNet configuration file."), - 'output_name': StringField(optional=True, default=None, description="Name of output.") + 'output_name': StringField(optional=True, description="Name of output.") }) return parameters @@ -682,6 +712,16 @@ def configure(self): self.expanded_strides = [] self.grids = [] self.img_size = [] + self.output_verifed = False + + def select_output_blob(self, outputs): + self.output_verifed = True + if self.output_name: + self.output_name = self.check_output_name(self.output_name, outputs) + return + super().select_output_blob(outputs) + self.output_name = self.output_blob + return @staticmethod def xywh2xyxy(x): @@ -698,9 +738,8 @@ def set_strides_grids(self, img_size): def process(self, raw, identifiers, frame_meta): result = [] raw_outputs = self._extract_predictions(raw, frame_meta) - self.select_output_blob(raw_outputs) - self.output_name = self.output_name or self.output_blob - + if not self.output_verifed: + self.select_output_blob(raw_outputs) for identifier, output, meta in zip(identifiers, raw_outputs[self.output_name], frame_meta): _, _, h, w = next(iter(meta.get('input_shape').values())) self.set_strides_grids((w, h)) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/README.md b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/README.md index 22efddd1aa9..ceaccb23799 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/README.md +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/README.md @@ -229,7 +229,7 @@ The main difference between this converter and `super_resolution` in data organi * `unicode_character_recognition` - converts [Kondate](http://web.tuat.ac.jp/~nakagawa/database/en/kondate_about.html) dataset and [Nakayosi](http://web.tuat.ac.jp/~nakagawa/database/en/about_nakayosi.html) for handwritten Japanese text recognition task , and [SCUT-EPT](https://github.com/HCIILAB/SCUT-EPT_Dataset_Release) for handwritten simplified Chinese text recognition task to `CharacterRecognitionAnnotation`. * `annotation_file` - path to annotation file in txt format. * `decoding_char_file` - path to decoding_char_file, consisting of all supported characters separated by '\n' in txt format. -* `bentham_lines` - converts [Bentham](http://transcriptorium.eu/datasets/bentham-collection/) dataset for line-level character recognition to `CharacterRecognitionAnnotation`. +* `bentham_lines` - converts [Bentham](https://zenodo.org/record/44519#.YVXcdFuEa90) dataset for line-level character recognition to `CharacterRecognitionAnnotation`. * `transcription_dir` - directory stored line transcriptions * `partition_file` - file with selected subset for validation. * `normalize_text` - allow unicode normalization for text (Optional, default `False`). @@ -322,6 +322,9 @@ The main difference between this converter and `super_resolution` in data organi * `cvat_age_gender` - converts [CVAT XML annotation version 1.1](https://openvinotoolkit.github.io/cvat/docs/manual/advanced/xml_format/) format for images which represent dataset for age gender recognition to `ContainerAnnotation` with `ClassificationAnnotation` for gender recognition, `ClassificationAnnotation` for age classification and `RegeressionAnnotation` for age regression. The identifiers for representations following: `gender_annotation`, `age_class_annotation`, `age_regression_annotation`. * `annotation_file` - path to xml file in appropriate format. * `cvat_facial_landmarks` - converts [CVAT XML annotation version 1.1](https://openvinotoolkit.github.io/cvat/docs/manual/advanced/xml_format/) format for images to `FacialLandmarksAnnotation`. +* `coco_facial_landmarks` - converts landmarks dataset in Coco format to `FacialLandmarksHeatMapAnnotation`. + * `annotation_file` - path to dataset annotation file in Coco format +* `cvat_facial_landmarks` - converts [CVAT XML annotation version 1.1](https://openvinotoolkit.github.io/cvat/docs/manual/advanced/xml_format) format for images to `FacialLandmarksAnnotation`. * `annotation_file` - path to xml file in appropriate format. * `cvat_pose_estimation` - converts [CVAT XML annotation version 1.1](https://openvinotoolkit.github.io/cvat/docs/manual/advanced/xml_format/) format for images to `PoseEstimationAnnotation`. * `annotation_file` - path to xml file in appropriate format. @@ -346,6 +349,7 @@ The main difference between this converter and `super_resolution` in data organi * `max_seq_length` - maximum total input sequence length after word-piece tokenization (Optional, default value is 128). * `max_query_length` - maximum number of tokens for the question (Optional, default value is 64). * `lower_case` - allows switching tokens to lower case register. It is useful for working with uncased models (Optional, default value is False) + * `enable_padding` - enable padding inputs to max length for queries and sequences. * `squad` - converts the Stanford Question Answering Dataset ([SQuAD](https://rajpurkar.github.io/SQuAD-explorer/)) to `Question Answering Annotation`. **Note: This converter not only converts data to metric specific format but also tokenize and encodes input for model.** * `testing_file` - path to testing file. * `vocab_file` - path to model co vocabulary file. @@ -353,6 +357,7 @@ The main difference between this converter and `super_resolution` in data organi * `max_query_length` - maximum number of tokens for the question (Optional, default value is 64). * `doc_stride` -stride size between chunks for splitting up long document (Optional, default value is 128). * `lower_case` - allows switching tokens to lower case register. It is useful for working with uncased models (Optional, default value is False) + * `enable_padding` - enable padding for max sequence length. * `squad_bidaf` - converts the Stanford Question Answering Dataset ([SQuAD](https://rajpurkar.github.io/SQuAD-explorer/)) to `QuestionAnsweringBiDAFAnnotation`. **Note:** This converter not only converts data to metric specific format but also tokenize and encodes input for BiDAF using nltk.word_tokenize. * `testing_file` - path to testing file. * `xnli` - converts The Cross-lingual Natural Language Inference Corpus ([XNLI](https://github.com/facebookresearch/XNLI)) to `TextClassificationAnnotattion`. **Note: This converter not only converts data to metric specific format but also tokenize and encodes input for model.** @@ -538,11 +543,30 @@ The main difference between this converter and `super_resolution` in data organi ```yaml tokenizer_dir: /roberta-base ``` +* `sentence_similarity` - converts Column-based dataset for sentence similarity evaluation to `SentenceSimilarityAnnotation`.**Note: This converter not only converts data to metric specific format but also tokenize and encodes input for model.** + * `annotation_file` - path to dataset annotation file in tsv or csv format. + * `separator` - column separator, supported values: `comma` for comma-separated data and `tab` - for tabular separation. Optional, default behaviour derived from file extension - for csv is `,`, for tsv - `\t`. + * `text_1` - column id for text (Optional, default - 0). + * `text_2` - column id for text for sentence pair classification task (Optional, default - 1). + * `label` - column id for label gold score (Optional, default - 2). + * `vocab_file` - path to model vocabulary file for WordPiece tokenization (Optional in case, when another tokenization approach used). + * `sentence_piece_model_file` - model used for [SentencePiece](https://github.com/google/sentencepiece) tokenization (Optional in case, when another tokenization approach used). + * `max_seq_length` - maximum total input sequence length after word-piece tokenization (Optional, default value is 128). + * `lower_case` - allows switching tokens to lower case register. It is useful for working with uncased models (Optional, default value is False). + * `enable_padding` - pad sequence to maximum sequence length (Optional, default `True`). + You also can use [HuggingFace Transformers](https://huggingface.co/transformers/index.html) library capabilities for tokenization with providing `model_id` for downloading tokenizer files from huggingface.co or `tokenizer_dir` for specification pretrained model directory instead vocab_file or sentencepiece model. + e.g. using tokenizer for roberta-base should be + ```yaml + model_id: roberta-base + ``` + or + ```yaml + tokenizer_dir: /roberta-base * `bert_xnli_tf_record` - converts The Cross-lingual Natural Language Inference Corpus ([XNLI](https://github.com/facebookresearch/XNLI)) stored in tf records format. This converter usage requires TensorFlow installation. Please make sure that TensorFlow installed before conversion. * `annotattion_file` - path to annotation file in tf records format. * `cmu_panoptic_keypoints` - converts CMU Panoptic dataset to `PoseEstimation3dAnnotation` format. * `data_dir` - dataset root directory, which contain subdirectories with validation scenes data. -* `clip_action_recognition` - converts annotation video-based action recognition datasets. Before conversion validation set should be preprocessed using approach described [here](https://github.com/openvinotoolkit/training_extensions/blob/develop/misc/pytorch_toolkit/action_recognition/README.md#preparation). +* `clip_action_recognition` - converts annotation video-based action recognition datasets. Before conversion validation set should be preprocessed using approach described [here](https://github.com/openvinotoolkit/training_extensions/tree/master/misc/pytorch_toolkit/action_recognition#preparation). * `annotation_file` - path to annotation file in json format. * `data_dir` - path to directory with prepared data (e. g. data/kinetics/frames_data). * `clips_per_video` - number of clips per video (Optional, default 3). @@ -697,13 +721,14 @@ The main difference between this converter and `super_resolution` in data organi * `features_subset_file` - file with list testing ark files, Optional, if not provided, all found in `data_dir` files will be used. * `ivectors` - include ivectors features to input, Optional, default `False`. * `kaldi_feat_regression` - converts preprocessed Kaldi\* features to `RegressionAnnotation`. - * `data_dir` - directory with input ark files. - * `features_subset_file` - file with list testing ark files, Optional, if not provided, all found in `data_dir` files will be used. Subset file has following format: each line stores information about input sample. Input sample consists of space separated list of input files and ends with reference file name. + * `data_dir` - directory with input ark or npz files. + * `features_subset_file` - file with list testing ark or npz files, Optional, if not provided, all found in `data_dir` files will be used. Subset file has following format: each line stores information about input sample. Input sample consists of space separated list of input files and ends with reference file name. * `ivectors` - include ivectors features to input, Optional, default `False`. - * `ref_data_dir` - directory with reference ark files (Optional, if not provided `data_dir` will be used instead). + * `ref_data_dir` - directory with reference ark or npz files (Optional, if not provided `data_dir` will be used instead). * `vectors_mode` - allow usage each vector in utterance as independent data. * `ref_file_suffix` - suffix for search reference files (Optional, default `_kaldi_score`). * `utterance_name_agnostic` - allow ignoring utterance name during conversion. Optional, default required utterance keys matching. + * `use_numpy_data` - allow using data stored in npz instead ark files as preferable data format. * `electricity` - converts Electricity dataset to `TimeSeriesForecastingAnnotation`. * `data_path_file` - Path to dataset file in .csv format. * `num_encoder_steps` - The maximum number of historical timestamps that model use. @@ -768,7 +793,11 @@ The main difference between this converter and `super_resolution` in data organi * `annotation_file` - path to `Deepvariant WGS` preprocessed dataset file * `preprocessed_dir` - path to preprocessed data * `skip_dump` - allow to skip storing preprocessed data. (Optional, default: `False`) - +* `common_text_recognition` - converts annotation for text recognition tasks (e.g. optical character recognition, automatic speech recognition) to `CharacterRecognitionAnnotation`. + * `annotation_file` - path to file with annotation, where each line represented as `[input_file]` `[reference]`. +* `speaker_reidentification` - converts annotation for speaker/sound reidentification dataset to `ReidentificationClassificationAnnotation`. + * `annotation_file` - text file containing reidentification pairs in following format: `[is_positive] [audio_1] [audio_2]`, where `is_positive` - indicator that pair is positive (1 if speaker is the same, 0 if speakers are different), `audio_1` and `audio_2` are path to the first and the second audio files respectively. + * `max_pairs` - limit for selection pairs for each image (Optional, by default use all founded pairs in annotation). ## Customizing Dataset Meta There are situations when we need to customize some default dataset parameters (e.g. replace original dataset label map with own.) You are able to overload parameters such as `label_map`, `segmentation_colors`, `background_label` using `dataset_meta_file` argument. diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/__init__.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/__init__.py index 501fdae8708..359d01306bc 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/__init__.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/__init__.py @@ -121,6 +121,10 @@ from .calgarycampinas import KSpaceMRIConverter from .amazon import AmazonProductData from .wgs import WGSTFRecords, WGSPickleRecords +from .sentence_similarity import SentenceSimilarityConverter +from .common_text_recognition import CommonTextRecognition +from .coco_facial_landmarks import COCOFacialLandmarksRecognitionConverter +from .speaker_identification import SpeakerReIdentificationDatasetConverter __all__ = [ 'BaseFormatConverter', @@ -242,4 +246,8 @@ 'AmazonProductData', 'WGSTFRecords', 'WGSPickleRecords', + 'SentenceSimilarityConverter', + 'CommonTextRecognition', + 'COCOFacialLandmarksRecognitionConverter', + 'SpeakerReIdentificationDatasetConverter', ] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/amazon.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/amazon.py index a649137b998..8f1ad8d0c9a 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/amazon.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/amazon.py @@ -35,21 +35,21 @@ def __init__(self, source, batch_size=128, maxlen=100): - self.source = open(source, 'r') + self.source = open(source, 'r', encoding='UTF-8') # pylint: disable=R1732 self.source_dicts = [] for source_dict in [uid_voc, mid_voc, cat_voc]: # disable B301:pickle check - self.source_dicts.append(pickle.load(open(source_dict, 'rb'), encoding='UTF-8')) # nosec - - f_meta = open(item_info, "r") - meta_map = {} - for line in f_meta: - arr = line.strip().split("\t") - if arr[0] not in meta_map: - meta_map[arr[0]] = arr[1] + with open(source_dict, 'rb') as source_content: + self.source_dicts.append(pickle.load(source_content, encoding='UTF-8')) # nosec + + with open(item_info, "r", encoding='UTF-8') as f_meta: + meta_map = {} + for line in f_meta: + arr = line.strip().split("\t") + if arr[0] not in meta_map: + meta_map[arr[0]] = arr[1] self.meta_id_map = {} - for key in meta_map: - val = meta_map[key] + for key, val in meta_map.items(): if key in self.source_dicts[1]: mid_idx = self.source_dicts[1][key] else: @@ -60,14 +60,14 @@ def __init__(self, source, cat_idx = 0 self.meta_id_map[mid_idx] = cat_idx - f_review = open(reviews_info, "r") - self.mid_list_for_random = [] - for line in f_review: - arr = line.strip().split("\t") - tmp_idx = 0 - if arr[1] in self.source_dicts[1]: - tmp_idx = self.source_dicts[1][arr[1]] - self.mid_list_for_random.append(tmp_idx) + with open(reviews_info, "r", encoding='UTF-8') as f_review: + self.mid_list_for_random = [] + for line in f_review: + arr = line.strip().split("\t") + tmp_idx = 0 + if arr[1] in self.source_dicts[1]: + tmp_idx = self.source_dicts[1][arr[1]] + self.mid_list_for_random.append(tmp_idx) self.batch_size = batch_size self.maxlen = maxlen @@ -179,9 +179,11 @@ def parameters(cls): description="Separator between input identifier and file identifier"), "test_data": StringField(optional=True, default='local_test_splitByUser', description="test data filename."), - "batch": NumberField(optional=True, default=1, description="Batch size"), - "max_len": NumberField(optional=True, default=100, description="Maximum sequence length"), - "subsample_size": NumberField(optional=True, default=0, description="Number of sentences to process"), + "batch": NumberField(optional=True, default=1, description="Batch size", value_type=int), + "max_len": NumberField(optional=True, default=None, description="Maximum sequence length", value_type=int), + "subsample_size": NumberField( + optional=True, default=0, description="Number of sentences to process", value_type=int + ), "uid_voc": StringField(optional=True, default='uid_voc.pkl', description="uid_voc filename"), "mid_voc": StringField(optional=True, default='mid_voc.pkl', description="mid_voc filename"), "cat_voc": StringField(optional=True, default='cat_voc.pkl', description="cat_voc filename"), @@ -224,19 +226,36 @@ def configure(self): self.mask = self.get_value_from_config('mask') self.seq_len = self.get_value_from_config('seq_len') self.skip_dump = self.get_value_from_config('skip_dump') - self.batch = int(self.get_value_from_config('batch')) - self.max_len = int(self.get_value_from_config('max_len')) - self.subsample_size = int(self.get_value_from_config('subsample_size')) + self.batch = self.get_value_from_config('batch') + self.max_len = self.get_value_from_config('max_len') + self.subsample_size = self.get_value_from_config('subsample_size') @staticmethod - def prepare_data(source, target): + def prepare_data(source, target, maxlen=None): # x: a list of sentences lengths_x = [len(s[4]) for s in source] seqs_mid = [inp[3] for inp in source] seqs_cat = [inp[4] for inp in source] + if maxlen is not None: + new_seqs_mid = [] + new_seqs_cat = [] + new_lengths_x = [] + for l_x, inp in zip(lengths_x, source): + if l_x > maxlen: + new_seqs_mid.append(inp[3][l_x - maxlen:]) + new_seqs_cat.append(inp[4][l_x - maxlen:]) + new_lengths_x.append(maxlen) + else: + new_seqs_mid.append(inp[3]) + new_seqs_cat.append(inp[4]) + new_lengths_x.append(l_x) + lengths_x = new_lengths_x + seqs_mid = new_seqs_mid + seqs_cat = new_seqs_cat n_samples = len(seqs_mid) maxlen_x = np.max(lengths_x) + maxlen_x = max(maxlen, maxlen_x) if maxlen is not None else maxlen_x mid_his = np.zeros((n_samples, maxlen_x)).astype('int64') cat_his = np.zeros((n_samples, maxlen_x)).astype('int64') @@ -278,7 +297,7 @@ def convert(self, check_content=False, **kwargs): iteration = 0 for src, tgt in test_data: - uids, mids, cats, mid_his, cat_his, mid_mask, gt, sl = self.prepare_data(src, tgt) + uids, mids, cats, mid_his, cat_his, mid_mask, gt, sl = self.prepare_data(src, tgt, maxlen=self.max_len) c_input = input_folder / "{:02d}".format(subfolder) c_input = c_input / "{:06d}.npz".format(iteration) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/coco_facial_landmarks.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/coco_facial_landmarks.py new file mode 100644 index 00000000000..a665fa5d120 --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/coco_facial_landmarks.py @@ -0,0 +1,82 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +import json +import numpy as np +from .format_converter import FileBasedAnnotationConverter, ConverterReturn +from ..representation import FacialLandmarksHeatMapAnnotation +from ..config import PathField + + +class COCOFacialLandmarksRecognitionConverter(FileBasedAnnotationConverter): + __provider__ = 'coco_facial_landmarks' + annotation_types = (FacialLandmarksHeatMapAnnotation, ) + + @classmethod + def parameters(cls): + configuration_parameters = super().parameters() + configuration_parameters.update({ + 'images_dir': PathField( + is_directory=True, optional=True, + description='path to dataset images, used only for content existence check' + ) + }) + return configuration_parameters + + def configure(self): + super().configure() + self.images_dir = self.get_value_from_config('images_dir') or self.annotation_file.parent + + @classmethod + def _collectImageIds(cls, data): + result = {} + for itm in data: + img_name = itm["file_name"] + img_id = itm["id"] + result[img_id] = img_name + + return result + + + def convert(self, check_content=False, progress_callback=None, progress_interval=100, **kwargs): + with open(self.annotation_file, encoding='UTF-8') as f: + data = json.load(f) + coco_ann = data["annotations"] + id2name = self._collectImageIds(data["images"]) + num_landmarks = 98 + annotations = [] + for ann_id, ann in enumerate(coco_ann[1:]): + identifier = id2name[ann["image_id"]] + bbox = ann["bbox"] + keypoints = np.array(ann["keypoints"]).reshape(-1, 3) + landmarks_x, landmarks_y = self.get_landmarks(keypoints, num_landmarks) + landmarks_annotation = FacialLandmarksHeatMapAnnotation(identifier, + np.array(landmarks_x), + np.array(landmarks_y)) + landmarks_annotation.metadata['rect'] = (bbox[0], bbox[1], bbox[0] + bbox[2], bbox[1] + bbox[3]) + annotations.append(landmarks_annotation) + if progress_callback is not None and ann_id % progress_interval == 0: + progress_callback(ann_id * 100 / len(coco_ann[1:])) + return ConverterReturn(annotations, None, None) + + @staticmethod + def get_landmarks(keypoints, num_landmarks): + landmarks_x, landmarks_y = np.zeros(num_landmarks), np.zeros(num_landmarks) + for i, point in enumerate(keypoints): + x, y = point[0], point[1] + landmarks_x[i] = float(x) + landmarks_y[i] = float(y) + + return landmarks_x, landmarks_y diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/common_text_recognition.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/common_text_recognition.py new file mode 100644 index 00000000000..05473fbbc57 --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/common_text_recognition.py @@ -0,0 +1,30 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +from .format_converter import FileBasedAnnotationConverter, ConverterReturn +from ..utils import read_txt +from ..representation import CharacterRecognitionAnnotation + + +class CommonTextRecognition(FileBasedAnnotationConverter): + __provider__ = 'common_text_recognition' + + def convert(self, check_content=False, **kwargs): + annotations = [] + for line in read_txt(self.annotation_file): + input_file, description = line.split(' ', 1) + annotations.append(CharacterRecognitionAnnotation(input_file, description)) + return ConverterReturn(annotations, None, None) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/convert.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/convert.py index 0b39b0c4691..c9294e7928f 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/convert.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/convert.py @@ -30,6 +30,7 @@ from .. import __version__ from ..representation import ( ReIdentificationClassificationAnnotation, ReIdentificationAnnotation, PlaceRecognitionAnnotation, + SentenceSimilarityAnnotation ) from ..data_readers import KaldiFrameIdentifier, KaldiMatrixIdentifier from ..utils import ( @@ -82,39 +83,45 @@ def build_argparser(): return parser -def make_subset(annotation, size, seed=666, shuffle=True): +def make_subset(annotation, size, seed=666, shuffle=True, no_recursion=False): + dtype_specific_subsets = { + SentenceSimilarityAnnotation: make_subset_sentence_similarity, + PlaceRecognitionAnnotation: make_subset_place_recognition, + ReIdentificationClassificationAnnotation: make_subset_pairwise, + ReIdentificationAnnotation: make_subset_reid, + } np.random.seed(seed) dataset_size = len(annotation) if dataset_size < size: warnings.warn('Dataset size {} less than subset size {}'.format(dataset_size, size)) return annotation - if isinstance(annotation[-1], ReIdentificationClassificationAnnotation): - return make_subset_pairwise(annotation, size, shuffle) - if isinstance(annotation[-1], ReIdentificationAnnotation): - return make_subset_reid(annotation, size, shuffle) - if isinstance(annotation[-1], PlaceRecognitionAnnotation): - return make_subset_place_recognition(annotation, size, shuffle) if isinstance(annotation[-1].identifier, (KaldiMatrixIdentifier, KaldiFrameIdentifier)): return make_subset_kaldi(annotation, size, shuffle) + for dtype, subset_func in dtype_specific_subsets.items(): + if isinstance(annotation[-1], dtype): + return subset_func(annotation, size, shuffle, no_recursion=no_recursion) result_annotation = list(np.random.choice(annotation, size=size, replace=False)) if shuffle else annotation[:size] return result_annotation -def make_subset_pairwise(annotation, size, shuffle=True): +def make_subset_pairwise(annotation, size, shuffle=True, no_recursion=False, **kwargs): def get_pairs(pairs_list): pairs_set = OrderedSet() for identifier in pairs_list: - next_annotation = next( - pair_annotation for pair_annotation in annotation if pair_annotation.identifier == identifier - ) - positive_pairs = get_pairs(next_annotation.positive_pairs) - negative_pairs = get_pairs(next_annotation.negative_pairs) + next_annotation = annotation_dict[identifier] + if not no_recursion: + positive_pairs = get_pairs(next_annotation.positive_pairs) + negative_pairs = get_pairs(next_annotation.negative_pairs) + else: + positive_pairs = [annotation_dict[identifier] for identifier in next_annotation.positive_pairs] + negative_pairs = [annotation_dict[identifier] for identifier in next_annotation.negative_pairs] pairs_set.add(next_annotation) pairs_set |= positive_pairs pairs_set |= negative_pairs return pairs_set + annotation_dict = {ann.identifier: ann for ann in annotation} subsample_set = OrderedSet() @@ -141,7 +148,7 @@ def get_pairs(pairs_list): return list(subsample_set) -def make_subset_reid(annotation, size, shuffle=True): +def make_subset_reid(annotation, size, shuffle=True, **kwargs): subsample_set = OrderedSet() potential_ann_ind = np.random.choice(len(annotation), size, replace=False) if shuffle else np.arange(size) for ann_ind in potential_ann_ind: @@ -172,7 +179,7 @@ def make_subset_reid(annotation, size, shuffle=True): return list(subsample_set) -def make_subset_place_recognition(annotation, size, shuffle=True): +def make_subset_place_recognition(annotation, size, shuffle=True, **kwargs): subsample_set = OrderedSet() potential_ann_ind = np.random.choice(len(annotation), size, replace=False) if shuffle else np.arange(size) queries_ids = [idx for idx, ann in enumerate(annotation) if ann.query] @@ -198,7 +205,32 @@ def make_subset_place_recognition(annotation, size, shuffle=True): return [annotation[ind] for ind in subsample_set] -def make_subset_kaldi(annotation, size, shuffle=True): +def make_subset_sentence_similarity(annotation, size, shuffle=True, **kwargs): + subsample_set = OrderedSet() + potential_ann_ind = np.random.choice(len(annotation), size, replace=False) if shuffle else np.arange(size) + index_to_info = { + idx: (ann.id, ann.pair_id) + for idx, ann in enumerate(annotation) + } + pair_id_to_idx = {pair_id: idx for idx, (_, pair_id) in index_to_info.items() if pair_id is not None} + id_to_idx = {inst_id: idx for idx, (inst_id, _) in index_to_info.items()} + for idx in potential_ann_ind: + addition = OrderedSet() + addition.add(idx) + sample_id, pair_id = index_to_info[idx] + if sample_id in pair_id_to_idx: + addition.add(pair_id_to_idx[sample_id]) + if pair_id is not None and pair_id in id_to_idx: + addition.add(id_to_idx[pair_id]) + subsample_set |= addition + if len(subsample_set) == size: + break + if len(subsample_set) > size: + subsample_set -= addition + return [annotation[ind] for ind in subsample_set] + + +def make_subset_kaldi(annotation, size, shuffle=True, **kwargs): file_to_num_utterances = {} for ind, ann in enumerate(annotation): if ann.identifier.file not in file_to_num_utterances: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/criteo_kaggle_dac.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/criteo_kaggle_dac.py index 48c9807d6c4..2b60ca46895 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/criteo_kaggle_dac.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/criteo_kaggle_dac.py @@ -64,7 +64,8 @@ def configure(self): self.src = self.get_value_from_config('testing_file') self.binary = self.get_value_from_config('binary') self.batch = int(self.get_value_from_config('batch')) - self.max_ind_range = int(self.get_value_from_config('max_ind_range')) + max_ind_range = self.get_value_from_config('max_ind_range') + self.max_ind_range = int(max_ind_range) if max_ind_range is not None else max_ind_range self.subsample = int(self.get_value_from_config('subsample_size')) self.validation = self.get_value_from_config('validation') self.block = self.get_value_from_config('block') @@ -103,7 +104,7 @@ def load_data_file(self): self.count = np.ceil(self.src.stat().st_size / self._bytes_per_entry) self.cat_feat = spa_fea - self.binfile = open(self.src, 'rb') if self.save_preprocessed_features else None + self.binfile = open(self.src, 'rb') if self.save_preprocessed_features else None # pylint: disable=R1732 else: data = np.load(self.src) self._x_int = data['X_int'] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/format_converter.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/format_converter.py index fe2179c1682..f282f84f446 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/format_converter.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/format_converter.py @@ -147,8 +147,8 @@ def verify_label_map(label_map): try: int_class_id = int(class_id) valid_label_map[int_class_id] = class_name - except ValueError: + except ValueError as value_err: raise ConfigError( 'class_id {} is invalid. `label_map` should have integer keys.'.format(class_id) - ) + ) from value_err return valid_label_map diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/icdar.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/icdar.py index de682595945..5041517f518 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/icdar.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/icdar.py @@ -47,15 +47,15 @@ def is_word(text): forbidden_symbols = "\N{MULTIPLICATION SIGN}\N{DIVISION SIGN}\N{GREEK ANO TELEIA}" - range1 = [ord(u'a'), ord(u'z')] - range2 = [ord(u'A'), ord(u'Z')] - range3 = [ord(u'\N{LATIN CAPITAL LETTER A WITH GRAVE}'), - ord(u'\N{LATIN LETTER WYNN}')] - range4 = [ord(u'\N{LATIN CAPITAL LETTER DZ WITH CARON}'), - ord(u'\N{LATIN SMALL LETTER REVERSED R WITH FISHHOOK}')] - range5 = [ord(u'\N{GREEK CAPITAL LETTER ALPHA WITH TONOS}'), - ord(u'\N{GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL}')] - range6 = [ord(u'-'), ord(u'-')] + range1 = [ord('a'), ord('z')] + range2 = [ord('A'), ord('Z')] + range3 = [ord('\N{LATIN CAPITAL LETTER A WITH GRAVE}'), + ord('\N{LATIN LETTER WYNN}')] + range4 = [ord('\N{LATIN CAPITAL LETTER DZ WITH CARON}'), + ord('\N{LATIN SMALL LETTER REVERSED R WITH FISHHOOK}')] + range5 = [ord('\N{GREEK CAPITAL LETTER ALPHA WITH TONOS}'), + ord('\N{GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL}')] + range6 = [ord('-'), ord('-')] for char in text: char_code = ord(char) @@ -108,8 +108,7 @@ def convert(self, check_content=False, progress_callback=None, progress_interval num_iterations = len(files) for gt_id, gt_file in enumerate(files): - gt_file_name = str(gt_file.parts[-1]) - identifier = '{}.jpg'.format(gt_file_name.split('gt_')[-1].split('.txt')[0]) + identifier = '{}.jpg'.format(gt_file.name.replace('gt_', '').replace('.txt', '')) if check_content: if not check_file_existence(self.images_dir / identifier): content_errors.append('{}: does not exist'.format(self.images_dir / identifier)) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/im2latex.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/im2latex.py index 7492faeb0a7..396a3f259ad 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/im2latex.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/im2latex.py @@ -38,7 +38,7 @@ def read_vocab(vocab_path): with open(vocab_path, "rb") as f: vocab_dict = pkl.load(f) elif vocab_path.suffix == '.json': - with open(vocab_path, "r") as f: + with open(vocab_path, "r", encoding='UTF-8') as f: vocab_dict = json.load(f) id2sign = {int(k): v for k, v in vocab_dict['id2sign'].items()} vocab_dict['id2sign'] = id2sign diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/kaldi_speech_recognition_pipeline.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/kaldi_speech_recognition_pipeline.py index 8f2e21d0f04..f77a5af5710 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/kaldi_speech_recognition_pipeline.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/kaldi_speech_recognition_pipeline.py @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. """ +import numpy as np from ..data_readers import KaldiMatrixIdentifier, KaldiARKReader, KaldiFrameIdentifier from ..representation import CharacterRecognitionAnnotation, RegressionAnnotation from ..config import PathField, BoolField, StringField @@ -104,6 +105,9 @@ def parameters(cls): 'vectors_mode': BoolField(optional=True, default=True, description='Split data to vectors'), 'utterance_name_agnostic': BoolField( optional=True, default=False, description='do not match names per utterance' + ), + 'use_numpy_data': BoolField( + optional=True, default=False, description='allow to search npz files instead of ark' ) }) return params @@ -118,6 +122,7 @@ def configure(self): self.ref_file_suffix = self.get_value_from_config('ref_file_suffix') self.vectors_mode = self.get_value_from_config('vectors_mode') self.utt_agnostic = self.get_value_from_config('utterance_name_agnostic') + self.file_ext = '.ark' if not self.get_value_from_config('use_numpy_data') else '.npz' def convert(self, check_content=False, progress_callback=None, progress_interval=100, **kwargs): ark_list = self.select_subset() @@ -132,54 +137,60 @@ def convert(self, check_content=False, progress_callback=None, progress_interval return ConverterReturn(annotation, None, None) def _convert_utt_agnostic(self, input_files, ref_ark, annotation): - input_utts = [KaldiARKReader.read_frames(in_file) for in_file in input_files] + input_utts = [] + for in_file in input_files: + input_utts.append(KaldiARKReader.read_frames(in_file) if in_file.suffix != '.npz' else np.load(in_file)) utt_ids = [list(in_utt.keys()) for in_utt in input_utts] - ref_scores = KaldiARKReader.read_frames(ref_ark) + ref_scores = KaldiARKReader.read_frames(ref_ark) if ref_ark.suffix != '.npz' else np.load(ref_ark) for idx, (_, ref_matrix) in enumerate(ref_scores.items()): current_utts = [u[idx] for u in utt_ids] if self.vectors_mode: for v_idx, ref_v in enumerate(ref_matrix): - if len(input_files) == 1: - identifier = KaldiFrameIdentifier(input_files[0].name, current_utts[0], v_idx) - else: - identifier = [ + identifier = [ KaldiFrameIdentifier(in_file.name, utt, v_idx) + if in_file.suffix != '.npz' else generate_numpy_identifier(in_file.name, utt, v_idx) for in_file, utt in zip(input_files, current_utts) - ] + ] + if len(identifier) == 1: + identifier = identifier[0] annotation.append(RegressionAnnotation(identifier, ref_v)) else: - if len(input_files) == 1: - identifier = KaldiMatrixIdentifier(input_files[0].name, current_utts[0]) - else: - identifier = [ + identifier = [ KaldiMatrixIdentifier(in_file.name, utt) + if in_file.suffix != '.npz' else generate_numpy_identifier(in_file.name, utt) for in_file, utt in zip(input_files, current_utts) - ] + ] + if len(identifier) == 1: + identifier = identifier[0] annotation.append(RegressionAnnotation(identifier, ref_matrix)) return annotation def _convert_utt_specific(self, input_files, ref_ark, annotation): - utterances = KaldiARKReader.read_frames(input_files[0]) - ref_scores = KaldiARKReader.read_frames(ref_ark) + utterances = ( + KaldiARKReader.read_frames(input_files[0]) + if input_files[0].suffix != '.npz' else dict(np.load(input_files[0]))) + ref_scores = KaldiARKReader.read_frames(ref_ark) if ref_ark.suffix != '.npz' else dict(np.load(ref_ark)) for utt, matrix in utterances.items(): if utt not in ref_scores: continue ref_matrix = ref_scores[utt] if self.vectors_mode: for vector_id, _ in enumerate(matrix): - if len(input_files) == 1: - identifier = KaldiFrameIdentifier(input_files[0].name, utt, vector_id) - else: - identifier = [ - KaldiFrameIdentifier(in_file.name, utt, vector_id) for in_file in input_files - ] + identifier = [ + KaldiFrameIdentifier(in_file.name, utt, vector_id) + if in_file.suffix != '.npz' else generate_numpy_identifier(in_file.name, utt, vector_id) + for in_file in input_files + ] + if len(identifier) == 1: + identifier = identifier[0] ref_vector = ref_matrix[vector_id] annotation.append(RegressionAnnotation(identifier, ref_vector)) else: - if len(input_files) == 1: - identifier = KaldiMatrixIdentifier(input_files[0].name, utt) - else: - identifier = [KaldiMatrixIdentifier(in_file.name, utt) for in_file in input_files] + identifier = [KaldiMatrixIdentifier(in_file.name, utt) + if in_file.suffix != '.npz' else generate_numpy_identifier(in_file.name, utt) + for in_file in input_files] + if len(identifier) == 1: + identifier = identifier[0] annotation.append(RegressionAnnotation(identifier, ref_matrix)) return annotation @@ -194,17 +205,21 @@ def select_subset(self): if not self.ivectors: pairs = [] - for ark_file in self.data_dir.glob('*.ark'): + for ark_file in self.data_dir.glob('*{}'.format(self.file_ext)): if self.data_dir == self.ref_data_dir and self.ref_file_suffix in ark_file.name: continue - ref_file = self.ref_data_dir / ark_file.name.replace('.ark', self.ref_file_suffix+'.ark') + ref_file = self.ref_data_dir / ark_file.name.replace(self.file_ext, self.ref_file_suffix+self.file_ext) pairs.append((ark_file, ref_file)) return pairs triples = [] - for ivector_file in self.data_dir.glob("*_ivector.ark"): + for ivector_file in self.data_dir.glob("*_ivector{}".format(self.file_ext)): feats_file = self.data_dir / ivector_file.name.replace('_ivector', '') ref_file = self.ref_data_dir / ivector_file.name.replace('_ivector', self.ref_file_suffix) if not feats_file.exists() or not ref_file.exists(): continue triples.append((feats_file, ivector_file, ref_file)) return triples + + +def generate_numpy_identifier(file_name, array_id, idx=None): + return '{}{}#{}'.format(array_id, '' if idx is None else '_{}'.format(idx), file_name) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/ms_asl_continuous.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/ms_asl_continuous.py index 96d25aae099..f12a757c9c8 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/ms_asl_continuous.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/ms_asl_continuous.py @@ -130,8 +130,7 @@ def load_annotations(ann_file): @staticmethod def get_indices(record, output_fps, out_clip_size): time_step = int(round(float(record.fps) / float(output_fps))) - if time_step < 1: - time_step = 1 + time_step = max(time_step, 1) input_length, output_length = time_step * out_clip_size, out_clip_size diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/pascal_voc.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/pascal_voc.py index f6978d10624..b3d936c4973 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/pascal_voc.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/pascal_voc.py @@ -17,7 +17,7 @@ from ..config import PathField, BoolField from ..representation import DetectionAnnotation, SegmentationAnnotation from ..representation.segmentation_representation import GTMaskLoader -from ..utils import get_path, read_txt, read_xml, check_file_existence, read_json +from ..utils import get_path, read_txt, read_xml, check_file_existence, read_json, string_to_tuple from .format_converter import BaseFormatConverter, ConverterReturn, verify_label_map _SYG_CLASSES_DETECTION = ( @@ -91,6 +91,7 @@ def syg_prepare_detection_labels(dataset_meta, has_background=True): return reversed_label_map + class PascalVOCSegmentationConverter(BaseFormatConverter): __provider__ = 'voc_segmentation' annotation_types = (SegmentationAnnotation, ) @@ -111,7 +112,8 @@ def parameters(cls): ), 'dataset_meta_file': PathField( description='path to json file with dataset meta (e.g. label_map, color_encoding)', optional=True - ) + ), + 'labelmap_file': PathField(description='labelmap.txt in Datumaro format', optional=True) }) return configuration_parameters @@ -121,6 +123,9 @@ def configure(self): self.image_dir = self.get_value_from_config('images_dir') dataset_meta_file = self.get_value_from_config('dataset_meta_file') self.dataset_meta = {} if not dataset_meta_file else read_json(dataset_meta_file) + labelmap_file = self.get_value_from_config('labelmap_file') + if labelmap_file is not None: + self.dataset_meta.update(self.read_labelmap(labelmap_file)) if not self.image_dir: self.image_dir = get_path(self.image_set_file.parents[-2] / 'JPEGImages', is_directory=True) @@ -156,6 +161,21 @@ def convert(self, check_content=False, progress_callback=None, progress_interval return ConverterReturn(annotations, meta, content_check_errors) + @staticmethod + def read_labelmap(input_file): + label_map = {} + segmentation_colors = [] + idx = 0 + for line in read_txt(input_file): + if line.startswith('#'): + continue + data = line.split(':') + label, color = data[:2] + label_map[idx] = label + segmentation_colors.append(string_to_tuple(color)) + idx += 1 + return {'label_map': label_map, 'segmentation_colors': segmentation_colors} + class PascalVOCDetectionConverter(BaseFormatConverter): __provider__ = 'voc_detection' diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/sentence_similarity.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/sentence_similarity.py new file mode 100644 index 00000000000..2e68cc0afba --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/sentence_similarity.py @@ -0,0 +1,176 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +import csv +from collections import namedtuple +import numpy as np +from ..config import NumberField, BoolField, PathField, StringField, ConfigError +from ..representation import SentenceSimilarityAnnotation +from .format_converter import FileBasedAnnotationConverter, ConverterReturn +from ._nlp_common import get_tokenizer, SEG_ID_A, SEP_ID, CLS_ID, SEG_ID_CLS, SEG_ID_PAD + + +input_sample = namedtuple('input_sample', ['id', 'text', 'pair_id', 'score']) + + +class SentenceSimilarityConverter(FileBasedAnnotationConverter): + __provider__ = 'sentence_similarity' + + @classmethod + def parameters(cls): + params = super().parameters() + params.update({ + 'annotation_file': PathField(description='path to annotation file in json or tsv format'), + 'vocab_file': PathField(description='Path to vocabulary file for word piece tokenizer', optional=True), + 'sentence_piece_model_file': PathField(description='sentence piece model for tokenization', optional=True), + 'max_seq_length': NumberField( + description='The maximum total input sequence length after tokenization.', + optional=True, default=128, value_type=int + ), + 'lower_case': BoolField(optional=True, default=False, description='Switch tokens to lower case register'), + 'class_token_first': BoolField( + optional=True, default=True, + description='Add [CLS] token to the begin of sequence. If False, will be added as the last token.'), + 'enable_padding': BoolField(optional=True, default=True, description='pad input sequence to max length'), + 'tokenizer_dir': PathField( + optional=True, is_directory=True, + description='A path to a directory containing vocabulary files required by the transformers tokenizer' + ), + 'model_id': StringField( + optional=True, + description='The model id of a predefined tokenizer hosted inside a model repo on huggingface.co' + ), + 'column_separator': StringField( + optional=True, choices=['tab', 'comma'], description='column separator used in annotation file' + ), + 'text_1': NumberField(value_type=int, description='Column index for text', optional=True, default=0), + 'text_2': NumberField(value_type=int, description='Second column index for text', optional=True, default=1), + 'label': NumberField(value_type=int, description='Label column', optional=True, default=2), + 'normalize_labels': BoolField( + optional=True, default=False, description='normalize similarity score to have 0, 1 range' + ) + }) + + return params + + def configure(self): + self.annotation_file = self.get_value_from_config('annotation_file') + self.text_a_id = self.get_value_from_config('text_1') + self.text_b_id = self.get_value_from_config('text_2') + self.label_id = self.get_value_from_config('label') + self.column_separator = self.get_column_separator() + self.max_seq_length = self.get_value_from_config('max_seq_length') + self.lower_case = self.get_value_from_config('lower_case') + self.tokenizer, self.external_tok = get_tokenizer(self.config, self.lower_case) + self.support_vocab = 'vocab_file' in self.config + self.class_token_first = self.get_value_from_config('class_token_first') + self.enable_padding = self.get_value_from_config('enable_padding') + self.normalize_labels = self.get_value_from_config('normalize_labels') + + def get_column_separator(self): + sep = self.get_value_from_config('column_separator') + if sep is None: + if self.annotation_file.suffix not in ['.csv', '.tsv']: + raise ConfigError( + 'Impossible automatically detect column separator for annotation. ' + 'Please provide separator in config') + sep = 'comma' if self.annotation_file.suffix == '.csv' else 'tab' + return ',' if sep == 'comma' else '\t' + + def read_annotation(self): + lines = [] + all_pair_scores = [] + with open(str(self.annotation_file), 'r', encoding="utf-8-sig") as ann_file: + reader = csv.reader(ann_file, delimiter=self.column_separator, quotechar=None) + for idx, line in enumerate(reader): + if idx == 0: + continue + first_idx = idx * 2 + second_idx = first_idx + 1 + score = float(line[self.label_id]) + all_pair_scores.append(score) + text_a = line[self.text_a_id] + text_b = line[self.text_b_id] + lines.append(input_sample(first_idx, text_a, second_idx, score)) + lines.append(input_sample(second_idx, text_b, None, None)) + + return lines, all_pair_scores + + def convert(self, check_content=False, progress_callback=None, progress_interval=100, **kwargs): + examples, scores = self.read_annotation() + min_score, max_score = None, None + if self.normalize_labels: + min_score = min(scores) + max_score = max(scores) + annotations = [] + num_iter = len(examples) + for example_id, example in enumerate(examples): + annotations.append(self.convert_single_example(example, min_score, max_score)) + if progress_callback and example_id % progress_interval == 0: + progress_callback(example_id * 100 / num_iter) + + return ConverterReturn(annotations, None, None) + + def convert_single_example(self, example, min_score=None, max_score=None): + identifier = [ + 'input_ids_{}'.format(example.id), + 'input_mask_{}'.format(example.id), + 'segment_ids_{}'.format(example.id) + ] + if not self.external_tok: + tokens_a = self.tokenizer.tokenize(example.text) + if len(tokens_a) > self.max_seq_length - 2: + tokens_a = tokens_a[:self.max_seq_length - 2] + + tokens = [] + segment_ids = [] + if self.class_token_first: + tokens.append("[CLS]" if self.support_vocab else CLS_ID) + segment_ids.append(SEG_ID_CLS) + for token in tokens_a: + tokens.append(token) + segment_ids.append(SEG_ID_A) + tokens.append('[SEP]' if self.support_vocab else SEP_ID) + segment_ids.append(SEG_ID_A) + + if not self.class_token_first: + tokens.append("[CLS]" if self.support_vocab else CLS_ID) + segment_ids.append(SEG_ID_CLS) + else: + tokens = self.tokenizer.tokenize(example.text, add_special_tokens=True) + segment_ids = [SEG_ID_A] * len(tokens) + + if len(tokens) > self.max_seq_length: + tokens = tokens[:self.max_seq_length] + + input_ids = self.tokenizer.convert_tokens_to_ids(tokens) if self.support_vocab or self.external_tok else tokens + input_mask = [0 if not self.class_token_first else 1] * len(input_ids) + + if self.enable_padding and len(input_ids) < self.max_seq_length: + delta_len = self.max_seq_length - len(input_ids) + input_ids = [0] * delta_len + input_ids if not self.class_token_first else input_ids + [0] * delta_len + input_mask = [1] * delta_len + input_mask if not self.class_token_first else input_mask + [0] * delta_len + segment_ids = ( + [SEG_ID_PAD] * delta_len + segment_ids if not self.class_token_first else segment_ids + [0] * delta_len + ) + score = example.score + if max_score is not None and score is not None : + score = (score - min_score) / max_score + + return SentenceSimilarityAnnotation( + identifier, example.id, example.pair_id, score, + np.array(input_ids), np.array(input_mask), np.array(segment_ids) + ) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/speaker_identification.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/speaker_identification.py new file mode 100644 index 00000000000..81fdec94057 --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/speaker_identification.py @@ -0,0 +1,62 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +from .format_converter import FileBasedAnnotationConverter, ConverterReturn +from ..utils import read_txt, OrderedSet +from ..representation import ReIdentificationClassificationAnnotation +from ..config import NumberField + + +class SpeakerReIdentificationDatasetConverter(FileBasedAnnotationConverter): + __provider__ = 'speaker_reidentification' + + @classmethod + def parameters(cls): + params = super().parameters() + params.update({'max_pairs': NumberField(optional=True, value_type=int)}) + return params + + def configure(self): + super().configure() + self.max_pairs = self.get_value_from_config('max_pairs') + + def convert(self, check_content=False, **kwargs): + annotations = [] + positive_pairs, negative_pairs = {}, {} + audio_files = OrderedSet() + for line in read_txt(self.annotation_file): + is_positive, audio1, audio2 = line.split() + if int(is_positive): + if audio1 not in positive_pairs: + positive_pairs[audio1] = [] + positive_pairs[audio1].append(audio2) + else: + if audio1 not in negative_pairs: + negative_pairs[audio1] = [] + negative_pairs[audio1].append(audio2) + audio_files.add(audio1) + audio_files.add(audio2) + for audio in audio_files: + audio_positive = positive_pairs.get(audio, []) + audio_negative = negative_pairs.get(audio, []) + if self.max_pairs: + if len(audio_positive) > self.max_pairs: + audio_positive = audio_positive[:self.max_pairs] + if len(audio_negative) > self.max_pairs: + audio_negative = audio_negative[:self.max_pairs] + annotations.append(ReIdentificationClassificationAnnotation( + audio, audio_positive, audio_negative)) + return ConverterReturn(annotations, {'no_recursion': True}, None) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad.py index 8d16c77d4a3..eb28c5cc54f 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad.py @@ -128,7 +128,8 @@ def parameters(cls): description="When splitting up a long document into chunks, how much stride to take between chunks.", optional=True, default=128, value_type=int ), - 'lower_case': BoolField(optional=True, default=False, description='Switch tokens to lower case register') + 'lower_case': BoolField(optional=True, default=False, description='Switch tokens to lower case register'), + 'enable_padding': BoolField(optional=True, default=True, description='enable padding for max sequence len') }) return configuration_parameters @@ -142,6 +143,7 @@ def configure(self): self.tokenizer = SquadWordPieseTokenizer( self.get_value_from_config('vocab_file'), self.lower_case, max_len=512 ) + self.enable_padding = self.get_value_from_config('enable_padding') @staticmethod def _load_examples(file): @@ -205,7 +207,7 @@ def convert(self, check_content=False, progress_callback=None, progress_interval span_doc_tokens if self.tokenizer.padding_side == "right" else truncated_query, max_length=self.max_seq_length, return_overflowing_tokens=True, - pad_to_max_length=True, + pad_to_max_length=self.enable_padding, stride=self.max_seq_length - self.doc_stride - len(truncated_query) - sequence_pair_added_tokens, truncation_strategy="only_second" if self.tokenizer.padding_side == "right" else "only_first", return_token_type_ids=True, diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad_bidaf.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad_bidaf.py index cc78abbf4ca..16c405597a9 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad_bidaf.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad_bidaf.py @@ -28,6 +28,7 @@ except ImportError as import_error: nltk = UnsupportedPackage("nltk", import_error.msg) + class SQUADConverterBiDAF(BaseFormatConverter): __provider__ = "squad_bidaf" annotation_types = (QuestionAnsweringBiDAFAnnotation, ) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad_emb.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad_emb.py index 59e061169fa..84ff2eb149a 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad_emb.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/squad_emb.py @@ -124,7 +124,8 @@ def parameters(cls): description='The maximum number of tokens for the question.', optional=True, default=64, value_type=int ), - 'lower_case': BoolField(optional=True, default=False, description='Switch tokens to lower case register') + 'lower_case': BoolField(optional=True, default=False, description='Switch tokens to lower case register'), + 'enable_padding': BoolField(optional=True, default=True, description='enable padding to max length') }) return configuration_parameters @@ -135,6 +136,7 @@ def configure(self): self.max_query_length = self.get_value_from_config('max_query_length') self.lower_case = self.get_value_from_config('lower_case') vocab_file = str(self.get_value_from_config('vocab_file')) + self.enable_padding = self.get_value_from_config('enable_padding') with open(vocab_file, "r", encoding="utf-8") as r: self.vocab = {t.rstrip("\n"): i for i, t in enumerate(r.readlines())} @@ -157,7 +159,7 @@ def convert(self, check_content=False, progress_callback=None, progress_interval def add_sample(ids, max_len, context_pos_id, annotations): ids_len = min(max_len - 2, len(ids)) ids = ids[:ids_len] - rest = max_len - (ids_len + 2) + rest = max_len - (ids_len + 2) if self.enable_padding else 0 assert rest >= 0 annotations.append(QuestionAnsweringEmbeddingAnnotation( diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/super_resolution_converter.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/super_resolution_converter.py index c76b5ebaad3..316f6dd7ea7 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/super_resolution_converter.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/super_resolution_converter.py @@ -112,9 +112,9 @@ def configure(self): try: self.lr_dir.relative_to(self.data_dir) self.upsampled_dir.relative_to(self.data_dir) - except ValueError: + except ValueError as value_err: raise ConfigError('data_dir parameter should be provided for conversion as common part of paths ' - 'lr_dir and upsampled_dir, if 2 streams used') + 'lr_dir and upsampled_dir, if 2 streams used') from value_err self.relative_dir = self.data_dir or os.path.commonpath([self.lr_dir, self.upsampled_dir]) if self.lr_dir != self.upsampled_dir: warnings.warn("lr_dir and upsampled_dir are different folders." @@ -318,7 +318,7 @@ def parse_ref_frame(self, config_value, num_frames): except ValueError: ref_func = self.predefined_ref_frame.get(config_value) if ref_func is None: - raise ConfigError('Unsupported value for reference_frame: {}'.format(config_value)) + raise ConfigError('Unsupported value for reference_frame: {}'.format(config_value)) from None ref_frame = ref_func(num_frames) if ref_frame > num_frames: raise ConfigError('Unexpected value for reference_frame id: {}'.format(ref_frame)) @@ -422,13 +422,13 @@ def set_default_path(add_dir, param_name): if self.images_dir: try: self.lr_dir.relative_to(self.images_dir) - except ValueError: - raise ConfigError('lr_dir should be relative to images_dir') + except ValueError as value_err: + raise ConfigError('lr_dir should be relative to images_dir') from value_err if self.two_streams: try: self.upsample_dir.relative_to(self.images_dir) - except ValueError: - raise ConfigError('upsample_dir should be relative to images_dir') + except ValueError as value_err: + raise ConfigError('upsample_dir should be relative to images_dir') from value_err else: self.images_dir = ( os.path.commonpath([str(self.lr_dir), str(self.upsample_dir)]) if self.two_streams else self.lr_dir diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/text_classification.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/text_classification.py index 4fbe8718fb5..8e60d0da913 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/text_classification.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/text_classification.py @@ -137,7 +137,7 @@ def convert_single_example(self, example): # pylint:disable=R0912 segment_ids = [] if self.class_token_first: tokens.append("[CLS]" if self.support_vocab else CLS_ID) - segment_ids.append(SEG_ID_CLS) + segment_ids.append(SEG_ID_CLS if not self.support_vocab else 1) for token in tokens_a: tokens.append(token) segment_ids.append(SEG_ID_A) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/wmt.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/wmt.py index 6f4f2d12fec..c13d0ecd2d7 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/wmt.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/wmt.py @@ -27,7 +27,7 @@ def _clean(sentence, subword_option=None): sentence = re.sub("@@ ", "", sentence) # SPM if subword_option == "spm": - sentence = u"".join(sentence.split()).replace(u"\u2581", u" ").lstrip() + sentence = "".join(sentence.split()).replace("\u2581", " ").lstrip() return sentence diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/argparser.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/argparser.py new file mode 100644 index 00000000000..a47884a635d --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/argparser.py @@ -0,0 +1,373 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +from argparse import ArgumentParser +from functools import partial +from pathlib import Path + +from . import __version__ +from .utils import get_path, cast_to_bool + + +def add_common_args(parser): + common_args = parser.add_argument_group('Common arguments') + common_args.add_argument( + '-d', '--definitions', + help='path to the yml file with definitions', + type=get_path, + required=False + ) + common_args.add_argument( + '-c', '--config', + help='path to the yml file with local configuration', + type=get_path, + required=True + ) + common_args.add_argument( + '-m', '--models', + help='prefix path to the models and weights', + type=partial(get_path, file_or_directory=True), + required=False, + nargs='+' + ) + common_args.add_argument( + '-s', '--source', + help='prefix path to the data source', + type=partial(get_path, is_directory=True), + required=False + ) + common_args.add_argument( + '-a', '--annotations', + help='prefix path to the converted annotations and datasets meta data', + type=partial(get_path, is_directory=True), + required=False + ) + common_args.add_argument( + '--model_attributes', + help="path's prefix for additional models attributes", + type=partial(get_path, is_directory=True), + required=False + ) + common_args.add_argument( + '--input_precision', + help='space-separated list of precisions for network inputs. ' + 'Providing several values required : format. ' + 'If single value without layer_name provided, then it will be applied to all input layers.', + required=False, + nargs='+' + ) + common_args.add_argument( + '--layout', + help='Prompts how network layouts should be treated by application.' + 'For example, "input1[NCHW],input2[NC]" or "[NCHW]" in case of one input size.', + required=False + ) + + +def add_config_filtration_args(parser): + config_filtration_args = parser.add_argument_group('Config filtration arguments') + config_filtration_args.add_argument( + '-tf', '--target_framework', + help='framework for infer', + required=False + ) + config_filtration_args.add_argument( + '-td', '--target_devices', + help='space separated list of devices for infer', + required=False, + nargs='+' + ) + config_filtration_args.add_argument( + '-tt', '--target_tags', + help='space separated list of launcher tags for infer', + required=False, + nargs='+' + ) + config_filtration_args.add_argument( + '-tb', '--target_backends', help='space separated list of backends for inference', + required=False, + nargs='+' + ) + + +def add_dataset_related_args(parser): + dataset_related_args = parser.add_argument_group('Dataset related arguments') + dataset_related_args.add_argument( + '-ss', '--subsample_size', + help="dataset subsample size", + type=str, + required=False + ) + dataset_related_args.add_argument( + '--shuffle', + help="allow shuffle annotation during creation a subset", + type=cast_to_bool, + required=False + ) + dataset_related_args.add_argument( + '--store_subset', + help='allow to save evaluation data ids', + type=cast_to_bool, + default=False, + required=False + ) + dataset_related_args.add_argument( + '--subset_file', + help='file name for saving or reading identifiers subset', + required=False + ) + + +def add_profiling_related_args(parser): + profiling_related_args = parser.add_argument_group('Profiling related arguments') + profiling_related_args.add_argument( + '--profile', + help='activate metric profiling mode', + type=cast_to_bool, + required=False + ) + profiling_related_args.add_argument( + '--profiler_logs_dir', + help='path to save profiler logs', + type=partial(get_path, is_directory=True), + default=Path.cwd(), + required=False + ) + profiling_related_args.add_argument( + '--profile_report_type', + help='report type for profiler logs', + default='csv', + choices=['csv', 'json'], + required=False + ) + + +def add_tool_settings_args(parser): + tool_settings_args = parser.add_argument_group('Tool settings arguments') + tool_settings_args.add_argument( + '--progress', + help='progress reporter. You can select bar or print', + default='bar', + required=False + ) + tool_settings_args.add_argument( + '--progress_interval', + help='interval for update progress if selected *print* progress.', + type=int, + default=1000, + required=False + ) + tool_settings_args.add_argument( + '--ignore_result_formatting', + help='allow to get raw metrics results without data formatting', + type=cast_to_bool, + default=False, + required=False + ) + tool_settings_args.add_argument( + '--ignore_metric_reference', help='disable comparing with metric reference during presenting result', + type=cast_to_bool, + default=False, + required=False + ) + tool_settings_args.add_argument( + '--stored_predictions', + help='path to file with saved predictions. Used for development', + # since at the first time file does not exist and then created we can not always check existence + required=False + ) + tool_settings_args.add_argument( + '--csv_result', + help='file for results writing', + required=False, + ) + tool_settings_args.add_argument( + '--intermediate_metrics_results', + help='enables intermediate metrics results printing or saving', + type=cast_to_bool, + default=False, + required=False + ) + tool_settings_args.add_argument( + '--metrics_interval', + help='number of iteration for updated metrics result printing', + type=int, + default=1000, + required=False + ) + tool_settings_args.add_argument( + '--store_only', + type=cast_to_bool, + default=False, + required=False + ) + tool_settings_args.add_argument( + '-l', '--log_file', + help='file for additional logging results', + required=False + ) + + +def add_openvino_specific_args(parser): + openvino_specific_args = parser.add_argument_group('OpenVINO specific arguments') + openvino_specific_args.add_argument( + '-e', '--extensions', + help='prefix path to extensions folder', + type=partial(get_path, check_exists=False), + default=Path.cwd(), + required=False + ) + openvino_specific_args.add_argument( + '--cpu_extensions_mode', + help='specified preferable set of processor instruction for automatic searching cpu extension lib', + choices=['avx512', 'avx2', 'sse4'], + required=False + ) + openvino_specific_args.add_argument( + '-M', '--model_optimizer', + help='path to model optimizer directory', + type=partial(get_path, is_directory=True), + # there is no default value because if user did not specify it we use specific locations + # defined in model_conversion.py + required=False + ) + openvino_specific_args.add_argument( + '--tf_custom_op_config_dir', + help='path to directory with tensorflow custom operation configuration files for model optimizer', + type=partial(get_path, is_directory=True), + # there is no default value because if user did not specify it we use specific location + # defined in model_conversion.py + required=False + ) + openvino_specific_args.add_argument( + '--transformations_config_dir', + help='path to directory with Model Optimizer transformations configuration files', + type=partial(get_path, is_directory=True), + # there is no default value because if user did not specify it we use specific location + # defined in model_conversion.py + required=False + ) + openvino_specific_args.add_argument( + '--tf_obj_detection_api_pipeline_config_path', + help='path to directory with tensorflow object detection api pipeline configuration files for model optimizer', + type=partial(get_path, is_directory=True), + # there is no default value because if user did not specify it we use specific location + # defined in model_conversion.py + required=False + ) + openvino_specific_args.add_argument( + '--deprecated_ir_v7', + help='allow generation IR v7 via Model Optimizer', + type=cast_to_bool, + default=False, + required=False + ) + openvino_specific_args.add_argument( + '-dc', '--device_config', + help='Inference Engine device specific config file', + type=get_path, + required=False + ) + openvino_specific_args.add_argument( + '--ie_preprocessing', + help='enable preprocessing via Inference Engine. Accepted only for dlsdk launcher.', + type=cast_to_bool, + default=False, + required=False + ) + openvino_specific_args.add_argument( + '--model_is_blob', + help='the tip for automatic model search to use blob for dlsdk launcher', + type=cast_to_bool, + required=False + ) + openvino_specific_args.add_argument( + '--model_type', + help='model format for automatic search (e.g. blob, xml, onnx)', + required=False + ) + openvino_specific_args.add_argument( + '-C', '--converted_models', + help='directory to store Model Optimizer converted models. Used for DLSDK launcher only', + type=partial(get_path, is_directory=True), + default=Path.cwd(), + required=False + ) + openvino_specific_args.add_argument( + '-am', '--affinity_map', + help='prefix path to the affinity maps', + type=partial(get_path, file_or_directory=True), + default=Path.cwd(), + required=False + ) + openvino_specific_args.add_argument( + '--vpu_log_level', + help='log level for VPU devices', + default='LOG_WARNING', + choices=['LOG_NONE', 'LOG_WARNING', 'LOG_INFO', 'LOG_DEBUG'], + required=False + ) + openvino_specific_args.add_argument( + '--async_mode', + help='Allow evaluation in async mode', + type=cast_to_bool, + default=False, + required=False + ) + openvino_specific_args.add_argument( + '--num_requests', + help='the number of infer requests', + required=False + ) + openvino_specific_args.add_argument( + '--kaldi_bin_dir', help='directory with Kaldi utility binaries. Required only for Kaldi models decoding.', + required=False, type=partial(get_path, is_directory=True) + ) + openvino_specific_args.add_argument( + '--kaldi_log_file', help='path for saving logs from Kaldi tools', type=partial(get_path, check_exists=False), + required=False + ) + openvino_specific_args.add_argument( + '--undefined_shapes_resolving_policy', choices=['default', 'dynamic', 'static'], + help='Policy how to make deal with undefined shapes in network: ' + 'default - try to run as default, if does not work switch to static, ' + 'dynamic - enforce network execution with dynamic shapes, ' + 'static - convert undefined shapes to static before execution', + required=False, default='default' + ) + openvino_specific_args.add_argument( + '--use_new_api', type=cast_to_bool, help='switch to processing using OpenVINO 2.0 API', required=False, + default=False + ) + + +def build_arguments_parser(): + parser = ArgumentParser(description='Deep Learning accuracy validation framework', allow_abbrev=False) + add_common_args(parser) + add_config_filtration_args(parser) + add_dataset_related_args(parser) + add_profiling_related_args(parser) + add_tool_settings_args(parser) + add_openvino_specific_args(parser) + + parser.add_argument( + '--version', + help='show tool version and exit', + action='version', + version='%(prog)s {version}'.format(version=__version__) + ) + + return parser diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/config/config_reader.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/config/config_reader.py index c56154765b3..9b0addcfa7a 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/config/config_reader.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/config/config_reader.py @@ -28,7 +28,6 @@ 'launchers': { 'cpu_extensions': 'extensions', 'gpu_extensions': 'extensions', - 'bitstream': 'bitstreams', 'affinity_map': 'affinity_map', 'predictions': 'source' }, @@ -83,14 +82,13 @@ COMMAND_LINE_ARGS_AS_ENV_VARS = { 'source': 'DATA_DIR', 'annotations': 'ANNOTATIONS_DIR', - 'bitstreams': 'BITSTREAMS_DIR', 'models': 'MODELS_DIR', 'extensions': 'EXTENSIONS_DIR', 'model_attributes': 'MODEL_ATTRIBUTES_DIR', 'kaldi_bin_dir': 'KALDI_BIN_DIR' } DEFINITION_ENV_VAR = 'DEFINITIONS_FILE' -CONFIG_SHARED_PARAMETERS = ['bitstream'] +CONFIG_SHARED_PARAMETERS = [] ACCEPTABLE_MODEL = [ 'caffe_model', 'caffe_weights', 'tf_model', 'tf_meta', @@ -349,33 +347,11 @@ def _provide_cmd_arguments(arguments, config, mode): profile_report_type = arguments.profile_report_type if 'profile_report_type' in arguments else 'csv' def merge_models(config, arguments, update_launcher_entry): - def provide_models(launchers): - if input_precisions: - for launcher in launchers: - launcher['_input_precision'] = input_precisions - if 'models' not in arguments or not arguments.models: - return launchers - model_paths = arguments.models - updated_launchers = [] - model_paths = [model_paths] if not isinstance(model_paths, list) else model_paths - for launcher in launchers: - if contains_any(launcher, ACCEPTABLE_MODEL): - updated_launchers.append(launcher) - continue - for model_path in model_paths: - copy_launcher = copy.deepcopy(launcher) - copy_launcher['model'] = model_path - if launcher['framework'] in ['dlsdk', 'g-api'] and 'model_is_blob' in arguments: - copy_launcher['_model_is_blob'] = arguments.model_is_blob - updated_launchers.append(copy_launcher) - return updated_launchers - - input_precisions = arguments.input_precision if 'input_precision' in arguments else None for model in config['models']: for launcher_entry in model['launchers']: merge_dlsdk_launcher_args(arguments, launcher_entry, update_launcher_entry) - model['launchers'] = provide_models(model['launchers']) + model['launchers'] = provide_models(model['launchers'], arguments) for dataset_entry in model['datasets']: _add_subset_specific_arg(dataset_entry, arguments) @@ -619,15 +595,27 @@ def create_command_line_mapping(config, default_value, value_map=None): def filtered(launcher, targets, args): target_tags = args.get('target_tags') or [] + target_backends = args.get('target_backends') + use_new_api = args.get('use_new_api', False) + target_framework = args.get('target_framework', '') + if target_framework and target_framework == 'dlsdk' and use_new_api: + target_framework = 'openvino' if target_tags: if not contains_any(target_tags, launcher.get('tags', [])): return True config_framework = launcher['framework'].lower() - target_framework = (args.get('target_framework') or config_framework).lower() + if not target_framework: + target_framework = config_framework + target_framework = target_framework.lower() if config_framework != target_framework: return True + if target_backends: + backend = launcher.get('backend') + if backend not in target_backends: + return True + return targets and launcher.get('device', '').lower() not in targets @@ -766,6 +754,19 @@ def process_launchers(launchers_configs): merge_entry_paths(command_line_arg, config_entry, args) +def select_arg_path(selected_argument, value_id, argument): + if isinstance(selected_argument, list): + if len(selected_argument) > 1: + if len(selected_argument) <= value_id: + raise ValueError('list of arguments for {} less than number of evaluations'.format(argument)) + selected_argument = selected_argument[value_id] + else: + selected_argument = selected_argument[0] + if not isinstance(selected_argument, Path): + selected_argument = Path(selected_argument) + return selected_argument + + def merge_entry_paths(keys, value, args, value_id=0): for field, argument in keys.items(): if not is_iterable(value) or field not in value: @@ -786,15 +787,7 @@ def merge_entry_paths(keys, value, args, value_id=0): if arg_candidate not in args or not args[arg_candidate]: continue - selected_argument = args[arg_candidate] - if isinstance(selected_argument, list): - if len(selected_argument) > 1: - if len(selected_argument) <= value_id: - raise ValueError('list of arguments for {} less than number of evaluations') - selected_argument = selected_argument[value_id] - else: - selected_argument = selected_argument[0] - + selected_argument = select_arg_path(args[arg_candidate], value_id, argument) if not selected_argument.is_dir(): raise ConfigError('argument: {} should be a directory'.format(argument)) @@ -839,14 +832,6 @@ def _convert_models_args(launcher_entry): return launcher_entry - def _fpga_specific_args(launcher_entry): - if 'aocl' in arguments and arguments.aocl: - launcher_entry['_aocl'] = arguments.aocl - - if 'bitstream' not in launcher_entry and 'bitstreams' in arguments and arguments.bitstreams: - if not arguments.bitstreams.is_dir(): - launcher_entry['bitstream'] = arguments.bitstreams - def _async_evaluation_args(launcher_entry): if 'async_mode' in arguments: launcher_entry['async_mode'] = arguments.async_mode @@ -862,13 +847,17 @@ def _async_evaluation_args(launcher_entry): launcher_entry['_kaldi_bin_dir'] = kaldi_binaries launcher_entry['_kaldi_log_file'] = kaldi_logs - if launcher_entry['framework'].lower() != 'dlsdk': + if launcher_entry['framework'].lower() not in ['dlsdk', 'openvino']: return launcher_entry + if 'use_new_api' in arguments: + if launcher_entry['framework'].lower() == 'dlsdk' and arguments.use_new_api: + launcher_entry['framework'] = 'openvino' + elif launcher_entry['framework'].lower() == 'openvino' and not arguments.use_new_api: + launcher_entry['framework'] = 'dlsdk' launcher_entry.update(update_launcher_entry) _convert_models_args(launcher_entry) _async_evaluation_args(launcher_entry) - _fpga_specific_args(launcher_entry) if 'device_config' in arguments and arguments.device_config: merge_device_configs(launcher_entry, arguments.device_config) @@ -934,3 +923,41 @@ def merge_device_configs(launcher_entry, device_config_file): embedded_device_config[key].update(value) launcher_entry['device_config'] = embedded_device_config return launcher_entry + + +def provide_precision_and_layout(launchers, input_precisions, input_layouts): + for launcher in launchers: + if input_precisions: + launcher['_input_precision'] = input_precisions + if input_layouts: + launcher['_input_layout'] = input_layouts + + +def provide_model_type(launcher, arguments): + if 'model_type' in arguments: + launcher['_model_type'] = arguments.model_type + if launcher['framework'] in ['dlsdk', 'openvino', 'g-api'] and 'model_is_blob' in arguments: + launcher['_model_is_blob'] = arguments.model_is_blob + if arguments.model_is_blob: + launcher['_model_type'] = 'blob' + + +def provide_models(launchers, arguments): + input_precisions = arguments.input_precision if 'input_precision' in arguments else None + input_layout = arguments.layout if 'layout' in arguments else None + provide_precision_and_layout(launchers, input_precisions, input_layout) + if 'models' not in arguments or not arguments.models: + return launchers + model_paths = arguments.models + updated_launchers = [] + model_paths = [model_paths] if not isinstance(model_paths, list) else model_paths + for launcher in launchers: + if contains_any(launcher, ACCEPTABLE_MODEL): + updated_launchers.append(launcher) + continue + for model_path in model_paths: + copy_launcher = copy.deepcopy(launcher) + copy_launcher['model'] = model_path + provide_model_type(copy_launcher, arguments) + updated_launchers.append(copy_launcher) + return updated_launchers diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/config/config_validator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/config/config_validator.py index 8b10e26e65e..b79458420be 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/config/config_validator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/config/config_validator.py @@ -205,12 +205,12 @@ def required(self): def parameters(self): parameters_dict = {} - for key, _ in self.__dict__.items(): + for key, value in self.__dict__.items(): if not key.startswith('_') and hasattr(self, key) and not hasattr(BaseValidator(), key): - if isinstance(self.__dict__[key], BaseField): - parameters_dict[key] = self.__dict__[key].parameters() + if isinstance(value, BaseField): + parameters_dict[key] = value.parameters() else: - parameters_dict[key] = self.__dict__[key] + parameters_dict[key] = value parameters_dict['type'] = type((self.type or str)()).__name__ return parameters_dict @@ -560,12 +560,12 @@ def type(self): def parameters(self): parameters_dict = {} - for key, _ in self.__dict__.items(): + for key, value in self.__dict__.items(): if not key.startswith('_') and hasattr(self, key) and not hasattr(BaseValidator(), key): - if isinstance(self.__dict__[key], BaseField): - parameters_dict[key] = self.__dict__[key].parameters() + if isinstance(value, BaseField): + parameters_dict[key] = value.parameters() else: - parameters_dict[key] = self.__dict__[key] + parameters_dict[key] = value parameters_dict['type'] = type(bool()).__name__ return parameters_dict diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/coco_instance_segmentation_analyzer.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/coco_instance_segmentation_analyzer.py index c85cbeb0879..cbfaaf51eda 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/coco_instance_segmentation_analyzer.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/coco_instance_segmentation_analyzer.py @@ -42,17 +42,17 @@ def analyze(self, result: list, meta, count_objects=True): characteristics[label] = {'area': [float(area)], 'width': [float(rect[2])], 'height': [float(rect[3])]} - for key in characteristics: + for key, value in characteristics.items(): size = counter[key] - characteristics[key]['area'] = {'average': sum(characteristics[key]['area']) / size, - 'min': min(characteristics[key]['area']), - 'max': max(characteristics[key]['area'])} - characteristics[key]['width'] = {'average': sum(characteristics[key]['width']) / size, - 'min': min(characteristics[key]['width']), - 'max': max(characteristics[key]['width'])} - characteristics[key]['height'] = {'average': sum(characteristics[key]['height']) / size, - 'min': min(characteristics[key]['height']), - 'max': max(characteristics[key]['height'])} + value['area'] = {'average': sum(characteristics[key]['area']) / size, + 'min': min(characteristics[key]['area']), + 'max': max(characteristics[key]['area'])} + value['width'] = {'average': sum(characteristics[key]['width']) / size, + 'min': min(characteristics[key]['width']), + 'max': max(characteristics[key]['width'])} + value['height'] = {'average': sum(characteristics[key]['height']) / size, + 'min': min(characteristics[key]['height']), + 'max': max(characteristics[key]['height'])} print_info('Total instances: {value}'.format(value=total_instances)) data_analysis['total_instances'] = total_instances diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/container_analyzer.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/container_analyzer.py index 3ff44720e90..18ed9e7a3f4 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/container_analyzer.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/container_analyzer.py @@ -40,9 +40,9 @@ def analyze(self, result: list, meta, count_objects=True): meta_names[annotation_prefix].append(meta_name) else: meta_names[annotation_prefix] = [meta_name] - for label_annotation in dict_annotations: + for label_annotation, value in dict_annotations.items(): name_annotation = label_annotation.split('_')[0] - first_element = next(iter(dict_annotations[label_annotation]), None) + first_element = next(iter(value), None) analyzer = BaseDataAnalyzer.provide(first_element.__class__.__name__) print_info('Analyzed annotation: {name}'.format(name=label_annotation)) if name_annotation in meta_names: @@ -50,9 +50,8 @@ def analyze(self, result: list, meta, count_objects=True): annotation_specific_meta = { key.split('{}_'.format(name_annotation))[-1]: meta[key] for key in specific_keys } - data_analysis[label_annotation] = analyzer.analyze(dict_annotations[label_annotation], - annotation_specific_meta, False) + data_analysis[label_annotation] = analyzer.analyze(value, annotation_specific_meta, False) else: - data_analysis[label_annotation] = analyzer.analyze(dict_annotations[label_annotation], meta, False) + data_analysis[label_annotation] = analyzer.analyze(value, meta, False) return data_analysis diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/segmentation_analyzer.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/segmentation_analyzer.py index 6eeeb41e360..30aa6bccb6f 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/segmentation_analyzer.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_analyzer/segmentation_analyzer.py @@ -58,11 +58,11 @@ def analyze(self, result: list, meta, count_objects=True): counter[elem] = int(count_) label_map = meta.get('label_map', {}) - for key in counter: + for key, value in counter.items(): class_name = label_map.get(key, 'class_{key}'.format(key=key)) print_info('{class_name}: count = {count}'.format( class_name=class_name, - count=counter[key])) - data_analysis[class_name] = counter[key] + count=value)) + data_analysis[class_name] = value return data_analysis diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/README.md b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/README.md index 85b30a74fc4..91244d2159e 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/README.md +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/README.md @@ -56,8 +56,13 @@ Note: since 1.3.0 version the image processing module is not a part of scipy lib * `separator` - separator symbol between input identifier and file identifier * `id_sep` - separator symbol between input name and record number in input identifier * `block` - block mode (batch - oriented). In this mode reader returns whole variable. + * `record_mode` - allow get specific record from numpy array using `id_sep` as separator between field name and record id * `numpy_txt_reader`- read data stored in text format to numpy array. * `numpy_dict_reader` - read and unpack dictionaries saved in numpy files. +* `numpy_bin_reader` - read binary file using numpy. + * `dtype` - data type for array reading (Optional, default `float32`). + * `as_buffer` - read binary file as buffer (Optional, default `False`). + * `offset` - offest for staring decoding array if `as_buffer` enabled (Optional, default 0). * `nifti_reader` - read NifTI data format * `channels_first` - allows read nifti files and transpose in order where channels first (Optional, default `False`) * `multi_frame` - allows reading of 3D images as sequence of 2D frames (optional, default `False`) @@ -68,6 +73,7 @@ Note: since 1.3.0 version the image processing module is not a part of scipy lib * `mono` - get mean along channels if multichannel audio loaded (Optional, default `False`). * `to_float` - converts audio signal to float (Optional, default `False`). Float data type can be selected using `float_dtype` parameter. * `float_dtype` - specifies data type for `to_float` conversion. Supported values: `float16`, `float32`, `float64`. Optional, default `float32`. + * `flattenize` - make signal flatten (Optional, default `False`). * `dicom_reader` - read images stored in DICOM format. * `pickle_reader` - read data stored in pickle file. Supported formats of pickle content: 1. numeric data array diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/audio_readers.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/audio_readers.py index 36cae5ae3cc..4683bd68ec6 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/audio_readers.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/audio_readers.py @@ -42,7 +42,8 @@ def parameters(cls): 'float_dtype': StringField( choices=['float16', 'float32', 'float64'], optional=True, default='float32', description='specifies precision for conversion to float ' - ) + ), + 'flattenize': BoolField(optional=True, default=False, description='flattenize signal') }) return params @@ -53,6 +54,7 @@ def configure(self): self.float_dtype = self.get_value_from_config('float_dtype') if self.float_dtype == 'float64': self.float_dtype = 'float' + self.flattenize = self.get_value_from_config('flattenize') def read(self, data_id): data_path = self.data_source / data_id if self.data_source is not None else data_id @@ -76,6 +78,9 @@ def read(self, data_id): if self.to_float: data = data.astype(self.float_dtype) / np.iinfo(self._samplewidth_types[sample_width]).max + if self.flattenize: + data = data.flatten() + return data, {'sample_rate': sample_rate} def read_item(self, data_id): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py index e8c6f3ea456..2dafbfbf3fa 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/data_reader.py @@ -137,19 +137,19 @@ def create_reader(config): class DataReaderField(BaseField): - def validate(self, entry_, field_uri=None, fetch_only=False, validation_scheme=None): - errors = super().validate(entry_, field_uri) + def validate(self, entry, field_uri=None, fetch_only=False, validation_scheme=None): + errors = super().validate(entry, field_uri) - if entry_ is None: + if entry is None: return errors field_uri = field_uri or self.field_uri - if isinstance(entry_, str): + if isinstance(entry, str): errors.extend( StringField(choices=BaseReader.providers).validate( - entry_, field_uri, fetch_only=fetch_only, validation_scheme=validation_scheme) + entry, field_uri, fetch_only=fetch_only, validation_scheme=validation_scheme) ) - elif isinstance(entry_, dict): + elif isinstance(entry, dict): class DictReaderValidator(ConfigValidator): type = StringField(choices=BaseReader.providers) @@ -158,13 +158,13 @@ class DictReaderValidator(ConfigValidator): ) errors.extend( dict_reader_validator.validate( - entry_, field_uri, fetch_only=fetch_only, validation_scheme=validation_scheme + entry, field_uri, fetch_only=fetch_only, validation_scheme=validation_scheme )) else: msg = 'reader must be either string or dictionary' if not fetch_only: - self.raise_error(entry_, field_uri, msg) - errors.append(self.build_error(entry_, field_uri, msg, validation_scheme)) + self.raise_error(entry, field_uri, msg) + errors.append(self.build_error(entry, field_uri, msg, validation_scheme)) return errors diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/image_readers.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/image_readers.py index e1de62efef4..2b9d0de738a 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/image_readers.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/image_readers.py @@ -143,11 +143,11 @@ def __init__(self, data_source, config=None, **kwargs): super().__init__(data_source, config, **kwargs) try: import tensorflow as tf # pylint: disable=C0415 - except ImportError as import_error: + except ImportError as import_err: raise ImportError( 'tf backend for image reading requires TensorFlow. ' - 'Please install it before usage. {}'.format(import_error.msg) - ) + 'Please install it before usage. {}'.format(import_err.msg) + ) from import_err if tf.__version__ < '2.0.0': tf.enable_eager_execution() diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/numpy_readers.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/numpy_readers.py index fb434c01d67..4ea2a80485f 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/numpy_readers.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/data_readers/numpy_readers.py @@ -40,7 +40,8 @@ def parameters(cls): description='Separator symbol between input name and record number in input identifier.' ), 'block': BoolField(optional=True, default=False, description='Allows block mode.'), - 'batch': NumberField(optional=True, default=1, description='Batch size') + 'batch': NumberField(optional=True, default=1, description='Batch size'), + 'records_mode': BoolField(optional=True, default=False, description='separate data on records'), }) return parameters @@ -53,9 +54,10 @@ def configure(self): self.id_sep = self.get_value_from_config('id_sep') self.block = self.get_value_from_config('block') self.batch = int(self.get_value_from_config('batch')) + self.record_mode = self.get_value_from_config('records_mode') if self.separator and self.is_text: - raise ConfigError('text file reading with numpy does') + raise ConfigError('text file reading with numpy does support separation') if not self.data_source: if not self._postpone_data_source: raise ConfigError('data_source parameter is required to create "{}" ' @@ -90,7 +92,15 @@ def read(self, data_id): return res key = next(iter(data.keys())) - return data[key] + data = data[key] + if self.record_mode and self.id_sep in field_id: + recno = field_id.split(self.id_sep)[-1] + recno = int(recno) + res = data[recno, :] + return res + if self.multi_infer: + return list(data) + return data class NumpyTXTReader(BaseReader): @@ -126,14 +136,21 @@ class NumpyBinReader(BaseReader): def parameters(cls): params = super().parameters() params.update({ - "dtype": StringField(optional=True, default='float32', description='data type for reading') + "dtype": StringField(optional=True, default='float32', description='data type for reading'), + 'as_buffer': BoolField(optional=True, default=False, description='interpter binary data as buffere'), + 'offset': NumberField(optional=True, default=0, value_type=int, min_value=0) }) return params def configure(self): super().configure() self.dtype = self.get_value_from_config('dtype') + self.as_buffer = self.get_value_from_config('as_buffer') + self.offset = self.get_value_from_config('offset') def read(self, data_id): data_path = self.data_source / data_id if self.data_source is not None else data_id - return np.fromfile(data_path, dtype=self.dtype) + if not self.as_buffer: + return np.fromfile(data_path, dtype=self.dtype) + buffer = Path(data_path).open('rb').read() + return np.frombuffer(buffer[self.offset:], dtype=self.dtype) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/dataset.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/dataset.py index 840008f416d..29b9b835c95 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/dataset.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/dataset.py @@ -47,7 +47,9 @@ ) from .representation import ( - BaseRepresentation, ReIdentificationClassificationAnnotation, ReIdentificationAnnotation, PlaceRecognitionAnnotation + BaseRepresentation, ReIdentificationClassificationAnnotation, + ReIdentificationAnnotation, PlaceRecognitionAnnotation, + SentenceSimilarityAnnotation ) from .data_readers import ( DataReaderField, REQUIRES_ANNOTATIONS, BaseReader, @@ -55,9 +57,21 @@ ) from .logging import print_info +MODULES_RENAMING = { + 'accuracy_checker': 'openvino.tools.accuracy_checker', + 'libs.open_model_zoo.tools.accuracy_checker.accuracy_checker': + [ + 'libs.open_model_zoo.tools.accuracy_checker.openvino.tools.accuracy_checker', + 'thirdparty.open_model_zoo.tools.accuracy_checker.openvino.tools.accuracy_checker', + 'openvino.tools.accuracy_checker', + ], + 'thirdparty.open_model_zoo.tools.accuracy_checker.openvino.tools.accuracy_checker': + 'openvino.tools.accuracy_checker', + } + class Dataset: - def __init__(self, config_entry, delayed_annotation_loading=False): + def __init__(self, config_entry, delayed_annotation_loading=False, log=True): self.name = config_entry.get('name') self._config = config_entry self._batch = self.config.get('batch') @@ -65,7 +79,7 @@ def __init__(self, config_entry, delayed_annotation_loading=False): self.data_provider = None ConfigValidator('dataset', fields=self.parameters()).validate(self.config) if not delayed_annotation_loading: - self.create_data_provider() + self.create_data_provider(log) @classmethod def parameters(cls): @@ -103,17 +117,19 @@ def parameters(cls): } @staticmethod - def load_annotation(config): + def load_annotation(config, log=True): def _convert_annotation(): - print_info("Annotation conversion for {dataset_name} dataset has been started".format( - dataset_name=config['name'])) - print_info("Parameters to be used for conversion:") - for key, value in config['annotation_conversion'].items(): - print_info('{key}: {value}'.format(key=key, value=value)) + if log: + print_info("Annotation conversion for {dataset_name} dataset has been started".format( + dataset_name=config['name'])) + print_info("Parameters to be used for conversion:") + for key, value in config['annotation_conversion'].items(): + print_info('{key}: {value}'.format(key=key, value=value)) annotation, meta = Dataset.convert_annotation(config) if annotation is not None: - print_info("Annotation conversion for {dataset_name} dataset has been finished".format( - dataset_name=config['name'])) + if log: + print_info("Annotation conversion for {dataset_name} dataset has been finished".format( + dataset_name=config['name'])) return annotation, meta def _run_dataset_analysis(meta): @@ -129,10 +145,12 @@ def _save_annotation(): meta_name = config.get('dataset_meta') if meta_name: meta_name = Path(meta_name) - print_info("{dataset_name} dataset metadata will be saved to {file}".format( - dataset_name=config['name'], file=meta_name)) - print_info('Converted annotation for {dataset_name} dataset will be saved to {file}'.format( - dataset_name=config['name'], file=Path(annotation_name))) + if log: + print_info("{dataset_name} dataset metadata will be saved to {file}".format( + dataset_name=config['name'], file=meta_name)) + if log: + print_info('Converted annotation for {dataset_name} dataset will be saved to {file}'.format( + dataset_name=config['name'], file=Path(annotation_name))) save_annotation(annotation, meta, Path(annotation_name), meta_name, config) annotation, meta = None, None @@ -140,9 +158,10 @@ def _save_annotation(): if 'annotation' in config: annotation_file = Path(config['annotation']) if annotation_file.exists(): - print_info('Annotation for {dataset_name} dataset will be loaded from {file}'.format( - dataset_name=config['name'], file=annotation_file)) - annotation = read_annotation(get_path(annotation_file)) + if log: + print_info('Annotation for {dataset_name} dataset will be loaded from {file}'.format( + dataset_name=config['name'], file=annotation_file)) + annotation = read_annotation(get_path(annotation_file), log) meta = Dataset.load_meta(config) use_converted_annotation = False @@ -151,8 +170,9 @@ def _save_annotation(): if not annotation: raise ConfigError('path to converted annotation or data for conversion should be specified') - annotation = _create_subset(annotation, config) - dataset_analysis = config.get('analyze_datase', False) + no_recursion = (meta or {}).get('no_recursion', False) + annotation = _create_subset(annotation, config, no_recursion) + dataset_analysis = config.get('analyze_dataset', False) if dataset_analysis: meta = _run_dataset_analysis(meta) @@ -204,8 +224,8 @@ def send_annotation_info(self, config): return info - def create_data_provider(self): - annotation, meta = self.load_annotation(self.config) + def create_data_provider(self, log=True): + annotation, meta = self.load_annotation(self.config, log=log) data_reader_config = self.config.get('reader', 'opencv_imread') data_source = self.config.get('data_source') if isinstance(data_reader_config, str): @@ -358,31 +378,28 @@ def labels(self): return self.data_provider.labels -def read_annotation(annotation_file: Path): +def read_annotation(annotation_file: Path, log=True): annotation_file = Path(annotation_file) result = [] + loader_cls = pickle.Unpickler # nosec - disable B301:pickle check with annotation_file.open('rb') as file: - loader = pickle.Unpickler(file) # nosec - disable B301:pickle check + loader = loader_cls(file) try: first_obj = loader.load() if isinstance(first_obj, DatasetConversionInfo): - describe_cached_dataset(first_obj) + if log: + describe_cached_dataset(first_obj) else: result.append(first_obj) except ModuleNotFoundError: - loader = RenameUnpickler( - file, - { - 'accuracy_checker': 'openvino.tools.accuracy_checker', - 'libs.open_model_zoo.tools.accuracy_checker.accuracy_checker': - ['libs.open_model_zoo.tools.accuracy_checker.openvino.tools.accuracy_checker', - 'openvino.tools.accuracy_checker'] - }) + loader_cls = RenameUnpickler + loader = loader_cls(file, MODULES_RENAMING) try: first_obj = loader.load() if isinstance(first_obj, DatasetConversionInfo): - describe_cached_dataset(first_obj) + if log: + describe_cached_dataset(first_obj) else: result.append(first_obj) except EOFError: @@ -391,31 +408,34 @@ def read_annotation(annotation_file: Path): return result while True: try: - result.append(BaseRepresentation.load(file, loader)) + result.append( + BaseRepresentation.load(file, loader_cls(file) if loader_cls != RenameUnpickler + else loader_cls(file, MODULES_RENAMING)) + ) except EOFError: break return result -def create_subset(annotation, subsample_size, subsample_seed, shuffle=True): +def create_subset(annotation, subsample_size, subsample_seed, shuffle=True, no_recursion=False): if isinstance(subsample_size, str): if subsample_size.endswith('%'): try: subsample_size = float(subsample_size[:-1]) - except ValueError: - raise ConfigError('invalid value for subsample_size: {}'.format(subsample_size)) + except ValueError as value_err: + raise ConfigError('invalid value for subsample_size: {}'.format(subsample_size)) from value_err if subsample_size <= 0: raise ConfigError('subsample_size should be > 0') subsample_size *= len(annotation) / 100 subsample_size = int(subsample_size) or 1 try: subsample_size = int(subsample_size) - except ValueError: - raise ConfigError('invalid value for subsample_size: {}'.format(subsample_size)) + except ValueError as value_err: + raise ConfigError('invalid value for subsample_size: {}'.format(subsample_size)) from value_err if subsample_size < 1: raise ConfigError('subsample_size should be > 0') - return make_subset(annotation, subsample_size, subsample_seed, shuffle) + return make_subset(annotation, subsample_size, subsample_seed, shuffle, no_recursion) def describe_cached_dataset(dataset_info): @@ -458,7 +478,8 @@ def make_subset(self, ids=None, start=0, step=1, end=None, accept_pairs=False): next(iter(self._data_buffer.values())), ( ReIdentificationAnnotation, ReIdentificationClassificationAnnotation, - PlaceRecognitionAnnotation + PlaceRecognitionAnnotation, + SentenceSimilarityAnnotation ) ) if ids: @@ -506,6 +527,22 @@ def reid_subset(pairs_set, subsample_set, ids): pairs_set |= OrderedSet(gallery_for_person) return pairs_set, subsample_set + def sentence_sim_subset(pairs_set, subsample_set, ids): + index_to_info = { + idx: (identifier, ann.id, ann.pair_id) + for idx, (identifier, ann) in enumerate(self._data_buffer.items()) + } + pair_id_to_idx = {pair_id: idx for idx, (_, _, pair_id) in index_to_info.items() if pair_id is not None} + id_to_idx = {inst_id: idx for idx, (_, inst_id, _) in index_to_info.items()} + for idx in ids: + subsample_set.add(idx) + current_annotation = self._data_buffer[index_to_info[idx][0]] + if current_annotation.pair_id is not None and current_annotation.pair_id in id_to_idx: + pairs_set.add(id_to_idx[current_annotation.pair_id]) + if current_annotation.id in pair_id_to_idx: + pairs_set.add(pair_id_to_idx[current_annotation.id]) + return pairs_set, subsample_set + def ibl_subset(pairs_set, subsample_set, ids): queries_ids = [idx for idx, (_, ann) in enumerate(self._data_buffer.items()) if ann.query] gallery_ids = [idx for idx, (_, ann) in enumerate(self._data_buffer.items()) if not ann.query] @@ -526,6 +563,7 @@ def ibl_subset(pairs_set, subsample_set, ids): return pairs_set, subsample_set realisation = [ + (SentenceSimilarityAnnotation, sentence_sim_subset), (PlaceRecognitionAnnotation, ibl_subset), (ReIdentificationClassificationAnnotation, reid_pairwise_subset), (ReIdentificationAnnotation, reid_subset), @@ -700,7 +738,8 @@ def set_annotation(self, annotation, meta): if subsample_size is not None: subsample_seed = self.dataset_config.get('subsample_seed', 666) - annotation = create_subset(annotation, subsample_size, subsample_seed) + annotation = create_subset( + annotation, subsample_size, subsample_seed, (meta or {}).get('no_recursion', False)) if self.dataset_config.get('analyze_dataset', False): if self.dataset_config.get('segmentation_masks_source'): @@ -762,14 +801,14 @@ def ignore_subset_settings(config): return False -def _create_subset(annotation, config): +def _create_subset(annotation, config, no_recursion=False): subsample_size = config.get('subsample_size') if not ignore_subset_settings(config): if subsample_size is not None: subsample_seed = config.get('subsample_seed', 666) shuffle = config.get('shuffle', True) - annotation = create_subset(annotation, subsample_size, subsample_seed, shuffle) + annotation = create_subset(annotation, subsample_size, subsample_seed, shuffle, no_recursion) elif subsample_size is not None: warnings.warn("Subset selection parameters will be ignored") diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/base_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/base_evaluator.py index 4181f2a3ea7..1b29f83e5ad 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/base_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/base_evaluator.py @@ -17,7 +17,6 @@ from ..presenters import write_csv_result -# base class for custom evaluators class BaseEvaluator: # create class instance using config @classmethod diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/README.md b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/README.md index bc4eacbac9a..6fd8ba0975c 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/README.md +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/README.md @@ -5,14 +5,12 @@ Suggested approach based on writing python module which will describe validation ## Implementation Adding new evaluator process similar with adding any other entities in the tool. -Custom evaluator is the class which should be inherited from BaseEvaluator and overwrite all abstract methods. +Custom evaluator is the class which should be inherited from BaseCustomEvaluator and overwrite methods necessary for the evaluator. The most important methods for overwriting: * `from_configs` - create new instance using configuration dictionary. -* `process_dataset` - determine validation cycle across all data batches in dataset. -* `compute_metrics` - metrics evaluation after dataset processing. -* `reset` - reset evaluation progress +* `_process` - determine validation cycle across all data batches in dataset. ## Configuration Each custom evaluation config should start with keyword `evaluation` and contain: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_custom_encoder_decoder_joint.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_custom_encoder_decoder_joint.py new file mode 100644 index 00000000000..9eb6cafcb10 --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_custom_encoder_decoder_joint.py @@ -0,0 +1,643 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +import heapq +import math +from collections import OrderedDict +from pathlib import Path +import numpy as np +from .asr_encoder_prediction_joint_evaluator import ASREvaluator +from ...adapters import create_adapter +from ...utils import generate_layer_name, contains_all, contains_any, get_path +from ...logging import print_info +from ...config import ConfigError + + +class BeamEntry: + def __init__(self, blank, other=None, hidden=None): + if other is None: + self.sequence = [blank] + self.log_prob = 0.0 + self.cache = [] + self.hidden = hidden + else: + self.sequence = other.sequence[:] + self.log_prob = other.log_prob + self.cache = other.cache[:] + self.hidden = other.hidden + + def __lt__(self, other): + return self.log_prob < other.log_prob + + def __eq__(self, other): + return self.log_prob == other.log_prob + + def is_prefix(self, other): + if self.sequence == other.sequence or len(self.sequence) >= len(other.sequence): + return False + for i, s in enumerate(self.sequence): + if s != other.sequence[i]: + return False + return True + + +class BaseModel: + def __init__(self, network_info, launcher, delayed_model_loading=False): + self.network_info = network_info + self.launcher = launcher + self.select_inputs_outputs(network_info) + self.reset() + if not delayed_model_loading: + self.prepare_model(network_info, launcher) + + def infer(self, input_data): + raise NotImplementedError + + def release(self): + pass + + def select_inputs_outputs(self, network_info): + raise NotImplementedError + + def reset(self): + pass + +class Encoder(BaseModel): + default_model_suffix = 'encoder' + default_inputs = ['input_0', 'input_1', 'input_2'] + default_outputs = ['output_0', 'output_1', 'output_2'] + + def reset(self): + self.h0 = np.zeros((6, 1, 1024)).astype('float32') + self.c0 = np.zeros((6, 1, 1024)).astype('float32') + + def predict(self, features): + # Evaluate the encoder network one feature frame at a time + input_data = self.fit_to_input(features) + outputs = self.infer(input_data) + encoder_output = np.array(outputs[self.encoder_out]).squeeze() + self.h0 = outputs[self.h0_out] + self.c0 = outputs[self.c0_out] + return encoder_output, outputs + + def infer(self, input_data): + raise NotImplementedError + + def fit_to_input(self, features): + return {self.input: features, self.h0_input: self.h0, self.c0_input: self.c0} + + @property + def input_names(self): + return [self.input, self.h0_input, self.c0_input] + + @input_names.setter + def input_names(self, list_inputs): + assert len(list_inputs) == 3 + self.input, self.h0_input, self.c0_input = list_inputs + + @property + def output_names(self): + return [self.encoder_out, self.h0_out, self.c0_out] + + @output_names.setter + def output_names(self, list_outputs): + assert len(list_outputs) == 3 + self.encoder_out, self.h0_out, self.c0_out = list_outputs + + def select_inputs_outputs(self, network_info): + input_info = network_info.get('inputs', {}) + if isinstance(input_info, list): + self.input_names = input_info + else: + input_list = [ + input_info.get('input', self.default_inputs[0]), + input_info.get('h0_input', self.default_inputs[1]), + input_info.get('c0_input', self.default_inputs[2]) + ] + self.input_names = input_list + output_info = network_info.get('outputs', {}) + if isinstance(output_info, list): + self.output_names = output_info + else: + output_list = [ + input_info.get('output', self.default_outputs[0]), + input_info.get('h0_output', self.default_outputs[1]), + input_info.get('c0_output', self.default_outputs[2]) + ] + self.output_names = output_list + + +class Decoder(BaseModel): + default_model_suffix = 'decoder' + default_inputs = ['input_0', 'input_1', 'input_2'] + default_outputs = ['output_0', 'output_1', 'output_2'] + + def reset(self): + self.h0 = np.zeros((2, 1, 1024)).astype('float32') + self.c0 = np.zeros((2, 1, 1024)).astype('float32') + + def predict(self, token_id, hidden=None): + input_data = self.fit_to_input(token_id, hidden) + outputs = self.infer(input_data) + self.h0 = outputs[self.h0_out] + self.c0 = outputs[self.c0_out] + return np.array(outputs[self.decoder_out]).squeeze(), (self.h0, self.c0), outputs + + def fit_to_input(self, token_id, hidden): + if hidden is None: + self.reset() + else: + self.h0 = hidden[0] + self.c0 = hidden[1] + input_data = np.array([token_id]).astype('int64') + return {self.input: input_data, self.h0_input: self.h0, self.c0_input: self.c0} + + @property + def input_names(self): + return [self.input, self.h0_input, self.c0_input] + + @input_names.setter + def input_names(self, list_inputs): + assert len(list_inputs) == 3 + self.input, self.h0_input, self.c0_input = list_inputs + + @property + def output_names(self): + return [self.decoder_out, self.h0_out, self.c0_out] + + @output_names.setter + def output_names(self, list_outputs): + assert len(list_outputs) == 3 + self.decoder_out, self.h0_out, self.c0_out = list_outputs + + def select_inputs_outputs(self, network_info): + input_info = network_info.get('inputs', {}) + if isinstance(input_info, list): + self.input_names = input_info + else: + input_list = [ + input_info.get('input', self.default_inputs[0]), + input_info.get('h0_input', self.default_inputs[1]), + input_info.get('c0_input', self.default_inputs[2]) + ] + self.input_names = input_list + output_info = network_info.get('outputs', {}) + if isinstance(output_info, list): + self.output_names = output_info + else: + output_list = [ + input_info.get('output', self.default_outputs[0]), + input_info.get('h0_output', self.default_outputs[1]), + input_info.get('c0_output', self.default_outputs[2]) + ] + self.output_names = output_list + + def infer(self, input_data): + raise NotImplementedError + +class Joint(BaseModel): + default_model_suffix = 'joint' + default_inputs = ['0', '1'] + default_outputs = ['8'] + + def predict(self, encoder_out, predictor_out): + input_data = self.fit_to_input(encoder_out, predictor_out) + outputs = self.infer(input_data) + joint_out = outputs[self.output] + return log_softmax(np.array(joint_out).squeeze()), outputs + + def fit_to_input(self, encoder_out, predictor_out): + return {self.input1: encoder_out, self.input2: predictor_out} + + @property + def input_names(self): + return [self.input1, self.input2] + + @input_names.setter + def input_names(self, list_inputs): + assert len(list_inputs) == 2 + self.input1, self.input2 = list_inputs + + @property + def output_names(self): + return [self.output] + + @output_names.setter + def output_names(self, list_outputs): + assert len(list_outputs) == 1 + self.output = list_outputs[0] + + def select_inputs_outputs(self, network_info): + input_info = network_info.get('inputs', {}) + if isinstance(input_info, list): + self.input_names = input_info + else: + input_list = [ + input_info.get('input1', self.default_inputs[0]), + input_info.get('input2', self.default_inputs[1]), + ] + self.input_names = input_list + output_info = network_info.get('outputs', {}) + if isinstance(output_info, list): + self.output_names = output_info + else: + output_list = [ + input_info.get('output', self.default_outputs[0]), + ] + self.output_names = output_list + + def reset(self): + pass + + def infer(self, input_data): + raise NotImplementedError + +def log_softmax(x): + e_x = np.exp(x - np.max(x)) + return np.log(e_x / e_x.sum()) + + +class CommonONNXModel(BaseModel): + def prepare_model(self, network_info, launcher): + model = self.automatic_model_search(network_info) + self.inference_session = launcher.create_inference_session(str(model)) + + def infer(self, input_data): + results = self.inference_session.run(self.output_names, input_data) + return dict(zip(self.output_names, results)) + + def release(self): + del self.inference_session + + def automatic_model_search(self, network_info): + model = Path(network_info['model']) + if model.is_dir(): + model_list = list(model.glob('*{}.onnx'.format(self.default_model_suffix))) + if not model_list: + model_list = list(model.glob('*.onnx')) + if not model_list: + raise ConfigError('Suitable model for {} not found'.format(self.default_model_suffix)) + if len(model_list) > 1: + raise ConfigError('Several suitable models for {} found'.format(self.default_model_suffix)) + model = model_list[0] + accepted_suffixes = ['.onnx'] + if model.suffix not in accepted_suffixes: + raise ConfigError('Models with following suffixes are allowed: {}'.format(accepted_suffixes)) + print_info('{} - Found model: {}'.format(self.default_model_suffix, model)) + + return model + + def select_inputs_outputs(self, network_info): + pass + +class ONNXEncoder(CommonONNXModel, Encoder): + pass + + +class ONNXDecoder(CommonONNXModel, Decoder): + pass + + +class ONNXJoint(CommonONNXModel, Joint): + pass + + +class CommonDLSDKModel: + with_prefix = None + + def _reshape_input(self, input_shapes): + if not self.is_dynamic: + del self.exec_network + self.network.reshape(input_shapes) + self.dynamic_inputs, self.partial_shapes = self.launcher.get_dynamic_inputs(self.network) + if not self.is_dynamic and self.dynamic_inputs: + self.exec_network = None + return + self.exec_network = self.launcher.ie_core.load_network(self.network, self.launcher.device) + + def load_network(self, network, launcher): + self.network = network + self.dynamic_inputs, self.partial_shapes = launcher.get_dynamic_inputs(self.network) + if self.dynamic_inputs and launcher.dynamic_shapes_policy in ['dynamic', 'default']: + try: + self.exec_network = launcher.ie_core.load_network(self.network, launcher.device) + self.is_dynamic = True + except RuntimeError as e: + if launcher.dynamic_shapes_policy == 'dynamic': + raise e + self.is_dynamic = False + self.exec_network = None + return + if not self.dynamic_inputs: + self.exec_network = launcher.ie_core.load_network(self.network, launcher.device) + + def print_input_output_info(self): + print_info('{} - Input info:'.format(self.default_model_suffix)) + has_info = hasattr(self.network if self.network is not None else self.exec_network, 'input_info') + if self.network: + if has_info: + network_inputs = OrderedDict( + [(name, data.input_data) for name, data in self.network.input_info.items()] + ) + else: + network_inputs = self.network.inputs + network_outputs = self.network.outputs + else: + if has_info: + network_inputs = OrderedDict([ + (name, data.input_data) for name, data in self.exec_network.input_info.items() + ]) + else: + network_inputs = self.exec_network.inputs + network_outputs = self.exec_network.outputs + for name, input_info in network_inputs.items(): + print_info('\tLayer name: {}'.format(name)) + print_info('\tprecision: {}'.format(input_info.precision)) + print_info('\tshape {}\n'.format( + input_info.shape if name not in self.partial_shapes else self.partial_shapes[name])) + print_info('{} - Output info'.format(self.default_model_suffix)) + for name, output_info in network_outputs.items(): + print_info('\tLayer name: {}'.format(name)) + print_info('\tprecision: {}'.format(output_info.precision)) + print_info('\tshape: {}\n'.format( + output_info.shape if name not in self.partial_shapes else self.partial_shapes[name])) + + def prepare_model(self, network_info, launcher): + self.load_model(network_info, launcher, True) + + def automatic_model_search(self, network_info): + model = Path(network_info['model']) + if model.is_dir(): + is_blob = network_info.get('_model_is_blob') + if is_blob: + model_list = list(model.glob('*{}.blob'.format(self.default_model_suffix))) + if not model_list: + model_list = list(model.glob('*.blob')) + else: + model_list = list(model.glob('*{}.xml'.format(self.default_model_suffix))) + blob_list = list(model.glob('*{}.blob'.format(self.default_model_suffix))) + if not model_list and not blob_list: + model_list = list(model.glob('*.xml')) + blob_list = list(model.glob('*.blob')) + if not model_list: + model_list = blob_list + if not model_list: + raise ConfigError('Suitable model for {} not found'.format(self.default_model_suffix)) + if len(model_list) > 1: + raise ConfigError('Several suitable models for {} found'.format(self.default_model_suffix)) + model = model_list[0] + accepted_suffixes = ['.blob', '.xml', '.onnx'] + if model.suffix not in accepted_suffixes: + raise ConfigError('Models with following suffixes are allowed: {}'.format(accepted_suffixes)) + print_info('{} - Found model: {}'.format(self.default_model_suffix, model)) + if model.suffix == '.blob': + return model, None + weights = get_path(network_info.get('weights', model.parent / model.name.replace('xml', 'bin'))) + accepted_weights_suffixes = ['.bin'] + if weights.suffix not in accepted_weights_suffixes: + raise ConfigError('Weights with following suffixes are allowed: {}'.format(accepted_weights_suffixes)) + print_info('{} - Found weights: {}'.format(self.default_model_suffix, weights)) + return model, weights + + def set_input_and_output(self): + if self.exec_network is not None: + has_info = hasattr(self.exec_network, 'input_info') + input_info = self.exec_network.input_info if has_info else self.exec_network.inputs + else: + has_info = hasattr(self.network, 'input_info') + input_info = self.network.input_info if has_info else self.network.inputs + input_blob = next(iter(input_info)) + with_prefix = input_blob.startswith(self.default_model_suffix) + if with_prefix != self.with_prefix: + self.input_names = [ + generate_layer_name( + inp_name, self.default_model_suffix + '_', with_prefix) for inp_name in self.input_names + ] + self.output_names = [ + generate_layer_name( + out_name, self.default_model_suffix + '_', with_prefix) for out_name in self.output_names + ] + self.with_prefix = with_prefix + + def load_model(self, network_info, launcher, log=False): + if 'onnx_model' in network_info: + network_info.update(launcher.config) + model, weights = launcher.convert_model(network_info) + else: + model, weights = self.automatic_model_search(network_info) + if weights is not None: + self.network = launcher.read_network(str(model), str(weights)) + self.load_network(self.network, launcher) + else: + self.exec_network = launcher.ie_core.import_network(str(model)) + self.set_input_and_output() + if log: + self.print_input_output_info() + + def infer(self, input_data): + return self.exec_network.infer(input_data) + + +class DLSDKEncoder(CommonDLSDKModel, Encoder): + pass + + +class DLSDKDecoder(CommonDLSDKModel, Decoder): + pass + + +class DLSDKJoint(CommonDLSDKModel, Joint): + pass + + +def create_encoder(model_config, launcher, delayed_model_loading=False): + launcher_model_mapping = { + 'dlsdk': DLSDKEncoder, + 'onnx_runtime': ONNXEncoder + } + framework = launcher.config['framework'] + model_class = launcher_model_mapping.get(framework) + if not model_class: + raise ValueError('model for framework {} is not supported'.format(framework)) + return model_class(model_config, launcher, delayed_model_loading) + + +def create_decoder(model_config, launcher, delayed_model_loading): + launcher_model_mapping = { + 'dlsdk': DLSDKDecoder, + 'onnx_runtime': ONNXDecoder + } + framework = launcher.config['framework'] + model_class = launcher_model_mapping.get(framework) + if not model_class: + raise ValueError('model for framework {} is not supported'.format(framework)) + return model_class(model_config, launcher, delayed_model_loading) + + +def create_joint(model_config, launcher, delayed_model_loading): + launcher_model_mapping = { + 'dlsdk': DLSDKJoint, + 'onnx_runtime': ONNXJoint + } + framework = launcher.config['framework'] + model_class = launcher_model_mapping.get(framework) + if not model_class: + raise ValueError('model for framework {} is not supported'.format(framework)) + return model_class(model_config, launcher, delayed_model_loading) + + +class CustomASREvaluator(ASREvaluator): + @classmethod + def from_configs(cls, config, delayed_model_loading=False, orig_config=None): + dataset_config, launcher, launcher_config = cls.get_dataset_and_launcher_info(config) + adapter_config = launcher_config.get('adapter', {'type': 'dumb_decoder'}) + model = ASRModel( + config.get('network_info', {}), adapter_config, launcher, config.get('_models', []), + config.get('_model_is_blob'), delayed_model_loading + ) + return cls(dataset_config, launcher, model, orig_config) + + +class ASRModel: + beam_width = 5 + + def __init__(self, network_info, adapter_config, launcher, models_args, is_blob, delayed_model_loading=False): + if models_args and not delayed_model_loading: + encoder = network_info.get('encoder', {}) + decoder = network_info.get('decoder', {}) + joint = network_info.get('joint', {}) + if not contains_any(encoder, ['model', 'onnx_model']) and models_args: + encoder['model'] = models_args[0] + encoder['_model_is_blob'] = is_blob + if not contains_any(decoder, ['model', 'onnx_model']) and models_args: + decoder['model'] = models_args[1 if len(models_args) > 1 else 0] + decoder['_model_is_blob'] = is_blob + if not contains_any(joint, ['model', 'onnx_model']) and models_args: + joint['model'] = models_args[2 if len(models_args) > 2 else 0] + joint['_model_is_blob'] = is_blob + network_info.update({'encoder': encoder, 'decoder': decoder, 'joint': joint}) + if not contains_all(network_info, ['encoder', 'decoder', 'joint']) and not delayed_model_loading: + raise ConfigError('network_info should contain encoder, prediction and joint fields') + self.encoder = create_encoder(network_info['encoder'], launcher, delayed_model_loading) + self.decoder = create_decoder(network_info['decoder'], launcher, delayed_model_loading) + self.joint = create_joint(network_info['joint'], launcher, delayed_model_loading) + self.adapter = create_adapter(adapter_config) + self._part_by_name = {'encoder': self.encoder, 'decoder': self.decoder, 'joint': self.joint} + + def release(self): + self.encoder.release() + self.decoder.release() + self.joint.release() + + def load_network(self, network_list, launcher): + for network_dict in network_list: + self._part_by_name[network_dict['name']].load_network(network_dict['model'], launcher) + + def load_model(self, network_list, launcher): + for network_dict in network_list: + self._part_by_name[network_dict['name']].load_model(network_dict, launcher) + + def get_network(self): + return [{'name': 'encoder', 'model': self.encoder.network}, + {'name': 'decoder', 'model': self.decoder.network}, + {'name': 'joint', 'model': self.joint.network}] + + def predict(self, identifiers, input_data, encoder_callback=None): + input_data = self.prepare_records(input_data) + B = [BeamEntry(blank=self.adapter.blank)] + self.encoder.reset() + self.decoder.reset() + for idx in range(0, input_data.shape[1], 3): + encoder_output, raw_outputs = self.encoder.predict(input_data[:, idx]) + if encoder_callback is not None: + encoder_callback(raw_outputs) + A = B + B = [] + for j in range(len(A) - 1): + for i in range(j + 1, len(A)): + if A[i].is_prefix(A[j]): + A = self.fill_prefix(A, i, j, encoder_output, encoder_callback) + while True: + y_hat = max(A) + A.remove(y_hat) + decoder_output, hidden, raw_outputs = self.decoder.predict(y_hat.sequence[-1], hidden=y_hat.hidden) + if encoder_callback is not None: + encoder_callback(raw_outputs) + joint_output, raw_outputs = self.joint.predict(encoder_output, decoder_output) + if encoder_callback is not None: + encoder_callback(raw_outputs) + joint_output = self.handle_eos(joint_output) + A = self.fill_beam(A, B, y_hat, hidden, joint_output, decoder_output) + y_hat = max(A) + yb = max(B) + if len(B) >= self.beam_width and yb.log_prob >= y_hat.log_prob: + break + B = heapq.nlargest(self.beam_width, B) + return self.adapter.process([B[0].sequence], identifiers, [{}]), {} + + @staticmethod + def prepare_records(features): + feats = features[0].reshape(features[0].shape[0] // 80, 80).T + feat_stack = np.vstack( + (feats[:, 0:-7], + feats[:, 1:-6], + feats[:, 2:-5], + feats[:, 3:-4], + feats[:, 4:-3], + feats[:, 5:-2], + feats[:, 6:-1], + feats[:, 7:])) + + return feat_stack + + def fill_beam(self, A, B, y_hat, hidden, joint_output, decoder_output): + for k, _ in enumerate(self.adapter.alphabet): + yk = BeamEntry(self.adapter.blank, y_hat) + yk.log_prob += joint_output[k] + if k == self.adapter.blank: + heapq.heappush(B, yk) + continue + yk.hidden = hidden + yk.sequence.append(k) + yk.cache.append(decoder_output) + A.append(yk) + return A + + def handle_eos(self, joint_output): + if self.adapter.eos != -1: + joint_output[self.adapter.blank] = np.log( + np.exp(joint_output[self.adapter.blank]) + np.exp(joint_output[self.adapter.eos])) + joint_output[self.adapter.eos] = np.log(1e-10) + return joint_output + + def fill_prefix(self, A, i, j, encoder_output, callback=None): + def log_add(a, b): + return max(a, b) + math.log1p(math.exp(-math.fabs(a - b))) + decoder_output, _, raw_outputs = self.decoder.predict(A[i].sequence[-1], hidden=A[i].hidden) + if callback is not None: + callback(raw_outputs) + idx = len(A[i].sequence) + joint_output, raw_outputs = self.joint.predict(encoder_output, decoder_output) + if callback is not None: + callback(raw_outputs) + joint_output = self.handle_eos(joint_output) + curlogp = A[i].log_prob + float(joint_output[A[j].sequence[idx]]) + for k in range(idx, len(A[j].sequence) - 1): + joint_output, raw_outputs = self.joint.predict(encoder_output, A[j].cache[k]) + if callback is not None: + callback(raw_outputs) + curlogp += joint_output[A[j].sequence[k + 1]] + A[j].log_prob = log_add(A[j].log_prob, curlogp) + return A diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_encoder_decoder_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_encoder_decoder_evaluator.py index 9594f773bf0..b3c1c861884 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_encoder_decoder_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_encoder_decoder_evaluator.py @@ -20,267 +20,46 @@ from collections import OrderedDict import numpy as np -from ..base_evaluator import BaseEvaluator -from ..quantization_model_evaluator import create_dataset_attributes +from .base_custom_evaluator import BaseCustomEvaluator from ...adapters import create_adapter from ...config import ConfigError -from ...launcher import create_launcher from ...utils import contains_all, contains_any, extract_image_representations, read_pickle, get_path -from ...progress_reporters import ProgressReporter from ...logging import print_info -class AutomaticSpeechRecognitionEvaluator(BaseEvaluator): +class AutomaticSpeechRecognitionEvaluator(BaseCustomEvaluator): def __init__(self, dataset_config, launcher, model, orig_config): - self.dataset_config = dataset_config - self.preprocessing_executor = None - self.preprocessor = None - self.dataset = None - self.postprocessor = None - self.metric_executor = None - self.launcher = launcher + super().__init__(dataset_config, launcher, orig_config) self.model = model - self._metrics_results = [] - self.config = orig_config + if hasattr(self.model, 'adapter'): + self.adapter_type = self.model.adapter.__provider__ @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_config = config['launchers'][0] - if launcher_config['framework'] == 'dlsdk' and 'device' not in launcher_config: - launcher_config['device'] = 'CPU' - - launcher = create_launcher(launcher_config, delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) model = ASRModel( config.get('network_info', {}), launcher, config.get('_models', []), config.get('_model_is_blob'), delayed_model_loading ) return cls(dataset_config, launcher, model, orig_config) - def process_dataset( - self, subset=None, - num_images=None, - check_progress=False, - dataset_tag='', - output_callback=None, - allow_pairwise_subset=False, - dump_prediction_to_annotation=False, - calculate_metrics=True, - **kwargs): - if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): - self.select_dataset(dataset_tag) - - self._annotations, self._predictions = [], [] - - self._create_subset(subset, num_images, allow_pairwise_subset) - metric_config = self.configure_intermediate_metrics_results(kwargs) - (compute_intermediate_metric_res, metric_interval, ignore_results_formatting, - ignore_metric_reference) = metric_config - - if 'progress_reporter' in kwargs: - _progress_reporter = kwargs['progress_reporter'] - _progress_reporter.reset(self.dataset.size) - else: - _progress_reporter = None if not check_progress else self._create_progress_reporter( - check_progress, self.dataset.size - ) + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): for batch_id, (batch_input_ids, batch_annotation, batch_inputs, batch_identifiers) in enumerate(self.dataset): batch_inputs = self.preprocessor.process(batch_inputs, batch_annotation) batch_inputs_extr, _ = extract_image_representations(batch_inputs) encoder_callback = None if output_callback: - encoder_callback = partial(output_callback, - metrics_result=None, - element_identifiers=batch_identifiers, + encoder_callback = partial(output_callback, metrics_result=None, element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) - batch_raw_prediction, batch_prediction = self.model.predict( batch_identifiers, batch_inputs_extr, encoder_callback=encoder_callback ) - metrics_result = None - if self.metric_executor and calculate_metrics: - metrics_result, _ = self.metric_executor.update_metrics_on_batch( - batch_input_ids, batch_annotation, batch_prediction - ) - if self.metric_executor.need_store_predictions: - self._annotations.extend(batch_annotation) - self._predictions.extend(batch_prediction) - + metrics_result = self._get_metrics_result(batch_input_ids, batch_annotation, batch_prediction, + calculate_metrics) if output_callback: - output_callback( - batch_raw_prediction[0], - metrics_result=metrics_result, - element_identifiers=batch_identifiers, - dataset_indices=batch_input_ids - ) - if _progress_reporter: - _progress_reporter.update(batch_id, len(batch_prediction)) - if compute_intermediate_metric_res and _progress_reporter.current % metric_interval == 0: - self.compute_metrics( - print_results=True, ignore_results_formatting=ignore_results_formatting, - ignore_metric_reference=ignore_metric_reference - ) - self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, metric_interval) - - if _progress_reporter: - _progress_reporter.finish() - - if self.model.store_encoder_predictions: - self.model.save_encoder_predictions() - - def compute_metrics(self, print_results=True, ignore_results_formatting=False, ignore_metric_reference=False): - if self._metrics_results: - del self._metrics_results - self._metrics_results = [] - - for result_presenter, evaluated_metric in self.metric_executor.iterate_metrics( - self._annotations, self._predictions): - self._metrics_results.append(evaluated_metric) - if print_results: - result_presenter.write_result(evaluated_metric, ignore_results_formatting, ignore_metric_reference) - - return self._metrics_results - - def extract_metrics_results(self, print_results=True, ignore_results_formatting=False, - ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(False, ignore_results_formatting, ignore_metric_reference) - - result_presenters = self.metric_executor.get_metric_presenters() - extracted_results, extracted_meta = [], [] - for presenter, metric_result in zip(result_presenters, self._metrics_results): - result, metadata = presenter.extract_result(metric_result) - if isinstance(result, list): - extracted_results.extend(result) - extracted_meta.extend(metadata) - else: - extracted_results.append(result) - extracted_meta.append(metadata) - if print_results: - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - return extracted_results, extracted_meta - - def print_metrics_results(self, ignore_results_formatting=False, ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(True, ignore_results_formatting, ignore_metric_reference) - return - result_presenters = self.metric_executor.get_metric_presenters() - for presenter, metric_result in zip(result_presenters, self._metrics_results): - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - def release(self): - self.model.release() - self.launcher.release() - - def reset(self): - if self.metric_executor: - self.metric_executor.reset() - if hasattr(self, '_annotations'): - del self._annotations - del self._predictions - del self._input_ids - del self._metrics_results - self._annotations = [] - self._predictions = [] - self._input_ids = [] - self._metrics_results = [] - if self.dataset: - self.dataset.reset(self.postprocessor.has_processors) - - @staticmethod - def get_processing_info(config): - module_specific_params = config.get('module_config') - model_name = config['name'] - dataset_config = module_specific_params['datasets'][0] - launcher_config = module_specific_params['launchers'][0] - return ( - model_name, launcher_config['framework'], launcher_config['device'], launcher_config.get('tags'), - dataset_config['name'] - ) - - def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): - if self.dataset.batch is None: - self.dataset.batch = 1 - if subset is not None: - self.dataset.make_subset(ids=subset, accept_pairs=allow_pairwise) - elif num_images is not None: - self.dataset.make_subset(end=num_images, accept_pairs=allow_pairwise) - - @staticmethod - def configure_intermediate_metrics_results(config): - compute_intermediate_metric_res = config.get('intermediate_metrics_results', False) - metric_interval, ignore_results_formatting, ignore_metric_reference = None, None, None - if compute_intermediate_metric_res: - metric_interval = config.get('metrics_interval', 1000) - ignore_results_formatting = config.get('ignore_results_formatting', False) - ignore_metric_reference = config.get('ignore_metric_reference', False) - return compute_intermediate_metric_res, metric_interval, ignore_results_formatting, ignore_metric_reference - - def load_network(self, network=None): - self.model.load_network(network, self.launcher) - - def load_network_from_ir(self, models_list): - self.model.load_model(models_list, self.launcher) - - def get_network(self): - return self.model.get_network() - - def get_metrics_attributes(self): - if not self.metric_executor: - return {} - return self.metric_executor.get_metrics_attributes() - - def register_metric(self, metric_config): - if isinstance(metric_config, str): - self.metric_executor.register_metric({'type': metric_config}) - elif isinstance(metric_config, dict): - self.metric_executor.register_metric(metric_config) - else: - raise ValueError('Unsupported metric configuration type {}'.format(type(metric_config))) - - def register_postprocessor(self, postprocessing_config): - pass - - def register_dumped_annotations(self): - pass - - def select_dataset(self, dataset_tag): - if self.dataset is not None and isinstance(self.dataset_config, list): - return - dataset_attributes = create_dataset_attributes(self.dataset_config, dataset_tag) - self.dataset, self.metric_executor, self.preprocessor, self.postprocessor = dataset_attributes - - @staticmethod - def _create_progress_reporter(check_progress, dataset_size): - pr_kwargs = {} - if isinstance(check_progress, int) and not isinstance(check_progress, bool): - pr_kwargs = {"print_interval": check_progress} - - return ProgressReporter.provide('print', dataset_size, **pr_kwargs) - - @property - def dataset_size(self): - return self.dataset.size - - def send_processing_info(self, sender): - if not sender: - return {} - model_type = None - details = {} - metrics = self.dataset_config[0].get('metrics', []) - metric_info = [metric['type'] for metric in metrics] - adapter_type = self.model.adapter.__provider__ - details.update({ - 'metrics': metric_info, - 'model_file_type': model_type, - 'adapter': adapter_type, - }) - if self.dataset is None: - self.select_dataset('') - - details.update(self.dataset.send_annotation_info(self.dataset_config[0])) - return details + output_callback(batch_raw_prediction[0], metrics_result=metrics_result, + element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) + self._update_progress(progress_reporter, metric_config, batch_id, len(batch_prediction), csv_file) class BaseModel: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_encoder_prediction_joint_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_encoder_prediction_joint_evaluator.py index 8d88c7a5203..a47d0770ce8 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_encoder_prediction_joint_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_encoder_prediction_joint_evaluator.py @@ -21,7 +21,6 @@ from ...adapters import create_adapter from ...config import ConfigError -from ...launcher import create_launcher from ...utils import contains_all, contains_any, read_pickle, get_path from ...logging import print_info from .asr_encoder_decoder_evaluator import AutomaticSpeechRecognitionEvaluator @@ -30,12 +29,7 @@ class ASREvaluator(AutomaticSpeechRecognitionEvaluator): @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_config = config['launchers'][0] - if launcher_config['framework'] == 'dlsdk' and 'device' not in launcher_config: - launcher_config['device'] = 'CPU' - - launcher = create_launcher(launcher_config, delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) model = ASRModel( config.get('network_info', {}), launcher, config.get('_models', []), config.get('_model_is_blob'), delayed_model_loading @@ -173,12 +167,6 @@ def load_model(self, network_info, launcher, log=False): model, weights = launcher.convert_model(network_info) else: model, weights = self.automatic_model_search(network_info) - self.input_layers = network_info.get('inputs', self.default_input_layers) - self.output_layers = network_info.get('outputs', self.default_output_layers) - if len(self.input_layers) == 1: - self.input_blob = self.input_layers[0] - if len(self.output_layers) == 1: - self.output_blob = self.output_layers[0] if weights is not None: self.network = launcher.read_network(str(model), str(weights)) self.load_network(self.network, launcher) @@ -383,6 +371,12 @@ class CommonDLSDKModel(BaseModel, BaseDLSDKModel): def __init__(self, network_info, launcher, delayed_model_loading=False): super().__init__(network_info, launcher) + self.input_layers = network_info.get('inputs', self.default_input_layers) + self.output_layers = network_info.get('outputs', self.default_output_layers) + if len(self.input_layers) == 1: + self.input_blob = self.input_layers[0] + if len(self.output_layers) == 1: + self.output_blob = self.output_layers[0] self.with_prefix = None if not hasattr(self, 'output_blob'): self.output_blob = None diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/base_custom_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/base_custom_evaluator.py new file mode 100644 index 00000000000..d8560cdca8c --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/base_custom_evaluator.py @@ -0,0 +1,256 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +from ..base_evaluator import BaseEvaluator +from ...progress_reporters import ProgressReporter +from ..quantization_model_evaluator import create_dataset_attributes +from ...launcher import create_launcher + + +# base class for custom evaluators +class BaseCustomEvaluator(BaseEvaluator): + def __init__(self, dataset_config, launcher, orig_config): + self.dataset_config = dataset_config + self.dataset = None + self.preprocessing_executor = None + self.preprocessor = None + self.postprocessor = None + self.metric_executor = None + self.launcher = launcher + self._metrics_results = [] + self.config = orig_config + self._annotations = [] + self._predictions = [] + self.adapter_type = None + self.model = None + self._part_by_name = None + + @staticmethod + def get_dataset_and_launcher_info(config): + dataset_config = config['datasets'] + launcher_config = config['launchers'][0] + if launcher_config['framework'] == 'dlsdk' and 'device' not in launcher_config: + launcher_config['device'] = 'CPU' + launcher = create_launcher(launcher_config, delayed_model_loading=True) + return dataset_config, launcher, launcher_config + + def process_dataset(self, subset=None, num_images=None, check_progress=False, dataset_tag='', + output_callback=None, allow_pairwise_subset=False, dump_prediction_to_annotation=False, + calculate_metrics=True, **kwargs): + self._prepare_dataset(dataset_tag) + self._create_subset(subset, num_images, allow_pairwise_subset) + metric_config = self.configure_intermediate_metrics_results(kwargs) + + if 'progress_reporter' in kwargs: + _progress_reporter = kwargs['progress_reporter'] + _progress_reporter.reset(self.dataset.size) + else: + _progress_reporter = None if not check_progress else self._create_progress_reporter( + check_progress, self.dataset.size + ) + + self._process(output_callback, calculate_metrics, _progress_reporter, metric_config, kwargs.get('csv_result')) + + if _progress_reporter: + _progress_reporter.finish() + + def _prepare_dataset(self, dataset_tag=''): + if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): + self.select_dataset(dataset_tag) + + if self.dataset.batch is None: + self.dataset.batch = 1 + + def select_dataset(self, dataset_tag): + if self.dataset is not None and isinstance(self.dataset_config, list): + return + dataset_attributes = create_dataset_attributes(self.dataset_config, dataset_tag) + self.dataset, self.metric_executor, self.preprocessor, self.postprocessor = dataset_attributes + + def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): + if subset is not None: + self.dataset.make_subset(ids=subset, accept_pairs=allow_pairwise) + elif num_images is not None: + self.dataset.make_subset(end=num_images, accept_pairs=allow_pairwise) + + @staticmethod + def configure_intermediate_metrics_results(config): + compute_intermediate_metric_res = config.get('intermediate_metrics_results', False) + metric_interval, ignore_results_formatting, ignore_metric_reference = None, None, None + if compute_intermediate_metric_res: + metric_interval = config.get('metrics_interval', 1000) + ignore_results_formatting = config.get('ignore_results_formatting', False) + ignore_metric_reference = config.get('ignore_metric_reference', False) + return compute_intermediate_metric_res, metric_interval, ignore_results_formatting, ignore_metric_reference + + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): + pass + + def _get_metrics_result(self, input_ids, annotation, prediction, calculate_metrics): + metrics_result = None + if self.metric_executor and calculate_metrics: + metrics_result, _ = self.metric_executor.update_metrics_on_batch(input_ids, annotation, prediction) + if self.metric_executor.need_store_predictions: + self._annotations.extend(annotation) + self._predictions.extend(prediction) + return metrics_result + + def _update_progress(self, progress_reporter, metric_config, batch_id, prediction_size, csv_file): + (compute_intermediate_metric_res, metric_interval, ignore_results_formatting, + ignore_metric_reference) = metric_config + if progress_reporter: + progress_reporter.update(batch_id, prediction_size) + if compute_intermediate_metric_res and progress_reporter.current % metric_interval == 0: + self.compute_metrics( + print_results=True, ignore_results_formatting=ignore_results_formatting, + ignore_metric_reference=ignore_metric_reference + ) + self.write_results_to_csv(csv_file, ignore_results_formatting, metric_interval) + + def compute_metrics(self, print_results=True, ignore_results_formatting=False, ignore_metric_reference=False): + if self._metrics_results: + del self._metrics_results + self._metrics_results = [] + for result_presenter, evaluated_metric in self.metric_executor.iterate_metrics( + self._annotations, self._predictions): + self._metrics_results.append(evaluated_metric) + if print_results: + result_presenter.write_result(evaluated_metric, ignore_results_formatting, ignore_metric_reference) + return self._metrics_results + + def print_metrics_results(self, ignore_results_formatting=False, ignore_metric_reference=False): + if not self._metrics_results: + self.compute_metrics(True, ignore_results_formatting, ignore_metric_reference) + return + result_presenters = self.metric_executor.get_metric_presenters() + for presenter, metric_result in zip(result_presenters, self._metrics_results): + presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) + + def extract_metrics_results(self, print_results=True, ignore_results_formatting=False, + ignore_metric_reference=False): + if not self._metrics_results: + self.compute_metrics(False, ignore_results_formatting, ignore_metric_reference) + result_presenters = self.metric_executor.get_metric_presenters() + extracted_results, extracted_meta = [], [] + for presenter, metric_result in zip(result_presenters, self._metrics_results): + result, metadata = presenter.extract_result(metric_result) + if isinstance(result, list): + extracted_results.extend(result) + extracted_meta.extend(metadata) + else: + extracted_results.append(result) + extracted_meta.append(metadata) + if print_results: + presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) + return extracted_results, extracted_meta + + def register_metric(self, metric_config): + if isinstance(metric_config, str): + self.metric_executor.register_metric({'type': metric_config}) + elif isinstance(metric_config, dict): + self.metric_executor.register_metric(metric_config) + else: + raise ValueError('Unsupported metric configuration type {}'.format(type(metric_config))) + + def get_metrics_attributes(self): + if not self.metric_executor: + return {} + return self.metric_executor.get_metrics_attributes() + + def set_profiling_dir(self, profiler_dir): + self.metric_executor.set_profiling_dir(profiler_dir) + + @property + def dataset_size(self): + return self.dataset.size + + @staticmethod + def _create_progress_reporter(check_progress, dataset_size): + pr_kwargs = {} + if isinstance(check_progress, int) and not isinstance(check_progress, bool): + pr_kwargs = {"print_interval": check_progress} + return ProgressReporter.provide('print', dataset_size, **pr_kwargs) + + def send_processing_info(self, sender): + if not sender: + return {} + model_type = None + details = {} + metrics = self.dataset_config[0].get('metrics', []) + metric_info = [metric['type'] for metric in metrics] + details.update({ + 'metrics': metric_info, + 'model_file_type': model_type, + 'adapter': self.adapter_type, + }) + if self.dataset is None: + self.select_dataset('') + details.update(self.dataset.send_annotation_info(self.dataset_config[0])) + return details + + @staticmethod + def get_processing_info(config): + module_specific_params = config.get('module_config') + model_name = config['name'] + dataset_config = module_specific_params['datasets'][0] + launcher_config = module_specific_params['launchers'][0] + return ( + model_name, launcher_config['framework'], launcher_config.get('device', 'CPU'), launcher_config.get('tags'), + dataset_config['name'] + ) + + def reset(self): + if self.metric_executor: + self.metric_executor.reset() + if hasattr(self, '_annotations'): + del self._annotations + del self._predictions + del self._metrics_results + self._annotations = [] + self._predictions = [] + self._metrics_results = [] + if self.dataset: + self.dataset.reset(self.postprocessor.has_processors) + + def release(self): + self._release_model() + self.launcher.release() + + def _release_model(self): + if self.model: + self.model.release() + if self._part_by_name: + for model in self._part_by_name.values(): + model.release() + + def register_postprocessor(self, postprocessing_config): + pass + + def register_dumped_annotations(self): + pass + + def load_network(self, network=None): + if self.model: + self.model.load_network(network, self.launcher) + + def load_network_from_ir(self, models_list): + if self.model: + self.model.load_model(models_list, self.launcher) + + def get_network(self): + if self.model: + return self.model.get_network() + return [] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/cocosnet_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/cocosnet_evaluator.py index bba14035c8d..9116683e793 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/cocosnet_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/cocosnet_evaluator.py @@ -19,58 +19,43 @@ import numpy as np import cv2 -from ..base_evaluator import BaseEvaluator -from ..quantization_model_evaluator import create_dataset_attributes +from .base_custom_evaluator import BaseCustomEvaluator from ...adapters import create_adapter from ...config import ConfigError from ...data_readers import DataRepresentation -from ...launcher import create_launcher from ...launcher.input_feeder import PRECISION_TO_DTYPE from ...logging import print_info from ...preprocessor import PreprocessingExecutor -from ...progress_reporters import ProgressReporter from ...representation import RawTensorPrediction, RawTensorAnnotation from ...utils import extract_image_representations, contains_all, get_path -class CocosnetEvaluator(BaseEvaluator): - def __init__( - self, dataset_config, launcher, preprocessor_mask, preprocessor_image, - gan_model, check_model, orig_config - ): - self.launcher = launcher - self.dataset_config = dataset_config +class CocosnetEvaluator(BaseCustomEvaluator): + def __init__(self, dataset_config, launcher, preprocessor_mask, preprocessor_image, gan_model, + check_model, orig_config): + super().__init__(dataset_config, launcher, orig_config) self.preprocessor_mask = preprocessor_mask self.preprocessor_image = preprocessor_image - self.postprocessor = None - self.dataset = None - self.metric_executor = None self.test_model = gan_model self.check_model = check_model - self.config = orig_config - self._metrics_results = [] self._part_by_name = { 'gan_network': self.test_model, } if self.check_model: self._part_by_name.update({'verification_network': self.check_model}) + if hasattr(self.test_model, 'adapter'): + self.adapter_type = self.test_model.adapter.__provider__ @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - launcher_config = config['launchers'][0] - dataset_config = config['datasets'] - - preprocessor_mask = PreprocessingExecutor( - dataset_config[0].get('preprocessing_mask') - ) - preprocessor_image = PreprocessingExecutor( - dataset_config[0].get('preprocessing_image') - ) - launcher = create_launcher(launcher_config, delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) + preprocessor_mask = PreprocessingExecutor(dataset_config[0].get('preprocessing_mask')) + preprocessor_image = PreprocessingExecutor(dataset_config[0].get('preprocessing_image')) network_info = config.get('network_info', {}) cocosnet_network = network_info.get('cocosnet_network', {}) verification_network = network_info.get('verification_network', {}) + if not delayed_model_loading: model_args = config.get('_models', []) models_is_blob = config.get('_model_is_blob') @@ -98,18 +83,6 @@ def from_configs(cls, config, delayed_model_loading=False, orig_config=None): dataset_config, launcher, preprocessor_mask, preprocessor_image, gan_model, check_model, orig_config ) - @staticmethod - def get_processing_info(config): - module_specific_params = config.get('module_config') - model_name = config['name'] - launcher_config = module_specific_params['launchers'][0] - dataset_config = module_specific_params['datasets'][0] - - return ( - model_name, launcher_config['framework'], launcher_config['device'], launcher_config.get('tags'), - dataset_config['name'] - ) - def _preprocessing_for_batch_input(self, batch_annotation, batch_inputs): for i, _ in enumerate(batch_inputs): for index_of_input, _ in enumerate(batch_inputs[i].data): @@ -119,37 +92,9 @@ def _preprocessing_for_batch_input(self, batch_annotation, batch_inputs): batch_inputs[i].data[index_of_input] = preprocessor.process( images=[DataRepresentation(batch_inputs[i].data[index_of_input])], batch_annotation=batch_annotation)[0].data - return batch_inputs - def process_dataset( - self, subset=None, - num_images=None, - check_progress=False, - dataset_tag='', - output_callback=None, - allow_pairwise_subset=False, - dump_prediction_to_annotation=False, - **kwargs): - if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): - self.select_dataset(dataset_tag) - - self._annotations, self._predictions = [], [] - - self._create_subset(subset, num_images, allow_pairwise_subset) - - if 'progress_reporter' in kwargs: - _progress_reporter = kwargs['progress_reporter'] - _progress_reporter.reset(self.dataset.size) - else: - _progress_reporter = None if not check_progress else self._create_progress_reporter( - check_progress, self.dataset.size - ) - - metric_config = self._configure_intermediate_metrics_results(kwargs) - (compute_intermediate_metric_res, metric_interval, ignore_results_formatting, - ignore_metric_reference) = metric_config - + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): for batch_id, (batch_input_ids, batch_annotation, batch_inputs, batch_identifiers) in enumerate(self.dataset): batch_inputs = self._preprocessing_for_batch_input(batch_annotation, batch_inputs) extr_batch_inputs, _ = extract_image_representations(batch_inputs) @@ -177,100 +122,20 @@ def process_dataset( check_model_predictions = [ RawTensorPrediction(batch_identifier, item) for batch_identifier, item in zip(batch_identifiers, check_model_predictions)] - if self.metric_executor.need_store_predictions: self._annotations.extend(check_model_annotations) self._predictions.extend(check_model_predictions) - if output_callback: - output_callback( - raw_predictions, - metrics_result=metrics_result, - element_identifiers=batch_identifiers, - dataset_indices=batch_input_ids - ) - - if _progress_reporter: - _progress_reporter.update(batch_id, len(batch_predictions)) - if compute_intermediate_metric_res and _progress_reporter.current % metric_interval == 0: - self.compute_metrics( - print_results=True, ignore_results_formatting=ignore_results_formatting, - ignore_metric_reference=ignore_metric_reference - ) - self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, metric_interval) - - if _progress_reporter: - _progress_reporter.finish() - - return self._annotations, self._predictions - - def compute_metrics(self, print_results=True, ignore_results_formatting=False, ignore_metric_reference=False): - if self._metrics_results: - del self._metrics_results - self._metrics_results = [] - - for result_presenter, evaluated_metric in self.metric_executor.iterate_metrics( - self._annotations, self._predictions): - self._metrics_results.append(evaluated_metric) - if print_results: - result_presenter.write_result(evaluated_metric, ignore_results_formatting, ignore_metric_reference) - return self._metrics_results - - def extract_metrics_results(self, print_results=True, ignore_results_formatting=False, - ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(False, ignore_results_formatting, ignore_metric_reference) - - result_presenters = self.metric_executor.get_metric_presenters() - extracted_results, extracted_meta = [], [] - for presenter, metric_result in zip(result_presenters, self._metrics_results): - result, metadata = presenter.extract_result(metric_result) - if isinstance(result, list): - extracted_results.extend(result) - extracted_meta.extend(metadata) - else: - extracted_results.append(result) - extracted_meta.append(metadata) - if print_results: - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - return extracted_results, extracted_meta - - def print_metrics_results(self, ignore_results_formatting=False, ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(True, ignore_results_formatting, ignore_metric_reference) - return - result_presenters = self.metric_executor.get_metric_presenters() - for presenter, metric_result in zip(result_presenters, self._metrics_results): - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - def release(self): - self.test_model.release() - if self.check_model: - self.check_model.release() - self.launcher.release() - - def reset(self): - if self.metric_executor: - self.metric_executor.reset() - if hasattr(self, '_annotations'): - del self._annotations - del self._predictions - del self._input_ids - del self._metrics_results - self._annotations = [] - self._predictions = [] - self._input_ids = [] - self._metrics_results = [] - if self.dataset: - self.dataset.reset(self.postprocessor.has_processors) + output_callback(raw_predictions, metrics_result=metrics_result, + element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) + self._update_progress(progress_reporter, metric_config, batch_id, len(batch_predictions), csv_file) def load_model(self, network_list): for network_dict in network_list: self._part_by_name[network_dict['name']].load_model(network_dict, self.launcher) - def load_network(self, network_list): - for network_dict in network_list: + def load_network(self, network=None): + for network_dict in network: self._part_by_name[network_dict['name']].load_network(network_dict['model'], self.launcher) def get_network(self): @@ -280,84 +145,6 @@ def load_network_from_ir(self, models_list): model_paths = next(iter(models_list)) next(iter(self._part_by_name.values())).load_model(model_paths, self.launcher) - def get_metrics_attributes(self): - if not self.metric_executor: - return {} - return self.metric_executor.get_metrics_attributes() - - def register_metric(self, metric_config): - if isinstance(metric_config, str): - self.metric_executor.register_metric({'type': metric_config}) - elif isinstance(metric_config, dict): - self.metric_executor.register_metric(metric_config) - else: - raise ValueError('Unsupported metric configuration type {}'.format(type(metric_config))) - - def register_postprocessor(self, postprocessing_config): - pass - - def register_dumped_annotations(self): - pass - - def select_dataset(self, dataset_tag): - if self.dataset is not None and isinstance(self.dataset_config, list): - return - dataset_attributes = create_dataset_attributes(self.dataset_config, dataset_tag) - self.dataset, self.metric_executor, self.preprocessor, self.postprocessor = dataset_attributes - - def set_profiling_dir(self, profiler_dir): - self.metric_executor.set_profiling_dir(profiler_dir) - - def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): - if self.dataset.batch is None: - self.dataset.batch = 1 - if subset is not None: - self.dataset.make_subset(ids=subset, accept_pairs=allow_pairwise) - elif num_images is not None: - self.dataset.make_subset(end=num_images, accept_pairs=allow_pairwise) - - @staticmethod - def _create_progress_reporter(check_progress, dataset_size): - pr_kwargs = {} - if isinstance(check_progress, int) and not isinstance(check_progress, bool): - pr_kwargs = {"print_interval": check_progress} - - return ProgressReporter.provide('print', dataset_size, **pr_kwargs) - - @staticmethod - def _configure_intermediate_metrics_results(config): - compute_intermediate_metric_res = config.get('intermediate_metrics_results', False) - metric_interval, ignore_results_formatting, ignore_metric_reference = None, None, None - if compute_intermediate_metric_res: - metric_interval = config.get('metrics_interval', 1000) - ignore_results_formatting = config.get('ignore_results_formatting', False) - ignore_metric_reference = config.get('ignore_metric_reference', False) - return compute_intermediate_metric_res, metric_interval, ignore_results_formatting, ignore_metric_reference - - @property - def dataset_size(self): - return self.dataset.size - - def send_processing_info(self, sender): - if not sender: - return {} - model_type = None - details = {} - metrics = self.dataset_config[0].get('metrics', []) - metric_info = [metric['type'] for metric in metrics] - adapter_type = self.test_model.adapter.__provider__ - details.update({ - 'metrics': metric_info, - 'model_file_type': model_type, - 'adapter': adapter_type, - }) - if self.dataset is None: - self.select_dataset('') - - details.update(self.dataset.send_annotation_info(self.dataset_config[0])) - return details - - class BaseModel: def __init__(self, network_info, launcher, delayed_model_loading=False): self.input_blob = None @@ -513,13 +300,13 @@ def fit_to_input(self, input_data): inputs[key] = value.astype(PRECISION_TO_DTYPE[self.inputs[key].precision]) return inputs - def predict(self, identifiers, inputs): + def predict(self, identifiers, input_data): results = [] - for current_input in inputs: - input_data = self.fit_to_input(current_input) + for current_input in input_data: + data = self.fit_to_input(current_input) if not self.is_dynamic and self.dynamic_inputs: - self.reshape_net({k: v.shape for k, v in input_data.items()}) - prediction = self.exec_network.infer(input_data) + self.reshape_net({k: v.shape for k, v in data.items()}) + prediction = self.exec_network.infer(data) results.append(*self.adapter.process(prediction, identifiers, [{}])) return results, prediction diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/colorization_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/colorization_evaluator.py index 2d996eca500..e5d913526f1 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/colorization_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/colorization_evaluator.py @@ -19,44 +19,29 @@ import numpy as np import cv2 -from ..base_evaluator import BaseEvaluator -from ..quantization_model_evaluator import create_dataset_attributes +from .base_custom_evaluator import BaseCustomEvaluator from ...adapters import create_adapter from ...config import ConfigError -from ...launcher import create_launcher from ...utils import extract_image_representations, contains_all, get_path -from ...progress_reporters import ProgressReporter from ...logging import print_info -class ColorizationEvaluator(BaseEvaluator): +class ColorizationEvaluator(BaseCustomEvaluator): def __init__(self, dataset_config, launcher, test_model, check_model, orig_config): - self.dataset_config = dataset_config - self.preprocessing_executor = None - self.preprocessor = None - self.dataset = None - self.postprocessor = None - self.metric_executor = None - self.launcher = launcher + super().__init__(dataset_config, launcher, orig_config) self.test_model = test_model self.check_model = check_model - self.config = orig_config - self._metrics_results = [] self._part_by_name = { 'colorization_network': self.test_model, 'verification_network': self.check_model } + if hasattr(self.check_model, 'adapter'): + self.adapter_type = self.check_model.adapter.__provider__ @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_settings = config['launchers'][0] - supported_frameworks = ['dlsdk'] - if not launcher_settings['framework'] in supported_frameworks: - raise ConfigError('{} framework not supported'.format(launcher_settings['framework'])) - if 'device' not in launcher_settings: - launcher_settings['device'] = 'CPU' - launcher = create_launcher(launcher_settings, delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) + network_info = config.get('network_info', {}) if not delayed_model_loading: colorization_network = network_info.get('colorization_network', {}) @@ -84,157 +69,29 @@ def from_configs(cls, config, delayed_model_loading=False, orig_config=None): ) return cls(dataset_config, launcher, test_model, check_model, orig_config) - def process_dataset( - self, subset=None, - num_images=None, - check_progress=False, - dataset_tag='', - output_callback=None, - allow_pairwise_subset=False, - dump_prediction_to_annotation=False, - calculate_metrics=True, - **kwargs): - - if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): - - self.select_dataset(dataset_tag) - - self._annotations, self._predictions = [], [] - - self._create_subset(subset, num_images, allow_pairwise_subset) - metric_config = self.configure_intermediate_metrics_results(kwargs) - (compute_intermediate_metric_res, metric_interval, ignore_results_formatting, - ignore_metric_reference) = metric_config - if 'progress_reporter' in kwargs: - _progress_reporter = kwargs['progress_reporter'] - _progress_reporter.reset(self.dataset.size) - else: - _progress_reporter = None if not check_progress else self._create_progress_reporter( - check_progress, self.dataset.size - ) + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): for batch_id, (batch_input_ids, batch_annotation, batch_inputs, batch_identifiers) in enumerate(self.dataset): batch_inputs = self.preprocessor.process(batch_inputs, batch_annotation) extr_batch_inputs, _ = extract_image_representations(batch_inputs) metrics_result = None batch_raw_prediction, batch_out = self.test_model.predict(batch_identifiers, extr_batch_inputs) if output_callback: - output_callback( - batch_raw_prediction, - metrics_result=metrics_result, - element_identifiers=batch_identifiers, - dataset_indices=batch_input_ids - ) + output_callback(batch_raw_prediction, metrics_result=metrics_result, + element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) batch_raw_prediction, batch_prediction = self.check_model.predict(batch_identifiers, batch_out) - if self.metric_executor: - metrics_result, _ = self.metric_executor.update_metrics_on_batch( - batch_input_ids, batch_annotation, batch_prediction - ) - if self.metric_executor.need_store_predictions: - self._annotations.extend(batch_annotation) - self._predictions.extend(batch_prediction) - + metrics_result = self._get_metrics_result(batch_input_ids, batch_annotation, batch_prediction, + calculate_metrics) if output_callback: - output_callback( - batch_raw_prediction, - metrics_result=metrics_result, - element_identifiers=batch_identifiers, - dataset_indices=batch_input_ids - ) - if _progress_reporter: - _progress_reporter.update(batch_id, len(batch_prediction)) - if compute_intermediate_metric_res and _progress_reporter.current % metric_interval == 0: - self.compute_metrics( - print_results=True, ignore_results_formatting=ignore_results_formatting, - ignore_metric_reference=ignore_metric_reference - ) - self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, metric_interval) - - if _progress_reporter: - _progress_reporter.finish() - - def compute_metrics(self, print_results=True, ignore_results_formatting=False, ignore_metric_reference=False): - if self._metrics_results: - del self._metrics_results - self._metrics_results = [] - - for result_presenter, evaluated_metric in self.metric_executor.iterate_metrics( - self._annotations, self._predictions - ): - self._metrics_results.append(evaluated_metric) - if print_results: - result_presenter.write_result(evaluated_metric, ignore_results_formatting, ignore_metric_reference) - - return self._metrics_results - - def print_metrics_results(self, ignore_results_formatting=False, ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(True, ignore_results_formatting, ignore_metric_reference) - return - result_presenters = self.metric_executor.get_metric_presenters() - for presenter, metric_result in zip(result_presenters, self._metrics_results): - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - @property - def dataset_size(self): - return self.dataset.size - - def release(self): - self.test_model.release() - self.check_model.release() - self.launcher.release() - - def reset(self): - if self.metric_executor: - self.metric_executor.reset() - if hasattr(self, '_annotations'): - del self._annotations - del self._predictions - del self._input_ids - del self._metrics_results - self._annotations = [] - self._predictions = [] - self._input_ids = [] - self._metrics_results = [] - if self.dataset: - self.dataset.reset(self.postprocessor.has_processors) - - @staticmethod - def get_processing_info(config): - module_specific_params = config.get('module_config') - model_name = config['name'] - dataset_config = module_specific_params['datasets'][0] - launcher_config = module_specific_params['launchers'][0] - return ( - model_name, launcher_config['framework'], launcher_config['device'], launcher_config.get('tags'), - dataset_config['name'] - ) - - def extract_metrics_results(self, print_results=True, ignore_results_formatting=False, - ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(False, ignore_results_formatting, ignore_metric_reference) - - result_presenters = self.metric_executor.get_metric_presenters() - extracted_results, extracted_meta = [], [] - for presenter, metric_result in zip(result_presenters, self._metrics_results): - result, metadata = presenter.extract_result(metric_result) - if isinstance(result, list): - extracted_results.extend(result) - extracted_meta.extend(metadata) - else: - extracted_results.append(result) - extracted_meta.append(metadata) - if print_results: - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - return extracted_results, extracted_meta + output_callback(batch_raw_prediction, metrics_result=metrics_result, + element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) + self._update_progress(progress_reporter, metric_config, batch_id, len(batch_prediction), csv_file) def load_model(self, network_list, launcher): for network_dict in network_list: self._part_by_name[network_dict['name']].load_network(network_dict, launcher) - def load_network(self, network_list, launcher): - for network_dict in network_list: + def load_network(self, network, launcher): + for network_dict in network: self._part_by_name[network_dict['name']].load_network(network_dict['model'], launcher) def get_network(self): @@ -243,78 +100,6 @@ def get_network(self): {'name': 'verification_network', 'model': self.check_model.network} ] - def get_metrics_attributes(self): - if not self.metric_executor: - return {} - return self.metric_executor.get_metrics_attributes() - - def register_metric(self, metric_config): - if isinstance(metric_config, str): - self.metric_executor.register_metric({'type': metric_config}) - elif isinstance(metric_config, dict): - self.metric_executor.register_metric(metric_config) - else: - raise ValueError('Unsupported metric configuration type {}'.format(type(metric_config))) - - def register_postprocessor(self, postprocessing_config): - pass - - def register_dumped_annotations(self): - pass - - def select_dataset(self, dataset_tag): - if self.dataset is not None and isinstance(self.dataset_config, list): - return - dataset_attributes = create_dataset_attributes(self.dataset_config, dataset_tag) - self.dataset, self.metric_executor, self.preprocessor, self.postprocessor = dataset_attributes - - @staticmethod - def _create_progress_reporter(check_progress, dataset_size): - pr_kwargs = {} - if isinstance(check_progress, int) and not isinstance(check_progress, bool): - pr_kwargs = {"print_interval": check_progress} - - return ProgressReporter.provide('print', dataset_size, **pr_kwargs) - - def set_profiling_dir(self, profiler_dir): - self.metric_executor.set_profiling_dir(profiler_dir) - - def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): - if self.dataset.batch is None: - self.dataset.batch = 1 - if subset is not None: - self.dataset.make_subset(ids=subset, accept_pairs=allow_pairwise) - elif num_images is not None: - self.dataset.make_subset(end=num_images, accept_pairs=allow_pairwise) - - @staticmethod - def configure_intermediate_metrics_results(config): - compute_intermediate_metric_res = config.get('intermediate_metrics_results', False) - metric_interval, ignore_results_formatting, ignore_metric_reference = None, None, None - if compute_intermediate_metric_res: - metric_interval = config.get('metrics_interval', 1000) - ignore_results_formatting = config.get('ignore_results_formatting', False) - ignore_metric_reference = config.get('ignore_metric_reference', False) - return compute_intermediate_metric_res, metric_interval, ignore_results_formatting, ignore_metric_reference - - def send_processing_info(self, sender): - if not sender: - return {} - model_type = None - details = {} - metrics = self.dataset_config[0].get('metrics', []) - metric_info = [metric['type'] for metric in metrics] - adapter_type = self.check_model.adapter.__provider__ - details.update({ - 'metrics': metric_info, - 'model_file_type': model_type, - 'adapter': adapter_type, - }) - if self.dataset is None: - self.select_dataset('') - - details.update(self.dataset.send_annotation_info(self.dataset_config[0])) - return details class BaseModel: def __init__(self, network_info, launcher, delayed_model_loading=False): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/custom_text_recognition_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/custom_text_recognition_evaluator.py index e32bd6947b3..2dd63bba50e 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/custom_text_recognition_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/custom_text_recognition_evaluator.py @@ -18,84 +18,41 @@ from functools import partial import numpy as np -from ..base_evaluator import BaseEvaluator -from ..quantization_model_evaluator import create_dataset_attributes +from .base_custom_evaluator import BaseCustomEvaluator from ...config import ConfigError from ...utils import contains_all, extract_image_representations -from ...launcher import create_launcher from ...logging import print_info -from ...progress_reporters import ProgressReporter from ...representation import CharacterRecognitionPrediction, CharacterRecognitionAnnotation -class TextRecognitionWithAttentionEvaluator(BaseEvaluator): +class TextRecognitionWithAttentionEvaluator(BaseCustomEvaluator): def __init__(self, dataset_config, launcher, model, lowercase, orig_config): - self.dataset_config = dataset_config - self.preprocessing_executor = None - self.preprocessor = None - self.dataset = None - self.postprocessor = None - self.metric_executor = None - self.launcher = launcher + super().__init__(dataset_config, launcher, orig_config) self.model = model self.lowercase = lowercase - self.config = orig_config - self._metrics_results = [] @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher = create_launcher(config['launchers'][0], delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) lowercase = config.get('lowercase', False) model_type = config.get('model_type', 'SequentialFormulaRecognitionModel') if model_type not in MODEL_TYPES.keys(): raise ValueError(f'Model type {model_type} is not supported') model = MODEL_TYPES[model_type]( - config.get('network_info', {}), - launcher, - config.get('_models', []), - {}, - config.get('_model_is_blob'), + config.get('network_info', {}), launcher, config.get('_models', []), {}, config.get('_model_is_blob'), delayed_model_loading=delayed_model_loading ) return cls(dataset_config, launcher, model, lowercase, orig_config) - def process_dataset( - self, subset=None, - num_images=None, - check_progress=False, - dataset_tag='', - output_callback=None, - allow_pairwise_subset=False, - dump_prediction_to_annotation=False, - calculate_metrics=True, - **kwargs - ): - self._prepare_dataset(dataset_tag) - self._create_subset(subset, num_images, allow_pairwise_subset) - self._annotations, self._predictions = [], [] - if 'progress_reporter' in kwargs: - _progress_reporter = kwargs['progress_reporter'] - _progress_reporter.reset(self.dataset.size) - else: - _progress_reporter = None if not check_progress else self._create_progress_reporter( - check_progress, self.dataset.size - ) - compute_intermediate_metric_res = kwargs.get('intermediate_metrics_results', False) - if compute_intermediate_metric_res: - metric_interval = kwargs.get('metrics_interval', 1000) - ignore_results_formatting = kwargs.get('ignore_results_formatting', False) - ignore_metric_reference = kwargs.get('ignore_metric_reference', False) + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): for batch_id, (batch_input_ids, batch_annotation, batch_inputs, batch_identifiers) in enumerate(self.dataset): batch_inputs = self.preprocessor.process(batch_inputs, batch_annotation) batch_data, batch_meta = extract_image_representations(batch_inputs) temporal_output_callback = None if output_callback: - temporal_output_callback = partial(output_callback, - metrics_result=None, + temporal_output_callback = partial(output_callback, metrics_result=None, element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) - batch_prediction, batch_raw_prediction = self.model.predict( batch_identifiers, batch_data, callback=temporal_output_callback ) @@ -108,181 +65,29 @@ def process_dataset( batch_annotation, batch_prediction = self.postprocessor.process_batch( batch_annotation, batch_prediction, batch_meta ) - metrics_result = None - if self.metric_executor and calculate_metrics: - metrics_result, _ = self.metric_executor.update_metrics_on_batch( - batch_input_ids, batch_annotation, batch_prediction - ) - if self.metric_executor.need_store_predictions: - self._annotations.extend(batch_annotation) - self._predictions.extend(batch_prediction) - + metrics_result = self._get_metrics_result(batch_input_ids, batch_annotation, batch_prediction, + calculate_metrics) if output_callback: - output_callback( - batch_raw_prediction, - metrics_result=metrics_result, - element_identifiers=batch_identifiers, - dataset_indices=batch_input_ids - ) - if _progress_reporter: - _progress_reporter.update(batch_id, len(batch_prediction)) - if compute_intermediate_metric_res and _progress_reporter.current % metric_interval == 0: - self.compute_metrics( - print_results=True, ignore_results_formatting=ignore_results_formatting, - ignore_metric_reference=ignore_metric_reference - ) - self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, metric_interval) - - if _progress_reporter: - _progress_reporter.finish() - - def compute_metrics(self, print_results=True, ignore_results_formatting=False, ignore_metric_reference=False): - if self._metrics_results: - del self._metrics_results - self._metrics_results = [] - - for result_presenter, evaluated_metric in self.metric_executor.iterate_metrics( - self._annotations, self._predictions): - self._metrics_results.append(evaluated_metric) - if print_results: - result_presenter.write_result(evaluated_metric, ignore_results_formatting, ignore_metric_reference) - - return self._metrics_results - - def extract_metrics_results(self, print_results=True, ignore_results_formatting=False, - ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(False, ignore_results_formatting, ignore_metric_reference) - - result_presenters = self.metric_executor.get_metric_presenters() - extracted_results, extracted_meta = [], [] - for presenter, metric_result in zip(result_presenters, self._metrics_results): - result, metadata = presenter.extract_result(metric_result) - if isinstance(result, list): - extracted_results.extend(result) - extracted_meta.extend(metadata) - else: - extracted_results.append(result) - extracted_meta.append(metadata) - if print_results: - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - return extracted_results, extracted_meta - - def print_metrics_results(self, ignore_results_formatting=False, ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(True, ignore_results_formatting, ignore_metric_reference) - return - result_presenters = self.metric_executor.get_metric_presenters() - for presenter, metric_result in zip(result_presenters, self._metrics_results): - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - def _prepare_dataset(self, dataset_tag=''): - if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): - self.select_dataset(dataset_tag) - - if self.dataset.batch is None: - self.dataset.batch = 1 - - def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): - if subset is not None: - self.dataset.make_subset(ids=subset, accept_pairs=allow_pairwise) - elif num_images is not None: - self.dataset.make_subset(end=num_images, accept_pairs=allow_pairwise) - - @property - def dataset_size(self): - return self.dataset.size - - def release(self): - self.model.release() - self.launcher.release() + output_callback(batch_raw_prediction, metrics_result=metrics_result, + element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) + self._update_progress(progress_reporter, metric_config, batch_id, len(batch_prediction), csv_file) def reset(self): - self.metric_executor.reset() + super().reset() self.model.reset() - @ staticmethod - def get_processing_info(config): - module_specific_params = config.get('module_config') - model_name = config['name'] - dataset_config = module_specific_params['datasets'][0] - launcher_config = module_specific_params['launchers'][0] - return ( - model_name, launcher_config['framework'], launcher_config['device'], - launcher_config.get('tags'), - dataset_config['name'] - ) - - def register_metric(self, metric_config): - if isinstance(metric_config, str): - self.metric_executor.register_metric({'type': metric_config}) - elif isinstance(metric_config, dict): - self.metric_executor.register_metric(metric_config) - else: - raise ValueError('Unsupported metric configuration type {}'.format(type(metric_config))) - - def register_postprocessor(self, postprocessing_config): - pass - - def register_dumped_annotations(self): - pass - def select_dataset(self, dataset_tag): - if self.dataset is not None and isinstance(self.dataset_config, list): - return - dataset_attributes = create_dataset_attributes(self.dataset_config, dataset_tag) - self.dataset, self.metric_executor, self.preprocessor, self.postprocessor = dataset_attributes + super().select_dataset(dataset_tag) if self.model.vocab is None: self.model.vocab = self.dataset.metadata.get('vocab') - def load_network(self, network=None): - self.model.load_network(network, self.launcher) - - def load_network_from_ir(self, models_dict): - self.model.load_model(models_dict, self.launcher) - - def get_network(self): - return self.model.get_network() - - def get_metrics_attributes(self): - if not self.metric_executor: - return {} - return self.metric_executor.get_metrics_attributes() - - @staticmethod - def _create_progress_reporter(check_progress, dataset_size): - pr_kwargs = {} - if isinstance(check_progress, int) and not isinstance(check_progress, bool): - pr_kwargs = {"print_interval": check_progress} - - return ProgressReporter.provide('print', dataset_size, **pr_kwargs) - - def send_processing_info(self, sender): - if not sender: - return {} - model_type = None - details = {} - metrics = self.dataset_config[0].get('metrics', []) - metric_info = [metric['type'] for metric in metrics] - details.update({ - 'metrics': metric_info, - 'model_file_type': model_type, - 'adapter': None, - }) - if self.dataset is None: - self.select_dataset('') - - details.update(self.dataset.send_annotation_info(self.dataset_config[0])) - return details - class BaseModel: def __init__(self, network_info, launcher, default_model_suffix): self.default_model_suffix = default_model_suffix self.network_info = network_info - def predict(self, identifiers, input_data): + def predict(self, inputs, identifiers=None): raise NotImplementedError def release(self): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/i3d_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/i3d_evaluator.py index c083e8d9457..90c6abfa57a 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/i3d_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/i3d_evaluator.py @@ -11,7 +11,7 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License. +limitations under the License." """ from pathlib import Path @@ -19,43 +19,32 @@ import warnings import numpy as np -from ..base_evaluator import BaseEvaluator -from ..quantization_model_evaluator import create_dataset_attributes +from .base_custom_evaluator import BaseCustomEvaluator from ...adapters import create_adapter from ...config import ConfigError -from ...launcher import create_launcher from ...data_readers import create_reader from ...utils import extract_image_representations, contains_all, get_path -from ...progress_reporters import ProgressReporter from ...logging import print_info from ...preprocessor import Crop, Resize -class I3DEvaluator(BaseEvaluator): +class I3DEvaluator(BaseCustomEvaluator): def __init__(self, dataset_config, launcher, adapter, rgb_model, flow_model, orig_config): - self.dataset_config = dataset_config - self.preprocessor = None - self.dataset = None - self.postprocessor = None - self.metric_executor = None - self.launcher = launcher + super().__init__(dataset_config, launcher, orig_config) self.adapter = adapter self.rgb_model = rgb_model self.flow_model = flow_model - self.config = orig_config - self._metrics_results = [] + self._part_by_name = { + 'flow_network': self.flow_model, + 'rgb_network': self.rgb_model + } + if self.adapter is not None: + self.adapter_type = self.adapter.__provider__ @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_settings = config['launchers'][0] - supported_frameworks = ['dlsdk'] - if not launcher_settings['framework'] in supported_frameworks: - raise ConfigError('{} framework not supported'.format(launcher_settings['framework'])) - if 'device' not in launcher_settings: - launcher_settings['device'] = 'CPU' - launcher = create_launcher(launcher_settings, delayed_model_loading=True) - adapter = create_adapter(launcher_settings['adapter']) + dataset_config, launcher, launcher_config = cls.get_dataset_and_launcher_info(config) + adapter = create_adapter(launcher_config['adapter']) network_info = config.get('network_info', {}) data_source = dataset_config[0].get('data_source', None) if not delayed_model_loading: @@ -113,34 +102,7 @@ def combine_predictions(output_rgb, output_flow): return output - def process_dataset( - self, subset=None, - num_images=None, - check_progress=False, - dataset_tag='', - allow_pairwise_subset=False, - **kwargs): - - if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): - self.select_dataset(dataset_tag) - self._create_subset(subset, num_images, allow_pairwise_subset) - - self._annotations, self._predictions = [], [] - - if 'progress_reporter' in kwargs: - _progress_reporter = kwargs['progress_reporter'] - _progress_reporter.reset(self.dataset.size) - else: - _progress_reporter = None if not check_progress else self._create_progress_reporter( - check_progress, self.dataset.size - ) - - compute_intermediate_metric_res = kwargs.get('intermediate_metrics_results', False) - if compute_intermediate_metric_res: - metric_interval = kwargs.get('metrics_interval', 1000) - ignore_results_formatting = kwargs.get('ignore_results_formatting', False) - ignore_metric_reference = kwargs.get('ignore_metric_reference', False) - + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): annotation, identifiers = self.get_dataset_info(self.dataset) for batch_id, (batch_annotation, batch_identifiers) in enumerate(zip(annotation, identifiers)): batch_inputs_images = self.rgb_model.prepare_data(batch_identifiers) @@ -163,134 +125,7 @@ def process_dataset( self.metric_executor.update_metrics_on_batch( [batch_id], [batch_annotation], batch_prediction ) - - if _progress_reporter: - _progress_reporter.update(batch_id, len(batch_prediction)) - if compute_intermediate_metric_res and _progress_reporter.current % metric_interval == 0: - self.compute_metrics( - print_results=True, ignore_results_formatting=ignore_results_formatting, - ignore_metric_reference=ignore_metric_reference - ) - self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, metric_interval) - - if _progress_reporter: - _progress_reporter.finish() - - def compute_metrics(self, print_results=True, ignore_results_formatting=False, ignore_metric_reference=False): - if self._metrics_results: - del self._metrics_results - self._metrics_results = [] - - for result_presenter, evaluated_metric in self.metric_executor.iterate_metrics( - self._annotations, self._predictions - ): - self._metrics_results.append(evaluated_metric) - if print_results: - result_presenter.write_result(evaluated_metric, ignore_results_formatting, ignore_metric_reference) - - return self._metrics_results - - def print_metrics_results(self, ignore_results_formatting=False, ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(True, ignore_results_formatting, ignore_metric_reference) - return - result_presenters = self.metric_executor.get_metric_presenters() - for presenter, metric_result in zip(result_presenters, self._metrics_results): - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - def extract_metrics_results(self, print_results=True, ignore_results_formatting=False, - ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(False, ignore_results_formatting, ignore_metric_reference) - - result_presenters = self.metric_executor.get_metric_presenters() - extracted_results, extracted_meta = [], [] - for presenter, metric_result in zip(result_presenters, self._metrics_results): - result, metadata = presenter.extract_result(metric_result) - if isinstance(result, list): - extracted_results.extend(result) - extracted_meta.extend(metadata) - else: - extracted_results.append(result) - extracted_meta.append(metadata) - if print_results: - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - return extracted_results, extracted_meta - - @property - def dataset_size(self): - return self.dataset.size - - def release(self): - self.rgb_model.release() - self.flow_model.release() - self.launcher.release() - - def reset(self): - if self.metric_executor: - self.metric_executor.reset() - if hasattr(self, '_annotations'): - del self._annotations - del self._predictions - del self._metrics_results - self._annotations = [] - self._predictions = [] - self._metrics_results = [] - if self.dataset: - self.dataset.reset(self.postprocessor.has_processors) - - @staticmethod - def get_processing_info(config): - module_specific_params = config.get('module_config') - model_name = config['name'] - dataset_config = module_specific_params['datasets'][0] - launcher_config = module_specific_params['launchers'][0] - return ( - model_name, launcher_config['framework'], launcher_config['device'], launcher_config.get('tags'), - dataset_config['name'] - ) - - def select_dataset(self, dataset_tag): - if self.dataset is not None and isinstance(self.dataset_config, list): - return - dataset_attributes = create_dataset_attributes(self.dataset_config, dataset_tag) - self.dataset, self.metric_executor, self.preprocessor, self.postprocessor = dataset_attributes - - @staticmethod - def _create_progress_reporter(check_progress, dataset_size): - pr_kwargs = {} - if isinstance(check_progress, int) and not isinstance(check_progress, bool): - pr_kwargs = {"print_interval": check_progress} - - return ProgressReporter.provide('print', dataset_size, **pr_kwargs) - - def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): - if self.dataset.batch is None: - self.dataset.batch = 1 - if subset is not None: - self.dataset.make_subset(ids=subset, accept_pairs=allow_pairwise) - elif num_images is not None: - self.dataset.make_subset(end=num_images, accept_pairs=allow_pairwise) - - def send_processing_info(self, sender): - if not sender: - return {} - model_type = None - details = {} - metrics = self.dataset_config[0].get('metrics', []) - metric_info = [metric['type'] for metric in metrics] - adapter_type = self.adapter.__provider__ - details.update({ - 'metrics': metric_info, - 'model_file_type': model_type, - 'adapter': adapter_type, - }) - if self.dataset is None: - self.select_dataset('') - - details.update(self.dataset.send_annotation_info(self.dataset_config[0])) - return details + self._update_progress(progress_reporter, metric_config, batch_id, len(batch_prediction), csv_file) class BaseModel: @@ -365,7 +200,7 @@ def load_model(self, network_info, launcher, log=False): if weights: self.network = launcher.read_network(str(model), str(weights)) self.network.batch_size = 1 - self.exec_network = self.load_network(self.network, launcher) + self.load_network(self.network, launcher) else: self.network = None launcher.ie_core.import_network(str(model)) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/lpcnet_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/lpcnet_evaluator.py index 82c47fd5e2b..b3adb8e3349 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/lpcnet_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/lpcnet_evaluator.py @@ -19,7 +19,6 @@ from .text_to_speech_evaluator import TextToSpeechEvaluator, TTSDLSDKModel from ...adapters import create_adapter from ...config import ConfigError -from ...launcher import create_launcher from ...utils import contains_all from ...logging import print_info @@ -121,6 +120,7 @@ def update_inputs_outputs_info(self): class EncoderModel: def __init__(self, network_info, launcher, suffix, nb_features, nb_used_features, delayed_model_loading=False): + self.is_dynamic = False self.network_info = network_info self.nb_features = nb_features self.nb_used_features = nb_used_features @@ -215,6 +215,7 @@ class EncoderONNXModel(BaseONNXModel, EncoderModel): class DecoderModel: def __init__(self, network_info, launcher, suffix, frame_size, nb_features, delayed_model_loading=False): + self.is_dynamic = False self.network_info = network_info self.default_model_suffix = suffix self.frame_size = frame_size @@ -339,12 +340,7 @@ def create_decoder(model_config, launcher, delayed_model_loading=False): class LPCNetEvaluator(TextToSpeechEvaluator): @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_config = config['launchers'][0] - if launcher_config['framework'] == 'dlsdk' and 'device' not in launcher_config: - launcher_config['device'] = 'CPU' - - launcher = create_launcher(launcher_config, delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) model = SequentialModel( config.get('network_info', {}), launcher, config.get('_models', []), config.get('_model_is_blob'), delayed_model_loading diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/mtcnn_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/mtcnn_evaluator.py index 80aaf453802..ae7a517a58b 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/mtcnn_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/mtcnn_evaluator.py @@ -22,14 +22,13 @@ import numpy as np from .mtcnn_evaluator_utils import calibrate_predictions, nms, cut_roi -from ..base_evaluator import BaseEvaluator +from .base_custom_evaluator import BaseCustomEvaluator from ..quantization_model_evaluator import create_dataset_attributes from ...adapters import create_adapter -from ...launcher import create_launcher, InputFeeder +from ...launcher import InputFeeder from ...preprocessor import PreprocessingExecutor from ...utils import extract_image_representations, read_pickle, contains_any, get_path from ...config import ConfigError -from ...progress_reporters import ProgressReporter from ...logging import print_info @@ -578,7 +577,7 @@ def load_network(self, network, launcher, model_prefix): def load_model(self, network_info, launcher, model_prefix=None, log=False): self.network = launcher.read_network(str(network_info['model']), str(network_info['weights'])) - self.exec_network = self.load_network(self.network, launcher, model_prefix) + self.load_network(self.network, launcher, model_prefix) self.launcher = launcher if log: self.print_input_output_info() @@ -664,37 +663,24 @@ def transform_for_callback(batch_size, raw_outputs): return output_per_box -class MTCNNEvaluator(BaseEvaluator): +class MTCNNEvaluator(BaseCustomEvaluator): def __init__(self, dataset_config, launcher, stages, orig_config): - self.dataset_config = dataset_config + super().__init__(dataset_config, launcher, orig_config) self.stages = stages - self.launcher = launcher - self.dataset = None - self.postprocessor = None - self.metric_executor = None - self._annotations, self._predictions, self._metrics_results = [], [], [] - self.config = orig_config - - def process_dataset( - self, subset=None, - num_images=None, - check_progress=False, - dataset_tag='', - output_callback=None, - allow_pairwise_subset=False, - dump_prediction_to_annotation=False, - calculate_metrics=True, - **kwargs): + stage = next(iter(self.stages.values())) + if hasattr(stage, 'adapter') and stage.adapter is not None: + self.adapter_type = stage.adapter.__provider__ + + @classmethod + def from_configs(cls, config, delayed_model_loading=False, orig_config=None): + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) + models_info = config['network_info'] + stages = build_stages(models_info, [], launcher, config.get('_models'), delayed_model_loading) + return cls(dataset_config, launcher, stages, orig_config) + + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): def no_detections(batch_pred): return batch_pred[0].size == 0 - self._prepare_dataset(dataset_tag) - self._create_subset(subset, num_images, allow_pairwise_subset) - _progress_reporter = self._prepare_progress_reporter(check_progress, kwargs.get('progress_reporter')) - compute_intermediate_metric_res = kwargs.get('intermediate_metrics_results', False) - if compute_intermediate_metric_res: - metric_interval = kwargs.get('metrics_interval', 1000) - ignore_results_formatting = kwargs.get('ignore_results_formatting', False) - ignore_metric_reference = kwargs.get('ignore_metric_reference', False) for batch_id, (batch_input_ids, batch_annotation, batch_inputs, batch_identifiers) in enumerate(self.dataset): batch_prediction = [] @@ -717,109 +703,20 @@ def no_detections(batch_pred): if no_detections(batch_prediction): break batch_annotation, batch_prediction = self.postprocessor.process_batch(batch_annotation, batch_prediction) - metrics_result = None - if self.metric_executor: - metrics_result, _ = self.metric_executor.update_metrics_on_batch( - batch_input_ids, batch_annotation, batch_prediction - ) - if self.metric_executor.need_store_predictions: - self._annotations.extend(batch_annotation) - self._predictions.extend(batch_prediction) + metrics_result = self._get_metrics_result(batch_input_ids, batch_annotation, batch_prediction, + calculate_metrics) if output_callback: - output_callback( - list(self.stages.values())[-1].transform_for_callback(batch_size, batch_raw_prediction), - metrics_result=metrics_result, element_identifiers=batch_identifiers, - dataset_indices=batch_input_ids - ) - if _progress_reporter: - _progress_reporter.update(batch_id, len(batch_prediction)) - if compute_intermediate_metric_res and _progress_reporter.current % metric_interval == 0: - self.compute_metrics(print_results=True, ignore_results_formatting=ignore_results_formatting, - ignore_metric_reference=ignore_metric_reference) - self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, metric_interval) - if _progress_reporter: - _progress_reporter.finish() - - def compute_metrics(self, print_results=True, ignore_results_formatting=False, ignore_metric_reference=False): - if self._metrics_results: - del self._metrics_results - self._metrics_results = [] - for result_presenter, evaluated_metric in self.metric_executor.iterate_metrics( - self._annotations, self._predictions): - self._metrics_results.append(evaluated_metric) - if print_results: - result_presenter.write_result(evaluated_metric, ignore_results_formatting, ignore_metric_reference) - return self._metrics_results - - def extract_metrics_results(self, print_results=True, ignore_results_formatting=False, - ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(False, ignore_results_formatting, ignore_metric_reference) - result_presenters = self.metric_executor.get_metric_presenters() - extracted_results, extracted_meta = [], [] - for presenter, metric_result in zip(result_presenters, self._metrics_results): - result, metadata = presenter.extract_result(metric_result) - if isinstance(result, list): - extracted_results.extend(result) - extracted_meta.extend(metadata) - else: - extracted_results.append(result) - extracted_meta.append(metadata) - if print_results: - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - return extracted_results, extracted_meta - - def print_metrics_results(self, ignore_results_formatting=False, ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(True, ignore_results_formatting, ignore_metric_reference) - return - result_presenters = self.metrics_executor.get_metric_presenters() - for presenter, metric_result in zip(result_presenters, self._metrics_results): - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - @classmethod - def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_config = config['launchers'][0] - if launcher_config['framework'] == 'dlsdk' and 'device' not in launcher_config: - launcher_config['device'] = 'CPU' - models_info = config['network_info'] - launcher = create_launcher(launcher_config, delayed_model_loading=True) - stages = build_stages(models_info, [], launcher, config.get('_models'), delayed_model_loading) - return cls(dataset_config, launcher, stages, orig_config) + output_callback(list(self.stages.values())[-1].transform_for_callback(batch_size, batch_raw_prediction), + metrics_result=metrics_result, element_identifiers=batch_identifiers, + dataset_indices=batch_input_ids) + self._update_progress(progress_reporter, metric_config, batch_id, len(batch_prediction), csv_file) - @staticmethod - def get_processing_info(config): - module_specific_params = config.get('module_config') - model_name = config['name'] - dataset_config = module_specific_params['datasets'][0] - launcher_config = module_specific_params['launchers'][0] - return ( - model_name, launcher_config['framework'], launcher_config['device'], launcher_config.get('tags'), - dataset_config['name'] - ) - - def set_profiling_dir(self, profiler_dir): - self.metric_executor.set_profiling_dir(profiler_dir) - - def release(self): + def _release_model(self): for _, stage in self.stages.items(): stage.release() - self.launcher.release() def reset(self): - if self.metric_executor: - self.metric_executor.reset() - if hasattr(self, '_annotations'): - del self._annotations - del self._predictions - del self._metrics_results - self._annotations = [] - self._predictions = [] - self._input_ids = [] - self._metrics_results = [] - if self.dataset: - self.dataset.reset(self.postprocessor.has_processors) + super().reset() for _, stage in self.stages.items(): stage.reset() @@ -841,25 +738,6 @@ def load_network_from_ir(self, models_list): def get_network(self): return [{'name': stage_name, 'model': stage.network} for stage_name, stage in self.stages.items()] - def get_metrics_attributes(self): - if not self.metric_executor: - return {} - return self.metric_executor.get_metrics_attributes() - - def register_metric(self, metric_config): - if isinstance(metric_config, str): - self.metric_executor.register_metric({'type': metric_config}) - elif isinstance(metric_config, dict): - self.metric_executor.register_metric(metric_config) - else: - raise ValueError('Unsupported metric configuration type {}'.format(type(metric_config))) - - def register_postprocessor(self, postprocessing_config): - pass - - def register_dumped_annotations(self): - pass - def select_dataset(self, dataset_tag): if self.dataset is not None and isinstance(self.dataset_config, list): return @@ -867,50 +745,3 @@ def select_dataset(self, dataset_tag): self.dataset, self.metric_executor, preprocessor, self.postprocessor = dataset_attributes for _, stage in self.stages.items(): stage.update_preprocessing(preprocessor) - - @staticmethod - def _create_progress_reporter(check_progress, dataset_size): - pr_kwargs = {} - if isinstance(check_progress, int) and not isinstance(check_progress, bool): - pr_kwargs = {"print_interval": check_progress} - return ProgressReporter.provide('print', dataset_size, **pr_kwargs) - - def _prepare_dataset(self, dataset_tag=''): - if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): - self.select_dataset(dataset_tag) - if self.dataset.batch is None: - self.dataset.batch = 1 - - def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): - if subset is not None: - self.dataset.make_subset(ids=subset, accept_pairs=allow_pairwise) - elif num_images is not None: - self.dataset.make_subset(end=num_images, accept_pairs=allow_pairwise) - - def _prepare_progress_reporter(self, check_progress, progress_reporter=None): - if progress_reporter: - progress_reporter.reset(self.dataset.size) - return progress_reporter - return None if not check_progress else self._create_progress_reporter(check_progress, self.dataset.size) - - @property - def dataset_size(self): - return self.dataset.size - - def send_processing_info(self, sender): - if not sender: - return {} - model_type = None - details = {} - metrics = self.dataset_config[0].get('metrics', []) - metric_info = [metric['type'] for metric in metrics] - adapter_type = next(iter(self.stages.values())).adapter.__provider__ - details.update({ - 'metrics': metric_info, - 'model_file_type': model_type, - 'adapter': adapter_type, - }) - if self.dataset is None: - self.select_dataset('') - details.update(self.dataset.send_annotation_info(self.dataset_config[0])) - return details diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/segnet_background_matting.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/segnet_background_matting.py index 68445b14c58..261648241db 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/segnet_background_matting.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/segnet_background_matting.py @@ -19,7 +19,6 @@ import numpy as np from .sr_evaluator import SuperResolutionFeedbackEvaluator from ...adapters import create_adapter -from ...launcher import create_launcher from ...logging import print_info from ...utils import contains_any, contains_all, generate_layer_name, get_path, extract_image_representations from ...config import ConfigError @@ -273,86 +272,31 @@ def reshape_net(self, shape): class VideoBackgroundMatting(SuperResolutionFeedbackEvaluator): @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_config = config['launchers'][0] - if launcher_config['framework'] == 'dlsdk' and 'device' not in launcher_config: - launcher_config['device'] = 'CPU' - - launcher = create_launcher(launcher_config, delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) model = SegnetModel( config.get('network_info', {}), launcher, config.get('_models', []), config.get('_model_is_blob'), delayed_model_loading ) return cls(dataset_config, launcher, model, orig_config) - def process_dataset( - self, subset=None, - num_images=None, - check_progress=False, - dataset_tag='', - output_callback=None, - allow_pairwise_subset=False, - dump_prediction_to_annotation=False, - calculate_metrics=True, - **kwargs): - if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): - self.select_dataset(dataset_tag) - - self._annotations, self._predictions = [], [] - - self._create_subset(subset, num_images, allow_pairwise_subset) - metric_config = self.configure_intermediate_metrics_results(kwargs) - (compute_intermediate_metric_res, metric_interval, ignore_results_formatting, - ignore_metric_reference) = metric_config - - if 'progress_reporter' in kwargs: - _progress_reporter = kwargs['progress_reporter'] - _progress_reporter.reset(self.dataset.size) - else: - _progress_reporter = None if not check_progress else self._create_progress_reporter( - check_progress, self.dataset.size - ) + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): previous_video_id = '' for batch_id, (batch_input_ids, batch_annotation, batch_inputs, batch_identifiers) in enumerate(self.dataset): if previous_video_id != batch_identifiers[0].video_id: self.model.reset() batch_inputs = self.preprocessor.process(batch_inputs, batch_annotation) batch_inputs_extr, _ = extract_image_representations(batch_inputs) - batch_raw_prediction, batch_prediction = self.model.predict( batch_identifiers, batch_inputs_extr ) self.model.set_feedback(batch_prediction[0].value) previous_video_id = batch_prediction[0].identifier.video_id annotation, prediction = self.postprocessor.process_batch(batch_annotation, batch_prediction) - - metrics_result = None - if self.metric_executor and calculate_metrics: - metrics_result, _ = self.metric_executor.update_metrics_on_batch( - batch_input_ids, annotation, prediction - ) - if self.metric_executor.need_store_predictions: - self._annotations.extend(annotation) - self._predictions.extend(prediction) - + metrics_result = self._get_metrics_result(batch_input_ids, annotation, prediction, calculate_metrics) if output_callback: - output_callback( - batch_raw_prediction[0], - metrics_result=metrics_result, - element_identifiers=batch_identifiers, - dataset_indices=batch_input_ids - ) - if _progress_reporter: - _progress_reporter.update(batch_id, len(prediction)) - if compute_intermediate_metric_res and _progress_reporter.current % metric_interval == 0: - self.compute_metrics( - print_results=True, ignore_results_formatting=ignore_results_formatting, - ignore_metric_reference=ignore_metric_reference - ) - self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, metric_interval) - - if _progress_reporter: - _progress_reporter.finish() + output_callback(batch_raw_prediction[0], metrics_result=metrics_result, + element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) + self._update_progress(progress_reporter, metric_config, batch_id, len(prediction), csv_file) class SegnetModel: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/sequential_action_recognition_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/sequential_action_recognition_evaluator.py index 2c17a56b9c9..8fb46ad4521 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/sequential_action_recognition_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/sequential_action_recognition_evaluator.py @@ -20,271 +20,50 @@ from collections import OrderedDict import numpy as np -from ..base_evaluator import BaseEvaluator -from ..quantization_model_evaluator import create_dataset_attributes +from .base_custom_evaluator import BaseCustomEvaluator from ...adapters import create_adapter from ...config import ConfigError -from ...launcher import create_launcher from ...utils import contains_all, contains_any, extract_image_representations, read_pickle, get_path -from ...progress_reporters import ProgressReporter from ...logging import print_info -class SequentialActionRecognitionEvaluator(BaseEvaluator): +class SequentialActionRecognitionEvaluator(BaseCustomEvaluator): def __init__(self, dataset_config, launcher, model, orig_config): - self.dataset_config = dataset_config - self.preprocessing_executor = None - self.preprocessor = None - self.dataset = None - self.postprocessor = None - self.metric_executor = None - self.launcher = launcher + super().__init__(dataset_config, launcher, orig_config) self.model = model - self.config = orig_config - self._metrics_results = [] + if hasattr(self.model.decoder, 'adapter'): + self.adapter_type = self.model.decoder.adapter.__provider__ @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_config = config['launchers'][0] - if launcher_config['framework'] == 'dlsdk' and 'device' not in launcher_config: - launcher_config['device'] = 'CPU' - - launcher = create_launcher(launcher_config, delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) model = SequentialModel( config.get('network_info', {}), launcher, config.get('_models', []), config.get('_model_is_blob'), delayed_model_loading ) return cls(dataset_config, launcher, model, orig_config) - def process_dataset( - self, subset=None, - num_images=None, - check_progress=False, - dataset_tag='', - output_callback=None, - allow_pairwise_subset=False, - dump_prediction_to_annotation=False, - calculate_metrics=True, - **kwargs): - if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): - self.select_dataset(dataset_tag) - - self._annotations, self._predictions = [], [] - - self._create_subset(subset, num_images, allow_pairwise_subset) - - if 'progress_reporter' in kwargs: - _progress_reporter = kwargs['progress_reporter'] - _progress_reporter.reset(self.dataset.size) - else: - _progress_reporter = None if not check_progress else self._create_progress_reporter( - check_progress, self.dataset.size - ) - metric_config = self.configure_intermediate_metrics_results(kwargs) - (compute_intermediate_metric_res, metric_interval, ignore_results_formatting, - ignore_metric_reference) = metric_config + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): for batch_id, (batch_input_ids, batch_annotation, batch_inputs, batch_identifiers) in enumerate(self.dataset): batch_inputs = self.preprocessor.process(batch_inputs, batch_annotation) batch_inputs_extr, _ = extract_image_representations(batch_inputs) encoder_callback = None if output_callback: - encoder_callback = partial(output_callback, - metrics_result=None, - element_identifiers=batch_identifiers, + encoder_callback = partial(output_callback, metrics_result=None, element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) - batch_raw_prediction, batch_prediction = self.model.predict( batch_identifiers, batch_inputs_extr, encoder_callback=encoder_callback ) - metrics_result = None - if self.metric_executor and calculate_metrics: - metrics_result, _ = self.metric_executor.update_metrics_on_batch( - batch_input_ids, batch_annotation, batch_prediction - ) - if self.metric_executor.need_store_predictions: - self._annotations.extend(batch_annotation) - self._predictions.extend(batch_prediction) - + metrics_result = self._get_metrics_result(batch_input_ids, batch_annotation, batch_prediction, + calculate_metrics) if output_callback: - output_callback( - batch_raw_prediction[0], - metrics_result=metrics_result, - element_identifiers=batch_identifiers, - dataset_indices=batch_input_ids - ) - if _progress_reporter: - _progress_reporter.update(batch_id, len(batch_prediction)) - if compute_intermediate_metric_res and _progress_reporter.current % metric_interval == 0: - self.compute_metrics( - print_results=True, ignore_results_formatting=ignore_results_formatting, - ignore_metric_reference=ignore_metric_reference - ) - self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, metric_interval) - - if _progress_reporter: - _progress_reporter.finish() + output_callback(batch_raw_prediction[0], metrics_result=metrics_result, + element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) + self._update_progress(progress_reporter, metric_config, batch_id, len(batch_prediction), csv_file) if self.model.store_encoder_predictions: self.model.save_encoder_predictions() - def compute_metrics(self, print_results=True, ignore_results_formatting=False, ignore_metric_reference=False): - if self._metrics_results: - del self._metrics_results - self._metrics_results = [] - - for result_presenter, evaluated_metric in self.metric_executor.iterate_metrics( - self._annotations, self._predictions): - self._metrics_results.append(evaluated_metric) - if print_results: - result_presenter.write_result(evaluated_metric, ignore_results_formatting, ignore_metric_reference) - - return self._metrics_results - - def extract_metrics_results(self, print_results=True, ignore_results_formatting=False, - ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(False, ignore_results_formatting, ignore_metric_reference) - - result_presenters = self.metric_executor.get_metric_presenters() - extracted_results, extracted_meta = [], [] - for presenter, metric_result in zip(result_presenters, self._metrics_results): - result, metadata = presenter.extract_result(metric_result) - if isinstance(result, list): - extracted_results.extend(result) - extracted_meta.extend(metadata) - else: - extracted_results.append(result) - extracted_meta.append(metadata) - if print_results: - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - return extracted_results, extracted_meta - - def print_metrics_results(self, ignore_results_formatting=False, ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(True, ignore_results_formatting, ignore_metric_reference) - return - result_presenters = self.metric_executor.get_metric_presenters() - for presenter, metric_result in zip(result_presenters, self._metrics_results): - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - def set_profiling_dir(self, profiler_dir): - self.metric_executor.set_profiling_dir(profiler_dir) - - def release(self): - self.model.release() - self.launcher.release() - - def reset(self): - if self.metric_executor: - self.metric_executor.reset() - if hasattr(self, '_annotations'): - del self._annotations - del self._predictions - del self._input_ids - del self._metrics_results - self._annotations = [] - self._predictions = [] - self._input_ids = [] - self._metrics_results = [] - if self.dataset: - self.dataset.reset(self.postprocessor.has_processors) - - @staticmethod - def get_processing_info(config): - module_specific_params = config.get('module_config') - model_name = config['name'] - dataset_config = module_specific_params['datasets'][0] - launcher_config = module_specific_params['launchers'][0] - return ( - model_name, launcher_config['framework'], launcher_config['device'], launcher_config.get('tags'), - dataset_config['name'] - ) - - def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): - if self.dataset.batch is None: - self.dataset.batch = 1 - if subset is not None: - self.dataset.make_subset(ids=subset, accept_pairs=allow_pairwise) - elif num_images is not None: - self.dataset.make_subset(end=num_images, accept_pairs=allow_pairwise) - - def load_network(self, network=None): - self.model.load_network(network, self.launcher) - - def load_network_from_ir(self, models_list): - self.model.load_model(models_list, self.launcher) - - def get_network(self): - return self.model.get_network() - - def get_metrics_attributes(self): - if not self.metric_executor: - return {} - return self.metric_executor.get_metrics_attributes() - - def register_metric(self, metric_config): - if isinstance(metric_config, str): - self.metric_executor.register_metric({'type': metric_config}) - elif isinstance(metric_config, dict): - self.metric_executor.register_metric(metric_config) - else: - raise ValueError('Unsupported metric configuration type {}'.format(type(metric_config))) - - def register_postprocessor(self, postprocessing_config): - pass - - def register_dumped_annotations(self): - pass - - def select_dataset(self, dataset_tag): - if self.dataset is not None and isinstance(self.dataset_config, list): - return - dataset_attributes = create_dataset_attributes(self.dataset_config, dataset_tag) - self.dataset, self.metric_executor, self.preprocessor, self.postprocessor = dataset_attributes - - @staticmethod - def _create_progress_reporter(check_progress, dataset_size): - pr_kwargs = {} - if isinstance(check_progress, int) and not isinstance(check_progress, bool): - pr_kwargs = {"print_interval": check_progress} - - return ProgressReporter.provide('print', dataset_size, **pr_kwargs) - - @staticmethod - def configure_intermediate_metrics_results(config): - compute_intermediate_metric_res = config.get('intermediate_metrics_results', False) - metric_interval, ignore_results_formatting, ignore_metric_reference = None, None, None - if compute_intermediate_metric_res: - metric_interval = config.get('metrics_interval', 1000) - ignore_results_formatting = config.get('ignore_results_formatting', False) - ignore_metric_reference = config.get('ignore_metric_reference', False) - return compute_intermediate_metric_res, metric_interval, ignore_results_formatting, ignore_metric_reference - - @property - def dataset_size(self): - return self.dataset.size - - def send_processing_info(self, sender): - if not sender: - return {} - model_type = None - details = {} - metrics = self.dataset_config[0].get('metrics', []) - metric_info = [metric['type'] for metric in metrics] - adapter_type = self.model.decoder.adapter.__provider__ - details.update({ - 'metrics': metric_info, - 'model_file_type': model_type, - 'adapter': adapter_type, - }) - if self.dataset is None: - self.select_dataset('') - - details.update(self.dataset.send_annotation_info(self.dataset_config[0])) - return details - class BaseModel: def __init__(self, network_info, launcher, delayed_model_loading=False): @@ -641,7 +420,7 @@ def load_model(self, network_info, launcher, log=False): model, weights = self.automatic_model_search(network_info) if weights is not None: self.network = launcher.read_network(str(model), str(weights)) - self.exec_network = self.load_network(self.network, launcher) + self.load_network(self.network, launcher) else: self.network = None self.exec_network = launcher.ie_core.import_network(str(model)) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/sr_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/sr_evaluator.py index 07b24c30c6d..546a789af69 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/sr_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/sr_evaluator.py @@ -18,13 +18,10 @@ from collections import OrderedDict import numpy as np -from ..base_evaluator import BaseEvaluator -from ..quantization_model_evaluator import create_dataset_attributes +from .base_custom_evaluator import BaseCustomEvaluator from ...adapters import create_adapter from ...config import ConfigError -from ...launcher import create_launcher from ...utils import contains_all, contains_any, extract_image_representations, get_path -from ...progress_reporters import ProgressReporter from ...logging import print_info @@ -32,253 +29,38 @@ def generate_name(prefix, with_prefix, layer_name): return prefix + layer_name if with_prefix else layer_name.split(prefix)[-1] -class SuperResolutionFeedbackEvaluator(BaseEvaluator): +class SuperResolutionFeedbackEvaluator(BaseCustomEvaluator): def __init__(self, dataset_config, launcher, model, orig_config): - self.dataset_config = dataset_config - self.preprocessing_executor = None - self.preprocessor = None - self.dataset = None - self.postprocessor = None - self.metric_executor = None - self.launcher = launcher + super().__init__(dataset_config, launcher, orig_config) self.model = model - self.config = orig_config - self._metrics_results = [] + if hasattr(self.model, 'adapter'): + self.adapter_type = self.model.adapter.__provider__ @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_config = config['launchers'][0] - if launcher_config['framework'] == 'dlsdk' and 'device' not in launcher_config: - launcher_config['device'] = 'CPU' - - launcher = create_launcher(launcher_config, delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) model = SRFModel( config.get('network_info', {}), launcher, config.get('_models', []), config.get('_model_is_blob'), delayed_model_loading ) return cls(dataset_config, launcher, model, orig_config) - def process_dataset( - self, subset=None, - num_images=None, - check_progress=False, - dataset_tag='', - output_callback=None, - allow_pairwise_subset=False, - dump_prediction_to_annotation=False, - calculate_metrics=True, - **kwargs): - if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): - self.select_dataset(dataset_tag) - - self._annotations, self._predictions = [], [] - - self._create_subset(subset, num_images, allow_pairwise_subset) - metric_config = self.configure_intermediate_metrics_results(kwargs) - (compute_intermediate_metric_res, metric_interval, ignore_results_formatting, - ignore_metric_reference) = metric_config - - if 'progress_reporter' in kwargs: - _progress_reporter = kwargs['progress_reporter'] - _progress_reporter.reset(self.dataset.size) - else: - _progress_reporter = None if not check_progress else self._create_progress_reporter( - check_progress, self.dataset.size - ) + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): self.model.init_feedback(self.dataset.data_reader) for batch_id, (batch_input_ids, batch_annotation, batch_inputs, batch_identifiers) in enumerate(self.dataset): self.model.fill_feedback(batch_inputs) batch_inputs = self.preprocessor.process(batch_inputs, batch_annotation) batch_inputs_extr, _ = extract_image_representations(batch_inputs) - batch_raw_prediction, batch_prediction = self.model.predict( batch_identifiers, batch_inputs_extr ) annotation, prediction = self.postprocessor.process_batch(batch_annotation, batch_prediction) self.model.feedback(prediction) - - metrics_result = None - if self.metric_executor and calculate_metrics: - metrics_result, _ = self.metric_executor.update_metrics_on_batch( - batch_input_ids, annotation, prediction - ) - if self.metric_executor.need_store_predictions: - self._annotations.extend(annotation) - self._predictions.extend(prediction) - + metrics_result = self._get_metrics_result(batch_input_ids, annotation, prediction, calculate_metrics) if output_callback: - output_callback( - batch_raw_prediction[0], - metrics_result=metrics_result, - element_identifiers=batch_identifiers, - dataset_indices=batch_input_ids - ) - if _progress_reporter: - _progress_reporter.update(batch_id, len(prediction)) - if compute_intermediate_metric_res and _progress_reporter.current % metric_interval == 0: - self.compute_metrics( - print_results=True, ignore_results_formatting=ignore_results_formatting, - ignore_metric_reference=ignore_metric_reference - ) - self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, metric_interval) - - if _progress_reporter: - _progress_reporter.finish() - - def compute_metrics(self, print_results=True, ignore_results_formatting=False, ignore_metric_reference=False): - if self._metrics_results: - del self._metrics_results - self._metrics_results = [] - - for result_presenter, evaluated_metric in self.metric_executor.iterate_metrics( - self._annotations, self._predictions): - self._metrics_results.append(evaluated_metric) - if print_results: - result_presenter.write_result(evaluated_metric, ignore_results_formatting, ignore_metric_reference) - - return self._metrics_results - - def extract_metrics_results(self, print_results=True, ignore_results_formatting=False, - ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(False, ignore_results_formatting, ignore_metric_reference) - - result_presenters = self.metric_executor.get_metric_presenters() - extracted_results, extracted_meta = [], [] - for presenter, metric_result in zip(result_presenters, self._metrics_results): - result, metadata = presenter.extract_result(metric_result) - if isinstance(result, list): - extracted_results.extend(result) - extracted_meta.extend(metadata) - else: - extracted_results.append(result) - extracted_meta.append(metadata) - if print_results: - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - return extracted_results, extracted_meta - - def print_metrics_results(self, ignore_results_formatting=False, ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(True, ignore_results_formatting, ignore_metric_reference) - return - result_presenters = self.metric_executor.get_metric_presenters() - for presenter, metric_result in zip(result_presenters, self._metrics_results): - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - @property - def dataset_size(self): - return self.dataset.size - - def release(self): - self.model.release() - self.launcher.release() - - def reset(self): - if self.metric_executor: - self.metric_executor.reset() - if hasattr(self, '_annotations'): - del self._annotations - del self._predictions - del self._input_ids - del self._metrics_results - self._annotations = [] - self._predictions = [] - self._input_ids = [] - self._metrics_results = [] - if self.dataset: - self.dataset.reset(self.postprocessor.has_processors) - - @staticmethod - def get_processing_info(config): - module_specific_params = config.get('module_config') - model_name = config['name'] - dataset_config = module_specific_params['datasets'][0] - launcher_config = module_specific_params['launchers'][0] - return ( - model_name, launcher_config['framework'], launcher_config['device'], launcher_config.get('tags'), - dataset_config['name'] - ) - - def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): - if self.dataset.batch is None: - self.dataset.batch = 1 - if subset is not None: - self.dataset.make_subset(ids=subset, accept_pairs=allow_pairwise) - elif num_images is not None: - self.dataset.make_subset(end=num_images, accept_pairs=allow_pairwise) - - @staticmethod - def configure_intermediate_metrics_results(config): - compute_intermediate_metric_res = config.get('intermediate_metrics_results', False) - metric_interval, ignore_results_formatting, ignore_metric_reference = None, None, None - if compute_intermediate_metric_res: - metric_interval = config.get('metrics_interval', 1000) - ignore_results_formatting = config.get('ignore_results_formatting', False) - ignore_metric_reference = config.get('ignore_metric_reference', False) - return compute_intermediate_metric_res, metric_interval, ignore_results_formatting, ignore_metric_reference - - def load_network(self, network=None): - self.model.load_network(network, self.launcher) - - def load_network_from_ir(self, models_list): - self.model.load_model(models_list, self.launcher) - - def get_network(self): - return self.model.get_network() - - def get_metrics_attributes(self): - if not self.metric_executor: - return {} - return self.metric_executor.get_metrics_attributes() - - def register_metric(self, metric_config): - if isinstance(metric_config, str): - self.metric_executor.register_metric({'type': metric_config}) - elif isinstance(metric_config, dict): - self.metric_executor.register_metric(metric_config) - else: - raise ValueError('Unsupported metric configuration type {}'.format(type(metric_config))) - - def register_postprocessor(self, postprocessing_config): - pass - - def register_dumped_annotations(self): - pass - - def select_dataset(self, dataset_tag): - if self.dataset is not None and isinstance(self.dataset_config, list): - return - dataset_attributes = create_dataset_attributes(self.dataset_config, dataset_tag) - self.dataset, self.metric_executor, self.preprocessor, self.postprocessor = dataset_attributes - - @staticmethod - def _create_progress_reporter(check_progress, dataset_size): - pr_kwargs = {} - if isinstance(check_progress, int) and not isinstance(check_progress, bool): - pr_kwargs = {"print_interval": check_progress} - - return ProgressReporter.provide('print', dataset_size, **pr_kwargs) - - def send_processing_info(self, sender): - if not sender: - return {} - model_type = None - details = {} - metrics = self.dataset_config[0].get('metrics', []) - metric_info = [metric['type'] for metric in metrics] - adapter_type = self.model.adapter.__provider__ - details.update({ - 'metrics': metric_info, - 'model_file_type': model_type, - 'adapter': adapter_type, - }) - if self.dataset is None: - self.select_dataset('') - - details.update(self.dataset.send_annotation_info(self.dataset_config[0])) - return details + output_callback(batch_raw_prediction[0], metrics_result=metrics_result, + element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) + self._update_progress(progress_reporter, metric_config, batch_id, len(prediction), csv_file) class BaseModel: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/tacotron2_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/tacotron2_evaluator.py index 9fa6f454082..df355abdcca 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/tacotron2_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/tacotron2_evaluator.py @@ -19,7 +19,6 @@ from .text_to_speech_evaluator import TextToSpeechEvaluator, TTSDLSDKModel from ...adapters import create_adapter from ...config import ConfigError -from ...launcher import create_launcher from ...utils import contains_all, sigmoid, generate_layer_name @@ -159,6 +158,7 @@ class EncoderModel: default_model_suffix = 'encoder' def __init__(self, network_info, launcher, delayed_model_loading=False): + self.is_dynamic = False self.network_info = network_info self.input_mapping = { 'text_encoder_outputs': 'text_encoder_outputs', @@ -200,6 +200,7 @@ class DecoderModel: default_model_suffix = 'decoder' def __init__(self, network_info, launcher, delayed_model_loading=False): + self.is_dynamic = False self.network_info = network_info self.input_mapping = { 'decoder_input': 'decoder_input', @@ -411,7 +412,8 @@ def prepare_inputs(self, feed_dict): new_shapes = {} for input_name in self.inputs: new_shapes[input_name] = ( - feed_dict[input_name].shape if input_name in feed_dict else self.inputs[input_name].shape) + feed_dict[input_name].shape if input_name in feed_dict else + self.inputs[input_name].input_data.shape) self.reshape(new_shapes) if len(feed_dict) != len(self.inputs): @@ -493,12 +495,7 @@ def create_postnet(model_config, launcher, delayed_model_loading=False): class Tacotron2Evaluator(TextToSpeechEvaluator): @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_config = config['launchers'][0] - if launcher_config['framework'] == 'dlsdk' and 'device' not in launcher_config: - launcher_config['device'] = 'CPU' - - launcher = create_launcher(launcher_config, delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) model = Synthesizer( config.get('network_info', {}), launcher, config.get('_models', []), config.get('_model_is_blob'), delayed_model_loading diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/text_spotting_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/text_spotting_evaluator.py index dec533e3304..0d366296762 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/text_spotting_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/text_spotting_evaluator.py @@ -19,13 +19,10 @@ from collections import OrderedDict import numpy as np -from ..base_evaluator import BaseEvaluator -from ..quantization_model_evaluator import create_dataset_attributes +from .base_custom_evaluator import BaseCustomEvaluator from ...adapters import create_adapter from ...config import ConfigError -from ...launcher import create_launcher from ...utils import contains_all, extract_image_representations, get_path -from ...progress_reporters import ProgressReporter from ...logging import print_info @@ -34,259 +31,48 @@ def softmax(x): return e_x / e_x.sum() -class TextSpottingEvaluator(BaseEvaluator): +class TextSpottingEvaluator(BaseCustomEvaluator): def __init__(self, dataset_config, launcher, model, orig_config): - self.dataset_config = dataset_config - self.preprocessing_executor = None - self.preprocessor = None - self.dataset = None - self.postprocessor = None - self.metric_executor = None - self.launcher = launcher + super().__init__(dataset_config, launcher, orig_config) self.model = model - self.config = orig_config - self._metrics_results = [] + if hasattr(self.model, 'adapter'): + self.adapter_type = self.model.adapter.__provider__ @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_config = config['launchers'][0] - if launcher_config['framework'] == 'dlsdk' and 'device' not in launcher_config: - launcher_config['device'] = 'CPU' - - launcher = create_launcher(launcher_config, delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) model = SequentialModel( config.get('network_info', {}), launcher, config.get('_models', []), config.get('_model_is_blob'), delayed_model_loading ) return cls(dataset_config, launcher, model, orig_config) - def process_dataset( - self, subset=None, - num_images=None, - check_progress=False, - dataset_tag='', - output_callback=None, - allow_pairwise_subset=False, - dump_prediction_to_annotation=False, - calculate_metrics=True, - **kwargs): - self._prepare_dataset(dataset_tag) - self._create_subset(subset, num_images, allow_pairwise_subset) - self._annotations, self._predictions = [], [] - if 'progress_reporter' in kwargs: - _progress_reporter = kwargs['progress_reporter'] - _progress_reporter.reset(self.dataset.size) - else: - _progress_reporter = None if not check_progress else self._create_progress_reporter( - check_progress, self.dataset.size - ) - compute_intermediate_metric_res = kwargs.get('intermediate_metrics_results', False) - if compute_intermediate_metric_res: - metric_interval = kwargs.get('metrics_interval', 1000) - ignore_results_formatting = kwargs.get('ignore_results_formatting', False) - ignore_metric_reference = kwargs.get('ignore_metric_reference', False) + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): for batch_id, (batch_input_ids, batch_annotation, batch_inputs, batch_identifiers) in enumerate(self.dataset): batch_inputs = self.preprocessor.process(batch_inputs, batch_annotation) batch_data, batch_meta = extract_image_representations(batch_inputs) temporal_output_callback = None if output_callback: - temporal_output_callback = partial(output_callback, - metrics_result=None, + temporal_output_callback = partial(output_callback, metrics_result=None, element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) - batch_raw_prediction, batch_prediction = self.model.predict( batch_identifiers, batch_data, batch_meta, callback=temporal_output_callback ) batch_annotation, batch_prediction = self.postprocessor.process_batch( batch_annotation, batch_prediction, batch_meta ) - metrics_result = None - if self.metric_executor and calculate_metrics: - metrics_result, _ = self.metric_executor.update_metrics_on_batch( - batch_input_ids, batch_annotation, batch_prediction - ) - if self.metric_executor.need_store_predictions: - self._annotations.extend(batch_annotation) - self._predictions.extend(batch_prediction) - + metrics_result = self._get_metrics_result(batch_input_ids, batch_annotation, batch_prediction, + calculate_metrics) if output_callback: - output_callback( - batch_raw_prediction, - metrics_result=metrics_result, - element_identifiers=batch_identifiers, - dataset_indices=batch_input_ids - ) - if _progress_reporter: - _progress_reporter.update(batch_id, len(batch_prediction)) - if compute_intermediate_metric_res and _progress_reporter.current % metric_interval == 0: - self.compute_metrics( - print_results=True, ignore_results_formatting=ignore_results_formatting, - ignore_metric_reference=ignore_metric_reference - ) - self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, metric_interval) - - if _progress_reporter: - _progress_reporter.finish() - - def compute_metrics(self, print_results=True, ignore_results_formatting=False, ignore_metric_reference=False): - if self._metrics_results: - del self._metrics_results - self._metrics_results = [] - - for result_presenter, evaluated_metric in self.metric_executor.iterate_metrics( - self._annotations, self._predictions - ): - self._metrics_results.append(evaluated_metric) - if print_results: - result_presenter.write_result(evaluated_metric, ignore_results_formatting, ignore_metric_reference) - - return self._metrics_results - - def extract_metrics_results(self, print_results=True, ignore_results_formatting=False, - ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(False, ignore_results_formatting, ignore_metric_reference) - - result_presenters = self.metric_executor.get_metric_presenters() - extracted_results, extracted_meta = [], [] - for presenter, metric_result in zip(result_presenters, self._metrics_results): - result, metadata = presenter.extract_result(metric_result) - if isinstance(result, list): - extracted_results.extend(result) - extracted_meta.extend(metadata) - else: - extracted_results.append(result) - extracted_meta.append(metadata) - if print_results: - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - return extracted_results, extracted_meta - - def print_metrics_results(self, ignore_results_formatting=False, ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(True, ignore_results_formatting, ignore_metric_reference) - return - result_presenters = self.metric_executor.get_metric_presenters() - for presenter, metric_result in zip(result_presenters, self._metrics_results): - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - def set_profiling_dir(self, profiler_dir): - self.metric_executor.set_profiling_dir(profiler_dir) - - def release(self): - self.model.release() - self.launcher.release() - - def reset(self): - if self.metric_executor: - self.metric_executor.reset() - if hasattr(self, '_annotations'): - del self._annotations - del self._predictions - del self._input_ids - del self._metrics_results - self._annotations = [] - self._predictions = [] - self._input_ids = [] - self._metrics_results = [] - if self.dataset: - self.dataset.reset(self.postprocessor.has_processors) - - @staticmethod - def get_processing_info(config): - module_specific_params = config.get('module_config') - model_name = config['name'] - dataset_config = module_specific_params['datasets'][0] - launcher_config = module_specific_params['launchers'][0] - return ( - model_name, launcher_config['framework'], launcher_config['device'], - launcher_config.get('tags'), - dataset_config['name'] - ) - - def load_network(self, network=None): - self.model.load_network(network, self.launcher) - - def load_network_from_ir(self, models_dict): - self.model.load_model(models_dict, self.launcher) - - def get_network(self): - return self.model.get_network() - - def get_metrics_attributes(self): - if not self.metric_executor: - return {} - return self.metric_executor.get_metrics_attributes() - - def register_metric(self, metric_config): - if isinstance(metric_config, str): - self.metric_executor.register_metric({'type': metric_config}) - elif isinstance(metric_config, dict): - self.metric_executor.register_metric(metric_config) - else: - raise ValueError('Unsupported metric configuration type {}'.format(type(metric_config))) - - def register_postprocessor(self, postprocessing_config): - pass - - def register_dumped_annotations(self): - pass - - def select_dataset(self, dataset_tag): - if self.dataset is not None and isinstance(self.dataset_config, list): - return - dataset_attributes = create_dataset_attributes(self.dataset_config, dataset_tag) - self.dataset, self.metric_executor, self.preprocessor, self.postprocessor = dataset_attributes - - @staticmethod - def _create_progress_reporter(check_progress, dataset_size): - pr_kwargs = {} - if isinstance(check_progress, int) and not isinstance(check_progress, bool): - pr_kwargs = {"print_interval": check_progress} - - return ProgressReporter.provide('print', dataset_size, **pr_kwargs) - - def _prepare_dataset(self, dataset_tag=''): - if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): - self.select_dataset(dataset_tag) - - if self.dataset.batch is None: - self.dataset.batch = 1 - - def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): - if subset is not None: - self.dataset.make_subset(ids=subset, accept_pairs=allow_pairwise) - elif num_images is not None: - self.dataset.make_subset(end=num_images, accept_pairs=allow_pairwise) - - @property - def dataset_size(self): - return self.dataset.size - - def send_processing_info(self, sender): - if not sender: - return {} - model_type = None - details = {} - metrics = self.dataset_config[0].get('metrics', []) - metric_info = [metric['type'] for metric in metrics] - adapter_type = self.model.adapter.__provider__ - details.update({ - 'metrics': metric_info, - 'model_file_type': model_type, - 'adapter': adapter_type, - }) - if self.dataset is None: - self.select_dataset('') - - details.update(self.dataset.send_annotation_info(self.dataset_config[0])) - return details + output_callback(batch_raw_prediction, metrics_result=metrics_result, + element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) + self._update_progress(progress_reporter, metric_config, batch_id, len(batch_prediction), csv_file) class BaseModel: def __init__(self, network_info, launcher, default_model_suffix, delayed_model_loading=False): + self.is_dynamic = False self.default_model_suffix = default_model_suffix self.network_info = network_info self.launcher = launcher @@ -574,11 +360,18 @@ def __init__(self, network_info, launcher, delayed_model_loading=False): self.im_data_name = None if not delayed_model_loading: self.load_model(network_info, launcher, log=True) - has_info = hasattr(self.exec_network, 'input_info') - input_info = ( - OrderedDict([(name, data.input_data) for name, data in self.exec_network.input_info.items()]) - if has_info else self.exec_network.inputs - ) + if self.exec_network is not None: + has_info = hasattr(self.exec_network, 'input_info') + input_info = ( + OrderedDict([(name, data.input_data) for name, data in self.exec_network.input_info.items()]) + if has_info else self.exec_network.inputs + ) + else: + has_info = hasattr(self.network, 'input_info') + input_info = ( + OrderedDict([(name, data.input_data) for name, data in self.network.input_info.items()]) + if has_info else self.network.inputs + ) self.im_info_name = [x for x in input_info if len(input_info[x].shape) == 2] self.im_data_name = [x for x in input_info if len(input_info[x].shape) == 4][0] if self.im_info_name: @@ -625,14 +418,21 @@ def load_model(self, network_info, launcher, log=False): model, weights = self.automatic_model_search(network_info) if weights is not None: self.network = launcher.read_network(str(model), str(weights)) - self.exec_network = self.load_network(self.network, launcher) + self.load_network(self.network, launcher) else: self.exec_network = launcher.ie_core.import_network(str(model)) - has_info = hasattr(self.exec_network, 'input_info') - input_info = ( - OrderedDict([(name, data.input_data) for name, data in self.exec_network.input_info.items()]) - if has_info else self.exec_network.inputs - ) + if self.exec_network: + has_info = hasattr(self.exec_network, 'input_info') + input_info = ( + OrderedDict([(name, data.input_data) for name, data in self.exec_network.input_info.items()]) + if has_info else self.exec_network.inputs + ) + else: + has_info = hasattr(self.network, 'input_info') + input_info = ( + OrderedDict([(name, data.input_data) for name, data in self.network.input_info.items()]) + if has_info else self.network.inputs + ) self.im_data_name = [x for x in input_info if len(input_info[x].shape) == 4][0] self.im_info_name = [x for x in input_info if len(input_info[x].shape) == 2] if self.im_info_name: @@ -665,7 +465,7 @@ def load_model(self, network_info, launcher, log=False): model, weights = self.automatic_model_search(network_info) if weights is not None: self.network = launcher.read_network(str(model), str(weights)) - self.exec_network = self.load_network(self.network, launcher) + self.load_network(self.network, launcher) else: self.exec_network = launcher.ie_core.import_network(str(model)) if log: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/text_to_speech_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/text_to_speech_evaluator.py index ee94a63c55a..97e7a4485a1 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/text_to_speech_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/text_to_speech_evaluator.py @@ -19,67 +19,30 @@ from collections import OrderedDict import numpy as np -from ..base_evaluator import BaseEvaluator -from ..quantization_model_evaluator import create_dataset_attributes +from .base_custom_evaluator import BaseCustomEvaluator from ...adapters import create_adapter from ...config import ConfigError -from ...launcher import create_launcher from ...utils import contains_all, extract_image_representations, get_path -from ...progress_reporters import ProgressReporter from ...logging import print_info -class TextToSpeechEvaluator(BaseEvaluator): +class TextToSpeechEvaluator(BaseCustomEvaluator): def __init__(self, dataset_config, launcher, model, orig_config): - self.dataset_config = dataset_config - self.preprocessor = None - self.dataset = None - self.postprocessor = None - self.metric_executor = None - self.launcher = launcher + super().__init__(dataset_config, launcher, orig_config) self.model = model - self.config = orig_config - self._metrics_results = [] + if hasattr(self.model, 'adapter'): + self.adapter_type = self.model.adapter.__provider__ @classmethod def from_configs(cls, config, delayed_model_loading=False, orig_config=None): - dataset_config = config['datasets'] - launcher_config = config['launchers'][0] - if launcher_config['framework'] == 'dlsdk' and 'device' not in launcher_config: - launcher_config['device'] = 'CPU' - - launcher = create_launcher(launcher_config, delayed_model_loading=True) + dataset_config, launcher, _ = cls.get_dataset_and_launcher_info(config) model = SequentialModel( config.get('network_info', {}), launcher, config.get('_models', []), config.get('_model_is_blob'), delayed_model_loading ) return cls(dataset_config, launcher, model, orig_config) - def process_dataset( - self, subset=None, - num_images=None, - check_progress=False, - dataset_tag='', - output_callback=None, - allow_pairwise_subset=False, - dump_prediction_to_annotation=False, - calculate_metrics=True, - **kwargs): - self._prepare_dataset(dataset_tag) - self._create_subset(subset, num_images, allow_pairwise_subset) - self._annotations, self._predictions = [], [] - if 'progress_reporter' in kwargs: - _progress_reporter = kwargs['progress_reporter'] - _progress_reporter.reset(self.dataset.size) - else: - _progress_reporter = None if not check_progress else self._create_progress_reporter( - check_progress, self.dataset.size - ) - compute_intermediate_metric_res = kwargs.get('intermediate_metrics_results', False) - if compute_intermediate_metric_res: - metric_interval = kwargs.get('metrics_interval', 1000) - ignore_results_formatting = kwargs.get('ignore_results_formatting', False) - ignore_metric_reference = kwargs.get('ignore_metric_reference', False) + def _process(self, output_callback, calculate_metrics, progress_reporter, metric_config, csv_file): for batch_id, (batch_input_ids, batch_annotation, batch_inputs, batch_identifiers) in enumerate(self.dataset): batch_inputs = self.preprocessor.process(batch_inputs, batch_annotation) batch_data, batch_meta = extract_image_representations(batch_inputs) @@ -88,196 +51,19 @@ def process_dataset( s.split('.')[-1]) for s in batch_inputs[0].identifier] temporal_output_callback = None if output_callback: - temporal_output_callback = partial(output_callback, - metrics_result=None, + temporal_output_callback = partial(output_callback, metrics_result=None, element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) - batch_raw_prediction, batch_prediction = self.model.predict( batch_identifiers, batch_data, batch_meta, input_names, callback=temporal_output_callback ) batch_annotation, batch_prediction = self.postprocessor.process_batch(batch_annotation, batch_prediction) - metrics_result = None - if self.metric_executor and calculate_metrics: - metrics_result, _ = self.metric_executor.update_metrics_on_batch( - batch_input_ids, batch_annotation, batch_prediction - ) - if self.metric_executor.need_store_predictions: - self._annotations.extend(batch_annotation) - self._predictions.extend(batch_prediction) - + metrics_result = self._get_metrics_result(batch_input_ids, batch_annotation, batch_prediction, + calculate_metrics) if output_callback: - output_callback( - batch_raw_prediction, - metrics_result=metrics_result, - element_identifiers=batch_identifiers, - dataset_indices=batch_input_ids - ) - if _progress_reporter: - _progress_reporter.update(batch_id, len(batch_prediction)) - if compute_intermediate_metric_res and _progress_reporter.current % metric_interval == 0: - self.compute_metrics( - print_results=True, ignore_results_formatting=ignore_results_formatting, - ignore_metric_reference=ignore_metric_reference - ) - self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, metric_interval) - - if _progress_reporter: - _progress_reporter.finish() - - def compute_metrics(self, print_results=True, ignore_results_formatting=False, ignore_metric_reference=False): - if self._metrics_results: - del self._metrics_results - self._metrics_results = [] - - for result_presenter, evaluated_metric in self.metric_executor.iterate_metrics( - self._annotations, self._predictions - ): - self._metrics_results.append(evaluated_metric) - if print_results: - result_presenter.write_result(evaluated_metric, ignore_results_formatting, ignore_metric_reference) - - return self._metrics_results - - def extract_metrics_results(self, print_results=True, ignore_results_formatting=False, - ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(False, ignore_results_formatting, ignore_metric_reference) - - result_presenters = self.metric_executor.get_metric_presenters() - extracted_results, extracted_meta = [], [] - for presenter, metric_result in zip(result_presenters, self._metrics_results): - result, metadata = presenter.extract_result(metric_result) - if isinstance(result, list): - extracted_results.extend(result) - extracted_meta.extend(metadata) - else: - extracted_results.append(result) - extracted_meta.append(metadata) - if print_results: - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - return extracted_results, extracted_meta - - def print_metrics_results(self, ignore_results_formatting=False, ignore_metric_reference=False): - if not self._metrics_results: - self.compute_metrics(True, ignore_results_formatting, ignore_metric_reference) - return - result_presenters = self.metric_executor.get_metric_presenters() - for presenter, metric_result in zip(result_presenters, self._metrics_results): - presenter.write_result(metric_result, ignore_results_formatting, ignore_metric_reference) - - def set_profiling_dir(self, profiler_dir): - self.metric_executor.set_profiling_dir(profiler_dir) - - @property - def dataset_size(self): - return self.dataset.size - - def release(self): - self.model.release() - self.launcher.release() - - def reset(self): - if self.metric_executor: - self.metric_executor.reset() - if hasattr(self, '_annotations'): - del self._annotations - del self._predictions - del self._input_ids - del self._metrics_results - self._annotations = [] - self._predictions = [] - self._input_ids = [] - self._metrics_results = [] - if self.dataset: - self.dataset.reset(self.postprocessor.has_processors) - - @staticmethod - def get_processing_info(config): - module_specific_params = config.get('module_config') - model_name = config['name'] - dataset_config = module_specific_params['datasets'][0] - launcher_config = module_specific_params['launchers'][0] - return ( - model_name, launcher_config['framework'], launcher_config['device'], - launcher_config.get('tags'), - dataset_config['name'] - ) - - def load_network(self, network=None): - self.model.load_network(network, self.launcher) - - def load_network_from_ir(self, models_dict): - self.model.load_model(models_dict, self.launcher) - - def get_network(self): - return self.model.get_network() - - def get_metrics_attributes(self): - if not self.metric_executor: - return {} - return self.metric_executor.get_metrics_attributes() - - def register_metric(self, metric_config): - if isinstance(metric_config, str): - self.metric_executor.register_metric({'type': metric_config}) - elif isinstance(metric_config, dict): - self.metric_executor.register_metric(metric_config) - else: - raise ValueError('Unsupported metric configuration type {}'.format(type(metric_config))) - - def register_postprocessor(self, postprocessing_config): - pass - - def register_dumped_annotations(self): - pass - - def select_dataset(self, dataset_tag): - if self.dataset is not None and isinstance(self.dataset_config, list): - return - dataset_attributes = create_dataset_attributes(self.dataset_config, dataset_tag) - self.dataset, self.metric_executor, self.preprocessor, self.postprocessor = dataset_attributes - - @staticmethod - def _create_progress_reporter(check_progress, dataset_size): - pr_kwargs = {} - if isinstance(check_progress, int) and not isinstance(check_progress, bool): - pr_kwargs = {"print_interval": check_progress} - - return ProgressReporter.provide('print', dataset_size, **pr_kwargs) - - def _prepare_dataset(self, dataset_tag=''): - if self.dataset is None or (dataset_tag and self.dataset.tag != dataset_tag): - self.select_dataset(dataset_tag) - - if self.dataset.batch is None: - self.dataset.batch = 1 - - def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): - if subset is not None: - self.dataset.make_subset(ids=subset, accept_pairs=allow_pairwise) - elif num_images is not None: - self.dataset.make_subset(end=num_images, accept_pairs=allow_pairwise) - - def send_processing_info(self, sender): - if not sender: - return {} - model_type = None - details = {} - metrics = self.dataset_config[0].get('metrics', []) - metric_info = [metric['type'] for metric in metrics] - adapter_type = self.model.adapter.__provider__ - details.update({ - 'metrics': metric_info, - 'model_file_type': model_type, - 'adapter': adapter_type, - }) - if self.dataset is None: - self.select_dataset('') - - details.update(self.dataset.send_annotation_info(self.dataset_config[0])) - return details + output_callback(batch_raw_prediction, metrics_result=metrics_result, + element_identifiers=batch_identifiers, dataset_indices=batch_input_ids) + self._update_progress(progress_reporter, metric_config, batch_id, len(batch_prediction), csv_file) def create_network(model_config, launcher, suffix, delayed_model_loading=False): @@ -488,6 +274,7 @@ class TTSDLSDKModel: def __init__(self, network_info, launcher, suffix, delayed_model_loading=False): self.network_info = network_info self.default_model_suffix = suffix + self.is_dynamic = False if not delayed_model_loading: self.load_model(network_info, launcher, log=True) self.launcher = launcher @@ -502,6 +289,8 @@ def release(self): del self.exec_network def reshape(self, input_shapes): + if not hasattr(self, 'is_dynamic'): + self.is_dynamic = False if not self.is_dynamic: del self.exec_network self.network.reshape(input_shapes) @@ -599,7 +388,7 @@ def load_model(self, network_info, launcher, log=False): model, weights = self.automatic_model_search(network_info) if weights is not None: self.network = launcher.read_network(str(model), str(weights)) - self.exec_network = self.load_network(self.network, launcher) + self.load_network(self.network, launcher) else: self.exec_network = launcher.ie_core.import_network(str(model)) if log: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/model_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/model_evaluator.py index b8ced9105da..68ba7fbf14c 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/model_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/model_evaluator.py @@ -26,6 +26,7 @@ from ..launcher.loaders import StoredPredictionBatch from ..logging import print_info, warning from ..metrics import MetricsExecutor +from ..presenters import generate_csv_report from ..postprocessor import PostprocessingExecutor from ..preprocessor import PreprocessingExecutor from ..adapters import create_adapter, Adapter @@ -79,6 +80,7 @@ def from_configs(cls, model_config, delayed_annotation_loading=False): enable_ie_preprocessing=enable_ie_preprocessing ) input_precision = launcher_config.get('_input_precision', []) + input_layouts = launcher_config.get('_input_layout', '') if enable_ie_preprocessing: launcher_kwargs['preprocessor'] = preprocessor if launcher_config['framework'] == 'dummy' and launcher_config.get('provide_identifiers', False): @@ -92,7 +94,8 @@ def from_configs(cls, model_config, delayed_annotation_loading=False): launcher_inputs = launcher.inputs if not postpone_model_loading else {} input_feeder = InputFeeder( launcher.config.get('inputs', []), launcher_inputs, launcher.input_shape, launcher.fit_to_input, - launcher.default_layout, launcher_config['framework'] == 'dummy' or postpone_model_loading, input_precision + launcher.default_layout, launcher_config['framework'] == 'dummy' or postpone_model_loading, input_precision, + input_layouts ) if not postpone_model_loading: if input_precision: @@ -248,12 +251,6 @@ def _get_batch_input(self, batch_annotation, batch_input, template=None): return filled_inputs, batch_meta, inputs_template def process_dataset_async(self, stored_predictions, progress_reporter, *args, **kwargs): - def completion_callback(status_code, request_id): - if status_code: - warning('Request {} failed with status code {}'.format(request_id, status_code)) - queued_irs.remove(request_id) - ready_irs.append(request_id) - def prepare_dataset(store_only_mode): if self.dataset is None: raise ConfigError('dataset entry is not assigned for execution') @@ -277,9 +274,34 @@ def prepare_dataset(store_only_mode): output_callback = kwargs.get('output_callback') metric_config = self._configure_metrics(kwargs, output_callback) + dataset_iterator = iter(enumerate(self.dataset)) + if hasattr(self.launcher, 'get_infer_queue'): + return self.process_dataset_async_infer_queue( + dataset_iterator, metric_config, progress_reporter, stored_predictions, + **kwargs + ) + return self.process_dataset_async_requests( + dataset_iterator, metric_config, progress_reporter, stored_predictions, + **kwargs + ) + + def process_dataset_async_requests( + self, dataset_iterator, metric_config, progress_reporter, stored_predictions, **kwargs): + if self.launcher.config['framework'] == 'openvino': + def completion_callback(request_id): + queued_irs.remove(request_id) + ready_irs.append(request_id) + else: + def completion_callback(status_code, request_id): + if status_code: + warning('Request {} failed with status code {}'.format(request_id, status_code)) + queued_irs.remove(request_id) + ready_irs.append(request_id) + (_, compute_intermediate_metric_res, metric_interval, ignore_results_formatting, ignore_metric_reference) = metric_config - dataset_iterator = iter(enumerate(self.dataset)) + store_only = kwargs.get('store_only', False) + output_callback = kwargs.get('output_callback') infer_requests_pool = {ir.request_id: ir for ir in self.launcher.get_async_requests()} free_irs = list(infer_requests_pool) queued_irs, ready_irs = [], [] @@ -322,6 +344,49 @@ def prepare_dataset(store_only_mode): if stored_predictions: print_info("prediction objects are save to {}".format(stored_predictions)) + def process_dataset_async_infer_queue( + self, dataset_iterator, metric_config, progress_reporter, stored_predictions, **kwargs): + + def completion_callback(request, user_data): + batch_id, batch_input_ids, batch_annotation, batch_identifiers, batch_meta = user_data + batch_raw_predictions = self.launcher.get_result_from_request(request) + if stored_predictions: + self.prepare_prediction_to_store( + batch_raw_predictions, batch_identifiers, batch_meta, stored_predictions + ) + if not store_only: + self._process_batch_results( + batch_raw_predictions, batch_annotation, batch_identifiers, + batch_input_ids, batch_meta, False, output_callback) + + if progress_reporter: + progress_reporter.update(batch_id, len(batch_identifiers)) + if compute_intermediate_metric_res and progress_reporter.current % metric_interval == 0: + self.compute_metrics( + print_results=True, ignore_results_formatting=ignore_results_formatting, + ignore_metric_reference=ignore_metric_reference + ) + self.write_results_to_csv(kwargs.get('csv_result'), ignore_results_formatting, + metric_interval) + + (_, compute_intermediate_metric_res, metric_interval, ignore_results_formatting, + ignore_metric_reference) = metric_config + store_only = kwargs.get('store_only', False) + output_callback = kwargs.get('output_callback') + infer_queue = self.launcher.get_infer_queue() + infer_queue.set_callback(completion_callback) + for batch_id, dataset_item in dataset_iterator: + batch_input_ids, batch_annotation, batch_input, batch_identifiers = dataset_item + filled_inputs, batch_meta, _ = self._get_batch_input(batch_annotation, batch_input) + infer_queue.start_async(*self.launcher.prepare_data_for_request( + filled_inputs, batch_meta, batch_id, batch_input_ids, batch_annotation, batch_identifiers)) + infer_queue.wait_all() + if progress_reporter: + progress_reporter.finish() + + if stored_predictions: + print_info("prediction objects are save to {}".format(stored_predictions)) + def process_dataset_sync(self, stored_predictions, progress_reporter, *args, **kwargs): if self.dataset is None: raise ConfigError('dataset entry is not assigned for evaluation') @@ -374,11 +439,16 @@ def _process_batch_results( self.adapter.output_blob = self.adapter.output_blob or self.launcher.output_blob batch_predictions = self.adapter.process(batch_predictions, batch_identifiers, batch_meta) + copy_annotations, copy_predictions = None, None + if self.metric_executor.profiler is not None and self.metric_executor.profiler.required_postprocessing: + copy_annotations, copy_predictions = copy.deepcopy(batch_annotations), copy.deepcopy(batch_predictions) + copy_annotations, copy_predictions = self.postprocessor.deprocess_batch( + copy_annotations, copy_predictions, batch_meta) annotations, predictions = self.postprocessor.process_batch( batch_annotations, batch_predictions, batch_meta ) _, profile_result = self.metric_executor.update_metrics_on_batch( - batch_input_ids, annotations, predictions, enable_profiling + batch_input_ids, annotations, predictions, enable_profiling, copy_annotations, copy_predictions ) if output_callback: callback_kwargs = {'profiling_result': profile_result} if enable_profiling else {} @@ -422,8 +492,8 @@ def _fill_free_irs(self, free_irs, queued_irs, infer_requests_pool, dataset_iter except StopIteration: break - queued_irs.append(ir_id) batch_input, batch_meta, _ = self._get_batch_input(batch_annotation, batch_input) + queued_irs.append(ir_id) self.launcher.predict_async(infer_requests_pool[ir_id], batch_input, batch_meta, context=(batch_id, batch_input_ids, batch_annotation)) @@ -648,7 +718,10 @@ def _initialize_input_shape_with_data_range(self): per_input_tamplates = [] for stat_shape in shapes_statistic: shape_template = [-1] * len(stat_shape[0]) - undefined_shapes = np.squeeze(np.sum(shapes_statistic == -1, axis=1), 0).astype(int) + + undefined_shapes = np.sum(stat_shape == -1, axis=0).astype(int) + if undefined_shapes.ndim >= 2: + undefined_shapes = np.squeeze(undefined_shapes, 0) for i, ds in enumerate(undefined_shapes): if ds > 0: continue @@ -686,3 +759,33 @@ def release(self): self.launcher.release() if self.adapter: self.adapter.release() + + @classmethod + def provide_metric_references(cls, conf, subset, return_header=True): + processing_info = cls.get_processing_info(conf) + dataset_config = conf['datasets'][0] + dataset = Dataset(dataset_config, log=False) + dataset_size = len(dataset) + ignore_config_refs = False + if subset is not None: + dataset_config['subsample_size'] = subset + new_dataset = Dataset(dataset_config, log=False) + if len(new_dataset) != len(dataset): + ignore_config_refs = True + warning('Subset is not matched with configuration. Reference values will be ignored') + dataset_size = len(new_dataset) + dataset = new_dataset + metric_dispatcher = MetricsExecutor(dataset_config.get('metrics', []), dataset) + extracted_results, extracted_meta = [], [] + for result_presenter, metric_result in metric_dispatcher.get_metric_result_template(ignore_config_refs): + result, metadata = result_presenter.extract_result(metric_result) + if isinstance(result, list): + extracted_results.extend(result) + extracted_meta.extend(metadata) + else: + extracted_results.append(result) + extracted_meta.append(metadata) + header, report = generate_csv_report(processing_info, extracted_results, dataset_size, extracted_meta) + if not return_header: + return report + return header, report diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/module_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/module_evaluator.py index 11e38a3e25c..ee8de6a42a2 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/module_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/module_evaluator.py @@ -20,6 +20,10 @@ import importlib from pathlib import Path from .base_evaluator import BaseEvaluator +from ..logging import warning +from ..dataset import Dataset +from ..presenters import generate_csv_report +from ..metrics import MetricsExecutor # pylint:disable=R0904 @@ -142,6 +146,35 @@ def set_profiling_dir(self, profiler_dir): def dataset_size(self): return self._internal_module.dataset_size + @classmethod + def provide_metric_references(cls, conf, subset, return_header=True): + processing_info = cls.get_processing_info(conf) + dataset_config = conf['module_config']['datasets'][0] + dataset = Dataset(dataset_config) + dataset_size = len(dataset) + ignore_config_refs = False + if subset is not None: + dataset_config['subsample_size'] = subset + new_dataset = Dataset(dataset_config) + if len(new_dataset) != len(dataset): + ignore_config_refs = True + warning('Subset is not matched with configuration. Reference values will be ignored') + dataset_size = len(new_dataset) + dataset = new_dataset + metric_dispatcher = MetricsExecutor(dataset_config.get('metrics', []), dataset) + extracted_results, extracted_meta = [], [] + for result_presenter, metric_result in metric_dispatcher.get_metric_result_template(ignore_config_refs): + result, metadata = result_presenter.extract_result(metric_result) + if isinstance(result, list): + extracted_results.extend(result) + extracted_meta.extend(metadata) + else: + extracted_results.append(result) + extracted_meta.append(metadata) + header, report = generate_csv_report(processing_info, extracted_results, dataset_size, extracted_meta) + if not return_header: + return report + return header, report def load_module(model_cls, python_path=None): module_parts = model_cls.split(".") diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/quantization_model_evaluator.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/quantization_model_evaluator.py index 7e2e3ef8e2e..019a9703fc7 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/quantization_model_evaluator.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/quantization_model_evaluator.py @@ -210,7 +210,7 @@ def select_dataset(self, dataset_tag): return dataset_attributes = create_dataset_attributes(self.dataset_config, dataset_tag, self._dumped_annotations) self.dataset, self.metric_executor, self.preprocessor, self.postprocessor = dataset_attributes - if self.dataset.annotation_provider and self.dataset.annotation_provider.metadata: + if self.dataset.annotation_provider and self.dataset.annotation_provider.metadata and self.adapter is not None: self.adapter.label_map = self.dataset.annotation_provider.metadata.get('label_map') def _create_subset(self, subset=None, num_images=None, allow_pairwise=False): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/__init__.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/__init__.py index ae9bea647b0..7172c524e20 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/__init__.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/__init__.py @@ -77,6 +77,13 @@ 'onnx_runtime', "ONNX Runtime isn't installed. Please, install it before using. \n{}".format(import_error.msg) ) +try: + from .openvino_launcher import OpenVINOLauncher #pylint:disable=package-absolute-imports +except ImportError as import_error: + OpenVINOLauncher = unsupported_launcher( + 'openvino', "OpenVINO isn't installed. Please, install it before using. \n{}".format(import_error.msg) + ) + try: from .pdpd_launcher import PaddlePaddleLauncher except ImportError as import_error: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_async_request.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_async_request.py index 5b3b3d2863a..4a902972297 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_async_request.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_async_request.py @@ -21,8 +21,12 @@ class AsyncInferRequestWrapper: def __init__(self, request_id, request, completion_callback=None): self.request_id = request_id self.request = request + self._contains_tensors = hasattr(self.request, 'output_tensors') if completion_callback: - self.request.set_completion_callback(completion_callback, self.request_id) + if not self._contains_tensors: + self.request.set_completion_callback(completion_callback, self.request_id) + else: + self.request.set_callback(completion_callback, self.request_id) self.context = None self._contains_blob = hasattr(self.request, 'output_blobs') @@ -30,15 +34,27 @@ def infer(self, inputs, meta, context=None): if context: self.context = context self.meta = meta - self.request.async_infer(inputs=inputs) + if hasattr(self.request, 'async_infer'): + self.request.async_infer(inputs=inputs) + else: + self.request.start_async(inputs=inputs) + self.request.wait() def get_result(self): - if not self._contains_blob: + if not self._contains_blob and not self._contains_tensors: return self.context, self.meta, self.request.outputs + if self._contains_tensors: + return self.context, self.meta, { + out.get_node().friendly_name: res.data + for out, res in zip(self.request.outputs, self.request.output_tensors) + } outputs = OrderedDict() for output_name, output_blob in self.request.output_blobs.items(): outputs[output_name] = output_blob.buffer return self.context, self.meta, outputs def set_completion_callback(self, callback): - self.request.set_completion_callback(callback, self.request_id) + if not self._contains_tensors: + self.request.set_completion_callback(callback, self.request_id) + else: + self.request.set_callback(callback, self.request_id) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher.py index 59c806d3b28..c40be2275db 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher.py @@ -14,10 +14,8 @@ limitations under the License. """ -import subprocess # nosec - disable B404:import-subprocess check import multiprocessing from pathlib import Path -import os import re import warnings from collections import OrderedDict @@ -25,7 +23,7 @@ import openvino.inference_engine as ie from .dlsdk_launcher_config import ( - HETERO_KEYWORD, MULTI_DEVICE_KEYWORD, FPGA_COMPILER_MODE_VAR, NIREQ_REGEX, VPU_PLUGINS, + HETERO_KEYWORD, MULTI_DEVICE_KEYWORD, NIREQ_REGEX, VPU_PLUGINS, get_cpu_extension, mo_convert_model, DLSDK_LAUNCHER_PARAMETERS, DLSDKLauncherConfigValidator, @@ -96,7 +94,6 @@ def __init__(self, config_entry, model_name='', delayed_model_loading=False, self.dynamic_shapes_policy = self.get_value_from_config('_undefined_shapes_resolving_policy') self._set_variable = False self._async_mode = False - self._prepare_bitstream_firmware(self.config) self._prepare_ie() self._delayed_model_loading = delayed_model_loading self._postpone_input_configuration = postpone_inputs_configuration @@ -121,7 +118,7 @@ def __init__(self, config_entry, model_name='', delayed_model_loading=False, self._model, self._weights = automatic_model_search( self._model_name, self.get_value_from_config('model'), self.get_value_from_config('weights'), - self.get_value_from_config('_model_is_blob') + self.get_value_from_config('_model_type') ) self.load_network(log=True, preprocessing=preprocessor) self.allow_reshape_input = self.get_value_from_config('allow_reshape_input') and self.network is not None @@ -134,7 +131,7 @@ def __init__(self, config_entry, model_name='', delayed_model_loading=False, self.reset_memory_state = self.get_value_from_config('reset_memory_state') @classmethod - def validate_config(cls, config, fetch_only=False, delayed_model_loading=False, uri_prefix=''): + def validate_config(cls, config, delayed_model_loading=False, fetch_only=False, uri_prefix=''): field_uri = uri_prefix or 'launcher.{}'.format(cls.__provider__) return DLSDKLauncherConfigValidator( field_uri, fields=cls.parameters(), delayed_model_loading=delayed_model_loading).validate( @@ -296,42 +293,10 @@ def _set_affinity_via_layers(self, custom_affinity, automatic_affinity): ) layers[layer_name].affinity = device - def _is_fpga(self): - device_list = map(lambda device: device.split('.')[0], self._devices_list()) - return 'FPGA' in device_list - def _is_vpu(self): device_list = map(lambda device: device.split('.')[0], self._devices_list()) return contains_any(device_list, VPU_PLUGINS) - def _prepare_bitstream_firmware(self, config): - if not self._is_fpga(): - return - compiler_mode = os.environ.get(FPGA_COMPILER_MODE_VAR) - if compiler_mode == '3': - return - bitstream = config.get('bitstream') - if bitstream: - previous_bitstream = config.get('_prev_bitstream', '') - if str(previous_bitstream) != str(bitstream): - print_info('programming bitstream: {}'.format(bitstream.name)) - aocl_executable = config.get('_aocl') - if aocl_executable: - subprocess.run([str(aocl_executable), 'program', 'acl0', str(bitstream)], check=True) - os.environ[FPGA_COMPILER_MODE_VAR] = '3' - self._set_variable = True - else: - aocx_variable = 'DLA_AOCX' - previous_bitstream = os.environ.get(aocx_variable) - if previous_bitstream == str(bitstream): - return - os.environ[aocx_variable] = str(bitstream) - if not os.environ.get(aocx_variable): - warning('Warning: {} has not been set'.format(aocx_variable)) - else: - os.environ[FPGA_COMPILER_MODE_VAR] = '3' - self._set_variable = True - @property def num_requests(self): return self._num_requests @@ -358,12 +323,13 @@ def async_mode(self, flag): def get_async_requests(self): return [AsyncInferRequestWrapper(ireq_id, ireq) for ireq_id, ireq in enumerate(self.exec_network.requests)] - def _reshape_input(self, shapes): + def _reshape_input(self, shapes, make_dynamic=False): if hasattr(self, 'exec_network'): del self.exec_network self.network.reshape(shapes) - if self.dyn_input_layers: - self.dyn_input_layers, self._partial_shapes = self.get_dynamic_inputs(self.network) + self.dyn_input_layers, self._partial_shapes = self.get_dynamic_inputs(self.network) + if self.dyn_input_layers and make_dynamic: + return self.exec_network = self.ie_core.load_network(self.network, self.device, num_requests=self._num_requests) def _set_batch_size(self, batch_size): @@ -475,7 +441,7 @@ def _set_nireq(self): print_info('Infer requests number:{}'.format(self.num_requests)) def auto_num_requests(self, return_list=False): - concurrency_device = {'CPU': 1, 'GPU': 1, 'HDDL': 100, 'MYRIAD': 4, 'FPGA': 3} + concurrency_device = {'CPU': 1, 'GPU': 1, 'HDDL': 100, 'MYRIAD': 4} platform_list = self._devices_list() if 'CPU' in platform_list and len(platform_list) == 1: min_requests = [4, 5, 3] @@ -839,14 +805,21 @@ def _set_input_shape(self): return config_inputs = self.config.get('inputs', []) input_shapes = {} + make_dynamic = False for input_config in config_inputs: if 'shape' in input_config: input_shapes[input_config['name']] = input_config['shape'] + if -1 in input_config['shape']: + make_dynamic = True if not input_shapes: return - orig_input_shapes = {input_name: input_info.shape for input_name, input_info in self.inputs.items()} + orig_input_shapes = { + input_name: input_info.shape + if input_name not in self._partial_shapes else self._partial_shapes[input_name] + for input_name, input_info in self.inputs.items() + } orig_input_shapes.update(input_shapes) - self._reshape_input(orig_input_shapes) + self._reshape_input(orig_input_shapes, make_dynamic) def _configure_lstm_inputs(self): lstm_mapping = {} @@ -960,5 +933,3 @@ def release(self): del self.exec_network if 'ie_core' in self.__dict__: del self.ie_core - if self._set_variable: - del os.environ[FPGA_COMPILER_MODE_VAR] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher_config.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher_config.py index 4962270aeaa..e25cccb2677 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher_config.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher_config.py @@ -35,7 +35,6 @@ HETERO_KEYWORD = 'HETERO:' MULTI_DEVICE_KEYWORD = 'MULTI:' -FPGA_COMPILER_MODE_VAR = 'CL_CONTEXT_COMPILER_MODE_INTELFPGA' NIREQ_REGEX = r"(\(\d+\))" VPU_PLUGINS = ('HDDL', "MYRIAD") VPU_LOG_LEVELS = ('LOG_NONE', 'LOG_WARNING', 'LOG_INFO', 'LOG_DEBUG') @@ -111,12 +110,17 @@ def __init__(self, config_uri, fields=None, delayed_model_loading=False, **kwarg self.need_conversion = None def create_device_regex(self, available_devices): - self.regular_device_regex = r"(?:^(?P{devices})$)".format(devices="|".join(available_devices)) + resolve_multi_device = set() + for device in available_devices: + resolve_multi_device.add(device) + if '.' in device: + resolve_multi_device.add(device.split('.')[0]) + self.regular_device_regex = r"(?:^(?P{devices})$)".format(devices="|".join(resolve_multi_device)) self.hetero_regex = r"(?:^{hetero}(?P(?:{devices})(?:,(?:{devices}))*)$)".format( - hetero=HETERO_KEYWORD, devices="|".join(available_devices) + hetero=HETERO_KEYWORD, devices="|".join(resolve_multi_device) ) self.multi_device_regex = r"(?:^{multi}(?P(?:{devices_ireq})(?:,(?:{devices_ireq}))*)$)".format( - multi=MULTI_DEVICE_KEYWORD, devices_ireq="{}?|".format(NIREQ_REGEX).join(available_devices) + multi=MULTI_DEVICE_KEYWORD, devices_ireq="{}?|".format(NIREQ_REGEX).join(resolve_multi_device) ) self.supported_device_regex = r"{multi}|{hetero}|{regular}".format( multi=self.multi_device_regex, hetero=self.hetero_regex, regular=self.regular_device_regex @@ -199,8 +203,8 @@ def check_model_source(entry, fetch_only=False, field_uri=None, validation_schem } specified = [] - for mo_source_option in sources: - if contains_all(entry, sources[mo_source_option]): + for mo_source_option, mo_source_value in sources.items(): + if contains_all(entry, mo_source_value): specified.append(mo_source_option) if not specified: @@ -234,7 +238,6 @@ def check_model_source(entry, fetch_only=False, field_uri=None, validation_schem 'kaldi_model': PathField(optional=True, description="Path to Kaldi model file."), 'cpu_extensions': CPUExtensionPathField(optional=True, description="Path to CPU extensions."), 'gpu_extensions': PathField(optional=True, description="Path to GPU extensions."), - 'bitstream': PathField(optional=True, description="Bitream (FPGA only)."), 'mo_params': DictField(optional=True, description="Model Optimizer parameters."), 'mo_flags': ListField(optional=True, description="Model Optimizer flags."), 'outputs': ListField(optional=True, description="Outputs."), @@ -266,11 +269,9 @@ def check_model_source(entry, fetch_only=False, field_uri=None, validation_schem '_tf_obj_detection_api_pipeline_config_path': PathField( optional=True, is_directory=False, description="TF Custom Operation Pipeline Config."), '_cpu_extensions_mode': StringField(optional=True, description="CPU extensions mode."), - '_aocl': PathField(optional=True, description="path to aocl (FPGA only)"), '_vpu_log_level': StringField( optional=True, choices=VPU_LOG_LEVELS, description="VPU LOG level: {}".format(', '.join(VPU_LOG_LEVELS)) ), - '_prev_bitstream': PathField(optional=True, description="path to bitstream from previous run (FPGA only)"), '_model_is_blob': BoolField(optional=True, description='hint for auto model search'), '_undefined_shapes_resolving_policy': StringField( optional=True, default='default', choices=['default', 'dynamic', 'static'], @@ -278,7 +279,10 @@ def check_model_source(entry, fetch_only=False, field_uri=None, validation_schem 'default - try to run as default, if does not work switch to static, ' 'dynamic - enforce network execution with dynamic shapes, ' 'static - convert undefined shapes to static before execution' - ) + ), + '_model_type': StringField( + choices=['xml', 'blob', 'onnx', 'paddle', 'tf'], + description='hint for model type in automatic model search', optional=True), } @@ -370,41 +374,36 @@ def mo_convert_model(config, launcher_parameters, framework=None): ) -def automatic_model_search(model_name, model_cfg, weights_cfg, model_is_blob): - def get_xml(model_dir): - models_list = list(model_dir.glob('{}.xml'.format(model_name))) - if not models_list: - models_list = list(model_dir.glob('*.xml')) - return models_list - - def get_blob(model_dir): - blobs_list = list(Path(model_dir).glob('{}.blob'.format(model_name))) - if not blobs_list: - blobs_list = list(Path(model_dir).glob('*.blob')) - return blobs_list - - def get_onnx(model_dir): - onnx_list = list(Path(model_dir).glob('{}.onnx'.format(model_name))) - if not onnx_list: - onnx_list = list(Path(model_dir).glob('*.onnx')) - return onnx_list +def automatic_model_search(model_name, model_cfg, weights_cfg, model_type=None): + model_type_ext = { + 'xml': 'xml', + 'blob': 'blob', + 'onnx': 'onnx', + 'paddle': 'pdmodel', + 'tf': 'pb' + } + def get_model_by_suffix(model_name, model_dir, suffix): + model_list = list(Path(model_dir).glob('{}.{}'.format(model_name, suffix))) + if not model_list: + model_list = list(Path(model_dir).glob('*.{}'.format(suffix))) + return model_list def get_model(): model = Path(model_cfg) if not model.is_dir(): - accepted_suffixes = ['.blob', '.onnx', '.xml'] - if model.suffix not in accepted_suffixes: + accepted_suffixes = list(model_type_ext.values()) + if model.suffix[1:] not in accepted_suffixes: raise ConfigError('Models with following suffixes are allowed: {}'.format(accepted_suffixes)) print_info('Found model {}'.format(model)) return model, model.suffix == '.blob' - if model_is_blob: - model_list = get_blob(model) + model_list = [] + if model_type is not None: + model_list = get_model_by_suffix(model_name, model, model_type_ext[model_type]) else: - model_list = get_xml(model) - if not model_list and model_is_blob is None: - model_list = get_blob(model) - if not model_list: - model_list = get_onnx(model) + for ext in model_type_ext.values(): + model_list = get_model_by_suffix(model_name, model, ext) + if model_list: + break if not model_list: raise ConfigError('suitable model is not found') if len(model_list) != 1: @@ -417,7 +416,7 @@ def get_model(): if is_blob: return model, None weights = weights_cfg - if (weights is None or Path(weights).is_dir()) and model.suffix != '.onnx': + if (weights is None or Path(weights).is_dir()) and model.suffix == '.xml': weights_dir = weights or model.parent weights = Path(weights_dir) / model.name.replace('xml', 'bin') if weights is not None: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher_readme.md b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher_readme.md index faffd0ff3e5..cd2136c81d5 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher_readme.md +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/dlsdk_launcher_readme.md @@ -1,16 +1,16 @@ # How to configure OpenVINO™ launcher OpenVINO™ launcher is one of the supported wrappers for easily launching models within Accuracy Checker tool. This launcher uses OpenVINO™ Inference Engine as inference backend and accepts for executing networks in OpenVINO™ supported formats. - +**Note:** Since OpenVINO™ 2022.1, API used as base for this launcher is deprecated, for usage new APO you can specify `--use_new_api True` in command line. More details about launcher with OpenVINO 2.0 API support can be found [here](openvino_launcher_readme.md) For enabling OpenVINO™ launcher you need to add `framework: dlsdk` in launchers section of your configuration file and provide following parameters: -* `device` - specifies which device will be used for infer. Supported: `CPU`, `GPU`, `FPGA`, `MYRIAD`, `HDDL`, +* `device` - specifies which device will be used for infer. Supported: `CPU`, `GPU`, `GNA`, `MYRIAD`, `HDDL`, Heterogeneous plugin as `HETERO:target_device,fallback_device` and Multi device plugin as `MULTI:target_device1,target_device2`. - If you have several MYRIAD devices in your machine, you are able to provide specific device id in such way: `MYRIAD.` (e.g. `MYRIAD.1.2-ma2480`) + If you have several devices in your machine, you are able to provide specific device id in such way: `.` (e.g. `MYRIAD.1.2-ma2480`) It is possible to specify one or more devices via `-td, --target devices` command line argument. Target device will be selected from command line (in case when several devices provided, evaluations will be run one by one with all specified devices). -* `model` - path to xml file with model for your topology or compiled executable network. +* `model` - path to model for your topology or compiled executable network. You also can provide path to directory with model for automatic model search inside directory and help to find it specifying `--model_type`. Supported model types: `xml`, `onnx`, `paddle`, `tf`, `blob`. * `weights` - path to bin file with weights for your topology (Optional, the argument can be omitted if bin file stored in the same directory with model xml or if you use compiled blob). * `adapter` - approach how raw output will be converted to representation of dataset problem, some adapters can be specific to framework. You can find detailed instruction how to use adapters [here](../adapters/README.md). @@ -22,7 +22,6 @@ Additionally you can provide device specific parameters: * `cpu_extensions` (path to extension file with custom layers for cpu). You can also use special key `AUTO` for automatic search cpu extensions library in the provided as command line argument directory (option `-e, --extensions`) * `gpu_extensions` (path to extension *.xml file with OpenCL kernel description for gpu). -* `bitstream` for running on FPGA. Launcher understands which batch size will be used from model intermediate representation (IR). If you want to use batch for infer, please, provide model with required batch or convert it using specific parameter in `mo_params`. @@ -91,7 +90,7 @@ OpenVINO™ launcher config example: ```yml launchers: - framework: dlsdk - device: HETERO:FPGA,CPU + device: HETERO:GPU,CPU caffe_model: path_to_model/alexnet.prototxt caffe_weights: path_to_weights/alexnet.caffemodel adapter: classification diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/gapi_launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/gapi_launcher.py index fffcefe3ad8..ce3ea4c9649 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/gapi_launcher.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/gapi_launcher.py @@ -120,6 +120,7 @@ def __init__(self, config_entry: dict, *args, **kwargs): self._delayed_model_loading = kwargs.get('delayed_model_loading', False) self.validate_config(config_entry, delayed_model_loading=self._delayed_model_loading) self.backend = self.get_value_from_config('backend') + print_info('backend: {}'.format(self.backend)) self.device = self.get_value_from_config('device').upper() if self.backend == 'ie' else '' self.comp = None self.network_args = None @@ -149,7 +150,7 @@ def __init__(self, config_entry: dict, *args, **kwargs): self.prepare_net() @classmethod - def validate_config(cls, config, fetch_only=False, delayed_model_loading=False, uri_prefix=''): + def validate_config(cls, config, delayed_model_loading=False, fetch_only=False, uri_prefix=''): return GAPILauncherConfigValidator( uri_prefix or 'launcher.{}'.format(cls.__provider__), fields=cls.parameters(), delayed_model_loading=delayed_model_loading diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/input_feeder.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/input_feeder.py index a53eb093d92..f48aa094f24 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/input_feeder.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/input_feeder.py @@ -60,7 +60,8 @@ 'I16': np.int16, # signed short 'I32': np.int32, # signed int 'I64': np.int64, # signed long int - 'STR': str, # string + 'STR': str, # string' + 'BOOL': bool } INPUT_TYPES_WITHOUT_VALUE = ['IMAGE_INFO', 'ORIG_IMAGE_INFO', 'IGNORE_INPUT', 'LSTM_INPUT', 'SCALE_FACTOR'] @@ -69,7 +70,7 @@ class InputFeeder: def __init__( self, inputs_config, network_inputs, shape_checker, prepare_input_data=None, default_layout='NCHW', - dummy=False, input_precisions_list=None + dummy=False, input_precisions_list=None, input_layouts=None ): def fit_to_input(data, input_layer_name, layout, precision, template=None): layout_used = False @@ -93,11 +94,11 @@ def fit_to_input(data, input_layer_name, layout, precision, template=None): self.default_layout = default_layout self.dummy = dummy self.ordered_inputs = False - self.configure(inputs_config, input_precisions_list) + self.configure(inputs_config, input_precisions_list, input_layouts) - def configure(self, inputs_config, precisions_list): + def configure(self, inputs_config, precisions_list, layouts): if not self.dummy: - parsing_results = self._parse_inputs_config(inputs_config, self.default_layout, precisions_list) + parsing_results = self._parse_inputs_config(inputs_config, self.default_layout, precisions_list, layouts) self.const_inputs, self.non_constant_inputs, self.inputs_mapping = parsing_results[:3] self.image_info_inputs, self.orig_image_info_inputs, self.scale_factor_inputs = parsing_results[3:6] self.lstm_inputs = parsing_results[6] @@ -309,8 +310,9 @@ def fill_inputs_with_template(self, data_representation_batch, template=None): infer_inputs.update(self.const_inputs) return inputs, templates - def _parse_inputs_config(self, inputs_entry, default_layout='NCHW', precisions_list=None): + def _parse_inputs_config(self, inputs_entry, default_layout='NCHW', precisions_list=None, layouts=None): precision_info = self.validate_input_precision(precisions_list) + layouts_info = self.validate_input_layouts(layouts, self.network_inputs) constant_inputs = {} non_constant_inputs_mapping = {} config_non_constant_inputs = [] @@ -346,7 +348,7 @@ def _parse_inputs_config(self, inputs_entry, default_layout='NCHW', precisions_l if value is not None: value = re.compile(value) if not isinstance(value, int) else value non_constant_inputs_mapping[name] = value - layout = input_.get('layout', default_layout) + layout = input_.get('layout', layouts_info.get(name, default_layout)) layouts[name] = LAYER_LAYOUT_TO_IMAGE_LAYOUT[layout] self.get_layer_precision(input_, name, precision_info, precisions) @@ -358,9 +360,9 @@ def _parse_inputs_config(self, inputs_entry, default_layout='NCHW', precisions_l if config_non_constant_inputs and not_config_inputs: raise ConfigError('input value for {} are not presented in config.'.format(','.join(not_config_inputs))) non_constant_inputs = not_config_inputs + config_non_constant_inputs - if not_config_inputs and (precision_info or isinstance(precision_info, defaultdict)): + if not_config_inputs and (precision_info or isinstance(precision_info, defaultdict)) or layouts_info: inputs_entry = self.provide_input_config_for_not_config( - inputs_entry, precision_info, not_config_inputs, precisions + inputs_entry, precision_info, not_config_inputs, precisions, layouts_info ) return ( @@ -411,8 +413,7 @@ def calculate_num_splits(layers_data, batch_size): offset = 0 if total_tiles_num % batch_size == 0 else 1 splits_for_layer = (total_tiles_num // batch_size) + offset - if max_split_num < splits_for_layer: - max_split_num = splits_for_layer + max_split_num = max(max_split_num, splits_for_layer) return max_split_num @@ -458,6 +459,24 @@ def separate_data(data, num_splits): return [batch_data], template_for_shapes + @staticmethod + def validate_input_layouts(parameter_string, input_names): + # Parse parameter string like "input0[value0],input1[value1]" or "[value]" (applied to all inputs) + return_value = {} + if parameter_string: + matches = re.findall(r'(.*?)\[(.*?)\],?', parameter_string) + if matches: + for match in matches: + input_name, value = match + if input_name != '': + return_value[input_name] = value + else: + return_value = {k: value for k in input_names} + break + else: + raise ConfigError(f"Can't parse input parameter: {parameter_string}") + return return_value + def validate_input_precision(self, precisions_list): if not precisions_list: return {} @@ -492,11 +511,13 @@ def get_layer_precision(input_config, input_name, precision_info, precisions): precisions[input_name] = input_precision return input_precision - def provide_input_config_for_not_config(self, inputs_entry, precision_info, not_config_inputs, precisions): + def provide_input_config_for_not_config(self, inputs_entry, precision_info, not_config_inputs, precisions, layouts): for input_name in not_config_inputs: input_config = {'name': input_name, 'type': 'INPUT'} precision = self.get_layer_precision(input_config, input_name, precision_info, precisions) - if precision is not None: + layout = layouts.get(input_name) + input_config['layout'] = layout + if precision is not None or layout is not None: inputs_entry.append(input_config) return inputs_entry diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/launcher.py index 9eba3f785b9..4922021aa48 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/launcher.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/launcher.py @@ -124,7 +124,7 @@ def __init__(self, config_entry, *args, model_name='', **kwargs): self.image_info_inputs = self.config.get('_list_image_infos', []) self._lstm_inputs = self.config.get('_list_lstm_inputs', []) self._ignore_inputs = self.config.get('_list_ignore_inputs', []) - self._scale_factor_inputs = self.config.get('_list_scale_factor_inputs', []) + self._scale_factor_inputs = self.config.get('_list_scale_factors', []) self._delayed_model_loading = kwargs.get('delayed_model_loading', False) @classmethod @@ -155,7 +155,7 @@ def parameters(cls): '_list_ignore_inputs': ListField( allow_empty=True, optional=True, default=[], description='List of ignored inputs' ), - '_list_scale_factor_inputs': ListField( + '_list_scale_factors': ListField( allow_empty=True, optional=True, default=[], description='List of scale factor inputs' ), '_input_precision': ListField( @@ -164,7 +164,11 @@ def parameters(cls): '_kaldi_bin_dir': PathField(is_directory=True, optional=True, description='directory with Kaldi binaries'), '_kaldi_log_file': PathField( optional=True, description='File for saving Kaldi tools logs', check_exists=False - ) + ), + '_model_type': StringField(optional=True, description='hint for launcher for model search'), + '_input_layout': StringField(optional=True, + description='input layout in format input1[layout],input2[layout] or [layout]' + ) } @classmethod @@ -302,7 +306,7 @@ def __init__(self, config_entry, *args, **kwargs): msg = "{launcher} launcher is disabled. Please install {launcher} to enable it.".format(launcher=name) raise ValueError(error_message or msg) - def predict(self, data, meta=None, **kwargs): + def predict(self, inputs, metadata=None, **kwargs): raise NotImplementedError def release(self): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/mxnet_launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/mxnet_launcher.py index 1e598063351..9525ae6cd64 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/mxnet_launcher.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/mxnet_launcher.py @@ -64,7 +64,7 @@ def __init__(self, config_entry: dict, *args, **kwargs): except ImportError as import_error: raise ValueError( "MXNet isn't installed. Please, install it before using. \n{}".format(import_error.msg) - ) + ) from import_error super().__init__(config_entry, *args, **kwargs) self._delayed_model_loading = kwargs.get('delayed_model_loading', False) @@ -111,7 +111,7 @@ def __init__(self, config_entry: dict, *args, **kwargs): def batch(self): return self._batch - def fit_to_input(self, data, input_layer, layout, precision, template=None): + def fit_to_input(self, data, layer_name, layout, precision, template=None): if layout: data = np.transpose(data, layout) return self.mxnet.nd.array(data.astype(precision) if precision else data) @@ -121,7 +121,7 @@ def inputs(self): return self._inputs @classmethod - def validate_config(cls, config, fetch_only=False, delayed_model_loading=False, uri_prefix=''): + def validate_config(cls, config, delayed_model_loading=False, fetch_only=False, uri_prefix=''): return MxNetLauncherConfigValidator( uri_prefix or 'launcher.{}'.format(cls.__provider__), fields=cls.parameters(), delayed_model_loading=delayed_model_loading diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/onnx_launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/onnx_launcher.py index 49a118e510b..d5f72252c30 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/onnx_launcher.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/onnx_launcher.py @@ -17,7 +17,7 @@ import re from pathlib import Path import numpy as np -import onnxruntime.backend as backend +from onnxruntime import backend import onnxruntime as onnx_rt from ..logging import warning from ..config import PathField, StringField, ListField, ConfigError diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/opencv_launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/opencv_launcher.py index 567d1d610eb..35ba7f4a0dc 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/opencv_launcher.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/opencv_launcher.py @@ -108,7 +108,7 @@ def __init__(self, config_entry: dict, *args, **kwargs): self.output_names = self.network.getUnconnectedOutLayersNames() @classmethod - def validate_config(cls, config, fetch_only=False, delayed_model_loading=False, uri_prefix=''): + def validate_config(cls, config, delayed_model_loading=False, fetch_only=False, uri_prefix=''): return OpenCVLauncherConfigValidator( uri_prefix or 'launcher.{}'.format(cls.__provider__), fields=cls.parameters(), delayed_model_loading=delayed_model_loading diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/openvino_launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/openvino_launcher.py new file mode 100644 index 00000000000..fa1180d8838 --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/openvino_launcher.py @@ -0,0 +1,872 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" +#pylint:disable=no-name-in-module +#pylint:disable=package-absolute-imports +import multiprocessing +from pathlib import Path +import re +import warnings +import numpy as np +from openvino.ie_api import Core, AsyncInferQueue +from openvino.pyopenvino import get_version +from openvino.impl import Type, PartialShape +from .dlsdk_launcher_config import ( + HETERO_KEYWORD, MULTI_DEVICE_KEYWORD, NIREQ_REGEX, VPU_PLUGINS, + get_cpu_extension, mo_convert_model, + DLSDK_LAUNCHER_PARAMETERS, + DLSDKLauncherConfigValidator, + parse_partial_shape, + automatic_model_search +) +from .dlsdk_async_request import AsyncInferRequestWrapper + +from ..config import ConfigError +from ..logging import warning +from ..utils import ( + read_yaml, + contains_any, + string_to_tuple, + get_or_parse_value, +) +from .launcher import Launcher +from ..logging import print_info +from .input_feeder import PRECISION_TO_DTYPE + + +format_map = { + 'f32': np.float32, + 'i32': np.int32, + 'i64': np.int64, + 'fp16': np.float16, + 'i16': np.int16, + 'u16': np.uint16, + 'i8': np.int8, + 'u8': np.uint8, + 'boolean': np.uint8 +} + +PRECISION_STR_TO_TYPE = { + 'FP32': Type.f32, + 'FP16': Type.f16, + 'U8': Type.u8, + 'U16': Type.u16, + 'I8': Type.i8, + 'I16': Type.i16, + 'I32': Type.i32, + 'I64': Type.i64, + 'BOOL': Type.boolean +} + + +# pylint:disable=R0904 +class OpenVINOLauncher(Launcher): + """ + Class for infer model using DLSDK framework. + """ + + __provider__ = 'openvino' + + @classmethod + def parameters(cls): + parameters = super().parameters() + parameters.update(DLSDK_LAUNCHER_PARAMETERS) + + return parameters + + def __init__(self, config_entry, model_name='', delayed_model_loading=False, + preprocessor=None, postpone_inputs_configuration=False): + super().__init__(config_entry, model_name=model_name) + + self._set_variable = False + self.ie_config = self.config.get('ie_config') + self.ie_core = Core() + if self.ie_config: + self.ie_core.set_config(self.ie_config) + self._delayed_model_loading = delayed_model_loading + dlsdk_launcher_config = DLSDKLauncherConfigValidator( + 'OpenVINO_Launcher', fields=self.parameters(), delayed_model_loading=delayed_model_loading, + ) + dlsdk_launcher_config.validate(self.config, ie_core=self.ie_core) + device = self.config['device'].split('.') + self._device = '.'.join((device[0].upper(), device[1])) if len(device) > 1 else device[0].upper() + self.dynamic_shapes_policy = self.get_value_from_config('_undefined_shapes_resolving_policy') + self._set_variable = False + self._async_mode = False + self._prepare_ie() + self._delayed_model_loading = delayed_model_loading + self._postpone_input_configuration = postpone_inputs_configuration + self._preprocess_info = {} + self._preprocess_steps = [] + self.disable_resize_to_input = False + self._do_reshape = False + self._output_layouts = {} + self._output_precisions = {} + self.dyn_input_layers = [] + self._partial_shapes = {} + self.is_dynamic = False + self.preprocessor = preprocessor + self.infer_request = None + + if not delayed_model_loading: + if dlsdk_launcher_config.need_conversion: + self._model, self._weights = mo_convert_model( + self.config, self.parameters(), dlsdk_launcher_config.framework + ) + else: + self._model, self._weights = automatic_model_search( + self._model_name, self.get_value_from_config('model'), + self.get_value_from_config('weights'), + self.get_value_from_config('_model_type') + ) + self.load_network(log=True, preprocessing=preprocessor) + self.allow_reshape_input = self.get_value_from_config('allow_reshape_input') and self.network is not None + self.try_to_set_default_layout() + else: + self.allow_reshape_input = self.get_value_from_config('allow_reshape_input') + self._target_layout_mapping = {} + self._lstm_inputs = None + if '_list_lstm_inputs' in self.config: + self._configure_lstm_inputs() + self.reset_memory_state = self.get_value_from_config('reset_memory_state') + + @classmethod + def validate_config(cls, config, delayed_model_loading=False, fetch_only=False, uri_prefix=''): + field_uri = uri_prefix or 'launcher.{}'.format(cls.__provider__) + return DLSDKLauncherConfigValidator( + field_uri, fields=cls.parameters(), delayed_model_loading=delayed_model_loading).validate( + config, field_uri=field_uri, validation_scheme=cls.validation_scheme(), fetch_only=fetch_only) + + def try_to_set_default_layout(self): + if self.get_value_from_config('_model_type') == 'tf': + self.default_layout = 'NHWC' + input_nodes = self.network.inputs if self.network else self.exec_network.inputs + for input_node in input_nodes: + shape = parse_partial_shape(input_node.get_node().partial_shape) + if len(shape) != 4: + continue + if shape[-1] in [1, 3, 4]: + self.default_layout = 'NHWC' + return + self.default_layout = 'NCHW' + return + + + @property + def device(self): + return self._device + + @property + def inputs(self): + if self.network is None: + inputs = self.exec_network.inputs + else: + inputs = self.network.inputs + return {input_info.get_node().friendly_name: input_info.get_node() for input_info in inputs} + + @property + def batch(self): + return self._batch + + @property + def output_blob(self): + if hasattr(self, 'original_outputs'): + return next(iter(self.original_outputs)).get_node().friendly_name + return None + + def predict(self, inputs, metadata=None, **kwargs): + if self._lstm_inputs: + return self._predict_sequential(inputs, metadata) + + results = [] + for infer_inputs in inputs: + if self._do_reshape: + input_shapes = {layer_name: data.shape for layer_name, data in infer_inputs.items()} + self._reshape_input(input_shapes) + if self.infer_request is None: + self.infer_request = self.exec_network.create_infer_request() + outputs = self.infer_request.infer(inputs=infer_inputs) + results.append({ + out_node.get_node().friendly_name: out_res + for out_node, out_res in zip(self.exec_network.outputs, outputs) + }) + if self.reset_memory_state: + for state in self.infer_request.query_state(): + state.reset() + + if metadata is not None: + self._fill_meta(metadata) + self._do_reshape = False + + return results + + def _predict_sequential(self, inputs, metadata=None, **kwargs): + lstm_inputs_feed = self._fill_lstm_inputs() + results = [] + for feed_dict in inputs: + feed_dict.update(lstm_inputs_feed) + out_tensors = self.exec_network.infer_new_request(feed_dict) + output_result = { + out_node.get_node().friendly_name: out_tensor + for out_node, out_tensor in zip(self.exec_network.outputs, out_tensors) + } + lstm_inputs_feed = self._fill_lstm_inputs(output_result) + results.append(output_result) + + if self._do_reshape: + input_shapes = {layer_name: data.shape for layer_name, data in feed_dict.items()} + self._reshape_input(input_shapes) + + if metadata is not None: + self._fill_meta(metadata) + self._do_reshape = False + return results + + def predict_async(self, ir, inputs, metadata=None, context=None, **kwargs): + infer_inputs = inputs[0] + if metadata is not None: + self._fill_meta(metadata) + ir.infer(infer_inputs, metadata, context) + + def _fill_meta(self, metadata): + for meta_ in metadata: + meta_['input_shape'] = self.inputs_info_for_meta() + if self._output_layouts: + meta_['output_layout'] = self._output_layouts + if self._output_precisions: + meta_['output_precision'] = self._output_precisions + + def _is_hetero(self): + return self._device.startswith(HETERO_KEYWORD) + + def _is_multi(self): + return self._device.startswith(MULTI_DEVICE_KEYWORD) + + def _devices_list(self): + device = self._device + if self._is_hetero(): + device = self._device[len(HETERO_KEYWORD):] + if self._is_multi(): + device = self._device[len(MULTI_DEVICE_KEYWORD):] + device = re.sub(NIREQ_REGEX, '', device) + return [platform_.upper().strip() for platform_ in device.split(',')] + + def _set_affinity(self, affinity_map_path): + auto_affinity = self.ie_core.query_network(self.network, self._device) + custom_affinity = read_yaml(affinity_map_path) + for layer in custom_affinity: + if layer not in auto_affinity: + raise ConfigError('Layer \'{layer}\' is not present in network'.format(layer=layer)) + for node in self.network.get_ordered_ops(): + layer_name = node.friendly_name + device = custom_affinity.get(layer_name, auto_affinity.get(layer_name)) + if device is None: + continue + if not (device in self._devices_list() or device == self._device): + raise ConfigError( + 'Device \'{device}\' set for \'{layer}\' layer is not present in ' + 'provided configuration \'{configuration}\''.format( + device=device, layer=layer_name, configuration=self._device + ) + ) + node.rt_info["affinity"] = device + + def _is_vpu(self): + device_list = map(lambda device: device.split('.')[0], self._devices_list()) + return contains_any(device_list, VPU_PLUGINS) + + @property + def num_requests(self): + return self._num_requests + + @num_requests.setter + def num_requests(self, num_ireq: int): + if num_ireq != self._num_requests: + self._num_requests = num_ireq + + @property + def async_mode(self): + return self._async_mode + + @async_mode.setter + def async_mode(self, flag): + if flag: + if 'CPU' in self._devices_list(): + self.ie_core.set_config({'CPU_THROUGHPUT_STREAMS': 'CPU_THROUGHPUT_AUTO'}, 'CPU') + if 'GPU' in self._devices_list(): + self.ie_core.set_config({'GPU_THROUGHPUT_STREAMS': 'GPU_THROUGHPUT_AUTO'}, 'GPU') + self._async_mode = flag + + def get_async_requests(self): + return [ + AsyncInferRequestWrapper(ireq_id, self.exec_network.create_infer_request()) + for ireq_id in range(self.num_requests)] + + def _reshape_input(self, shapes, make_dynamic=False): + if hasattr(self, 'exec_network'): + del self.exec_network + if self.infer_request is not None: + self.infer_request = None + self.network.reshape({k: PartialShape(shape) for k, shape in shapes.items()}) + self.dyn_input_layers, self._partial_shapes = self.get_dynamic_inputs(self.network) + if self.dyn_input_layers and make_dynamic: + return + self.exec_network = self.ie_core.compile_model(self.network, self.device) + + def _align_data_shape(self, data, input_blob, data_layout): + input_shape = self.inputs[input_blob].shape + data_batch_size = data.shape[0] + input_batch_size = input_shape[0] + if data_batch_size < input_batch_size: + warning_message = 'data batch {} is not equal model input batch_size {}.'.format( + data_batch_size, input_batch_size + ) + warning(warning_message) + diff_number = input_batch_size - data_batch_size + filled_part = [data[-1]] * diff_number + data = np.concatenate([data, filled_part]) + return data.reshape(input_shape) if not self.disable_resize_to_input else data + + def _prepare_ie(self, log=True): + if log: + print_info('IE version: {}'.format(get_version())) + if self._is_multi(): + self._prepare_multi_device(log) + else: + self.async_mode = self.get_value_from_config('async_mode') + self._set_nireq() + if log: + self._log_versions() + self._device_specific_configuration() + + def _device_specific_configuration(self): + cpu_extensions = self.config.get('cpu_extensions') + if 'CPU' in self._devices_list(): + if cpu_extensions: + selection_mode = self.config.get('_cpu_extensions_mode') + cpu_extensions = get_cpu_extension(cpu_extensions, selection_mode) + self.ie_core.add_extension(str(cpu_extensions), 'CPU') + self.ie_core.set_config({'CPU_BIND_THREAD': 'YES' if not self._is_multi() else 'NO'}, 'CPU') + gpu_extensions = self.config.get('gpu_extensions') + if 'GPU' in self._devices_list(): + config = {} + if gpu_extensions: + config['CONFIG_FILE'] = str(gpu_extensions) + if self._is_multi() and 'CPU' in self._devices_list(): + config['CLDNN_PLUGIN_THROTTLE'] = '1' + if config: + self.ie_core.set_config(config, 'GPU') + if self._is_vpu(): + device_list = map(lambda device: device.split('.')[0], self._devices_list()) + devices = [vpu_device for vpu_device in VPU_PLUGINS if vpu_device in device_list] + log_level = self.config.get('_vpu_log_level') + if log_level: + for device in devices: + self.ie_core.set_config({'LOG_LEVEL': log_level}, device) + device_config = self.config.get('device_config') + if device_config: + self._set_device_config(device_config) + + def _set_nireq(self): + num_requests = self.config.get('num_requests') + if num_requests is not None and num_requests != 'AUTO': + num_requests = get_or_parse_value(num_requests, casting_type=int) + if len(num_requests) != 1: + raise ConfigError('Several values for _num_requests specified') + self._num_requests = num_requests[0] + if self._num_requests != 1 and not self.async_mode: + warning('{} infer requests in sync mode is not supported. Only 1 infer request will be used.') + self._num_requests = 1 + elif not self.async_mode: + self._num_requests = 1 + else: + self._num_requests = self.auto_num_requests() + if self.async_mode: + print_info('Async mode activated') + print_info('Infer requests number:{}'.format(self.num_requests)) + + def auto_num_requests(self, return_list=False): + concurrency_device = {'CPU': 1, 'GPU': 1, 'HDDL': 100, 'MYRIAD': 4} + platform_list = self._devices_list() + if 'CPU' in platform_list and len(platform_list) == 1: + min_requests = [4, 5, 3] + cpu_count = multiprocessing.cpu_count() + for min_request in min_requests: + if cpu_count % min_request == 0: + num_req = max(min_request, cpu_count / min_request) + return num_req if not return_list else [num_req] + if 'GPU' in platform_list and len(platform_list) == 1: + return 2 if not return_list else [2] + per_device_requests = [] + for device in platform_list: + per_device_requests.append(concurrency_device.get(device, 1)) + return per_device_requests if return_list else sum(per_device_requests) + + def _prepare_multi_device(self, log=True): + async_mode = self.get_value_from_config('async_mode') + if not async_mode: + warning('Using multi device in sync mode non-applicable. Async mode will be used.') + num_per_device_req = re.findall(NIREQ_REGEX, self._device) + device_list = self._devices_list() + num_devices = len(device_list) + if num_per_device_req: + brackets = r"(\()|(\))" + num_per_device_requests = [int(re.sub(brackets, '', nreq)) for nreq in num_per_device_req] + if 'num_requests' in self.config: + warning( + "number requests already provided in device name specification. " + "'num_requests' option will be ignored." + ) + elif 'num_requests' in self.config and self.config['num_requests'] != 'AUTO': + num_per_device_requests = get_or_parse_value(self.config['num_request'], casting_type=int) + else: + num_per_device_requests = self.auto_num_requests(return_list=True) + if len(num_per_device_requests) == 1: + num_per_device_requests = [num_per_device_requests[0]] * len(device_list) + if num_devices != len(num_per_device_requests): + raise ConfigError('num requests for all {} should be specified'.format(num_devices)) + self._num_requests = sum(num_per_device_requests) * 2 + if log: + self._log_versions() + print_info('Async mode activated') + print_info('Request number for each device:') + for device, nreq in zip(device_list, num_per_device_requests): + print_info(' {} - {}'.format(device, nreq)) + + def _set_device_config(self, device_config): + if not isinstance(device_config, dict): + raise ConfigError('device configuration should be a dict-like') + if all(not isinstance(value, dict) for value in device_config.values()): + self.ie_core.set_config(dict(device_config), self.device) + else: + for key, value in device_config.items(): + if isinstance(value, dict): + if key in self._devices_list(): + if key not in self.ie_core.available_devices: + warnings.warn('{} device is unknown. Config loading may lead to error.'.format(key)) + self.ie_core.set_config(dict(value), key) + else: + warnings.warn( + f'Configuration for {key} will be skipped as device is not listed in evaluation device' + ) + else: + warnings.warn('Option {key}: {value} will be skipped because device to which it should be ' + 'applied is not specified or option is not a dict-like'.format(key=key, value=value)) + + def _log_versions(self): + versions = self.ie_core.get_versions(self._device) + print_info("Loaded {} plugin version:".format(self._device)) + for device_name, device_version in versions.items(): + print_info(" {device_name} - {descr}: {maj}.{min}.{num}".format( + device_name=device_name, descr=device_version.description, maj=device_version.major, + min=device_version.minor, num=device_version.build_number + )) + + def _create_network(self, input_shapes=None): + model_path = Path(self._model) + compiled_model = model_path.suffix == '.blob' + if compiled_model: + self.network = None + self.exec_network = self.ie_core.import_model(str(self._model), self._device) + self.original_outputs = list(self.exec_network.outputs.keys()) + has_info = hasattr(self.exec_network, 'input_info') + if has_info: + ie_input_info = {name: data.input_data for name, data in self.exec_network.input_info.items()} + else: + ie_input_info = self.exec_network.inputs + first_input = next(iter(ie_input_info)) + input_info = ie_input_info[first_input] + batch_pos = input_info.layout.find('N') + self._batch = input_info.shape[batch_pos] if batch_pos != -1 else 1 + return + if self._weights is None and self._model.suffix != '.onnx': + self._weights = model_path.parent / (model_path.name.split(model_path.suffix)[0] + '.bin') + self.network = self.read_network(self._model, self._weights) + self.original_outputs = self.network.outputs + outputs = self.config.get('outputs') + if outputs: + def output_preprocessing(output_string): + output_tuple = string_to_tuple(output_string, casting_type=None) + if len(output_tuple) == 1: + return output_string + return output_tuple[0], int(output_tuple[1]) + + preprocessed_outputs = [output_preprocessing(output) for output in outputs] + self.network.add_outputs(preprocessed_outputs) + if input_shapes is not None: + self.network.reshape(input_shapes) + self._batch = self.config.get('batch', 1) + affinity_map_path = self.config.get('affinity_map') + if affinity_map_path and self._is_hetero(): + self._set_affinity(affinity_map_path) + elif affinity_map_path: + warning('affinity_map config is applicable only for HETERO device') + + def load_network(self, network=None, log=False, preprocessing=None): + if hasattr(self, 'exec_network'): + del self.exec_network + if network is None: + self._create_network() + else: + self.network = network + if self.network is not None: + self.dyn_input_layers, self._partial_shapes = self.get_dynamic_inputs(self.network) + + if not self._postpone_input_configuration: + self._set_precision() + self._set_input_shape() + self.dyn_input_layers, self._partial_shapes = self.get_dynamic_inputs(self.network) + if log: + self._print_input_output_info() + if preprocessing: + self._set_preprocess(preprocessing) + if self.network and not preprocessing and (not self.dyn_input_layers or self.is_dynamic): + self.exec_network = self.ie_core.compile_model( + self.network, self._device + ) + + def update_input_configuration(self, input_config): + self.config['inputs'] = input_config + self._set_precision() + self._set_input_shape() + self.try_to_set_default_layout() + self.dyn_input_layers, self._partial_shapes = self.get_dynamic_inputs(self.network) + self._print_input_output_info() + if self.preprocessor: + self._set_preprocess(self.preprocessor) + if self.network: + self.exec_network = self.ie_core.compile_model( + self.network, self._device + ) + + @staticmethod + def get_dynamic_inputs(network): + def is_dynamic(data_info): + if hasattr(data_info, 'is_dynamic'): + return data_info.is_dynamic + return -1 in data_info.shape or not data_info.shape + + inputs_with_undefined_shapes = [] + partial_shapes = {} + if network is None: + return inputs_with_undefined_shapes, partial_shapes + + for input_info in network.inputs: + input_node = input_info.get_node() + input_shape = input_node.get_partial_shape() + if is_dynamic(input_shape): + inputs_with_undefined_shapes.append(input_node.friendly_name) + partial_shapes[input_node.friendly_name] = input_shape + + return inputs_with_undefined_shapes, partial_shapes + + @property + def dyn_batch_only(self): + if not self.dyn_input_layers: + return True + for input_name in self.dyn_input_layers: + partial_shape = self._partial_shapes[input_name] + layout = self.inputs[input_name].layout + if str(layout) == '[...]': + layout = self.get_layout_from_config(input_name) + if not layout: + return False + for dim, layout_dim in zip(partial_shape, layout): + if dim == -1 and layout_dim != 'N': + return False + return True + + def get_layout_from_config(self, input_name): + for input_config in self.config.get('inputs', []): + if input_config.get('name', '') != input_name: + continue + return input_config.get('layout', '') + return '' + + def load_ir(self, xml_path, bin_path, log=False): + self._model = xml_path + self._weights = bin_path + self.load_network(log=log) + self.try_to_set_default_layout() + + def read_network(self, model, weights): + network = self.ie_core.read_model(model=str(model), weights=str(weights)) + return network + + def inputs_info_for_meta(self): + return { + layer_name: parse_partial_shape(layer.get_partial_shape()) for layer_name, layer in self.inputs.items() + if layer_name not in self.const_inputs + self.image_info_inputs + } + + def initialize_undefined_shapes(self, input_data, template_shapes=None): + if self.dynamic_shapes_policy in ['default', 'dynamic']: + try: + if template_shapes: + input_shapes = { + layer_name: template_shapes.get(layer_name, data.shape) for layer_name, data in + input_data[0].items() + } + self._reshape_input(input_shapes) + self.load_network(self.network) + self.is_dynamic = True + if not hasattr(self, 'exec_network') or self.exec_network is None: + self.is_dynamic = True + self.load_network(self.network) + self.exec_network.infer_new_request(input_data[0]) + return + except RuntimeError as e: + if self.dynamic_shapes_policy == 'dynamic': + raise e + self.is_dynamic = False + input_shapes = {layer_name: data.shape for layer_name, data in input_data[0].items()} + self._reshape_input(input_shapes) + + def resolve_undefined_batch(self): + if self.dynamic_shapes_policy in ['default', 'dynamic']: + try: + self.is_dynamic = True + self.load_network(self.network) + except RuntimeError as e: + if self.dynamic_shapes_policy == 'dynamic': + raise e + self.is_dynamic = False + if not self.is_dynamic: + self.load_network(self.network) + + def fit_to_input(self, data, layer_name, layout, precision, template=None): + if precision is None: + precision = format_map[self.inputs[layer_name].element_type.get_type_name()] + if layer_name in self.dyn_input_layers: + layer_rang = len(parse_partial_shape(self._partial_shapes[layer_name])) + input_template = template.get(layer_name) if template else template + data, l_template = self._data_to_blob_dyn(layer_rang, data, layout, input_template) + layer_shape = data.shape + if l_template is not None: + template[layer_name] = l_template + else: + layer_shape = tuple(self.inputs[layer_name].shape) + precision = format_map[self.inputs[layer_name].element_type.get_type_name()] + data = self._data_to_blob(layer_shape, data, layout) + if precision: + data = data.astype(precision) + if layer_name in self.dyn_input_layers: + self._do_reshape = not self.is_dynamic + return data, template + data_shape = np.shape(data) + if data_shape != layer_shape: + if self.allow_reshape_input: + self._do_reshape = True + return data + return self._align_data_shape(data, layer_name, layout) + + @staticmethod + def _data_to_blob_dyn(layer_rang, data, layout, template=None): + data_shape = np.shape(data) + if len(data_shape) - layer_rang == 1 and data_shape[0] == 1: + data = data[0] + data_shape = np.shape(data) + if template is not None: + if len(template) < np.ndim(data): + template = [1] * (np.ndim(data) - len(template)) + template + if len(template) > np.ndim(data): + template = template[0] + if len(layout) == len(data_shape): + if template is not None: + new_template = [template[l_dim] for l_dim in layout] + template = new_template + return np.transpose(data, layout), template + return np.array(data), template + + def _data_to_blob(self, layer_shape, data, layout): # pylint:disable=R0911,R0912 + data_shape = np.shape(data) + if len(layer_shape) == 4: + if len(data_shape) == 5: + data = data[0] + if len(data_shape) == 3: + data = np.expand_dims(data, -1) + data_shape = np.shape(data) + if len(data_shape) < 4: + if len(np.squeeze(np.zeros(layer_shape))) == len(np.squeeze(np.zeros(data_shape))): + return np.resize(data, layer_shape) + return np.transpose(data, layout) if layout is not None else data + if len(layer_shape) == 2: + if len(data_shape) == 1: + return np.transpose([data]) + if len(data_shape) > 2: + if all(dim == 1 for dim in layer_shape) and all(dim == 1 for dim in data_shape): + return np.resize(data, layer_shape) + if len(np.squeeze(np.zeros(layer_shape))) == len(np.squeeze(np.zeros(data_shape))): + return np.resize(data, layer_shape) + if len(layer_shape) == 3 and len(data_shape) == 4: + return np.transpose(data, layout)[0] if layout is not None else data[0] + if len(layer_shape) == 1: + return np.resize(data, layer_shape) + if (len(data_shape) == 3) and (len(layer_shape) == 2) and (data_shape[0] == 1) and ( + data_shape[1] == 1) and self.allow_reshape_input: + return data[0] + if layout is not None and len(layer_shape) == len(layout): + return np.transpose(data, layout) + if ( + len(layer_shape) == 1 and len(data_shape) > 1 and + len(np.squeeze(np.zeros(layer_shape))) == len(np.squeeze(np.zeros(data_shape))) + ): + return np.resize(data, layer_shape) + return np.array(data) + + def _set_precision(self): + config_inputs = self.config.get('inputs', []) + for input_config in config_inputs: + if 'precision' in input_config: + if self.network: + self.inputs[input_config['name']].set_element_type( + PRECISION_STR_TO_TYPE[input_config['precision'].upper()] + ) + + def _set_input_shape(self): + if not self.network: + return + config_inputs = self.config.get('inputs', []) + input_shapes = {} + make_dynamic = False + for input_config in config_inputs: + if 'shape' in input_config: + input_shapes[input_config['name']] = input_config['shape'] + if -1 in input_config['shape']: + make_dynamic = True + if not input_shapes: + return + orig_input_shapes = {input_name: input_info.shape for input_name, input_info in self.inputs.items()} + orig_input_shapes.update(input_shapes) + self._reshape_input(orig_input_shapes, make_dynamic) + + def _configure_lstm_inputs(self): + lstm_mapping = {} + config_inputs = self.config.get('inputs', []) + for input_config in config_inputs: + if input_config['type'] == 'LSTM_INPUT': + lstm_mapping[input_config['name']] = input_config['value'] + self._lstm_inputs = lstm_mapping + + def _fill_lstm_inputs(self, infer_outputs=None): + feed_dict = {} + for lstm_var, output_layer in self._lstm_inputs.items(): + layer_shape = self.inputs[lstm_var].shape + input_data = infer_outputs[output_layer].reshape(layer_shape) if infer_outputs else np.zeros( + layer_shape, dtype=PRECISION_TO_DTYPE[self.inputs[lstm_var].precision] + ) + feed_dict[lstm_var] = input_data + return feed_dict + + def _print_input_output_info(self): + print_info('Input info:') + if self.network: + network_inputs = self.network.inputs + network_outputs = self.network.outputs + else: + network_inputs = self.exec_network.inputs + network_outputs = self.exec_network.outputs + for input_info in network_inputs: + input_node = input_info.get_node() + print_info('\tLayer name: {}'.format(input_node.friendly_name)) + print_info('\tprecision: {}'.format(input_node.element_type.get_type_name())) + print_info('\tshape: {}\n'.format(parse_partial_shape(input_node.get_partial_shape()))) + print_info('Output info') + for output_info in network_outputs: + out_node = output_info.get_node() + print_info('\tLayer name: {}'.format(out_node.friendly_name)) + precision = out_node.get_output_element_type(0).get_type_name() + print_info('\tprecision: {}'.format(precision)) + shape = parse_partial_shape(out_node.get_output_partial_shape(0)) + print_info('\tshape: {}\n'.format(shape)) + self._output_precisions[out_node.friendly_name] = format_map[precision] + + def _set_preprocess(self, preprocess): + if preprocess.ie_processor is None: + return + if self.network is not None: + self.disable_resize_to_input = False + preprocess_steps = preprocess.ie_preprocess_steps + if not preprocess_steps: + return + for input_name, input_info in self.network.input_info.items(): + if input_name in self.const_inputs + self.image_info_inputs: + continue + for (name, value) in preprocess_steps: + setattr(input_info.preprocess_info, name, value) + if preprocess.ie_processor.has_normalization(): + channel_id = input_info.layout.find('C') + if channel_id != -1: + num_channels = input_info.input_data.shape[channel_id] + preprocess.ie_processor.set_normalization(num_channels, input_info.preprocess_info) + self.disable_resize_to_input = preprocess.ie_processor.has_resize() + self._use_set_blob = self.disable_resize_to_input + self.load_network(self.network) + self._preprocess_steps = preprocess_steps + return + preprocess_info_by_input = {} + preprocess_info = preprocess.preprocess_info + for input_name in self.inputs: + if input_name in self.const_inputs + self.image_info_inputs: + continue + if preprocess.ie_processor.has_normalization(): + channel_id = self.inputs[input_name].layout.find('C') + if channel_id != -1: + num_channels = self.inputs[input_name].shape[channel_id] + preprocess.ie_processor.set_normalization(num_channels, preprocess_info) + preprocess_info_by_input[input_name] = preprocess_info + self._preprocess_info = preprocess_info_by_input + self.disable_resize_to_input = preprocess.ie_processor.has_resize() + + def get_model_file_type(self): + return self._model.suffix + + def get_infer_queue(self, log=True): + if self.config.get('num_requests', 'AUTO') == 'AUTO': + num_requests = 0 + else: + num_requests = self.num_requests + queue = AsyncInferQueue(self.exec_network, num_requests) + if log: + print_info('Prepared async infer queue with {} requests'.format(len(queue))) + return queue + + def prepare_data_for_request(self, + inputs, batch_meta, batch_id, batch_input_ids, + batch_annotation, batch_identifiers): + infer_inputs = inputs[0] + if batch_meta is not None: + self._fill_meta(batch_meta) + context = (batch_id, batch_input_ids, batch_annotation, batch_identifiers, batch_meta) + return infer_inputs, context + + def get_result_from_request(self, request): + return [{ + out.get_node().friendly_name: tensor.data for out, tensor + in zip(self.exec_network.outputs, request.output_tensors)} + ] + + def input_shape(self, input_name): + return parse_partial_shape(self.inputs[input_name].get_partial_shape()) + + def release(self): + if 'network' in self.__dict__: + del self.network + if 'infer_request' in self.__dict__: + del self.infer_request + if 'exec_network' in self.__dict__: + del self.exec_network + if 'ie_core' in self.__dict__: + del self.ie_core diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/openvino_launcher_readme.md b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/openvino_launcher_readme.md new file mode 100644 index 00000000000..756f0badfcb --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/openvino_launcher_readme.md @@ -0,0 +1,102 @@ +# How to configure OpenVINO™ launcher + +OpenVINO™ launcher is one of the supported wrappers for easily launching models within Accuracy Checker tool. This launcher uses OpenVINO™ Inference Engine with support API 2.0 as inference backend and accepts for executing networks in OpenVINO™ supported formats. + +For enabling OpenVINO™ launcher you need to add `framework: openvino` in launchers section of your configuration file and provide following parameters: + +* `device` - specifies which device will be used for infer. Supported: `CPU`, `GPU`, `GNA`, `MYRIAD`, `HDDL`, + Heterogeneous plugin as `HETERO:target_device,fallback_device` and Multi device plugin as `MULTI:target_device1,target_device2`. + + If you have several devices in your machine, you are able to provide specific device id in such way: `.` (e.g. `MYRIAD.1.2-ma2480`) + + It is possible to specify one or more devices via `-td, --target devices` command line argument. Target device will be selected from command line (in case when several devices provided, evaluations will be run one by one with all specified devices). +* `model` - path to model for your topology or compiled executable network. You also can provide path to directory with model for automatic model search inside directory and help to find it specifying `--model_type`. Supported model types: `xml`, `onnx`, `paddle`, `tf`, `blob`. +* `weights` - path to bin file with weights for your topology (Optional, the argument can be omitted if bin file stored in the same directory with model xml or if you use compiled blob). +* `adapter` - approach how raw output will be converted to representation of dataset problem, some adapters can be specific to framework. You can find detailed instruction how to use adapters [here](../adapters/README.md). + +**Note:** + You can generate executable blob using [compile_tool](https://docs.openvinotoolkit.org/latest/_inference_engine_tools_compile_tool_README.html). + Before evaluation executable blob, please make sure that selected device support it. + +Additionally you can provide device specific parameters: + +* `cpu_extensions` (path to extension file with custom layers for cpu). You can also use special key `AUTO` for automatic search cpu extensions library in the provided as command line argument directory (option `-e, --extensions`) +* `gpu_extensions` (path to extension *.xml file with OpenCL kernel description for gpu). + +Launcher understands which batch size will be used from model intermediate representation (IR). If you want to use batch for infer, please, provide model with required batch or convert it using specific parameter in `mo_params`. + +* `allow_reshape_input` - parameter, which allows to reshape input layer to data shape (default value is False). +* `reset_memory_state` - parameter, which allows resetting internal infer request memory states after inference. State control essential for recurrent networks. (Optional, default is `False`). + + +Device config contains device specific options which should be set to Inference Engine. For setting device specific flags, you are able to use `-dc` or `--device_config` command line option and provide path to YML file or specify device config directly to Accuracy Checker config file with key `device_config` in the launchers section. Device config should be represented as dictionary of one of two types: +1. keys are plugin configuration keys and values are their values respectively. In this way configuration will be applied to current running device. +2. keys are supported devices and values are plugin configuration for each device. Plugin configuration represented as dictionary where keys are plugin specific configuration keys and values are their values respectively. + +Each supported device has own set of supported configuration parameters which can be found on device page in [Inference Engine development guide](https://docs.openvinotoolkit.org/latest/_docs_IE_DG_supported_plugins_Supported_Devices.html) + +**Note:** Since OpenVINO 2020.4 on platforms with native bfloat16 support models will be executed on this precision by default. For disabling this behaviour, you need to use device_config with following configuration: +```yml +CPU: + ENFORCE_BF16: "NO" +``` +Device config example can be found at `/tools/accuracy_checker/sample/disable_bfloat16_device_config.yml`. + +Beside that, you can launch model in `async_mode`, enable this option and optionally provide the number of infer requests (`num_requests`), which will be used in evaluation process. By default, if `num_requests` not provided or used value `AUTO`, automatic number request assignment for specific device will be performed +For multi device configuration async mode used always. You can provide number requests for each device as part device specification: `MULTI:device_1(num_req_1),device_2(num_req_2)` or in `num_requests` config section (for this case comma-separated list of integer numbers or one value if number requests for all devices equal can be used). + +**Note:** not all models support async execution, in cases when evaluation can not be run in async, the inference will be switched to sync. + +## Specifying model inputs in config + +In case when you model has several inputs you should provide list of input layers in launcher config section using key `inputs`. +Each input description should has following info: + * `name` - input layer name in network + * `type` - type of input values, it has impact on filling policy. Available options: + * `CONST_INPUT` - input will be filled using constant provided in config. It also requires to provide `value`. + * `IMAGE_INFO` - specific key for setting information about input shape to layer (used in Faster RCNN based topologies). You do not need to provide `value`, because it will be calculated in runtime. Format value is list with `N` elements of the form `[H, W, S]`, where `N` is batch size, `H` - original image height, `W` - original image width, `S` - scale of original image (default 1). + * `ORIG_IMAGE_INFO` - specific key for setting information about original image size before preprocessing. + * `SCALE_FACTOR` - specific key for setting information about image scale factor defined as `[SCALE_Y, SCALE_X]`, where `SCALE_Y` = `/ / ` + * `INPUT` - network input for main data stream (e. g. images). If you have several data inputs, you should provide regular expression for identifier as `value` for specifying which one data should be provided in specific input. + * `LSTM_INPUT` - input which should be filled by hidden state from previous iteration. The hidden state layer name should be provided via `value` parameter. + * `IGNORE_INPUT` - input which should be stayed empty during evaluation. + + Optionally you can determine `shape` of input (by default OpenVINO™ launcher uses info given from network, this option allows override default. It required for running ONNX\* models with dynamic input shape on devices, where dynamic shape is not supported), `layout` in case when your model was trained with non-standard data layout (For OpenVINO™ launcher default layout is `NCHW`) + and `precision` (Supported precisions: `FP32` - float, `FP16` - signed shot, `U8` - unsigned char, `U16` - unsigned short int, `I8` - signed char, `I16` - short int, `I32` - int, `I64` - long int). + +## Launcher configuration in case of conversion from source framework + +Launcher may optionally accept model parameters in source framework format which will be converted to Inference Engine IR using Model Optimizer. +If you want to use Model Optimizer for model conversion, please view [Model Optimizer Developer Guide](https://software.intel.com/en-us/articles/OpenVINO-ModelOptimizer). +You can provide: + +* `caffe_model` and `caffe_weights` for Caffe model and weights (*.prototxt and *.caffemodel). +* `tf_model` for TensorFlow model (*.pb, *.pb.frozen, *.pbtxt). +* `tf_meta` for TensorFlow MetaGraph (*.meta). +* `mxnet_weights` for MXNet params (*.params). +* `onnx_model` for ONNX model (*.onnx). You also able to pass your ONNX model directly using `model` option if you do not need Model Optimizer conversion step. +* `kaldi_model` for Kaldi model (*.nnet). + +In case when you want to determine additional parameters for model conversion (data_type, input_shape and so on), you can use `mo_params` for arguments with values and `mo_flags` for positional arguments like `legacy_mxnet_model` . +Full list of supported parameters you can find in [Model Optimizer Developer Guide](https://software.intel.com/en-us/articles/OpenVINO-ModelOptimizer). + +Model will be converted before every evaluation. +You can provide `converted_model_dir` for saving converted model in specific folder, otherwise, converted models will be saved in path provided via `-C` command line argument or source model directory. + +## Configuration example + +OpenVINO™ launcher config example: + +```yml +launchers: + - framework: dlsdk + device: HETERO:GPU,CPU + caffe_model: path_to_model/alexnet.prototxt + caffe_weights: path_to_weights/alexnet.caffemodel + adapter: classification + mo_params: + batch: 4 + mo_flags: + - reverse_input_channels + cpu_extensions: custom_cpu_extensions.so +``` diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/pdpd_launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/pdpd_launcher.py index 19b3dcdd0ac..b44fcbfdc1d 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/pdpd_launcher.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/pdpd_launcher.py @@ -33,7 +33,7 @@ def __init__(self, config_entry: dict, *args, **kwargs): except ImportError as import_error: raise ValueError( "PaddlePaddle isn't installed. Please, install it before using. \n{}".format(import_error.msg) - ) + ) from import_error self._paddle_tensor = PaddleTensor self._analysis_config = AnalysisConfig self._create_paddle_predictor = create_paddle_predictor diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/pytorch_launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/pytorch_launcher.py index 8a0220f3b79..646571a9b7d 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/pytorch_launcher.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/pytorch_launcher.py @@ -62,7 +62,8 @@ def __init__(self, config_entry: dict, *args, **kwargs): # it is the reason, why it is imported only when it used import torch # pylint: disable=C0415 except ImportError as import_error: - raise ValueError("PyTorch isn't installed. Please, install it before using. \n{}".format(import_error.msg)) + raise ValueError("PyTorch isn't installed. Please, install it before using. \n{}".format( + import_error.msg)) from import_error self._torch = torch self.validate_config(config_entry) module_args = config_entry.get("module_args", ()) @@ -117,7 +118,7 @@ def load_module(self, model_cls, module_args, module_kwargs, checkpoint=None, st checkpoint, map_location=None if self.cuda else self._torch.device('cpu') ) state = checkpoint if not state_key else checkpoint[state_key] - if all([key.startswith('module.') for key in state]): + if all(key.startswith('module.') for key in state): module = self._torch.nn.DataParallel(module) module.load_state_dict(state, strict=False) module.to(self.device) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf2_launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf2_launcher.py index 0e921865773..f03b1235dc1 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf2_launcher.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf2_launcher.py @@ -45,7 +45,7 @@ def __init__(self, config_entry, *args, **kwargs): except ImportError as import_error: raise ValueError( "TensorFlow isn't installed. Please, install it before using. \n{}".format(import_error.msg) - ) + ) from import_error self.tf = tensorflow self.default_layout = 'NHWC' self._delayed_model_loading = kwargs.get('delayed_model_loading', False) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf_launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf_launcher.py index e5d550663ed..f4a0cfc7f45 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf_launcher.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf_launcher.py @@ -58,7 +58,7 @@ def __init__(self, config_entry, *args, **kwargs): except ImportError as import_error: raise ValueError( "TensorFlow isn't installed. Please, install it before using. \n{}".format(import_error.msg) - ) + ) from import_error self.default_layout = 'NHWC' self._delayed_model_loading = kwargs.get('delayed_model_loading', False) self.validate_config(config_entry, delayed_model_loading=self._delayed_model_loading) @@ -87,8 +87,8 @@ def __init__(self, config_entry, *args, **kwargs): try: tensor = self._graph.get_tensor_by_name('{}:0'.format(output)) self.node_pattern = '{}:0' - except KeyError: - raise ConfigError('model graph does not contains output {}'.format(output)) + except KeyError as key_err: + raise ConfigError('model graph does not contains output {}'.format(output)) from key_err self._outputs_tensors.append(tensor) self.device = '/{}:0'.format(self.get_value_from_config('device').lower()) @@ -321,7 +321,7 @@ def _get_graph_inputs(self, graph, config_inputs=None): inputs_ops = {'Placeholder'} inputs = [x for x in graph.as_graph_def().node if not x.input and x.op in inputs_ops] if config_inputs: - node_pattern_without_op = self.node_pattern.split(':')[0] + node_pattern_without_op = self.node_pattern.split(':', maxsplit=1)[0] config_inputs_names = [node_pattern_without_op.format(layer['name']) for layer in config_inputs] config_inputs = [x for x in graph.as_graph_def().node if x.name in config_inputs_names] inputs.extend(config_inputs) @@ -369,8 +369,8 @@ def create_inference_session(self, model, saved_model_dir=False, inputs=None, ou try: tensor = _graph.get_tensor_by_name('{}:0'.format(output)) _node_pattern = '{}:0' - except KeyError: - raise ConfigError('model graph does not contains output {}'.format(output)) + except KeyError as key_err: + raise ConfigError('model graph does not contains output {}'.format(output)) from key_err _outputs_tensors.append(tensor) graph_inputs = self._get_graph_inputs(_graph, inputs) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf_lite_launcher.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf_lite_launcher.py index 8148304c24b..191cdae6458 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf_lite_launcher.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/tf_lite_launcher.py @@ -38,7 +38,7 @@ def __init__(self, config_entry, *args, **kwargs): except ImportError as import_error: raise ValueError( "TensorFlow isn't installed. Please, install it before using. \n{}".format(import_error.msg) - ) + ) from import_error try: self.tf_lite = tf.lite except AttributeError: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/main.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/main.py index 5de09039e47..8ec574af652 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/main.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/main.py @@ -1,9 +1,12 @@ """ Copyright (c) 2018-2021 Intel Corporation + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -14,28 +17,21 @@ import json import sys from datetime import datetime -from pathlib import Path -from argparse import ArgumentParser -from functools import partial -from csv import DictWriter import cv2 +from .argparser import build_arguments_parser from .config import ConfigReader from .logging import print_info, add_file_handler, exception from .evaluators import ModelEvaluator, ModuleEvaluator from .progress_reporters import ProgressReporter +from .presenters import write_csv_result from .utils import ( - get_path, - cast_to_bool, - check_file_existence, validate_print_interval, start_telemetry, end_telemetry, send_telemetry_event ) -from . import __version__ - EVALUATION_MODE = { 'models': ModelEvaluator, @@ -43,343 +39,6 @@ } -def add_common_args(parser): - common_args = parser.add_argument_group('Common arguments') - common_args.add_argument( - '-d', '--definitions', - help='path to the yml file with definitions', - type=get_path, - required=False - ) - common_args.add_argument( - '-c', '--config', - help='path to the yml file with local configuration', - type=get_path, - required=True - ) - common_args.add_argument( - '-m', '--models', - help='prefix path to the models and weights', - type=partial(get_path, file_or_directory=True), - required=False, - nargs='+' - ) - common_args.add_argument( - '-s', '--source', - help='prefix path to the data source', - type=partial(get_path, is_directory=True), - required=False - ) - common_args.add_argument( - '-a', '--annotations', - help='prefix path to the converted annotations and datasets meta data', - type=partial(get_path, is_directory=True), - required=False - ) - common_args.add_argument( - '--model_attributes', - help="path's prefix for additional models attributes", - type=partial(get_path, is_directory=True), - required=False - ) - common_args.add_argument( - '--input_precision', - help='space-separated list of precisions for network inputs. ' - 'Providing several values required : format. ' - 'If single value without layer_name provided, then it will be applied to all input layers.', - required=False, - nargs='+' - ) - - -def add_config_filtration_args(parser): - config_filtration_args = parser.add_argument_group('Config filtration arguments') - config_filtration_args.add_argument( - '-tf', '--target_framework', - help='framework for infer', - required=False - ) - config_filtration_args.add_argument( - '-td', '--target_devices', - help='space separated list of devices for infer', - required=False, - nargs='+' - ) - config_filtration_args.add_argument( - '-tt', '--target_tags', - help='space separated list of launcher tags for infer', - required=False, - nargs='+' - ) - - -def add_dataset_related_args(parser): - dataset_related_args = parser.add_argument_group('Dataset related arguments') - dataset_related_args.add_argument( - '-ss', '--subsample_size', - help="dataset subsample size", - type=str, - required=False - ) - dataset_related_args.add_argument( - '--shuffle', - help="allow shuffle annotation during creation a subset", - type=cast_to_bool, - required=False - ) - dataset_related_args.add_argument( - '--store_subset', - help='allow to save evaluation data ids', - type=cast_to_bool, - default=False, - required=False - ) - dataset_related_args.add_argument( - '--subset_file', - help='file name for saving or reading identifiers subset', - required=False - ) - - -def add_profiling_related_args(parser): - profiling_related_args = parser.add_argument_group('Profiling related arguments') - profiling_related_args.add_argument( - '--profile', - help='activate metric profiling mode', - type=cast_to_bool, - required=False - ) - profiling_related_args.add_argument( - '--profiler_logs_dir', - help='path to save profiler logs', - type=partial(get_path, is_directory=True), - default=Path.cwd(), - required=False - ) - profiling_related_args.add_argument( - '--profile_report_type', - help='report type for profiler logs', - default='csv', - choices=['csv', 'json'], - required=False - ) - - -def add_tool_settings_args(parser): - tool_settings_args = parser.add_argument_group('Tool settings arguments') - tool_settings_args.add_argument( - '--progress', - help='progress reporter. You can select bar or print', - default='bar', - required=False - ) - tool_settings_args.add_argument( - '--progress_interval', - help='interval for update progress if selected *print* progress.', - type=int, - default=1000, - required=False - ) - tool_settings_args.add_argument( - '--ignore_result_formatting', - help='allow to get raw metrics results without data formatting', - type=cast_to_bool, - default=False, - required=False - ) - tool_settings_args.add_argument( - '--stored_predictions', - help='path to file with saved predictions. Used for development', - # since at the first time file does not exist and then created we can not always check existence - required=False - ) - tool_settings_args.add_argument( - '--csv_result', - help='file for results writing', - required=False, - ) - tool_settings_args.add_argument( - '--intermediate_metrics_results', - help='enables intermediate metrics results printing or saving', - type=cast_to_bool, - default=False, - required=False - ) - tool_settings_args.add_argument( - '--metrics_interval', - help='number of iteration for updated metrics result printing', - type=int, - default=1000, - required=False - ) - tool_settings_args.add_argument( - '--store_only', - type=cast_to_bool, - default=False, - required=False - ) - tool_settings_args.add_argument( - '-l', '--log_file', - help='file for additional logging results', - required=False - ) - - -def add_openvino_specific_args(parser): - openvino_specific_args = parser.add_argument_group('OpenVINO specific arguments') - openvino_specific_args.add_argument( - '-e', '--extensions', - help='prefix path to extensions folder', - type=partial(get_path, check_exists=False), - default=Path.cwd(), - required=False - ) - openvino_specific_args.add_argument( - '--cpu_extensions_mode', - help='specified preferable set of processor instruction for automatic searching cpu extension lib', - choices=['avx512', 'avx2', 'sse4'], - required=False - ) - openvino_specific_args.add_argument( - '-b', '--bitstreams', - help='prefix path to bitstreams folder', - type=partial(get_path, file_or_directory=True), - required=False - ) - openvino_specific_args.add_argument( - '-M', '--model_optimizer', - help='path to model optimizer directory', - type=partial(get_path, is_directory=True), - # there is no default value because if user did not specify it we use specific locations - # defined in model_conversion.py - required=False - ) - openvino_specific_args.add_argument( - '--tf_custom_op_config_dir', - help='path to directory with tensorflow custom operation configuration files for model optimizer', - type=partial(get_path, is_directory=True), - # there is no default value because if user did not specify it we use specific location - # defined in model_conversion.py - required=False - ) - openvino_specific_args.add_argument( - '--transformations_config_dir', - help='path to directory with Model Optimizer transformations configuration files', - type=partial(get_path, is_directory=True), - # there is no default value because if user did not specify it we use specific location - # defined in model_conversion.py - required=False - ) - openvino_specific_args.add_argument( - '--tf_obj_detection_api_pipeline_config_path', - help='path to directory with tensorflow object detection api pipeline configuration files for model optimizer', - type=partial(get_path, is_directory=True), - # there is no default value because if user did not specify it we use specific location - # defined in model_conversion.py - required=False - ) - openvino_specific_args.add_argument( - '--deprecated_ir_v7', - help='allow generation IR v7 via Model Optimizer', - type=cast_to_bool, - default=False, - required=False - ) - openvino_specific_args.add_argument( - '-dc', '--device_config', - help='Inference Engine device specific config file', - type=get_path, - required=False - ) - openvino_specific_args.add_argument( - '--ie_preprocessing', - help='enable preprocessing via Inference Engine. Accepted only for dlsdk launcher.', - type=cast_to_bool, - default=False, - required=False - ) - openvino_specific_args.add_argument( - '--model_is_blob', - help='the tip for automatic model search to use blob for dlsdk launcher', - type=cast_to_bool, - required=False - ) - openvino_specific_args.add_argument( - '-C', '--converted_models', - help='directory to store Model Optimizer converted models. Used for DLSDK launcher only', - type=partial(get_path, is_directory=True), - default=Path.cwd(), - required=False - ) - openvino_specific_args.add_argument( - '-am', '--affinity_map', - help='prefix path to the affinity maps', - type=partial(get_path, file_or_directory=True), - default=Path.cwd(), - required=False - ) - openvino_specific_args.add_argument( - '--aocl', - help='path to aocl executable for FPGA bitstream programming', - type=get_path, - required=False - ) - openvino_specific_args.add_argument( - '--vpu_log_level', - help='log level for VPU devices', - default='LOG_WARNING', - choices=['LOG_NONE', 'LOG_WARNING', 'LOG_INFO', 'LOG_DEBUG'], - required=False - ) - openvino_specific_args.add_argument( - '--async_mode', - help='Allow evaluation in async mode', - type=cast_to_bool, - default=False, - required=False - ) - openvino_specific_args.add_argument( - '--num_requests', - help='the number of infer requests', - required=False - ) - openvino_specific_args.add_argument( - '--kaldi_bin_dir', help='directory with Kaldi utility binaries. Required only for Kaldi models decoding.', - required=False, type=partial(get_path, is_directory=True) - ) - openvino_specific_args.add_argument( - '--kaldi_log_file', help='path for saving logs from Kaldi tools', type=partial(get_path, check_exists=False), - required=False - ) - openvino_specific_args.add_argument( - '--undefined_shapes_resolving_policy', choices=['default', 'dynamic', 'static'], - help='Policy how to make deal with undefined shapes in network: ' - 'default - try to run as default, if does not work switch to static, ' - 'dynamic - enforce network execution with dynamic shapes, ' - 'static - convert undefined shapes to static before execution', - required=False, default='default' - ) - - -def build_arguments_parser(): - parser = ArgumentParser(description='Deep Learning accuracy validation framework', allow_abbrev=False) - add_common_args(parser) - add_config_filtration_args(parser) - add_dataset_related_args(parser) - add_profiling_related_args(parser) - add_tool_settings_args(parser) - add_openvino_specific_args(parser) - - parser.add_argument( - '--version', - help='show tool version and exit', - action='version', - version='%(prog)s {version}'.format(version=__version__) - ) - - return parser - - def main(): return_code = 0 args = build_arguments_parser().parse_args() @@ -422,6 +81,7 @@ def main(): if not args.store_only: metrics_results, metrics_meta = evaluator.extract_metrics_results( print_results=True, ignore_results_formatting=args.ignore_result_formatting, + ignore_metric_reference=args.ignore_metric_reference ) if args.csv_result: write_csv_result( @@ -455,41 +115,6 @@ def print_processing_info(model, launcher, device, tags, dataset): print_info('OpenCV version: {}'.format(cv2.__version__)) -def write_csv_result(csv_file, processing_info, metric_results, dataset_size, metrics_meta): - new_file = not check_file_existence(csv_file) - field_names = [ - 'model', 'launcher', 'device', 'dataset', - 'tags', 'metric_name', 'metric_type', 'metric_value', 'metric_target', 'metric_scale', 'metric_postfix', - 'dataset_size', 'ref', 'abs_threshold', 'rel_threshold'] - model, launcher, device, tags, dataset = processing_info - main_info = { - 'model': model, - 'launcher': launcher, - 'device': device.upper(), - 'tags': ' '.join(tags) if tags else '', - 'dataset': dataset, - 'dataset_size': dataset_size - } - - with open(csv_file, 'a+', newline='') as f: - writer = DictWriter(f, fieldnames=field_names) - if new_file: - writer.writeheader() - for metric_result, metric_meta in zip(metric_results, metrics_meta): - writer.writerow({ - **main_info, - 'metric_name': metric_result['name'], - 'metric_type': metric_result['type'], - 'metric_value': metric_result['value'], - 'metric_target': metric_meta.get('target', 'higher-better'), - 'metric_scale': metric_meta.get('scale', 100), - 'metric_postfix': metric_meta.get('postfix', '%'), - 'ref': metric_result.get('ref', ''), - 'abs_threshold': metric_result.get('abs_threshold', 0), - 'rel_threshold': metric_result.get('rel_threshold', 0) - }) - - def setup_profiling(logs_dir, evaluator): _timestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S') profiler_dir = logs_dir / _timestamp diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/README.md b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/README.md index aecbb8344c8..7779cd91e52 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/README.md +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/README.md @@ -16,6 +16,15 @@ reference: std: 0.89 ``` +**Note**: all reference values should be provided in raw format without scaling (metric specific, you can see raw metrics results using --ignore_results_formatting True parameter) e.g. +If you want provide reference for metric expressed as a percentage, you should normalized reference value by `scale = 100`. For example, if you use accuracy metric for classification models, you should specify reference as: +```yaml +name: accuracy@top1 +type: accuracy +top_k: 1 +reference: 0.7464 +``` + Every metric has parameters available for configuration. The metric and its parameters are set through the configuration file. Metrics are provided in `datasets` section of configuration file to use specific metric. ## Supported Metrics @@ -31,7 +40,7 @@ Supported representations: `ClassificationAnnotation`, `TextClassificationAnnota * `top_k` - the number of classes with the highest probability, which will be used to decide if prediction is correct. * `label_map` - the field in annotation metadata, which contains dataset label map (Optional, should be provided if different from default). * `character_recognition_accuracy` - accuracy metric for character recognition task. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `CharacterRecognitionAnnotation`, `CharacterRecognitionPrediction`. - * `remove_spaces` - allow removement spaces from reference and predicted strings (Optional, default - `False`). + * `remove_spaces` - allow removing spaces from reference and predicted strings (Optional, default - `False`). * `label_level_recognition_accuracy` - [label level recognition accuracy](https://dl.acm.org/doi/abs/10.1145/1143844.1143891) metric for text line character recognition task using [editdistance](https://pypi.org/project/editdistance/). Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `CharacterRecognitionAnnotation`, `CharacterRecognitionPrediction`. * `classification_f1-score` - [F1 score](https://en.wikipedia.org/wiki/F1_score) metric for classification task. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `ClassificationAnnotation`, `TextClassificationAnnotation`, `ClassificationPrediction`. * `label_map` - the field in annotation metadata, which contains dataset label map (Optional, should be provided if different from default). @@ -43,8 +52,8 @@ Supported representations: `ClassificationAnnotation`, `TextClassificationAnnota * `map` - mean average precision. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `DetectionAnnotation`, `DetectionPrediction`. * `overlap_threshold` - minimal value for intersection over union that allows to make decision that prediction bounding box is true positive. * `overlap_method` - method for calculation bbox overlap. You can choose between intersection over union (`iou`), defined as area of intersection divided by union of annotation and prediction boxes areas, and intersection over area (`ioa`), defined as area of intersection divided by ara of prediction box. - * `include_boundaries` - allows include boundaries in overlap calculation process. If it is True then width and height of box is calculated by max - min + 1. - * `ignore_difficult` - allows to ignore difficult annotation boxes in metric calculation. In this case, difficult boxes are filtered annotations from postprocessing stage. + * `include_boundaries` - allows including boundaries in overlap calculation process. If it is True then width and height of box is calculated by max - min + 1. + * `ignore_difficult` - allows ignoring difficult annotation boxes in metric calculation. In this case, difficult boxes are filtered annotations from postprocessing stage. * `distinct_conf` - select only values for distinct confidences. * `allow_multiple_matches_per_ignored` - allows multiple matches per ignored. * `label_map` - the field in annotation metadata, which contains dataset label map (Optional, should be provided if different from default). @@ -52,8 +61,8 @@ Supported representations: `ClassificationAnnotation`, `TextClassificationAnnota * `miss_rate` - miss rate metric of detection models. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `DetectionAnnotation`, `DetectionPrediction`. * `overlap_threshold` - minimal value for intersection over union that allows to make decision that prediction bounding box is true positive. * `overlap_method` - method for calculation bbox overlap. You can choose between intersection over union (`iou`), defined as area of intersection divided by union of annotation and prediction boxes areas, and intersection over area (`ioa`), defined as area of intersection divided by ara of prediction box. - * `include_boundaries` - allows include boundaries in overlap calculation process. If it is True then width and height of box is calculated by max - min + 1. - * `ignore_difficult` - allows to ignore difficult annotation boxes in metric calculation. In this case, difficult boxes are filtered annotations from postprocessing stage. + * `include_boundaries` - allows including boundaries in overlap calculation process. If it is True then width and height of box is calculated by max - min + 1. + * `ignore_difficult` - allows ignoring difficult annotation boxes in metric calculation. In this case, difficult boxes are filtered annotations from postprocessing stage. * `distinct_conf` - select only values for distinct confidences. * `allow_multiple_matches_per_ignored` - allows multiple matches per ignored. * `label_map` - the field in annotation metadata, which contains dataset label map (Optional, should be provided if different from default). @@ -61,32 +70,32 @@ Supported representations: `ClassificationAnnotation`, `TextClassificationAnnota * `recall` - recall metric of detection models. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `DetectionAnnotation`, `DetectionPrediction`. * `overlap_threshold` - minimal value for intersection over union that allows to make decision that prediction bounding box is true positive. * `overlap_method` - method for calculation bbox overlap. You can choose between intersection over union (`iou`), defined as area of intersection divided by union of annotation and prediction boxes areas, and intersection over area (`ioa`), defined as area of intersection divided by ara of prediction box. - * `include_boundaries` - allows include boundaries in overlap calculation process. If it is True then width and height of box is calculated by max - min + 1. - * `ignore_difficult` - allows to ignore difficult annotation boxes in metric calculation. In this case, difficult boxes are filtered annotations from postprocessing stage. + * `include_boundaries` - allows including boundaries in overlap calculation process. If it is True then width and height of box is calculated by max - min + 1. + * `ignore_difficult` - allows ignoring difficult annotation boxes in metric calculation. In this case, difficult boxes are filtered annotations from postprocessing stage. * `distinct_conf` - select only values for distinct confidences. * `allow_multiple_matches_per_ignored` - allows multiple matches per ignored. * `label_map` - the field in annotation metadata, which contains dataset label map (Optional, should be provided if different from default). * `detection_accuracy` - accuracy for detection models. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `DetectionAnnotation`, `DetectionPrediction`. * `overlap_threshold` - minimal value for intersection over union that allows to make decision that prediction bounding box is true positive. * `overlap_method` - method for calculation bbox overlap. You can choose between intersection over union (`iou`), defined as area of intersection divided by union of annotation and prediction boxes areas, and intersection over area (`ioa`), defined as area of intersection divided by ara of prediction box. - * `include_boundaries` - allows include boundaries in overlap calculation process. If it is True then width and height of box is calculated by max - min + 1. + * `include_boundaries` - allows to include boundaries in overlap calculation process. If it is True then width and height of box is calculated by max - min + 1. * `label_map` - the field in annotation metadata, which contains dataset label map (Optional, should be provided if different from default). * `use_normalization` - allows to normalize confusion_matrix for metric calculation. * `segmentation_accuracy` - pixel accuracy for semantic segmentation models. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `SegmentationAnnotation`, `SegmentationPrediction`. - * `use_argmax` - allows to use argmax for prediction mask. + * `use_argmax` - allows using argmax for prediction mask. * `ignore_label` - specified which class_id prediction should be ignored during metric calculation. (Optional, if not provided, all labels will be used). * `mean_iou` - mean intersection over union for semantic segmentation models. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `SegmentationAnnotation`, `SegmentationPrediction`. - * `use_argmax` - allows to use argmax for prediction mask. + * `use_argmax` - allows using argmax for prediction mask. * `ignore_label` - specified which class_id prediction should be ignored during metric calculation. (Optional, if not provided, all labels will be used). * `mean_accuracy` - mean accuracy for semantic segmentation models. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `SegmentationAnnotation`, `SegmentationPrediction`. - * `use_argmax` - allows to use argmax for prediction mask. + * `use_argmax` - allows using argmax for prediction mask. * `ignore_label` - specified which class_id prediction should be ignored during metric calculation. (Optional, if not provided, all labels will be used). * `frequency_weighted_accuracy` - frequency weighted accuracy for semantic segmentation models. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `SegmentationAnnotation`, `SegmentationPrediction`. - * `use_argmax` - allows to use argmax for prediction mask. + * `use_argmax` - allows using argmax for prediction mask. * `ignore_label` - specified which class_id prediction should be ignored during metric calculation. (Optional, if not provided, all labels will be used). More detailed information about calculation segmentation metrics you can find [here](https://arxiv.org/abs/1411.4038). * `cmc` - Cumulative Matching Characteristics (CMC) score. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `ReIdentificationAnnotation`, `ReIdentificationPrediction`. - * `top_k` - number of k highest ranked samples to consider when matching. + * `top_k` - number of k-highest ranked samples to consider when matching. * `separate_camera_set` - should identities from the same camera view be filtered out. * `single_gallery_shot` - each identity has only one instance in the gallery. * `number_single_shot_repeats` - number of repeats for single_gallery_shot setting (required for CUHK). @@ -96,15 +105,19 @@ More detailed information about calculation segmentation metrics you can find [h * `pairwise_accuracy` - pairwise accuracy for object reidentification. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `ReIdentificationClassificationAnnotation`, `ReIdentificationPrediction`. * `min_score` - min score for determining that objects are different. You can provide value or use `train_median` or `best_train_threshold` values which will be calculated if annotations has training subset. * `distance_method` - allows to choose one of the distance calculation methods (optional, supported methods are `euclidian_distance` and `cosine_distance`, default - `euclidian_distance`). - * `subtract_mean` - allows to subtract mean calculated on train embeddings before calculating the distance(optional, default - `False`). + * `subtract_mean` - allows subtracting mean calculated on train embeddings before calculating the distance(optional, default - `False`). * `pairwise_accuracy_subsets` - object reidentification pairwise accuracy with division dataset on test and train subsets for calculation mean score. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `ReIdentificationClassificationAnnotation`, `ReIdentificationPrediction`. * `subset_number` - number of subsets for separating. * `min_score` - min score for determining that objects are different. You can provide value or use `train_median` or `best_train_threshold` values which will be calculated if annotations has training subset. * `distance_method` - allows to choose one of the distance calculation methods (optional, supported methods are `euclidian_distance` and `cosine_distance`, default - `euclidian_distance`). - * `subtract_mean` - allows to subtract mean calculated on train embeddings before calculating the distance(optional, default - `False`). + * `subtract_mean` - allows subtracting mean calculated on train embeddings before calculating the distance(optional, default - `False`). * `localization_recall` - recall metric used for evaluation place recognition task. Metric is calculated as a percentage. Direction of metric's growth is higher-better. Supported representations: `PlaceRecognitionAnnotation`, `ReidentificationPrediction`. - * `top_k` - number of k highest ranked samples to consider when matching. + * `top_k` - number of k-highest ranked samples to consider when matching. * `distance_threshold` - distance threshold for search positive matching pairs between query and gallery (Optional, default 25). +* `spearman_correlation_coef` - the similarity of the embeddings by calculating the Spearman rank correlation in comparison to the gold standard labels. Supported representations: `SentenceSimilarityAnnotation`, `ReidentificationPrediction`. The Spearman rank-order correlation coefficient is a nonparametric measure of the monotonicity of the relationship between two values sets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Correlations of -1 or +1 imply an exact monotonic relationship. Positive correlations imply that as x increases, so does y. Negative correlations imply that as x increases, y decreases. + * `similarity_distance` - approach for calculation distance between embeddings, supported methods: `cosine` - cosine distance, `manhattan` - manhattan distance, `euclidian` - euclidian distance, `dot_product` - dot product between embeddings vectors. +* `pearson_correlation_coef` - the similarity of the embeddings by calculating the Pearson rank correlation in comparison to the gold standard labels. Supported representations: `SentenceSimilarityAnnotation`, `ReidentificationPrediction`. The Pearson rank-order correlation coefficient is a nonparametric measure of the linear relationship between two values sets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Correlations of -1 or +1 imply an exact monotonic relationship. Positive correlations imply that as x increases, so does y. Negative correlations imply that as x increases, y decreases. + * `similarity_distance` - approach for calculation distance between embeddings, supported methods: `cosine` - cosine distance, `manhattan` - manhattan distance, `euclidian` - euclidian distance, `dot_product` - dot product between embeddings vectors. * `mae` - [Mean Absolute Error](https://en.wikipedia.org/wiki/Mean_absolute_error). Direction of metric's growth is higher-worse. Supported representations: `RegressionAnnotation`, `RegressionPrediction`, `FeatureRegressionAnnotation`, `DepthEstimationAnnotation`, `DepthEstimationPrediction`, `ImageProcessingAnnotation`, `ImageProcessingPrediction`, `BackgroundMattingAnnotation`, `BackgroundMattingPrediction`. * `max_error` - allow to calculate maximal error in range. Optional, default `False`. * `mae_on_intervals` - Mean Absolute Error estimated magnitude for specific value range. Direction of metric's growth is higher-worse. Supported representations: `RegressionAnnotation`, `RegressionPrediction`. diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/__init__.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/__init__.py index 08b0a4698c3..8cd25589b61 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/__init__.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/__init__.py @@ -40,7 +40,9 @@ PairwiseAccuracySubsets, FaceRecognitionTAFAPairMetric, NormalizedEmbeddingAccuracy, - LocalizationRecall + LocalizationRecall, + SpearmanCorrelation, + PearsonCorrelation ) from .semantic_segmentation import SegmentationAccuracy, SegmentationIOU, SegmentationMeanAccuracy, SegmentationFWAcc from .character_recognition import CharacterRecognitionAccuracy, LabelLevelRecognitionAccuracy @@ -144,6 +146,8 @@ 'FaceRecognitionTAFAPairMetric', 'NormalizedEmbeddingAccuracy', 'LocalizationRecall', + 'SpearmanCorrelation', + 'PearsonCorrelation', 'SegmentationAccuracy', 'SegmentationIOU', diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/classification.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/classification.py index 7ae82ab5c6b..384e89972b8 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/classification.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/classification.py @@ -273,7 +273,7 @@ def roc_auc_score(fpr, tpr): @staticmethod def precision_recall_auc(precision, recall): - return -np.sum(np.diff(recall) * np.array(precision)[:-1]) + return -1 * np.sum(np.diff(recall) * np.array(precision)[:-1]) class ClassificationAccuracyClasses(PerImageEvaluationMetric): @@ -310,6 +310,7 @@ def configure(self): else: raise ConfigError('accuracy per class metric requires dataset metadata' 'Please provide dataset meta file or regenerate annotation') + self.meta['names'] = list(self.labels.values()) def loss(annotation_label, prediction_top_k_labels): result = np.zeros_like(list(self.labels.keys())) @@ -336,7 +337,6 @@ def update(self, annotation, prediction): return result def evaluate(self, annotations, predictions): - self.meta['names'] = list(self.labels.values()) if self.profiler: self.profiler.finish() return self.accuracy.evaluate() @@ -350,6 +350,7 @@ def set_profiler(self, profiler): self.profiler = profiler self.summary_helper = ClassificationProfilingSummaryHelper() + class AverageProbMeter(AverageMeter): def __init__(self): def loss(annotation_label, prediction_scores): @@ -370,6 +371,7 @@ def __init__(self, *args, **kwargs): self.video_avg_prob = AverageProbMeter() self.previous_video_id = None self.previous_video_label = None + self.meta['names'] = ['clip_accuracy', 'video_accuracy'] def update(self, annotation, prediction): if isinstance(annotation.identifier, list): @@ -394,7 +396,6 @@ def update(self, annotation, prediction): return clip_accuracy def evaluate(self, annotations, predictions): - self.meta['names'] = ['clip_accuracy', 'video_accuracy'] if self.profiler: self.profiler.finish() return [self.clip_accuracy.evaluate(), self.video_accuracy.evaluate()] @@ -437,6 +438,10 @@ def configure(self): raise ConfigError('classification_f1-scores metric requires dataset metadata' 'Please provide dataset meta file or regenerate annotation') self.cm = np.zeros((len(self.labels), len(self.labels))) + if self.pos_label is not None: + self.meta['names'] = [self.labels[self.pos_label]] + else: + self.meta['names'] = list(self.labels.values()) def update(self, annotation, prediction): self.cm[annotation.label][prediction.label] += 1 @@ -464,10 +469,7 @@ def evaluate(self, annotations, predictions): self.profiler.finish() if self.pos_label is not None: - self.meta['names'] = [self.labels[self.pos_label]] return f1_score[self.pos_label] - - self.meta['names'] = list(self.labels.values()) return f1_score if len(f1_score) == 2 else f1_score[0] def reset(self): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/coco_metrics.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/coco_metrics.py index 00f7f60a3f7..851d639b10a 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/coco_metrics.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/coco_metrics.py @@ -69,6 +69,7 @@ def parameters(cls): def configure(self): self.max_detections = self.get_value_from_config('max_detections') threshold = process_threshold(self.get_value_from_config('threshold')) + self.config.pop('threshold', None) self.thresholds = get_or_parse_value(threshold, COCO_THRESHOLDS) if not self.dataset: raise ConfigError('coco metrics require dataset metadata providing in dataset_meta' @@ -120,13 +121,19 @@ def _update_label_stat_for_non_matched_classes(self, labels_stat, predictions): matched_classes = set(labels_stat) background = self.dataset.metadata.get('background_label') prediction_classes = np.unique([pred.labels for pred in predictions]) + get_polygon = hasattr(predictions[0], 'to_polygon') for pc in prediction_classes: if pc == background or pc in matched_classes: continue - prediction_boxes, _, _ = _prepare_prediction_boxes( - pc, predictions, True - ) - conf = prediction_boxes[:, 0] + if not get_polygon: + prediction_boxes, _, _ = _prepare_prediction_boxes( + pc, predictions, True + ) + conf = prediction_boxes[:, 0] if not get_polygon else [] + prediction_boxes = prediction_boxes[:, 1:] + else: + prediction_boxes = [p.to_polygon().get(pc, []) for p in predictions][0] + conf = [p.scores[p.labels == pc] for p in predictions][0] label_report = { 'precision': [], 'recall': [], @@ -135,7 +142,7 @@ def _update_label_stat_for_non_matched_classes(self, labels_stat, predictions): 'scores': conf, 'matched': defaultdict(list), 'gt': [], - 'dt': prediction_boxes[:, 1:], + 'dt': prediction_boxes, 'prediction_matches': 0, 'annotation_matches': 0, 'iou': [] @@ -413,8 +420,8 @@ def evaluate(self, annotations, predictions): return recalls -class MSCOCOSegmAveragePrecision(MSCOCOAveragePrecision): - __provider__ = 'coco_segm_precision' +class MSCOCOSegmBase(MSCOCOBaseMetric): + __provider__ = 'coco_segm' annotation_types = (CoCoInstanceSegmentationAnnotation,) prediction_types = (CoCoInstanceSegmentationPrediction,) @@ -424,17 +431,37 @@ def configure(self): if isinstance(maskUtils, UnsupportedPackage): maskUtils.raise_error(self.__provider__) + def update(self, annotation, prediction): + compute_iou, create_boxes = select_specific_parameters(annotation) + per_class_results = [] + profile_boxes = self.profiler is not None + if profile_boxes: + annotation_polygons = annotation.to_polygon() + prediction_polygons = prediction.to_polygon() -class MSCOCOSegmRecall(MSCOCORecall): - __provider__ = 'coco_segm_recall' + for label_id, label in enumerate(self.labels): - annotation_types = (CoCoInstanceSegmentationAnnotation,) - prediction_types = (CoCoInstanceSegmentationPrediction,) + detections, scores, dt_difficult = prepare_predictions(prediction, label, self.max_detections) + ground_truth, gt_difficult, iscrowd, boxes, areas = prepare_annotations(annotation, label, create_boxes) + iou = compute_iou(ground_truth, detections, annotation_boxes=boxes, annotation_areas=areas, iscrowd=iscrowd) + eval_result = evaluate_image( + ground_truth if not profile_boxes else annotation_polygons.get(label, []), + gt_difficult, iscrowd, detections if not profile_boxes else prediction_polygons.get(label, []), + dt_difficult, scores, iou, self.thresholds, + profile_boxes + ) + self.matching_results[label_id].append(eval_result) + per_class_results.append(eval_result) - def configure(self): - super().configure() - if isinstance(maskUtils, UnsupportedPackage): - maskUtils.raise_error(self.__provider__) + return per_class_results + + +class MSCOCOSegmAveragePrecision(MSCOCOAveragePrecision, MSCOCOSegmBase): + __provider__ = 'coco_segm_precision' + + +class MSCOCOSegmRecall(MSCOCORecall, MSCOCOSegmBase): + __provider__ = 'coco_segm_recall' @singledispatch diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/coco_orig_metrics.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/coco_orig_metrics.py index 3fb9ef29d2a..fb115936045 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/coco_orig_metrics.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/coco_orig_metrics.py @@ -34,8 +34,8 @@ from ..logging import print_info from ..config import BaseField, BoolField, ConfigError from ..utils import get_or_parse_value, UnsupportedPackage -from .metric import FullDatasetEvaluationMetric, PerImageEvaluationMetric -from .coco_metrics import COCO_THRESHOLDS, process_threshold, compute_precision_recall +from .metric import FullDatasetEvaluationMetric, Metric, PerImageEvaluationMetric +from .coco_metrics import COCO_THRESHOLDS, process_threshold try: from pycocotools.coco import COCO @@ -79,6 +79,7 @@ def parameters(cls): def configure(self): threshold = process_threshold(self.get_value_from_config('threshold')) + self.config.pop('threshold', None) self.threshold = get_or_parse_value(threshold, COCO_THRESHOLDS) self.box_side_delta = int(self.get_value_from_config('include_boundaries')) if not self.dataset.metadata: @@ -96,6 +97,16 @@ def configure(self): if label != self.dataset.metadata.get('background_label') ] + def set_profiler(self, profiler): + self.profiler = profiler + self.profiling_helper = Metric.provide( + self.__provider__.replace('_orig', ''), {'max_detections': 100}, self.dataset, self.name, profiler=profiler + ) + + def update(self, annotation, prediction): + if self.profiler: + self.profiling_helper.update(annotation, prediction) + @staticmethod def _iou_type_data_to_coco(data_to_store, data, box_side_delta): x_mins = data.x_mins.tolist() @@ -462,12 +473,12 @@ def evaluate(self, annotations, predictions): pass -class MSCOCOorigAveragePrecision(MSCOCOorigBaseMetric): +class MSCOCOorigAveragePrecision(MSCOCOorigBaseMetric, PerImageEvaluationMetric): __provider__ = 'coco_orig_precision' def evaluate(self, annotations, predictions): if self.profiler: - self.profiler.finish() + self.profiling_helper.evaluate(annotations, predictions) return self.compute_precision_recall(annotations, predictions)[0][0] @@ -480,34 +491,12 @@ class MSCOCOOrigSegmAveragePrecision(MSCOCOorigAveragePrecision, PerImageEvaluat def update(self, annotation, prediction): if self.profiler: - per_class_matching = {} - for _, label in enumerate(self.labels): - detections, scores, dt_difficult = self._prepare_predictions(prediction, label) - ground_truth, gt_difficult, iscrowd = self._prepare_annotations(annotation, label) - if not ground_truth.size: - continue - iou = self._compute_iou(ground_truth, detections, iscrowd) - eval_result = self._evaluate_image( - ground_truth, gt_difficult, iscrowd, detections, dt_difficult, scores, iou, self.threshold, - True - ) - eval_result['gt'] = annotation.to_polygon()[label] - eval_result['dt'] = annotation.to_polygon()[label] - per_class_matching[label] = eval_result - per_class_result = {k: compute_precision_recall( - self.threshold, [v])[0] for k, v in per_class_matching.items() - } - for label in per_class_matching: - per_class_matching[label]['result'] = per_class_result[label] - self.profiler.update( - annotation.identifier, per_class_matching, self.name, np.nanmean(list(per_class_result.values())) - ) + self.profiling_helper.update(annotation, prediction) @staticmethod def _compute_iou(gt, dets, iscrowd): return iou_calc(list(dets), list(gt), iscrowd) - @staticmethod def _prepare_predictions(prediction, label): if prediction.size == 0: @@ -542,7 +531,6 @@ def _prepare_annotations(annotation, label): return ann[order], difficult_label[order], iscrowd_label[order] - @staticmethod def _iou_type_data_to_coco(data_to_store, data, box_side_delta): encoded_masks = data.mask @@ -569,7 +557,6 @@ def _iou_type_specific_coco_annotation(self, annotation_data_to_store, annotatio return annotation_data_to_store - class MSCOCOorigRecall(MSCOCOorigBaseMetric): __provider__ = 'coco_orig_recall' diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/detection.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/detection.py index 6910a672c02..d83fcf86739 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/detection.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/detection.py @@ -302,18 +302,18 @@ def _calculate_map(self, annotations, predictions, profile_boxes=False, return_l labels_stat = self.per_class_detection_statistics(annotations, predictions, valid_labels, profile_boxes) average_precisions = [] - for label in labels_stat: - label_precision = labels_stat[label]['precision'] - label_recall = labels_stat[label]['recall'] + for value in labels_stat.values(): + label_precision = value['precision'] + label_recall = value['recall'] label_miss_rate = 1 - label_recall - labels_stat[label]['miss_rate'] = label_miss_rate + value['miss_rate'] = label_miss_rate if label_recall.size: ap = average_precision(label_precision, label_recall, self.integral) average_precisions.append(ap) else: average_precisions.append(np.nan) - labels_stat[label]['ap'] = average_precisions[-1] - labels_stat[label]['result'] = average_precisions[-1] + value['ap'] = average_precisions[-1] + value['result'] = average_precisions[-1] if profile_boxes: self._update_label_stat_for_non_matched_classes(labels_stat, predictions) self.profiler.update(annotations[0].identifier, labels_stat, self.name, np.nanmean(average_precisions)) @@ -376,16 +376,16 @@ def update(self, annotation, prediction): [annotation], [prediction], valid_labels, self.profiler is not None ) miss_rates = [] - for label in labels_stat: - label_miss_rate = 1.0 - labels_stat[label]['recall'] - label_fppi = labels_stat[label]['fppi'] + for value in labels_stat.values(): + label_miss_rate = 1.0 - value['recall'] + label_fppi = value['fppi'] position = bisect.bisect_left(label_fppi, self.fppi_level) m0 = max(0, position - 1) m1 = position if position < len(label_miss_rate) else m0 miss_rates.append(0.5 * (label_miss_rate[m0] + label_miss_rate[m1])) if self.profiler: - labels_stat[label]['result'] = miss_rates[-1] + value['result'] = miss_rates[-1] if self.profiler: self.profiler.update(annotation[0].identifier, labels_stat, self.name, np.nanmean(miss_rates)) @@ -397,9 +397,9 @@ def evaluate(self, annotations, predictions): labels_stat = self.per_class_detection_statistics(annotations, predictions, valid_labels) miss_rates = [] - for label in labels_stat: - label_miss_rate = 1.0 - labels_stat[label]['recall'] - label_fppi = labels_stat[label]['fppi'] + for value in labels_stat.values(): + label_miss_rate = 1.0 - value['recall'] + label_fppi = value['fppi'] position = bisect.bisect_left(label_fppi, self.fppi_level) m0 = max(0, position - 1) @@ -437,15 +437,15 @@ def _calculate_recall(self, annotations, predictions, profile_boxes=False): labels_stat = self.per_class_detection_statistics(annotations, predictions, valid_labels, profile_boxes) recalls = [] - for label in labels_stat: - label_recall = labels_stat[label]['recall'] + for value in labels_stat.values(): + label_recall = value['recall'] if label_recall.size: max_recall = label_recall[-1] recalls.append(max_recall) else: recalls.append(np.nan) if profile_boxes: - labels_stat[label]['result'] = recalls[-1] + value['result'] = recalls[-1] if profile_boxes: self.profiler.update(annotations[0].identifier, labels_stat, self.name, np.nanmean(recalls)) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/im2latex_images_match.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/im2latex_images_match.py index a4a4d64d650..61dba5c9173 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/im2latex_images_match.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/im2latex_images_match.py @@ -112,16 +112,16 @@ def crop_image(img, output_path, default_size=None): def run(cmd, timeout_sec): - proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.DEVNULL) - def kill_proc(process): return process.kill() - timer = Timer(timeout_sec, kill_proc, [proc]) - try: - timer.start() - _, _ = proc.communicate() - finally: - timer.cancel() + + with subprocess.Popen(cmd, shell=True, stdout=subprocess.DEVNULL) as proc: + timer = Timer(timeout_sec, kill_proc, [proc]) + try: + timer.start() + _, _ = proc.communicate() + finally: + timer.cancel() def preprocess_formula(formula): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/image_quality_assessment.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/image_quality_assessment.py index 737d0b80075..862949137a8 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/image_quality_assessment.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/image_quality_assessment.py @@ -407,6 +407,7 @@ def configure(self): if isinstance(lpips, UnsupportedPackage): lpips.raise_error(self.__provider__) self.dist_threshold = self.get_value_from_config('distance_threshold') + self.meta['names'].append('ratio_greater_{}'.format(self.dist_threshold)) self.loss = self._create_loss() def lpips_differ(self, annotation_image, prediction_image): @@ -421,7 +422,6 @@ def evaluate(self, annotations, predictions): results = super().evaluate(annotations, predictions) if self.dist_threshold: invalid_ratio = np.sum(np.array(self.magnitude) > self.dist_threshold) / len(self.magnitude) - self.meta['names'].append('ratio_greater_{}'.format(self.dist_threshold)) results += (invalid_ratio, ) return results diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/machine_translation.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/machine_translation.py index 3f56ce00927..a5a8b4fc342 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/machine_translation.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/machine_translation.py @@ -21,6 +21,7 @@ from ..config import BoolField, NumberField, StringField from ..representation import MachineTranslationPrediction, MachineTranslationAnnotation + class TokenizerRegexp: def __init__(self): self._re = [ @@ -123,24 +124,36 @@ def configure(self): self.smooth_value = None def update(self, annotation, prediction): + correct = [0] * self.max_order + total = [0] * self.max_order reference_corpus = annotation.reference translation_corpus = prediction.translation + sys_len, ref_len = 0, 0 for lines in zip([translation_corpus], [reference_corpus]): output, *refs = [self.tokenizer(' '.join(x)) for x in lines] output_len = len(output.split()) ref_ngrams, _, closest_len = self.reference_stats(refs, output_len) - self.sys_len += output_len - self.ref_len += closest_len + sys_len += output_len + ref_len += closest_len sys_ngrams = self.extract_ngrams(output, self.max_order) - for ngram in sys_ngrams.keys(): + for ngram, value in sys_ngrams.items(): n = len(ngram.split()) - self.correct[n - 1] += min(sys_ngrams[ngram], ref_ngrams.get(ngram, 0)) - self.total[n - 1] += sys_ngrams[ngram] + correct[n - 1] += min(value, ref_ngrams.get(ngram, 0)) + total[n - 1] += value + for i in range(self.max_order): + self.correct[i] += correct[i] + self.total[i] += total[i] + self.sys_len += sys_len + self.ref_len += ref_len + return self.calculate_score(correct, total, sys_len, ref_len) def evaluate(self, annotations, predictions): + return self.calculate_score(self.correct, self.total, self.sys_len, self.ref_len) + + def calculate_score(self, correct, total, sys_len, ref_len): def log(num): if num == 0.0: return -9999999999 @@ -151,32 +164,28 @@ def log(num): for n in range(1, self.max_order + 1): if self.smooth_method == 'add-k' and n > 1: - self.correct[n - 1] += self.smooth_value - self.total[n - 1] += self.smooth_value + correct[n - 1] += self.smooth_value + total[n - 1] += self.smooth_value - if self.total[n - 1] == 0: + if total[n - 1] == 0: break - if self.correct[n - 1] == 0: + if correct[n - 1] == 0: if self.smooth_method == 'exp': smooth_mteval *= 2 - precisions[n - 1] = 1 / (smooth_mteval * self.total[n - 1]) + precisions[n - 1] = 1 / (smooth_mteval * total[n - 1]) elif self.smooth_method == 'floor': - precisions[n - 1] = 1. / (smooth_mteval * self.total[n - 1]) + precisions[n - 1] = 1. / (smooth_mteval * total[n - 1]) else: - precisions[n - 1] = self.correct[n - 1] / self.total[n - 1] + precisions[n - 1] = correct[n - 1] / total[n - 1] - if self.sys_len < self.ref_len: - bp = math.exp(1 - self.ref_len / self.sys_len) if self.sys_len > 0 else 0.0 + if sys_len < ref_len: + bp = math.exp(1 - ref_len / sys_len) if sys_len > 0 else 0.0 else: bp = 1.0 score = bp * math.exp( sum(map(log, precisions[:self.max_order])) / self.max_order) - pred_text, ref_text = [], [] - for pred, annot in zip(predictions, annotations): - pred_text.append(' '.join(pred.translation)) - ref_text.append(' '.join(annot.reference)) return score @staticmethod @@ -207,8 +216,8 @@ def reference_stats(self, refs, output_len): closest_len = reflen ngrams_ref = self.extract_ngrams(ref, self.max_order) - for ngram in ngrams_ref.keys(): - ngrams[ngram] = max(ngrams[ngram], ngrams_ref[ngram]) + for ngram, value in ngrams_ref.items(): + ngrams[ngram] = max(ngrams[ngram], value) return ngrams, closest_diff, closest_len diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric.py index b2b19b407da..9af4b2526d1 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric.py @@ -231,6 +231,12 @@ def validation_scheme(cls, provider=None): return full_scheme return cls.parameters() + @property + def result_template(self): + if 'names' in self.meta: + return [0] * len(self.meta['names']) + return 0 + class PerImageEvaluationMetric(Metric): def submit(self, annotation, prediction): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_executor.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_executor.py index bed4fcdb9b5..c69d13fea3d 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_executor.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_executor.py @@ -82,7 +82,8 @@ def update_metrics_on_object(self, annotation, prediction): return metric_results - def update_metrics_on_batch(self, batch_ids, annotation, prediction, profile=False): + def update_metrics_on_batch(self, batch_ids, annotation, prediction, + profile=False, deprocessed_annotation=None, deprocessed_prediction=None): """ Updates metric value corresponding given batch. @@ -94,7 +95,11 @@ def update_metrics_on_batch(self, batch_ids, annotation, prediction, profile=Fal results = OrderedDict() profile_results = OrderedDict() - for input_id, single_annotation, single_prediction in zip(batch_ids, annotation, prediction): + for idx, (input_id, single_annotation, single_prediction) in enumerate(zip(batch_ids, annotation, prediction)): + if profile: + if deprocessed_annotation is not None and deprocessed_prediction is not None: + self.profiler.update_annotation_and_prediction( + deprocessed_annotation[idx], deprocessed_prediction[idx]) results[input_id] = self.update_metrics_on_object(single_annotation, single_prediction) if profile: profile_results[input_id] = self.profiler.get_last_report() @@ -115,6 +120,20 @@ def iterate_metrics(self, annotations, predictions): profiling_file=profiling_file ) + def get_metric_result_template(self, ignore_refs): + for name, metric_type, functor, reference, abs_threshold, rel_threshold, presenter in self.metrics: + profiling_file = None if functor.profiler is None else functor.profiler.report_file + yield presenter, EvaluationResult( + name=name, + metric_type=metric_type, + evaluated_value=functor.result_template, + reference_value=reference if not ignore_refs else None, + abs_threshold=abs_threshold, + rel_threshold=rel_threshold, + meta=functor.meta, + profiling_file=profiling_file + ) + def register_metric(self, metric_config_entry): type_ = 'type' identifier = 'name' @@ -150,9 +169,9 @@ def register_metric(self, metric_config_entry): metric_type, metric_config_entry, self.dataset, metric_identifier, state=self.state, **metric_kwargs ) metric_presenter = BasePresenter.provide(metric_config_entry.get(presenter, 'print_scalar')) - threshold_v = metric_config_entry.get(threshold) - abs_threshold_v = metric_config_entry.get(abs_threshold) - reference_v = metric_config_entry.get(reference) + threshold_v = metric_fn.config.get(threshold) + abs_threshold_v = metric_fn.config.get(abs_threshold) + reference_v = metric_fn.config.get(reference) if reference_v is not None and not isinstance(reference_v, (int, float, dict)): raise ConfigError( 'reference value should be represented as number or dictionary with numbers for each submetric' diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/base_profiler.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/base_profiler.py index 9bfc4b69105..7e7342ee10e 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/base_profiler.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/base_profiler.py @@ -69,6 +69,7 @@ def __init__(self, dump_iterations=100, report_type='csv', name=None): self.storage = OrderedDict() self.write_result = self.write_csv_result if report_type == 'csv' else self.write_json_result self._last_profile = None + self.required_postprocessing = False def register_metric(self, metric_name): self.fields.append('{}_result'.format(metric_name)) @@ -106,7 +107,7 @@ def write_summary(self, summary): out_path = self.out_dir / self.report_file new_file = not out_path.exists() if not new_file: - with open(str(out_path), 'r') as f: + with open(str(out_path), 'r', encoding='utf-8') as f: out_dict = json.load(f) else: out_dict = { @@ -122,7 +123,7 @@ def write_summary(self, summary): 'dataset_meta': self.dataset_meta, } out_dict.update(summary) - with open(str(out_path), 'w') as f: + with open(str(out_path), 'w', encoding='utf-8') as f: json.dump(out_dict, f) def reset(self): @@ -142,7 +143,7 @@ def write_csv_result(self): else: data_to_store.append(value) - with open(str(out_path), 'a+', newline='') as f: + with open(str(out_path), 'a+', newline='', encoding='utf-8') as f: writer = DictWriter(f, fieldnames=self.fields) if new_file: writer.writeheader() @@ -154,7 +155,7 @@ def write_json_result(self): out_path = self.out_dir / self.report_file new_file = not out_path.exists() if not new_file: - with open(str(out_path), 'r') as f: + with open(str(out_path), 'r', encoding='utf-8') as f: out_dict = json.load(f) out_dict['report'].extend(list(self.storage.values())) else: @@ -170,7 +171,7 @@ def write_json_result(self): 'report_type': self.__provider__, 'dataset_meta': self.dataset_meta } - with open(str(out_path), 'w') as f: + with open(str(out_path), 'w', encoding='utf-8') as f: json.dump(out_dict, f) self._reset_storage() @@ -193,6 +194,9 @@ def set_dataset_meta(self, meta): def last_report(self): return self._last_profile + def update_annotation_and_prediction(self, annotation, prediction): + pass + def create_profiler(metric_type, metric_name): profiler = None diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/instance_segmentation_metric_profiler.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/instance_segmentation_metric_profiler.py index f2e46dc4c6e..1f4746ff2a4 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/instance_segmentation_metric_profiler.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/instance_segmentation_metric_profiler.py @@ -15,10 +15,10 @@ """ import numpy as np -from .base_profiler import MetricProfiler +from .object_detection_metric_profiler import DetectionListProfiler -class InstanceSegmentationProfiler(MetricProfiler): +class InstanceSegmentationProfiler(DetectionListProfiler): __provider__ = 'instance_segmentation' def __init__(self, dump_iterations=100, report_type='csv', name=None): @@ -56,13 +56,16 @@ def generate_profiling_data(self, identifier, metric_result, metric_name, final_ def generate_json_report(self, identifier, metric_result, metric_name): report = {'identifier': identifier, 'per_class_result': {}} per_class_results = {} - for idx, (class_id, class_result) in enumerate(metric_result.items()): - if not np.size(class_result['scores']): + totat_pred_boxes, total_gt_boxes, total_gt_matches, total_pred_matches = 0, 0, 0, 0 + for idx, class_result in metric_result.items(): + if not np.size(class_result['gt']) + np.size(class_result['dt']): continue - label_id = self.valid_labels[idx] if self.valid_labels else class_id + label_id = idx iou = [iou_str.tolist() for iou_str in class_result['iou']] - gt = [gt_obj.tolist() for gt_obj in class_result['gt']] - dt = [dt_obj.tolist() for dt_obj in class_result['dt']] + gt = [g.tolist() if not isinstance(g, list) else g for g in class_result['gt']] + dt = [] + for dp in class_result['dt']: + dt.append([d.tolist() if not isinstance(d, list) else d for d in dp]) scores = ( class_result['scores'].tolist() if not isinstance(class_result['scores'], list) else class_result['scores'] @@ -71,11 +74,21 @@ def generate_json_report(self, identifier, metric_result, metric_name): per_class_results[label_id] = { 'annotation_polygons': gt, 'prediction_polygons': dt, + 'num_prediction_polygons': len(dt), + 'num_annotation_polygons': len(gt), 'prediction_scores': scores, 'iou': iou, } - per_class_results[label_id].update(self.generate_result_matching(class_result, metric_name)) + total_gt_boxes += len(gt) + totat_pred_boxes += len(dt) + per_class_results[label_id].update(self.generate_result_matching(class_result, metric_name, aggregate=True)) + total_pred_matches += per_class_results[label_id]['prediction_matches'] + total_gt_matches += per_class_results[label_id]['annotation_matches'] report['per_class_result'] = per_class_results + report['num_prediction_polygons'] = totat_pred_boxes + report['num_annotation_polygons'] = total_gt_boxes + report['total_annotation_matches'] = total_gt_matches + report['total_prediction_matches'] = total_pred_matches return report def per_instance_result(self, identifier, metric_result): @@ -87,8 +100,8 @@ def per_instance_result(self, identifier, metric_result): dt = per_class_result['dt'] gt = per_class_result['gt'] matches_result = self.generate_result_matching(per_class_result, '') - dt_matched = matches_result['prediction_matches'] - gt_matched = matches_result['annotation_matches'] + dt_matched = matches_result.get('prediction_matches', []) + gt_matched = matches_result.get('annotation_matches', []) for dt_id, dt_box in enumerate(dt): box_result = { 'identifier': identifier, @@ -121,11 +134,19 @@ def set_dataset_meta(self, meta): ] @staticmethod - def generate_result_matching(per_class_result, metric_name): + def generate_result_matching(per_class_result, metric_name, aggregate=False): + result = per_class_result['result'] + if np.isnan(result): + result = -1 + dt_matches = per_class_result['dt_matches'][0].tolist() if 'dt_matches' in per_class_result else [] + gt_matches = per_class_result['gt_matches'][0].tolist() if 'gt_matches' in per_class_result else [] + if aggregate: + dt_matches = int(sum(dt_matches)) + gt_matches = int(np.sum(np.array(gt_matches) != 0)) matching_result = { - 'prediction_matches': per_class_result['dt_matches'][0].tolist(), - 'annotation_matches': per_class_result['gt_matches'][0].tolist(), - metric_name: per_class_result['result'] + 'prediction_matches': dt_matches, + 'annotation_matches': gt_matches, + 'result': result, } return matching_result diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/object_detection_metric_profiler.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/object_detection_metric_profiler.py index ee092a3003f..c1bd3ef2a5b 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/object_detection_metric_profiler.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/object_detection_metric_profiler.py @@ -4,9 +4,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/profiling_executor.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/profiling_executor.py index 5b4d4ab5111..dac7e8659f7 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/profiling_executor.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/profiling_executor.py @@ -54,7 +54,7 @@ def write_summary_result(result, meta, out_path, label_map): } out_dict = {} if out_path.exists(): - with open(str(out_path), 'r') as f: + with open(str(out_path), 'r', encoding='utf-8') as f: out_dict = json.load(f) final_summary = out_dict.get('summary_result', {}) @@ -65,7 +65,7 @@ def write_summary_result(result, meta, out_path, label_map): per_class_res.update(summary['per_class_result']) out_dict['per_class_result'] = per_class_res - with open(str(out_path), 'w') as f: + with open(str(out_path), 'w', encoding='utf-8') as f: json.dump(out_dict, f) @@ -110,3 +110,15 @@ def get_last_report(self): for profiler_id, profiler in self.profilers.items(): reports[profiler_id] = profiler.last_report return reports + + def update_annotation_and_prediction(self, annotation, prediction): + for profiler in self.profilers.values(): + if profiler.required_postprocessing: + profiler.update_annotation_and_prediction(annotation, prediction) + + @property + def required_postprocessing(self): + for profiler in self.profilers.values(): + if profiler.required_postprocessing: + return True + return False diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/segmentation_metric_profiler.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/segmentation_metric_profiler.py index aef177a0cc9..e9868bbab9f 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/segmentation_metric_profiler.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/metric_profiler/segmentation_metric_profiler.py @@ -26,13 +26,49 @@ def __init__(self, dump_iterations=100, report_type='csv', name=None): self.updated_fields = False self.names = [] self.metric_names = [] + self.mask_as_polygon = report_type == 'json' super().__init__(dump_iterations, report_type, name) + self.required_postprocessing = True + self.annotation, self.prediction = None, None def register_metric(self, metric_name): self.metric_names.append(metric_name) - def generate_profiling_data(self, identifier, metric_name, cm, metric_result, predicted_mask): + def generate_profiling_json(self, identifier, cm, metric_result, + prediction_mask_polygon, annotation_mask_polygon, per_class_result, ignore_label): + report = {'identifier': identifier} + class_result = {} + if self.prediction is not None: + prediction_mask_polygon = self.prediction.to_polygon() + for label, polygons in prediction_mask_polygon.items(): + if label == ignore_label: + continue + class_result[int(label)] = {'prediction_mask': [polygon.tolist() for polygon in polygons]} + if self.annotation: + annotation_mask_polygon = self.annotation.to_polygon() + for label, polygons in annotation_mask_polygon.items(): + if label == ignore_label: + continue + if int(label) not in class_result: + class_result[int(label)] = {'prediction_mask': []} + class_result[int(label)].update({'annotation_mask': [polygon.tolist() for polygon in polygons]}) + report['confusion_matrix'] = cm.tolist() + report['result'] = np.mean(metric_result) + if per_class_result: + for label, metric in per_class_result.items(): + if int(label) not in class_result: + continue + class_result[int(label)]['result'] = metric + report['per_class_result'] = class_result + + return report + + def generate_profiling_data(self, identifier, metric_name, cm, metric_result, predicted_mask, + prediction_mask_polygon, annotation_mask_polygon, per_class_result, ignore_label): + if self.report_type == 'json': + return self.generate_profiling_json(identifier, cm, metric_result, + prediction_mask_polygon, annotation_mask_polygon, per_class_result, ignore_label) dumping_dir = self.out_dir / 'dumped' if not dumping_dir.exists(): dumping_dir.mkdir(parents=True) @@ -47,21 +83,19 @@ def generate_profiling_data(self, identifier, metric_name, cm, metric_result, pr if not self.updated_fields: self._create_fields(metric_result) report = {'identifier': identifier, 'predicted_mask': str(dumping_dir / dumped_file_name)} - if self.report_type == 'json': - report['confusion_matrix'] = cm.tolist() if np.isscalar(metric_result) or np.size(metric_result) == 1: report['{}_result'.format(metric_name)] = np.mean(metric_result) return report if not self.names: metrics_results = { - 'class {} ({})'.format(class_id, metric_name): result for class_id, result in enumerate(metric_result) + 'class {} ({})'.format(class_id, metric_name): + result for class_id, result in enumerate(metric_result) } else: metrics_results = {} for name, result in zip(self.names, metric_result): metrics_results['{} ({})'.format(name, metric_name)] = result report.update(metrics_results) - return report def _create_fields(self, metric_result): @@ -82,3 +116,7 @@ def _create_fields(self, metric_result): def set_dataset_meta(self, meta): self.dataset_meta = meta + + def update_annotation_and_prediction(self, annotation, prediction): + self.annotation = annotation + self.prediction = prediction diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/question_answering.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/question_answering.py index f1def3ebceb..0f47be71b8c 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/question_answering.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/question_answering.py @@ -88,7 +88,7 @@ def compute_f1(a_gold, a_pred): f1 = (2 * precision * recall) / (precision + recall) return f1 - def evaluate(self, annotation, prediction): + def evaluate(self, annotations, predictions): return sum(self.per_question_results.values()) / len(self.per_question_results) def reset(self): @@ -121,7 +121,7 @@ def update(self, annotation, prediction): def compute_exact(a_gold, a_pred): return int(normalize_answer(a_gold) == normalize_answer(a_pred)) - def evaluate(self, annotation, prediction): + def evaluate(self, annotations, predictions): return sum(self.per_question_results.values()) / len(self.per_question_results) def reset(self): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/regression.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/regression.py index cd8787ec973..beff4807b5a 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/regression.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/regression.py @@ -23,6 +23,8 @@ from ..representation import ( RegressionAnnotation, RegressionPrediction, + FacialLandmarksHeatMapAnnotation, + FacialLandmarksHeatMapPrediction, FacialLandmarksAnnotation, FacialLandmarksPrediction, FacialLandmarks3DAnnotation, @@ -79,6 +81,7 @@ def configure(self): }) self.magnitude = [] + def update(self, annotation, prediction): diff = self.calculate_diff(annotation, prediction) if isinstance(diff, dict): @@ -380,8 +383,8 @@ def __init__(self, *args, **kwargs): class FacialLandmarksPerPointNormedError(PerImageEvaluationMetric): __provider__ = 'per_point_normed_error' - annotation_types = (FacialLandmarksAnnotation, FacialLandmarks3DAnnotation) - prediction_types = (FacialLandmarksPrediction, FacialLandmarks3DPrediction) + annotation_types = (FacialLandmarksAnnotation, FacialLandmarks3DAnnotation, FacialLandmarksHeatMapAnnotation) + prediction_types = (FacialLandmarksPrediction, FacialLandmarks3DPrediction, FacialLandmarksHeatMapAnnotation) def configure(self): self.meta.update({ @@ -426,8 +429,8 @@ def reset(self): class FacialLandmarksNormedError(PerImageEvaluationMetric): __provider__ = 'normed_error' - annotation_types = (FacialLandmarksAnnotation, FacialLandmarks3DAnnotation) - prediction_types = (FacialLandmarksPrediction, FacialLandmarks3DPrediction) + annotation_types = (FacialLandmarksAnnotation, FacialLandmarks3DAnnotation, FacialLandmarksHeatMapAnnotation) + prediction_types = (FacialLandmarksPrediction, FacialLandmarks3DPrediction, FacialLandmarksHeatMapPrediction) @classmethod def parameters(cls): @@ -455,6 +458,11 @@ def configure(self): 'target': 'higher-worse' }) self.magnitude = [] + self.meta['names'] = ['mean'] + if self.calculate_std: + self.meta['names'].append('std') + if self.percentile: + self.meta['names'].append('{}th percentile'.format(self.percentile)) def update(self, annotation, prediction): per_point_result = point_regression_differ( @@ -475,18 +483,15 @@ def update(self, annotation, prediction): return avg_result def evaluate(self, annotations, predictions): - self.meta['names'] = ['mean'] result = [np.mean(self.magnitude)] if self.calculate_std: result.append(np.std(self.magnitude)) - self.meta['names'].append('std') if self.percentile: sorted_magnitude = np.sort(self.magnitude) index = len(self.magnitude) / 100 * self.percentile result.append(sorted_magnitude[int(index)]) - self.meta['names'].append('{}th percentile'.format(self.percentile)) if self.profiler: self.profiler.finish() @@ -501,8 +506,8 @@ def reset(self): class NormalizedMeanError(PerImageEvaluationMetric): __provider__ = 'nme' - annotation_types = (FacialLandmarks3DAnnotation, ) - prediction_types = (FacialLandmarks3DPrediction, ) + annotation_types = (FacialLandmarks3DAnnotation, FacialLandmarksHeatMapAnnotation) + prediction_types = (FacialLandmarks3DPrediction, FacialLandmarksHeatMapPrediction) @classmethod def parameters(cls): @@ -526,8 +531,12 @@ def configure(self): self.magnitude = [] def update(self, annotation, prediction): - gt = np.array([annotation.x_values, annotation.y_values, annotation.z_values]).T - pred = np.array([prediction.x_values, prediction.y_values, prediction.z_values]).T + if self.only_2d: + gt = np.array([annotation.x_values, annotation.y_values]).T + pred = np.array([prediction.x_values, prediction.y_values]).T + else: + gt = np.array([annotation.x_values, annotation.y_values, annotation.z_values]).T + pred = np.array([prediction.x_values, prediction.y_values, prediction.z_values]).T diff = np.square(gt - pred) dist = np.sqrt(np.sum(diff[:, 0:2], axis=1)) if self.only_2d else np.sqrt(np.sum(diff, axis=1)) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/reid.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/reid.py index b9260ca6591..92fe8c08a8d 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/reid.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/reid.py @@ -22,10 +22,18 @@ ReIdentificationClassificationAnnotation, ReIdentificationAnnotation, PlaceRecognitionAnnotation, - ReIdentificationPrediction + ReIdentificationPrediction, + SentenceSimilarityAnnotation ) from ..config import BaseField, BoolField, NumberField, StringField from .metric import FullDatasetEvaluationMetric +from ..utils import UnsupportedPackage + +try: + from scipy.stats import spearmanr, pearsonr +except ImportError as e: + spearmanr = UnsupportedPackage('scipy', e.msg) + pearsonr = UnsupportedPackage('scipy', e.msg) def _auc(x, y): @@ -755,3 +763,109 @@ def evaluate(self, annotations, predictions): correct_at_n += 1 recall = correct_at_n / query_len return recall + + +def row_norms(x, squared=False): + norms = np.einsum("ij,ij->i", x, x) + if not squared: + np.sqrt(norms, norms) + return norms + + +def pairwise_dot_score(embeddings1, embeddings2): + return [np.dot(emb1, emb2) for emb1, emb2 in zip(embeddings1, embeddings2)] + + +def pairwise_manhattan_score(embeddings1, embeddings2): + return [-1 * np.abs(emb1 - emb2).sum(axis=-1) for emb1, emb2 in zip(embeddings1, embeddings2)] + + +def pairwise_euclidean_score(embeddings1, embeddings2): + return [-1 * row_norms(emb1[np.newaxis, :] - emb2[np.newaxis, :]) for emb1, emb2 in zip(embeddings1, embeddings2)] + + +def pairwise_cosine_score(embeddings1, embeddings2): + def cosine_dist(emb1, emb2): + return 0.5 * row_norms( + emb1 / (row_norms(emb1)[:, np.newaxis]) - emb2 / (row_norms(emb2)[:, np.newaxis]), squared=True) + return [1 - cosine_dist(emb1[np.newaxis, :], emb2[np.newaxis, :]) for emb1, emb2 in zip(embeddings1, embeddings2)] + + +similarity_score = { + 'manhattan': pairwise_manhattan_score, + 'euclidean': pairwise_euclidean_score, + 'cosine': pairwise_cosine_score, + 'dot_product': pairwise_dot_score +} + + +class BaseSentenceSimilarityMetric(FullDatasetEvaluationMetric): + annotation_types = (SentenceSimilarityAnnotation, ) + prediction_types = (ReIdentificationPrediction, ) + + @classmethod + def parameters(cls): + params = super().parameters() + params.update({ + 'similarity_distance': StringField( + optional=True, default='cosine', choices=similarity_score, + description='select similarity distance calculation approach' + ) + }) + return params + + def configure(self): + self.similarity_score_func = similarity_score[self.get_value_from_config('similarity_distance')] + self.meta['scale'] = 1 + self.meta['postfix'] = '' + + @staticmethod + def get_pair_embeddings(annotations, predictions): + first_emb, second_emb, scores = [], [], [] + idx_to_emb = {ann.id: pred.embedding for ann, pred in zip(annotations, predictions)} + for ann in annotations: + if ann.pair_id is None: + continue + if ann.pair_id not in idx_to_emb: + continue + first_emb.append(idx_to_emb[ann.id]) + second_emb.append(idx_to_emb[ann.pair_id]) + scores.append(ann.similarity_score) + return first_emb, second_emb, scores + + def evaluate(self, annotations, predictions): + embeddings1, embeddings2, gt_score = self.get_pair_embeddings(annotations, predictions) + sim_score = self.similarity_score_func(embeddings1, embeddings2) + return sim_score, gt_score + + +class SpearmanCorrelation(BaseSentenceSimilarityMetric): + __provider__ = 'spearman_correlation_coef' + annotation_types = (SentenceSimilarityAnnotation, ) + prediction_types = (ReIdentificationPrediction, ) + + def configure(self): + super().configure() + if isinstance(spearmanr, UnsupportedPackage): + spearmanr.raise_error(self.name) + + def evaluate(self, annotations, predictions): + sim_score, gt_score = super().evaluate(annotations, predictions) + score, _ = spearmanr(gt_score, np.squeeze(sim_score)) + return score + + +class PearsonCorrelation(BaseSentenceSimilarityMetric): + __provider__ = 'pearson_correlation_coef' + annotation_types = (SentenceSimilarityAnnotation, ) + prediction_types = (ReIdentificationPrediction, ) + + def configure(self): + super().configure() + if isinstance(pearsonr, UnsupportedPackage): + spearmanr.raise_error(self.name) + + def evaluate(self, annotations, predictions): + sim_score, gt_score = super().evaluate(annotations, predictions) + score, _ = pearsonr(gt_score, np.squeeze(sim_score)) + return score diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/salient_objects_detection.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/salient_objects_detection.py index 4f0b0557fed..d3c86ad32aa 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/salient_objects_detection.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/salient_objects_detection.py @@ -69,8 +69,7 @@ def configure(self): def update(self, annotation, prediction): sum_label = 2 * np.mean(prediction.mask) - if sum_label > 1: - sum_label = 1 + sum_label = min(sum_label, 1) label3 = np.zeros_like(annotation.mask) label3[prediction.mask >= sum_label] = 1 diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/semantic_segmentation.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/semantic_segmentation.py index 91514a9c431..48f82cee116 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/semantic_segmentation.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/semantic_segmentation.py @@ -99,7 +99,18 @@ def update(self, annotation, prediction): cm = super().update(annotation, prediction) result = np.diag(cm).sum() / cm.sum() if self.profiler: - self.profiler.update(annotation.identifier, self.name, cm, result, prediction.mask) + diagonal = np.diag(cm).astype(float) + per_class_count = cm.sum(axis=1) + acc_cls = np.divide(diagonal, per_class_count, out=np.full_like(diagonal, np.nan), + where=per_class_count != 0) + acc_cls, labels = finalize_metric_result( + acc_cls, [key for key in self.dataset.labels if key != self.ignore_label] + ) + per_class_result = dict(zip(labels, acc_cls)) + self.profiler.update( + annotation.identifier, self.name, cm, result, + prediction.mask, prediction.to_polygon(), annotation.to_polygon(), per_class_result, self.ignore_label + ) return result def evaluate(self, annotations, predictions): @@ -112,6 +123,13 @@ def evaluate(self, annotations, predictions): class SegmentationIOU(SegmentationMetric): __provider__ = 'mean_iou' + def configure(self): + super().configure() + cls_names = list(self.dataset.labels.values()) + if self.ignore_label is not None: + cls_names = [cls_name for cls_id, cls_name in self.dataset.labels.items() if cls_id != self.ignore_label] + self.meta['names'] = cls_names + def update(self, annotation, prediction): cm = super().update(annotation, prediction) diagonal = np.diag(cm).astype(float) @@ -119,8 +137,13 @@ def update(self, annotation, prediction): iou = np.divide(diagonal, union, out=np.full_like(diagonal, np.nan), where=union != 0) if self.ignore_label is not None: iou = np.delete(iou, self.ignore_label) + iou, labels = finalize_metric_result(iou, [key for key in self.dataset.labels if key != self.ignore_label]) if self.profiler: - self.profiler.update(annotation.identifier, self.name, cm, iou, prediction.mask) + per_class_result = dict(zip(labels, iou)) + self.profiler.update( + annotation.identifier, self.name, cm, iou, prediction.mask, + prediction.to_polygon(), annotation.to_polygon(), per_class_result, self.ignore_label + ) return iou @@ -146,13 +169,22 @@ def evaluate(self, annotations, predictions): class SegmentationMeanAccuracy(SegmentationMetric): __provider__ = 'mean_accuracy' + def configure(self): + super().configure() + self.meta['names'] = list(self.dataset.labels.values()) + def update(self, annotation, prediction): cm = super().update(annotation, prediction) diagonal = np.diag(cm).astype(float) per_class_count = cm.sum(axis=1) acc_cls = np.divide(diagonal, per_class_count, out=np.full_like(diagonal, np.nan), where=per_class_count != 0) + acc_cls, labels = finalize_metric_result( + acc_cls, [key for key in self.dataset.labels if key != self.ignore_label] + ) if self.profiler: - self.profiler.update(annotation.identifier, self.name, cm, acc_cls, prediction.mask) + per_class_result = dict(zip(labels, acc_cls)) + self.profiler.update(annotation.identifier, self.name, cm, acc_cls, prediction.mask, + prediction.to_polygon(), annotation.to_polygon(), per_class_result, self.ignore_label) return acc_cls def evaluate(self, annotations, predictions): @@ -182,7 +214,15 @@ def update(self, annotation, prediction): result = (freq[freq > 0] * iou[freq > 0]).sum() if self.profiler: - self.profiler.update(annotation.identifier, self.name, cm, result, prediction.mask) + class_result = freq * iou + class_result[freq == 0] = np.nan + class_result, labels = finalize_metric_result( + class_result, list(self.dataset.labels) + ) + per_class_result = dict(zip(labels, class_result)) + self.profiler.update(annotation.identifier, self.name, cm, result, + prediction.mask, prediction.to_polygon(), annotation.to_polygon(), + per_class_result, self.ignore_label) return result diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/speech_recognition.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/speech_recognition.py index 67c7c9a0ea8..51adfc325bf 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/speech_recognition.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/speech_recognition.py @@ -44,7 +44,7 @@ def update(self, annotation, prediction): cur_words = len(annotation.label.split()) self.score += cur_score self.words += cur_words - return cur_score / cur_words + return cur_score / cur_words if cur_words != 0 else 0 def evaluate(self, annotations, predictions): return self.score / self.words if self.words != 0 else 0 @@ -70,7 +70,7 @@ def update(self, annotation, prediction): cur_length = len(annotation.label) self.score += cur_score self.length += cur_length - return cur_score / cur_length + return cur_score / cur_length if cur_length != 0 else 0 def evaluate(self, annotations, predictions): return self.score / self.length if self.length != 0 else 0 diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/misc.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/misc.py new file mode 100644 index 00000000000..4e259f9d174 --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/misc.py @@ -0,0 +1,43 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +from argparse import Namespace +from pathlib import Path +from .config import ConfigReader +from .evaluators import ModelEvaluator, ModuleEvaluator + +EVALUATION_MODE = { + 'models': ModelEvaluator, + 'evaluations': ModuleEvaluator +} + + +def get_metric_references(config_path, definitions_path, subset=None, additional_info=None, return_header=True): + args = {'config': Path(config_path), 'definitions': Path(definitions_path)} + if additional_info: + args.update(additional_info) + + config, mode = ConfigReader.merge(Namespace(**args)) + evaluator_class = EVALUATION_MODE.get(mode) + if not evaluator_class: + raise ValueError('Unknown evaluation mode') + report = [] + for conf in config[mode]: + header, template_report = evaluator_class.provide_metric_references(conf, subset) + report.extend(template_report) + if return_header: + return header, report + return report diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/README.md b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/README.md index 2ae66bee6dc..649dbcf7293 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/README.md +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/README.md @@ -64,6 +64,7 @@ Accuracy Checker supports following set of postprocessors: You can also use `size` instead in case when destination sizes are equal for all three dimensions. * `crop_or_pad-segmentation_mask` - performs central cropping if original mask size greater then destination size and padding in case, when source size lower than destination. Padding filling value is 0, realization - right-bottom. * `dst_width` and `dst_height` are destination width and height for keypoints resizing respectively. You can also use `size` instead in case when destination sizes are equal. Supported representations: `SegmentationAnotation`, `SegmentationPrediction`. +* `heatmap2keypoints` - extract landmark keypoints from the heatmap. Supported representations: `FacialLandmarksHeatMapAnnotation`, `FacialLandmarksHeatMapPrediction`. * `clip_segmentation_mask` - clipping segmentation mask values. Supported representations: `BrainTumorSegmentationAnnotation`, `BrainTumorSegmentationPrediction`. * `min_value` - lower bound of range. * `max_value` - upper bound of range. @@ -129,3 +130,6 @@ Accuracy Checker supports following set of postprocessors: * `apply_to` - determines target masks for processing (`annotation` for ground truth and `prediction` for detection results, `all` for both). * `min` - minimal value in range, optional, default 0. * `max`- maximal value in range. +* `sentence_similarity_pooling` - pool words embeddings for sentence similarity task. Supported representations: `SentenceSimilarityAnnotation`, `ReidentificationPrediction`. + * `pooling type` - pooling type for embeddings - `mean` for mean pooling, `max` for max pooling (Optional, default `mean`). + * `remove_padding` - remove end of string padding from word embeddings (Optional, default `True`). diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/__init__.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/__init__.py index f4347a8a9ef..7ce8d0eab29 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/__init__.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/__init__.py @@ -65,7 +65,8 @@ from .interp import Interpolation from .invert_mask import InvertMask from .rescale_mask import RescaleMask - +from .facial_landmarks_98_postprocess import Heatmap2Keypoints +from .text_similarity_pooling import SentenceSimilarityPooling __all__ = [ 'Postprocessor', @@ -149,4 +150,8 @@ 'InvertMask', 'RescaleMask', + + 'Heatmap2Keypoints', + + 'SentenceSimilarityPooling' ] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/brats_postprocessing.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/brats_postprocessing.py index 9fae99bf353..3dca9c0813c 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/brats_postprocessing.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/brats_postprocessing.py @@ -52,7 +52,7 @@ def parameters(cls): def configure(self): self.make_argmax = self.config.get('make_argmax') - def process_image(self, annotations, predictions): + def process_image(self, annotation, prediction): raise RuntimeError("Since `process_image_with_metadata` is overridden, this method MUST NOT be called") def process_image_with_metadata(self, annotation, prediction, image_metadata=None): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/crop_image.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/crop_image.py index 265c997bc02..c982f4029ab 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/crop_image.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/crop_image.py @@ -68,10 +68,10 @@ def process_image(self, annotation, prediction): return annotation, prediction - def process_image_with_metadata(self, annotations, predictions, image_metadata=None): + def process_image_with_metadata(self, annotation, prediction, image_metadata=None): if 'image_size' in image_metadata: self.image_size = image_metadata['image_size'] - self.process_image(annotations, predictions) + self.process_image(annotation, prediction) class CornerCropImage(PostprocessorWithSpecificTargets): @@ -117,7 +117,7 @@ def process_image(self, annotation, prediction): return annotation, prediction - def process_image_with_metadata(self, annotations, predictions, image_metadata=None): + def process_image_with_metadata(self, annotation, prediction, image_metadata=None): if 'image_size' in image_metadata: self.image_size = image_metadata['image_size'] - self.process_image(annotations, predictions) + self.process_image(annotation, prediction) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/crop_segmentation_mask.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/crop_segmentation_mask.py index 30a387670f9..108c62dd784 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/crop_segmentation_mask.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/crop_segmentation_mask.py @@ -119,10 +119,11 @@ def configure(self): self.dst_height, self.dst_width = get_size_from_config(self.config) def process_image(self, annotation, prediction): - for ann in annotation: - if annotation is None: - continue - ann.mask = self.process_mask(ann.mask) + if not self.deprocessing_mode: + for ann in annotation: + if annotation is None: + continue + ann.mask = self.process_mask(ann.mask) return annotation, prediction def process_mask(self, mask): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/encode_segmentation_mask.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/encode_segmentation_mask.py index 96cdae2ed0a..d4d6cfe2ef7 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/encode_segmentation_mask.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/encode_segmentation_mask.py @@ -34,7 +34,7 @@ def process_image(self, annotation, prediction): segmentation_colors = self.meta.get("segmentation_colors") prediction_to_gt_label = self.meta.get('prediction_to_gt_labels') - if annotation and any([ann is not None for ann in annotation]): + if annotation and any(ann is not None for ann in annotation): if not segmentation_colors: raise ValueError("No 'segmentation_colors' in dataset metadata.") diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/extend_segmentation_mask.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/extend_segmentation_mask.py index 6cd255dd3a1..0e5ca13e536 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/extend_segmentation_mask.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/extend_segmentation_mask.py @@ -69,7 +69,7 @@ def process_image(self, annotation, prediction): return annotation, prediction def process_image_with_metadata(self, annotation, prediction, image_metadata=None): - if all(annotation_ is None for annotation_ in annotation): + if all(annotation_ is None for annotation_ in annotation) or self.deprocessing_mode: return annotation, self._deprocess_prediction(prediction, image_metadata) return self.process_image(annotation, prediction) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/facial_landmarks_98_postprocess.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/facial_landmarks_98_postprocess.py new file mode 100644 index 00000000000..bda7fd94b58 --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/facial_landmarks_98_postprocess.py @@ -0,0 +1,152 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +import numpy as np +import cv2 +from ..postprocessor.postprocessor import Postprocessor +from ..representation import FacialLandmarksHeatMapAnnotation, FacialLandmarksHeatMapPrediction + + +class Heatmap2Keypoints(Postprocessor): + __provider__ = 'heatmap2keypoints' + + annotation_types = (FacialLandmarksHeatMapAnnotation, ) + prediction_types = (FacialLandmarksHeatMapPrediction, ) + + @classmethod + def parameters(cls): + parameters = super().parameters() + return parameters + + def configure(self): + pass + + def process_image(self, annotation, prediction): + for annotation_, prediction_ in zip(annotation, prediction): + height, width, _ = self.image_size + x_start, y_start = 0, 0 + resized_box = annotation_.metadata.get('rect') + + x_start, y_start, x_max, y_max = resized_box + width = x_max - x_start + height = y_max - y_start + + center, scale = self._xywh2cs(x_start, y_start, width, height) + pred, _ = self._keypoints_from_heatmaps(np.array(prediction_.heatmap), [center], [scale]) + detLms_x = [] + detLms_y = [] + for pr in pred[0]: + detLms_x.append(pr[0]) + detLms_y.append(pr[1]) + + prediction_.x_values = detLms_x + prediction_.y_values = detLms_y + + return annotation, prediction + + @classmethod + def _xywh2cs(cls, x, y, w, h, padding=1.25): + center = np.array([x + w * 0.5, y + h * 0.5], dtype=np.float32) + scale = np.array([w / 200.0, h / 200.0], dtype=np.float32) + scale = scale * padding + return center, scale + + @classmethod + def _keypoints_from_heatmaps(cls, heatmaps, center, scale): + + def _get_max_preds(heatmaps): + N, K, _, W = heatmaps.shape + heatmaps_reshaped = heatmaps.reshape((N, K, -1)) + idx = np.argmax(heatmaps_reshaped, 2).reshape((N, K, 1)) + maxvals = np.amax(heatmaps_reshaped, 2).reshape((N, K, 1)) + + preds = np.tile(idx, (1, 1, 2)).astype(np.float32) + preds[:, :, 0] = preds[:, :, 0] % W + preds[:, :, 1] = preds[:, :, 1] // W + preds = np.where(np.tile(maxvals, (1, 1, 2)) > 0.0, preds, -1) + return preds, maxvals + + def _get_3rd_point(a, b): + direction = a - b + third_pt = b + np.array([-direction[1], direction[0]], dtype=np.float32) + return third_pt + + def rotate_point(pt, angle_rad): + sn, cs = np.sin(angle_rad), np.cos(angle_rad) + new_x = pt[0] * cs - pt[1] * sn + new_y = pt[0] * sn + pt[1] * cs + rotated_pt = [new_x, new_y] + + return rotated_pt + + def _get_affine_transform(center, scale, rot, output_size, shift=(0., 0.), inv=False): + + scale_tmp = scale * 200.0 + + shift = np.array(shift) + src_w = scale_tmp[0] + dst_w = output_size[0] + dst_h = output_size[1] + + rot_rad = np.pi * rot / 180 + src_dir = rotate_point([0., src_w * -0.5], rot_rad) + dst_dir = np.array([0., dst_w * -0.5]) + + src = np.zeros((3, 2), dtype=np.float32) + src[0, :] = center + scale_tmp * shift + src[1, :] = center + src_dir + scale_tmp * shift + src[2, :] = _get_3rd_point(src[0, :], src[1, :]) + + dst = np.zeros((3, 2), dtype=np.float32) + dst[0, :] = [dst_w * 0.5, dst_h * 0.5] + dst[1, :] = np.array([dst_w * 0.5, dst_h * 0.5]) + dst_dir + dst[2, :] = _get_3rd_point(dst[0, :], dst[1, :]) + + if inv: + trans = cv2.getAffineTransform(np.float32(dst), np.float32(src)) + else: + trans = cv2.getAffineTransform(np.float32(src), np.float32(dst)) + + return trans + + def _transform_preds(coords, center, scale, output_size, use_udp=False): + target_coords = coords.copy() + trans = _get_affine_transform(center, scale, 0, output_size, inv=True) + for p in range(coords.shape[0]): + target_coords[p, 0:2] = np.array(trans) @ np.array([coords[p, 0:2][0], coords[p, 0:2][1], 1.]) + return target_coords + + N, K, H, W = heatmaps.shape + preds, maxvals = _get_max_preds(heatmaps) + + for n in range(N): + for k in range(K): + heatmap = heatmaps[n][k] + px = int(preds[n][k][0]) + py = int(preds[n][k][1]) + if 1 < px < W - 1 and 1 < py < H - 1: + diff = np.array([ + heatmap[py][px + 1] - heatmap[py][px - 1], + heatmap[py + 1][px] - heatmap[py - 1][px] + ]) + preds[n][k] += np.sign(diff) * .25 + + # Transform back to the image + for i in range(N): + preds[i] = _transform_preds( + preds[i], center[i], scale[i], [W, H]) + + return preds, maxvals diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/faster_rcnn_postprocessing_resize.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/faster_rcnn_postprocessing_resize.py index ad5c81ea443..3a8bd6748c8 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/faster_rcnn_postprocessing_resize.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/faster_rcnn_postprocessing_resize.py @@ -84,19 +84,19 @@ def get_coeff_x_y_from_metadata(image_metadata, rescale=False): coeff_y /= input_h return coeff_x, coeff_y - def process_image(self, annotations, predictions): + def process_image(self, annotation, prediction): raise RuntimeError("Since `process_image_with_metadata` is overridden, this method MUST NOT be called") - def process_image_with_metadata(self, annotations, predictions, image_metadata=None): + def process_image_with_metadata(self, annotation, prediction, image_metadata=None): assert image_metadata and 'geometric_operations' in image_metadata, ( "Postprocessing step `faster_rcnn_postprocessing_resize` cannot work without " "metadata with `geometric_operations` field") coeff_x, coeff_y = self.get_coeff_x_y_from_metadata(image_metadata, self.rescale) - for prediction in predictions: - prediction.x_mins *= coeff_x - prediction.x_maxs *= coeff_x - prediction.y_mins *= coeff_y - prediction.y_maxs *= coeff_y + for pred in prediction: + pred.x_mins *= coeff_x + pred.x_maxs *= coeff_x + pred.y_mins *= coeff_y + pred.y_maxs *= coeff_y - return annotations, predictions + return annotation, prediction diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/filter.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/filter.py index ff4eaf9350f..e27d6504442 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/filter.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/filter.py @@ -104,10 +104,10 @@ def apply_filter(self, entry, filter_arg): class FilterByLabels(BaseFilter): __provider__ = 'labels' - def apply_filter(self, entry, labels): + def apply_filter(self, entry, filter_arg): filtered = [] for index, label in enumerate(entry.labels): - if label in labels: + if label in filter_arg: filtered.append(index) return filtered @@ -116,14 +116,14 @@ def apply_filter(self, entry, labels): class FilterByMinConfidence(BaseFilter): __provider__ = 'min_confidence' - def apply_filter(self, entry, min_confidence): + def apply_filter(self, entry, filter_arg): filtered = [] if isinstance(entry, DetectionAnnotation): return filtered for index, score in enumerate(entry.scores): - if score < min_confidence: + if score < filter_arg: filtered.append(index) return filtered @@ -132,16 +132,16 @@ def apply_filter(self, entry, min_confidence): class FilterTopK(BaseFilter): __provider__ = 'top_k' - def apply_filter(self, entry, top_k): + def apply_filter(self, entry, filter_arg): filtered = [] if isinstance(entry, DetectionAnnotation): return filtered - if len(entry.scores) <= top_k: + if len(entry.scores) <= filter_arg: return filtered scores_inds = np.argsort(entry.scores)[::-1] - non_filtered = scores_inds[:int(top_k)] + non_filtered = scores_inds[:int(filter_arg)] return [ind for ind in range(len(entry.scores)) if ind not in non_filtered] @@ -151,7 +151,7 @@ class FilterByHeightRange(BaseFilter): annotation_types = (DetectionAnnotation, TextDetectionAnnotation) prediction_types = (DetectionPrediction, TextDetectionPrediction) - def apply_filter(self, entry, height_range): + def apply_filter(self, entry, filter_arg): @singledispatch def filter_func(entry_value, height_range_): return [] @@ -180,7 +180,7 @@ def _(entry_values, height_range_): return filtered - return filter_func(entry, convert_to_range(height_range)) + return filter_func(entry, convert_to_range(filter_arg)) class FilterByWidthRange(BaseFilter): @@ -189,7 +189,7 @@ class FilterByWidthRange(BaseFilter): annotation_types = (DetectionAnnotation, TextDetectionAnnotation) prediction_types = (DetectionPrediction, TextDetectionPrediction) - def apply_filter(self, entry, width_range): + def apply_filter(self, entry, filter_arg): @singledispatch def filter_func(entry_value, width_range_): return [] @@ -218,7 +218,7 @@ def _(entry_values, width_range_): return filtered - return filter_func(entry, convert_to_range(width_range)) + return filter_func(entry, convert_to_range(filter_arg)) class FilterByAreaRange(BaseFilter): @@ -227,8 +227,8 @@ class FilterByAreaRange(BaseFilter): annotation_types = (TextDetectionAnnotation, PoseEstimationAnnotation) prediction_types = (TextDetectionPrediction, ) - def apply_filter(self, entry, area_range): - area_range = convert_to_range(area_range) + def apply_filter(self, entry, filter_arg): + area_range = convert_to_range(filter_arg) @singledispatch def filter_func(entry, area_range): @@ -259,7 +259,7 @@ def _(entry, area_range): class FilterEmpty(BaseFilter): __provider__ = 'is_empty' - def apply_filter(self, entry: DetectionAnnotation, is_empty): + def apply_filter(self, entry: DetectionAnnotation, filter_arg): return np.where(np.bitwise_or(entry.x_maxs - entry.x_mins <= 0, entry.y_maxs - entry.y_mins <= 0))[0] @@ -272,9 +272,9 @@ class FilterByVisibility(BaseFilter): 'visible': 2 } - def apply_filter(self, entry, min_visibility): + def apply_filter(self, entry, filter_arg): filtered = [] - min_visibility_level = self.visibility_level(min_visibility) + min_visibility_level = self.visibility_level(filter_arg) for index, visibility in enumerate(entry.metadata.get('visibilities', [])): if self.visibility_level(visibility) < min_visibility_level: filtered.append(index) @@ -293,8 +293,8 @@ def visibility_level(self, visibility): class FilterByAspectRatio(BaseFilter): __provider__ = 'aspect_ratio' - def apply_filter(self, entry, aspect_ratio): - aspect_ratio = convert_to_range(aspect_ratio) + def apply_filter(self, entry, filter_arg): + aspect_ratio = convert_to_range(filter_arg) filtered = [] coordinates = zip(entry.x_mins, entry.y_mins, entry.x_maxs, entry.y_maxs) @@ -309,8 +309,8 @@ def apply_filter(self, entry, aspect_ratio): class FilterByAreaRatio(BaseFilter): __provider__ = 'area_ratio' - def apply_filter(self, entry, area_ratio): - area_ratio = convert_to_range(area_ratio) + def apply_filter(self, entry, filter_arg): + area_ratio = convert_to_range(filter_arg) filtered = [] if not isinstance(entry, DetectionAnnotation): @@ -337,7 +337,7 @@ def apply_filter(self, entry, area_ratio): class FilterInvalidBoxes(BaseFilter): __provider__ = 'invalid_boxes' - def apply_filter(self, entry, invalid_boxes): + def apply_filter(self, entry, filter_arg): infinite_mask_x = np.logical_or(~np.isfinite(entry.x_mins), ~np.isfinite(entry.x_maxs)) # pylint: disable=E1130 infinite_mask_y = np.logical_or(~np.isfinite(entry.y_mins), ~np.isfinite(entry.y_maxs)) # pylint: disable=E1130 infinite_mask = np.logical_or(infinite_mask_x, infinite_mask_y) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/nms.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/nms.py index 1bece90a865..4c80d5ae10a 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/nms.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/nms.py @@ -77,16 +77,16 @@ def configure(self): self.keep_top_k = self.get_value_from_config('keep_top_k') self.use_min_area = self.get_value_from_config('use_min_area') - def process_image(self, annotations, predictions): - for prediction in predictions: - scores = get_scores(prediction) + def process_image(self, annotation, prediction): + for pred in prediction: + scores = get_scores(pred) keep = self.nms( - prediction.x_mins, prediction.y_mins, prediction.x_maxs, prediction.y_maxs, scores, + pred.x_mins, pred.y_mins, pred.x_maxs, pred.y_maxs, scores, self.overlap, self.include_boundaries, self.keep_top_k, self.use_min_area ) - prediction.remove([box for box in range(len(prediction.x_mins)) if box not in keep]) + pred.remove([box for box in range(len(pred.x_mins)) if box not in keep]) - return annotations, predictions + return annotation, prediction @staticmethod def nms(x1, y1, x2, y2, scores, thresh, include_boundaries=True, keep_top_k=None, use_min_area=False): @@ -137,22 +137,22 @@ class ClassAwareNMS(NMS): prediction_types = (DetectionPrediction, ActionDetectionPrediction) annotation_types = (DetectionAnnotation, ActionDetectionPrediction) - def process_image(self, annotations, predictions): - for prediction in predictions: - scores = get_scores(prediction) - labels = prediction.labels + def process_image(self, annotation, prediction): + for pred in prediction: + scores = get_scores(pred) + labels = pred.labels keep = [] for label in np.unique(labels): mask = np.flatnonzero(label == labels) keep_i = self.nms( - prediction.x_mins[mask], prediction.y_mins[mask], prediction.x_maxs[mask], prediction.y_maxs[mask], + pred.x_mins[mask], pred.y_mins[mask], pred.x_maxs[mask], pred.y_maxs[mask], scores[mask], self.overlap, self.include_boundaries, self.keep_top_k, self.use_min_area ) keep.extend(mask[keep_i]) - prediction.remove([box for box in range(prediction.size) if box not in keep]) + pred.remove([box for box in range(pred.size) if box not in keep]) - return annotations, predictions + return annotation, prediction class SoftNMS(Postprocessor): __provider__ = 'soft_nms' @@ -184,19 +184,19 @@ def configure(self): self.sigma = self.get_value_from_config('sigma') self.min_score = self.get_value_from_config('min_score') - def process_image(self, annotations, predictions): - for prediction in predictions: - if not prediction.size: + def process_image(self, annotation, prediction): + for pred in prediction: + if not pred.size: continue - scores = get_scores(prediction) + scores = get_scores(pred) keep, new_scores = self._nms( - np.c_[prediction.x_mins, prediction.y_mins, prediction.x_maxs, prediction.y_maxs], scores, + np.c_[pred.x_mins, pred.y_mins, pred.x_maxs, pred.y_maxs], scores, ) - prediction.remove([box for box in range(len(prediction.x_mins)) if box not in keep]) - set_scores(prediction, new_scores) + pred.remove([box for box in range(len(pred.x_mins)) if box not in keep]) + set_scores(pred, new_scores) - return annotations, predictions + return annotation, prediction @staticmethod def _matrix_iou(set_a, set_b): @@ -280,16 +280,16 @@ def configure(self): self.include_boundaries = self.get_value_from_config('include_boundaries') self.keep_top_k = self.get_value_from_config('keep_top_k') - def process_image(self, annotations, predictions): - for prediction in predictions: - scores = get_scores(prediction) + def process_image(self, annotation, prediction): + for pred in prediction: + scores = get_scores(pred) keep = self.diou_nms( - prediction.x_mins, prediction.y_mins, prediction.x_maxs, prediction.y_maxs, scores, + pred.x_mins, pred.y_mins, pred.x_maxs, pred.y_maxs, scores, self.overlap, self.include_boundaries, self.keep_top_k ) - prediction.remove([box for box in range(len(prediction.x_mins)) if box not in keep]) + pred.remove([box for box in range(len(pred.x_mins)) if box not in keep]) - return annotations, predictions + return annotation, prediction @staticmethod def diou_nms(x1, y1, x2, y2, scores, thresh, include_boundaries=True, keep_top_k=None, use_min_area=False): diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/postprocessing_executor.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/postprocessing_executor.py index cff275ca729..1e678431d71 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/postprocessing_executor.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/postprocessing_executor.py @@ -67,6 +67,13 @@ def process_batch(self, annotations, predictions, metas=None, allow_empty_annota return zipped_result[0:2] # return changed annotations and predictions only + def deprocess_batch(self, annotations, predictions, metas=None): + if metas is None: + zipped_result = zipped_transform(self.deprocess_image, annotations, predictions) + else: + zipped_result = zipped_transform(self.deprocess_image, annotations, predictions, metas) + return zipped_result[0:2] # return changed annotations and predictions only + def full_process(self, annotations, predictions, metas=None): self.postprocessing_applyed = True return self.process_dataset(*self.process_batch(annotations, predictions, metas)) @@ -113,6 +120,16 @@ def validate_config(cls, processors, fetch_only=False, uri_prefix=''): def reset(self): self.postprocessing_applyed = False + def deprocess_image(self, annotation, prediction, image_metadata=None): + self.postprocessing_applyed = True + for method in self._image_processors: + method.deprocessing_mode = True + annotation_entries, prediction_entries = method.get_entries(annotation, prediction) + method.process(annotation_entries, prediction_entries, image_metadata) + method.deprocessing_mode = False + + return annotation, prediction + class PostprocessorConfig(ConfigValidator): type = StringField(choices=Postprocessor.providers) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/postprocessor.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/postprocessor.py index 957ac78532f..3653fb6e833 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/postprocessor.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/postprocessor.py @@ -62,6 +62,7 @@ def __init__(self, config, name=None, meta=None, state=None): self.meta = meta self.state = state self.image_size = None + self.deprocessing_mode = False self.annotation_source = self.get_value_from_config('annotation_source') if self.annotation_source and not isinstance(self.annotation_source, list): @@ -216,7 +217,7 @@ def setup(self): apply_to = self.get_value_from_config('apply_to') self._required_both = False self.apply_to = ApplyToOption(apply_to) if apply_to else None - self._deprocess_predictions = False + self._deprocess_predictions = self.deprocessing_mode if (self.annotation_source or self.prediction_source) and self.apply_to: raise ConfigError("apply_to and sources both provided. You need specify only one from them") @@ -254,7 +255,7 @@ def _choose_targets_using_sources(self, annotations, predictions): return target_annotations, target_predictions def _choose_targets_using_apply_to(self, annotations, predictions): - if all(annotation is None for annotation in annotations): + if all(annotation is None for annotation in annotations) or self.deprocessing_mode: apply_to = ApplyToOption.PREDICTION self._deprocess_predictions = True else: diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize.py index 6046ce72f1c..762d2f92650 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize.py @@ -93,7 +93,7 @@ def _calculate_scale(self, image_metadata): self.x_scale = image_w / input_w self.y_scale = image_h / input_h - def process_image(self, annotations, predictions): + def process_image(self, annotation, prediction): @singledispatch def resize(entry, height, width): return entry @@ -180,20 +180,20 @@ def _(entry): return height, width if self.apply_to is None or self.apply_to in [ApplyToOption.PREDICTION, ApplyToOption.ALL]: - if annotations: - for annotation, prediction in zip(annotations, predictions): - height, width = set_sizes(annotation or prediction) - resize(prediction, height, width) + if annotation: + for ann, pred in zip(annotation, prediction): + height, width = set_sizes(ann or pred) + resize(pred, height, width) else: - for prediction in predictions: - height, width = set_sizes(prediction) - resize(prediction, height, width) + for pred in prediction: + height, width = set_sizes(pred) + resize(pred, height, width) if self.apply_to is None or self.apply_to in [ApplyToOption.ANNOTATION, ApplyToOption.ALL]: - for annotation in annotations: - if annotation is None: + for ann in annotation: + if ann is None: continue - height, width = set_sizes(annotation) - resize(annotation, height, width) + height, width = set_sizes(ann) + resize(ann, height, width) - return annotations, predictions + return annotation, prediction diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize_prediction_boxes.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize_prediction_boxes.py index e5716b46dcb..977c631df7b 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize_prediction_boxes.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize_prediction_boxes.py @@ -42,15 +42,15 @@ def parameters(cls): def configure(self): self.rescale = self.get_value_from_config('rescale') - def process_image(self, annotations, predictions): + def process_image(self, annotation, prediction): h, w, _ = self.image_size - for prediction in predictions: - prediction.x_mins *= w - prediction.x_maxs *= w - prediction.y_mins *= h - prediction.y_maxs *= h + for pred in prediction: + pred.x_mins *= w + pred.x_maxs *= w + pred.y_mins *= h + pred.y_maxs *= h - return annotations, predictions + return annotation, prediction def process_image_with_metadata(self, annotation, prediction, image_metadata=None): h, w, _ = self.image_size diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize_segmentation_mask.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize_segmentation_mask.py index 90986595d40..53612163ccd 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize_segmentation_mask.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize_segmentation_mask.py @@ -140,7 +140,7 @@ def _bytescale(data): return np.array(image_new) - def process_image_with_metadata(self, annotations, predictions, image_metadata=None): - if 'image_info' in image_metadata and self.to_dst_image_size: + def process_image_with_metadata(self, annotation, prediction, image_metadata=None): + if 'image_info' in image_metadata and self.to_dst_image_size and not self._deprocess_predictions: self.image_size = image_metadata['image_info'] - self.process_image(annotations, predictions) + self.process_image(annotation, prediction) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/text_similarity_pooling.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/text_similarity_pooling.py new file mode 100644 index 00000000000..8a4a63fc601 --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/text_similarity_pooling.py @@ -0,0 +1,50 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +import numpy as np +from .postprocessor import Postprocessor +from ..config import StringField, BoolField +from ..representation import SentenceSimilarityAnnotation, ReIdentificationPrediction + + +class SentenceSimilarityPooling(Postprocessor): + __provider__ = 'sentence_similarity_pooling' + + annotation_types = (SentenceSimilarityAnnotation, ) + prediction_types = (ReIdentificationPrediction, ) + + @classmethod + def parameters(cls): + params = super().parameters() + params.update({ + 'pooling_type': StringField( + optional=True, default='mean', choices=['mean', 'max'], description='pooling type'), + 'remove_padding': BoolField(optional=True, default=True, description='allow removing padding') + }) + return params + + def configure(self): + self.pooling_type = self.get_value_from_config('pooling_type') + self.remove_padding = self.get_value_from_config('remove_padding') + + def process_image(self, annotation, prediction): + for ann, pred in zip(annotation, prediction): + pred_emb = pred.embedding + if self.remove_padding: + pred_emb = pred_emb[ann.input_mask != 0, :] + pred_emb = np.mean(pred_emb, axis=0) if self.pooling_type == 'mean' else np.max(pred_emb, axis=0) + pred.embedding = pred_emb + return annotation, prediction diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/translate_3d_poses.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/translate_3d_poses.py index 96787ffa230..f301e6e8f38 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/translate_3d_poses.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/translate_3d_poses.py @@ -23,13 +23,13 @@ class Translate3dPoses(Postprocessor): annotation_types = (PoseEstimation3dAnnotation,) prediction_types = (PoseEstimation3dPrediction,) - def process_image(self, annotations, predictions): - for batch_id, prediction in enumerate(predictions): - for pose_id in range(prediction.size): - translation = prediction.translations[pose_id] - translation[2] *= annotations[batch_id].fx if annotations[batch_id] is not None else 1 - prediction.x_3d_values[pose_id] += translation[0] - prediction.y_3d_values[pose_id] += translation[1] - prediction.z_3d_values[pose_id] += translation[2] - - return annotations, predictions + def process_image(self, annotation, prediction): + for batch_id, pred in enumerate(prediction): + for pose_id in range(pred.size): + translation = pred.translations[pose_id] + translation[2] *= annotation[batch_id].fx if annotation[batch_id] is not None else 1 + pred.x_3d_values[pose_id] += translation[0] + pred.y_3d_values[pose_id] += translation[1] + pred.z_3d_values[pose_id] += translation[2] + + return annotation, prediction diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/README.md b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/README.md index 98740875148..b9a48286f20 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/README.md +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/README.md @@ -182,6 +182,7 @@ Accuracy Checker supports following set of preprocessors: * `overlap` - sets overlapping for clips in percents or samples (use `%` or `samples` suffixes respectively) (no overlapping by default), e.g. `25%`, `4000samples` * `max_clips` - sets the maximum number of clips (clips all record by default) * `audio_normalization` - normalize audio record with mean sample subtraction and division on standard deviation of samples. + * `per_frame` - calculate mean and std for each frame separately (Optional, default `False`). * `audio_to_mel_spectrogram` - performs all needed preprocessing to calculate MEL spectrogram from time-domain audio signal * `window_size` - size of time-domain signal frame, seconds * `window_stride` - intersection of frames in time-domain, seconds @@ -234,6 +235,11 @@ Accuracy Checker supports following set of preprocessors: * `trimap` - concatenates image data with alpha-channel based information for cut, keep and calculation zones in image. * `cut_treshold` - maximum level of alpha values in cut zone. Optional, default is 0.1. * `keep_treshold` - minimum level of alpha values in keep zone. Optional, default is 0.9. Pixels with alpha-channel values between `cut_threshold` and `keep_treshold` are in calculation zone. +* `jpeg_compression` - compress the image into jpeg format. + * `quality_factor` - quality of compression, from 0 to 100 (the higher is the better). +* `transpose` - transpose data using specified axes order. + * `axes` - list of dimensions in transposing order. + ## Optimized preprocessing via OpenVINO Inference Engine OpenVINO™ is able perform preprocessing during model execution. For enabling this behaviour you can use command line parameter `--ie_preprocessing True`. diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/__init__.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/__init__.py index fca47f021da..663f6fe3582 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/__init__.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/__init__.py @@ -34,7 +34,8 @@ DCT, ClipCepstrum, TrimmingAudio, - AudioToMelSpectrogram + AudioToMelSpectrogram, + FFTSpectrogram ) from .audio_preprocessing_ext import ( SpliceFrame, @@ -46,7 +47,10 @@ ResampleAudio, ClipAudio, SamplesToFloat32, - NormalizeAudio + NormalizeAudio, + RemoveDCandDither, + TruncateBucket, + FrameSignalOverlappingWindow, ) from .normalization import Normalize, Normalize3d @@ -57,7 +61,8 @@ Tiling, ImagePyramid, FaceDetectionImagePyramid, - WarpAffine + WarpAffine, + Transpose ) from .crop import ( Crop, CropRect, ExtendAroundRect, Crop3D, TransformedCropWithAutoScale, @@ -71,6 +76,7 @@ from .one_hot_encoding import OneHotEncoding from .raw_image_preprocessing import PackBayerImage from .trimap import TrimapPreprocessor, AlphaChannel +from .compression import JPEGCompression __all__ = [ 'PreprocessingExecutor', @@ -95,6 +101,10 @@ 'PreemphFrame', 'SignalPatching', 'ContextWindow', + 'RemoveDCandDither', + 'FFTSpectrogram', + 'TruncateBucket', + 'FrameSignalOverlappingWindow', 'Resize', 'Resize3D', @@ -102,6 +112,7 @@ 'Flip', 'PointAligner', 'Tiling', + 'Transpose', 'CropBraTS', 'ImagePyramid', 'FaceDetectionImagePyramid', @@ -152,5 +163,6 @@ 'PackBayerImage', 'TrimapPreprocessor', - 'AlphaChannel' + 'AlphaChannel', + 'JPEGCompression' ] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/audio_preprocessing.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/audio_preprocessing.py index 34351602069..dd41f1ce27d 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/audio_preprocessing.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/audio_preprocessing.py @@ -90,6 +90,45 @@ def calculate_out_shape(self, data_shape): return [self.calculate_out_single_shape(ds) for ds in data_shape] +class FFTSpectrogram(Preprocessor): + __provider__ = 'fft' + shape_modificator = True + + @classmethod + def parameters(cls): + parameters = super().parameters() + parameters.update({ + 'num_fft': NumberField(optional=True, default=512, description="Base of FFT, samples", value_type=int), + 'magnitude_squared': BoolField(optional=True, default=True, description="Square spectrum magnitudes"), + 'skip_channels': BoolField(optional=True, default=False, description="Skips channels dimension"), + }) + return parameters + + def configure(self): + self.num_fft = self.get_value_from_config('num_fft') + self.magnutide_squared = self.get_value_from_config('magnitude_squared') + self.skip_channels = self.get_value_from_config('skip_channels') + + def process(self, image, annotation_meta=None): + frames = image.data + if self.skip_channels: + frames = frames.squeeze() + pspec = np.abs(np.fft.fft(frames, n=self.num_fft)) + if self.magnutide_squared: + pspec = np.square(pspec) + image.data = pspec + return image + + def calculate_out_single_shape(self, data_shape): + fake_input = np.zeros(data_shape) + if self.skip_channels: + fake_input = fake_input.squeeze() + return np.fft.fft(fake_input, n=self.num_fft).shape + + def calculate_out_shape(self, data_shape): + return [self.calculate_out_single_shape(ds) for ds in data_shape] + + class TriangleFiltering(Preprocessor): __provider__ = 'audio_triangle_filtering' shape_modificator = True diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/audio_preprocessing_ext.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/audio_preprocessing_ext.py index e5728b4d966..b3f406eb871 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/audio_preprocessing_ext.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/audio_preprocessing_ext.py @@ -16,8 +16,14 @@ import numpy as np -from ..config import BoolField, NumberField, BaseField, ConfigError +from ..config import BoolField, NumberField, BaseField, ConfigError, StringField from ..preprocessor import Preprocessor +from ..utils import UnsupportedPackage + +try: + from scipy.signal import lfilter +except ImportError as error: + lfilter = UnsupportedPackage('scipy', error.msg) class SpliceFrame(Preprocessor): @@ -360,15 +366,15 @@ def _parse_overlap(self, overlap): if overlap.endswith('%'): try: self.overlap = float(overlap[:-1]) / 100 - except ValueError: + except ValueError as value_err: raise ConfigError("Preprocessor {}: invalid value for 'overlap' - {}." - .format(self.__provider__, overlap)) + .format(self.__provider__, overlap)) from value_err elif overlap.endswith('samples'): try: self.overlap_in_samples = int(overlap[:-7]) - except ValueError: + except ValueError as value_err: raise ConfigError("Preprocessor {}: invalid value for 'overlap' - {}." - .format(self.__provider__, overlap)) + .format(self.__provider__, overlap)) from value_err if self.overlap_in_samples < 1: raise ConfigError("Preprocessor {}: invalid value for 'overlap' - {}." .format(self.__provider__, overlap)) @@ -379,9 +385,9 @@ def _parse_overlap(self, overlap): else: try: self.overlap = float(overlap) - except ValueError: + except ValueError as value_err: raise ConfigError("Preprocessor {}: invalid value for 'overlap' - {}." - .format(self.__provider__, overlap)) + .format(self.__provider__, overlap)) from value_err if self.overlap <= 0 or self.overlap >= 1: raise ConfigError("Preprocessor {}: invalid value for 'overlap' - {}." .format(self.__provider__, overlap)) @@ -392,9 +398,9 @@ def _parse_duration(self, duration): if duration.endswith('samples'): try: self.duration = int(duration[:-7]) - except ValueError: + except ValueError as value_err: raise ConfigError("Preprocessor {}: invalid value for duration - {}." - .format(self.__provider__, duration)) + .format(self.__provider__, duration)) from value_err if self.duration <= 1: raise ConfigError("Preprocessor {}: duration should be positive value - {}." .format(self.__provider__, self.duration)) @@ -405,9 +411,9 @@ def _parse_duration(self, duration): else: try: self.duration = float(duration) - except ValueError: + except ValueError as value_err: raise ConfigError("Preprocessor {}: invalid value for duration - {}." - .format(self.__provider__, duration)) + .format(self.__provider__, duration)) from value_err if self.duration <= 0: raise ConfigError("Preprocessor {}: duration should be positive value - {}." .format(self.__provider__, self.duration)) @@ -449,19 +455,24 @@ def parameters(cls): parameters = super().parameters() parameters.update({ 'int16mode': BoolField(optional=True, default=False, description="Normalization to int16 range"), + 'per_frame': BoolField( + optional=True, default=False, description='apply normalization to each frame separately') }) return parameters def configure(self): - self.int16mode = self.get_value_from_config('int16mode') + self.per_frame = self.get_value_from_config('per_frame') def process(self, image, annotation_meta=None): sound = image.data if self.int16mode: sound = sound / np.float32(0x8000) else: - sound = (sound - np.mean(sound)) / (np.std(sound) + 1e-15) + if not self.per_frame: + sound = (sound - np.mean(sound)) / (np.std(sound) + 1e-15) + else: + sound = np.array([(frame - np.mean(frame)) / (np.std(frame) + 1e-15) for frame in sound[0]]) image.data = sound @@ -510,3 +521,120 @@ def calculate_out_single_shape(self, data_shape): def calculate_out_shape(self, data_shape): return [self.calculate_out_single_shape(ds) for ds in data_shape] + + +class RemoveDCandDither(Preprocessor): + __provider__ = 'remove_dc_and_dither' + + @classmethod + def parameters(cls): + params = super().parameters() + params.update({ + 'alpha': NumberField(value_type=float, min_value=0, max_value=1, description='alpha'), + }) + return params + + def configure(self): + self.alpha = self.get_value_from_config('alpha') + + if isinstance(lfilter, UnsupportedPackage): + lfilter.raise_error(self.__provider__) + + def process(self, image, annotation_meta=None): + image.data = self.process_feat(image.data) + return image + + def process_feat(self, input_signal): + input_signal = lfilter([1, -1], [1, -1 * self.alpha], input_signal) + dither = np.random.random_sample(len(input_signal)) + np.random.random_sample(len(input_signal)) - 1 + spow = np.std(dither) + out_signal = input_signal + 1e-6 * spow * dither + return out_signal + + +windows = { + 'none': lambda x: np.ones((x,)), + 'hamming': np.hamming, + 'hanning': np.hanning, + 'blackman': np.blackman, + 'bartlett': np.bartlett, +} + + +class FrameSignalOverlappingWindow(Preprocessor): + __provider__ = 'frame_signal_overlap' + + @classmethod + def parameters(cls): + params = super().parameters() + params.update({ + 'frame_len': NumberField(value_type=float, min_value=0, description='frame length'), + 'frame_step': NumberField(value_type=float, min_value=0, description='frame step'), + 'window': StringField( + optional=True, default='none', description='rolling window function', choices=windows) + }) + return params + + def configure(self): + self.frame_len = self.get_value_from_config('frame_len') + self.frame_step = self.get_value_from_config('frame_step') + self.window = windows[self.get_value_from_config('window')] + + def process(self, image, annotation_meta=None): + def rolling_window(signal, window, step=1): + shape = signal.shape[:-1] + (signal.shape[-1] - window + 1, window) + strides = signal.strides + (signal.strides[-1],) + return np.lib.stride_tricks.as_strided(signal, shape=shape, strides=strides)[::step] + + sample_rate = image.metadata.get('sample_rate') + if sample_rate is None: + raise RuntimeError('Operation "{}" can\'t resample audio: required original samplerate in metadata.'. + format(self.__provider__)) + frame_len = int(round(self.frame_len * sample_rate)) + frame_step = int(round(self.frame_step * sample_rate)) + signal_len = image.data.shape[1] + if signal_len <= frame_len: + num_frames = 1 + else: + num_frames = 1 + int(np.ceil((1.0 * signal_len - frame_len) / frame_step)) + padding = np.zeros((1, int((num_frames - 1) * frame_step + frame_len) - signal_len)) + padded_signal = np.concatenate((image.data, padding), axis=1) + win = self.window(frame_len) + frames = rolling_window(padded_signal, window=frame_len, step=frame_step) + image.data = frames * win + return image + + +class TruncateBucket(Preprocessor): + __provider__ = 'truncate_bucket' + shape_modificator = True + _dynamic_shapes = True + + @classmethod + def parameters(cls): + params = super().parameters() + params.update({'bucket': NumberField(value_type=int, min_value=1)}) + return params + + def configure(self): + self.bucket_size = self.get_value_from_config('bucket') + + def process(self, image, annotation_meta=None): + if image.data.shape[1] < self.bucket_size: + return image + rsize = self.bucket_size + rstart = int((image.data.shape[1] - rsize) / 2) + image.data = image.data[:, rstart:rstart + rsize] + return image + + @property + def dynamic_result_shape(self): + return self._dynamic_shapes + + def calculate_out_shape_single(self, data_shape): + if data_shape[1] > self.bucket_size: + return data_shape[0], self.bucket_size + return data_shape + + def calculate_out_shape(self, data_shape): + return [self.calculate_out_shape_single(ds) for ds in data_shape] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/color_space_conversion.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/color_space_conversion.py index 7c362fae059..1c9ead5f9bc 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/color_space_conversion.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/color_space_conversion.py @@ -141,7 +141,7 @@ def __init__(self, config, name): raise ImportError( '*tf_convert_image_dtype* operation requires TensorFlow. ' 'Please install it before usage. {}'.format(import_error.msg) - ) + ) from import_error if tf.__version__ < '2.0.0': tf.enable_eager_execution() self.converter = tf.image.convert_image_dtype diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/compression.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/compression.py new file mode 100644 index 00000000000..92eec73979c --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/compression.py @@ -0,0 +1,62 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +import cv2 +import numpy as np + +from ..config import NumberField +from .preprocessor import Preprocessor + + +class JPEGCompression(Preprocessor): + __provider__ = 'jpeg_compression' + + @classmethod + def parameters(cls): + parameters = super().parameters() + parameters.update({ + 'quality_factor': NumberField( + value_type=int, optional=True, min_value=0, max_value=100, + description="Quality of compression, from 0 to 100 (the higher is the better)." + ) + }) + + return parameters + + def configure(self): + self.quality_factor = self.get_value_from_config('quality_factor') + + def process(self, image, annotation_meta=None): + if isinstance(image.data, list): + image.data = [ + self.process_data(fragment, self.quality_factor) + for fragment in image.data + ] + else: + image.data = self.process_data( + image.data, self.quality_factor) + + return image + + @staticmethod + def process_data(data, quality_factor): + channels = data.shape[2] + _, encimg = cv2.imencode('.jpg', data, [int(cv2.IMWRITE_JPEG_QUALITY), quality_factor]) + img_lq = cv2.imdecode(encimg, 0 if channels == 1 else 3) + if channels == 1: + img_lq = np.expand_dims(img_lq, axis=2) + + return img_lq diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/geometric_transformations.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/geometric_transformations.py index ec74603dc47..dd5cce6195c 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/geometric_transformations.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/geometric_transformations.py @@ -244,7 +244,7 @@ def parameters(cls): ), 'numpy_pad_mode': StringField( optional=True, default='constant', - choices=['constant', 'edge', 'maximum', 'minimum', 'mean', 'median', 'wrap'], + choices=['constant', 'edge', 'maximum', 'minimum', 'mean', 'median', 'symmetric', 'wrap'], description="If use_numpy is True, Numpy padding mode,including constant, edge, mean, etc." ), 'enable_resize': BoolField( @@ -751,3 +751,34 @@ def calculate_out_single_shape(self, data_shape): def calculate_out_shape(self, data_shape): return [self.calculate_out_single_shape(ds) if is_image(ds) else ds for ds in data_shape] + + +class Transpose(Preprocessor): + __provider__ = 'transpose' + shape_modificator = True + _dynamic_shape = True + + @classmethod + def parameters(cls): + params = super().parameters() + params.update({ + 'axes': ListField(value_type=int, description='axes order for transposing') + }) + return params + + def configure(self): + self.axes = self.get_value_from_config('axes') + + def process(self, image, annotation_meta=None): + image.data = np.transpose(image.data, self.axes) + return image + + @property + def dynamic_result_shape(self): + return self._dynamic_shape + + def calculate_out_shape(self, data_shape): + new_data_shape = [] + for ds in data_shape: + new_data_shape.append([ds[a] for a in self.axes]) + return new_data_shape diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/presenters.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/presenters.py index 6d8e4595894..2d4f28098af 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/presenters.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/presenters.py @@ -51,8 +51,7 @@ def write_result(self, evaluation_result: EvaluationResult, ignore_results_forma postfix, scale, result_format = get_result_format_parameters(meta, ignore_results_formatting) difference = None if reference and not ignore_metric_reference: - _, original_scale, _ = get_result_format_parameters(meta, False) - difference = compare_with_ref(reference, value, original_scale, name) + difference = compare_with_ref(reference, value, name) write_scalar_result( value, name, abs_threshold, rel_threshold, difference, postfix=postfix, scale=scale, result_format=result_format @@ -96,8 +95,7 @@ def write_result(self, evaluation_result: EvaluationResult, ignore_results_forma difference = None value_name = value_names[0] if value_names else None if reference and not ignore_metric_reference: - _, original_scale, _ = get_result_format_parameters(meta, False) - difference = compare_with_ref(reference, value, original_scale, value_name) + difference = compare_with_ref(reference, value, value_name) write_scalar_result( value, name, abs_threshold, rel_threshold, difference, value_name=value_name, @@ -113,7 +111,7 @@ def write_result(self, evaluation_result: EvaluationResult, ignore_results_forma value_name = value_names[index] if value_names else None if reference and not ignore_metric_reference and isinstance(reference, dict): - difference = compare_with_ref(reference, res, value_scale, value_name) + difference = compare_with_ref(reference, res, value_name) write_scalar_result( res, name, abs_threshold, rel_threshold, difference, value_name=value_name, @@ -123,14 +121,14 @@ def write_result(self, evaluation_result: EvaluationResult, ignore_results_forma ) if len(value) > 1 and meta.get('calculate_mean', True): - mean_value = np.mean(np.multiply(value, scale)) + mean_value = np.mean(value) + value_scale = scale[0] if not np.isscalar(scale) else scale difference = None if reference and not ignore_metric_reference: - original_scale = get_result_format_parameters(meta, False)[1] if ignore_results_formatting else 1 - difference = compare_with_ref(reference, mean_value, original_scale, 'mean') + difference = compare_with_ref(reference, mean_value, 'mean') write_scalar_result( mean_value, name, abs_threshold, rel_threshold, difference, value_name='mean', - postfix=postfix[-1] if not np.isscalar(postfix) else postfix, scale=1, + postfix=postfix[-1] if not np.isscalar(postfix) else postfix, scale=value_scale, result_format=result_format ) @@ -208,7 +206,7 @@ def write_scalar_result( rel_threshold = rel_threshold or 0 if abs_threshold <= diff_with_ref[0] or rel_threshold <= diff_with_ref[1]: fail_message = "[FAILED: abs error = {:.4} | relative error = {:.4}]".format( - diff_with_ref[0], diff_with_ref[1] + diff_with_ref[0] * scale, diff_with_ref[1] ) message = "{} {}".format(message, color_format(fail_message, Color.FAILED)) else: @@ -217,14 +215,14 @@ def write_scalar_result( print_info(message) -def compare_with_ref(reference, res_value, scale, name=None): +def compare_with_ref(reference, res_value, name=None): if isinstance(reference, dict): if name is None: reference = next(iter(reference.values())) reference = reference.get(name) if reference is None: return None - return abs(reference - (res_value * scale)), abs(reference - (res_value * scale)) / reference + return abs(reference - res_value), abs(reference - res_value) / reference def get_result_format_parameters(meta, use_default_formatting): @@ -239,8 +237,7 @@ def get_result_format_parameters(meta, use_default_formatting): return postfix, scale, result_format -def write_csv_result(csv_file, processing_info, metric_results, dataset_size, metrics_meta): - new_file = not check_file_existence(csv_file) +def generate_csv_report(processing_info, metric_results, dataset_size, metrics_meta): field_names = [ 'model', 'launcher', 'device', 'dataset', 'tags', 'metric_name', 'metric_type', 'metric_value', 'metric_target', 'metric_scale', 'metric_postfix', @@ -254,22 +251,29 @@ def write_csv_result(csv_file, processing_info, metric_results, dataset_size, me 'dataset': dataset, 'dataset_size': dataset_size } + rows = [] + for metric_result, metric_meta in zip(metric_results, metrics_meta): + rows.append({ + **main_info, + 'metric_name': metric_result['name'], + 'metric_type': metric_result['type'], + 'metric_value': metric_result['value'], + 'metric_target': metric_meta.get('target', 'higher-better'), + 'metric_scale': metric_meta.get('scale', 100), + 'metric_postfix': metric_meta.get('postfix', '%'), + 'ref': metric_result.get('ref', ''), + 'abs_threshold': metric_result.get('abs_threshold', 0), + 'rel_threshold': metric_result.get('rel_threshold', 0), + 'profiling_file': metric_result.get('profiling_file', '') + }) + return field_names, rows - with open(csv_file, 'a+', newline='') as f: + +def write_csv_result(csv_file, processing_info, metric_results, dataset_size, metrics_meta): + new_file = not check_file_existence(csv_file) + field_names, rows = generate_csv_report(processing_info, metric_results, dataset_size, metrics_meta) + with open(csv_file, 'a+', newline='', encoding='utf-8') as f: writer = DictWriter(f, fieldnames=field_names) if new_file: writer.writeheader() - for metric_result, metric_meta in zip(metric_results, metrics_meta): - writer.writerow({ - **main_info, - 'metric_name': metric_result['name'], - 'metric_type': metric_result['type'], - 'metric_value': metric_result['value'], - 'metric_target': metric_meta.get('target', 'higher-better'), - 'metric_scale': metric_meta.get('scale', 100), - 'metric_postfix': metric_meta.get('postfix', '%'), - 'ref': metric_result.get('ref', ''), - 'abs_threshold': metric_result.get('abs_threshold', 0), - 'rel_threshold': metric_result.get('rel_threshold', 0), - 'profiling_file': metric_result.get('profiling_file', '') - }) + writer.writerows(rows) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/__init__.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/__init__.py index 3c207589d99..53868cc3dca 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/__init__.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/__init__.py @@ -70,6 +70,7 @@ FeaturesRegressionAnnotation, NiftiRegressionAnnotation, ) +from .facial_landmarks_heatmap_representation import FacialLandmarksHeatMapAnnotation, FacialLandmarksHeatMapPrediction from .multilabel_recognition import MultiLabelRecognitionAnnotation, MultiLabelRecognitionPrediction from .super_resolution_representation import SuperResolutionAnnotation, SuperResolutionPrediction from .text_detection_representation import TextDetectionAnnotation, TextDetectionPrediction @@ -87,7 +88,8 @@ LanguageModelingAnnotation, LanguageModelingPrediction, QuestionAnsweringBiDAFAnnotation, - BERTNamedEntityRecognitionAnnotation + BERTNamedEntityRecognitionAnnotation, + SentenceSimilarityAnnotation ) from .image_inpainting import ImageInpaintingAnnotation, ImageInpaintingPrediction from .style_transfer import StyleTransferAnnotation, StyleTransferPrediction @@ -159,6 +161,8 @@ 'RegressionAnnotation', 'RegressionPrediction', + 'FacialLandmarksHeatMapAnnotation', + 'FacialLandmarksHeatMapPrediction', 'FacialLandmarksAnnotation', 'FacialLandmarksPrediction', 'FacialLandmarks3DAnnotation', @@ -202,6 +206,7 @@ 'LanguageModelingAnnotation', 'LanguageModelingPrediction', 'BERTNamedEntityRecognitionAnnotation', + 'SentenceSimilarityAnnotation', 'DepthEstimationAnnotation', 'DepthEstimationPrediction', diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/facial_landmarks_heatmap_representation.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/facial_landmarks_heatmap_representation.py new file mode 100644 index 00000000000..88fd678978a --- /dev/null +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/facial_landmarks_heatmap_representation.py @@ -0,0 +1,41 @@ +""" +Copyright (c) 2018-2021 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +import numpy as np +from .base_representation import BaseRepresentation + + +class FacialLandmarksHeatMapRepresentation(BaseRepresentation): + def __init__(self, identifier='', x_values=None, y_values=None, heatmap=None): + super().__init__(identifier) + self.x_values = x_values if np.size(x_values) > 0 else [] + self.y_values = y_values if np.size(y_values) > 0 else [] + self.heatmap = heatmap + + @property + def size(self): + return len(self.x_values) + +class FacialLandmarksHeatMapAnnotation(FacialLandmarksHeatMapRepresentation): + def normalization_coef(self, is_2d=False): + min_x, max_x = np.min(self.x_values), np.max(self.x_values) + min_y, max_y = np.min(self.y_values), np.max(self.y_values) + return np.sqrt((max_x - min_x) ** 2 + (max_y - min_y) ** 2) + +class FacialLandmarksHeatMapPrediction(FacialLandmarksHeatMapRepresentation): + + def to_annotation(self, **kwargs): + return FacialLandmarksHeatMapPrediction(self.identifier, self.x_values, self.y_values) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/nlp_representation.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/nlp_representation.py index 3ecc2fcfd50..474a79d5a19 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/nlp_representation.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/nlp_representation.py @@ -146,3 +146,17 @@ def __init__(self, identifier, input_ids, input_mask, segment_ids, label_id, val self.segment_ids = segment_ids if segment_ids is not None else [] self.valid_ids = np.array(valid_ids, dtype=bool) if valid_ids is not None else valid_ids self.label_mask = np.array(label_mask, dtype=bool) if label_mask is not None else label_mask + + +class SentenceSimilarityAnnotation(BaseRepresentation): + def __init__( + self, + identifier, idx, pair_id, similarity_score, input_ids, input_mask, segment_ids + ): + super().__init__(identifier) + self.id = idx + self.pair_id = pair_id + self.input_ids = input_ids + self.similarity_score = similarity_score + self.input_mask = input_mask if input_mask is not None else [] + self.segment_ids = segment_ids if segment_ids is not None else [] diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/segmentation_representation.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/segmentation_representation.py index bfbacb409a6..665b408bb54 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/segmentation_representation.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/representation/segmentation_representation.py @@ -172,7 +172,7 @@ def to_annotation(self, **kwargs): mask_source = Path.cwd() / 'dumped_masks' if not mask_source.exists(): mask_source.mkdir() - mask_file = mask_source / (str(self.identifier).split('.')[0] + '.npy') + mask_file = mask_source / (str(self.identifier).split('.', maxsplit=1)[0] + '.npy') mask_shape = self.mask.shape if len(mask_shape) == 3 and mask_shape[0] != 1: argmaxed_mask = np.argmax(self.mask, axis=0).astype(np.uint8) diff --git a/tools/accuracy_checker/openvino/tools/accuracy_checker/utils.py b/tools/accuracy_checker/openvino/tools/accuracy_checker/utils.py index 9c38498d2cf..2c9478521d2 100644 --- a/tools/accuracy_checker/openvino/tools/accuracy_checker/utils.py +++ b/tools/accuracy_checker/openvino/tools/accuracy_checker/utils.py @@ -50,8 +50,8 @@ def concat_lists(*lists): def get_path(entry: Union[str, Path], is_directory=False, check_exists=True, file_or_directory=False): try: path = Path(entry) - except TypeError: - raise TypeError('"{}" is expected to be a path-like'.format(entry)) + except TypeError as type_err: + raise TypeError('"{}" is expected to be a path-like'.format(entry)) from type_err if not check_exists: return path @@ -368,12 +368,12 @@ def get_or_parse_value(item, supported_values=None, default=None, casting_type=f try: return string_to_tuple(item, casting_type=casting_type) - except ValueError: + except ValueError as value_err: message = 'Invalid value "{}", expected {}list of values'.format( item, 'one of precomputed: ({}) or '.format(', '.join(supported_values.keys())) if supported_values else '' ) - raise ValueError(message) + raise ValueError(message) from value_err if isinstance(item, (float, int)): return (casting_type(item), ) @@ -502,15 +502,15 @@ def __len__(self): def __contains__(self, key): return key in self.map - def add(self, key): - if key not in self.map: + def add(self, value): + if value not in self.map: end = self.end curr = end[1] - curr[2] = end[1] = self.map[key] = [key, curr, end] + curr[2] = end[1] = self.map[value] = [value, curr, end] - def discard(self, key): - if key in self.map: - key, prev_value, next_value = self.map.pop(key) + def discard(self, value): + if value in self.map: + value, prev_value, next_value = self.map.pop(value) prev_value[2] = next_value next_value[1] = prev_value @@ -848,7 +848,7 @@ def eof(fd): fd.seek(curpos - 1) return end - fd = open(filename, 'rb') + fd = open(filename, 'rb') # pylint: disable=R1732 fd.seek(124) tst_str = fd.read(4) @@ -911,7 +911,7 @@ def init_telemetry(): except ImportError: return None try: - telemetry = tm.Telemetry('Accuracy Checker', app_version=__version__) + telemetry = tm.Telemetry(tid='UA-17808594-29', app_name='Accuracy Checker', app_version=__version__) return telemetry except Exception: # pylint:disable=W0703 return None diff --git a/tools/accuracy_checker/requirements.in b/tools/accuracy_checker/requirements.in index 4cf4b9a8652..f85903c3262 100644 --- a/tools/accuracy_checker/requirements.in +++ b/tools/accuracy_checker/requirements.in @@ -2,9 +2,8 @@ tqdm>=4.54.1 # image reading and preprocessing -# scikit-image version will be changed to 0.18 after fixing tests (compare_ssim method has been removed in this version) # note: python 3.6 wheels is not available since 0.18 -scikit-image~=0.17.2 +scikit-image>=0.17.2 # there is issue with resolving versions for python3.6, pin to specific version of lib imagecodecs~=2020.5.30;python_version<"3.7" diff --git a/tools/accuracy_checker/tests/test_config_reader.py b/tools/accuracy_checker/tests/test_config_reader.py index c3fb8014cf6..6f06aa4af23 100644 --- a/tools/accuracy_checker/tests/test_config_reader.py +++ b/tools/accuracy_checker/tests/test_config_reader.py @@ -28,9 +28,8 @@ def setup_method(self): self.global_launchers = [ { 'framework': 'dlsdk', - 'device': 'fpga', + 'device': 'cpu', 'cpu_extensions': 'dlsdk_shared.so', - 'bitstream': 'bitstream' }, { 'framework': 'caffe', @@ -85,7 +84,6 @@ def setup_method(self): 'annotations': Path('annotations/'), 'converted_models': Path('converted_models/'), 'model_optimizer': Path('model_optimizer/'), - 'bitstreams': Path('bitstreams/'), 'definitions': None, 'stored_predictions': None, 'tf_custom_op_config_dir': None, @@ -96,7 +94,6 @@ def setup_method(self): 'log_file': None, 'target_tags': None, 'cpu_extensions_mode': None, - 'aocl': None, 'deprecated_ir_v7': False, 'transformations_config_dir': None, 'model_attributes': None @@ -110,14 +107,14 @@ def test_read_configs_without_global_config(self, mocker): }]} empty_args = Namespace(**{ 'models': Path.cwd(), 'extensions': Path.cwd(), 'source': Path.cwd(), 'annotations': Path.cwd(), - 'converted_models': None, 'model_optimizer': None, 'bitstreams': Path.cwd(), + 'converted_models': None, 'model_optimizer': None, 'definitions': None, 'config': None, 'stored_predictions': None, 'tf_custom_op_config_dir': None, 'progress': 'bar', 'target_framework': None, 'target_devices': None, 'log_file': None, 'tf_obj_detection_api_pipeline_config_path': None, 'target_tags': None, 'cpu_extensions_mode': None, - 'aocl': None, 'deprecated_ir_v7': False, 'transformations_config_dir': None, 'model_attributes': None + 'deprecated_ir_v7': False, 'transformations_config_dir': None, 'model_attributes': None }) mocker.patch('openvino.tools.accuracy_checker.utils.get_path', return_value=Path.cwd()) - mocker.patch('yaml.load', return_value=config) + mocker.patch('yaml.safe_load', return_value=config) mocker.patch('pathlib.Path.open') result = ConfigReader.merge(empty_args) @@ -214,7 +211,6 @@ def test_merge_datasets_with_definitions(self, mocker): arguments = copy.deepcopy(self.arguments) arguments.model_optimizer = None arguments.extensions = None - arguments.bitstreams = None config = ConfigReader.merge(arguments)[0] @@ -232,7 +228,6 @@ def test_merge_datasets_with_definitions_and_meta_is_not_modified(self, mocker): self.global_config, local_config )) arguments = copy.deepcopy(self.arguments) - arguments.bitstreams = None arguments.extensions = None config = ConfigReader.merge(arguments)[0] @@ -263,7 +258,6 @@ def test_expand_relative_paths_in_datasets_config_using_command_line(self, mocke expected['data_source'] = prefix / self.arguments.source / 'relative_source_path' arguments = copy.deepcopy(self.arguments) - arguments.bitstreams = None arguments.extensions = None arguments.annotations = prefix / self.arguments.annotations arguments.source = prefix / self.arguments.source @@ -298,7 +292,6 @@ def test_expand_relative_paths_in_datasets_config_using_env_variable(self, mocke expected['data_source'] = prefix / self.arguments.source / 'relative_source_path' arguments = copy.deepcopy(self.arguments) - arguments.bitstreams = None arguments.extensions = None arguments.source = prefix / arguments.source arguments.annotations = prefix / self.arguments.annotations @@ -333,7 +326,6 @@ def test_not_overwrite_relative_paths_in_datasets_config_using_env_variable_if_c expected['dataset_meta'] = prefix / 'relative_annotation_path' arguments = copy.deepcopy(self.arguments) - arguments.bitstreams = None arguments.extensions = None arguments.source = None arguments.annotations = None @@ -373,14 +365,12 @@ def test_merge_launchers_with_definitions(self, mocker): )) expected = copy.deepcopy(self.get_global_launcher('dlsdk')) expected['model'] = 'model' - with mock_filesystem(['bitstreams/', 'extensions/']) as prefix: - expected['bitstream'] = prefix / self.arguments.bitstreams / expected['bitstream'] + with mock_filesystem(['extensions/']) as prefix: expected['cpu_extensions'] = prefix / self.arguments.extensions / expected['cpu_extensions'] args = copy.deepcopy(self.arguments) args.model_optimizer = None args.converted_models = None args.models = None - args.bitstreams = prefix / self.arguments.bitstreams args.extensions = prefix / self.arguments.extensions config = ConfigReader.merge(args)[0] @@ -398,14 +388,12 @@ def test_merge_launchers_with_model_is_not_modified(self, mocker): mocker.patch(self.module + '._read_configs', return_value=( self.global_config, local_config )) - with mock_filesystem(['bitstreams/', 'extensions/']) as prefix: - expected['bitstream'] = prefix / self.arguments.bitstreams / expected['bitstream'] + with mock_filesystem(['extensions/']) as prefix: expected['cpu_extensions'] = prefix / self.arguments.extensions / expected['cpu_extensions'] args = copy.deepcopy(self.arguments) args.model_optimizer = None args.converted_models = None args.models = None - args.bitstreams = prefix / self.arguments.bitstreams args.extensions = prefix / self.arguments.extensions config = ConfigReader.merge(args)[0] @@ -425,12 +413,11 @@ def test_expand_relative_paths_in_launchers_config_using_command_line(self, mock 'caffe_weights': 'relative_weights_path', 'tf_model': 'relative_model_path', 'mxnet_weights': 'relative_weights_path', - 'bitstream': 'relative_bitstreams_path' }], 'datasets': [{'name': 'dataset'}] }]} mocker.patch(self.module + '._read_configs', return_value=(None, local_config)) - with mock_filesystem(['bitstreams/', 'extensions/', 'models/']) as prefix: + with mock_filesystem(['extensions/', 'models/']) as prefix: expected = copy.deepcopy(local_config['models'][0]['launchers'][0]) expected['model'] = prefix / self.arguments.models / 'relative_model_path' expected['caffe_model'] = prefix / self.arguments.models / 'relative_model_path' @@ -440,11 +427,9 @@ def test_expand_relative_paths_in_launchers_config_using_command_line(self, mock expected['mxnet_weights'] = prefix / self.arguments.models / 'relative_weights_path' expected['cpu_extensions'] = prefix / self.arguments.extensions / 'relative_extensions_path' expected['gpu_extensions'] = prefix / self.arguments.extensions / 'relative_extensions_path' - expected['bitstream'] = prefix / self.arguments.bitstreams / 'relative_bitstreams_path' args = copy.deepcopy(self.arguments) args.model_optimizer = None args.converted_models = None - args.bitstreams = prefix / self.arguments.bitstreams args.extensions = prefix / self.arguments.extensions args.models = prefix / self.arguments.models @@ -473,7 +458,6 @@ def test_both_launchers_are_filtered_by_target_tags_if_tags_not_provided_in_conf arguments = copy.deepcopy(self.arguments) arguments.target_tags = ['some_tag'] arguments.extensions = None - arguments.bitstreams = None mocker.patch(self.module + '._read_configs', return_value=(None, local_config)) @@ -497,7 +481,6 @@ def test_launcher_is_not_filtered_by_the_same_tag(self, mocker): args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_tags = ['some_tag'] config = ConfigReader.merge(args)[0] @@ -532,7 +515,6 @@ def test_both_launchers_are_not_filtered_by_the_same_tag(self, mocker): args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_tags = ['some_tag'] config = ConfigReader.merge(args)[0] @@ -603,7 +585,6 @@ def test_only_appropriate_launcher_is_filtered_by_another_tag(self, mocker): args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_tags = ['tag2'] config = ConfigReader.merge(args)[0] @@ -639,7 +620,6 @@ def test_only_appropriate_launcher_is_filtered_by_another_tag_if_provided_severa args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_tags = ['tag2', 'tag3'] config = ConfigReader.merge(args)[0] @@ -666,7 +646,6 @@ def test_launcher_with_several_tags_contained_at_least_one_from_target_tegs_is_n args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_tags = ['tag2'] config = ConfigReader.merge(args)[0] @@ -702,7 +681,6 @@ def test_both_launchers_with_different_tags_are_not_filtered_by_the_same_tags(se args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_tags = ['tag1', 'tag2'] config = ConfigReader.merge(args)[0] @@ -728,7 +706,6 @@ def test_launcher_is_not_filtered_by_the_same_framework(self, mocker): args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_framework = 'dlsdk' config = ConfigReader.merge(args)[0] @@ -761,7 +738,6 @@ def test_both_launchers_are_not_filtered_by_the_same_framework(self, mocker): args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_framework = 'dlsdk' config = ConfigReader.merge(args)[0] @@ -786,7 +762,6 @@ def test_launcher_is_filtered_by_another_framework(self, mocker): args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_framework = 'caffe' with pytest.warns(Warning): @@ -818,7 +793,6 @@ def test_both_launchers_are_filtered_by_another_framework(self, mocker): args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_framework = 'caffe' with pytest.warns(Warning): @@ -850,7 +824,6 @@ def test_only_appropriate_launcher_is_filtered_by_another_framework(self, mocker args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_framework = 'caffe' config = ConfigReader.merge(args)[0] @@ -874,7 +847,6 @@ def test_launcher_is_not_filtered_by_the_same_device(self, mocker): args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_devices = ['CPU'] config = ConfigReader.merge(args)[0] @@ -905,7 +877,6 @@ def test_both_launchers_are_not_filtered_by_the_same_device(self, mocker): args = copy.deepcopy(self.arguments) args.converted_models = None args.extensions = None - args.bitstreams = None args.target_devices = ['CPU'] config = ConfigReader.merge(args)[0] @@ -960,7 +931,6 @@ def test_both_launchers_are_filtered_by_another_device(self, mocker): args.model_optimizer = None args.converted_models = None args.extensions = None - args.bitstreams = None args.target_devices = ['GPU'] with pytest.warns(Warning): @@ -1030,7 +1000,6 @@ def test_only_appropriate_launcher_is_filtered_by_user_input_devices(self, mocke args = copy.deepcopy(self.arguments) args.converted_models = None args.extensions = None - args.bitstreams = None args.target_devices = ['GPU', 'CPU'] config = ConfigReader.merge(args)[0] @@ -1064,7 +1033,6 @@ def test_both_launchers_are_filtered_by_other_devices(self, mocker): args.converted_models = None args.target_devices = ['FPGA', 'MYRIAD'] args.extensions = None - args.bitstreams = None with pytest.warns(Warning): config = ConfigReader.merge(args)[0] @@ -1094,7 +1062,6 @@ def test_both_launchers_are_not_filtered_by_same_devices(self, mocker): args = copy.deepcopy(self.arguments) args.converted_models = None args.extensions = None - args.bitstreams = None args.target_devices = ['GPU', 'CPU'] config = ConfigReader.merge(args)[0] @@ -1128,7 +1095,6 @@ def test_launcher_is_not_filtered_by_device_with_tail(self, mocker): args = copy.deepcopy(self.arguments) args.converted_models = None args.extensions = None - args.bitstreams = None args.target_devices = ['CPU', 'GPU_unexpected_tail'] config = ConfigReader.merge(args)[0] diff --git a/tools/accuracy_checker/tests/test_dataset.py b/tools/accuracy_checker/tests/test_dataset.py index 841a2bcebad..0767ebf2865 100644 --- a/tools/accuracy_checker/tests/test_dataset.py +++ b/tools/accuracy_checker/tests/test_dataset.py @@ -112,7 +112,7 @@ def test_annotation_conversion_not_convert_twice(self, mocker): ) Dataset(config) - annotation_reader_mock.assert_called_once_with(Path('custom')) + annotation_reader_mock.assert_called_once_with(Path('custom'), True) def test_annotation_conversion_with_store_annotation(self, mocker): addition_options = { @@ -165,7 +165,7 @@ def test_annotation_conversion_subset_ratio(self, mocker): 'openvino.tools.accuracy_checker.dataset.make_subset' ) Dataset.load_annotation(config) - subset_maker_mock.assert_called_once_with(converted_annotation, 1, 666, True) + subset_maker_mock.assert_called_once_with(converted_annotation, 1, 666, True, False) def test_annotation_conversion_subset_more_than_dataset_size(self, mocker): addition_options = { @@ -290,7 +290,7 @@ def test_annotation_conversion_closer_to_zero_subset_ratio(self, mocker): 'openvino.tools.accuracy_checker.dataset.make_subset' ) Dataset.load_annotation(config) - subset_maker_mock.assert_called_once_with(converted_annotation, 1, 666, True) + subset_maker_mock.assert_called_once_with(converted_annotation, 1, 666, True, False) def test_annotation_conversion_subset_with_seed(self, mocker): addition_options = { diff --git a/tools/accuracy_checker/tests/test_dlsdk_launcher.py b/tools/accuracy_checker/tests/test_dlsdk_launcher.py index 7ed6a838173..e4434296c50 100644 --- a/tools/accuracy_checker/tests/test_dlsdk_launcher.py +++ b/tools/accuracy_checker/tests/test_dlsdk_launcher.py @@ -19,7 +19,6 @@ import pytest pytest.importorskip('openvino.tools.accuracy_checker.launcher.dlsdk_launcher') -import os import cv2 import numpy as np @@ -235,190 +234,6 @@ def test_dlsdk_launcher_affinity_map_invalid_layer(self, mocker, models_dir): class TestDLSDKLauncher: FAKE_MO_PATH = Path('/path/ModelOptimizer').absolute() - def test_program_bitsream_when_device_is_fpga(self, mocker): - subprocess_mock = mocker.patch('subprocess.run') - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'fpga', - 'bitstream': Path('custom_bitstream'), - 'adapter': 'classification', - '_aocl': Path('aocl') - } - launcher = create_launcher(config, model_name='custom') - subprocess_mock.assert_called_once_with(['aocl', 'program', 'acl0', 'custom_bitstream'], check=True) - launcher.release() - - def test_program_bitstream_when_fpga_in_hetero_device(self, mocker): - subprocess_mock = mocker.patch('subprocess.run') - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'hetero:fpga,cpu', - 'bitstream': Path('custom_bitstream'), - 'adapter': 'classification', - '_aocl': Path('aocl') - } - launcher = create_launcher(config, model_name='custom') - subprocess_mock.assert_called_once_with(['aocl', 'program', 'acl0', 'custom_bitstream'], check=True) - launcher.release() - - def test_does_not_program_bitstream_when_device_is_not_fpga(self, mocker): - subprocess_mock = mocker.patch('subprocess.run') - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'cpu', - 'bitstream': Path('custom_bitstream'), - 'adapter': 'classification', - '_aocl': Path('aocl') - } - create_launcher(config, model_name='custom') - subprocess_mock.assert_not_called() - - def test_does_not_program_bitstream_when_hetero_without_fpga(self, mocker): - subprocess_mock = mocker.patch('subprocess.run') - - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'hetero:cpu,cpu', - 'bitstream': Path('custom_bitstream'), - 'adapter': 'classification', - '_aocl': Path('aocl') - } - create_launcher(config, model_name='custom') - subprocess_mock.assert_not_called() - - def test_does_not_program_bitstream_if_compiler_mode_3_in_env_when_fpga_in_hetero_device(self, mocker): - subprocess_mock = mocker.patch('subprocess.run') - mocker.patch('os.environ.get', return_value='3') - - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'hetero:fpga,cpu', - 'bitstream': Path('custom_bitstream'), - 'adapter': 'classification', - '_aocl': Path('aocl') - } - create_launcher(config, model_name='custom') - - subprocess_mock.assert_not_called() - - def test_does_not_program_bitstream_if_compiler_mode_3_in_env_when_fpga_in_device(self, mocker): - subprocess_mock = mocker.patch('subprocess.run') - mocker.patch('os.environ.get', return_value='3') - - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'fpga', - 'bitstream': Path('custom_bitstream'), - 'adapter': 'classification', - '_aocl': Path('aocl') - } - create_launcher(config, model_name='custom') - - subprocess_mock.assert_not_called() - - def test_sets_dla_aocx_when_device_is_fpga(self, mocker): - mocker.patch('os.environ') - - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'fpga', - 'bitstream': Path('custom_bitstream'), - 'adapter': 'classification', - } - create_launcher(config, model_name='custom') - - os.environ.__setitem__.assert_called_once_with('DLA_AOCX', 'custom_bitstream') - - def test_sets_dla_aocx_when_fpga_in_hetero_device(self, mocker): - mocker.patch('os.environ') - - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'hetero:fpga,cpu', - 'bitstream': Path('custom_bitstream'), - 'adapter': 'classification', - } - create_launcher(config, model_name='custom') - os.environ.__setitem__.assert_called_once_with('DLA_AOCX', 'custom_bitstream') - - def test_does_not_set_dla_aocx_when_device_is_not_fpga(self, mocker): - mocker.patch('os.environ') - - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'cpu', - 'bitstream': 'custom_bitstream', - 'adapter': 'classification', - } - create_launcher(config, model_name='custom') - - os.environ.__setitem__.assert_not_called() - - def test_does_not_set_dla_aocx_when_hetero_without_fpga(self, mocker): - mocker.patch('os.environ') - - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'hetero:cpu,cpu', - 'bitstream': 'custom_bitstream', - 'adapter': 'classification', - } - create_launcher(config, model_name='custom') - - os.environ.__setitem__.assert_not_called() - - def test_does_not_set_dla_aocx_if_compiler_mode_3_in_env_when_fpga_in_hetero_device(self, mocker): - mocker.patch('os.environ') - mocker.patch('os.environ.get', return_value='3') - - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'hetero:fpga,cpu', - 'bitstream': 'custom_bitstream', - 'adapter': 'classification', - } - create_launcher(config, model_name='custom') - - os.environ.__setitem__.assert_not_called() - - def test_does_not_set_dla_aocx_if_compiler_mode_3_in_env_when_fpga_in_device(self, mocker): - mocker.patch('os.environ') - mocker.patch('os.environ.get', return_value='3') - - config = { - 'framework': 'dlsdk', - 'weights': 'custom_weights', - 'model': 'custom_model', - 'device': 'fpga', - 'bitstream': 'custom_bitstream', - 'adapter': 'classification', - } - create_launcher(config, model_name='custom') - - os.environ.__setitem__.assert_not_called() - def test_model_converted_from_caffe(self, mocker): mock = mocker.patch( 'openvino.tools.accuracy_checker.launcher.dlsdk_launcher_config.convert_model', @@ -430,7 +245,6 @@ def test_model_converted_from_caffe(self, mocker): 'caffe_model': '/path/to/source_models/custom_model', 'caffe_weights': '/path/to/source_models/custom_weights', "device": 'cpu', - 'bitstream': Path('custom_bitstream'), 'adapter': 'classification', 'should_log_cmd': False } @@ -453,7 +267,6 @@ def test_model_converted_with_mo_params(self, mocker): 'caffe_model': '/path/to/source_models/custom_model', 'caffe_weights': '/path/to/source_models/custom_weights', 'device': 'cpu', - 'bitstream': Path('custom_bitstream'), 'mo_params': {'data_type': 'FP16'}, 'adapter': 'classification', 'should_log_cmd': False @@ -477,7 +290,6 @@ def test_model_converted_with_mo_flags(self, mocker): 'caffe_model': '/path/to/source_models/custom_model', 'caffe_weights': '/path/to/source_models/custom_weights', 'device': 'cpu', - 'bitstream': Path('custom_bitstream'), 'mo_flags': ['reverse_input_channels'], 'adapter': 'classification', 'should_log_cmd': False @@ -1167,15 +979,15 @@ def setup(self): def test_hetero_correct(self): self.config.validate(update_dict(self.launcher, device='HETERO:CPU')) - self.config.validate(update_dict(self.launcher, device='HETERO:CPU,FPGA')) + self.config.validate(update_dict(self.launcher, device='HETERO:CPU,CPU')) def test_hetero_endswith_comma(self): with pytest.raises(ConfigError): - self.config.validate(update_dict(self.launcher, device='HETERO:CPU,FPGA,')) + self.config.validate(update_dict(self.launcher, device='HETERO:CPU,CPU,')) def test_normal_multiple_devices(self): with pytest.raises(ConfigError): - self.config.validate(update_dict(self.launcher, device='CPU,FPGA')) + self.config.validate(update_dict(self.launcher, device='CPU,CPU')) def test_hetero_empty(self): with pytest.raises(ConfigError): diff --git a/tools/accuracy_checker/tests/test_gapi_launcher.py b/tools/accuracy_checker/tests/test_gapi_launcher.py index 2df6a7a0d23..9e07900fabb 100644 --- a/tools/accuracy_checker/tests/test_gapi_launcher.py +++ b/tools/accuracy_checker/tests/test_gapi_launcher.py @@ -16,6 +16,7 @@ import pytest pytest.importorskip('openvino.inference_engine') +pytest.importorskip('cv2.gapi.ie.params') pytest.importorskip('openvino.tools.accuracy_checker.launcher.gapi_launcher') import cv2 diff --git a/tools/accuracy_checker/tests/test_model_evaluator.py b/tools/accuracy_checker/tests/test_model_evaluator.py index a4ddecf4fd6..8b6cd271b0d 100644 --- a/tools/accuracy_checker/tests/test_model_evaluator.py +++ b/tools/accuracy_checker/tests/test_model_evaluator.py @@ -59,6 +59,7 @@ def setup_method(self): self.metric = Mock() self.metric.update_metrics_on_batch = Mock(return_value=[{}, {}]) + self.metric.profiler = None self.evaluator = ModelEvaluator( self.launcher, @@ -185,6 +186,7 @@ def setup_method(self): self.metric = Mock() self.metric.update_metrics_on_batch = Mock(return_value=[{}, {}]) + self.metric.profiler = None self.evaluator = ModelEvaluator( self.launcher, @@ -208,12 +210,13 @@ def test_process_dataset_without_storing_predictions_and_dataset_processors(self self.preprocessor.has_multi_infer_transformations = False self.launcher.dyn_input_layers = False + self.evaluator.process_dataset(None, None) assert not self.evaluator.store_predictions.called assert not self.evaluator.load.called assert not self.launcher.predict.called - assert self.launcher.get_async_requests.called + assert self.launcher.get_infer_queue.called def test_process_dataset_with_storing_predictions_and_without_dataset_processors(self): self.postprocessor.has_dataset_processors = False @@ -226,7 +229,7 @@ def test_process_dataset_with_storing_predictions_and_without_dataset_processors assert not self.evaluator.load.called assert not self.launcher.predict.called - assert self.launcher.get_async_requests.called + assert self.launcher.get_infer_queue.called def test_process_dataset_with_loading_predictions_and_without_dataset_processors(self, mocker): mocker.patch('openvino.tools.accuracy_checker.evaluators.model_evaluator.get_path') diff --git a/tools/accuracy_checker/tests/test_presenter.py b/tools/accuracy_checker/tests/test_presenter.py index b90f36f9c3e..0627402ed8c 100644 --- a/tools/accuracy_checker/tests/test_presenter.py +++ b/tools/accuracy_checker/tests/test_presenter.py @@ -139,7 +139,7 @@ def test_reference_value_for_scalar_presenter(self, mocker): name='vector_metric', metric_type='metric', evaluated_value=[0.456], - reference_value=45.6, + reference_value=0.456, abs_threshold=None, rel_threshold=None, meta={}, @@ -164,7 +164,7 @@ def test_reference_value_for_scalar_presenter_with_ignore_results_formatting(sel name='vector_metric', metric_type='metric', evaluated_value=[0.456], - reference_value=45.6, + reference_value=0.456, abs_threshold=None, rel_threshold=None, meta={}, @@ -189,7 +189,7 @@ def test_reference_value_for_scalar_presenter_with_ref_values_dict(self, mocker) name='vector_metric', metric_type='metric', evaluated_value=[0.456], - reference_value={'vector_metric': 45.6}, + reference_value={'vector_metric': 0.456}, abs_threshold=None, rel_threshold=None, meta={}, @@ -214,7 +214,7 @@ def test_reference_value_for_scalar_presenter_with_ref_values_dict_no_value(self name='vector_metric', metric_type='metric', evaluated_value=[0.456], - reference_value={'other_metric': 45.6}, + reference_value={'other_metric': 0.456}, abs_threshold=None, rel_threshold=None, meta={}, @@ -233,6 +233,31 @@ def test_reference_value_for_scalar_presenter_with_ref_values_dict_no_value(self result_format='{:.2f}' ) + def test_specific_format_for_scalar_presenter(self, mocker): + mock_write_scalar_res = mocker.patch('openvino.tools.accuracy_checker.presenters.write_scalar_result') # type: MagicMock + result = EvaluationResult( + name='vector_metric', + metric_type='metric', + evaluated_value=[0.456], + reference_value=None, + abs_threshold=None, + rel_threshold=None, + meta={'scale': 0.5, 'postfix': 'km/h', 'data_format': '{:.4f}'}, + profiling_file=None + ) + presenter = ScalarPrintPresenter() + presenter.write_result(result) + mock_write_scalar_res.assert_called_once_with( + np.mean(result.evaluated_value), + result.name, + result.reference_value, + result.abs_threshold, + result.rel_threshold, + postfix='km/h', + scale=0.5, + result_format='{:.4f}' + ) + def test_specific_format_for_scalar_presenter_with_ignore_formatting(self, mocker): mock_write_scalar_res = mocker.patch('openvino.tools.accuracy_checker.presenters.write_scalar_result') # type: MagicMock result = EvaluationResult( @@ -289,7 +314,7 @@ def test_vector_presenter_with_scaler_data_compare_with_reference(self, mocker): result = EvaluationResult( name='scalar_metric', metric_type='metric', - evaluated_value=0.4, + evaluated_value=40, reference_value=42, abs_threshold=None, rel_threshold=None, @@ -315,7 +340,7 @@ def test_vector_presenter_with_scaler_data_compare_with_reference_ignore_formatt result = EvaluationResult( name='scalar_metric', metric_type='metric', - evaluated_value=0.4, + evaluated_value=40, reference_value=42, abs_threshold=None, rel_threshold=None, @@ -367,7 +392,7 @@ def test_vector_presenter_with_vector_data_contain_one_element_compare_with_refe result = EvaluationResult( name='scalar_metric', metric_type='metric', - evaluated_value=[0.4], + evaluated_value=[40], reference_value=42, abs_threshold=None, rel_threshold=None, @@ -393,7 +418,7 @@ def test_vector_presenter_with_vector_data_contain_one_element_compare_with_refe result = EvaluationResult( name='vector_metric', metric_type='metric', - evaluated_value=[0.4], + evaluated_value=[40], reference_value=42, abs_threshold=None, rel_threshold=None, @@ -438,8 +463,8 @@ def test_vector_presenter_with_vector_data_with_default_postfix_and_scale(self, postfix='%', scale=100, value_name=result.meta['names'][1], result_format='{:.2f}' ), call( - np.mean(np.multiply(result.evaluated_value, 100)), result.name, result.abs_threshold, result.rel_threshold, - None, value_name='mean', postfix='%', scale=1, result_format='{:.2f}' + np.mean(result.evaluated_value), result.name, result.abs_threshold, result.rel_threshold, + None, value_name='mean', postfix='%', scale=100, result_format='{:.2f}' ) ] mock_write_scalar_res.assert_has_calls(calls) @@ -468,7 +493,7 @@ def test_vector_presenter_with_vector_data_has_default_format_with_ignore_format postfix=' ', scale=1, value_name=result.meta['names'][1], result_format='{}' ), call( - np.mean(np.multiply(result.evaluated_value, 1)), result.name, result.abs_threshold, result.rel_threshold, None, + np.mean(result.evaluated_value), result.name, result.abs_threshold, result.rel_threshold, None, value_name='mean', postfix=' ', scale=1, result_format='{}' ) ] @@ -479,7 +504,7 @@ def test_vector_presenter_with_vector_data_with_default_formatting_compare_with_ result = EvaluationResult( name='vector_metric', metric_type='metric', - evaluated_value=[0.4, 0.6], + evaluated_value=[40, 60], reference_value=49, abs_threshold=None, rel_threshold=None, @@ -498,8 +523,8 @@ def test_vector_presenter_with_vector_data_with_default_formatting_compare_with_ postfix='%', scale=100, value_name=result.meta['names'][1], result_format='{:.2f}' ), call( - np.mean(np.multiply(result.evaluated_value, 100)), result.name, result.abs_threshold, result.rel_threshold, - (1.0, 0.02040816326530612), value_name='mean', postfix='%', scale=1, result_format='{:.2f}' + np.mean(result.evaluated_value), result.name, result.abs_threshold, result.rel_threshold, + (1.0, 0.02040816326530612), value_name='mean', postfix='%', scale=100, result_format='{:.2f}' ) ] mock_write_scalar_res.assert_has_calls(calls) @@ -509,7 +534,7 @@ def test_vector_presenter_with_vector_data_has_default_format_with_ignore_format result = EvaluationResult( name='vector_metric', metric_type='metric', - evaluated_value=[0.4, 0.6], + evaluated_value=[40, 60], reference_value=49, abs_threshold=None, rel_threshold=None, @@ -528,7 +553,7 @@ def test_vector_presenter_with_vector_data_has_default_format_with_ignore_format postfix=' ', scale=1, value_name=result.meta['names'][1], result_format='{}' ), call( - np.mean(np.multiply(result.evaluated_value, 1)), result.name, result.abs_threshold, result.rel_threshold, + np.mean(result.evaluated_value), result.name, result.abs_threshold, result.rel_threshold, (1.0, 0.02040816326530612), value_name='mean', postfix=' ', scale=1, result_format='{}' ) @@ -559,7 +584,7 @@ def test_vector_presenter_with_vector_data_has_specific_format_with_ignore_forma postfix=' ', scale=1, value_name=result.meta['names'][1], result_format='{}' ), call( - np.mean(np.multiply(result.evaluated_value, 1)), result.name, result.reference_value, + np.mean(result.evaluated_value), result.name, result.reference_value, result.abs_threshold, result.rel_threshold, value_name='mean', postfix=' ', scale=1, result_format='{}' ) @@ -589,8 +614,8 @@ def test_vector_presenter_with_vector_data_with_scalar_postfix(self, mocker): postfix=result.meta['postfix'], scale=100, value_name=result.meta['names'][1], result_format='{:.2f}' ), call( - np.mean(np.multiply(result.evaluated_value, 100)), result.name, - result.abs_threshold, result.rel_threshold, None, value_name='mean', postfix=result.meta['postfix'], scale=1, result_format='{:.2f}' + np.mean(result.evaluated_value), result.name, + result.abs_threshold, result.rel_threshold, None, value_name='mean', postfix=result.meta['postfix'], scale=100, result_format='{:.2f}' ) ] mock_write_scalar_res.assert_has_calls(calls) @@ -619,9 +644,9 @@ def test_vector_presenter_with_vector_data_with_scalar_scale(self, mocker): postfix='%', scale=result.meta['scale'], value_name=result.meta['names'][1], result_format='{:.2f}' ), call( - np.mean(np.multiply(result.evaluated_value, result.meta['scale'])), result.name, None, + np.mean(result.evaluated_value), result.name, None, result.abs_threshold, result.rel_threshold, - value_name='mean', postfix='%', scale=1, result_format='{:.2f}' + value_name='mean', postfix='%', scale=10, result_format='{:.2f}' ) ] mock_write_scalar_res.assert_has_calls(calls) @@ -635,7 +660,7 @@ def test_vector_presenter_with_vector_data_with_vector_scale(self, mocker): reference_value=None, abs_threshold=None, rel_threshold=None, - meta={'names': ['class1', 'class2'], 'scale': [1, 2]}, + meta={'names': ['class1', 'class2'], 'scale': [1, 1]}, profiling_file=None ) presenter = VectorPrintPresenter() @@ -650,7 +675,7 @@ def test_vector_presenter_with_vector_data_with_vector_scale(self, mocker): scale=result.meta['scale'][1], result_format='{:.2f}', value_name=result.meta['names'][1] ), call( - np.mean(np.multiply(result.evaluated_value, result.meta['scale'])), result.name, + np.mean(result.evaluated_value), result.name, result.abs_threshold, result.rel_threshold, None, result_format='{:.2f}', value_name='mean', postfix='%', scale=1 ) @@ -662,8 +687,8 @@ def test_vector_presenter_with_vector_data_with_dict_ref(self, mocker): result = EvaluationResult( name='scalar_metric', metric_type='metric', - evaluated_value=[0.4, 0.6], - reference_value={'class1': 0.4, 'class2': 0.5}, + evaluated_value=[4, 6], + reference_value={'class1': 4, 'class2': 5}, abs_threshold=None, rel_threshold=None, meta={'names': ['class1', 'class2'], 'scale': [1, 2]}, @@ -677,13 +702,8 @@ def test_vector_presenter_with_vector_data_with_dict_ref(self, mocker): postfix='%', scale=result.meta['scale'][0], result_format='{:.2f}', value_name=result.meta['names'][0] ), call( - result.evaluated_value[1], result.name, None, None, (0.7, 1.4), postfix='%', + result.evaluated_value[1], result.name, None, None, (1, 0.2), postfix='%', scale=result.meta['scale'][1], result_format='{:.2f}', value_name=result.meta['names'][1] - ), - call( - np.mean(np.multiply(result.evaluated_value, result.meta['scale'])), result.name, - result.abs_threshold, result.rel_threshold, - None, result_format='{:.2f}', value_name='mean', postfix='%', scale=1 ) ] mock_write_scalar_res.assert_has_calls(calls) @@ -697,7 +717,7 @@ def test_vector_presenter_with_vector_data_with_dict_ref_without_represented_cla reference_value={'class3': 0.4, 'class4': 0.5}, abs_threshold=None, rel_threshold=None, - meta={'names': ['class1', 'class2'], 'scale': [1, 2]}, + meta={'names': ['class1', 'class2'], 'scale': [1, 1]}, profiling_file=None ) presenter = VectorPrintPresenter() @@ -712,7 +732,7 @@ def test_vector_presenter_with_vector_data_with_dict_ref_without_represented_cla scale=result.meta['scale'][1], result_format='{:.2f}', value_name=result.meta['names'][1] ), call( - np.mean(np.multiply(result.evaluated_value, result.meta['scale'])), result.name, + np.mean(result.evaluated_value), result.name, result.abs_threshold, result.rel_threshold, None, result_format='{:.2f}', value_name='mean', postfix='%', scale=1 ) diff --git a/tools/model_tools/README.md b/tools/model_tools/README.md index e4147163594..d2137741d74 100644 --- a/tools/model_tools/README.md +++ b/tools/model_tools/README.md @@ -34,20 +34,25 @@ Installation from source is as follows: 1. Install Python (version 3.6 or higher), [setuptools](https://pypi.org/project/setuptools/): +2. Install [openvino-dev](https://pypi.org/project/openvino-dev/) python package of the corresponding version: + +```sh +pip install openvino-dev[caffe,caffe2,onnx,tensorflow2,pytorch,mxnet] +``` +> **NOTE**: For example, if you are using OMZ Tools for 2021.4.2 then install openvino-dev==2021.4.2. + 2. Install the tools with the following command: ```sh -python setup.py install +pip install --upgrade pip +pip install . ``` > **NOTE**: On Linux and macOS, you may need to type `python3` instead of `python`. You may also need to [install pip](https://pip.pypa.io/en/stable/installation/). > For example, on Ubuntu execute the following command to get pip installed: `sudo apt install python3-pip`. +> If you are using pip version lower than 21.3, you also need to set OMZ_ROOT variable: `export OMZ_ROOT=` -For the model converter, you will also need to install the OpenVINO™ -toolkit and the prerequisite libraries for Model Optimizer. See the -[OpenVINO toolkit documentation](https://docs.openvinotoolkit.org/) for details. - -To convert models from certain frameworks, you will also need to install +To convert models from certain frameworks, you may also need to install additional dependencies. For models from Caffe2: @@ -284,8 +289,8 @@ The script will attempt to locate Model Optimizer using several methods: omz_converter --all --mo my/openvino/path/model_optimizer/mo.py ``` -2. Otherwise, if the selected Python executable can import the `mo` package, - then that package will be used. +2. Otherwise, if the selected Python executable can find the `mo` entrypoint, + then it will be used. 3. Otherwise, if the OpenVINO™ toolkit's `setupvars.sh`/`setupvars.bat` script has been executed, the environment variables set by that script will @@ -380,8 +385,8 @@ The script will attempt to locate Post-Training Optimization Toolkit using sever omz_quantizer --all --dataset_dir --pot my/openvino/path/post_training_optimization_toolkit/main.py ``` -2. Otherwise, if the selected Python executable can import the `pot` package, - then that package will be used. +2. Otherwise, if the selected Python executable can find the `pot` entrypoint, + then it will be used. 3. Otherwise, if the OpenVINO™ toolkit's `setupvars.sh`/`setupvars.bat` script has been executed, the environment variables set by that script will diff --git a/tools/model_tools/requirements.in b/tools/model_tools/requirements.in index 7c837a10ad7..b02e516a0de 100644 --- a/tools/model_tools/requirements.in +++ b/tools/model_tools/requirements.in @@ -1,2 +1,3 @@ +pyrx==0.3.0 pyyaml>=5.4.1 requests>=2.25.1 diff --git a/tools/model_tools/setup.cfg b/tools/model_tools/setup.cfg index 03f8dcdf19b..5c37571354c 100644 --- a/tools/model_tools/setup.cfg +++ b/tools/model_tools/setup.cfg @@ -28,6 +28,9 @@ package_dir = [options.packages.find] where = src +[options.package_data] +openvino.model_zoo = schema.yml + [options.entry_points] console_scripts = omz_converter = openvino.model_zoo.omz_converter:main diff --git a/tools/model_tools/src/openvino/model_zoo/_common.py b/tools/model_tools/src/openvino/model_zoo/_common.py index 8e968cd1b3e..79986d3f27c 100644 --- a/tools/model_tools/src/openvino/model_zoo/_common.py +++ b/tools/model_tools/src/openvino/model_zoo/_common.py @@ -14,9 +14,11 @@ import contextlib import platform +import pyrx import re import shlex import subprocess # nosec - disable B404:import-subprocess check +import yaml from pathlib import Path @@ -86,7 +88,7 @@ from openvino_telemetry import Telemetry except ImportError: class Telemetry: - def __init__(self, app_name=None, app_version=None): pass + def __init__(self, tid=None, app_name=None, app_version=None): pass def start_session(self, category): pass @@ -114,24 +116,24 @@ def command_string(args): def get_package_path(python_executable, package_name): completed_process = subprocess.run( [str(python_executable), '-c', - 'import inspect, importlib, sys;' + 'import importlib, sys;' 'print(importlib.import_module(sys.argv[1]).__file__)', package_name, ], stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, - stderr=subprocess.DEVNULL, + stderr=subprocess.PIPE, universal_newlines=True, ) if completed_process.returncode != 0: - return None + return None, completed_process.stderr file_path = Path(completed_process.stdout.rstrip('\n')) # For a package, the file is __init__.py, so to get the package path, # take its parent directory. - return file_path.parent + return file_path.parent, completed_process.stderr def get_version(): if VERSION_FILE and VERSION_FILE.is_file(): @@ -144,7 +146,7 @@ def get_version(): @contextlib.contextmanager def telemetry_session(app_name, tool): version = get_version() - telemetry = Telemetry(app_name, version) + telemetry = Telemetry(tid='UA-17808594-29', app_name=app_name, app_version=version) telemetry.start_session('md') try: yield telemetry @@ -159,3 +161,12 @@ def telemetry_session(app_name, tool): finally: telemetry.end_session('md') telemetry.force_shutdown(1.0) + +def get_schema(): + schema_path = PACKAGE_DIR / 'schema.yml' + with schema_path.open('rb') as schema_file: + schema = yaml.safe_load(schema_file) + rx = pyrx.Factory({"register_core_types": True}) + schema = rx.make_schema(schema) + + return schema diff --git a/tools/model_tools/src/openvino/model_zoo/_configuration.py b/tools/model_tools/src/openvino/model_zoo/_configuration.py index 9db66da20e8..ef71ca402f4 100644 --- a/tools/model_tools/src/openvino/model_zoo/_configuration.py +++ b/tools/model_tools/src/openvino/model_zoo/_configuration.py @@ -23,13 +23,13 @@ from openvino.model_zoo.download_engine import file_source, postprocessing, validation RE_MODEL_NAME = re.compile(r'[0-9a-zA-Z._-]+') -RE_SHA256SUM = re.compile(r'[0-9a-fA-F]{64}') +RE_SHA384SUM = re.compile(r'[0-9a-fA-F]{96}') class ModelFile: - def __init__(self, name, size, sha256, source): + def __init__(self, name, size, sha384, source): self.name = name self.size = size - self.sha256 = sha256 + self.sha384 = sha384 self.source = source @classmethod @@ -39,18 +39,18 @@ def deserialize(cls, file): with validation.deserialization_context('In file "{}"'.format(name)): size = validation.validate_nonnegative_int('"size"', file['size']) - sha256_str = validation.validate_string('"sha256"', file['sha256']) + sha384_str = validation.validate_string('"sha384"', file['sha384']) - if not RE_SHA256SUM.fullmatch(sha256_str): + if not RE_SHA384SUM.fullmatch(sha384_str): raise validation.DeserializationError( - '"sha256": got invalid hash {!r}'.format(sha256_str)) + '"sha384": got invalid hash {!r}'.format(sha384_str)) - sha256 = bytes.fromhex(sha256_str) + sha384 = bytes.fromhex(sha384_str) with validation.deserialization_context('"source"'): source = file_source.FileSource.deserialize(file['source']) - return cls(name, size, sha256, source) + return cls(name, size, sha384, source) class Model: def __init__( @@ -188,6 +188,8 @@ def load_models(models_root, args): composite_models = [] + schema = _common.get_schema() + for composite_model_config in sorted(models_root.glob('**/composite-model.yml')): composite_model_name = composite_model_config.parent.name with validation.deserialization_context('In model "{}"'.format(composite_model_name)): @@ -213,6 +215,8 @@ def load_models(models_root, args): validation.deserialization_context('In config "{}"'.format(config_path)): model = yaml.safe_load(config_file) + if not schema.check(model): + raise validation.DeserializationError('Configuration file check was\'t successful.') for bad_key in ['name', 'subdirectory']: if bad_key in model: diff --git a/tools/model_tools/src/openvino/model_zoo/download_engine/cache.py b/tools/model_tools/src/openvino/model_zoo/download_engine/cache.py index 2548986a4be..00d18f15ebe 100644 --- a/tools/model_tools/src/openvino/model_zoo/download_engine/cache.py +++ b/tools/model_tools/src/openvino/model_zoo/download_engine/cache.py @@ -30,7 +30,7 @@ def put(self, hash, path): pass class DirCache: _FORMAT = 1 # increment if backwards-incompatible changes to the format are made - _HASH_LEN = hashlib.sha256().digest_size + _HASH_LEN = hashlib.sha384().digest_size def __init__(self, cache_dir): self._cache_dir = cache_dir / str(self._FORMAT) @@ -48,8 +48,8 @@ def has(self, hash): return self._hash_path(hash).exists() def get(self, model_file, path, reporter): - cache_path = self._hash_path(model_file.sha256) - cache_sha256 = hashlib.sha256() + cache_path = self._hash_path(model_file.sha384) + cache_sha384 = hashlib.sha384() cache_size = 0 with open(cache_path, 'rb') as cache_file, open(path, 'wb') as destination_file: @@ -61,12 +61,12 @@ def get(self, model_file, path, reporter): if cache_size > model_file.size: reporter.log_error("Cached file is longer than expected ({} B), copying aborted", model_file.size) return False - cache_sha256.update(data) + cache_sha384.update(data) destination_file.write(data) if cache_size < model_file.size: reporter.log_error("Cached file is shorter ({} B) than expected ({} B)", cache_size, model_file.size) return False - return verify_hash(reporter, cache_sha256.digest(), model_file.sha256, path) + return verify_hash(reporter, cache_sha384.digest(), model_file.sha384, path) def put(self, hash, path): staging_path = None diff --git a/tools/model_tools/src/openvino/model_zoo/download_engine/downloader.py b/tools/model_tools/src/openvino/model_zoo/download_engine/downloader.py index 0432138f9d5..a2c7e53da1d 100644 --- a/tools/model_tools/src/openvino/model_zoo/download_engine/downloader.py +++ b/tools/model_tools/src/openvino/model_zoo/download_engine/downloader.py @@ -87,7 +87,7 @@ def _try_download(self, reporter, file, start_download, size): file.seek(0) file.truncate() progress.size = 0 - progress.hasher = hashlib.sha256() + progress.hasher = hashlib.sha384() self._process_download(reporter, chunk_iterable, size, progress, file) @@ -109,7 +109,7 @@ def _try_download(self, reporter, file, start_download, size): def _try_retrieve_from_cache(self, reporter, model_file, destination): try: - if self.cache.has(model_file.sha256): + if self.cache.has(model_file.sha384): reporter.job_context.check_interrupted() reporter.print_section_heading('Retrieving {} from the cache', destination) @@ -145,8 +145,8 @@ def _try_retrieve(self, reporter, destination, model_file, start_download): with destination.open('w+b') as f: actual_hash = self._try_download(reporter, f, start_download, model_file.size) - if actual_hash and cache.verify_hash(reporter, actual_hash, model_file.sha256, destination): - self._try_update_cache(reporter, self.cache, model_file.sha256, destination) + if actual_hash and cache.verify_hash(reporter, actual_hash, model_file.sha384, destination): + self._try_update_cache(reporter, self.cache, model_file.sha384, destination) success = True reporter.print() diff --git a/tools/model_tools/src/openvino/model_zoo/omz_converter.py b/tools/model_tools/src/openvino/model_zoo/omz_converter.py index 74993ab14bd..cd5ae22cf8d 100644 --- a/tools/model_tools/src/openvino/model_zoo/omz_converter.py +++ b/tools/model_tools/src/openvino/model_zoo/omz_converter.py @@ -16,6 +16,7 @@ import collections import json import os +import shutil import string import sys @@ -207,15 +208,17 @@ def main(): mo_path = args.mo if mo_path is None: - mo_package_path = _common.get_package_path(args.python, 'mo') + mo_executable = shutil.which('mo') - if mo_package_path: - # run MO as a module - mo_cmd_prefix = [str(args.python), '-m', 'mo'] + if mo_executable: + mo_cmd_prefix = [str(args.python), '--', mo_executable] + mo_package_path, stderr = _common.get_package_path(args.python, 'mo') + if mo_package_path is None: + sys.exit('Unable to load Model Optimizer. Errors occurred: {}'.format(stderr)) mo_dir = mo_package_path.parent else: try: - mo_path = Path(os.environ['INTEL_OPENVINO_DIR']) / 'deployment_tools/model_optimizer/mo.py' + mo_path = Path(os.environ['INTEL_OPENVINO_DIR']) / 'tools/model_optimizer/mo.py' except KeyError: sys.exit('Unable to locate Model Optimizer. ' + 'Use --mo or run setupvars.sh/setupvars.bat from the OpenVINO toolkit.') diff --git a/tools/model_tools/src/openvino/model_zoo/omz_data_downloader.py b/tools/model_tools/src/openvino/model_zoo/omz_data_downloader.py index cb5f517bab4..46fc67a1e70 100644 --- a/tools/model_tools/src/openvino/model_zoo/omz_data_downloader.py +++ b/tools/model_tools/src/openvino/model_zoo/omz_data_downloader.py @@ -23,7 +23,7 @@ def copy_data(output_dir): data_path = output_dir / 'data' - print('Copying fies from {} to {}'.format(_common.PACKAGE_DIR / 'data', data_path)) + print('Copying files from {} to {}'.format(_common.PACKAGE_DIR / 'data', data_path)) shutil.copytree( str(_common.PACKAGE_DIR / 'data'), diff --git a/tools/model_tools/src/openvino/model_zoo/omz_quantizer.py b/tools/model_tools/src/openvino/model_zoo/omz_quantizer.py index 2eedfde1238..53d5de4609d 100644 --- a/tools/model_tools/src/openvino/model_zoo/omz_quantizer.py +++ b/tools/model_tools/src/openvino/model_zoo/omz_quantizer.py @@ -15,6 +15,7 @@ import argparse import json import os +import shutil import sys import tempfile @@ -162,12 +163,13 @@ def main(): pot_path = args.pot if pot_path is None: - if _common.get_package_path(args.python, 'pot'): - # run POT as a module - pot_cmd_prefix = [str(args.python), '-m', 'pot'] + pot_executable = shutil.which('pot') + + if pot_executable: + pot_cmd_prefix = [str(args.python), '--', pot_executable] else: try: - pot_path = Path(os.environ['INTEL_OPENVINO_DIR']) / 'deployment_tools/tools/post_training_optimization_toolkit/main.py' + pot_path = Path(os.environ['INTEL_OPENVINO_DIR']) / 'tools/post_training_optimization_tool/main.py' except KeyError: sys.exit('Unable to locate Post-Training Optimization Toolkit. ' + 'Use --pot or run setupvars.sh/setupvars.bat from the OpenVINO toolkit.') diff --git a/tools/model_tools/src/openvino/model_zoo/schema.yml b/tools/model_tools/src/openvino/model_zoo/schema.yml new file mode 100644 index 00000000000..2a3ff25f708 --- /dev/null +++ b/tools/model_tools/src/openvino/model_zoo/schema.yml @@ -0,0 +1,57 @@ +# Copyright (c) 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +type: "//rec" +required: + description: "//str" + task_type: "//str" + files: + type: "//arr" + contents: + type: "//rec" + required: + name: "//str" + size: "//int" + sha384: "//str" + source: + type: "//any" + of: + - "//str" + - type: "//rec" + required: + $type: "//str" + id: "//str" + framework: "//str" + license: "//str" +optional: + postprocessing: + type: "//arr" + contents: + type: "//rec" + required: + $type: "//str" + file: "//str" + optional: + pattern: "//str" + replacement: "//str" + format: "//str" + count: "//int" + model_optimizer_args: + type: "//arr" + contents: "//str" + conversion_to_onnx_args: + type: "//arr" + contents: "//str" + quantizable: "//bool" + quantized: "//str"