diff options
| author | Yeoh Ee Peng <ee.peng.yeoh@intel.com> | 2019-12-04 11:17:42 +0800 |
|---|---|---|
| committer | Anuj Mittal <anuj.mittal@intel.com> | 2019-12-10 13:31:24 +0800 |
| commit | 1e514838dfad1d2339f896f850425bc33621d297 (patch) | |
| tree | f93a016de883f4af953592e7c635cae6e6f56308 /lib/oeqa/runtime/miutils | |
| parent | f39ad91524768c729cd68ce367dacf9b4dfc4cf7 (diff) | |
| download | meta-intel-1e514838dfad1d2339f896f850425bc33621d297.tar.gz | |
oeqa/runtime/cases/dldt: Enable inference engine and model optimizer tests
Add sanity tests for inference engine:
- test inference engine c/cpp shared library
- test inference engine python api
- test inference engine cpu, gpu, myriad plugin
Add sanity tests for model optimizer
- test model optmizer can generate ir
Licenses:
- classification_sample.py
license: Apache 2.0
source: <install_root>/deployment_tools/inference_engine/samples/*
Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Diffstat (limited to 'lib/oeqa/runtime/miutils')
5 files changed, 110 insertions, 0 deletions
diff --git a/lib/oeqa/runtime/miutils/dldtutils.py b/lib/oeqa/runtime/miutils/dldtutils.py new file mode 100644 index 00000000..45bf2e12 --- /dev/null +++ b/lib/oeqa/runtime/miutils/dldtutils.py | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | |||
| 2 | def get_testdata_config(testdata, config): | ||
| 3 | return testdata.get(config) | ||
diff --git a/lib/oeqa/runtime/miutils/targets/oeqatarget.py b/lib/oeqa/runtime/miutils/targets/oeqatarget.py new file mode 100644 index 00000000..a9f7f1b4 --- /dev/null +++ b/lib/oeqa/runtime/miutils/targets/oeqatarget.py | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | |||
| 2 | class OEQATarget(object): | ||
| 3 | |||
| 4 | def __init__(self, target): | ||
| 5 | self.target = target | ||
| 6 | |||
| 7 | def run(self, cmd): | ||
| 8 | return self.target.run(cmd) | ||
| 9 | |||
| 10 | def copy_to(self, source, destination_dir): | ||
| 11 | self.target.copyTo(source, destination_dir) | ||
diff --git a/lib/oeqa/runtime/miutils/tests/dldt_inference_engine_test.py b/lib/oeqa/runtime/miutils/tests/dldt_inference_engine_test.py new file mode 100644 index 00000000..a44f9027 --- /dev/null +++ b/lib/oeqa/runtime/miutils/tests/dldt_inference_engine_test.py | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | import os | ||
| 2 | script_path = os.path.dirname(os.path.realpath(__file__)) | ||
| 3 | files_path = os.path.join(script_path, '../../files/') | ||
| 4 | |||
| 5 | class DldtInferenceEngineTest(object): | ||
| 6 | ie_input_files = {'ie_python_sample': 'classification_sample.py', | ||
| 7 | 'input': 'chicky_512.png', | ||
| 8 | 'input_download': 'https://raw.githubusercontent.com/opencv/opencv/master/samples/data/chicky_512.png', | ||
| 9 | 'model': 'squeezenet_v1.1.xml'} | ||
| 10 | |||
| 11 | def __init__(self, target, work_dir): | ||
| 12 | self.target = target | ||
| 13 | self.work_dir = work_dir | ||
| 14 | |||
| 15 | def setup(self): | ||
| 16 | self.target.run('mkdir -p %s' % self.work_dir) | ||
| 17 | self.target.copy_to(os.path.join(files_path, 'dldt-inference-engine', self.ie_input_files['ie_python_sample']), | ||
| 18 | self.work_dir) | ||
| 19 | |||
| 20 | def tear_down(self): | ||
| 21 | self.target.run('rm -rf %s' % self.work_dir) | ||
| 22 | |||
| 23 | def test_can_download_input_file(self, proxy_port): | ||
| 24 | return self.target.run('cd %s; wget %s -e https_proxy=%s' % | ||
| 25 | (self.work_dir, | ||
| 26 | self.ie_input_files['input_download'], | ||
| 27 | proxy_port)) | ||
| 28 | |||
| 29 | def test_dldt_ie_classification_with_device(self, device, ir_files_dir): | ||
| 30 | return self.target.run('classification_sample_async -d %s -i %s -m %s' % | ||
| 31 | (device, | ||
| 32 | os.path.join(self.work_dir, self.ie_input_files['input']), | ||
| 33 | os.path.join(ir_files_dir, self.ie_input_files['model']))) | ||
| 34 | |||
| 35 | def test_dldt_ie_classification_python_api_with_device(self, device, ir_files_dir, extension=''): | ||
| 36 | if extension: | ||
| 37 | return self.target.run('python3 %s -d %s -i %s -m %s -l %s' % | ||
| 38 | (os.path.join(self.work_dir, self.ie_input_files['ie_python_sample']), | ||
| 39 | device, | ||
| 40 | os.path.join(self.work_dir, self.ie_input_files['input']), | ||
| 41 | os.path.join(ir_files_dir, self.ie_input_files['model']), | ||
| 42 | extension)) | ||
| 43 | else: | ||
| 44 | return self.target.run('python3 %s -d %s -i %s -m %s' % | ||
| 45 | (os.path.join(self.work_dir, self.ie_input_files['ie_python_sample']), | ||
| 46 | device, | ||
| 47 | os.path.join(self.work_dir, self.ie_input_files['input']), | ||
| 48 | os.path.join(ir_files_dir, self.ie_input_files['model']))) | ||
diff --git a/lib/oeqa/runtime/miutils/tests/dldt_model_optimizer_test.py b/lib/oeqa/runtime/miutils/tests/dldt_model_optimizer_test.py new file mode 100644 index 00000000..7d3db15b --- /dev/null +++ b/lib/oeqa/runtime/miutils/tests/dldt_model_optimizer_test.py | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | import os | ||
| 2 | |||
| 3 | class DldtModelOptimizerTest(object): | ||
| 4 | mo_input_files = {'model': 'squeezenet_v1.1.caffemodel', | ||
| 5 | 'prototxt': 'deploy.prototxt'} | ||
| 6 | mo_exe = 'mo.py' | ||
| 7 | |||
| 8 | def __init__(self, target, work_dir): | ||
| 9 | self.target = target | ||
| 10 | self.work_dir = work_dir | ||
| 11 | |||
| 12 | def setup(self): | ||
| 13 | self.target.run('mkdir -p %s' % self.work_dir) | ||
| 14 | |||
| 15 | def tear_down(self): | ||
| 16 | self.target.run('rm -rf %s' % self.work_dir) | ||
| 17 | |||
| 18 | def test_dldt_mo_can_create_ir(self, mo_exe_dir, mo_files_dir): | ||
| 19 | return self.target.run('python3 %s --input_model %s --input_proto %s --output_dir %s --data_type FP16' % | ||
| 20 | (os.path.join(mo_exe_dir, self.mo_exe), | ||
| 21 | os.path.join(mo_files_dir, self.mo_input_files['model']), | ||
| 22 | os.path.join(mo_files_dir, self.mo_input_files['prototxt']), | ||
| 23 | self.work_dir)) | ||
diff --git a/lib/oeqa/runtime/miutils/tests/squeezenet_model_download_test.py b/lib/oeqa/runtime/miutils/tests/squeezenet_model_download_test.py new file mode 100644 index 00000000..a3e46a0a --- /dev/null +++ b/lib/oeqa/runtime/miutils/tests/squeezenet_model_download_test.py | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | class SqueezenetModelDownloadTest(object): | ||
| 2 | download_files = {'squeezenet1.1.prototxt': 'https://raw.githubusercontent.com/DeepScale/SqueezeNet/a47b6f13d30985279789d08053d37013d67d131b/SqueezeNet_v1.1/deploy.prototxt', | ||
| 3 | 'squeezenet1.1.caffemodel': 'https://github.com/DeepScale/SqueezeNet/raw/a47b6f13d30985279789d08053d37013d67d131b/SqueezeNet_v1.1/squeezenet_v1.1.caffemodel'} | ||
| 4 | |||
| 5 | def __init__(self, target, work_dir): | ||
| 6 | self.target = target | ||
| 7 | self.work_dir = work_dir | ||
| 8 | |||
| 9 | def setup(self): | ||
| 10 | self.target.run('mkdir -p %s' % self.work_dir) | ||
| 11 | |||
| 12 | def tear_down(self): | ||
| 13 | self.target.run('rm -rf %s' % self.work_dir) | ||
| 14 | |||
| 15 | def test_can_download_squeezenet_model(self, proxy_port): | ||
| 16 | return self.target.run('cd %s; wget %s -e https_proxy=%s' % | ||
| 17 | (self.work_dir, | ||
| 18 | self.download_files['squeezenet1.1.caffemodel'], | ||
| 19 | proxy_port)) | ||
| 20 | |||
| 21 | def test_can_download_squeezenet_prototxt(self, proxy_port): | ||
| 22 | return self.target.run('cd %s; wget %s -e https_proxy=%s' % | ||
| 23 | (self.work_dir, | ||
| 24 | self.download_files['squeezenet1.1.prototxt'], | ||
| 25 | proxy_port)) | ||
