37 self.
_type = kwargs.pop(
'type',
None)
38 if self.
_type is None:
40 print(
'Benchmark[\'type\'] is omitted, set to \'Base\' by default.')
43 assert self.
_data_dict,
'Benchmark[\'data\'] cannot be empty and must have path and files.'
50 assert self.
_metric_dict,
'Benchmark[\'metric\'] cannot be empty.'
56 backend_id = kwargs.pop(
'backend',
'default')
57 available_backends = dict(
58 default=cv.dnn.DNN_BACKEND_DEFAULT,
61 opencv=cv.dnn.DNN_BACKEND_OPENCV,
63 cuda=cv.dnn.DNN_BACKEND_CUDA,
66 target_id = kwargs.pop(
'target',
'cpu')
67 available_targets = dict(
68 cpu=cv.dnn.DNN_TARGET_CPU,
74 cuda=cv.dnn.DNN_TARGET_CUDA,
75 cuda_fp16=cv.dnn.DNN_TARGET_CUDA_FP16,
81 available_backends[
'timvx'] = cv.dnn.DNN_BACKEND_TIMVX
82 available_targets[
'npu'] = cv.dnn.DNN_TARGET_NPU
84 print(
'OpenCV is not compiled with TIM-VX backend enbaled. See https://github.com/opencv/opencv/wiki/TIM-VX-Backend-For-Running-OpenCV-On-NPU for more details on how to enable TIM-VX backend.')
87 self.
_target = available_targets[target_id]
96 filename, input_data = data[:2]
99 if isinstance(input_data, np.ndarray):
100 size = [input_data.shape[1], input_data.shape[0]]
102 size = input_data.getFrameSize()