[BENCHAMRK_APP/PYTHON] CV2 module required only when loading images (#13113)
This commit is contained in:
parent
1bb15b1d18
commit
29a15e39da
@ -2,7 +2,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import os
|
||||
import cv2
|
||||
import re
|
||||
import numpy as np
|
||||
from collections import defaultdict
|
||||
@ -127,6 +126,16 @@ def get_input_data(paths_to_input, app_input_info):
|
||||
|
||||
|
||||
def get_image_tensors(image_paths, info, batch_sizes):
|
||||
try:
|
||||
import cv2
|
||||
except ModuleNotFoundError as ex:
|
||||
raise Exception("Loading images requires the opencv-python or opencv-python-headless package. " \
|
||||
"Please install it before continuing or run benchmark without "\
|
||||
"the -i flag to fill vectors with random data.") from ex
|
||||
except ImportError as ex:
|
||||
raise Exception("Failed to import opencv module. Please try to uninstall opencv-python " \
|
||||
"and install opencv-python-headless instead.") from ex
|
||||
|
||||
processed_frames = 0
|
||||
widthes = info.widthes if info.is_dynamic else [info.width]
|
||||
heights = info.heights if info.is_dynamic else [info.height]
|
||||
|
Loading…
Reference in New Issue
Block a user