pipeline

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package pipeline orchestrates the end-to-end 1:1 verification flow:

image -> detect -> crop -> quality -> embed -> compare -> result

It is deliberately decoupled from the public package so that the detector, embedder and matcher can be swapped (e.g. mocks in tests) without touching the public API.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoFaceDetected is returned when no face is found in an input image.
	ErrNoFaceDetected = errors.New("gofacekit: no face detected")
	// ErrMultipleFacesDetected is reserved for stricter modes that reject
	// images containing more than one face. It is not enforced in v0.1.
	ErrMultipleFacesDetected = errors.New("gofacekit: multiple faces detected")
	// ErrInvalidImage is returned when an input image cannot be decoded.
	ErrInvalidImage = imageproc.ErrInvalidImage
	// ErrEmbeddingFailed is returned when the embedder cannot produce a vector.
	ErrEmbeddingFailed = errors.New("gofacekit: embedding failed")
	// ErrVectorMismatch is returned when two embeddings cannot be compared.
	ErrVectorMismatch = errors.New("gofacekit: embedding vector mismatch")
	// ErrQualityCheckFailed is returned when an input image fails the quality
	// gate (only when quality checks are enabled).
	ErrQualityCheckFailed = errors.New("gofacekit: quality check failed")
)

Pipeline errors. The public package re-exports these so library users can match on them with errors.Is.

Functions

This section is empty.

Types

type FaceResult

type FaceResult struct {
	Found      bool
	Box        detector.FaceBox
	Confidence float64
}

FaceResult describes the chosen face from a single input image.

type Options

type Options struct {
	Threshold          float64
	MinFaceSize        int
	EnableQualityCheck bool
	QualityThresholds  quality.Thresholds
}

Options configures a Pipeline.

type Pipeline

type Pipeline struct {
	// contains filtered or unexported fields
}

Pipeline runs verification using an injected detector and embedder.

func New

func New(det detector.Detector, emb embedder.Embedder, opts Options) *Pipeline

New constructs a Pipeline from a detector, embedder and options.

func (*Pipeline) Verify

func (p *Pipeline) Verify(refImg, probeImg image.Image) (*Result, error)

Verify runs the full pipeline on two already-decoded images.

func (*Pipeline) VerifyBytes

func (p *Pipeline) VerifyBytes(referenceImage, probeImage []byte) (*Result, error)

VerifyBytes decodes both images from memory and verifies them.

func (*Pipeline) VerifyImages

func (p *Pipeline) VerifyImages(referencePath, probePath string) (*Result, error)

VerifyImages decodes both images from disk and verifies them.

type Result

type Result struct {
	Match         bool
	Similarity    float64
	Threshold     float64
	ReferenceFace FaceResult
	ProbeFace     FaceResult
	Quality       quality.Result
}

Result is the internal verification result. The public package maps it onto the exported VerificationResult type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL