VisionLite is an Android face vision toolkit focused on low latency, low memory use, concurrency, and developer experience.
It ships five face modules:
- Face detection
- Face alignment
- Face embedding
- Face anti-spoofing
- Face quality
All models are bundled with the library so the app only uses the public API.
Each module has its own config and model preset, so you can tune latency, quality, and memory independently.
- Add the library dependency.
- Create
VisionLitewith the face modules you want to configure. - Run detection on
ImageProxy,ByteArray,Bitmap, or captured requests. - Use
face.crop(...),faceAligner,faceEmbedder, andmatch(...)for enrollment and recognition.
repositories {
maven("https://jitpack.io")
}dependencies {
implementation("com.github.kkokotero:VisionLite:1.0.1")
}val faceDetector = VisionLite.faceDetector(context) {
mode(FaceDetectionMode.LOW)
trackingEnabled(true)
maxConcurrentRequests(2)
}
val faceAligner = VisionLite.faceAligner(context) {
inputSize(256)
threadCount(2)
parallelism(2)
cropMargin(0.25f)
}
val faceEmbedder = VisionLite.faceEmbedder(context) {
preferredModelPreset(FaceEmbeddingModelPreset.MODERN_PREFERRED)
threadCount(2)
parallelism(2)
normalizeOutput(true)
}
val faceAntiSpoofing = VisionLite.faceAntiSpoofing(context) {
preferredModelPreset(FaceAntiSpoofingModelPreset.MODERN_PREFERRED)
threshold(0.25f)
}
val faceQuality = VisionLite.faceQuality(context) {
inputSize(256)
minScore(0.48f)
minConfidence(0.45f)
}val faces = visionLite.faceDetector.detect(imageProxy)
val results = faces.map { face ->
val crop = face.crop(imageProxy)
val aligned = faceAligner.align(crop)
val quality = faceQuality.assess(aligned.bitmap)
val live = faceAntiSpoofing.check(aligned.bitmap)
val embedding = if (live.live) faceEmbedder.embed(aligned.bitmap) else null
FaceResult(
face = face,
live = live,
modelQuality = quality,
embedding = embedding,
)
}val similarity = faceEmbedder.match(embeddingA, embeddingB)
val centroid = faceEmbedder.centroid(listOf(embeddingA, embeddingB, embeddingC))| Module | What it does | Notes |
|---|---|---|
| Face detection | Finds faces and tracks them | ML Kit based, supports low-latency modes |
| Face alignment | Normalizes the face crop | Helps keep embedding and spoof checks stable |
| Face embedding | Generates face vectors | Supports match(...) and centroid(...) |
| Face anti-spoofing | Detects live vs spoofed faces | Keeps the live path safer |
| Face quality | Scores image quality | Useful for gating enrollment and capture |
| Module | Main config | Common knobs |
|---|---|---|
| Face detection | FaceDetectorConfig |
mode, trackingEnabled, minFaceSize, quality, maxConcurrentRequests |
| Face alignment | FaceAlignmentConfig |
inputSize, modelAssetPath, threadCount, parallelism, cropMargin |
| Face embedding | FaceEmbedderConfig |
preferredModelPreset, modelAssetPath, inputSize, outputSize, threadCount, parallelism, normalizeOutput |
| Face anti-spoofing | FaceAntiSpoofingConfig |
preferredModelPreset, modelAssetPath, inputSize, threshold, threadCount, parallelism |
| Face quality | FaceQualityModelConfig |
modelAssetPath, inputSize, minScore, minConfidence, threadCount, parallelism |
FaceEmbeddingModelPreset.MODERN_PREFERREDFaceEmbeddingModelPreset.FACE_NET_512
You can also set modelAssetPath(...) directly if you want to override the preset.
VisionLite is designed to work with ImageProxy directly so the hot path avoids unnecessary bitmap allocations.
Recommended flow:
- Analyze preview frames with
FaceDetector. - Pick the best face using coverage or tracking.
- Crop the face with rotation correction.
- Align the crop.
- Run quality and anti-spoofing.
- Generate the embedding only when the face is acceptable.
- Store multiple embeddings per person and compare against the centroid.
VisionLite supports storing multiple embeddings for the same person and matching against a centroid.
Recommended enrollment flow:
- Capture a live face.
- Save the embedding.
- Repeat up to a small number of samples.
- Build the centroid from the stored embeddings.
- Compare future faces against the centroid instead of a single sample.
This improves stability and reduces one-off false matches.
- face enrollment
- face recognition
- camera preview overlays
- kiosk or on-device identity flows
- low-latency Android vision pipelines
VisionLite is under active development.
The API is intentionally small and face-focused so the public surface stays easy to use and fast to review.
See CONTRIBUTING.md.
See CODE_OF_CONDUCT.md.
See SECURITY.md.
See LICENSE.