I am trying to understand your question, are you adding a customer layer to the person-detection-retail-0001 model?
I am looking at the document about adding customer layer but I can't find the code you referred.
If you are asking to port the C++ code to python in general, I think there is a standard way.
I am referring to the object_detection_sample present at "<Path to OpenVINO>\deployment_tools\inference_engine\samples\object_detection_sample", the "Adding DetectionOutput" section in the main.cpp. I want to convert the C++ code for object_detection_sample to Python. When I explored the Python API documentation, I could not get equivalent functions in Python API for the code mentioned earlier.
(ICNNNetwork&)network).getData(FLAGS_bbox_name.c_str() gets me the network information for the '<FLAGS_bbox_name>' layer in the person-detection-retail-0001.xml file.
The input and output functions of the IENetwork class in the Python API give something similar to what I need but not quite -
input_blob = next(iter(net.inputs)) for a net object of IENetwork class in the Python API would give all the input layer names along with the network dimensions for each input layer from the xml file. But how do I get the dimensions for a layer that is not an input or output layer from the xml file using the Python API for OpenVINO.
I can always read the xml file using Python but I wanted to check if there is a provision for doing so using the Python API for OpenVINO just like in the C++ API.
To get data and dimensions of intermediate layers you should add it to outputs by calling
add_outputs() method of IENetwork. Similar things are done in C++ code.
Then you can get the output data of each output layer referring to `outputs` attribute of infer request even before inference was started. The output data represented as numpy ndarray so you can get dimensions from `shape` attribute . Finally the code looks like this (I've skipped network reading, plugin initialization and all other things nor related to the problem)
layer_name = "some_layer_name" net.add_outputs(layer_name) exec_net = plugin.load(net) layer_data = exec_net.requests.outputs[layer name] data_shape = layer_data.shape