classifier

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package classifier is a Cifar-10 classifier. It loads a pre-trained model and offers a Classify method that will classify any image, by first resizing it to the model's input size.

To use it, create a Classifier with New(), and then simply call its Classify method with a 32x32 image.

This is an example of how to serve a model for inference.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Classifier

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

Classifier holds the Cifar-10 model compiled. It will use XLA with GPU if available or CPU by default. But the backend can be configured with GOMLX_BACKEND.

func New

func New(checkpointDir string) (*Classifier, error)

New creates a new Classifier object that can be used to classify images using a Cifar-10 model.

func (*Classifier) Classify

func (c *Classifier) Classify(img image.Image) (int32, error)

Classify takes a 32x32 image and returns a Cifar-10 classification according to the models. Use cifar.C10Labels to convert the returned class to a string name. The returned class is from 0 to 9.

TODO: resize image to 32x32, used by the model.

Jump to

Keyboard shortcuts

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