diff --git a/tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py b/tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py index cc7f53bbb45..8d0d2bcae07 100644 --- a/tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py +++ b/tools/benchmark_tool/openvino/tools/benchmark/utils/inputs_filling.py @@ -168,7 +168,12 @@ def get_image_tensors(image_paths, info, batch_sizes): red = np.divide(red, info.scale[2]) image = cv2.merge([blue, green, red]) - if str(info.layout) in ['[N,C,H,W]', '[C,H,W]']: + model_channel = int(str(info.channels)) + image_channel = image.shape[-1] + if model_channel == 1 and image_channel == 3: + image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) + + if model_channel == image_channel and str(info.layout) in ['[N,C,H,W]', '[C,H,W]']: image = image.transpose((2, 0, 1)) if process_with_original_shapes: