Skip to content

kkokotero/VisionLite

VisionLite

VisionLite banner

GitHub badge Version badge MIT license badge Android badge Kotlin badge JitPack Version

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.


Quick path

  1. Add the library dependency.
  2. Create VisionLite with the face modules you want to configure.
  3. Run detection on ImageProxy, ByteArray, Bitmap, or captured requests.
  4. Use face.crop(...), faceAligner, faceEmbedder, and match(...) for enrollment and recognition.

Installation

repositories {
    maven("https://jitpack.io")
}
dependencies {
    implementation("com.github.kkokotero:VisionLite:1.0.1")
}

Basic usage

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)
}

Detect and analyze a face

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,
    )
}

Match embeddings

val similarity = faceEmbedder.match(embeddingA, embeddingB)
val centroid = faceEmbedder.centroid(listOf(embeddingA, embeddingB, embeddingC))

Face modules

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 configs

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

Presets

  • FaceEmbeddingModelPreset.MODERN_PREFERRED
  • FaceEmbeddingModelPreset.FACE_NET_512

You can also set modelAssetPath(...) directly if you want to override the preset.


CameraX workflow

VisionLite is designed to work with ImageProxy directly so the hot path avoids unnecessary bitmap allocations.

Recommended flow:

  1. Analyze preview frames with FaceDetector.
  2. Pick the best face using coverage or tracking.
  3. Crop the face with rotation correction.
  4. Align the crop.
  5. Run quality and anti-spoofing.
  6. Generate the embedding only when the face is acceptable.
  7. Store multiple embeddings per person and compare against the centroid.

Embedding strategy

VisionLite supports storing multiple embeddings for the same person and matching against a centroid.

Recommended enrollment flow:

  1. Capture a live face.
  2. Save the embedding.
  3. Repeat up to a small number of samples.
  4. Build the centroid from the stored embeddings.
  5. Compare future faces against the centroid instead of a single sample.

This improves stability and reduces one-off false matches.


Good fit

  • face enrollment
  • face recognition
  • camera preview overlays
  • kiosk or on-device identity flows
  • low-latency Android vision pipelines

Status

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.


Contributing

See CONTRIBUTING.md.

Code of conduct

See CODE_OF_CONDUCT.md.

Security

See SECURITY.md.

License

See LICENSE.

About

VisionLite is a low-latency Android face vision toolkit for detection, alignment, embedding, anti-spoofing, and quality analysis.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors