Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tiny yolov2 doesn't work on raspberry pi zero #89

Open
iamfaith opened this issue Mar 8, 2021 · 9 comments
Open

tiny yolov2 doesn't work on raspberry pi zero #89

iamfaith opened this issue Mar 8, 2021 · 9 comments

Comments

@iamfaith
Copy link

iamfaith commented Mar 8, 2021

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

@nopeslide
Copy link
Collaborator

nopeslide commented Mar 8, 2021

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 ?

@iamfaith
Copy link
Author

iamfaith commented Mar 9, 2021

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

@nopeslide
Copy link
Collaborator

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

@iamfaith
Copy link
Author

iamfaith commented Mar 9, 2021

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

@nopeslide
Copy link
Collaborator

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
Copy link
Collaborator

nopeslide commented Mar 9, 2021

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)

@alrevuelta
Copy link
Owner

alrevuelta commented Mar 9, 2021

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?

@nopeslide
Copy link
Collaborator

I hate this ui x.x

@nopeslide nopeslide reopened this Mar 9, 2021
@Coderitter-GmbH
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants