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

EdgeTPU models don't work with minimal application #98

Closed
jlz3008 opened this issue Apr 19, 2020 · 3 comments
Closed

EdgeTPU models don't work with minimal application #98

jlz3008 opened this issue Apr 19, 2020 · 3 comments
Labels
build issues with the build system good first issue Good for newcomers

Comments

@jlz3008
Copy link

jlz3008 commented Apr 19, 2020

I made a Pull request to compile minimal example in Dev Board #97 (comment)

But I can't execute it successfully with edgetpu models.

mendel@undefined-dog:~/coral/edgetpu/src/cpp/examples$  LD_LIBRARY_PATH=/home/mendel/coral/edgetpu/libedgetpu/direct/aarch64 ./minimal ~/coral/edgetpu/test_data/mobilenet_v1_1.0_224_quant_edgetpu.tflite ~/coral/edgetpu/test_data/resized_cat.bmp 
ERROR: Internal: Unsupported data type in custom op handler: -610837120
ERROR: Node number 0 (edgetpu-custom-op) failed to prepare.

Failed to allocate tensors.
Segmentation fault

But works with tflite models

LD_LIBRARY_PATH=/home/mendel/coral/edgetpu/libedgetpu/direct/aarch64 ./minimal
 ~/coral/edgetpu/test_data/mobilenet_v1_1.0_224_quant.tflite ~/coral/edgetpu/test_data/resized_cat.bmp
[Image analysis] max value index: 286 value: 0.804688

The models works with python demos

mendel@undefined-dog:~/coral/tflite/python/examples/classification$ LD_LIBRARY_PATH=/home/mendel/coral/edgetpu/libedgetpu/direct/aarch64 python3 classify_image.py --model ~/coral/edgetpu/test_data/mobilenet_v1_1.0_224_quant_edgetpu.tflite --input  ~/coral/edgetpu/test_data/resized_cat.bmp 
----INFERENCE TIME----
Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory.
14.6ms
2.3ms
2.3ms
2.3ms
2.3ms
-------RESULTS--------
286: 0.79297
@Namburger
Copy link

Namburger commented Apr 19, 2020

@jlz3008 Really appreciate the PR and the attention for this repo!!
Unfortunately, our repo right now has some blocking issues to take in PRs due to how it's structured internally. We are working diligently to come up with a solution for PRs which I expected to be working in the future.
On another note, your build seems to be segfault-ing on the dev board, which isn't something we'd need to add. I recently worked on a native build solution to allow this example to be build natively, tested on my laptop, dev board, and my pi4. Please checkout this minimal repo:
https://github.com/Namburger/edgetpu-minimal-example
Let me know if you have issues trying it, here are instructions to build & run on the dev board:

$ git clone https://github.com/Namburger/edgetpu-minimal-example.git && cd edgetpu-minimal-example
$ ./scripts/install_cmake.sh // install cmake if needed
$ ./scripts/make2gbswap.sh //  [Optional] increase swap to avoid OOM killer
$ mkdir build && cd build
$ cmake ..
$ make
$ ../out/aarch64/minimal ../test_data/mobilenet_v1_1.0_224_quant_edgetpu.tflite ../test_data/resized_cat.bmp ../test_data/imagenet_labels.txt
------
Class: tabby, tabby cat
Score: 0.046875
------
Class: tiger cat
Score: 0.109375
------
Class: Siamese cat, Siamese
Score: 0.00390625
------
Class: Egyptian cat
Score: 0.804688
------
Class: doormat, welcome mat
Score: 0.0078125
------
Class: radiator
Score: 0.0078125
------
Class: space heater
Score: 0.0117188

Cheers!

@jlz3008
Copy link
Author

jlz3008 commented Apr 20, 2020

Thanks for your code @Namburger . It works.
I can see that the minimal.cc and model_utils.cc code is almost identical to google-coral/edgetpu repo so I guess the difference is in the tflite and other dependences repos.
I need some time to understand how to the build works in your repo code.

Thanks.

@jlz3008 jlz3008 closed this as completed Apr 20, 2020
@Namburger
Copy link

@jlz3008 no worries, please ask if you have any questions!

@Namburger Namburger added build issues with the build system good first issue Good for newcomers labels May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build issues with the build system good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants