Function Testing

Basic function testing

The Basic function testing use the network model(minist) and data include in the installation package for Neural Network inference, the test results will be output to the out subdirectory of the current directory, please make sure that the user has the write rights to the current directory.

$ source /opt/bmtap2/bm1880-<Mode>-x.y.z /test/test_bmnet.sh
$ mkdir out
$ run_test_bmnet_bm1880

Test test results are as follow:

$ run_test_bmnet_bm1880
begin to test net:mnist mnist <4,1,28,28>,epsilon:0.00001
<CMD>test_bmnet_bmodel /opt/bmtap2/bm1880-pcie_1.0.1/test/mnist/mnist_input_4_1_28_28.bin /opt/bmtap2/bm1880-pcie_1.0.1/test/mnist/mnist_4_1_28_28.bmodel out//mnist_output.bin 4 1 28 28 0.00001
input size:12544
WARRING:Logging before InitgoogleLogging()is written to STDERR
# run_test_bmnet_bm1880
begin to test net: mtcnn det1 <1,3,12,12>
<CMD> test_bmnet_bmodel /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mtcnn/det1_input_1_3_12_12.bin /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mtcnn/det1_1_3_12_12.bmodel out//det1_output.bin 1 3 12 12
input size: 432
WARNING: Logging before InitGoogleLogging() is written to STDERR
I1026 19:41:03.865362 2635 bm_firmware.cpp:76] check firmware status ...
I1026 19:41:03.865628 2635 bm_firmware.cpp:82] firmware loading ...
I1026 19:41:03.929674 2635 bm_firmware.cpp:47] firmware load success
I1026 19:41:08.937716 2635 bm_firmware.cpp:98] firmware is running
I1026 19:41:08.937757 2635 bm_device.cpp:104] device[0] opened,gmem_size : 0x40000000
output size:6
outputs[0]: [1,4,1,1], "conv4-2"
outputs[1]: [1,2,1,1], "conv4-1"
test_bmnet_bmodel: load 107 us, run 106 us, read 76 us
('/opt/bmtap2/bm1880-usb_1.0.1/test/../models/mtcnn/det1_output_1_3_12_12_ref.bin', ' vs. ', 'out//det1_output.bin')
Result matched @ epsilon = 0.000000
det1<1,3,12,12> passed
begin to test net: mobilenet mobilenet <1,3,224,224>
<CMD> test_bmnet_bmodel /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mobilenet/mobilenet_input_1_3_224_224.bin /opt/bmtap2/bm1880-usb_1.0.1/test/../models/mobilenet/mobilenet_1_3_224_224.bmodel out//mobilenet_output.bin 1 3 224 224
input size: 150528
WARNING: Logging before InitGoogleLogging() is written to STDERR
I1026 19:41:09.092887 2662 bm_firmware.cpp:76] check firmware status ...
I1026 19:41:09.093133 2662 bm_firmware.cpp:85] firmware is running
I1026 19:41:09.093152 2662 bm_device.cpp:104] device[0] opened,gmem_size : 0x40000000
output size:1000
outputs[0]: [1,1000,1,1], "fc7"
test_bmnet_bmodel: load 3773 us, run 2820 us, read 222 us
('/opt/bmtap2/bm1880-usb_1.0.1/test/../models/mobilenet/mobilenet_output_1_3_224_224_ref.bin', ' vs. ', 'out//mobilenet_output.bin')
Result matched @ epsilon = 0.000000
mobilenet<1,3,224,224> passed
test_bmnet_bm1880 success

Python API testing

BMNNSDK provide Python Wrapper,and you can use the python interface for deeplearning application development:

// bmnet inference test
$ python /opt/bmtap2/bm1880-<MODE>_x.y.z/python/test/test_mobilenet.py

The testing results are as follows:

# python /opt/bmtap2/bm1880-usb_1.0.1/python/test/test_mobilenet.py
WARNING: Logging before InitGoogleLogging() is written to STDERR
I1103 11:35:07.977723 21141 bm_firmware.cpp:76] check firmware status ...
I1103 11:35:07.977876 21141 bm_firmware.cpp:85] firmware is running
I1103 11:35:07.977897 21141 bm_device.cpp:104] device[0] opened,gmem_size : 0x40000000
input size 150528
output size 1000