Skip to content

Commit

Permalink
Modify test cases - video as an input
Browse files Browse the repository at this point in the history
  • Loading branch information
DariaMityagina committed Jan 4, 2024
1 parent 076e468 commit e8a710d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions demos/tests/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def single_option_cases(key, *args):
test_cases=combine_cases(
TestCase(options={'-no_show': None,
**MONITORS,
'-i': TestDataArg('coco128/images/train2017/')}),
'-i': TestDataArg('video.mp4')}),
TestCase(options={
'-m': ModelArg('gaze-estimation-adas-0002'),
'-m_hp': ModelArg('head-pose-estimation-adas-0001'),
Expand Down Expand Up @@ -445,7 +445,7 @@ def single_option_cases(key, *args):
test_cases=combine_cases(
TestCase(options={'-no_show': None,
**MONITORS,
'-i': DataPatternArg('gaze-estimation-adas')}),
'-i': DataPatternArg('video.mp4')}),
TestCase(options={
'-m': ModelArg('gaze-estimation-adas-0002'),
'-m_hp': ModelArg('head-pose-estimation-adas-0001'),
Expand Down
10 changes: 8 additions & 2 deletions demos/tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,21 @@

from pathlib import Path
from io import BytesIO
from urllib.request import urlopen
import urllib.request
from zipfile import ZipFile

from args import ArgContext, Arg, ModelArg
from cases import Demo
from data_sequences import DATA_SEQUENCES

import shutil

scopes = {
'base': importlib.import_module('cases').DEMOS,
'performance': importlib.import_module('performance_cases').DEMOS,
}
COCO128_URL = "https://ultralytics.com/assets/coco128.zip"
VIDEO_URL = "https://github.com/intel-iot-devkit/sample-videos/raw/master/face-demographics-walking.mp4"


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

fullfilename = os.path.join(args.test_data_dir, "video.mp4")
urllib.request.urlopen(VIDEO_URL, fullfilename)

with temp_dir_as_path() as global_temp_dir:
if args.models_dir:
dl_dir = args.models_dir
Expand Down

0 comments on commit e8a710d

Please sign in to comment.