Help us shape the future of Go! Take the 2026 Go Developer Survey

stats

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultQuantiles = []float64{0.01, 0.10, 0.50, 0.90, 0.99}

Functions

func AggregateStats

func AggregateStats(list []EpisodeStats) map[string]map[string]any

func CheckAggregateVisualCoverage added in v1.2.4

func CheckAggregateVisualCoverage(agg map[string]map[string]any, features map[string]FeatureDesc) error

CheckAggregateVisualCoverage reports when aggregated stats omit declared image/video keys.

func CheckStatsFileVisualCoverage added in v1.2.4

func CheckStatsFileVisualCoverage(path string, features map[string]FeatureDesc) error

CheckStatsFileVisualCoverage reports when stats.json omits declared image/video keys.

func MissingDeclaredVisualKeys added in v1.2.4

func MissingDeclaredVisualKeys(statsKeys map[string]any, features map[string]FeatureDesc) []string

MissingDeclaredVisualKeys returns image/video feature keys absent from stats.

func MissingVisualKeys added in v1.2.4

func MissingVisualKeys(ep EpisodeStats, required map[string]string) []string

MissingVisualKeys returns feature keys in required that have no stats entry.

func ToJSONSerializable

func ToJSONSerializable(stats map[string]map[string]any) map[string]map[string]any

Types

type EpisodeInput

type EpisodeInput struct {
	Columns    map[string]any
	FramePaths map[string][]string
	FrameBytes map[string][][]byte
	// VideoFiles maps image/video feature keys to MP4 paths. Used when
	// FramePaths/FrameBytes are empty (ExternalVideos / H264Remux / encode).
	VideoFiles map[string]string
	// Length is the episode frame count, used to sample VideoFiles.
	Length int
	// Locator resolves ffmpeg/ffprobe. Optional; PATH/bundled binaries are used when nil.
	Locator video.Locator
	// Ctx cancels ffmpeg sampling. Optional.
	Ctx context.Context
}

type EpisodeStats

type EpisodeStats map[string]FeatureStats

func ComputeEpisodeStats

func ComputeEpisodeStats(in EpisodeInput, features map[string]FeatureDesc, opts Options) EpisodeStats

func ComputeEpisodeStatsErr added in v1.2.4

func ComputeEpisodeStatsErr(in EpisodeInput, features map[string]FeatureDesc, opts Options) (EpisodeStats, error)

ComputeEpisodeStatsErr is ComputeEpisodeStats but surfaces sampling failures.

func OverlayFromVideos added in v1.2.4

func OverlayFromVideos(existing EpisodeStats, files map[string]string, length int, features map[string]FeatureDesc, opts Options, extra EpisodeInput) (EpisodeStats, error)

OverlayFromVideos fills missing image/video keys by sampling finalized MP4s.

func SanitizeEpisodeStats added in v1.1.0

func SanitizeEpisodeStats(ep EpisodeStats) EpisodeStats

SanitizeEpisodeStats replaces non-finite floats so JSON encoding succeeds.

type FeatureDesc

type FeatureDesc struct {
	DType string
	Shape []int
}

type FeatureStats

type FeatureStats map[string]any

type ImageStat311

type ImageStat311 [][][]float64

ImageStat311 is the (3,1,1) nested layout used by LeRobot image/video stats.

func AsImageStat311 added in v1.2.4

func AsImageStat311(v any) (ImageStat311, bool)

AsImageStat311 coerces in-memory or JSON-decoded (C,1,1) stats.

func ImageStat311FromChannels

func ImageStat311FromChannels(ch []float64) ImageStat311

func (ImageStat311) Channels

func (s ImageStat311) Channels() []float64

type Mode

type Mode int

Mode controls how image/video statistics are computed.

const (
	// ModeSampled matches official compute_episode_stats (estimate_num_samples heuristic).
	ModeSampled Mode = iota
	// ModeFull uses every frame path when computing image/video statistics.
	ModeFull
)

type Options

type Options struct {
	Mode Mode
}

Jump to

Keyboard shortcuts

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