google-coral / project-bodypix

BodyPix model demo application for Google Coral
Apache License 2.0
275 stars 52 forks source link

OSX Installation with the USB Accelerator #15

Closed crecord closed 3 years ago

crecord commented 3 years ago

Hi There,

Thanks for the code, excited to get some realtime local segmentation up and running.

I have been struggling to get this compiling in osx (10.15.7) with python 3.7 with the Coral Usb Accelerator. The instructions in this post have been helpful, but haven't taken me all the way. Here is the script I ended up using

Note I had to use python 3.7 because (as of writing this) the script relies on the depreciated edgeTpu api which only supports up to 3.7.

echo "Installing DevBoard specific dependencies"
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda
#can use the following to set the python version - 'conda install python=3.7.7'
#needed to reinstall tflite runtime and the pycoral api again after installing conda 
pip3 install https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-macosx_10_15_x86_64.whl
pip3 install https://dl.google.com/coral/edgetpu_api/edgetpu-2.14.0-cp37-cp37m-macosx_10_14_x86_64.whl
pip3 install scipy
pip3 install pygobject
conda install -c pkgw-forge gtk3
sudo pip3 install svgwrite
sudo pip3 install python-periphery 
brew install gst-python

This got me past many errors, but I am now stuck on the following.

Model: models/bodypix_mobilenet_v1_075_640_480_16_quant_edgetpu_decoder.tflite
Traceback (most recent call last):
  File "bodypix.py", line 180, in <module>
    main()
  File "bodypix.py", line 161, in main
    engine = PoseEngine(model)
  File "/Users/rafael/Documents/antimodular/googleCoral/project-bodypix-master/pose_engine.py", line 133, in __init__
    BasicEngine.__init__(self, model_path)
  File "/opt/miniconda3/lib/python3.7/site-packages/edgetpu/basic/basic_engine.py", line 92, in __init__
    self._engine = BasicEnginePythonWrapper.CreateFromFile(model_path)
RuntimeError: Internal: Unsupported data type in custom op handler: 0Node number 0 (edgetpu-custom-op) failed to prepare.
Failed to allocate tensors.

I tried running this with all the available models and got the same result. Which lead me to this discussion , but I have yet to find a solution.

Should I switch to Linux for a better result? Is this example compatible with the usb accelerator? or is it necessary to use the Dev board?

manoj7410 commented 3 years ago

@crecord hello, can you try to register the posenet_decoder.so like how it is being done at: https://github.com/google-coral/project-posenet/blob/ugrade-to-frogfish/pose_engine.py#L79-L83 ?

manoj7410 commented 3 years ago

Closing this due to lack of activity. Feel free to reopen if this is still reproducible.