builtin

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Overview

Package builtin is the service that allows you to access various computer vision algorithms (like detection, segmentation, tracking, etc) that usually only require a camera or image input.

Index

Constants

View Source
const (
	TFLiteDetector    = vision.VisModelType("tflite_detector")
	TFDetector        = vision.VisModelType("tf_detector")
	ColorDetector     = vision.VisModelType("color_detector")
	TFLiteClassifier  = vision.VisModelType("tflite_classifier")
	TFClassifier      = vision.VisModelType("tf_classifier")
	RCSegmenter       = vision.VisModelType("radius_clustering_segmenter")
	DetectorSegmenter = vision.VisModelType("detector_segmenter")
)

The set of allowed vision model types.

View Source
const (
	VisDetection      = VisOperation("detection")
	VisClassification = VisOperation("classification")
	VisSegmentation   = VisOperation("segmentation")
)

The set of operations supported by the vision model types.

View Source
const RadiusClusteringSegmenter = "radius_clustering"

RadiusClusteringSegmenter is the name of a segmenter that finds well separated objects on a flat plane.

Variables

This section is empty.

Functions

func ImageToFloatBuffer

func ImageToFloatBuffer(img image.Image) []float32

ImageToFloatBuffer reads an image into a byte slice (buffer) the most common sense way. Left to right like a book; R, then G, then B. No funny stuff. Assumes values between -1 and 1.

func ImageToUInt8Buffer

func ImageToUInt8Buffer(img image.Image) []byte

ImageToUInt8Buffer reads an image into a byte slice in the most common sense way. Left to right like a book; R, then G, then B. No funny stuff. Assumes values should be between 0-255.

func NewBuiltIn

func NewBuiltIn(ctx context.Context, r robot.Robot, config config.Service, logger golog.Logger) (vision.Service, error)

NewBuiltIn registers new detectors from the config and returns a new object detection service for the given robot.

func NewTFLiteClassifier

func NewTFLiteClassifier(ctx context.Context, conf *vision.VisModelConfig,
	logger golog.Logger,
) (classification.Classifier, *inf.TFLiteStruct, error)

NewTFLiteClassifier creates an RDK classifier given a VisModelConfig. In other words, this function returns a function from image-->[]classifier.Classifications. It does this by making calls to an inference package and wrapping the result.

func NewTFLiteDetector

func NewTFLiteDetector(
	ctx context.Context,
	cfg *vision.VisModelConfig,
	logger golog.Logger,
) (objectdetection.Detector, *inf.TFLiteStruct, error)

NewTFLiteDetector creates an RDK detector given a DetectorConfig. In other words, this function returns a function from image-->[]objectdetection.Detection. It does this by making calls to an inference package and wrapping the result.

Types

type TFLiteClassifierConfig

type TFLiteClassifierConfig struct {
	// this should come from the attributes part of the detector config
	ModelPath  string  `json:"model_path"`
	NumThreads int     `json:"num_threads"`
	LabelPath  *string `json:"label_path"`
}

TFLiteClassifierConfig specifies the fields necessary for creating a TFLite classifier.

type TFLiteDetectorConfig

type TFLiteDetectorConfig struct {
	// this should come from the attributes part of the detector config
	ModelPath  string  `json:"model_path"`
	NumThreads int     `json:"num_threads"`
	LabelPath  *string `json:"label_path"`
	ServiceURL *string `json:"service_url"`
}

TFLiteDetectorConfig specifies the fields necessary for creating a TFLite detector.

type VisOperation

type VisOperation string

VisOperation defines what types of operations are allowed by the vision service.

Jump to

Keyboard shortcuts

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