Setting up Google Coral USB accelerator on Raspberry Pi 4 for Donkey Car

Image for post
Image for post

1. Make sure you have a steady power supply

vcgencmd version; vcgencmd get_throttled; vcgencmd measure_volts; vcgencmd measure_temp;vcgencmd measure_clock arm;

2. Take care of system cooling

3. Install Edgetpu library

edgetpu_api/install.sh: line 51: warning: command substitution: ignored null byte in input
Your platform is not supported.
elif [[ "${MODEL}" == "Raspberry Pi 4 Model B Rev"* ]]; then
info "Recognized as Raspberry Pi 4B."
LIBEDGETPU_SUFFIX=arm32
HOST_GNU_TYPE=arm-linux-gnueabihf
fi
ModuleNotFoundError: No module named '_edgetpu_cpp_wrapper'
cd /usr/local/lib/python3.7/dist-packages/edgetpu/swig
sudo cp _edgetpu_cpp_wrapper.cpython-35m-arm-linux-gnueabihf.so _edgetpu_cpp_wrapper.cpython-37m-arm-linux-gnueabihf.so

4. Run a demo

cd /usr/local/lib/python3.7/dist-packages/edgetpu/demopython3 classify_image.py \
--model ~/Downloads/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
--label ~/Downloads/inat_bird_labels.txt \
--image ~/Downloads/parrot.jpg

5. Install the EdgeTPU in your virtual env

# The virtual environment is called env in donkey car
cd ~/env/lib/python3.7/site-packages
ln -s /usr/local/lib/python3.7/dist-packages/edgetpu .
ln -s /usr/local/lib/python3.7/dist-packages/edgetpu-2.11.1.dist-info .
cd ~/anaconda3/envs/<your_env>/lib/python3.7/site-packagesln -s /usr/local/lib/python3.7/dist-packages/edgetpu .
ln -s /usr/local/lib/python3.7/dist-packages/edgetpu-2.11.1.dist-info .

Love Self-driving technology and machine learning. Community leader in DIYRobocar Hong Kong.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store