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.

Questions About OpenVINO API

Tsin__Ross
New Contributor I
545 Views

Hi ,

I check the OpenVINO sample codes, 

found layer definitions like this,

/**
 * @brief This class represents a standard 3D Convolution Layer
 */
class ConvolutionLayer : public WeightableLayer {
public:
    /**
     * @brief A convolution kernel array [X, Y, Z, ...]
     */
    DEFINE_PROP(_kernel);
    /**
     * @brief A convolution paddings begin array [X, Y, Z, ...]
     */
    DEFINE_PROP(_padding);
    /**
     * @brief A convolution paddings end array [X, Y, Z, ...]
     */
    PropertyVector<unsigned int> _pads_end;
    /**
     * @brief A convolution strides array [X, Y, Z, ...]
     */
    DEFINE_PROP(_stride);
    /**
     * @brief A convolution dilations array [X, Y, Z, ...]
     */
    DEFINE_PROP(_dilation);
    /**
     * @brief A number of output feature maps (size) generating the 3'rd output dimension
     */
    unsigned int _out_depth = 0u;
    /**
     * @brief Number of groups
     */
    unsigned int _group = 1u;
    /**
     * @brief Auto padding type
     */
    std::string _auto_pad;

    /**
     * @brief Creates a new ConvolutionLayer instance.
     */
    explicit ConvolutionLayer(const LayerParams &p) : WeightableLayer(p),
            _kernel(2, 0u), _padding(2, 0u), _stride(2, 1u), _dilation(2, 1u) {}
    /**
     * @brief assignment operator
     */
    ConvolutionLayer & operator = (const ConvolutionLayer & that) {
        if (&that != this) {
            WeightableLayer::operator=(that);
            _kernel = that._kernel;
            _padding = that._padding;
            _pads_end = that._pads_end;
            _stride = that._stride;
            _dilation = that._dilation;
            _out_depth = that._out_depth;
            _group = that._group;
        }
        return *this;
    }
    /**
     * @brief move assignment operator
     */
    ConvolutionLayer& operator = (ConvolutionLayer &&) = default;
    /**
     * @brief copy constructor
     */
    ConvolutionLayer(const ConvolutionLayer & that) : WeightableLayer(that) {
        operator = (that);
    }
    /**
     * @brief move constructor
     */
    ConvolutionLayer(ConvolutionLayer &&) = default;
};

And in the model file .xml,  a ConvolutionLayer is defined as ,

<layer id="1" name="detector/yolo-v3-tiny/Conv/Conv2D" precision="FP32" type="Convolution">
			<data auto_pad="same_upper" dilations="1,1" group="1" kernel="3,3" output="16" pads_begin="1,1" pads_end="1,1" strides="1,1"/>
			<input>
				<port id="0">
					<dim>1</dim>
					<dim>3</dim>
					<dim>416</dim>
					<dim>416</dim>
				</port>
			</input>
			<output>
				<port id="3">
					<dim>1</dim>
					<dim>16</dim>
					<dim>416</dim>
					<dim>416</dim>
				</port>
			</output>
			<blobs>
				<weights offset="0" size="1728"/>
				<biases offset="1728" size="64"/>
			</blobs>
		</layer>

Which means I can convert my own model directly into IR model. However, there are some informations I can't understand,  like pads_begin and pads_end,  could you please give me some more details? Thank you very much.

Something else I am confused is , I see yolo layer definition like 

<layer id="30" name="detector/yolo-v3-tiny/Conv_12/BiasAdd/YoloRegion" precision="FP32" type="RegionYolo">
			<data axis="1" classes="80" coords="4" do_softmax="0" end_axis="3" mask="0,1,2" num="9"/>
			<input>
				<port id="0">
					<dim>1</dim>
					<dim>255</dim>
					<dim>26</dim>
					<dim>26</dim>
				</port>
			</input>
			<output>
				<port id="1">
					<dim>1</dim>
					<dim>255</dim>
					<dim>26</dim>
					<dim>26</dim>
				</port>
			</output>
		</layer>

but no corresponding layer in ie_layers.h.

I created my own tiny DNN framework RQNet and really want to deploy models on NCS2.  Your guidance is very appreciated.


Regards,

Ross

 

 

 

0 Kudos
7 Replies
Shubha_R_Intel
Employee
545 Views

Dearest Ross:

I hope this document explains it for you:

https://software.intel.com/en-us/articles/OpenVINO-ModelOptimizer

On the left side, find Intermediate Representation Notation Reference Catalog then Pad Layer.

Thanks for using OpenVino !

Shubha

0 Kudos
Tsin__Ross
New Contributor I
545 Views

That explains a lot, very detailed. Thank you very much.

Will create a thread to show how to it if I can successfully translate my model into IR model.

 

Shubha R. (Intel) wrote:

Dearest Ross:

I hope this document explains it for you:

https://software.intel.com/en-us/articles/OpenVINO-ModelOptimizer

On the left side, find Intermediate Representation Notation Reference Catalog then Pad Layer.

Thanks for using OpenVino !

Shubha

0 Kudos
Shubha_R_Intel
Employee
545 Views

Dearest Ross, 

here is the preferred doc location but it should be similar to what I posted above:

https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_IRLayersCatalogSpec.html

It is preferred because OpenVino docs have moved to the https://docs.openvinotoolkit.org/ site. It takes a little while to get used to but if you're patient (:)) you can find everything you need.

Shubha

0 Kudos
Tsin__Ross
New Contributor I
545 Views

Wonderful, Shubha!

Shubha R. (Intel) wrote:

Dearest Ross, 

here is the preferred doc location but it should be similar to what I posted above:

https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_IRLayersCatalogSpec.html

It is preferred because OpenVino docs have moved to the https://docs.openvinotoolkit.org/ site. It takes a little while to get used to but if you're patient (:)) you can find everything you need.

Shubha

0 Kudos
Tsin__Ross
New Contributor I
545 Views

Hi Shubha,

Is the "bias" field a mandatory field in Convolution layer?

 

Shubha R. (Intel) wrote:

Dearest Ross, 

here is the preferred doc location but it should be similar to what I posted above:

https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_IRLayersCatalogSpec.html

It is preferred because OpenVino docs have moved to the https://docs.openvinotoolkit.org/ site. It takes a little while to get used to but if you're patient (:)) you can find everything you need.

Shubha

0 Kudos
Tsin__Ross
New Contributor I
545 Views

Another question,

from the page of 

https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_IRLayersCatalogSpec.html#BatchNormalization

,  I can not see any instruction how to use my gamma and beta been trained in the layer.

Shubha R. (Intel) wrote:

Dearest Ross, 

here is the preferred doc location but it should be similar to what I posted above:

https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_IRLayersCatalogSpec.html

It is preferred because OpenVino docs have moved to the https://docs.openvinotoolkit.org/ site. It takes a little while to get used to but if you're patient (:)) you can find everything you need.

Shubha

0 Kudos
Tsin__Ross
New Contributor I
545 Views

Hope this is right.

 

0 Kudos
Reply