cls

package module
v0.0.0-...-2a239b9 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

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)

func DestroyEnvironment

func DestroyEnvironment() error

func InitOnnxRuntime

func InitOnnxRuntime(libPath string)

Types

type Classifier

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

func NewClassifier

func NewClassifier(modelConf *ModelConfig, preprocessConf *PreprocessConfig, 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 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 ModelConfig

type ModelConfig struct {
	ModelPath string
	InputName string
	Outputs   []OutputConfig
	Shape     Shape
}

type Output

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

func (*Output) Label

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

func (*Output) Raw

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

type OutputConfig

type OutputConfig struct {
	Name   string
	Dim    int
	Labels []string
}

type PreprocessConfig

type PreprocessConfig struct {
	ColorFormatFunc        ColorFormatFunc
	ProcessImageFuncs      []ProcessImageFunc
	ProcessFloatImageFuncs []ProcessFloatImageFunc
}

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 interface {
	Index(batchIdx, x, y int) (first, second, third int)
	Get(batch int) []int64
	Size() int
}

func NewBCHW

func NewBCHW(size int) Shape

func NewBHWC

func NewBHWC(size int) Shape

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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