> For the complete documentation index, see [llms.txt](https://doc.faceplugin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.faceplugin.com/products/face-recognition-sdk/recognition/open-source-windows-and-linux.md).

# Open Source

Free on-premise Python Face Recognition sample for Windows and Linux. Detect, embed, and compare faces locally. Lower accuracy than Faceplugin’s commercial HTTP API on port 8083.

### Code <a href="#code" id="code"></a>

{% embed url="<https://github.com/Faceplugin-ltd/Open-Source-Face-Recognition-SDK>" %}

### Overview <a href="#overview" id="overview"></a>

The **Open Source Face Recognition SDK** is a free Python sample for Windows and Linux. It detects faces, extracts embeddings, and compares them on your machine (no Faceplugin cloud).

Accuracy is lower than the commercial Face Recognition SDK. Contact Faceplugin if you need the higher-accuracy native engine. This sample is **not** the commercial Android/iOS or HTTP engine.

### Setup <a href="#setup" id="setup"></a>

#### Prerequisites

* **Python 3.9 or higher**
* **Anaconda** (recommended for dependency management)
* **Windows or Linux** operating system

#### Setup Instructions

1. **Install Anaconda** (if not already installed)

   ```
   # Download from: https://www.anaconda.com/products/distribution
   ```
2. **Create and activate conda environment**

   ```
   conda create -n facesdk python=3.9
   conda activate facesdk
   ```
3. **Install dependencies**

   ```
   pip install -r requirements.txt
   ```
4. **Test the installation**

   ```
   python run.py
   ```

***

### Quick Start

#### Basic Usage

```
from face_recognition_sdk import FaceRecognition

# Initialize the SDK
face_sdk = FaceRecognition()

# Process an image
image_path = "path/to/your/image.jpg"
face_info = face_sdk.GetImageInfo(image_path, faceMaxCount=10)

# Compare two faces
similarity = face_sdk.get_similarity(feature1, feature2)
```

#### Example: Face Comparison

```
# Compare two images
image1 = "test/1.jpg"
image2 = "test/2.png"

# Get face information from both images
faces1 = face_sdk.GetImageInfo(image1, faceMaxCount=1)
faces2 = face_sdk.GetImageInfo(image2, faceMaxCount=1)

if faces1 and faces2:
    # Compare the first face from each image
    similarity = face_sdk.get_similarity(faces1[0]['embedding'], faces2[0]['embedding'])
    print(f"Similarity: {similarity}%")
    
    # Check if it's the same person (threshold = 75)
    is_same_person = similarity >= 75
    print(f"Same person: {is_same_person}")
```

***

### APIs

### Core Functions

**`GetImageInfo(image_path, faceMaxCount)`**

Extracts face information from an image.

**Parameters:**

* `image_path` (str): Path to the input image
* `faceMaxCount` (int): Maximum number of faces to detect

**Returns:**

* List of dictionaries containing:
  * `bbox`: Face bounding box coordinates
  * `landmarks`: Facial landmark points
  * `embedding`: Feature embedding vector

**`get_similarity(feature1, feature2)`**

Compares two face feature embeddings.

**Parameters:**

* `feature1` (array): First face embedding
* `feature2` (array): Second face embedding

**Returns:**

* Similarity score (0-100), where higher values indicate greater similarity

#### Configuration

* **Default Threshold**: 75 (for determining if two faces belong to the same person)
* **Supported Formats**: JPG, PNG, BMP, TIFF
* **Face Detection**: Automatic detection of multiple faces per image<br>

### FAQ

**Is this the commercial SDK?** No. Contact Faceplugin for the higher-accuracy native engine.

**Does it run on-premise?** Yes. Processing stays on the user’s Windows or Linux machine.

### Related documentation

* [Faceplugin Face Recognition Server SDK](/products/face-recognition-sdk/recognition/server-sdk.md) · [Mobile SDK](/products/face-recognition-sdk/recognition-and-liveness/mobile-sdk.md) · [Glossary](/help/resources/glossary.md)
* [Request a License](/help/request-a-license-and-support.md) · [Status codes](/help/resources/status-codes.md)
* [Combining products (eKYC)](/getting-started/choose-a-product.md) · [SDK comparison](/help/comparisons.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.faceplugin.com/products/face-recognition-sdk/recognition/open-source-windows-and-linux.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
