1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
import os
script_path = os.path.dirname(os.path.realpath(__file__))
files_path = os.path.join(script_path, '../../files/')
class DldtInferenceEngineTest(object):
ie_input_files = {'ie_python_sample': 'classification_sample.py',
'input': 'chicky_512.png',
'input_download': 'https://raw.githubusercontent.com/opencv/opencv/master/samples/data/chicky_512.png',
'model': 'squeezenet_v1.1.xml'}
def __init__(self, target, work_dir):
self.target = target
self.work_dir = work_dir
def setup(self):
self.target.run('mkdir -p %s' % self.work_dir)
self.target.copy_to(os.path.join(files_path, 'dldt-inference-engine', self.ie_input_files['ie_python_sample']),
self.work_dir)
def tear_down(self):
self.target.run('rm -rf %s' % self.work_dir)
def test_can_download_input_file(self, proxy_port):
return self.target.run('cd %s; wget %s -e https_proxy=%s' %
(self.work_dir,
self.ie_input_files['input_download'],
proxy_port))
def test_dldt_ie_classification_with_device(self, device, ir_files_dir):
return self.target.run('classification_sample_async -d %s -i %s -m %s' %
(device,
os.path.join(self.work_dir, self.ie_input_files['input']),
os.path.join(ir_files_dir, self.ie_input_files['model'])))
def test_dldt_ie_classification_python_api_with_device(self, device, ir_files_dir, extension=''):
if extension:
return self.target.run('python3 %s -d %s -i %s -m %s -l %s' %
(os.path.join(self.work_dir, self.ie_input_files['ie_python_sample']),
device,
os.path.join(self.work_dir, self.ie_input_files['input']),
os.path.join(ir_files_dir, self.ie_input_files['model']),
extension))
else:
return self.target.run('python3 %s -d %s -i %s -m %s' %
(os.path.join(self.work_dir, self.ie_input_files['ie_python_sample']),
device,
os.path.join(self.work_dir, self.ie_input_files['input']),
os.path.join(ir_files_dir, self.ie_input_files['model'])))
|