Skip to content

Commit

Permalink
add nncf precision test
Browse files Browse the repository at this point in the history
  • Loading branch information
wonjuleee committed Jun 2, 2022
1 parent 0957213 commit e9e58f9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion external/mmdetection/tests/test_ote_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from ote_sdk.entities.inference_parameters import InferenceParameters
from ote_sdk.entities.model_template import TaskType, task_type_to_label_domain
from ote_sdk.entities.metrics import Performance
from ote_sdk.entities.model import ModelEntity, ModelFormat, ModelOptimizationType
from ote_sdk.entities.model import ModelEntity, ModelFormat, ModelOptimizationType, ModelPrecision
from ote_sdk.entities.model_template import parse_model_template
from ote_sdk.entities.optimization_parameters import OptimizationParameters
from ote_sdk.entities.resultset import ResultSetEntity
Expand Down Expand Up @@ -520,6 +520,14 @@ def end_to_end(
print(f'Performance of NNCF model: {nncf_performance.score.value:.4f}')
self.check_threshold(validation_performance, nncf_performance, nncf_perf_delta_tolerance,
'Too big performance difference after NNCF optimization.')

# Check whether optimize & export assigns correct model precision
nncf_task.export(ExportType.OPENVINO, nncf_model)

if nncf_task._hyperparams.nncf_optimization.enable_quantization:
assert nncf_model.precision[0] == ModelPrecision.INT8
else:
assert nncf_model.precision[0] == nncf_task._precision_from_config[0]
else:
print('Skipped test of OTEDetectionNNCFTask. Required NNCF module.')

Expand Down

0 comments on commit e9e58f9

Please sign in to comment.