summaryrefslogtreecommitdiffstats
path: root/lib/oeqa/runtime/miutils/tests/dldt_inference_engine_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oeqa/runtime/miutils/tests/dldt_inference_engine_test.py')
-rw-r--r--lib/oeqa/runtime/miutils/tests/dldt_inference_engine_test.py56
1 files changed, 56 insertions, 0 deletions
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..31bfb539
--- /dev/null
+++ b/lib/oeqa/runtime/miutils/tests/dldt_inference_engine_test.py
@@ -0,0 +1,56 @@
1import os
2script_path = os.path.dirname(os.path.realpath(__file__))
3files_path = os.path.join(script_path, '../../files/')
4
5class 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 python_cmd = 'from openvino.inference_engine import IENetwork, IECore; ie = IECore(); print(ie.available_devices)'
20 __, output = self.target.run('python3 -c "%s"' % python_cmd)
21 self.available_devices = output
22
23 def tear_down(self):
24 self.target.run('rm -rf %s' % self.work_dir)
25
26 def test_check_if_openvino_device_available(self, device):
27 if device not in self.available_devices:
28 return False, self.available_devices
29 return True, self.available_devices
30
31 def test_can_download_input_file(self, proxy_port):
32 return self.target.run('cd %s; wget %s -e https_proxy=%s' %
33 (self.work_dir,
34 self.ie_input_files['input_download'],
35 proxy_port))
36
37 def test_dldt_ie_classification_with_device(self, device, ir_files_dir):
38 return self.target.run('classification_sample_async -d %s -i %s -m %s' %
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
43 def test_dldt_ie_classification_python_api_with_device(self, device, ir_files_dir, extension=''):
44 if extension:
45 return self.target.run('python3 %s -d %s -i %s -m %s -l %s' %
46 (os.path.join(self.work_dir, self.ie_input_files['ie_python_sample']),
47 device,
48 os.path.join(self.work_dir, self.ie_input_files['input']),
49 os.path.join(ir_files_dir, self.ie_input_files['model']),
50 extension))
51 else:
52 return self.target.run('python3 %s -d %s -i %s -m %s' %
53 (os.path.join(self.work_dir, self.ie_input_files['ie_python_sample']),
54 device,
55 os.path.join(self.work_dir, self.ie_input_files['input']),
56 os.path.join(ir_files_dir, self.ie_input_files['model'])))