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

Batch Normalization Information does not exist in OpenVINO model

Tsin__Ross
New Contributor I
546 Views

Hi, 

I want to deploy my yolov3 model to NCS2,  and I check the OpenVINO model,do not see any batch normalization information,

for example, in the file yolov3-tiny.cfg, the first layer is defined as :

[convolutional]
batch_normalize=1
filters=16
size=3
stride=1
pad=1
activation=leaky

However, in the yolov3-tiny.xml generated by MO, it is represented as 

<layer id="1" name="detector/yolo-v3-tiny/Conv/Conv2D" precision="FP16" 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="864"/>
				<biases offset="864" size="32"/>
			</blobs>
		</layer>
		<layer id="2" name="LeakyReLU_861" precision="FP16" type="ReLU">
			<data negative_slope="0.10000000149011612"/>
			<input>
				<port id="0">
					<dim>1</dim>
					<dim>16</dim>
					<dim>416</dim>
					<dim>416</dim>
				</port>
			</input>
			<output>
				<port id="1">
					<dim>1</dim>
					<dim>16</dim>
					<dim>416</dim>
					<dim>416</dim>
				</port>
			</output>
		</layer>

My understanding is, without batch normalization, the OpenVINO model is different from the original one, which leads to a different result, right?

0 Kudos
2 Replies
Severine_H_Intel
Employee
546 Views

Dear Ross, 

OpenVINO is not a one-to-one mapping to the original model. We perform optimizations on the layers in order to make the model smaller. In particular, batch norm operations are merged to the convolution before. 

Best, 

Severine

0 Kudos
Tsin__Ross
New Contributor I
546 Views

Thank you very much Habert.

 

As you've mentioned, "OpenVINO is not a one-to-one mapping to the original model." In my YoloV3 Tiny model, batchnorm parameters have been trained and stored, and I think they should be very important as part of the model. If Removed in IR model, how to keep the same accuracy in IR model compared to my original model?

 

Looking forward to your response and help.

 

I try to bring NCS2 into real use scenario.  My first attempt is to plug one into RaspberryPi 3B+ as a companion computer of my drone. 

I have been a C++ developer for more than 15 years, but not very familiar with google TensorFlow.

If there is a way to convert the yolov3.weghts file to .xml and .bin files, that will be much easier.

 picture 

Habert, Severine (Intel) wrote:

Dear Ross, 

OpenVINO is not a one-to-one mapping to the original model. We perform optimizations on the layers in order to make the model smaller. In particular, batch norm operations are merged to the convolution before. 

Best, 

Severine

0 Kudos
Reply