Documentation
¶
Overview ¶
Package edgeimpulse lets you run model processes to classify measurements.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MAF ¶
type MAF struct {
// contains filtered or unexported fields
}
MAF is a moving average filter, for smoothing out classification values.
func NewMAF ¶
NewMAF returns a new moving average filter with a history of given size. Values are initialized to all zeroes.
type ModelParameters ¶
type ModelParameters struct {
ModelType ModelType `json:"model_type"`
Sensor int64 `json:"sensor"`
SensorType SensorType
IntervalMS float64 `json:"interval_ms"`
Frequency float64 `json:"frequency"`
InputFeaturesCount int `json:"input_features_count"`
// For images only.
ImageInputHeight int `json:"image_input_height"`
ImageInputWidth int `json:"image_input_width"`
ImageChannelCount int `json:"image_channel_count"`
// Labels in resulting classifications.
Labels []string `json:"labels"`
LabelCount int `json:"label_count"`
HasAnomaly float64 `json:"has_anomaly"`
}
ModelParameters holds the model parameters for a model.
func (ModelParameters) String ¶
func (p ModelParameters) String() string
String returns a human-readable summary of the model parameters.
type ModelType ¶
type ModelType string
ModelType can be "classification" or "object_detection". May be expanded in the future.
const ( // ModelTypeClassification indicates the model returns scoring values // for a set of labels. ModelTypeClassification ModelType = "classification" // ModelTypeObjectDetection indicates the model returns returns // bounding boxes for recognized objects. ModelTypeObjectDetection ModelType = "object_detection" )
type Project ¶
type Project struct {
DeployVersion int64 `json:"deploy_version"`
ID int64 `json:"id"`
Name string `json:"name"`
Owner string `json:"owner"`
}
Project holds the project information stored in the model, originally from EdgeImpulse Studio.
type Runner ¶
type Runner interface {
ModelParameters() ModelParameters
Project() Project
Classify(data []float64) (RunnerClassifyResponse, error)
Close() error
}
Runner is a running model with model and project parameters, and the ability to classify data.
type RunnerClassifyRequest ¶
RunnerClassifyRequest is a request to the model to classify data.
type RunnerClassifyResponse ¶
type RunnerClassifyResponse struct {
RunnerResponse
Result struct {
// Based on the ModelType, either Classification or BoundingBoxes will be set.
Classification map[string]float64 `json:"classification,omitempty"`
BoundingBoxes []struct {
Label string `json:"label"`
Value float64 `json:"value"`
X int `json:"x"`
Y int `json:"y"`
Width int `json:"width"`
Height int `json:"height"`
} `json:"bounding_boxes,omitempty"`
Anomaly float64 `json:"anomaly,omitempty"`
} `json:"result"`
Timing struct {
DSP float64 `json:"dsp"`
Classification float64 `json:"classification"`
Anomaly float64 `json:"anomaly"`
} `json:"timing"`
}
RunnerClassifyResponse is the response from the model to a RunnerClassifyRequest.
func (RunnerClassifyResponse) String ¶
func (r RunnerClassifyResponse) String() string
String returns a summary of the result, with classification or error message.
type RunnerOpts ¶
type RunnerOpts struct {
// Explicitly set a working directory. This directory is not
// automatically removed on Runner.Close. If empty, a temporary
// directory is created.
WorkDir string
// If not empty, the JSON-encoded requests and responses are written to
// this directory.
TraceDir string
}
RunnerOpts contains options for starting a runner.
type RunnerProcess ¶
type RunnerProcess struct {
// contains filtered or unexported fields
}
RunnerProcess is a running model process that can classify data.
func NewRunnerProcess ¶
func NewRunnerProcess(modelPath string, opts *RunnerOpts) (runner *RunnerProcess, rerr error)
NewRunnerProcess creates and starts a new runner from a model file. Always call Close on a runner, to cleanup any temporary directories.
func (*RunnerProcess) Classify ¶
func (r *RunnerProcess) Classify(data []float64) (resp RunnerClassifyResponse, rerr error)
Classify executes the model on the features and returns the resulting classification.
func (*RunnerProcess) Close ¶
func (r *RunnerProcess) Close() error
Close shuts down the runner, stopping the model process.
func (*RunnerProcess) ModelParameters ¶
func (r *RunnerProcess) ModelParameters() ModelParameters
ModelParameters returns the parameters for this runner.
func (*RunnerProcess) Project ¶
func (r *RunnerProcess) Project() Project
Project returns the project for this runner.
type RunnerResponse ¶
type RunnerResponse struct {
ID int64 `json:"id"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
// contains filtered or unexported fields
}
RunnerResponse represents the basic status of a response from the model.
type SensorType ¶
type SensorType string
SensorType describes the source of measurements/values.
const ( SensorTypeUnknown SensorType = "unknown" SensorTypeMicrophone SensorType = "microphone" SensorTypeAccelerometer SensorType = "accelerometer" SensorTypeCamera SensorType = "camera" )
SensorTypes as source of measurements. Use a matching recorder and classifier, e.g. an audio classifier with a SensorTypeMicrophone.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package audio implements reading audio samples and classifying samples.
|
Package audio implements reading audio samples and classifying samples. |
|
audiocmd
Package audiocmd implements reading audio samples by executing an external command.
|
Package audiocmd implements reading audio samples by executing an external command. |
|
cmd
|
|
|
eimaudio
command
Command eimaudio launches an audio (microphone) model process, records audio from your microphone, and classifies the audio samples using the model.
|
Command eimaudio launches an audio (microphone) model process, records audio from your microphone, and classifies the audio samples using the model. |
|
eimclassify
command
Command eimclassify launches a classification model process, reads features from files named on the command line, and classifies each set of features, printing the results.
|
Command eimclassify launches a classification model process, reads features from files named on the command line, and classifies each set of features, printing the results. |
|
eimcollect
command
Command eimcollect uploads measurements to EdgeImpulse for processing into a model.
|
Command eimcollect uploads measurements to EdgeImpulse for processing into a model. |
|
eimimage
command
Command eimimage launches a model classification process, starts recording images from a camera (eg webcam), and classifies the image, printing the results.
|
Command eimimage launches a model classification process, starts recording images from a camera (eg webcam), and classifies the image, printing the results. |
|
eimimagereq
command
Command eimimagereq reads a classification request and writes a png image.
|
Command eimimagereq reads a classification request and writes a png image. |
|
Package image implements fetching images from video sources, and classifying images.
|
Package image implements fetching images from video sources, and classifying images. |
|
ffmpeg
Package ffmpeg implements an image recorder with the ffmpeg command.
|
Package ffmpeg implements an image recorder with the ffmpeg command. |
|
gstreamer
Package gstreamer implements an image recorder with the gstreamer tools.
|
Package gstreamer implements an image recorder with the gstreamer tools. |
|
imagesnap
Package imagesnap implements an image recorder with the imagesnap command for macOS.
|
Package imagesnap implements an image recorder with the imagesnap command for macOS. |
|
Package ingest helps to send measurement data to edgeimpulse for processing into a model.
|
Package ingest helps to send measurement data to edgeimpulse for processing into a model. |