{"id":18801767,"url":"https://github.com/cloudwiser/tensorflowliterpizerotpu","last_synced_at":"2026-01-04T16:30:17.561Z","repository":{"id":83242619,"uuid":"222305297","full_name":"cloudwiser/TensorFlowLiteRPIZeroTPU","owner":"cloudwiser","description":"TensorFlow Lite \u0026 Coral TPU: C++ examples on Raspberry Pi Zero W","archived":false,"fork":false,"pushed_at":"2021-01-07T17:22:39.000Z","size":44,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-29T19:58:05.656Z","etag":null,"topics":["armv6","google-coral","raspberry-pi-zero-w","tensorflow-examples","tensorflow-lite","tpu"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudwiser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-17T20:08:55.000Z","updated_at":"2024-04-05T07:33:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"1242a868-bec9-4a0c-bb33-2febe0ae6c59","html_url":"https://github.com/cloudwiser/TensorFlowLiteRPIZeroTPU","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwiser%2FTensorFlowLiteRPIZeroTPU","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwiser%2FTensorFlowLiteRPIZeroTPU/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwiser%2FTensorFlowLiteRPIZeroTPU/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudwiser%2FTensorFlowLiteRPIZeroTPU/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudwiser","download_url":"https://codeload.github.com/cloudwiser/TensorFlowLiteRPIZeroTPU/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239734604,"owners_count":19688257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["armv6","google-coral","raspberry-pi-zero-w","tensorflow-examples","tensorflow-lite","tpu"],"created_at":"2024-11-07T22:25:10.701Z","updated_at":"2026-01-04T16:30:15.494Z","avatar_url":"https://github.com/cloudwiser.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg  align=\"left\"  width=\"120\"  height=\"120\"  src=\"https://avatars0.githubusercontent.com/u/15658638?s=200\u0026v=4\"\u003e\n\u003cimg  align=\"centre\"  width=\"323\"  height=\"100\"  src=\"./coral-logo.png\"\u003e\n\n### TensorFlow Lite \u0026 Coral TPU: C++ examples on Raspberry Pi Zero W\n\nThis guide outlines the steps to get the `minimal` C++ example provided in the Google Coral TPU `edgetpu` distro running on the Raspberry Pi Zero W\n\nIf you want to just get up-and-running with the Python examples then Google provide an SD image for the Raspberry Pi Zero W at https://github.com/google-coral/edgetpu-platforms/releases/tag/v1.9.2 \nNote that the manual install fails currently due to the wrong version of `libedgetpu.so.1.0` being installed in `/usr/lib/arm-linux-gnueabihf` - see later for how to fix this.\n\nIf you want to run the C++ sample and the associated build process, read on!\n\nFirst of all, you'll need to purchase a Coral TPU USB stick from https://coral.withgoogle.com/products/\n\nYou will also need a USB-to-micro-USB adapter if you intend to use the cable provided with Coral TPU adapter to connect to the RPi Zero USB port (the one nearest the SD card). I decided to skip the adapter and purchase a suitable USB-C-to-micro-USB e.g. https://smile.amazon.co.uk/gp/product/B01LONQ7R6\n\nI haven't checked the power consumptiom of the Coral TPU plus RPi Zero W but please check that your micro-USB power source can drive both devices\n\nOnce you plug-in the TPU adapter, the white LED should illuminate. You should now check that it is recognised as a USB device via...\n\n```sh\npi@raspberrypi: \u003cpath\u003e $ lsusb\nBus 001 Device 003: ID 18d1:9302 Google Inc.\nBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\n```\n\nNote that if the (Google) device doesn't appear, check you are not running other USB drivers e.g. a ssh connection from your client to your RPi Zero W via USB. If you are, remove your SD and edit the image to reverse any changes in `cmdline.txt` and `config.txt` files to disable these drivers (see https://desertbot.io/blog/ssh-into-pi-zero-over-usb)\n\nNext you need to build the `lib_tensorflow-lite.a` in `\u003cpath_to\u003e/tensorflow/tensorflow/lite/tools/make/gen/rpi_armv6/lib`. I have a repo that outlines this process (warning: it takes time if you are native compiling on the RPi Zero W) at https://github.com/cloudwiser/TensorFlowLiteRPIZero\n\nWith this complete and working on the non-TPU samples, proceed with the `edgetpu` runtime install as per step #1 at https://coral.withgoogle.com/docs/accelerator/get-started/#1-install-the-edge-tpu-runtime\n\nAlso, ensure you have the the required external dependencies via...\n```sh\n$ \u003cpath_to\u003e/tensorflow/tensorflow/lite/tools/make/download_dependencies.sh\n```\n\nFWIW, I installed the runtime package under `~/tensorflow/edgetpu`...so if you hit build problems, it maybe down to path dependencies\n\nNote I didn't proceed any further through the Getting Started section as this is focussed on running the python samples and (at the time of writing) there was no python wheel for armv6 at https://www.tensorflow.org/lite/guide/python\n\nNow for a tweak to `/usr/lib`...as the `edgetpu` runtime places `libedgetpu.so.1.0` and a link to it in `/usr/lib/arm-linux-gnueabihf`...unfortunately for the RPi Zero W, this is a version for armv7. If we don't amend this, applications will compile and link and then core dump with `Illegal instruction` when run!\n\nWe need to overwrite this lib with the armv6 version so...copy the armv6 library from `libedgetpu.so.1.0` from `\u003cpath_to\u003e/edgetpu/libedgetpu/direct/armv6` to `/usr/lib/arm-linux-gnueabihf`\n\nThis may need you to `sudo cp \u003csrc\u003e \u003cdest\u003e` plus you should also to change the file permissions and group:owner via `chmod` and `chown` respectively\n\nNow rename the original `Makefile` in `\u003cpath_to\u003e/tensorflow/edgetpu/src/cpp/examples` to ``Makefile.orig` and replace it the `Makefile` from this repo\n\nEdit the new `Makefile` and set your `TENSORFLOW_DIR` to the relevant path\n\nRun `make all` to compile and link `minimal`\nCheck you have this binary if the make completes silently\n\nNext we require the tflite model and source image for `minimal` so copy the `mobilenet_v1_1.0_224_quant_edgetpu.tflite` and `resized_cat.bmp` files from `\u003cpath_to\u003e/tensorflow/edgetpu/test_data` into this `examples` directory\n\nEnsure your Google Coral TPU USB stick is installed and run...\n```sh\npi@raspberrypi: \u003cpath\u003e $ ./minimal mobilenet_v1_1.0_224_quant_edgetpu.tflite resized_cat.bmp\n```\n\nThe output should be similar to/same as...\n```sh\npi@raspberrypi: \u003cpath\u003e $ ./minimal mobilenet_v1_1.0_224_quant_edgetpu.tflite resized_cat.bmp\n[Image analysis] max value index: 286 value: 0.792969\n```\n\nHappy TensorFlow-Lite-development-with-TPU-inference-on-arm6-devices!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudwiser%2Ftensorflowliterpizerotpu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudwiser%2Ftensorflowliterpizerotpu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudwiser%2Ftensorflowliterpizerotpu/lists"}