Skip to content

Commit e8a710d

Browse files
Modify test cases - video as an input
1 parent 076e468 commit e8a710d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

demos/tests/cases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def single_option_cases(key, *args):
255255
test_cases=combine_cases(
256256
TestCase(options={'-no_show': None,
257257
**MONITORS,
258-
'-i': TestDataArg('coco128/images/train2017/')}),
258+
'-i': TestDataArg('video.mp4')}),
259259
TestCase(options={
260260
'-m': ModelArg('gaze-estimation-adas-0002'),
261261
'-m_hp': ModelArg('head-pose-estimation-adas-0001'),
@@ -445,7 +445,7 @@ def single_option_cases(key, *args):
445445
test_cases=combine_cases(
446446
TestCase(options={'-no_show': None,
447447
**MONITORS,
448-
'-i': DataPatternArg('gaze-estimation-adas')}),
448+
'-i': DataPatternArg('video.mp4')}),
449449
TestCase(options={
450450
'-m': ModelArg('gaze-estimation-adas-0002'),
451451
'-m_hp': ModelArg('head-pose-estimation-adas-0001'),

demos/tests/run_tests.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,21 @@
4444

4545
from pathlib import Path
4646
from io import BytesIO
47-
from urllib.request import urlopen
47+
import urllib.request
4848
from zipfile import ZipFile
4949

5050
from args import ArgContext, Arg, ModelArg
5151
from cases import Demo
5252
from data_sequences import DATA_SEQUENCES
5353

54+
import shutil
55+
5456
scopes = {
5557
'base': importlib.import_module('cases').DEMOS,
5658
'performance': importlib.import_module('performance_cases').DEMOS,
5759
}
5860
COCO128_URL = "https://ultralytics.com/assets/coco128.zip"
61+
VIDEO_URL = "https://github.com/intel-iot-devkit/sample-videos/raw/master/face-demographics-walking.mp4"
5962

6063

6164
def parser_paths_list(supported_devices):
@@ -243,10 +246,13 @@ def main():
243246
print(*[demo.subdirectory for demo in demos_to_test], sep =',')
244247
os.environ["REQUESTS_CA_BUNDLE"] = certifi.where()
245248
os.environ["SSL_CERT_FILE"] = certifi.where()
246-
with urlopen(COCO128_URL) as zipresp: # nosec B310 # disable urllib_urlopen because url is hardcoded
249+
with urllib.request.urlopen(COCO128_URL) as zipresp: # nosec B310 # disable urllib_urlopen because url is hardcoded
247250
with ZipFile(BytesIO(zipresp.read())) as zfile:
248251
zfile.extractall(args.test_data_dir)
249252

253+
fullfilename = os.path.join(args.test_data_dir, "video.mp4")
254+
urllib.request.urlopen(VIDEO_URL, fullfilename)
255+
250256
with temp_dir_as_path() as global_temp_dir:
251257
if args.models_dir:
252258
dl_dir = args.models_dir

0 commit comments

Comments
 (0)