{"id":19025961,"url":"https://github.com/ruhyadi/vision-fr","last_synced_at":"2026-04-16T04:02:12.074Z","repository":{"id":247756427,"uuid":"824577141","full_name":"ruhyadi/vision-fr","owner":"ruhyadi","description":"Face recognition with ONNX Runtime, YOLOX, InsightFace, PostgreSQL, pgvector, and FastAPI.","archived":false,"fork":false,"pushed_at":"2024-07-07T18:04:21.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-02T02:24:02.887Z","etag":null,"topics":["cpu","face-recognition","fastapi","insightface","onnx","onnxruntime","pgvector","postgresql","yolox"],"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/ruhyadi.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":"2024-07-05T12:33:23.000Z","updated_at":"2024-09-19T02:31:44.000Z","dependencies_parsed_at":"2024-07-10T12:53:04.328Z","dependency_job_id":null,"html_url":"https://github.com/ruhyadi/vision-fr","commit_stats":null,"previous_names":["ruhyadi/vision-fr"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruhyadi%2Fvision-fr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruhyadi%2Fvision-fr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruhyadi%2Fvision-fr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruhyadi%2Fvision-fr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruhyadi","download_url":"https://codeload.github.com/ruhyadi/vision-fr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240072132,"owners_count":19743526,"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":["cpu","face-recognition","fastapi","insightface","onnx","onnxruntime","pgvector","postgresql","yolox"],"created_at":"2024-11-08T20:46:57.602Z","updated_at":"2026-04-16T04:02:07.030Z","avatar_url":"https://github.com/ruhyadi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Face Recognition\n\n## Introduction\n\nFace Recognition is a computer vision task of identifying and verifying a person from a digital image or video frame. Face recognition systems can be used for various applications such as security, surveillance, access control, and more.\n\nThis repository contains an **End-to-End Face Recognition API** implemented using [ONNX Runtime](https://onnxruntime.ai/), [PostgreSQL](https://www.postgresql.org/) ([pgvector](https://github.com/pgvector/pgvector)), and [FastAPI](https://fastapi.tiangolo.com/). We also combining [YOLOx](https://github.com/Megvii-BaseDetection/YOLOX) for face detection and [InsigtFace](https://github.com/deepinsight/insightface) for face recognition in ONNX format. With pgvector (a vector similarity search extension for PostgreSQL), we can store and search for face embeddings efficiently. Lastly, we use FastAPI to expose the face recognition API.\n\n## Docker Image\n\nWe provide a production-ready Docker image for convenience. You can pull the image from [Docker Hub](https://hub.docker.com/repository/docker/ruhyadi/vision-fr/general) and run it directly. The details are as follows:\n\n| Version | Docker Image               | Description                                                                             |\n| ------- | -------------------------- | --------------------------------------------------------------------------------------- |\n| v1.0.0  | `ruhyadi/vision-fr:v1.0.0` | Contains YOLOx_s model for face detection and MobileFaceNet model for face recognition. |\n\n## Supported Models\n\nThe following models are supported in this repository:\n\n### Face Detection\n\n| Model Name   | Description                                                                                  | Input Shape       | Output Shape                               | Link                                                                                               |\n| ------------ | -------------------------------------------------------------------------------------------- | ----------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------------- |\n| YOLOx s face | YOLOx small model for face detection. Trained on WIDER FACE dataset. **ONNX NMS supported**. | (-1, 3, 640, 640) | (`num_dets`, `boxes`, `classes`, `scores`) | [yoloxs_face.onnx](https://github.com/ruhyadi/vision-fr/releases/download/v1.0.0/yoloxs_face.onnx) |\n\n### Face Recognition\n\n| Model Name    | Description                                                                                                                                                            | Input Shape       | Output Shape | Link                                                                                           |\n| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ------------ | ---------------------------------------------------------------------------------------------- |\n| MobileFaceNet | MobileFaceNet model for face recognition. Trained on WebFace600K. Official model from [InsightFace](https://github.com/deepinsight/insightface/tree/master/model_zoo). | (-1, 3, 112, 112) | (-1, 512)    | [w600k_mbf.onnx](https://github.com/ruhyadi/vision-fr/releases/download/v1.0.0/w600k_mbf.onnx) |\n\n## Getting Started\n\n### Prerequisites\n\nWe recommend using Docker either for development or production. You can install Docker by following the instructions [here](https://docs.docker.com/get-docker/).\n\nNext, you can clone this repository and navigate to the project directory:\n\n```bash\ngit clone https://github.com/ruhyadi/vision-fr\ncd vision-fr\n```\n\n### Production\n\nTo run the Face Recognition API in production, you can use the provided Docker image. You can pull the image from Docker Hub and run it directly. The details are as follows:\n\n```bash\ndocker pull ruhyadi/vision-fr:latest\n```\n\nWe provide a `docker-compose.onnx.prod.yaml` file to run the API with PostgreSQL. You can run the following command to start the services:\n\n```bash\ndocker compose -f docker-compose.onnx.prod.yaml up -d\n```\n\nThe swagger documentation will be available at `http://localhost:7030`.\n\n### Development\n\nWe encourage you to use [devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) for development. Please make sure you have installed [Visual Studio Code](https://code.visualstudio.com/) and [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension.\n\nWe provide a `devcontainer/onnx/devcontainer.json` file to build the ONNX development container.\n\nBefore you start devcontainer, you need to start the PostgreSQL service. You can run the following command to start the PostgreSQL service:\n\n```bash\ndocker compose -f docker-compose.devel.db.yaml up -d\n```\n\nNext, you can press `Ctrl+Shift+P` to open the command palette. Then, type and select `Remote-Containers: Reopen in Container`. The development container will be built and you can start developing.\n\n## API Endpoints\n\nThe details of endpoints can be found in the Swagger documentation. Here the brief description of the endpoints:\n\n| Method | Endpoint                        | Description                                 |\n| ------ | ------------------------------- | ------------------------------------------- |\n| GET    | `/api/v1/engine/face`           | Get list of all faces data in the database. |\n| POST   | `/api/v1/engine/face/register`  | Register a new face to the database.        |\n| POST   | `/api/v1/engine/face/recognize` | Compare a face with the database.           |\n| DELETE | `/api/v1/engine/face/{id}`      | Delete a face from the database.            |\n\n## Acknowledgements\n\n- [ONNX Runtime](https://onnxruntime.ai/): ONNX Runtime is a performance-focused scoring engine for Open Neural Network Exchange (ONNX) models.\n- [PostgreSQL](https://www.postgresql.org/): PostgreSQL is a powerful, open-source object-relational database system.\n- [pgvector](https://github.com/pgvector/pgvector): pgvector is a vector similarity search extension for PostgreSQL.\n- [FastAPI](https://fastapi.tiangolo.com/): FastAPI is a modern, fast (high-performance), web framework for building APIs with Python.\n- [YOLOx](https://github.com/Megvii-BaseDetection/YOLOX): YOLOX is a high-performance anchor-free YOLO with ONNX NMS supported.\n- [InsigtFace](https://github.com/deepinsight/insightface): InsightFace is an open-source 2D and 3D face analysis toolkit.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruhyadi%2Fvision-fr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruhyadi%2Fvision-fr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruhyadi%2Fvision-fr/lists"}