🌐 Company Site - Here
🤗 Hugging Face - Here
📚 Help Center - Here
🐳 Docker Hub - Here
FacePlugin ID Document Recognition + Liveness Detection — Linux (Fully On-Premise)
Quick start
- Docker (recommended):
docker pull faceplugin/document-reader:latest then docker run — Option A
- Or local: download CPU runtime into
lib/cpu/ — Option B, then ./run.sh — API on 8082
- Confirm it is running:
curl -s http://127.0.0.1:8082/api/health (no license needed yet)
- Contact us with your machine code to obtain a license key, then activate with
POST /api/activate — Activate your license
- Try it: Postman, curl, or local Gradio demo on 9082 (
python3 demo)
Docs: doc.faceplugin.com
Try online: Hugging Face Space
Introduction
FacePlugin ID Document Recognition SDK is an on-premise identity document verification engine for Linux and Docker. It reads ID cards, passports, and driver’s licenses and returns structured data through OCR, MRZ reading, and barcode / QR extraction, together with document detection and classification, image quality analysis, and portrait and signature extraction.
The SDK also supports optional NFC / RFID chip reading and document authenticity (liveness) checks to support KYC, eKYC, banking, and remote identity verification workflows. All processing runs on your own server, and no images or biometric data are ever sent to FacePlugin.
The SDK runs as a REST API server on Linux (x86_64), or through Docker on Linux, Windows, and macOS (Apple Silicon uses amd64 emulation). This repository is self-contained, with no other FacePlugin repository required.
Main Functionalities
| Feature |
Supported |
| ID card, passport, and driver’s license recognition |
✓ |
| MRZ, barcode, QR, and OCR data extraction |
✓ |
| Document detection and type classification |
✓ |
| Auto-capture and image quality analysis |
✓ |
| Face, portrait, and signature extraction from document |
✓ |
| NFC / RFID chip reading (where available) |
✓ |
| Document authenticity / liveness checks |
✓ |
Product List
Product hubs: Face Recognition · Face Liveness Detection · ID Document Recognition · ID Document Liveness
Start the API
You do not need a license to start the API. The server prints your machine code on startup, which you’ll need to activate your license. Product endpoints unlock after you activate.
Option A — Docker Hub
The runtime is already inside the image, so no Google Drive download is needed.
sudo docker pull faceplugin/document-reader:latest
sudo docker run -d --name faceplugin-document-reader \
--shm-size=2gb --privileged \
-p 8082:8082 \
-v /etc/machine-id:/etc/machine-id:ro \
faceplugin/document-reader:latest
sudo docker logs -f faceplugin-document-reader
# Look for the machine code line in the logs
--shm-size=2gb is required (dcf.fpk extracts to /dev/shm). Keep --privileged and the /etc/machine-id volume as shown.
On Docker Desktop (macOS/Windows) omit the /etc/machine-id volume.
Run multiple containers
To run multiple containers on one Linux host with a shared machine code / license, see the docs:
https://doc.faceplugin.com/id-document-recognition-sdk/server-sdk/id-document-recognition-linux-sdk#run-multiple-containers
Option B — Local Linux (./run.sh)
This option runs the server directly on your machine. It requires glibc 2.38 or newer (for example, Ubuntu 24.04). Check your version with ldd --version. No GPU is needed; this product runs on CPU only.
1. Clone the repository
git clone https://github.com/Faceplugin-ltd/ID-Document-Recognition-LivenessDetection-Linux.git
cd ID-Document-Recognition-LivenessDetection-Linux
2. Download the runtime
The lib/cpu/ folder is empty on GitHub because the native libraries and model files are too large to host there.
- Open the DocumentReader Linux runtime folder on Google Drive.
- Download every file in the folder.
- Place the files directly in
lib/cpu/, not in a subfolder.
Your project should look like this:
ID-Document-Recognition-Docker/
└── lib/
└── cpu/
├── libDocumentReaderSDK.so
├── libdcf-eng.so
├── dcf.fpk
└── ... (remaining files from Google Drive)
⚠️ If Google Drive gives you a zip, extract it and move the files up so you don’t end up with lib/cpu/SomeFolder/libDocumentReaderSDK.so.
3. Install dependencies and run
pip3 install -r requirements.txt
./run.sh
The API starts at http://127.0.0.1:8082, and the machine code is printed in the terminal. Continue with Activate your license.
Activate your license
Licenses work offline and are tied to the machine code of the environment where the server runs.
⚠️ Docker and local installs have different machine codes. Get the machine code from the same environment you’ll use in production. If you’ll run in Docker, send the code from the Docker container, not from the host.
-
Start the server using Docker Hub or ./run.sh (see Start the API). You don’t need a license for the first start.
-
Get your machine code. It’s printed in the startup log, or you can fetch it with GET /api/machinecode.
-
Send the machine code to FacePlugin (contact us). We’ll reply with a license key for that machine code.
-
Activate the license. Save the license key to license.txt in the project root, replacing anything already in the file. Then send it to the running server:
curl -s -X POST http://127.0.0.1:8082/api/activate \
-H 'Content-Type: text/plain' \
--data-binary @license.txt
If you run in Docker, this command is required, because detached containers don’t re-read license.txt after they start. The same command also works with ./run.sh.
License capabilities (Recognition + Liveness)
After activation, GET /api/licenseStatus reports what the key unlocks. The Gradio demo shows the same summary as License: … at the top of the page.
| Capability |
Meaning |
| Recognition |
OCR, MRZ, barcode/QR, and document type classification |
| Liveness (authenticity) |
Document authenticity: physical document, security patterns, photo origin, barcode format |
Typical labels:
- Recognition + Liveness — full identity verification (Fields + Liveness tabs)
- Recognition — OCR, MRZ, and barcode only; Security stays empty / not checked
- Liveness — authenticity / document liveness only; OCR/MRZ/barcode stays empty / not checked
- Not licensed — machine code only until you activate
Check status anytime:
curl -s http://127.0.0.1:8082/api/licenseStatus
Authenticity is not requested with a flag any more. documentProcess always runs the full pipeline — identity fields plus authenticity — and the license decides whether the security block comes back. Set verifyStrict if you want the stricter authenticity status. See Scan options.
Scan options
The public option surface is a keep-list. Send them under options (nested) or at the request root:
{ "images": [ { "image": "<BASE64>", "page_idx": 0 } ], "options": {} }
Empty {} — or no options at all — is the recommended full scan: full KYC identity + authenticity, all visual fields, all languages, and image QA on sharp + glare + cover.
| Key |
Full name |
What it does |
Default |
lang |
Languages to read |
Visual-zone OCR language filter, e.g. ["en","de-de"]. Omit or [] = no filter. |
all |
checks |
Image quality checks |
Any of sharp, glare, cover. [] sends no QA block (see note). |
all three on |
checksStrict |
Affect overall status |
A failed QA check fails the optical / overall status. |
false |
verifyStrict |
Stricter security status |
Stricter authenticity overall status. |
false |
photo.cropped |
Already cropped |
The image is already edge-cropped, so skip document locating. |
false |
fine.mergeNames |
Merge names across sources |
Prefer the longest name spelling when MRZ, barcode and OCR disagree. |
true |
fine.qa.minDpi |
Minimum DPI |
Image QA resolution floor. |
150 |
fine.qa.maxTilt |
Maximum tilt angle |
Perspective angle threshold, in degrees. |
10 |
fine.qa.margin |
Edge indent % |
Minimum gap between the document and the image edge, in percent. |
0 |
On checks: the list picks which of the three gates the SDK asks the engine for; bounds, perspective and resolution always come back, driven by the fine.qa thresholds. An empty list sends no image-QA block at all, so the engine falls back to its own built-in quality checks — it is not an off switch for imageQuality in the result.
Example — English-only OCR, stricter status, pre-cropped image:
{
"lang": ["en"],
"checks": ["sharp", "glare", "cover"],
"checksStrict": true,
"verifyStrict": true,
"photo": { "cropped": true },
"fine": { "mergeNames": true, "qa": { "minDpi": 150, "maxTilt": 10, "margin": 0 } }
}
Keys outside this list are ignored, so an old caller that sends use, want, verify, reply, dates, ageMin or a response flag block still scans — those keys simply do nothing. Legacy isCropped / alreadyCropped still map to photo.cropped. Full reference: SDK docs/DOCUMENT_SDK_API_MANUAL.md and CAPABILITIES.md.
Try it
Health
curl -s http://127.0.0.1:8082/api/health
Postman
Import postman/DocumentReader-API.postman_collection.json.
Default base URL: http://127.0.0.1:8082
Demo UI (Gradio) — local only
The Docker image includes only the API server, not the demo UI. To view results in your browser, run the Gradio demo on your own machine. Make sure the API is already running on port 8082 first.
pip3 install -r requirements-demo.txt
./run_demo.sh
Or:
pip3 install -r requirements-demo.txt
DEMO_PORT=9082 API_BASE=http://127.0.0.1:8082 python3 demo
Open http://127.0.0.1:9082 in your browser. Sample images, if included, are in assets/examples/samples/. The page header shows your current license status (for example Recognition + Liveness), taken from /api/licenseStatus.
Drop the front (and the back if the document has one) on the left, or pick a sample, then press Recognize. The result panel on the right has four tabs:
- Fields — document type, country, field cross-check, image quality, and OCR / MRZ / barcode fields
- Liveness — overall and per-page authenticity: photo origin, physical document, security patterns, barcode format (needs a Liveness-capable license)
- Images — portrait, signature, ghost portrait, barcodes, and cropped pages
- Raw JSON — the
requestOptions that were sent plus the full /api/documentProcess response, so you can copy a working body straight into your own integration
Scan settings dialog
Everything in Scan options is editable from the ⚙︎ Scan settings button, and a chip row under it shows the current selection without opening the dialog:
- Visual zone — Languages is a searchable multi-select listing every supported language by full name (type “german”, pick German (Germany)), not a token string. Leave it empty for all languages. Merge names across sources maps to
fine.mergeNames.
- Image quality — the
sharp / glare / cover gates, Affect the overall status (checksStrict), and the three thresholds: DPI, angle in degrees, and document position indent in percent.
- Other — Stricter security status (
verifyStrict) and Already edge-cropped (photo.cropped).
Press Done to apply. The exact options the demo sent are echoed under the verdict and in the Raw JSON tab.
Setup on your own app
Two paths. You do not need the Gradio demo in production.
HTTP (any language) — start the API (see Start the API), then call:
curl -s -X POST http://127.0.0.1:8082/api/documentRecognition \
-H 'Content-Type: application/json' \
-d '{"images":[{"image":"<BASE64>"}]}'
curl -s -X POST http://127.0.0.1:8082/api/documentLiveness \
-H 'Content-Type: application/json' \
-d '{"images":[{"image":"<BASE64>"}]}'
curl -s -X POST http://127.0.0.1:8082/api/documentProcess \
-H 'Content-Type: application/json' \
-d '{"images":[{"image":"<BASE64>"}],"options":{}}'
"options": {} runs the full default scan. To narrow it, send the keep-list keys from Scan options:
curl -s -X POST http://127.0.0.1:8082/api/documentProcess \
-H 'Content-Type: application/json' \
-d '{"images":[{"image":"<BASE64>"}],"options":{"lang":["en"],"checks":["sharp","glare","cover"],"verifyStrict":true}}'
Python in-process — keep lib/cpu/ beside sdk.py and call the SDK directly. See About SDK.
About SDK
Use the Python bindings in sdk.py. Return code 0 means success.
import sdk
machine_code = sdk.get_machine_code()
print("machineCode:", machine_code)
ret = sdk.activate("license.txt")
ret = sdk.init_sdk()
result = sdk.document_recognition([{"image": base64_front}])
result = sdk.document_liveness([{"image": base64_front}])
result = sdk.document_process([{"image": base64_front}], rfid="", options={})
# Front + back, English OCR only, stricter authenticity status
result = sdk.document_process(
[
{"image": base64_front, "page_idx": 0},
{"image": base64_back, "page_idx": 1},
],
rfid="",
options={"lang": ["en"], "verifyStrict": True},
)
result = sdk.general_process(base64_image, options={})
print(sdk.get_license_status()) # recognition / authenticity flags + label
Optional session APIs: sdk.start_new_session(), sdk.start_new_page(), sdk.unload().
HTTP endpoints: /api/health, /api/machinecode, /api/licenseStatus, /api/backend, /api/activate, /api/documentRecognition, /api/documentLiveness, /api/documentProcess, /api/generalProcess.
Request a license, machine-code activation (machine code → license key), or integration help:
评论