edge-impulse-linux 1.9.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/library/sensors/gstreamer.d.ts +6 -2
- package/build/library/sensors/gstreamer.js +31 -12
- package/build/library/sensors/gstreamer.js.map +1 -1
- package/build/sdk/studio/sdk/api/classifyApi.d.ts +20 -0
- package/build/sdk/studio/sdk/api/classifyApi.js +86 -0
- package/build/sdk/studio/sdk/api/classifyApi.js.map +1 -1
- package/build/sdk/studio/sdk/api/jobsApi.d.ts +26 -0
- package/build/sdk/studio/sdk/api/jobsApi.js +168 -0
- package/build/sdk/studio/sdk/api/jobsApi.js.map +1 -1
- package/build/sdk/studio/sdk/api/organizationBlocksApi.d.ts +12 -0
- package/build/sdk/studio/sdk/api/organizationBlocksApi.js +79 -0
- package/build/sdk/studio/sdk/api/organizationBlocksApi.js.map +1 -1
- package/build/sdk/studio/sdk/api/organizationJobsApi.d.ts +2 -0
- package/build/sdk/studio/sdk/api/organizationJobsApi.js +4 -0
- package/build/sdk/studio/sdk/api/organizationJobsApi.js.map +1 -1
- package/build/sdk/studio/sdk/api/projectsApi.d.ts +107 -0
- package/build/sdk/studio/sdk/api/projectsApi.js +735 -26
- package/build/sdk/studio/sdk/api/projectsApi.js.map +1 -1
- package/build/sdk/studio/sdk/api/rawDataApi.d.ts +147 -10
- package/build/sdk/studio/sdk/api/rawDataApi.js +561 -10
- package/build/sdk/studio/sdk/api/rawDataApi.js.map +1 -1
- package/build/sdk/studio/sdk/api/userApi.d.ts +16 -1
- package/build/sdk/studio/sdk/api/userApi.js +72 -1
- package/build/sdk/studio/sdk/api/userApi.js.map +1 -1
- package/build/sdk/studio/sdk/model/aIAction.d.ts +51 -0
- package/build/sdk/studio/sdk/model/aIAction.js +69 -0
- package/build/sdk/studio/sdk/model/aIAction.js.map +1 -0
- package/build/sdk/studio/sdk/model/aIActionLastPreviewState.d.ts +31 -0
- package/build/sdk/studio/sdk/model/aIActionLastPreviewState.js +37 -0
- package/build/sdk/studio/sdk/model/aIActionLastPreviewState.js.map +1 -0
- package/build/sdk/studio/sdk/model/aIActionLastPreviewStateProposedChanges.d.ts +27 -0
- package/build/sdk/studio/sdk/model/aIActionLastPreviewStateProposedChanges.js +34 -0
- package/build/sdk/studio/sdk/model/aIActionLastPreviewStateProposedChanges.js.map +1 -0
- package/build/sdk/studio/sdk/model/aIActionsConfig.d.ts +44 -0
- package/build/sdk/studio/sdk/model/aIActionsConfig.js +49 -0
- package/build/sdk/studio/sdk/model/aIActionsConfig.js.map +1 -0
- package/build/sdk/studio/sdk/model/aIActionsDataCategory.d.ts +13 -0
- package/build/sdk/studio/sdk/model/aIActionsDataCategory.js +16 -0
- package/build/sdk/studio/sdk/model/aIActionsDataCategory.js.map +1 -0
- package/build/sdk/studio/sdk/model/addOrganizationTransformationBlockRequest.d.ts +6 -0
- package/build/sdk/studio/sdk/model/addOrganizationTransformationBlockRequest.js +10 -0
- package/build/sdk/studio/sdk/model/addOrganizationTransformationBlockRequest.js.map +1 -1
- package/build/sdk/studio/sdk/model/additionalMetric.d.ts +1 -0
- package/build/sdk/studio/sdk/model/additionalMetric.js +5 -0
- package/build/sdk/studio/sdk/model/additionalMetric.js.map +1 -1
- package/build/sdk/studio/sdk/model/batchAddMetadataRequest.d.ts +26 -0
- package/build/sdk/studio/sdk/model/batchAddMetadataRequest.js +34 -0
- package/build/sdk/studio/sdk/model/batchAddMetadataRequest.js.map +1 -0
- package/build/sdk/studio/sdk/model/batchClearMetadataByKeyRequest.d.ts +25 -0
- package/build/sdk/studio/sdk/model/batchClearMetadataByKeyRequest.js +29 -0
- package/build/sdk/studio/sdk/model/batchClearMetadataByKeyRequest.js.map +1 -0
- package/build/sdk/studio/sdk/model/createAIActionResponse.d.ts +33 -0
- package/build/sdk/studio/sdk/model/createAIActionResponse.js +39 -0
- package/build/sdk/studio/sdk/model/createAIActionResponse.js.map +1 -0
- package/build/sdk/studio/sdk/model/createPreviewAIActionsJobRequest.d.ts +35 -0
- package/build/sdk/studio/sdk/model/createPreviewAIActionsJobRequest.js +39 -0
- package/build/sdk/studio/sdk/model/createPreviewAIActionsJobRequest.js.map +1 -0
- package/build/sdk/studio/sdk/model/dSPGroupItem.d.ts +1 -0
- package/build/sdk/studio/sdk/model/dSPGroupItem.js +5 -0
- package/build/sdk/studio/sdk/model/dSPGroupItem.js.map +1 -1
- package/build/sdk/studio/sdk/model/detailedImpulse.d.ts +4 -0
- package/build/sdk/studio/sdk/model/detailedImpulse.js +5 -0
- package/build/sdk/studio/sdk/model/detailedImpulse.js.map +1 -1
- package/build/sdk/studio/sdk/model/environmentVariable.d.ts +32 -0
- package/build/sdk/studio/sdk/model/environmentVariable.js +34 -0
- package/build/sdk/studio/sdk/model/environmentVariable.js.map +1 -0
- package/build/sdk/studio/sdk/model/getAIActionResponse.d.ts +34 -0
- package/build/sdk/studio/sdk/model/getAIActionResponse.js +39 -0
- package/build/sdk/studio/sdk/model/getAIActionResponse.js.map +1 -0
- package/build/sdk/studio/sdk/model/getAIActionResponseAllOf.d.ts +26 -0
- package/build/sdk/studio/sdk/model/getAIActionResponseAllOf.js +29 -0
- package/build/sdk/studio/sdk/model/getAIActionResponseAllOf.js.map +1 -0
- package/build/sdk/studio/sdk/model/getAIActionsProposedChangesResponse.d.ts +34 -0
- package/build/sdk/studio/sdk/model/getAIActionsProposedChangesResponse.js +39 -0
- package/build/sdk/studio/sdk/model/getAIActionsProposedChangesResponse.js.map +1 -0
- package/build/sdk/studio/sdk/model/getAIActionsProposedChangesResponseAllOf.d.ts +26 -0
- package/build/sdk/studio/sdk/model/getAIActionsProposedChangesResponseAllOf.js +29 -0
- package/build/sdk/studio/sdk/model/getAIActionsProposedChangesResponseAllOf.js.map +1 -0
- package/build/sdk/studio/sdk/model/getPublicOrganizationTransformationBlockResponse.d.ts +34 -0
- package/build/sdk/studio/sdk/model/getPublicOrganizationTransformationBlockResponse.js +39 -0
- package/build/sdk/studio/sdk/model/getPublicOrganizationTransformationBlockResponse.js.map +1 -0
- package/build/sdk/studio/sdk/model/getPublicOrganizationTransformationBlockResponseAllOf.d.ts +26 -0
- package/build/sdk/studio/sdk/model/getPublicOrganizationTransformationBlockResponseAllOf.js +29 -0
- package/build/sdk/studio/sdk/model/getPublicOrganizationTransformationBlockResponseAllOf.js.map +1 -0
- package/build/sdk/studio/sdk/model/getUserProjectsResponse.d.ts +34 -0
- package/build/sdk/studio/sdk/model/getUserProjectsResponse.js +39 -0
- package/build/sdk/studio/sdk/model/getUserProjectsResponse.js.map +1 -0
- package/build/sdk/studio/sdk/model/getUserProjectsResponseAllOf.d.ts +26 -0
- package/build/sdk/studio/sdk/model/getUserProjectsResponseAllOf.js +29 -0
- package/build/sdk/studio/sdk/model/getUserProjectsResponseAllOf.js.map +1 -0
- package/build/sdk/studio/sdk/model/getUserResponse.d.ts +9 -0
- package/build/sdk/studio/sdk/model/getUserResponse.js +10 -0
- package/build/sdk/studio/sdk/model/getUserResponse.js.map +1 -1
- package/build/sdk/studio/sdk/model/getUserResponseAllOf.d.ts +9 -0
- package/build/sdk/studio/sdk/model/getUserResponseAllOf.js +10 -0
- package/build/sdk/studio/sdk/model/getUserResponseAllOf.js.map +1 -1
- package/build/sdk/studio/sdk/model/getUserResponseAllOfLastAccessedProjects.d.ts +30 -0
- package/build/sdk/studio/sdk/model/getUserResponseAllOfLastAccessedProjects.js +37 -0
- package/build/sdk/studio/sdk/model/getUserResponseAllOfLastAccessedProjects.js.map +1 -0
- package/build/sdk/studio/sdk/model/getUserResponseAllOfLastAccessedProjectsProjects.d.ts +28 -0
- package/build/sdk/studio/sdk/model/getUserResponseAllOfLastAccessedProjectsProjects.js +44 -0
- package/build/sdk/studio/sdk/model/getUserResponseAllOfLastAccessedProjectsProjects.js.map +1 -0
- package/build/sdk/studio/sdk/model/listAIActionsResponse.d.ts +34 -0
- package/build/sdk/studio/sdk/model/listAIActionsResponse.js +39 -0
- package/build/sdk/studio/sdk/model/listAIActionsResponse.js.map +1 -0
- package/build/sdk/studio/sdk/model/listAIActionsResponseAllOf.d.ts +26 -0
- package/build/sdk/studio/sdk/model/listAIActionsResponseAllOf.js +29 -0
- package/build/sdk/studio/sdk/model/listAIActionsResponseAllOf.js.map +1 -0
- package/build/sdk/studio/sdk/model/models.d.ts +27 -0
- package/build/sdk/studio/sdk/model/models.js +80 -2
- package/build/sdk/studio/sdk/model/models.js.map +1 -1
- package/build/sdk/studio/sdk/model/optimizeConfig.d.ts +6 -4
- package/build/sdk/studio/sdk/model/optimizeConfig.js +9 -5
- package/build/sdk/studio/sdk/model/optimizeConfig.js.map +1 -1
- package/build/sdk/studio/sdk/model/optimizeConfigResponse.d.ts +6 -4
- package/build/sdk/studio/sdk/model/optimizeConfigResponse.js +9 -5
- package/build/sdk/studio/sdk/model/optimizeConfigResponse.js.map +1 -1
- package/build/sdk/studio/sdk/model/organizationTransformationBlock.d.ts +9 -0
- package/build/sdk/studio/sdk/model/organizationTransformationBlock.js +10 -0
- package/build/sdk/studio/sdk/model/organizationTransformationBlock.js.map +1 -1
- package/build/sdk/studio/sdk/model/previewAIActionsSamplesRequest.d.ts +42 -0
- package/build/sdk/studio/sdk/model/previewAIActionsSamplesRequest.js +49 -0
- package/build/sdk/studio/sdk/model/previewAIActionsSamplesRequest.js.map +1 -0
- package/build/sdk/studio/sdk/model/publicOrganizationTransformationBlock.d.ts +4 -0
- package/build/sdk/studio/sdk/model/publicOrganizationTransformationBlock.js +5 -0
- package/build/sdk/studio/sdk/model/publicOrganizationTransformationBlock.js.map +1 -1
- package/build/sdk/studio/sdk/model/sampleProposedChanges.d.ts +48 -0
- package/build/sdk/studio/sdk/model/sampleProposedChanges.js +49 -0
- package/build/sdk/studio/sdk/model/sampleProposedChanges.js.map +1 -0
- package/build/sdk/studio/sdk/model/setAIActionsOrderRequest.d.ts +25 -0
- package/build/sdk/studio/sdk/model/setAIActionsOrderRequest.js +29 -0
- package/build/sdk/studio/sdk/model/setAIActionsOrderRequest.js.map +1 -0
- package/build/sdk/studio/sdk/model/setSampleProposedChangesRequest.d.ts +30 -0
- package/build/sdk/studio/sdk/model/setSampleProposedChangesRequest.js +34 -0
- package/build/sdk/studio/sdk/model/setSampleProposedChangesRequest.js.map +1 -0
- package/build/sdk/studio/sdk/model/updateAIActionRequest.d.ts +57 -0
- package/build/sdk/studio/sdk/model/updateAIActionRequest.js +64 -0
- package/build/sdk/studio/sdk/model/updateAIActionRequest.js.map +1 -0
- package/build/sdk/studio/sdk/model/updateOrganizationTransformationBlockRequest.d.ts +6 -0
- package/build/sdk/studio/sdk/model/updateOrganizationTransformationBlockRequest.js +10 -0
- package/build/sdk/studio/sdk/model/updateOrganizationTransformationBlockRequest.js.map +1 -1
- package/build/sdk/studio/sdk/model/updateProjectRequest.d.ts +4 -0
- package/build/sdk/studio/sdk/model/updateProjectRequest.js +5 -0
- package/build/sdk/studio/sdk/model/updateProjectRequest.js.map +1 -1
- package/build/shared/bounding-box-file-types.d.ts +1 -0
- package/build/shared/bounding-box-file-types.js +46 -2
- package/build/shared/bounding-box-file-types.js.map +1 -1
- package/build/shared/viewmodels/init.d.ts +3 -0
- package/build/shared/viewmodels/init.js +3 -0
- package/build/shared/viewmodels/init.js.map +1 -1
- package/cli/linux/webserver/public/assets/argon-dashboard.css +20595 -0
- package/cli/linux/webserver/public/assets/favicon-color/favicon-120.png +0 -0
- package/cli/linux/webserver/public/assets/favicon-color/favicon-128.png +0 -0
- package/cli/linux/webserver/public/assets/favicon-color/favicon-144.png +0 -0
- package/cli/linux/webserver/public/assets/favicon-color/favicon-152.png +0 -0
- package/cli/linux/webserver/public/assets/favicon-color/favicon-16.png +0 -0
- package/cli/linux/webserver/public/assets/favicon-color/favicon-180.png +0 -0
- package/cli/linux/webserver/public/assets/favicon-color/favicon-228.png +0 -0
- package/cli/linux/webserver/public/assets/favicon-color/favicon-32.png +0 -0
- package/cli/linux/webserver/public/assets/favicon-color/favicon-57.png +0 -0
- package/cli/linux/webserver/public/assets/favicon-color/favicon-76.png +0 -0
- package/cli/linux/webserver/public/assets/favicon-color/favicon-96.png +0 -0
- package/cli/linux/webserver/public/assets/logo-rgb.svg +18 -0
- package/cli/linux/webserver/public/assets/mark.svg +20 -0
- package/cli/linux/webserver/public/assets/mobileclient.css +4179 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300.eot +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300.svg +332 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300.ttf +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300.woff +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300.woff2 +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300italic.eot +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300italic.svg +345 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300italic.ttf +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300italic.woff +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300italic.woff2 +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600.eot +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600.svg +336 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600.ttf +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600.woff +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600.woff2 +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600italic.eot +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600italic.svg +349 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600italic.ttf +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600italic.woff +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600italic.woff2 +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700.eot +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700.svg +334 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700.ttf +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700.woff +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700.woff2 +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700italic.eot +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700italic.svg +342 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700italic.ttf +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700italic.woff +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700italic.woff2 +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800.eot +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800.svg +336 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800.ttf +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800.woff +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800.woff2 +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800italic.eot +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800italic.svg +342 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800italic.ttf +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800italic.woff +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800italic.woff2 +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-italic.eot +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-italic.svg +349 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-italic.ttf +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-italic.woff +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-italic.woff2 +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-regular.eot +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-regular.svg +336 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-regular.ttf +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-regular.woff +0 -0
- package/cli/linux/webserver/public/fonts/open-sans-v17-latin-regular.woff2 +0 -0
- package/cli/linux/webserver/public/index.html +114 -0
- package/cli/linux/webserver/public/inference-server.js +216 -0
- package/cli/linux/webserver/public/webserver.js +247 -0
- package/package.json +3 -2
- package/test/gstreamer.test.ts +797 -10
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
window.InferenceServer = async () => {
|
|
2
|
+
// hello world
|
|
3
|
+
const els = {
|
|
4
|
+
uploadFile: document.querySelector('#upload-file'),
|
|
5
|
+
runInferenceBtn: document.querySelector('#run-inference'),
|
|
6
|
+
resultSection: document.querySelector('#result-section'),
|
|
7
|
+
resultSectionPre: document.querySelector('#result-section pre'),
|
|
8
|
+
previewSection: document.querySelector('#preview-section'),
|
|
9
|
+
previewSectionImgContainer: document.querySelector('#preview-image-container'),
|
|
10
|
+
previewSectionImg: document.querySelector('#preview-section img'),
|
|
11
|
+
features: document.querySelector('#features'),
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const colors = [
|
|
15
|
+
'#e6194B', '#3cb44b', '#ffe119', '#4363d8', '#f58231', '#42d4f4', '#f032e6', '#fabed4',
|
|
16
|
+
'#469990', '#dcbeff', '#9A6324', '#fffac8', '#800000', '#aaffc3',
|
|
17
|
+
];
|
|
18
|
+
const labelToColor = { };
|
|
19
|
+
|
|
20
|
+
if (els.uploadFile) {
|
|
21
|
+
els.uploadFile.oninput = () => {
|
|
22
|
+
if (els.uploadFile.files.length > 0) {
|
|
23
|
+
els.runInferenceBtn.disabled = false;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
els.runInferenceBtn.disabled = true;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
if (els.uploadFile.files.length > 0) {
|
|
30
|
+
els.runInferenceBtn.disabled = false;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
els.runInferenceBtn.disabled = true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (els.features) {
|
|
38
|
+
els.features.oninput = () => {
|
|
39
|
+
if (els.features.value.length > 0) {
|
|
40
|
+
els.runInferenceBtn.disabled = false;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
els.runInferenceBtn.disabled = true;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
if (els.features.value.length > 0) {
|
|
47
|
+
els.runInferenceBtn.disabled = false;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
els.runInferenceBtn.disabled = true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
els.runInferenceBtn.onclick = async (ev) => {
|
|
55
|
+
ev.preventDefault();
|
|
56
|
+
|
|
57
|
+
const origText = els.runInferenceBtn.textContent;
|
|
58
|
+
|
|
59
|
+
els.runInferenceBtn.disabled = true;
|
|
60
|
+
els.runInferenceBtn.textContent = 'Running inference...';
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
let resp;
|
|
64
|
+
if (els.uploadFile) {
|
|
65
|
+
if (els.uploadFile.files.length === 0) return;
|
|
66
|
+
|
|
67
|
+
let formData = new FormData();
|
|
68
|
+
formData.append('file', els.uploadFile.files[0]);
|
|
69
|
+
|
|
70
|
+
resp = await fetch('/api/image', {
|
|
71
|
+
body: formData,
|
|
72
|
+
method: 'post',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
else if (els.features) {
|
|
76
|
+
if (els.features.value.length === 0) return;
|
|
77
|
+
|
|
78
|
+
let features = els.features.value.split(',').map(n => Number(n.trim()));
|
|
79
|
+
|
|
80
|
+
resp = await fetch('/api/features', {
|
|
81
|
+
body: JSON.stringify({
|
|
82
|
+
features: features,
|
|
83
|
+
}),
|
|
84
|
+
headers: {
|
|
85
|
+
'Content-Type': 'application/json',
|
|
86
|
+
},
|
|
87
|
+
method: 'post',
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
throw new Error('Could not find either upload or features elements');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const text = await resp.text();
|
|
95
|
+
let body;
|
|
96
|
+
try {
|
|
97
|
+
body = JSON.parse(text);
|
|
98
|
+
}
|
|
99
|
+
catch (ex) {
|
|
100
|
+
throw new Error(text);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (els.uploadFile && (body.result.bounding_boxes || body.result.visual_anomaly_grid)) {
|
|
104
|
+
els.previewSection.style.display = '';
|
|
105
|
+
|
|
106
|
+
const dataUrl = await new Promise((resolve, reject) => {
|
|
107
|
+
const reader = new FileReader();
|
|
108
|
+
|
|
109
|
+
reader.onload = e => {
|
|
110
|
+
resolve(e.target.result);
|
|
111
|
+
};
|
|
112
|
+
reader.onerror = err => {
|
|
113
|
+
reject(err);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
reader.readAsDataURL(els.uploadFile.files[0]);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
els.previewSectionImg.src = dataUrl;
|
|
120
|
+
|
|
121
|
+
const result = body.result;
|
|
122
|
+
let factor = 1;
|
|
123
|
+
|
|
124
|
+
for (let oldEl of els.previewSectionImgContainer.querySelectorAll('.bounding-box-container')) {
|
|
125
|
+
oldEl.parentNode.removeChild(oldEl);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
for (let b of (result.bounding_boxes || [])) {
|
|
129
|
+
let bb = {
|
|
130
|
+
x: b.x / factor,
|
|
131
|
+
y: b.y / factor,
|
|
132
|
+
width: b.width / factor,
|
|
133
|
+
height: b.height / factor,
|
|
134
|
+
label: b.label,
|
|
135
|
+
value: b.value
|
|
136
|
+
};
|
|
137
|
+
if (!labelToColor[bb.label]) {
|
|
138
|
+
labelToColor[bb.label] = colors[0];
|
|
139
|
+
colors.splice(0, 1);
|
|
140
|
+
}
|
|
141
|
+
let color = labelToColor[bb.label];
|
|
142
|
+
let el = document.createElement('div');
|
|
143
|
+
el.classList.add('bounding-box-container');
|
|
144
|
+
el.style.position = 'absolute';
|
|
145
|
+
el.style.border = 'solid 3px ' + color;
|
|
146
|
+
// if (modelType === 'object_detection') {
|
|
147
|
+
el.style.width = (bb.width) + 'px';
|
|
148
|
+
el.style.height = (bb.height) + 'px';
|
|
149
|
+
el.style.left = (bb.x) + 'px';
|
|
150
|
+
el.style.top = (bb.y) + 'px';
|
|
151
|
+
// }
|
|
152
|
+
// else if (modelType === 'constrained_object_detection') {
|
|
153
|
+
// let centerX = bb.x + (bb.width / 2);
|
|
154
|
+
// let centerY = bb.y + (bb.height / 2);
|
|
155
|
+
// el.style.borderRadius = '10px';
|
|
156
|
+
// el.style.width = 20 + 'px';
|
|
157
|
+
// el.style.height = 20 + 'px';
|
|
158
|
+
// el.style.left = (centerX - 10) + 'px';
|
|
159
|
+
// el.style.top = (centerY - 10) + 'px';
|
|
160
|
+
// }
|
|
161
|
+
let label = document.createElement('div');
|
|
162
|
+
label.classList.add('bounding-box-label');
|
|
163
|
+
label.style.background = color;
|
|
164
|
+
label.textContent = bb.label + ' (' + bb.value.toFixed(2) + ')';
|
|
165
|
+
el.style.whiteSpace = 'nowrap';
|
|
166
|
+
el.appendChild(label);
|
|
167
|
+
els.previewSectionImgContainer.appendChild(el);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
for (let b of (result.visual_anomaly_grid || [])) {
|
|
171
|
+
let bb = {
|
|
172
|
+
x: b.x / factor,
|
|
173
|
+
y: b.y / factor,
|
|
174
|
+
width: b.width / factor,
|
|
175
|
+
height: b.height / factor,
|
|
176
|
+
label: b.label,
|
|
177
|
+
value: b.value
|
|
178
|
+
};
|
|
179
|
+
let el = document.createElement('div');
|
|
180
|
+
el.classList.add('bounding-box-container');
|
|
181
|
+
el.style.position = 'absolute';
|
|
182
|
+
el.style.background = 'rgba(255, 0, 0, 0.5)';
|
|
183
|
+
el.style.width = (bb.width) + 'px';
|
|
184
|
+
el.style.height = (bb.height) + 'px';
|
|
185
|
+
el.style.left = (bb.x) + 'px';
|
|
186
|
+
el.style.top = (bb.y) + 'px';
|
|
187
|
+
|
|
188
|
+
let score = document.createElement('div');
|
|
189
|
+
score.style.color = 'white';
|
|
190
|
+
score.textContent = bb.value.toFixed(2);
|
|
191
|
+
el.appendChild(score);
|
|
192
|
+
|
|
193
|
+
// Center align the score
|
|
194
|
+
el.style.display = 'flex';
|
|
195
|
+
el.style.alignItems = 'center';
|
|
196
|
+
el.style.justifyContent = 'center';
|
|
197
|
+
|
|
198
|
+
els.previewSectionImgContainer.appendChild(el);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
els.previewSection.style.display = 'none';
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
els.resultSection.style.display = '';
|
|
206
|
+
els.resultSectionPre.textContent = JSON.stringify(body, null, 4);
|
|
207
|
+
}
|
|
208
|
+
catch (ex) {
|
|
209
|
+
alert('Failed to run inference: ' + (ex.message || ex.toString()));
|
|
210
|
+
}
|
|
211
|
+
finally {
|
|
212
|
+
els.runInferenceBtn.disabled = false;
|
|
213
|
+
els.runInferenceBtn.textContent = origText;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
window.WebServer = async () => {
|
|
2
|
+
|
|
3
|
+
const els = {
|
|
4
|
+
title: document.querySelector('#header-row h1'),
|
|
5
|
+
cameraContainer: document.querySelector('#capture-camera .capture-camera-inner'),
|
|
6
|
+
cameraImg: document.querySelector('#capture-camera img'),
|
|
7
|
+
timePerInference: document.querySelector('#time-per-inference'),
|
|
8
|
+
additionalInfo: document.querySelector('#additional-info'),
|
|
9
|
+
timePerInferenceContainer: document.querySelector('#time-per-inference-container'),
|
|
10
|
+
additionalInfoContainer: document.querySelector('#additional-info-container'),
|
|
11
|
+
imageClassify: {
|
|
12
|
+
row: document.querySelector('#image-classification-conclusion'),
|
|
13
|
+
text: document.querySelector('#image-classification-conclusion .col'),
|
|
14
|
+
},
|
|
15
|
+
views: {
|
|
16
|
+
loading: document.querySelector('#loading-view'),
|
|
17
|
+
captureCamera: document.querySelector('#capture-camera'),
|
|
18
|
+
},
|
|
19
|
+
resultsTable: document.querySelector('#results-table'),
|
|
20
|
+
resultsThead: document.querySelector('#results-table thead tr'),
|
|
21
|
+
resultsTbody: document.querySelector('#results-table tbody'),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const colors = [
|
|
25
|
+
'#e6194B', '#3cb44b', '#ffe119', '#4363d8', '#f58231', '#42d4f4', '#f032e6', '#fabed4',
|
|
26
|
+
'#469990', '#dcbeff', '#9A6324', '#fffac8', '#800000', '#aaffc3',
|
|
27
|
+
];
|
|
28
|
+
const labelToColor = { };
|
|
29
|
+
|
|
30
|
+
function switchView(el) {
|
|
31
|
+
for (let k of Object.keys(els.views)) {
|
|
32
|
+
els.views[k].style.display = 'none';
|
|
33
|
+
}
|
|
34
|
+
el.style.display = '';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Here is how we connect back to the server
|
|
38
|
+
const socket = io.connect(location.origin);
|
|
39
|
+
socket.on('connect', () => {
|
|
40
|
+
socket.emit('hello');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
socket.on('hello', (opts) => {
|
|
44
|
+
els.title.textContent = opts.projectName;
|
|
45
|
+
|
|
46
|
+
switchView(els.views.captureCamera);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
socket.on('image', (opts) => {
|
|
50
|
+
els.cameraImg.src = opts.img;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
let isFirstClassification = true;
|
|
54
|
+
let inferenceIx = 0;
|
|
55
|
+
|
|
56
|
+
socket.on('classification', (opts) => {
|
|
57
|
+
let result = opts.result;
|
|
58
|
+
let modelType = opts.modelType;
|
|
59
|
+
|
|
60
|
+
els.timePerInference.textContent = opts.timeMs;
|
|
61
|
+
els.additionalInfo.textContent = opts.additionalInfo;
|
|
62
|
+
els.timePerInferenceContainer.style.display = '';
|
|
63
|
+
els.additionalInfoContainer.style.display = '';
|
|
64
|
+
|
|
65
|
+
console.log('classification', opts.result, opts.timeMs);
|
|
66
|
+
|
|
67
|
+
for (let bx of Array.from(els.cameraContainer.querySelectorAll('.bounding-box-container'))) {
|
|
68
|
+
bx.parentNode?.removeChild(bx);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
els.imageClassify.row.style.display = 'none';
|
|
72
|
+
|
|
73
|
+
if (result.classification) {
|
|
74
|
+
if (isFirstClassification) {
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
76
|
+
for (let ix = 0; ix < Object.keys(result.classification).length; ix++) {
|
|
77
|
+
const key = Object.keys(result.classification)[ix];
|
|
78
|
+
|
|
79
|
+
let th = document.createElement('th');
|
|
80
|
+
th.scope = 'col';
|
|
81
|
+
th.classList.add('px-0', 'text-center');
|
|
82
|
+
th.textContent = th.title = key;
|
|
83
|
+
els.resultsThead.appendChild(th);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (result.visual_anomaly_grid) {
|
|
87
|
+
let th = document.createElement('th');
|
|
88
|
+
th.scope = 'col';
|
|
89
|
+
th.classList.add('px-0', 'text-center');
|
|
90
|
+
th.textContent = th.title = 'anomaly';
|
|
91
|
+
els.resultsThead.appendChild(th);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
els.resultsTable.style.display = '';
|
|
95
|
+
isFirstClassification = false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
els.imageClassify.row.style.display = '';
|
|
99
|
+
|
|
100
|
+
let conclusion = 'uncertain';
|
|
101
|
+
let highest = Math.max(...Object.values(result.classification));
|
|
102
|
+
|
|
103
|
+
for (let k of Object.keys(result.classification)) {
|
|
104
|
+
if (result.classification[k] >= 0.55) {
|
|
105
|
+
conclusion = k + ' (' + result.classification[k].toFixed(2) + ')';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// both visual AD and we have at least 1 anomaly
|
|
110
|
+
let isVisualAnomaly = false;
|
|
111
|
+
if (result.visual_anomaly_grid && result.visual_anomaly_grid.length > 0) {
|
|
112
|
+
conclusion = 'anomaly (' + (result.visual_anomaly_max || 0).toFixed(2) + ')';
|
|
113
|
+
isVisualAnomaly = true;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let tr = document.createElement('tr');
|
|
117
|
+
let td1 = document.createElement('td');
|
|
118
|
+
td1.textContent = (++inferenceIx).toString();
|
|
119
|
+
tr.appendChild(td1);
|
|
120
|
+
for (let k of Object.keys(result.classification)) {
|
|
121
|
+
let td = document.createElement('td');
|
|
122
|
+
td.classList.add('text-center');
|
|
123
|
+
td.textContent = result.classification[k].toFixed(2);
|
|
124
|
+
if (result.classification[k] === highest && !isVisualAnomaly) {
|
|
125
|
+
td.style.fontWeight = 600;
|
|
126
|
+
}
|
|
127
|
+
tr.appendChild(td);
|
|
128
|
+
}
|
|
129
|
+
if (result.visual_anomaly_grid) {
|
|
130
|
+
let td = document.createElement('td');
|
|
131
|
+
td.classList.add('text-center');
|
|
132
|
+
td.textContent = (result.visual_anomaly_max || 0).toFixed(2);
|
|
133
|
+
if (isVisualAnomaly) {
|
|
134
|
+
td.style.fontWeight = 600;
|
|
135
|
+
}
|
|
136
|
+
tr.appendChild(td);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
tr.classList.add('active');
|
|
140
|
+
setTimeout(() => {
|
|
141
|
+
tr.classList.remove('active');
|
|
142
|
+
}, 200);
|
|
143
|
+
if (els.resultsTbody.firstChild) {
|
|
144
|
+
els.resultsTbody.insertBefore(tr, els.resultsTbody.firstChild);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
els.resultsTbody.appendChild(tr);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// keep max n rows
|
|
151
|
+
if (els.resultsTbody.childElementCount >= 100) {
|
|
152
|
+
els.resultsTbody.removeChild(els.resultsTbody.lastChild);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
els.imageClassify.text.textContent = conclusion;
|
|
156
|
+
}
|
|
157
|
+
if (result.bounding_boxes) {
|
|
158
|
+
let factor = els.cameraImg.naturalHeight / els.cameraImg.clientHeight;
|
|
159
|
+
|
|
160
|
+
for (let b of result.bounding_boxes) {
|
|
161
|
+
let bb = {
|
|
162
|
+
x: b.x / factor,
|
|
163
|
+
y: b.y / factor,
|
|
164
|
+
width: b.width / factor,
|
|
165
|
+
height: b.height / factor,
|
|
166
|
+
label: b.label,
|
|
167
|
+
value: b.value
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
if (!labelToColor[bb.label]) {
|
|
171
|
+
labelToColor[bb.label] = colors[0];
|
|
172
|
+
colors.splice(0, 1);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
let color = labelToColor[bb.label];
|
|
176
|
+
|
|
177
|
+
let el = document.createElement('div');
|
|
178
|
+
el.classList.add('bounding-box-container');
|
|
179
|
+
el.style.position = 'absolute';
|
|
180
|
+
el.style.border = 'solid 3px ' + color;
|
|
181
|
+
|
|
182
|
+
if (modelType === 'object_detection') {
|
|
183
|
+
el.style.width = (bb.width) + 'px';
|
|
184
|
+
el.style.height = (bb.height) + 'px';
|
|
185
|
+
el.style.left = (bb.x) + 'px';
|
|
186
|
+
el.style.top = (bb.y) + 'px';
|
|
187
|
+
}
|
|
188
|
+
else if (modelType === 'constrained_object_detection') {
|
|
189
|
+
let centerX = bb.x + (bb.width / 2);
|
|
190
|
+
let centerY = bb.y + (bb.height / 2);
|
|
191
|
+
|
|
192
|
+
el.style.borderRadius = '10px';
|
|
193
|
+
el.style.width = 20 + 'px';
|
|
194
|
+
el.style.height = 20 + 'px';
|
|
195
|
+
el.style.left = (centerX - 10) + 'px';
|
|
196
|
+
el.style.top = (centerY - 10) + 'px';
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
let label = document.createElement('div');
|
|
200
|
+
label.classList.add('bounding-box-label');
|
|
201
|
+
label.style.background = color;
|
|
202
|
+
label.textContent = bb.label + ' (' + bb.value.toFixed(2) + ')';
|
|
203
|
+
if (modelType === 'constrained_object_detection') {
|
|
204
|
+
el.style.whiteSpace = 'nowrap';
|
|
205
|
+
}
|
|
206
|
+
el.appendChild(label);
|
|
207
|
+
|
|
208
|
+
els.cameraContainer.appendChild(el);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (result.visual_anomaly_grid) {
|
|
212
|
+
let factor = els.cameraImg.naturalHeight / els.cameraImg.clientHeight;
|
|
213
|
+
|
|
214
|
+
for (let b of result.visual_anomaly_grid) {
|
|
215
|
+
let bb = {
|
|
216
|
+
x: b.x / factor,
|
|
217
|
+
y: b.y / factor,
|
|
218
|
+
width: b.width / factor,
|
|
219
|
+
height: b.height / factor,
|
|
220
|
+
label: b.label,
|
|
221
|
+
value: b.value
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
let el = document.createElement('div');
|
|
225
|
+
el.classList.add('bounding-box-container');
|
|
226
|
+
el.style.position = 'absolute';
|
|
227
|
+
el.style.background = 'rgba(255, 0, 0, 0.5)';
|
|
228
|
+
el.style.width = (bb.width) + 'px';
|
|
229
|
+
el.style.height = (bb.height) + 'px';
|
|
230
|
+
el.style.left = (bb.x) + 'px';
|
|
231
|
+
el.style.top = (bb.y) + 'px';
|
|
232
|
+
|
|
233
|
+
let score = document.createElement('div');
|
|
234
|
+
score.style.color = 'white';
|
|
235
|
+
score.textContent = bb.value.toFixed(2);
|
|
236
|
+
el.appendChild(score);
|
|
237
|
+
|
|
238
|
+
// Center align the score
|
|
239
|
+
el.style.display = 'flex';
|
|
240
|
+
el.style.alignItems = 'center';
|
|
241
|
+
el.style.justifyContent = 'center';
|
|
242
|
+
|
|
243
|
+
els.cameraContainer.appendChild(el);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-impulse-linux",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "Node.js SDK and tools for Edge Impulse for Linux",
|
|
5
5
|
"directories": {
|
|
6
6
|
"example": "examples"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"borc": "2.1.2",
|
|
37
37
|
"cbor": "5.0.2",
|
|
38
38
|
"commander": "4.1.1",
|
|
39
|
-
"express": "4.21.
|
|
39
|
+
"express": "4.21.1",
|
|
40
40
|
"form-data": "4.0.0",
|
|
41
41
|
"inquirer": "7.0.0",
|
|
42
42
|
"jpeg-js": "0.4.4",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"files": [
|
|
82
82
|
"LICENSE",
|
|
83
83
|
"README.md",
|
|
84
|
+
"cli/linux/webserver/public",
|
|
84
85
|
"build/",
|
|
85
86
|
"!build/test/",
|
|
86
87
|
"!build/examples/",
|