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
349 Views

I'd like to extract feature map from Convolution layer by inputting
larger or smaller image size which is different size when a model was trained.

 

segmentation_model = ie.read_model(model=inmodel)
segmentation_input_layer = next(iter(segmentation_model.inputs))
segmentation_output_layer = next(iter(segmentation_model.outputs))

print("~~~~ ORIGINAL MODEL ~~~~")
print(f"input shape: {segmentation_input_layer.shape}")
print(f"output shape: {segmentation_output_layer.shape}")
new_shape = PartialShape([1, 3, 448, 448])
segmentation_model.reshape({segmentation_input_layer.any_name: new_shape})
segmentation_compiled_model = ie.compile_model(model=segmentation_model, device_name="CPU")
# help(segmentation_compiled_model)
print("~~~~ RESHAPED MODEL ~~~~")
print(f"model input shape: {segmentation_input_layer.shape}")
print(
f"compiled_model input shape: "
f"{segmentation_compiled_model.input(index=0).shape}"
)
print(f"compiled_model output shape: {segmentation_output_layer.shape}")

 

I can reshape using ResNet50
But, I can't using AlexNet. I got following message...

segmentation_model.reshape({segmentation_input_layer.any_name: new_shape})
RuntimeError: Check 'input_dim.get_length() % output_dim.get_length() == 0' failed at core/src/op/reshape.cpp:338:While validating node 'v1::Reshape 31 (30[0]:f32{1,256,13,13}, Constant_266[0]:i64{2}) -> (f32{?,?})' with friendly_name '31':
Non-'-1' output dimensions do not evenly divide the input dimensions
~

While validating node 'v1::Reshape 31 (30[0]:f32{1,256,8,8}, Constant_266[0]:i64{2}) -> (f32{?,?})' with friendly_name '31':
Non-'-1' output dimensions do not evenly divide the input dimensions

Labels (2)
0 Kudos
0 Replies
Reply