service

package
v0.0.0-...-a71e27e Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Demo

func Demo(tr *TestResults, classifier *classifier.Classifier) echo.HandlerFunc

Demo creates and returns a new echo Handler that performs demonstration game screenshot verifications

func Index

func Index(tr *TestResults) echo.HandlerFunc

Index is an echo Handler that renders the index template with the given data

Types

type Results

type Results struct {
	Filename    string                  `json:"filename,omitempty"`
	Predictions []classifier.Prediction `json:"predictions,omitempty"`
	SpeedMS     int64                   `json:"speed_ms,omitempty"`
}

Results is a struct containing the results of a classified image

type Service

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

Service is a struct that contains everything needed to perform image predictions

func New

func New(graphPath, labelsPath, domain, demo string) (*Service, error)

New creates a new Service reference using the given service params

func (*Service) Classify

func (s *Service) Classify(c echo.Context) error

Classify is an echo Handler that processes an image and returns its predicted classifications

func (*Service) Close

func (s *Service) Close() error

Close closes the Service by closing all it's closers ;)

func (*Service) Echo

func (s *Service) Echo() *echo.Echo

Echo creates and returns an echo router that serves the gamedetect api

type Template

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

Template contains pre-processed templates for rendering

func (*Template) Render

func (t *Template) Render(w io.Writer, name string, data interface{},
	c echo.Context) error

Render satisfies the Renderer interface in order to populate a template page

type TestResult

type TestResult struct {
	Filename    string                  `json:"filename,omitempty"`
	Expected    string                  `json:"expected,omitempty"`
	Correct     bool                    `json:"correct,omitempty"`
	Predictions []classifier.Prediction `json:"predictions,omitempty"`
	SpeedMS     int64                   `json:"speed_ms,omitempty"`
}

TestResult is a struct containing the results of a tested classified image

type TestResults

type TestResults struct {
	Correct  int
	Accuracy float64
	Results  []TestResult
}

TestResults contains all test results and summary data

func ProcessTestData

func ProcessTestData(classifier *classifier.Classifier,
	testDir string) (*TestResults, error)

ProcessTestData pre-processes all the test data in the passed testDir, returning the results for serving on the demos index

Jump to

Keyboard shortcuts

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