-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more acceptance test coverage and minor fixes to existing tests…
…; Updates to CI/CD pipeline; Added 3 new TF models and updated Torch MobileBert - Minor clean-up of code to minimize errors from static analysis (pylint) - Added more acceptance tests for a few pytorch segmentation models and applied minor fixes to previous acceptance tests - Config file and documentation updates for a pytorch MobileBert models - Releasing next package release of aimet model zoo (installable wheel file binaries) - Added code, documentation and artifacts the following new Tensorflow models: MobileNet-EdgeTPU, DeepLabV3Plus_Xception_TF2 and DeepLabV3Plus_MBNV2_TF2 Signed-off-by: Hanwen Xiong <quic_hanwxion@quicinc.com>
- Loading branch information
1 parent
7e1bea4
commit 7473180
Showing
98 changed files
with
3,367 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# ============================================================================= | ||
# @@-COPYRIGHT-START-@@ | ||
# | ||
# Copyright (c) 2023 of Qualcomm Innovation Center, Inc. All rights reserved. | ||
# | ||
# @@-COPYRIGHT-END-@@ | ||
# ============================================================================= | ||
if (ENABLE_CUDA) | ||
set(CUDA_FLAG -m "not blah") | ||
set(USE_CUDA True) | ||
else (ENABLE_CUDA) | ||
set(CUDA_FLAG -m "not cuda") | ||
set(USE_CUDA False) | ||
endif (ENABLE_CUDA) | ||
|
||
add_custom_target( AcceptanceTests.Tensorflow ) | ||
|
||
file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*quanteval.py") | ||
foreach(filename ${files}) | ||
get_filename_component( testname "${filename}" NAME_WE ) | ||
string(SUBSTRING ${testname} 5 -1 formatted_name) | ||
message(STATUS "Now running Tensorflow Test: ${formatted_name}") | ||
|
||
add_custom_target(AcceptanceTests.Tensorflow.${testname} | ||
VERBATIM COMMAND . /opt/${formatted_name}-venv/bin/activate && export HF_HOME=/opt/cache && | ||
${CMAKE_COMMAND} -E env | ||
${MZ_PYTHONPATH}:$$PYTHONPATH | ||
python -m pytest -s ${filename} | ||
${CUDA_FLAG} --junitxml=${CMAKE_CURRENT_BINARY_DIR}/py_test_output_${testname}.xml) | ||
|
||
add_dependencies( AcceptanceTests.Tensorflow AcceptanceTests.Tensorflow.${testname} ) | ||
endforeach( filename ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
AcceptanceTests/tensorflow/staging/test_deeplabv3plus_mbnv2_tf2_quanteval.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# /usr/bin/env python3 | ||
# -*- mode: python -*- | ||
# ============================================================================= | ||
# @@-COPYRIGHT-START-@@ | ||
# | ||
# Copyright (c) 2023 of Qualcomm Innovation Center, Inc. All rights reserved. | ||
# Changes from QuIC are licensed under the terms and conditions at | ||
# https://github.com/quic/aimet-model-zoo/blob/develop/LICENSE.pdf | ||
# | ||
# @@-COPYRIGHT-END-@@ | ||
# ============================================================================= | ||
|
||
""" acceptance test for deeplabv3plus mbnv2""" | ||
|
||
import pytest | ||
from aimet_zoo_tensorflow.deeplabv3plus_tf2.evaluators import deeplabv3plus_tf2_quanteval | ||
|
||
@pytest.mark.slow | ||
@pytest.mark.cuda | ||
@pytest.mark.sementic_segmentation | ||
# pylint:disable = redefined-outer-name | ||
@pytest.mark.parametrize("model_config", ["deeplabv3plus_mbnv2_w8a8"]) | ||
def test_quanteval_deeplabv3plus_mbnv2_tf2(model_config, PascalVOC_segmentation_test_data_path): | ||
"""mobiledet edgetpu image classification test""" | ||
|
||
if PascalVOC_segmentation_test_data_path is None: | ||
pytest.xfail(f'Dataset path is not set') | ||
|
||
deeplabv3plus_tf2_quanteval.main( | ||
[ | ||
"--model-config", | ||
model_config, | ||
"--dataset-path", | ||
PascalVOC_segmentation_test_data_path | ||
] | ||
) | ||
|
35 changes: 35 additions & 0 deletions
35
AcceptanceTests/tensorflow/staging/test_deeplabv3plus_xception_tf2_quanteval.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env python3 | ||
# -*- mode: python -*- | ||
# ============================================================================= | ||
# @@-COPYRIGHT-START-@@ | ||
# | ||
# Copyright (c) 2023 of Qualcomm Innovation Center, Inc. All rights reserved. | ||
# | ||
# @@-COPYRIGHT-END-@@ | ||
# ============================================================================= | ||
|
||
""" acceptance test for deeplabv3plus xception""" | ||
|
||
import pytest | ||
from aimet_zoo_tensorflow.deeplabv3plus_tf2.evaluators import deeplabv3plus_tf2_quanteval | ||
|
||
@pytest.mark.slow | ||
@pytest.mark.cuda | ||
@pytest.mark.sementic_segmentation | ||
# pylint:disable = redefined-outer-name | ||
@pytest.mark.parametrize("model_config", ["deeplabv3plus_xception_w8a8"]) | ||
def test_quanteval_deeplabv3plus_xception_tf2(model_config, PascalVOC_segmentation_test_data_path): | ||
"""mobiledet edgetpu image classification test""" | ||
|
||
if PascalVOC_segmentation_test_data_path is None: | ||
pytest.xfail(f'Dataset path is not set') | ||
|
||
deeplabv3plus_tf2_quanteval.main( | ||
[ | ||
"--model-config", | ||
model_config, | ||
"--dataset-path", | ||
PascalVOC_segmentation_test_data_path | ||
] | ||
) | ||
|
34 changes: 34 additions & 0 deletions
34
AcceptanceTests/tensorflow/staging/test_mobilenet_edgetpu_quanteval.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# /usr/bin/env python3 | ||
# -*- mode: python -*- | ||
# ============================================================================= | ||
# @@-COPYRIGHT-START-@@ | ||
# | ||
# Copyright (c) 2023 of Qualcomm Innovation Center, Inc. All rights reserved. | ||
# Changes from QuIC are licensed under the terms and conditions at | ||
# https://github.com/quic/aimet-model-zoo/blob/develop/LICENSE.pdf | ||
# | ||
# @@-COPYRIGHT-END-@@ | ||
# ============================================================================= | ||
|
||
""" acceptance test for resnet""" | ||
import pytest | ||
from aimet_zoo_tensorflow.mobilenetedgetpu.evaluators import mobilenet_edgetpu_quanteval | ||
|
||
@pytest.mark.cuda | ||
@pytest.mark.image_classification | ||
# pylint:disable = redefined-outer-name | ||
@pytest.mark.parametrize("model_config", ["mobilenetedgetpu_w8a8"]) | ||
def test_quanteval_mobilenet_edgetpu(model_config, tiny_imageNet_tfrecords): | ||
"""resnet image classification test""" | ||
|
||
if tiny_imageNet_tfrecords is None: | ||
pytest.xfail(f'failed since dataset path is not set') | ||
|
||
mobilenet_edgetpu_quanteval.main( | ||
[ | ||
"--model-config", | ||
model_config, | ||
"--dataset-path", | ||
tiny_imageNet_tfrecords, | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# /usr/bin/env python3 | ||
# -*- mode: python -*- | ||
# ============================================================================= | ||
# @@-COPYRIGHT-START-@@ | ||
# | ||
# Copyright (c) 2023 of Qualcomm Innovation Center, Inc. All rights reserved. | ||
# Changes from QuIC are licensed under the terms and conditions at | ||
# https://github.com/quic/aimet-model-zoo/blob/develop/LICENSE.pdf | ||
# | ||
# @@-COPYRIGHT-END-@@ | ||
# ============================================================================= | ||
""" acceptance test for ffnet semantic segmentation""" | ||
import pytest | ||
from math import isclose | ||
|
||
import torch | ||
|
||
from aimet_zoo_torch.ffnet.evaluators import ( | ||
ffnet_quanteval, | ||
) | ||
|
||
expected_results = { | ||
'segmentation_ffnet40S_dBBB_mobile': {'original_mIoU': 0.7015, 'quantized_mIoU': 0.7018}, | ||
'segmentation_ffnet54S_dBBB_mobile': {'original_mIoU': 0.6957, 'quantized_mIoU': 0.7368}, | ||
'segmentation_ffnet78S_BCC_mobile_pre_down': {'original_mIoU': None, 'quantized_mIoU': None}, | ||
'segmentation_ffnet78S_dBBB_mobile': {'original_mIoU': 0.6904, 'quantized_mIoU': 0.6882}, | ||
'segmentation_ffnet122NS_CCC_mobile_pre_down': {'original_mIoU': None, 'quantized_mIoU': None} | ||
} | ||
|
||
@pytest.mark.sementic_segmentation | ||
@pytest.mark.cuda | ||
#pylint:disable = redefined-outer-name | ||
@pytest.mark.parametrize( | ||
"model_config, expected_mIoUs",[ | ||
("segmentation_ffnet40S_dBBB_mobile", expected_results["segmentation_ffnet40S_dBBB_mobile"]), | ||
("segmentation_ffnet54S_dBBB_mobile", expected_results["segmentation_ffnet54S_dBBB_mobile"]), | ||
("segmentation_ffnet78S_BCC_mobile_pre_down", expected_results["segmentation_ffnet78S_BCC_mobile_pre_down"]), | ||
("segmentation_ffnet78S_dBBB_mobile", expected_results["segmentation_ffnet78S_dBBB_mobile"]), | ||
("segmentation_ffnet122NS_CCC_mobile_pre_down", expected_results["segmentation_ffnet122NS_CCC_mobile_pre_down"]) | ||
] | ||
) | ||
def test_quaneval_ffnet( | ||
model_config, | ||
expected_mIoUs, | ||
tiny_cityscapes_path | ||
): | ||
"""acceptance test of hrnet for semantic segmentation""" | ||
torch.cuda.empty_cache() | ||
if tiny_cityscapes_path is None: | ||
pytest.xfail('Dataset is not set') | ||
|
||
#TODO: Fix the two failing model cards | ||
if expected_mIoUs['original_mIoU'] is None: | ||
pytest.skip(f'{model_config} hasn`t passed manual testing!') | ||
|
||
mIoUs = ffnet_quanteval.main( | ||
[ | ||
"--model-config", model_config, | ||
"--dataset-path", tiny_cityscapes_path, | ||
"--batch-size", '2' | ||
] | ||
) | ||
|
||
assert isclose(mIoUs['mIoU_orig_fp32'], expected_mIoUs['original_mIoU'], rel_tol=1e-4) | ||
assert isclose(mIoUs['mIoU_optim_int8'], expected_mIoUs['quantized_mIoU'], rel_tol=1e-4) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
AcceptanceTests/torch/staging/test_inverseform_quanteval.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# /usr/bin/env python3 | ||
# -*- mode: python -*- | ||
# ============================================================================= | ||
# @@-COPYRIGHT-START-@@ | ||
# | ||
# Copyright (c) 2023 of Qualcomm Innovation Center, Inc. All rights reserved. | ||
# Changes from QuIC are licensed under the terms and conditions at | ||
# https://github.com/quic/aimet-model-zoo/blob/develop/LICENSE.pdf | ||
# | ||
# @@-COPYRIGHT-END-@@ | ||
# ============================================================================= | ||
""" acceptance test for inverseform """ | ||
import pytest | ||
from math import isclose | ||
|
||
from aimet_zoo_torch.inverseform.evaluators.inverseform_quanteval import main | ||
|
||
expected_results = { | ||
'hrnet_16_slim_if': {'original_mIoU': 0.6883, 'quantized_mIoU': 0.6850}, | ||
'ocrnet_48_if': {'original_mIoU': 0.8499, 'quantized_mIoU': 0.8465} | ||
} | ||
|
||
|
||
@pytest.mark.semantic_segmentation | ||
@pytest.mark.parametrize("model_config, expected_mIoUs", [('hrnet_16_slim_if', expected_results['hrnet_16_slim_if']), | ||
('ocrnet_48_if', expected_results['ocrnet_48_if'])]) | ||
def test_inverseform_quanteval( | ||
model_config, | ||
expected_mIoUs, | ||
tiny_cityscapes_path | ||
): | ||
if tiny_cityscapes_path is None: | ||
pytest.xfail(f"dataset path is None!") | ||
|
||
args = ['--model-config', model_config, | ||
'--dataset-path', tiny_cityscapes_path, | ||
'--batch-size', '2'] | ||
mIoUs = main(args) | ||
|
||
assert isclose(mIoUs['original_mIoU'], expected_mIoUs['original_mIoU'] ,rel_tol=1e-4) | ||
assert isclose(mIoUs['quantized_mIoU'], expected_mIoUs['quantized_mIoU'], rel_tol=1e-4) |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.