Project: Low Powered Models for disease detection and classification for Radiology Images

List of issues faced during emulating Raspberry Pi on Qemu to run inference -

  1. Image size - Once any image is downloaded, it needs to be increased in size to accommodate Tensorflow and other packages required to run inference (cv2, numpy, argparse, tensorflow-model-optimization). This can be done without docker using fdisk, resize2fs, losetup, etc (on the host as well as guest machine). When it comes to containerizing it, a bash script needs to be written to automate this. This will be difficult to customize as we also need to feed the starting address of partitions output during fdisk.

  2. Providing network access - When providing network access to Pi on an emulator, we need to build a virtual interface on a network bridge. Again putting this in a dockerfile would need help.

  3. Tensorflow installation -

a. Memory error or grpcio installation error (resolved) -

This error can be resolved using combination of - upgrading setuptools, using python3 -m prefix before pip commands, using --no-cache-dir in installation commands or using a virtual environment. Any combination of the 4 have chances of working. Applies to both Raspbian-stretch and Raspbian-buster.

b. Tensorflow installation error -

After resolving the above errors, you will see that tensorflow installs version 1.x and not 2.x. You may explicitly specify it to install 2.x and you will see the following message -

This is because pip is looking for these packages in the given indices.

Solution to this is building the package from source. Exporting the .whl file to the Pi and running pip install. When I tried this, I got …

So I tried using already available .whl files on this github page - https://github.com/lhelontra/tensorflow-on-arm/releases And the result was -

This result was obtained on Raspbian Stretch as well as Raspbian Buster. Currently there is full support for tf1.x but the pretrained models cannot be downgraded to this version.

Link to my ppt - Click here

1 Like