Edge Impulse Classify API
The Classify API from Edge Impulse — 10 operation(s) for classify.
The Classify API from Edge Impulse — 10 operation(s) for classify.
openapi: 3.0.0
info:
title: Edge Impulse Classify API
version: 1.0.0
servers:
- url: https://studio.edgeimpulse.com/v1
security:
- ApiKeyAuthentication: []
- JWTAuthentication: []
- JWTHttpHeaderAuthentication: []
tags:
- name: Classify
paths:
/api/{projectId}/classify/{sampleId}:
get:
summary: Classify sample (deprecated)
description: This API is deprecated, use classifySampleV2 instead (`/v1/api/{projectId}/classify/v2/{sampleId}`). Classify a complete file against the current impulse. This will move the sliding window (dependent on the sliding window length and the sliding window increase parameters in the impulse) over the complete file, and classify for every window that is extracted.
operationId: classifySample
tags:
- Classify
x-middleware:
- AllowsReadOnly
parameters:
- $ref: '#/components/parameters/ProjectIdParameter'
- $ref: '#/components/parameters/SampleIdParameter'
- $ref: '#/components/parameters/IncludeDebugInfoParameter'
- $ref: '#/components/parameters/OptionalImpulseIdParameter'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ClassifySampleResponse'
/api/{projectId}/classify/v2/{sampleId}:
post:
summary: Classify sample
description: 'Classify a complete file against the current impulse. This will move the sliding window (dependent on
the sliding window length and the sliding window increase parameters in the impulse) over the complete
file, and classify for every window that is extracted. Depending on the size of your file, whether your
sample is resampled, and whether the result is cached you''ll get either the result or a job back. If
you receive a job, then wait for the completion of the job, and then call this function again to receive
the results. The unoptimized (float32) model is used by default, and classification with an optimized
(int8) model can be slower.
'
operationId: classifySampleV2
tags:
- Classify
x-middleware:
- AllowsReadOnly
parameters:
- $ref: '#/components/parameters/ProjectIdParameter'
- $ref: '#/components/parameters/SampleIdParameter'
- $ref: '#/components/parameters/IncludeDebugInfoParameter'
- $ref: '#/components/parameters/ModelVariantParameter'
- $ref: '#/components/parameters/OptionalImpulseIdParameter'
responses:
'200':
description: OK
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ClassifySampleResponse'
- $ref: '#/components/schemas/StartJobResponse'
/api/{projectId}/classify/v2/{sampleId}/variants:
post:
summary: Classify sample for the given set of variants
description: 'Classify a complete file against the current impulse, for all given variants.
Depending on the size of your file and whether the sample is resampled, you may get a job ID in
the response.
'
operationId: classifySampleForVariants
tags:
- Classify
x-middleware:
- AllowsReadOnly
parameters:
- $ref: '#/components/parameters/ProjectIdParameter'
- $ref: '#/components/parameters/SampleIdParameter'
- $ref: '#/components/parameters/IncludeDebugInfoParameter'
- $ref: '#/components/parameters/ModelVariantsListParameter'
- $ref: '#/components/parameters/OptionalImpulseIdParameter'
responses:
'200':
description: OK
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ClassifySampleResponseMultipleVariants'
- $ref: '#/components/schemas/StartJobResponse'
/api/{projectId}/classify/v2/{sampleId}/raw-data/{windowIndex}:
get:
summary: Get a window of raw sample features from cache, after a live classification job has completed.
description: 'Get raw sample features for a particular window. This is only available after a live classification job
has completed and raw features have been cached.
'
operationId: getSampleWindowFromCache
tags:
- Classify
x-middleware:
- AllowsReadOnly
parameters:
- $ref: '#/components/parameters/ProjectIdParameter'
- $ref: '#/components/parameters/SampleIdParameter'
- $ref: '#/components/parameters/SampleWindowIndexParameter'
- $ref: '#/components/parameters/OptionalImpulseIdParameter'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GetSampleResponse'
/api/{projectId}/classify/all/result:
get:
summary: Classify job result
description: Get classify job result, containing the result for the complete testing dataset.
operationId: getClassifyJobResult
tags:
- Classify
x-middleware:
- AllowsReadOnly
parameters:
- $ref: '#/components/parameters/ProjectIdParameter'
- $ref: '#/components/parameters/FeatureExplorerOnlyParameter'
- $ref: '#/components/parameters/ModelVariantParameter'
- $ref: '#/components/parameters/OptionalImpulseIdParameter'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ClassifyJobResponse'
/api/{projectId}/classify/all/result/page:
get:
summary: Single page of a classify job result
description: Get classify job result, containing the predictions for a given page.
operationId: getClassifyJobResultPage
tags:
- Classify
x-middleware:
- AllowsReadOnly
parameters:
- $ref: '#/components/parameters/ProjectIdParameter'
- $ref: '#/components/parameters/LimitResultsParameter'
- $ref: '#/components/parameters/OffsetResultsParameter'
- $ref: '#/components/parameters/ModelVariantParameter'
- $ref: '#/components/parameters/OptionalImpulseIdParameter'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ClassifyJobResponsePage'
/api/{projectId}/classify/all/metrics:
get:
summary: Get metrics for all available model variants
description: Get metrics, calculated during a classify all job, for all available model variants. This is experimental and may change in the future.
x-internal-api: true
operationId: getClassifyMetricsAllVariants
tags:
- Classify
x-middleware:
- AllowsReadOnly
parameters:
- $ref: '#/components/parameters/ProjectIdParameter'
- $ref: '#/components/parameters/OptionalImpulseIdParameter'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MetricsAllVariantsResponse'
/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}:
get:
summary: Classify sample by learn block
description: This API is deprecated, use classifySampleByLearnBlockV2 (`/v1/api/{projectId}/classify/anomaly-gmm/v2/{blockId}/{sampleId}`) instead. Classify a complete file against the specified learn block. This will move the sliding window (dependent on the sliding window length and the sliding window increase parameters in the impulse) over the complete file, and classify for every window that is extracted.
operationId: classifySampleByLearnBlock
tags:
- Classify
x-middleware:
- AllowsReadOnly
parameters:
- $ref: '#/components/parameters/ProjectIdParameter'
- $ref: '#/components/parameters/SampleIdParameter'
- $ref: '#/components/parameters/BlockIdParameter'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ClassifySampleResponse'
/api/{projectId}/classify/anomaly-gmm/v2/{blockId}/{sampleId}:
post:
summary: Classify sample by learn block
description: 'Classify a complete file against the specified learn block. This will move the sliding window
(dependent on the sliding window length and the sliding window increase parameters in the impulse)
over the complete file, and classify for every window that is extracted. Depending on the size of your
file, whether your sample is resampled, and whether the result is cached you''ll get either the result
or a job back. If you receive a job, then wait for the completion of the job, and then call this
function again to receive the results. The unoptimized (float32) model is used by default, and
classification with an optimized (int8) model can be slower.
'
operationId: classifySampleByLearnBlockV2
tags:
- Classify
x-middleware:
- AllowsReadOnly
parameters:
- $ref: '#/components/parameters/ProjectIdParameter'
- $ref: '#/components/parameters/SampleIdParameter'
- $ref: '#/components/parameters/BlockIdParameter'
- $ref: '#/components/parameters/ModelVariantParameter'
responses:
'200':
description: OK
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ClassifySampleResponse'
- $ref: '#/components/schemas/StartJobResponse'
/api/{projectId}/classify/image:
post:
summary: Classify an image
description: Test out a trained impulse (using a posted image).
operationId: classifyImage
tags:
- Classify
parameters:
- $ref: '#/components/parameters/ProjectIdParameter'
- $ref: '#/components/parameters/OptionalImpulseIdParameter'
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/UploadImageRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/TestPretrainedModelResponse'
components:
schemas:
KerasModelVariantEnum:
type: string
enum:
- int8
- float32
- akida
ModelResult:
type: object
required:
- sampleId
- sample
- classifications
properties:
sampleId:
type: integer
sample:
$ref: '#/components/schemas/Sample'
classifications:
type: array
items:
$ref: '#/components/schemas/ClassifySampleResponseClassification'
UploadImageRequest:
type: object
required:
- image
properties:
image:
type: string
format: binary
MetricsAllVariantsResponse:
allOf:
- $ref: '#/components/schemas/GenericApiResponse'
- type: object
properties:
metrics:
type: array
items:
$ref: '#/components/schemas/MetricsForModelVariant'
StartJobResponse:
allOf:
- $ref: '#/components/schemas/GenericApiResponse'
- type: object
required:
- id
properties:
id:
type: integer
description: Job identifier. Status updates will include this identifier.
example: 12873488112
ClassifySampleResponseClassificationDetails:
type: object
properties:
boxes:
type: array
description: Bounding boxes predicted by localization model
items:
type: array
items:
type: number
labels:
type: array
description: Labels predicted by localization model
items:
type: number
scores:
type: array
description: Scores predicted by localization model
items:
type: number
mAP:
type: number
description: For object detection, the COCO mAP computed for the predictions on this image
f1:
type: number
description: For FOMO, the F1 score computed for the predictions on this image
ClassifySampleResponseClassification:
type: object
required:
- learnBlock
- result
- expectedLabels
- minimumConfidenceRating
properties:
learnBlock:
$ref: '#/components/schemas/ImpulseLearnBlock'
result:
type: array
description: Classification result, one item per window.
example:
- idle: 0.0002
wave: 0.9998
anomaly: -0.42
items:
type: object
description: Classification value per label. For a neural network this will be the confidence, for anomalies the anomaly score.
additionalProperties:
type: number
anomalyResult:
type: array
description: Anomaly scores and computed metrics for visual anomaly detection, one item per window.
items:
$ref: '#/components/schemas/AnomalyResult'
structuredResult:
type: array
description: Results of inferencing that returns structured data, such as object detection
items:
$ref: '#/components/schemas/StructuredClassifyResult'
minimumConfidenceRating:
type: number
description: The minimum confidence rating for this block. For regression, this is the absolute error (which can be larger than 1).
details:
type: array
description: Structured outputs and computed metrics for some model types (e.g. object detection), one item per window.
items:
$ref: '#/components/schemas/ClassifySampleResponseClassificationDetails'
objectDetectionLastLayer:
$ref: '#/components/schemas/ObjectDetectionLastLayer'
expectedLabels:
type: array
description: An array with an expected label per window.
items:
$ref: '#/components/schemas/StructuredLabel'
MetricsForModelVariant:
type: object
required:
- variant
properties:
variant:
description: The model variant
$ref: '#/components/schemas/KerasModelVariantEnum'
accuracy:
description: The overall accuracy for the given model variant
type: number
ClassifyJobResponsePage:
allOf:
- $ref: '#/components/schemas/GenericApiResponse'
- type: object
required:
- result
- predictions
properties:
result:
type: array
items:
$ref: '#/components/schemas/ModelResult'
predictions:
type: array
items:
$ref: '#/components/schemas/ModelPrediction'
GetSampleResponse:
allOf:
- $ref: '#/components/schemas/GenericApiResponse'
- $ref: '#/components/schemas/RawSampleData'
TestPretrainedModelResponse:
allOf:
- $ref: '#/components/schemas/GenericApiResponse'
- type: object
properties:
result:
type: object
description: Classification value per label. For a neural network this will be the confidence, for anomalies the anomaly score.
additionalProperties:
type: number
boundingBoxes:
type: array
items:
$ref: '#/components/schemas/BoundingBoxWithScore'
AdditionalMetric:
type: object
required:
- name
- value
- fullPrecisionValue
properties:
name:
type: string
value:
type: string
fullPrecisionValue:
type: number
tooltipText:
type: string
link:
type: string
ImpulseLearnBlock:
type: object
required:
- id
- type
- name
- dsp
- title
- primaryVersion
properties:
id:
type: integer
minimum: 1
description: Identifier for this block. Make sure to up this number when creating a new block, and don't re-use identifiers. If the block hasn't changed, keep the ID as-is. ID must be unique across the project and greather than zero (>0).
type:
$ref: '#/components/schemas/LearnBlockType'
name:
type: string
description: Block name, will be used in menus. If a block has a baseBlockId, this field is ignored and the base block's name is used instead.
example: NN Classifier
dsp:
type: array
description: DSP dependencies, identified by DSP block ID
items:
type: integer
example: 27
title:
type: string
description: Block title, used in the impulse UI
example: Classification (Keras)
description:
type: string
description: A short description of the block version, displayed in the block versioning UI
example: Reduced learning rate and more layers
createdBy:
type: string
description: The system component that created the block version (createImpulse | clone | tuner). Cannot be set via API.
example: createImpulse
createdAt:
type: string
format: date-time
description: The datetime that the block version was created. Cannot be set via API.
Sensor:
type: object
required:
- name
- units
properties:
name:
type: string
description: Name of the axis
example: accX
units:
type: string
description: Type of data on this axis. Needs to comply to SenML units (see https://www.iana.org/assignments/senml/senml.xhtml).
BoundingBoxWithScore:
type: object
description: This has the _ratio_ for x/y/w/h (so 0..1)
required:
- label
- x
- y
- width
- height
- score
properties:
label:
type: string
x:
type: number
y:
type: number
width:
type: number
height:
type: number
score:
type: number
GenericApiResponse:
type: object
required:
- success
properties:
success:
type: boolean
description: Whether the operation succeeded
error:
type: string
description: Optional error description (set if 'success' was false)
BoundingBox:
type: object
description: This has the _absolute values_ for x/y/w/h (so 0..x (where x is the w/h of the image))
required:
- label
- x
- y
- width
- height
properties:
label:
type: string
x:
type: integer
y:
type: integer
width:
type: integer
height:
type: integer
AnomalyResult:
type: object
properties:
boxes:
type: array
description: For visual anomaly detection. An array of bounding box objects, (x, y, width, height, score, label), one per detection in the image. Filtered by the minimum confidence rating of the learn block.
items:
$ref: '#/components/schemas/BoundingBoxWithScore'
scores:
type: array
description: 2D array of shape (n, n) with raw anomaly scores for visual anomaly detection, where n can be calculated as ((1/8 of image input size)/2 - 1). The scores corresponds to each grid cell in the image's spatial matrix.
items:
type: array
items:
type: number
meanScore:
type: number
description: Mean value of the scores.
maxScore:
type: number
description: Maximum value of the scores.
ObjectDetectionLastLayer:
type: string
enum:
- mobilenet-ssd
- fomo
- yolov2-akida
- yolov5
- yolov5v5-drpai
- yolox
- yolov7
- tao-retinanet
- tao-ssd
- tao-yolov3
- tao-yolov4
RawSampleData:
type: object
required:
- sample
- payload
- totalPayloadLength
properties:
sample:
$ref: '#/components/schemas/Sample'
payload:
$ref: '#/components/schemas/RawSamplePayload'
totalPayloadLength:
type: integer
description: Total number of payload values
StructuredClassifyResult:
type: object
required:
- boxes
- scores
- mAP
- f1
- precision
- recall
properties:
boxes:
type: array
description: For object detection. An array of bounding box arrays, (x, y, width, height), one per detection in the image.
items:
type: array
items:
type: number
labels:
type: array
description: For object detection. An array of labels, one per detection in the image.
items:
type: string
scores:
type: array
description: For object detection. An array of probability scores, one per detection in the image.
items:
type: number
mAP:
type: number
description: For object detection. A score that indicates accuracy compared to the ground truth, if available.
f1:
type: number
description: For FOMO. A score that combines the precision and recall of a classifier into a single metric, if available.
precision:
type: number
description: A measure of how many of the positive predictions made are correct (true positives).
recall:
type: number
description: A measure of how many of the positive cases the classifier correctly predicted, over all the positive cases.
debugInfoJson:
type: string
description: Debug info in JSON format
example: "{\n \"y_trues\": [\n {\"x\": 0.854, \"y\": 0.453125, \"label\": 1},\n {\"x\": 0.197, \"y\": 0.53125, \"label\": 2}\n ],\n \"y_preds\": [\n {\"x\": 0.916, \"y\": 0.875, \"label\": 1},\n {\"x\": 0.25, \"y\": 0.541, \"label\": 2}\n ],\n \"assignments\": [\n {\"yp\": 1, \"yt\": 1, \"label\": 2, \"distance\": 0.053}\n ],\n \"normalised_min_distance\": 0.2,\n \"all_pairwise_distances\": [\n [0, 0, 0.426],\n [1, 1, 0.053]\n ],\n \"unassigned_y_true_idxs\": [0],\n \"unassigned_y_pred_idxs\": [0]\n}\n"
ClassifySampleResponseMultipleVariants:
allOf:
- $ref: '#/components/schemas/GenericApiResponse'
- type: object
required:
- classifications
- sample
- windowSizeMs
- windowIncreaseMs
- alreadyInDatabase
properties:
results:
type: array
items:
$ref: '#/components/schemas/ClassifySampleResponseVariantResults'
sample:
$ref: '#/components/schemas/RawSampleData'
windowSizeMs:
type: integer
description: Size of the sliding window (as set by the impulse) in milliseconds.
example: 2996
windowIncreaseMs:
type: integer
description: Number of milliseconds that the sliding window increased with (as set by the impulse)
example: 10
alreadyInDatabase:
type: boolean
description: Whether this sample is already in the training database
ClassifySampleResponse:
allOf:
- $ref: '#/components/schemas/GenericApiResponse'
- type: object
required:
- classifications
- sample
- windowSizeMs
- windowIncreaseMs
- alreadyInDatabase
properties:
classifications:
type: array
items:
$ref: '#/components/schemas/ClassifySampleResponseClassification'
sample:
$ref: '#/components/schemas/RawSampleData'
windowSizeMs:
type: integer
description: Size of the sliding window (as set by the impulse) in milliseconds.
example: 2996
windowIncreaseMs:
type: integer
description: Number of milliseconds that the sliding window increased with (as set by the impulse)
example: 10
alreadyInDatabase:
type: boolean
description: Whether this sample is already in the training database
warning:
type: string
ModelPrediction:
type: object
required:
- sampleId
- startMs
- endMs
- prediction
properties:
sampleId:
type: integer
startMs:
type: number
endMs:
type: number
label:
type: string
prediction:
type: string
predictionCorrect:
type: boolean
f1Score:
type: number
description: Only set for object detection projects
anomalyScores:
type: array
description: Only set for visual anomaly projects. 2D array of shape (n, n) with raw anomaly scores, where n varies based on the image input size and the specific visual anomaly algorithm used. The scores corresponds to each grid cell in the image's spatial matrix.
items:
type: array
items:
type: number
RawSamplePayload:
type: object
description: Sensor readings and metadata
required:
- device_type
- sensors
- values
properties:
device_name:
type: string
description: Unique identifier for this device. **Only** set this when the device has a globally unique identifier (e.g. MAC address).
example: ac:87:a3:0a:2d:1b
device_type:
type: string
description: Device type, for example the exact model of the device. Should be the same for all similar devices.
example: DISCO-L475VG-IOT01A
sensors:
type: array
description: Array with sensor axes
items:
$ref: '#/components/schemas/Sensor'
values:
type: array
description: 'Array of sensor values. One array item per interval, and as many items in this array as there are sensor axes. This type is returned if there are multiple axes.
'
items:
type: array
items:
type: number
cropStart:
type: integer
description: New start index of the cropped sample
example: 0
cropEnd:
type: integer
description: New end index of the cropped sample
example: 128
ClassifySampleResponseVariantResults:
type: object
required:
- variant
- classifications
properties:
variant:
description: The model variant
$ref: '#/components/schemas/KerasModelVariantEnum'
classifications:
type: array
items:
$ref: '#/components/schemas/ClassifySampleResponseClassification'
StructuredLabel:
type: object
description: 'A structured label contains a label, and the range for which this label is valid. `endIndex` is inclusive. E.g. `{ startIndex: 10, endIndex: 13, label: ''running'' }` means that the values at index 10, 11, 12, 13 are labeled ''running''. To get time codes you can multiple by the sample''s `intervalMs` property.'
required:
- startIndex
- endIndex
- label
properties:
startIndex:
type: integer
description: Start index of the label (e.g. 0)
endIndex:
type: integer
description: 'End index of the label (e.g. 3). This value is inclusive, so { startIndex: 0, endIndex: 3 } covers 0, 1, 2, 3.'
label:
type: string
description: The label for this section.
Sample:
type: object
required:
- id
- filename
- signatureValidate
- created
- lastModified
- category
- coldstorageFilename
- label
- intervalMs
- frequency
- originalIntervalMs
- originalFrequency
- deviceType
- sensors
- valuesCount
- added
- boundingBoxes
- boundingBoxesType
- chartType
- isDisabled
- isProcessing
- processingError
- isCropped
- projectId
- sha256Hash
properties:
id:
type: integer
example: 2
filename:
type: string
example: idle01.d8Ae
signatureValidate:
type: boolean
description: Whether signature validation passed
example: true
signatureMethod:
type: string
example: HS256
signatureKey:
type: string
description: Either the shared key or the public key that was used to validate the sample
created:
type: string
format: date-time
description: Timestamp when the sample was created on device, or if no accurate time was known on device, the time that the file was processed by the ingestion service.
lastModified:
type: string
format: date-time
description: Timestamp when the sample was last modified.
category:
type: string
example: training
coldstorageFilename:
type: string
label:
type: string
example: healthy-machine
intervalMs:
type: number
description: Interval between two windows (1000 / frequency). If the data was resampled, then this lists the resampled interval.
example: 16
frequency:
type: number
description: Frequency of the sample. If the data was resampled, then this lists the resampled frequency.
example: 62.5
originalIntervalMs:
type: number
description: Interval between two windows (1000 / frequency) in the source data (before resampling).
example: 16
originalFrequency:
type: number
description: Frequency of the sample in the source data (before resampling).
example: 62.5
deviceName:
type: string
deviceType:
type: string
sensors:
type: array
items:
$ref: '#/components/schemas/Sensor'
valuesCount:
type: integer
description: Number of readings in this file
totalLengthMs:
type: number
description: Total length (in ms.) of this file
added:
type: string
format: date-time
description: Timestamp when the sample was added to the current acquisition bucket.
boundingBoxes:
type: array
items:
$ref: '#/components/schemas/BoundingBox'
boundingBoxesType:
type: string
enum:
- object_detection
- constrained_object_detection
chartType:
type: string
enum:
- chart
- image
- video
- table
thumbnailVideo:
type: string
thumbnailVideoFull:
type: string
isDisabled:
type: boolean
description: True if the current sample is excluded from use
isProcessing:
type: boolean
description: True if the current sample is still processing (e.g. for video)
processingJobId:
type: integer
description: Set when sample is processing and a job has picked up the request
processingError:
type: boolean
description: Set when processing this sample failed
processingErrorString:
type: string
description: Error (only set when processing this sample failed)
isCropped:
type: boolean
description: Whether the
# --- truncated at 32 KB (38 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/edge-impulse/refs/heads/main/openapi/edge-impulse-classify-api-openapi.yml