cONNXr icon indicating copy to clipboard operation
cONNXr copied to clipboard

tiny yolov2 doesn't work on raspberry pi zero

Open iamfaith opened this issue 5 years ago • 9 comments

pi@raspberrypi:~/cONNXr-master $ build/connxr test/tiny_yolov2/Model.onnx test/tiny_yolov2/test_data_set_0/input_0.pb Loading model test/tiny_yolov2/Model.onnx...ok! Loading input test/tiny_yolov2/test_data_set_0/input_0.pb...ok! values = 1 Resolving model... Running inference on Example Model model... Killed

iamfaith avatar Mar 08 '21 11:03 iamfaith

hey ho, thanks for reporting this. could you run

make clean
make TRACE_LEVEL=1 connxr
./build/connxr test/tiny_yolov2/Model.onnx test/tiny_yolov2/test_data_set_0/input_0.pb 2>&1 | tee tiny_yolov2.log

and post the tiny_yolov2.log file ?

nopeslide avatar Mar 08 '21 12:03 nopeslide

pi@raspberrypi:~/cONNXr-master $ ./build/connxr test/tiny_yolov2/Model.onnx test/tiny_yolov2/test_data_set_0/input_0.pb Loading model test/tiny_yolov2/Model.onnx...[ENTRY 1] src/utils.c:144 entering function openOnnxFile [TRACE 1] src/utils.c:161 length of file is 63480982 [EXIT 1] src/utils.c:165 exiting function openOnnxFile ok! Loading input test/tiny_yolov2/test_data_set_0/input_0.pb...[ENTRY 1] src/utils.c:170 entering function openTensorProtoFile [TRACE 1] src/utils.c:173 Opening .pb file test/tiny_yolov2/test_data_set_0/input_0.pb [TRACE 1] src/utils.c:189 length of file 2076688 [EXIT 1] src/utils.c:193 exiting function openTensorProtoFile ok! [ENTRY 1] src/utils.c:203 entering function convertRawDataOfTensorProto [TRACE 1] src/utils.c:218 Tensor has raw data. Unserializing it [TRACE 1] src/utils.c:219 Tensor type = 1 [EXIT 1] src/utils.c:291 exiting function convertRawDataOfTensorProto values = 1 Resolving model... [ENTRY 1] src/inference.c:18 entering function resolve [ENTRY 1] src/utils.c:15 entering function searchTensorProtoByName [TRACE 1] src/utils.c:16 Searching for TensorProto with name=image [TRACE 1] src/utils.c:34 Found TensorProto in inputs to de model with name=image [EXIT 1] src/utils.c:35 exiting function searchTensorProtoByName [ENTRY 1] src/utils.c:15 entering function searchTensorProtoByName [TRACE 1] src/utils.c:16 Searching for TensorProto with name=scalerPreprocessor_scale [TRACE 1] src/utils.c:23 Found TensorProto in initializer list with name=scalerPreprocessor_scale [EXIT 1] src/utils.c:24 exiting function searchTensorProtoByName [ENTRY 1] src/utils.c:353 entering function init_tensor_proto [EXIT 1] src/utils.c:410 exiting function init_tensor_proto [ENTRY 1] src/operators/ai.onnx/Mul/7/prepare_operator__ai_onnx__mul__7.c:11 entering function prepare_operator__ai_onnx__mul__7 [ENTRY 1] src/utils.c:66 entering function searchInputByName [EXIT 1] src/utils.c:90 exiting function searchInputByName [ENTRY 1] src/utils.c:102 entering function searchOutputByName [EXIT 1] src/utils.c:116 exiting function searchOutputByName Killed

iamfaith avatar Mar 09 '21 09:03 iamfaith

thanks! now we know the problem lies in prepare_operator__ai_onnx__mul__7
so please run once again (no need to recompile) and post the log

CONNXR_TRACE_FUNCTION="prepare_operator__ai_onnx__mul__7:9" ./build/connxr test/tiny_yolov2/Model.onnx test/tiny_yolov2/test_data_set_0/input_0.pb

nopeslide avatar Mar 09 '21 10:03 nopeslide

pi@raspberrypi:~/cONNXr-master $ CONNXR_TRACE_FUNCTION="prepare_operator__ai_onnx__mul__7:9" ./build/connxr test/tiny_yolov2/Model.onnx test/tiny_yolov2/test_data_set_0/input_0.pb Loading model test/tiny_yolov2/Model.onnx...[ENTRY 1] src/utils.c:144 entering function openOnnxFile [TRACE 1] src/utils.c:161 length of file is 63480982 [EXIT 1] src/utils.c:165 exiting function openOnnxFile ok! Loading input test/tiny_yolov2/test_data_set_0/input_0.pb...[ENTRY 1] src/utils.c:170 entering function openTensorProtoFile [TRACE 1] src/utils.c:173 Opening .pb file test/tiny_yolov2/test_data_set_0/input_0.pb [TRACE 1] src/utils.c:189 length of file 2076688 [EXIT 1] src/utils.c:193 exiting function openTensorProtoFile ok! [ENTRY 1] src/utils.c:203 entering function convertRawDataOfTensorProto [TRACE 1] src/utils.c:218 Tensor has raw data. Unserializing it [TRACE 1] src/utils.c:219 Tensor type = 1 Killed

iamfaith avatar Mar 09 '21 10:03 iamfaith

wow, not even as far as before :D there seems to be something very basic broken. could you test if this occurs randomly or always at the same point? than try to building it again with TRACE_LEVEL=9 to enable all tracing levels and post the log again.

you could also try to produce a core dump by running ulimit -S -c unlimited and send it over with the connxr binary, than I can at least identify the problem further.

will test this on my raspberry pi 1 (which has the same chipset as the zero). but this will take a moment (days,weeks) on my side. so if you want to debug this, feel free :D

nopeslide avatar Mar 09 '21 14:03 nopeslide

One simple thing this could be is a failing malloc without error handling. There are still quite few in the codebase and tiny yolo is not as tiny as the name suggests :D You could simply run it on another machine and check the ram usage (it runs a few minutes) (I checked and it's almost 200MB)

nopeslide avatar Mar 09 '21 15:03 nopeslide

There are still quite few in the codebase and tiny yolo is not as tiny as the name suggests :D

This was exactly was I was thinking when I read raspberry pi. Tiny yolo is quite big and computation intensive. But really nice that @iamfaith you are trying cONNXr in a RPI. Have you tried the other models we have?

alrevuelta avatar Mar 09 '21 19:03 alrevuelta

I hate this ui x.x

nopeslide avatar Mar 09 '21 20:03 nopeslide

One problem is, that the allocated memory of the tensors is not freed when they are not needed anymore. I had the same problem and added the functionality for freeing the tensors, but the algorithm only works for linear networks.

Coderitter-GmbH avatar Mar 16 '21 13:03 Coderitter-GmbH