classification

package
v0.44.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: AGPL-3.0 Imports: 8 Imported by: 6

Documentation

Overview

Package classification implements a classifier for use as a visModel in the vision service

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Overlay added in v0.2.17

func Overlay(img image.Image, classifications Classifications) (image.Image, error)

Overlay returns a color image with the classification labels and confidence scores overlaid on the original image.

Types

type Classification

type Classification interface {
	Score() float64
	Label() string
}

Classification returns a confidence score of the classification and a label of the class.

func NewClassification

func NewClassification(score float64, label string) Classification

NewClassification creates a simple 2D classification.

type Classifications

type Classifications []Classification

Classifications is a list of the Classification object.

func (Classifications) TopN

func (cc Classifications) TopN(n int) (Classifications, error)

TopN finds the N Classifications with the highest confidence scores.

type Classifier

type Classifier func(context.Context, image.Image) (Classifications, error)

A Classifier is defined as a function from an image to a list of Classifications.

type Postprocessor added in v0.2.17

type Postprocessor func(Classifications) Classifications

Postprocessor defines a function that filters/modifies on an incoming array of Classifications.

func NewLabelConfidenceFilter added in v0.26.0

func NewLabelConfidenceFilter(labels map[string]float64) Postprocessor

NewLabelConfidenceFilter returns a function that filters out classifications based on label map. Does not filter when input is empty.

func NewLabelFilter added in v0.17.0

func NewLabelFilter(labels map[string]interface{}) Postprocessor

NewLabelFilter returns a function that filters out classifications without one of the chosen labels. Does not filter when input is empty.

func NewScoreFilter added in v0.2.17

func NewScoreFilter(conf float64) Postprocessor

NewScoreFilter returns a function that filters out classifications below a certain confidence score.

Jump to

Keyboard shortcuts

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