cls

package module
v0.0.0-...-4022cf2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BCHW = iota
	BHWC
)

Variables

This section is empty.

Functions

func ColorFormatBGR

func ColorFormatBGR(r, g, b float32) (first, second, third float32)

func ColorFormatRGB

func ColorFormatRGB(r, g, b float32) (first, second, third float32)

Types

type Classifier

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

func NewClassifier

func NewClassifier(conf *Config, sessionConf *SessionConfig) (*Classifier, error)

func (*Classifier) Close

func (c *Classifier) Close()

func (*Classifier) Run

func (c *Classifier) Run(images []image.Image) ([]*Output, error)

func (*Classifier) RunRaw

func (c *Classifier) RunRaw(images []image.Image) ([][][]float32, error)

type ColorFormatFunc

type ColorFormatFunc func(r, g, b float32) (first, second, third float32)

type Config

type Config struct {
	ModelPath              string
	Width, Height          int
	OutputLabels           map[int][]string
	Shape                  Shape
	ColorFormatFunc        ColorFormatFunc
	ProcessImageFuncs      []ProcessImageFunc
	ProcessFloatImageFuncs []ProcessFloatImageFunc
}

type DirectMLConfig

type DirectMLConfig struct {
	Enabled  bool
	DeviceID int
}

type LabelProb

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

func (*LabelProb) Get

func (l *LabelProb) Get() (string, float32)

type Output

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

func (*Output) Labels

func (o *Output) Labels() [][]*LabelProb

func (*Output) Raw

func (o *Output) Raw() [][]float32

func (*Output) TopLabels

func (o *Output) TopLabels() []*LabelProb

type ProcessFloatImageFunc

type ProcessFloatImageFunc func(rgb float32) float32

func Normalize

func Normalize(mean, std float32) ProcessFloatImageFunc

func Rescale

func Rescale() ProcessFloatImageFunc

type ProcessImageFunc

type ProcessImageFunc func(img image.Image) image.Image

func ResizeImage

func ResizeImage(size int, interp resize.InterpolationFunction) ProcessImageFunc

func ResizeWithPadding

func ResizeWithPadding(size int, padColor color.Color, interp resize.InterpolationFunction) ProcessImageFunc

type SessionConfig

type SessionConfig struct {
	Cuda        CudaConfig
	TensortRT   TensorRTConfig
	CoreML      CoreMLConfig
	DirectML    DirectMLConfig
	CpuMemArena *bool
	MemPattern  *bool

	InterOpNumThreads int
	IntraOpNumThreads int
}

type Shape

type Shape int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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