Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CPUExecutionProvider to the ONNX E2E #1398

Merged
merged 34 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
863e7a2
Add CPU EP
kshpv Nov 30, 2022
c408986
Fix bug
kshpv Nov 30, 2022
5e2f944
Update report creation
kshpv Dec 1, 2022
f042429
Merge remote-tracking branch 'remote/develop' into onnx_e2e_cpu
kshpv Dec 1, 2022
7421d95
Update configs
kshpv Dec 2, 2022
0cd4a50
Update reference; Update generate_report
kshpv Dec 2, 2022
35d8deb
Add ov_ep_only parameter
kshpv Dec 4, 2022
fabbd1f
Fix bug
kshpv Dec 5, 2022
a2e09a0
Fix bug
kshpv Dec 5, 2022
bef3420
Fix pylint
kshpv Dec 6, 2022
2c7bc74
Add meta to report
kshpv Dec 7, 2022
a597067
Update html generation based on yattag
kshpv Dec 7, 2022
4fc835b
Update generating table
kshpv Dec 8, 2022
86e073b
Merge cells
kshpv Dec 8, 2022
2fea9bc
Fix typo
kshpv Dec 8, 2022
87e7ffd
Fix merging cells of the Provider names
kshpv Dec 9, 2022
35c9e47
Divide is_ov_ep_only to disable-ov-ep and enable-cpu-ep
kshpv Dec 9, 2022
f3fcfc0
Fix pylint
kshpv Dec 9, 2022
977fb2b
Fix typo
kshpv Dec 9, 2022
2dd6e83
Make getting row colors before generating final df
kshpv Dec 11, 2022
425b616
Update config to not override masks
kshpv Dec 13, 2022
5c7ebc6
Add commands for all providers
kshpv Dec 13, 2022
0822c79
Update Makefile
kshpv Dec 13, 2022
3c2b458
Add target_tags to quanitze only on ones
kshpv Dec 13, 2022
639ce68
Update Makefile
kshpv Dec 14, 2022
a0d45da
Add extra line
kshpv Dec 14, 2022
dd0ac14
Add --model_names option
kshpv Dec 20, 2022
759827a
Merge remote-tracking branch 'remote/develop' into onnx_e2e_cpu
kshpv Dec 20, 2022
a7f21c5
Update Makefile
kshpv Dec 20, 2022
12a94fb
logger
kshpv Dec 20, 2022
d0624c3
Merge remote-tracking branch 'remote/develop' into onnx_e2e_cpu
kshpv Jan 11, 2023
e9a3d97
Update yattag version
kshpv Jan 11, 2023
4ef409f
Remove e2e target in makefile
kshpv Jan 12, 2023
e4e2033
Update doc
kshpv Jan 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ install-onnx-test:
pip install -r tests/onnx/benchmarking/requirements.txt
pip install -r examples/post_training_quantization/onnx/mobilenet_v2/requirements.txt

install-onnx-dev: install-onnx-test
install-onnx-dev: install-onnx-test
pip install pylint==$(PYLINT_VERSION)

test-onnx:
Expand Down
23 changes: 14 additions & 9 deletions tests/onnx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ We provide two types of tests.

1. Pre-commit test (no pytest markers)

This is a test that the CI server runs for every PR. It includes unit testing of ONNX framework-specific features of NNCF. In order to merge PR into the develop branch, all tests in it must be green. If a new feature or a bug fix is implemented, an appropriate unit test to validate those implementation should also be added to the pre-commit test. To run the pre-commit test, please execute the following command.
This is a test that the CI server runs for every PR. It consists of unit tests of ONNX features of NNCF. To run the pre-commit test, please execute the following command.

```bash
$ pytest tests/onnx --junitxml nncf-tests.xml
# (alias)
$ make test-onnx
```

2. E2E test for ONNX Model ZOO (pytest markers: `e2e_ptq` and `e2e_eval_reference_model`)
2. E2E test (pytest markers: `e2e_ptq` and `e2e_eval_reference_model`)

This is a test to validate ONNX PTQ API functionality for the models in ONNX Model ZOO. There is no obligation for developers to check this test to merge their PR. It checks the quantized model accuracy and performance and compare them to the references. Our CI server runs it periodically, and if defects are found, the merged changes during the test cycle should be investigated. To run the E2E test, please execute the following command.
This is a test to validate ONNX PTQ API functionality for the models in ONNX Model ZOO. It compares the quantized model accuracy with the references. To run the E2E test, please execute the following command.

```bash
$ pytest tests/onnx -m e2e_ptq --model-dir (model_dir) --data-dir (data_dir) --output-dir (output_dir) --ckpt-dir (ckpt_dir) --anno-dir (anno_dir) --eval-size (eval_size) --ptq-size (ptq_size)
Expand All @@ -25,12 +25,17 @@ We provide two types of tests.
1. `--model-dir`: The directory path which includes ONNX Model ZOO models (.onnx files). See [#prepare-models](benchmarking/README.md#prepare-models) for details.
2. `--data-dir`: The directory path which includes datasets (ImageNet2012, COCO, Cityscapes, and VOC) [#prepare-models](benchmarking/README.md#prepare-models).
3. `--output-dir`: The directory path where the test results will be saved.
4. (Optional) `--ckpt-dir`: Directory path to save quantized models.
5. (Optional) `--anno-dir`: Directory path for dataset annotations. Please refer to [OpenVINO accuracy checker](https://github.com/openvinotoolkit/open_model_zoo/tree/master/tools/accuracy_checker).
6. (Optional) `--eval-size` The number of samples for evaluation.
7. (Optional) `--ptq-size` The number of samples for calibrating quantization parameters.

(Optional) If you want to test the reference (not quantized) model accuracy and performance, try the following command.
4. (Optional) `--model-names`: String containing model names to test. Model name is the prefix of the name of AccuracyChecker config before the '.' symbol. Please, provide the model names using ' ' as a separator.
5. (Optional) `--ckpt-dir`: Directory path to save quantized models.
6. (Optional) `--anno-dir`: Directory path for dataset annotations. Please refer to [OpenVINO accuracy checker](https://github.com/openvinotoolkit/open_model_zoo/tree/master/tools/accuracy_checker).
7. (Optional) `--eval-size`: The number of samples for evaluation.
8. (Optional) `--ptq-size`: The number of samples for calibrating quantization parameters.
9. (Optional) `--enable-ov-ep`: If the parameter is set then the accuracy validation of the quantized models
will be enabled for OpenVINOExecutionProvider.
10. (Optional) `--disable-cpu-ep`: If the parameter is set then the accuracy validation of the quantized models
will be disabled for CPUExecutionProvider.

If you want to test the reference (not quantized) model accuracy - try the following command.

```bash
$ pytest tests/onnx -m e2e_eval_reference_model --model-dir (model_dir) --data-dir (data_dir) --output-dir (output_dir) --ckpt-dir (ckpt_dir) --anno-dir (anno_dir) --eval-size (eval_size) --ptq-size (ptq_size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ models:
launchers:
- framework: onnx_runtime
adapter: classification
execution_providers: ["OpenVINOExecutionProvider"]
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
inputs:
- name: images:0
type: INPUT
shape: [ 1, 224, 224, 3 ]
layout: "NHWC"
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
inputs:
- name: images:0
type: INPUT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ models:
- framework: onnx_runtime
adapter: classification
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
- framework: onnx_runtime
adapter: classification
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
datasets:
- name: imagenet_1000_classes
# read in RGB format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ models:
launchers:
- framework: onnx_runtime
execution_providers: [ 'OpenVINOExecutionProvider' ]
tags: ['OpenVINOExecutionProvider']
adapter:
type: faster_rcnn_onnx
boxes_out: '6379'
scores_out: '6383'
labels_out: '6381'
inputs:
- name: image
type: INPUT
layout: "CHW"
- framework: onnx_runtime
execution_providers: [ 'CPUExecutionProvider' ]
tags: ['CPUExecutionProvider']
adapter:
type: faster_rcnn_onnx
boxes_out: '6379'
Expand All @@ -12,7 +25,6 @@ models:
- name: image
type: INPUT
layout: "CHW"

datasets:
- name: ms_coco_detection_80_class_with_background
preprocessing:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ models:
launchers:
- framework: onnx_runtime
execution_providers: [ 'OpenVINOExecutionProvider' ]
tags: ['OpenVINOExecutionProvider']
adapter:
type: mask_rcnn
boxes_out: '6568'
classes_out: '6570'
scores_out: '6572'
raw_masks_out: '6887'
inputs:
- name: image
type: INPUT
layout: "CHW"
- framework: onnx_runtime
execution_providers: [ 'CPUExecutionProvider' ]
tags: ['CPUExecutionProvider']
adapter:
type: mask_rcnn
boxes_out: '6568'
Expand Down Expand Up @@ -38,6 +52,20 @@ models:
launchers:
- framework: onnx_runtime
execution_providers: [ 'OpenVINOExecutionProvider' ]
tags: ['OpenVINOExecutionProvider']
adapter:
type: mask_rcnn
boxes_out: '6568'
classes_out: '6570'
scores_out: '6572'
raw_masks_out: '6887'
inputs:
- name: image
type: INPUT
layout: "CHW"
- framework: onnx_runtime
execution_providers: [ 'CPUExecutionProvider' ]
tags: ['CPUExecutionProvider']
adapter:
type: mask_rcnn
boxes_out: '6568'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ models:
launchers:
- framework: onnx_runtime
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
adapter:
type: duc_segmentation
ds_rate: 8
cell_width: 2
- framework: onnx_runtime
execution_providers: [ 'CPUExecutionProvider' ]
tags: ['CPUExecutionProvider']
adapter:
type: duc_segmentation
ds_rate: 8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ models:
launchers:
- framework: onnx_runtime
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
adapter:
type: segmentation
- framework: onnx_runtime
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
adapter:
type: segmentation

datasets:
- name: mscoco_segmentation_to_voc
annotation_conversion:
Expand All @@ -14,6 +19,7 @@ models:
has_background: True
sort_annotations: True
semantic_only: True
convert_mask: False
# Do not change masks_dir path
masks_dir: mscoco_to_voc_seg_masks
# Only evaluate on VOC labels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ models:
launchers:
- framework: onnx_runtime
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
adapter:
type: retinanet_multihead
boxes_outputs: [output6, output7, output8, output9, output10]
class_outputs: [output1, output2, output3, output4, output5]
inputs:
- name: input
type: INPUT
layout: "NCHW"
- framework: onnx_runtime
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
adapter:
type: retinanet_multihead
boxes_outputs: [output6, output7, output8, output9, output10]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ models:
launchers:
- framework: onnx_runtime
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
adapter:
type: ssd_onnx
scores_out: '.*scores*'
labels_out: '.*labels*'
bboxes_out: '.*bboxes*'
- framework: onnx_runtime
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
adapter:
type: ssd_onnx
scores_out: '.*scores*'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ models:
launchers:
- framework: onnx_runtime
execution_providers: ['OpenVINOExecutionProvider']
tags: ['OpenVINOExecutionProvider']
adapter:
type: tf_object_detection
scores_out: detection_scores
classes_out: detection_classes
boxes_out: detection_boxes
num_detections_out: num_detections
inputs:
- name: inputs
type: INPUT
layout: "NHWC"
- framework: onnx_runtime
execution_providers: ['CPUExecutionProvider']
tags: ['CPUExecutionProvider']
adapter:
type: tf_object_detection
scores_out: detection_scores
Expand Down
Loading