{"id":20685532,"url":"https://github.com/yas-sim/face-feature-visualization","last_synced_at":"2025-10-28T23:02:28.894Z","repository":{"id":185235174,"uuid":"266528294","full_name":"yas-sim/face-feature-visualization","owner":"yas-sim","description":"This program demonstrates how to plot face feature vectors on a 2-D chart using t-SNE method to compress dimension of the vectors","archived":false,"fork":false,"pushed_at":"2020-05-30T03:27:06.000Z","size":418,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-17T16:17:56.435Z","etag":null,"topics":["deep-learning","dimension-reduction","face-features","facial-features","facial-features-detection","feature-vectors","intel","openvino","openvino-toolkit","python","stochastic-neighbor-embedding","t-distributed-stochastic"],"latest_commit_sha":null,"homepage":null,"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/yas-sim.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}},"created_at":"2020-05-24T11:38:32.000Z","updated_at":"2023-10-22T16:03:11.000Z","dependencies_parsed_at":"2023-08-01T07:09:27.171Z","dependency_job_id":null,"html_url":"https://github.com/yas-sim/face-feature-visualization","commit_stats":null,"previous_names":["yas-sim/face-feature-visualization"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yas-sim%2Fface-feature-visualization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yas-sim%2Fface-feature-visualization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yas-sim%2Fface-feature-visualization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yas-sim%2Fface-feature-visualization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yas-sim","download_url":"https://codeload.github.com/yas-sim/face-feature-visualization/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242940021,"owners_count":20209882,"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":["deep-learning","dimension-reduction","face-features","facial-features","facial-features-detection","feature-vectors","intel","openvino","openvino-toolkit","python","stochastic-neighbor-embedding","t-distributed-stochastic"],"created_at":"2024-11-16T22:27:45.240Z","updated_at":"2025-10-28T23:02:28.835Z","avatar_url":"https://github.com/yas-sim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Visualization of Facial Feature Vectors using T-SNE Algorithm\r\nThe OpenVINO(tm) Open Model Zoo (OMZ) provides several facial feature extraction models. Those models take a cropped face image and generates a feature vector which consists of 256 FP32 values. Users can identify similar objects by calculating the norm (or distance) of those feature vectors.  \r\nThis is a sample program to demonstrate how to visualize those multi-dimentional vectors on a 2D chart.  \r\nThis program uses t-SNE (T-distributed stochastic neighbor embedding) method to reduce the dimention of the vectors from 256 to 2, then plot the vectors on a chart.  \r\nYou can understand that the chart shows the good separation of the feature vectors. The same persons faces are plotted close to each other and separated from the other faces.  \r\n\r\nOpenVINO(tm) Open Model Zooではいくつかの顔特徴ベクトル抽出モデルを提供しています。これらのモデルは切り抜かれた顔イメージを入力とし、256のFP32数値からなる特徴ベクトルを出力します。ユーザーはこの特徴ベクトル同士の距離を計算することでオブジェクトの同定を行うことが可能です。  \r\nここではこの多次元特徴ベクトルを2次元の図に表示する方法について説明しています。  \r\nこのプログラムではt-SNE (T-distributed stochastic neighbor embedding)法を使用し、特徴ベクトルの次元数を256から2に圧縮し、図に表示しています。  \r\n図を見ると、特徴ベクトルがきれいに分離されていることがわかります。同じ人の顔のベクトルは近くに、そして他の人のベクトルからは離れた位置にプロットされています。\r\n\r\n**The faces found in the `./face-db` directory**\r\n![face_db](./resources/db.png)  \r\n\r\n**Scatter Chart of the face feature vectors obtained by `face-reidentification` model**\r\n![scatter_chart](./resources/t-sne.png)\r\n\r\n## Required DL Models to Run This Demo\r\n\r\nThe demo expects the following models in the Intermediate Representation (IR) format:\r\n\r\n * For face detection and re-identification \r\n   * `face-detection-adas-0001`\r\n   * `face-reidentification-retail-0095`\r\n\r\n\r\nYou can download those models from OpenVINO [Open Model Zoo](https://github.com/opencv/open_model_zoo).\r\nIn the `models.lst` is the list of appropriate models for this demo that can be obtained via `Model downloader`.\r\nPlease see more information about `Model downloader` [here](../../../tools/downloader/README.md).\r\n\r\n## How to Run\r\n\r\n(Assuming you have successfully installed and setup OpenVINO 2020.2. If you haven't, go to the OpenVINO web page and follow the [*Get Started*](https://software.intel.com/en-us/openvino-toolkit/documentation/get-started) guide to do it.)  \r\n\r\n### 1. Install dependencies  \r\nThe demo depends on:\r\n- `opencv-python`\r\n- `numpy`\r\n- `scipy`\r\n- `scikit-learn`\r\n- `matplotlib`\r\n\r\nTo install all the required Python modules you can use:\r\n\r\n``` sh\r\n(Linux) pip3 install -r requirements.txt\r\n(Win10) pip install -r requirements.txt\r\n```\r\n\r\n### 2. Download DL models from OMZ\r\nUse `Model Downloader` to download the required models.\r\n``` sh\r\n(Linux) python3 $INTEL_OPENVINO_DIR/deployment_tools/tools/model_downloader/downloader.py --list models.lst\r\n(Win10) python \"%INTEL_OPENVINO_DIR%\\deployment_tools\\tools\\model_downloader\\downloader.py\" --list models.lst\r\n```\r\n\r\n### 3. Prepare face images\r\nThis program will search images (jpg/bmp/png) from `./face-db` directory. You can create the directories under `./face-db` as many as you want. The directory names and the file names are displayed right next to the dot on the chart so that you can identify which data it is.  \r\nThis program will detect the faces from the images, crop the found faces and register them to the DB.  \r\n\r\n#### Example of `face-db`\r\n```sh\r\n./\r\n+ face-feature-visualization.py\r\n+ face-db/\r\n| + person0/\r\n| | + 0.jpg\r\n| | + 1.jpg\r\n| + person1/\r\n| | + 0.jpg\r\n| | + 1.jpg\r\n```\r\n\r\n### 4. Run the demo app\r\nThis program doesn't take any command line arguments. All file names and paths are hard coded in the source code.\r\n``` sh\r\n(Linux) python3 face-feature-visualization.py\r\n(Win10) python face-feature-visualization.py\r\n```\r\n\r\n## Demo Output  \r\nThe application displays the face database (found faces), then a chart.\r\n\r\n## Tested Environment  \r\n- Windows 10 x64 1909 and Ubuntu 18.04 LTS  \r\n- Intel(r) Distribution of OpenVINO(tm) toolkit 2020.2  \r\n- Python 3.6.5 x64  \r\n\r\n## See Also  \r\n* [Using Open Model Zoo demos](../../README.md)  \r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyas-sim%2Fface-feature-visualization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyas-sim%2Fface-feature-visualization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyas-sim%2Fface-feature-visualization/lists"}