{"id":25616691,"url":"https://github.com/parthapray/yolo_ollama_raspberrypi","last_synced_at":"2026-05-10T02:20:59.940Z","repository":{"id":278790109,"uuid":"936785081","full_name":"ParthaPRay/yolo_ollama_raspberrypi","owner":"ParthaPRay","description":"This repo contains code of yolo integration with localized ollama for object detection on Raspberry Pi","archived":false,"fork":false,"pushed_at":"2025-02-21T17:26:20.000Z","size":9863,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-21T18:28:11.116Z","etag":null,"topics":["object-detection","ollama","ollama-api","raspberry-pi","yolo"],"latest_commit_sha":null,"homepage":"","language":"Python","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/ParthaPRay.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":"2025-02-21T17:22:18.000Z","updated_at":"2025-02-21T17:27:20.000Z","dependencies_parsed_at":"2025-02-21T18:38:45.450Z","dependency_job_id":null,"html_url":"https://github.com/ParthaPRay/yolo_ollama_raspberrypi","commit_stats":null,"previous_names":["parthapray/yolo_ollama_raspberrypi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParthaPRay%2Fyolo_ollama_raspberrypi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParthaPRay%2Fyolo_ollama_raspberrypi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParthaPRay%2Fyolo_ollama_raspberrypi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ParthaPRay%2Fyolo_ollama_raspberrypi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ParthaPRay","download_url":"https://codeload.github.com/ParthaPRay/yolo_ollama_raspberrypi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240122817,"owners_count":19751180,"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":["object-detection","ollama","ollama-api","raspberry-pi","yolo"],"created_at":"2025-02-22T04:17:59.850Z","updated_at":"2026-05-10T02:20:59.867Z","avatar_url":"https://github.com/ParthaPRay.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YOLO-Ollama Object Detection System\n\n## Overview\nThis repository implements an image analysis system that integrates:\n- **Ollama LLM** for extracting image URLs or paths from user queries.\n- **YOLO (You Only Look Once)** for object detection on the extracted image.\n- **Ollama LLM** again for summarizing detected objects.\n- **Flask API** for handling user requests and processing the workflow.\n- **CSV Logging** for tracking inference time and model performance.\n\n## Workflow\n### 1. User Input\nA user submits a prompt containing an image URL or a local file path via a `POST` request:\n```bash\ncurl -X POST http://localhost:5000/detect \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"prompt\": \"Here is my image: /home/pi/Desktop/yoloollama/cat1.jpg. Please analyze it!\"}'\n```\n\n### 2. LLM Extraction\n- The first Ollama LLM extracts the image path or URL from the user’s query.\n- If no valid path is found, a response is returned stating no image was provided.\n\n### 3. YOLO Object Detection\n- The extracted image path/URL is passed to the YOLO model for object detection.\n- The model returns detected objects along with their confidence scores.\n\n### 4. LLM Summarization\n- The detected objects are sent to another Ollama LLM to generate a brief summary.\n\n### 5. Response \u0026 Logging\n- The summarized response is returned to the user.\n- The entire process (LLM inference time, YOLO inference time, detected objects) is logged in a CSV file.\n\n## Flowchart\n```mermaid\ngraph TD;\n    A[User sends prompt] --\u003e|POST /detect| B[Flask API receives request]\n    B --\u003e C[Extract image URL/path using LLM]\n    C --\u003e|Extracted URL/path| D{Is URL/path found?}\n    D --No--\u003e E[Return No valid image link extracted]\n    D --Yes--\u003e F[YOLO model processes image]\n    F --\u003e|Detected objects| G[Summarize results using LLM]\n    G --\u003e|Summary generated| H[Return JSON response]\n    H --\u003e I[Log metrics to CSV]\n    H --\u003e J[Send summarized response to user]\n```\n\n## Technologies Used\n- **Flask**: Handles API requests.\n- **Ollama LLM**: Extracts image path \u0026 summarizes detected objects.\n- **YOLO**: Runs object detection.\n- **CSV Logging**: Stores performance metrics.\n\n## Installation\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/yourusername/yolo-ollama-detection.git\n   cd yolo-ollama-detection\n   ```\n2. Install dependencies:\n   ```bash\n   pip install flask requests ultralytics\n   ```\n3. Start the Flask server:\n   ```bash\n   python server.py\n   ```\n4. Send a request using `curl` or Postman to test the API.\n\n## API Endpoint\n### `POST /detect`\n#### Request Body:\n```json\n{\n  \"prompt\": \"Analyze this image: /home/user/image.jpg\"\n}\n```\n#### Response:\n```json\n{\n  \"extracted_url\": \"/home/user/image.jpg\",\n  \"detections\": [\n    {\"class_name\": \"cat\", \"confidence\": 0.97},\n    {\"class_name\": \"sofa\", \"confidence\": 0.85}\n  ],\n  \"summary_paragraph\": \"A cat is sitting on a sofa.\"\n}\n```\n\n## Contributors\n- **Partha Pratim Ray**, 2025\n\n## License\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparthapray%2Fyolo_ollama_raspberrypi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparthapray%2Fyolo_ollama_raspberrypi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparthapray%2Fyolo_ollama_raspberrypi/lists"}