It looks like you're new here. If you want to get involved, click one of these buttons!

Sign InIt looks like you're new here. If you want to get involved, click one of these buttons!

I am interested in running stream_infer after training with some new images. In the readme for stream_infer it states that more information can be found for creating the stat.txt file in Movidus Neural Compute Toolkit User's Manual. I cannot find any more information on this. I have figured out that the first set of data is just the mean of all the RGB values of the training data. The second set of 3 values are supposed to be some form of standard deviation for the network. I have not been able to figure out how these values are derived, especially since all three are the same for the stat.txt that comes with the example networks:

0.40787054 0.45752458 0.48109378 (means for RGB values of the input data)

0.00392157 0.00392157 0.00392157 (std dev?)

Thanks to anyone that can help out with this

## Comments

6 Commentssorted by Votes Date Added0Vote UpVote Down@nlannan You are correct. These values are the average RGB values and std dev for the training set of images used for the network.

0Vote UpVote DownThe weird thing is I did not get 0.00392157 as the standard deviation when I calculated it for the training set: ilsvrc12

the three std deviation values are all the same in the stat.txt file included with the example nets:

0.00392157 0.00392157 0.00392157

when I calculated the mean and std dev on the numpy gathered by using convert_mean.py on imagenet_mean.binaryproto I got the same mean values but not the same standard deviation values:

means: 0.40787054 0.45752458 0.48109378

std devs: 0.0264842429796 0.0213271232094 0.0142675012063

to get the standard deviations I hacked convert_mean.py and used:

np.std(out[0]/255)

np.std(out[1]/255)

np.std(out[2]/255)

am I doing something wrong to calculate it?

0Vote UpVote Down@nlannan Some Neural Networks utilize normalization and this could explain why dividing by 255 gets you the right values.

0Vote UpVote DownThe mean values

`0.40787054 0.45752458 0.48109378`

and std deviation values`0.00392157 0.00392157 0.00392157`

appear to be the same in all networks.Note that

`0.00392157 = 1/255`

.Also

`255*[0.40787054 0.45752458 0.48109378]`

gets us to`[104 117 123]`

which match the mean values in BVLC/GoogleNet and SqueezeNet prototxt files.This is then used in the API (

`c_examples/ncs-fullcheck.c`

) as followsand then

so essentially, std deviation is not being used, as it leads to a multiply by 1 when it is used to transform the image data. Also, image data range of 0-255 is being assumed (quite reasonably, as this is the most common use case).

It looks like std dev has been included for future proofing (in cases where the image data does not range from 0-255, this may be useful, but it will require a change to the API examples and adding a third line for range of input values in stats.txt).

0Vote UpVote Down@pashmina.bendale You are correct in regards to the std_dev not being factored into ncs-fullcheck.c. Thank you for clarification .

0Vote UpVote DownThat makes sense now. Thank you very much to you both.