{"id":15797263,"url":"https://github.com/ethanlee928/pi-inference","last_synced_at":"2026-02-10T16:11:03.100Z","repository":{"id":257809594,"uuid":"841544698","full_name":"ethanlee928/pi-inference","owner":"ethanlee928","description":"Computer Vision Inference Pipeline for Raspberry Pi","archived":false,"fork":false,"pushed_at":"2024-10-04T16:05:57.000Z","size":339,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-20T15:24:50.495Z","etag":null,"topics":["computer-vision","deep-learning","edge-computing","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethanlee928.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":"2024-08-12T16:07:13.000Z","updated_at":"2024-10-04T16:04:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"71856389-c924-48b9-862c-b2b7576ce614","html_url":"https://github.com/ethanlee928/pi-inference","commit_stats":{"total_commits":57,"total_committers":3,"mean_commits":19.0,"dds":0.07017543859649122,"last_synced_commit":"73ba8a4f203b6c41abede386736d759a6e40e333"},"previous_names":["ethanlee928/pi-inference"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ethanlee928/pi-inference","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanlee928%2Fpi-inference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanlee928%2Fpi-inference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanlee928%2Fpi-inference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanlee928%2Fpi-inference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethanlee928","download_url":"https://codeload.github.com/ethanlee928/pi-inference/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanlee928%2Fpi-inference/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269677510,"owners_count":24457858,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["computer-vision","deep-learning","edge-computing","raspberry-pi"],"created_at":"2024-10-05T00:05:52.628Z","updated_at":"2026-02-10T16:11:03.048Z","avatar_url":"https://github.com/ethanlee928.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://github.com/ethanlee928/pi-inference/raw/main/images/raspberries-inference.jpg\" width=\"75%\" alt=\"raspberries-inference\"\u003e\n\n# pi-inference\n\nA Computer Vision Inference Pipeline for Raspberry Pi inspired by [Jetson Inference](https://github.com/dusty-nv/jetson-inference).\n\nThe pipeline utilized `Gstreamer` and [`picamera2`](https://github.com/raspberrypi/picamera2) for video pipeline, and [`ncnn`](https://github.com/Tencent/ncnn) for optimized inference.\n\n## 🖥️ Install\n\nThe pipeline is based on Gstreamer v1.22.0.\n\n```bash\nsudo scripts/install-packages.sh\n```\n\nInstall the `pi-inference` package in a `Python\u003e=3.8` environment.\n\n```bash\npip install pi-inference\n```\n\n## 🚀 Quick Start\n\nInference using USB camera with pretrained `YOLOv8s` model, and display on GUI window.\n\n```python\nimport logging\n\nimport supervision as sv\nfrom ncnn.model_zoo import get_model\n\nfrom pi_inference import VideoOutput, VideoSource\nfrom pi_inference import functions as f\n\nlogging.basicConfig(level=logging.INFO, format=\"%(asctime)s %(name)s %(levelname)s: %(message)s\")\nlogger = logging.getLogger(__name__)\n\nvideo_source = VideoSource(\"v4l2:///dev/video0\", {\"codec\": \"mjpg\"})\nvideo_output = VideoOutput(\"display://0\", {})\n\nnet = get_model(\n    \"yolov8s\",\n    target_size=640,\n    prob_threshold=0.25,\n    nms_threshold=0.45,\n    num_threads=4,\n    use_gpu=False,\n)\nbox_annotator = sv.BoxAnnotator()\nlabels_annotator = sv.LabelAnnotator()\nfps_monitor = sv.FPSMonitor()\n\nwhile True:\n    try:\n        frame = video_source.capture(timeout=300)\n        if frame is not None:\n            fps_monitor.tick()\n            detections = f.from_ncnn(frame, net)\n            labels = [\n                f\"{class_name} {confidence:.2f}\"\n                for class_name, confidence in zip(detections[\"class_name\"], detections.confidence)\n            ]\n            frame = box_annotator.annotate(scene=frame, detections=detections)\n            frame = labels_annotator.annotate(scene=frame, detections=detections, labels=labels)\n            frame = f.draw_clock(frame)\n            frame = f.draw_text(frame, f\"FPS: {fps_monitor.fps:.1f}\", anchor_y=80)\n            video_output.render(frame)\n\n    except KeyboardInterrupt:\n        break\n\nvideo_source.on_terminate()\nvideo_output.on_terminate()\n```\n\nFind out more in [`examples`](examples).\n\n## ⛏️ Development\n\nInstall the package using pip\n\n```bash\n# For raspberrypi\npython3 -m venv --system-site-packages .venv\n\n# For others\npython3 -m venv .venv\n\nsource .venv/bin/activate\npip3 install --upgrade pip\npip3 install -e \".[dev]\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethanlee928%2Fpi-inference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethanlee928%2Fpi-inference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethanlee928%2Fpi-inference/lists"}