{"id":24625352,"url":"https://github.com/clementsan/object_detection_yolo_fastapi","last_synced_at":"2025-03-19T08:48:27.792Z","repository":{"id":273779963,"uuid":"920854232","full_name":"clementsan/object_detection_yolo_fastapi","owner":"clementsan","description":"Object detection with YOLO model and FastAPI","archived":false,"fork":false,"pushed_at":"2025-01-22T22:47:02.000Z","size":214,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T23:21:48.592Z","etag":null,"topics":["computer-vision","data-science","deep-learning","fastapi","machine-learning","object-detection","object-detection-api","yolo"],"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/clementsan.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":"2025-01-22T22:10:00.000Z","updated_at":"2025-01-22T22:47:05.000Z","dependencies_parsed_at":"2025-01-22T23:21:50.245Z","dependency_job_id":"b6b2a43a-fd95-4317-a138-4dd48b54106b","html_url":"https://github.com/clementsan/object_detection_yolo_fastapi","commit_stats":null,"previous_names":["clementsan/object_detection_yolo_fastapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clementsan%2Fobject_detection_yolo_fastapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clementsan%2Fobject_detection_yolo_fastapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clementsan%2Fobject_detection_yolo_fastapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clementsan%2Fobject_detection_yolo_fastapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clementsan","download_url":"https://codeload.github.com/clementsan/object_detection_yolo_fastapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244394468,"owners_count":20445634,"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":["computer-vision","data-science","deep-learning","fastapi","machine-learning","object-detection","object-detection-api","yolo"],"created_at":"2025-01-25T04:33:07.394Z","updated_at":"2025-03-19T08:48:27.771Z","avatar_url":"https://github.com/clementsan.png","language":"Python","readme":"# Object detection via FastAPI\n\n[![](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)\n[![Docker Pulls](https://img.shields.io/docker/pulls/cvachet/object-detection-yolo-fastapi)](https://hub.docker.com/repository/docker/cvachet/object-detection-yolo-fastapi)\n[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint)\n\n![example workflow](https://github.com/clementsan/object_detection_yolo_fastapi/actions/workflows/ci_python.yml/badge.svg)\n![example workflow](https://github.com/clementsan/object_detection_yolo_fastapi/actions/workflows/publish_docker_image.yml/badge.svg)\n\n\n**Aim:** AI-driven object detection via FastAPI (on COCO image dataset)\n\n**Machine learning models:**\n - ultralytics/yolo11n\n - ultralytics/yolo11s\n\n-----\n### Table of contents:\n - [Local development](#1-local-development)\n   - [Run FastAPI interface](#11-run-fastapi-interface)\n   - [Run API query via curl command](#12-run-api-query-via-curl-command)\n   - [Run API query via python script](#13-run-api-query-via-python-script)\n   - [Tests via pytest library](#14-tests-via-pytest-library)\n - [Execution via docker container](#2-execution-via-docker-container)\n   - [Build image and run docker container](#21-build-image-and-run-docker-container)\n   - [Run query via API](#22-run-query-via-api)\n - [Deployment on Docker hub](#3-deployment-on-docker-hub)\n - [MLOps pipeline via GitHub actions](#4-mlops-pipeline-via-github-actions)\n----\n\n## 1. Local development\n\n### 1.1. Run FastAPI interface\n\nCommand line in development mode:\n\u003e fastapi dev app/main.py\n\nManual command line in production:\n\u003e fastapi run app/main.py\n\n\u003cb\u003eNotes:\u003c/b\u003e\n - Serving at: http://127.0.0.1:8000 \n - API docs: http://127.0.0.1:8000/docs\n\n\n\n### 1.2. Run API query via curl command\n\nCommand lines:\n - Endpoint \"/\":\n\u003e curl -X 'GET' -H 'accept: application/json' 'http://127.0.0.1:8000/'\n\n- Endpoint \"/info\":\n\u003e curl -X 'GET' -H 'accept: application/json' 'http://127.0.0.1:8000/info'\n  \n\n - Endpoint \"/api/v1/detect\":\n\u003e  curl -X POST -F \"image=@./tests/data/savanna.jpg\" http://127.0.0.1:8000/api/v1/detect\n\n - Endpoint \"/api/v1/detect\" with optional model type (e.g. yolo11n or yolo11s):\n\u003e  curl -X POST -F \"image=@./tests/data/savanna.jpg\" http://127.0.0.1:8000/api/v1/detect?model=yolo11n\n\n\n### 1.3. Run API query via python script\n\nCommand line:\n\u003e python app/inference_api.py -u \"http://127.0.0.1:8000/api/v1/detect\" -f tests/data/savanna.jpg\n\n### 1.4. Tests via pytest library\n\nCommand lines:\n\u003e pytest tests/ -v\n\n\u003e pytest tests/ -s -o log_cli=true -o log_level=DEBUG\n\n\n## 2. Execution via docker container\n\n### 2.1. Build image and run docker container\n\nCommand lines:\n\u003e sudo docker build -t object-detection-yolo-fastapi .\n\n\u003e sudo docker run --name object-detection-yolo-fastapi-cont -p 8000:8000 object-detection-yolo-fastapi\n\n### 2.2. Run query via API\n\nCommand lines:\n - Endpoint \"/\":\n\u003e curl -X 'GET' 'http://0.0.0.0:8000/' -H 'accept: application/json'\n\n - Endpoint \"/info\":\n\u003e curl -X 'GET' -H 'accept: application/json' 'http://0.0.0.0:8000/info'\n\n - Endpoint \"/api/v1/detect\":\n\u003e  curl -X 'POST' -F \"image=@./tests/data/savanna.jpg\" http://0.0.0.0:8000/api/v1/detect \n\n - Endpoint \"/api/v1/detect\" with optional model type (e.g. yolo11n or yolo11s):\n\u003e  curl -X 'POST' -F \"image=@./tests/data/savanna.jpg\" http://0.0.0.0:8000/api/v1/detect\\?model=yolo11s\n\n\n## 3. Deployment on Docker hub\n\nThis FastAPI application is available as a Docker container on Docker hub\n\nURL: https://hub.docker.com/r/cvachet/object-detection-yolo-fastapi\n\n\n## 4. MLOps pipeline via GitHub actions\n\nGithub actions were created to enable Continuous Integration (CI) and Continuous Deployment (CD) for this FastAPI app. \n\nYAML files:\n - Python testing suite: [ci_python.yml](.github/workflows/ci_python.yml)\n - Pushing to docker: [publish_docker_image.yml](.github/workflows/publish_docker_image.yml)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclementsan%2Fobject_detection_yolo_fastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclementsan%2Fobject_detection_yolo_fastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclementsan%2Fobject_detection_yolo_fastapi/lists"}