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.
6404 Discussions

Extracting a feature map of Convolution layer by inputing differebt image size

timosy
New Contributor I
791 Views

I'd like to extract feature map from Convolution layer by inputting
larg

Labels (2)
0 Kudos
1 Solution
IntelSupport
Community Manager
745 Views

Hi hep77to,

 

Thanks for reaching out.

 

OpenVINO™ provides capabilities to change model input shape during the runtime. You can set a new input shape with the reshape method. Refer to Changing input shapes for the details. The reshape method is useful in case you would like to feed model an input that has different size than model input shape.

 

Apart from that, the Hello Reshape SSD C++ Sample demonstrates how to do synchronous inference of object detection models using input reshape feature. Below is the reshape method used in the sample:


/ Step 5. Reshape model to image size and batch size

       // assume model layout NCHW

       const ov::Layout model_layout{"NCHW"};

 

       ov::Shape tensor_shape = model->input().get_shape();

 

       size_t batch_size = 1;

 

       tensor_shape[ov::layout::batch_idx(model_layout)] = batch_size;

       tensor_shape[ov::layout::channels_idx(model_layout)] = image_channels;

       tensor_shape[ov::layout::height_idx(model_layout)] = image_height;

       tensor_shape[ov::layout::width_idx(model_layout)] = image_width;

 

       std::cout << "Reshape network to the image size = [" << image_height << "x" << image_width << "] " << std::endl;

       model->reshape({{model->input().get_any_name(), tensor_shape}});

       printInputAndOutputsInfo(*model);

 

Hope this helps.

 

 

Regards,

Aznie


View solution in original post

0 Kudos
3 Replies
IntelSupport
Community Manager
746 Views

Hi hep77to,

 

Thanks for reaching out.

 

OpenVINO™ provides capabilities to change model input shape during the runtime. You can set a new input shape with the reshape method. Refer to Changing input shapes for the details. The reshape method is useful in case you would like to feed model an input that has different size than model input shape.

 

Apart from that, the Hello Reshape SSD C++ Sample demonstrates how to do synchronous inference of object detection models using input reshape feature. Below is the reshape method used in the sample:


/ Step 5. Reshape model to image size and batch size

       // assume model layout NCHW

       const ov::Layout model_layout{"NCHW"};

 

       ov::Shape tensor_shape = model->input().get_shape();

 

       size_t batch_size = 1;

 

       tensor_shape[ov::layout::batch_idx(model_layout)] = batch_size;

       tensor_shape[ov::layout::channels_idx(model_layout)] = image_channels;

       tensor_shape[ov::layout::height_idx(model_layout)] = image_height;

       tensor_shape[ov::layout::width_idx(model_layout)] = image_width;

 

       std::cout << "Reshape network to the image size = [" << image_height << "x" << image_width << "] " << std::endl;

       model->reshape({{model->input().get_any_name(), tensor_shape}});

       printInputAndOutputsInfo(*model);

 

Hope this helps.

 

 

Regards,

Aznie


0 Kudos
timosy
New Contributor I
737 Views

Dear

Community Manager
 
 
 
 
 

 

Nice infoamtion!

Thanks a lot.

0 Kudos
IntelSupport
Community Manager
723 Views

Hi hep77to,


This thread will no longer be monitored since this we have provided the information. If you need any additional information from Intel, please submit a new question.



Regards,

Aznie


0 Kudos
Reply