{"id":14977885,"url":"https://github.com/driedler/rpi0_tflite_picamera","last_synced_at":"2026-01-31T14:32:55.890Z","repository":{"id":152440153,"uuid":"380597284","full_name":"driedler/rpi0_tflite_picamera","owner":"driedler","description":"Raspberry Pi Zero Development Environment + TF-Lite Image Classificaiton","archived":false,"fork":false,"pushed_at":"2021-08-30T03:30:30.000Z","size":2548,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T07:07:22.697Z","etag":null,"topics":["python","python3","raspberry-pi","raspberry-pi-camera","raspberry-pi-zero","raspberry-pi-zero-w","raspberrypi","rpi","rpi-zero-w","tensorflow","tflite","tflite-micro","tflite-runtime","tflm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/driedler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-06-26T21:14:41.000Z","updated_at":"2023-06-13T16:16:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d5e7b9c-a5f7-4350-b634-bab90feae6ed","html_url":"https://github.com/driedler/rpi0_tflite_picamera","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":0.5,"last_synced_commit":"40b007105f8c453b3d062da8bc36f06e3142b6d0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/driedler/rpi0_tflite_picamera","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/driedler%2Frpi0_tflite_picamera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/driedler%2Frpi0_tflite_picamera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/driedler%2Frpi0_tflite_picamera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/driedler%2Frpi0_tflite_picamera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/driedler","download_url":"https://codeload.github.com/driedler/rpi0_tflite_picamera/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/driedler%2Frpi0_tflite_picamera/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28945670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T14:26:55.697Z","status":"ssl_error","status_checked_at":"2026-01-31T14:26:52.545Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["python","python3","raspberry-pi","raspberry-pi-camera","raspberry-pi-zero","raspberry-pi-zero-w","raspberrypi","rpi","rpi-zero-w","tensorflow","tflite","tflite-micro","tflite-runtime","tflm"],"created_at":"2024-09-24T13:56:29.510Z","updated_at":"2026-01-31T14:32:55.875Z","avatar_url":"https://github.com/driedler.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TF-Lite Image Classification for Raspberry PI Zero W\n\nThis demonstrates how to run image classification on a Raspberry PI Zero W using:\n- [Tensorflow-Lite Micro](https://github.com/tensorflow/tflite-micro)\n- [PicCamera](https://picamera.readthedocs.io/en/release-1.13/)\n\nThis uses the [tflite_micro_runtime](https://github.com/driedler/tflite_micro_runtime) Python package for image classification\nwhich is similar to the [tflite_runtime]() package but is 8x faster since it's based on Tensorflow-Lite for Microcontrollers. \n\nThis project also demonstrates how to use VSCode to single-step debug Python from your local PC while executing on a remote Raspberry PI Zero.\n\n\n__NOTE:__ This assumes your using Windows for local debugging but a very similar setup should work for Linux/OSX.\n\n\n# Hardware \n\nThis assumes you have a Raspberry Pi Zero W (W = built-in wifi/bluetooth support).\nThere a tons of dev kits available, e.g.:\nhttps://www.canakit.com/raspberry-pi-zero-wireless.html?src=raspberrypi\n\n__NOTE:__ You need a micro SD card, the RPI board-only doesn't have onboard ROM to store the OS.\n\n__NOTE:__ You might also need a micro SD reader if you computer doesn't have one. e.g.:  \nhttps://www.amazon.com/s?k=usb+micro+sd+card+reader\n\nIt also assumes for have a Raspberry Pi Camera Module:\nhttps://www.raspberrypi.org/products/camera-module-v2/\n\n\n\n# Raspberry Pi Setup\n\n## 1) Program Raspberry Pi OS to SD Card \n\nPlug the SD card in your computer's SD card reader, then  \nuse the Raspberry PI Imager to program RPI OS-Lite to your micro SD card:  \nhttps://www.raspberrypi.org/software/\n\nSelect the __RPI OS-Lite__ image.\n\n## 2) Configure RaspberryPI Boot Config\n\nAfter programming RPI OS-Lite from setup 1, unplug the SD card, then plugin it back into your computer.\nGo to your file explorer, you should see the SD card be mounted as a new drive (at least on Windows)\nwith a description as: `boot`.\n\nOpen the SD card 'boot' drive and create the following files in the root of the SD card:\n\n__wpa_supplicant.conf:__ \nCreate the the file `wpa_supplicant.conf` and copy and paste the following to the file.\nBe sure to update `NAME OF YOUR WIFI` and  `WIFI PASSWORD` with your local Wi-Fi network's info.\n\n```\nctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev\nupdate_config=1\ncountry=GB\n\nnetwork={\n    ssid=\"NAME OF YOUR WIFI\"\n    psk=\"WIFI PASSWORD\"\n    scan_ssid=1\n}\n```\n\n__ssh__   \nCreate empty file named `ssh` in root of the SD card\n\n__config.txt__\nOpen the file `config.txt` and uncomment the following entries to enable the PiCamera:\n```\nstart_x=1             # essential\ngpu_mem=128           # at least, or maybe more if you wish\ndisable_camera_led=1  # optional, if you don't want the led to glow\n```\n\n\n## 3) Install mDNS onto your computer\n\nIf you're using Windows, install:\nhttps://support.apple.com/kb/DL999?viewlocale=en_US\u0026locale=en_US\n\nIf you're using Linux, install:\n```\nsudo apt-get install avahi-daemon\n```\n\n## 4) Start the Raspberry Pi Zero W\n\nUnmount the SD card an plug it into the RPI.\nThen plug the USB micro into the RPI's `USB` port (_not_ PWR) and the other side into your computer.\n\n\n## 5) Open an SSH session to the RPI\n\nOn Windows, PuTTY is recommended: http://www.putty.org/\n\nWait until the green LED on the RPI0 is solid green before continuing.\n\nConnect over SSH (port 22) with connection string: `pi@raspberrypi.local`   \nAccept certificate  \nDefault password is `raspberry`\n\n\nOn Ubuntu, putty can be install with:\n\n```bash\nsudo apt-get install putty-tools\n```\n\nNOTE: The `plink` command is used by the scripts in this project.\n\n\n## 6) Update Pi, install samba, config samba\n\nFrom the RPI SSH session (step 5), issue the commands:\n\n```\nsudo apt-get update\nsudo apt-get install -y samba samba-common-bin\n```\n\nThen issue:\n\n```\nsudo nano /etc/samba/smb.conf\n```\nAdd to the end of file:\n```\n[root]\npath=/\nbrowsable=yes\nwritable=yes\nonly guest=no\ncreate mask=0777\ndirectory mask=0777\npublic=yes\n```\n\nThen issue:\n```\nsudo service smbd restart\n```\n\nIn your local file explorer, you should be able to open (on Windows):\n```\n\\\\RASPBERRYPI\\root\n```\n\n__NOTE:__ While useful for development, this opens a __major security hole__ into your RPI.  \nDo NOT do the above if you're on an unsecure network!!\n\n\n## 7) Resize your Pi partition to use all available space on SD card\n\nFrom the RPI SSH session (step 5), issue the commands:\n```\nsudo raspi-config --expand-rootfs\nsudo reboot\n```\n\n# Prepare VSCode Workspace\n\n\n## 1) Map Network Drive\n\nIf using Windows, map the `\\\\RASPBERRYPI\\root` network drive, more details [here](https://support.microsoft.com/en-us/windows/map-a-network-drive-in-windows-10-29ce55d1-34e3-a7e2-4801-131475f9557d)  \nAfter this is complete, you should have a new drive, e.g. `Z:\\` that points to your RPI's `/` directory.\n\nThis is required so we can easily sync the local workspace with the RPI's workspace.\nIt also allows the VSCode Python indexer to search the RPI Python packages.\n\nAfter completing this step, you should be able to open the directory `Z:\\` (or whatever drive letter you gave it) from your file explorer.\n\n## 2) Run the setup script\n\nNext, in a local terminal, run the setup script that comes with this repo:\n\n```bash\npython3 ./workspace_setup.py \u003cnetwork drive\u003e\n```\n\nWhere `\u003cnetwork drive\u003e` is the mounted network drive from step 1.  \nThis will setup the local Python environment as well as RPI0 environment.\nIn will also configure the VSCode workspace file.\n\nSee the [setup_workspace.py](./setup_workspace.py) for more details.\n\n\n## 3) Open VSCode Workspace\n\nAssuming you cloned this repo, open the VSCode 'workspace' that is at the root of this repo: `workspace.code-workspace` \nthen install the 'Recommended Extensions'.\n\n# Run the debugger\n\nThat's it! Running the `Debug Python on RPI0` [debug configuration](https://code.visualstudio.com/docs/python/debugging) should:\n1. Synchronize the local workspace with the RPI's workspace (assuming the network drive is properly mapped)\n2. Start the `main.py` python script with remote debugging enabled\n3. Cause VSCode to connect to the debug server and allow for single-stepping in the Python script as if it were running locally\n\nAdditionally, the VSCode Python indexer will search the RPI0 for Python packages. \nSo, for instance, the indexer will resolve the `picamera` package which is on the RPI0 as if it were installed locally.\n\nSee the [main.py](./main.py) for more details on how the image classification works.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdriedler%2Frpi0_tflite_picamera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdriedler%2Frpi0_tflite_picamera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdriedler%2Frpi0_tflite_picamera/lists"}