codelab

package module
v0.0.0-...-efabd05 Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: MIT Imports: 5 Imported by: 0

README

Tensorflow + Go codelab

Shows how to load a model and run inference in Go. Slides: http://vmarkovtsev.github.io/codelab-2018-aalborg/

To be used in:

  • 24/04/2018 - Moscow
  • 08/05/2018 - Aalborg
  • ??/06/2018 - Madrid

License

MIT.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ImagenetClasses = [1001]string{}/* 1001 elements not displayed */

ImagenetClasses holds the Imagenet class names. Source github.com/tensorflow/models/research/slim/datasets/imagenet.py

Functions

func GetInputShape

func GetInputShape(graph *tf.Graph) (width, height int)

GetInputShape finds the input image dimensions.

func LoadImage

func LoadImage(path string, width, height int) ([][][3]float32, error)

LoadImage reads an image from FS and converts it to [-1, 1] RGB float32 format.

func RunInference

func RunInference(graph *tf.Graph, session *tf.Session, image [][][3]float32) ([]float32, error)

RunInference executes the model and returns the logits.

Types

type Confidence

type Confidence struct {
	Value float32
	Index int
}

Confidence is a pair of logit value and the corresponding class index.

func SelectTopN

func SelectTopN(confs []float32, n int) []Confidence

SelectTopN chooses the biggest n logits.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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