waitsensor

package
v0.0.0-...-dc1615d Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModelName is the name of the model
	ModelName = "wait-sensor"
	// OverflowLabel is the label if the counts exceed what was specified by the user
	OverflowLabel = "Overflow"
	// DefaultMaxFrequency is how often the vision service will poll the camera for a new image
	DefaultPollFrequency = 1.0
	// DefaultTransitionTime is how long it takes for the state to change by default
	DefaultTransitionTime = 30.0
)

Variables

View Source
var (
	// Model is the resource
	Model = resource.NewModel("viam", "queue-estimator", ModelName)
)

Functions

This section is empty.

Types

type Bin

type Bin struct {
	UpperBound float64
	Label      string
}

Bin stores the thresholds that turns counts into labels

func NewThresholds

func NewThresholds(t map[string]int) []Bin

NewThresholds creates a list of thresholds for labeling counts

type BoundingBox

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

func NewBoundingBox

func NewBoundingBox(coords BoundingBoxConfig) (BoundingBox, error)

func (BoundingBox) Crop

func (bb BoundingBox) Crop(img image.Image) image.Image

crop coordinates were already validated upon configuration empty bounding box implies no crop

type BoundingBoxConfig

type BoundingBoxConfig struct {
	XMin float64 `json:"x_min"`
	XMax float64 `json:"x_max"`
	YMin float64 `json:"y_min"`
	YMax float64 `json:"y_max"`
}

type Config

type Config struct {
	DetectorName    string                         `json:"detector_name"`
	ChosenLabels    map[string]float64             `json:"chosen_labels"`
	CountThresholds map[string]int                 `json:"count_thresholds"`
	CountPeriod     float64                        `json:"sampling_period_s"`
	NSamples        int                            `json:"n_samples"`
	ExtraFields     map[string]interface{}         `json:"extra_fields"`
	ValidRegions    map[string][]BoundingBoxConfig `json:"valid_regions"`
}

Config contains names for necessary resources

func (*Config) Validate

func (cfg *Config) Validate(path string) ([]string, []string, error)

Validate validates the config and returns implicit dependencies, this Validate checks if the camera and detector exist for the module's vision model.

type RingBuffer

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

func NewRingBuffer

func NewRingBuffer(size int) *RingBuffer

func (*RingBuffer) Add

func (rb *RingBuffer) Add(newCount float64)

func (*RingBuffer) Len

func (rb *RingBuffer) Len() int

func (*RingBuffer) Mean

func (rb *RingBuffer) Mean() float64

func (*RingBuffer) MeanLabel

func (rb *RingBuffer) MeanLabel(thresholds []Bin) string

func (*RingBuffer) ModeLabel

func (rb *RingBuffer) ModeLabel(thresholds []Bin) string

func (*RingBuffer) String

func (rb *RingBuffer) String() string

Jump to

Keyboard shortcuts

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