Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.
6066 Discussions

DL Workbench inference with single channel Network

niclas1992
Beginner
563 Views

Hello,

 

I try to run my single channel object detection model on the DL Workbench. For this I uploaded single channel jpg images. However. the backend part of the DL Workbench seems to recognize or load it as 3 channel input, because when I try to infer the model with the uploaded input data, I get the following Inference error:

 

 

[ ERROR ] Image shape (3, 192, 608) is not compatible with input shape [1, 1, 192, 608]! Make sure -i parameter is valid.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/openvino/tools/benchmark/utils/inputs_filling.py", line 186, in get_image_tensors
images[b] = image
ValueError: could not broadcast input array from shape (3,192,608) into shape (1,192,608)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/openvino/tools/benchmark/main.py", line 375, in run
data_queue = get_input_data(paths_to_input, app_inputs_info)
File "/usr/local/lib/python3.8/dist-packages/openvino/tools/benchmark/utils/inputs_filling.py", line 113, in get_input_data
data[port] = get_image_tensors(image_mapping[info.name][:images_to_be_used_map[info.name]], info, batch_sizes_map[info.name])
File "/usr/local/lib/python3.8/dist-packages/openvino/tools/benchmark/utils/inputs_filling.py", line 188, in get_image_tensors
raise Exception(f"Image shape {image.shape} is not compatible with input shape {shape}! "
Exception: Image shape (3, 192, 608) is not compatible with input shape [1, 1, 192, 608]! Make sure -i parameter is valid.

 

I have made sure I saved the images as single channel images by converting them with openCV to grayscale. Attached I send you the corresponding server_log and a sample image of thos that I used.

 

Best Regards
Niclas

0 Kudos
3 Replies
Hairul_Intel
Moderator
512 Views

Hi Niclas,

Thank you for reaching out to us.

 

We have replicated this issue using a single channel model (text-recognition-0012) with single channel .jpg images (grayscale) and we are also observing same errors as yours.

 

We are investigating this issue further and will update you at the earliest.

 

 

Regards,

Hairul


Hairul_Intel
Moderator
471 Views

Hi Niclas,

Apologies for the delayed response.

 

I've tested further using grayscale images with text-recognition-0012 and found an issue with OpenCV cv.imread() function. From my findings, a grayscale image will be read as a 3-chanelled image when using a default flag for cv.imread() function in /usr/local/lib/python3.8/dist-packages/openvino/tools/benchmark/utils/inputs_filling.py.

 

I've attempted a possible workaround by editing the cv.imread() function to use "-1" flag where OpenCV will retain the image shape so that it would not be read as a 3-chanelled image.

 

However, after changing the cv.imread(image) to cv.imread(image, -1) a different error occurs.

 

Original error when using cv.imread(image):

[ ERROR ] Image shape (32, 120, 3) is not compatible with input shape [1, 32, 120, 1]!

ValueError: could not broadcast input array from shape (32,120,3) into shape (32,120,1)

 

New error when using cv.imread(image, -1):

[ ERROR ] Image shape (32, 120) is not compatible with input shape [1, 32, 120, 1]!

ValueError: could not broadcast input array from shape (32,120) into shape (32,120,1)

 

 

Could you please provide the following information for further troubleshooting:

  1. How did you install OpenVINO™ Deep Learning Workbench (DL Workbench)?
  2. The DL Workbench version that you are using.
  3. Please share your single channel object detection model that you are running on DL Workbench.

 

 

Regards,

Hairul


Hairul_Intel
Moderator
220 Views

Hi Niclas,

Thank you for your question. If you need any additional information from Intel, please submit a new question as this thread is no longer being monitored.

 

 

Regards

Hairul


Reply