curl --request GET \
--url https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId} \
--header 'x-api-key: <api-key>'import requests
url = "https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"classifications": [
{
"learnBlock": {
"id": 2,
"name": "NN Classifier",
"dsp": [
27
],
"title": "Classification (Keras)",
"createdBy": "createImpulse",
"createdAt": "2023-11-07T05:31:56Z"
},
"result": [
{
"idle": 0.0002,
"wave": 0.9998,
"anomaly": -0.42
}
],
"minimumConfidenceRating": 123,
"expectedLabels": [
{
"startIndex": 123,
"endIndex": 123,
"label": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
}
}
],
"thresholds": [
{
"key": "min_score",
"description": "Score threshold",
"helpText": "Threshold score for bounding boxes. If the score for a bounding box is below this the box will be discarded.",
"value": 0.5,
"suggestedValue": 123,
"suggestedValueText": "<string>",
"dropdownOptions": [
{
"description": "<string>",
"value": "<string>"
}
]
}
],
"intervalMs": 123,
"frequencyHz": 123,
"anomalyResult": [
{
"boxes": [
{
"label": "<string>",
"x": 123,
"y": 123,
"width": 123,
"height": 123,
"score": 123
}
],
"scores": [
[
123
]
],
"meanScore": 123,
"maxScore": 123
}
],
"structuredResult": [
{
"boxes": [
[
123
]
],
"scores": [
123
],
"mAP": 123,
"f1": 123,
"precision": 123,
"recall": 123,
"labels": [
"<string>"
],
"debugInfoJson": "{\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"
}
],
"details": [
{
"boxes": [
[
123
]
],
"labels": [
123
],
"scores": [
123
],
"mAP": 123,
"f1": 123
}
],
"expectedAnomalyOutcome": [
{
"startIndex": 123,
"endIndex": 123,
"label": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
}
}
],
"isMultiLabel": true
}
],
"sample": {
"sample": {
"id": 2,
"filename": "idle01.d8Ae",
"signatureValidate": true,
"created": "2023-11-07T05:31:56Z",
"lastModified": "2023-11-07T05:31:56Z",
"category": "training",
"coldstorageFilename": "<string>",
"label": "healthy-machine",
"intervalMs": 16,
"frequency": 62.5,
"originalIntervalMs": 16,
"originalFrequency": 62.5,
"deviceType": "<string>",
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"valuesCount": 123,
"added": "2023-11-07T05:31:56Z",
"boundingBoxes": [
{
"label": "<string>",
"x": 123,
"y": 123,
"width": 123,
"height": 123
}
],
"isDisabled": true,
"isProcessing": true,
"processingError": true,
"isCropped": true,
"projectId": 123,
"sha256Hash": "<string>",
"datastreams": [
{
"index": 123,
"intervalMs": 123,
"frequencyHz": 123,
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"valuesCount": 123,
"totalLengthMs": 123,
"imageDimensions": {
"width": 123,
"height": 123
}
}
],
"signatureMethod": "HS256",
"signatureKey": "<string>",
"deviceName": "<string>",
"totalLengthMs": 123,
"thumbnailVideo": "<string>",
"thumbnailVideoFull": "<string>",
"processingJobId": 123,
"processingErrorString": "<string>",
"metadata": {},
"projectOwnerName": "<string>",
"projectName": "<string>",
"structuredLabels": [
{
"startIndex": 123,
"endIndex": 123,
"label": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
}
}
],
"structuredLabelsList": [
"<string>"
],
"createdBySyntheticDataJobId": 123,
"imageDimensions": {
"width": 123,
"height": 123
},
"videoUrl": "<string>",
"videoUrlFull": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
},
"lastUpdatedBy": {
"type": "user",
"id": 123
}
},
"payload": {
"device_type": "DISCO-L475VG-IOT01A",
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"values": [
[
123
]
],
"intervalMs": 16,
"frequencyHz": 62.5,
"device_name": "ac:87:a3:0a:2d:1b",
"cropStart": 0,
"cropEnd": 128
},
"totalPayloadLength": 123,
"datastreamPayloads": [
{
"index": 123,
"payload": {
"device_type": "DISCO-L475VG-IOT01A",
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"values": [
[
123
]
],
"intervalMs": 16,
"frequencyHz": 62.5,
"device_name": "ac:87:a3:0a:2d:1b",
"cropStart": 0,
"cropEnd": 128
},
"totalPayloadLength": 123
}
]
},
"windowSizeMs": 2996,
"windowIncreaseMs": 10,
"alreadyInDatabase": true,
"error": "<string>",
"warning": "<string>"
}Classify sample by learn block
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.
curl --request GET \
--url https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId} \
--header 'x-api-key: <api-key>'import requests
url = "https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://studio.edgeimpulse.com/v1/api/{projectId}/classify/anomaly-gmm/{blockId}/{sampleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"classifications": [
{
"learnBlock": {
"id": 2,
"name": "NN Classifier",
"dsp": [
27
],
"title": "Classification (Keras)",
"createdBy": "createImpulse",
"createdAt": "2023-11-07T05:31:56Z"
},
"result": [
{
"idle": 0.0002,
"wave": 0.9998,
"anomaly": -0.42
}
],
"minimumConfidenceRating": 123,
"expectedLabels": [
{
"startIndex": 123,
"endIndex": 123,
"label": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
}
}
],
"thresholds": [
{
"key": "min_score",
"description": "Score threshold",
"helpText": "Threshold score for bounding boxes. If the score for a bounding box is below this the box will be discarded.",
"value": 0.5,
"suggestedValue": 123,
"suggestedValueText": "<string>",
"dropdownOptions": [
{
"description": "<string>",
"value": "<string>"
}
]
}
],
"intervalMs": 123,
"frequencyHz": 123,
"anomalyResult": [
{
"boxes": [
{
"label": "<string>",
"x": 123,
"y": 123,
"width": 123,
"height": 123,
"score": 123
}
],
"scores": [
[
123
]
],
"meanScore": 123,
"maxScore": 123
}
],
"structuredResult": [
{
"boxes": [
[
123
]
],
"scores": [
123
],
"mAP": 123,
"f1": 123,
"precision": 123,
"recall": 123,
"labels": [
"<string>"
],
"debugInfoJson": "{\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"
}
],
"details": [
{
"boxes": [
[
123
]
],
"labels": [
123
],
"scores": [
123
],
"mAP": 123,
"f1": 123
}
],
"expectedAnomalyOutcome": [
{
"startIndex": 123,
"endIndex": 123,
"label": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
}
}
],
"isMultiLabel": true
}
],
"sample": {
"sample": {
"id": 2,
"filename": "idle01.d8Ae",
"signatureValidate": true,
"created": "2023-11-07T05:31:56Z",
"lastModified": "2023-11-07T05:31:56Z",
"category": "training",
"coldstorageFilename": "<string>",
"label": "healthy-machine",
"intervalMs": 16,
"frequency": 62.5,
"originalIntervalMs": 16,
"originalFrequency": 62.5,
"deviceType": "<string>",
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"valuesCount": 123,
"added": "2023-11-07T05:31:56Z",
"boundingBoxes": [
{
"label": "<string>",
"x": 123,
"y": 123,
"width": 123,
"height": 123
}
],
"isDisabled": true,
"isProcessing": true,
"processingError": true,
"isCropped": true,
"projectId": 123,
"sha256Hash": "<string>",
"datastreams": [
{
"index": 123,
"intervalMs": 123,
"frequencyHz": 123,
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"valuesCount": 123,
"totalLengthMs": 123,
"imageDimensions": {
"width": 123,
"height": 123
}
}
],
"signatureMethod": "HS256",
"signatureKey": "<string>",
"deviceName": "<string>",
"totalLengthMs": 123,
"thumbnailVideo": "<string>",
"thumbnailVideoFull": "<string>",
"processingJobId": 123,
"processingErrorString": "<string>",
"metadata": {},
"projectOwnerName": "<string>",
"projectName": "<string>",
"structuredLabels": [
{
"startIndex": 123,
"endIndex": 123,
"label": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
}
}
],
"structuredLabelsList": [
"<string>"
],
"createdBySyntheticDataJobId": 123,
"imageDimensions": {
"width": 123,
"height": 123
},
"videoUrl": "<string>",
"videoUrlFull": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
},
"lastUpdatedBy": {
"type": "user",
"id": 123
}
},
"payload": {
"device_type": "DISCO-L475VG-IOT01A",
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"values": [
[
123
]
],
"intervalMs": 16,
"frequencyHz": 62.5,
"device_name": "ac:87:a3:0a:2d:1b",
"cropStart": 0,
"cropEnd": 128
},
"totalPayloadLength": 123,
"datastreamPayloads": [
{
"index": 123,
"payload": {
"device_type": "DISCO-L475VG-IOT01A",
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"values": [
[
123
]
],
"intervalMs": 16,
"frequencyHz": 62.5,
"device_name": "ac:87:a3:0a:2d:1b",
"cropStart": 0,
"cropEnd": 128
},
"totalPayloadLength": 123
}
]
},
"windowSizeMs": 2996,
"windowIncreaseMs": 10,
"alreadyInDatabase": true,
"error": "<string>",
"warning": "<string>"
}Authorizations
Path Parameters
Project ID
Sample ID
Block ID
Response
OK
Whether the operation succeeded
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Size of the sliding window (as set by the impulse) in milliseconds.
2996
Number of milliseconds that the sliding window increased with (as set by the impulse)
10
Whether this sample is already in the training database
Optional error description (set if 'success' was false)
Was this page helpful?