Deployment metadata spec
This is the specification for the deployment-metadata.json file from Building deployment blocks.
export interface DeploymentMetadataV1 {
version: 1;
// Global deployment counter
deployCounter: number;
// The output classes (for classification)
classes: string[];
// The number of samples to be taken per inference (e.g. 100Hz data, 3 axis, 2 seconds => 200)
samplesPerInference: number;
// Number of axes ((e.g. 100Hz data, 3 axis, 2 seconds => 3)
axesCount: number;
// Frequency of the data
frequency: number;
// TFLite models (already converted and quantized)
tfliteModels: {
// Information about the model type, e.g. quantization parameters
details: KerasModelIODetails;
// Name of the input tensor
inputTensor: string;
// Name of the output tensor
outputTensor: string;
// Path of the model on disk
modelPath: string;
// Calculated arena size when running TFLite in interpreter mode
arenaSize: number;
// Number of values to be passed into the model
inputFrameSize: number;
}[];
// Project information
project: {
name: string;
// API key, only set for deploy blocks with privileged flag and development keys set
apiKey: string | undefined;
};
// Impulse information
impulse: DeploymentMetadataImpulse;
// Sensor guess based on the input
sensor: 'camera' | 'microphone' | 'accelerometer' | undefined;
// Folder locations
folders: {
// Input files are here, the input folder contains 'edge-impulse-sdk', 'model-parameters', 'tflite-model'
input: string;
// Write your output file here
output: string;
};
}
export type ResizeEnum = 'squash' | 'fit-short' | 'fit-long' | 'crop';
export type CropAnchorEnum = 'top-left' | 'top-center' | 'top-right' |
'middle-left' | 'middle-center' | 'middle-right' |
'bottom-left' | 'bottom-center' | 'bottom-right';
export interface CreateImpulseStateInput {
id: number;
type: 'time-series' | 'image';
name: string;
title: string;
windowSizeMs?: number;
windowIncreaseMs?: number;
imageWidth?: number;
imageHeight?: number;
resizeMode?: ResizeEnum;
cropAnchor?: CropAnchorEnum;
}
export interface CreateImpulseStateDsp {
id: number;
type: string | 'custom';
name: string;
axes: string[];
title: string;
customUrl?: string;
}
export interface CreateImpulseStateLearning {
id: number;
type: string;
name: string;
dsp: number[];
title: string;
}
export interface CreateImpulseState {
inputBlocks: CreateImpulseStateInput[];
dspBlocks: CreateImpulseStateDsp[];
learnBlocks: CreateImpulseStateLearning[];
}
export interface DSPConfig {
options: { [k: string ]: string | number | boolean };
}
export type DSPFeatureMetadataOutput = {
type: 'image',
shape: { width: number, height: number, channels: number }
} | {
type: 'spectrogram',
shape: { width: number, height: number }
} | {
type: 'flat',
shape: { width: number }
};
export interface DSPFeatureMetadata {
created: Date;
dspConfig: DSPConfig;
labels: string[]; // the training labels
featureLabels: string[];
valuesPerAxis: number;
windowCount: number;
windowSizeMs: number;
windowIncreaseMs: number;
frequency: number;
includedSamples: { id: number, windowCount: number }[];
outputConfig: DSPFeatureMetadataOutput;
}
/**
* Information necessary to quantize or dequantize the contents of a tensor
*/
export type KerasModelTensorDetails = {
dataType: 'float32'
} | {
dataType: 'int8';
// Scale and zero point are used only for quantized tensors
quantizationScale?: number;
quantizationZeroPoint?: number;
};
export type KerasModelTypeEnum = 'int8' | 'float32' | 'requiresRetrain';
/**
* Information required to process a model's input and output data
*/
export interface KerasModelIODetails {
modelType: KerasModelTypeEnum;
inputs: KerasModelTensorDetails[];
outputs: KerasModelTensorDetails[];
}
export interface DeploymentMetadataImpulse {
inputBlocks: CreateImpulseStateInput[];
dspBlocks: (CreateImpulseStateDsp & { metadata: DSPFeatureMetadata | undefined })[];
learnBlocks: CreateImpulseStateLearning[];
}
Export as PDF
Copy link