Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6392 Discussions

Sizes equal or broadcast is possible(true) should be false. Invalid input shapes

Kizna1ver
Beginner
727 Views

Hello,

I am following the sample  

Direct Consuming of the NV12 VAAPI Video Decoder Surface on Linux  

and try to build a model on the va device used in ffmpeg hardware decoder. But I encounted some error below when calling the function compile_model().

My system infomation:

  • OpenVINO=> 2022.1
  • Operating System / Platform => ubuntu20.04

Part of my codes:


    size_t input_height = 300;
    size_t input_width = 300;

    // initialize the core and load the network
    ov::Core core;
    auto model = core.read_model("/opt/intel/openvino_2022.1.0.643/samples/cpp/hello_remote_blob/public/ssd300/FP32/ssd300.xml");

    printf("Preprocessing...\n");  
    auto p = PrePostProcessor(model);
    p.input().tensor().set_element_type(ov::element::u8)
                    .set_color_format(ov::preprocess::ColorFormat::NV12_TWO_PLANES, {"y", "uv"})
                    .set_memory_type(ov::intel_gpu::memory_type::surface); 
            
    p.input().preprocess()
                    .convert_color(ov::preprocess::ColorFormat::BGR);
    p.input().model().set_layout("NCHW");
    model = p.build();
    printf("Build finished\n");  

    // create the shared context object
    auto shared_va_context = ov::intel_gpu::ocl::VAContext(core, display);
    // compile model within a shared context
    auto compiled_model = core.compile_model(model, shared_va_context);

    printf("Compile model finished\n");  

 The error:

 terminate called after throwing an instance of 'ov::Exception'
what(): Error has occured for: add:data/mean
Sizes equal or broadcast is possible(true) should be false
Invalid input shapes

 part of ssd300.xml file(This file is obtained by omz_downloader and omz_converter):

<layer id="0" name="data" type="Parameter" version="opset1">
			<data shape="1,3,300,300" element_type="f32"/>
			<rt_info>
				<attribute name="fused_names" version="0" value="data"/>
			</rt_info>
			<output>
				<port id="0" precision="FP32" names="data">
					<dim>1</dim>
					<dim>3</dim>
					<dim>300</dim>
					<dim>300</dim>
					<rt_info>
						<attribute name="layout" version="0" layout="[N,C,H,W]"/>
					</rt_info>
				</port>
			</output>
		</layer>
		<layer id="1" name="data/mean_input_port_1/value8827915" type="Const" version="opset1">
			<data element_type="f32" shape="1, 3, 1, 1" offset="0" size="12"/>
			<rt_info>
				<attribute name="fused_names" version="0" value="data/mean_input_port_1/value8827915"/>
			</rt_info>
			<output>
				<port id="0" precision="FP32">
					<dim>1</dim>
					<dim>3</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</output>
		</layer>
		<layer id="2" name="data/mean" type="Add" version="opset1">
			<data auto_broadcast="numpy"/>
			<rt_info>
				<attribute name="fused_names" version="0" value="data/mean"/>
			</rt_info>
			<input>
				<port id="0" precision="FP32">
					<dim>1</dim>
					<dim>3</dim>
					<dim>300</dim>
					<dim>300</dim>
				</port>
				<port id="1" precision="FP32">
					<dim>1</dim>
					<dim>3</dim>
					<dim>1</dim>
					<dim>1</dim>
				</port>
			</input>
			<output>
				<port id="2" precision="FP32">
					<dim>1</dim>
					<dim>3</dim>
					<dim>300</dim>
					<dim>300</dim>
				</port>
			</output>
		</layer>

The XML file seems to correct, I don't know why this error is raised. And my complete code in this repository.

Thanks!

0 Kudos
1 Solution
Peh_Intel
Moderator
560 Views

Hi Kizna1ver,


Sorry for my late response as I still facing challenges in installing FFMPEG with VAAPI support. By the way, it is glad to hear that the error was resolved as per this GitHub discussion.


As for the C API of RemoteBlob, there is no plan yet from our development.



Sincerely,

Peh


View solution in original post

0 Kudos
8 Replies
Peh_Intel
Moderator
690 Views

Hi Kizna1ver,


Thanks for reaching out to us.


By adding the pre-processing step of converting to ‘float’, did the error resolved?

p.input().preprocess()

           .convert_element_type(ov::element::f32)



Regards,

Peh


0 Kudos
Kizna1ver
Beginner
684 Views

Hi Peh_Intel,

 

Thanks for reply,

 

After modified, my code is

    p.input().tensor().set_element_type(ov::element::u8)
                    .set_color_format(ov::preprocess::ColorFormat::NV12_TWO_PLANES, {"y", "uv"})
                    .set_memory_type(ov::intel_gpu::memory_type::surface); 
            
    p.input().preprocess()
                    .convert_element_type(ov::element::f32) 
                    .convert_color(ov::preprocess::ColorFormat::BGR);

But the error still occurs:

terminate called after throwing an instance of 'ov::Exception'
  what():  cldnn program build failed! Error has occured for: convert:Convert_826
No image_nv12 to image_nv12 reorder is supported

Aborted (core dumped)

 

0 Kudos
Peh_Intel
Moderator
665 Views

Hi Kizna1ver,

 

I was not able to reproduce the issue because fail to build the application based on your repository.

config.jpeg

 

Can you share the config.h file that included in the main.cpp?  

 

 

Regards,

Peh

 

0 Kudos
Kizna1ver
Beginner
656 Views

Hi Peh_Intel,

 

Thanks for reply,

 

I push the config.h file to the repository. If you need to build this project, you need to install FFMPEG with VAAPI support first. And I added the complement information in the readme.md file. Thanks!

0 Kudos
Peh_Intel
Moderator
629 Views

Hi Kizna1ver,


Thanks for the updates in building the project.


We are still investigating this issue and will get back to you at the earliest.



Regards,

Peh


0 Kudos
Kizna1ver
Beginner
604 Views

Hi Peh_Intel,

 

Thanks for reply and helping me solve this issue

 

By the way, does openvino community plan to develop C API of RemoteBlob?

0 Kudos
Peh_Intel
Moderator
561 Views

Hi Kizna1ver,


Sorry for my late response as I still facing challenges in installing FFMPEG with VAAPI support. By the way, it is glad to hear that the error was resolved as per this GitHub discussion.


As for the C API of RemoteBlob, there is no plan yet from our development.



Sincerely,

Peh


0 Kudos
Peh_Intel
Moderator
529 Views

Hi Kizna1ver,


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,

Peh


0 Kudos
Reply