edge-impulse-linux 1.9.1 → 1.9.3

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.
Files changed (139) hide show
  1. package/README.md +5 -0
  2. package/build/cli/aws-iotcore-connector.d.ts +62 -0
  3. package/build/cli/aws-iotcore-connector.js +255 -0
  4. package/build/cli/aws-iotcore-connector.js.map +1 -0
  5. package/build/cli/aws-sm-utils.d.ts +18 -0
  6. package/build/cli/aws-sm-utils.js +52 -0
  7. package/build/cli/aws-sm-utils.js.map +1 -0
  8. package/build/cli/init-cli-app.d.ts +10 -0
  9. package/build/cli/init-cli-app.js +62 -1
  10. package/build/cli/init-cli-app.js.map +1 -1
  11. package/build/cli/linux/linux.js +3 -0
  12. package/build/cli/linux/linux.js.map +1 -1
  13. package/build/cli/linux/runner.js +121 -7
  14. package/build/cli/linux/runner.js.map +1 -1
  15. package/build/sdk/studio/sdk/api/rawDataApi.d.ts +4 -0
  16. package/build/sdk/studio/sdk/api/rawDataApi.js +8 -0
  17. package/build/sdk/studio/sdk/api/rawDataApi.js.map +1 -1
  18. package/build/sdk/studio/sdk/model/aIActionLastPreviewStateProposedChanges.d.ts +1 -0
  19. package/build/sdk/studio/sdk/model/aIActionLastPreviewStateProposedChanges.js +5 -0
  20. package/build/sdk/studio/sdk/model/aIActionLastPreviewStateProposedChanges.js.map +1 -1
  21. package/build/sdk/studio/sdk/model/aIActionsConfig.d.ts +2 -10
  22. package/build/sdk/studio/sdk/model/aIActionsConfig.js +3 -8
  23. package/build/sdk/studio/sdk/model/aIActionsConfig.js.map +1 -1
  24. package/build/sdk/studio/sdk/model/aIActionsConfigStep.d.ts +34 -0
  25. package/build/sdk/studio/sdk/model/aIActionsConfigStep.js +34 -0
  26. package/build/sdk/studio/sdk/model/aIActionsConfigStep.js.map +1 -0
  27. package/build/sdk/studio/sdk/model/aIActionsOperatesOn.d.ts +13 -0
  28. package/build/sdk/studio/sdk/model/aIActionsOperatesOn.js +16 -0
  29. package/build/sdk/studio/sdk/model/aIActionsOperatesOn.js.map +1 -0
  30. package/build/sdk/studio/sdk/model/addOrganizationTransformationBlockRequest.d.ts +6 -1
  31. package/build/sdk/studio/sdk/model/addOrganizationTransformationBlockRequest.js +5 -0
  32. package/build/sdk/studio/sdk/model/addOrganizationTransformationBlockRequest.js.map +1 -1
  33. package/build/sdk/studio/sdk/model/createPreviewAIActionsJobRequest.d.ts +2 -10
  34. package/build/sdk/studio/sdk/model/createPreviewAIActionsJobRequest.js +3 -8
  35. package/build/sdk/studio/sdk/model/createPreviewAIActionsJobRequest.js.map +1 -1
  36. package/build/sdk/studio/sdk/model/dSPGroupItem.d.ts +8 -0
  37. package/build/sdk/studio/sdk/model/dSPGroupItem.js +10 -0
  38. package/build/sdk/studio/sdk/model/dSPGroupItem.js.map +1 -1
  39. package/build/sdk/studio/sdk/model/models.d.ts +4 -2
  40. package/build/sdk/studio/sdk/model/models.js +11 -6
  41. package/build/sdk/studio/sdk/model/models.js.map +1 -1
  42. package/build/sdk/studio/sdk/model/organizationTransformationBlock.d.ts +6 -1
  43. package/build/sdk/studio/sdk/model/organizationTransformationBlock.js +5 -0
  44. package/build/sdk/studio/sdk/model/organizationTransformationBlock.js.map +1 -1
  45. package/build/sdk/studio/sdk/model/profileModelInfoMemory.d.ts +4 -5
  46. package/build/sdk/studio/sdk/model/profileModelInfoMemory.js +3 -3
  47. package/build/sdk/studio/sdk/model/profileModelInfoMemory.js.map +1 -1
  48. package/build/sdk/studio/sdk/model/{profileModelInfoMemoryTflite.d.ts → profileModelInfoMemoryDetails.d.ts} +10 -1
  49. package/build/sdk/studio/sdk/model/{profileModelInfoMemoryTflite.js → profileModelInfoMemoryDetails.js} +7 -7
  50. package/build/sdk/studio/sdk/model/profileModelInfoMemoryDetails.js.map +1 -0
  51. package/build/sdk/studio/sdk/model/profileModelTableMcuMemory.d.ts +4 -4
  52. package/build/sdk/studio/sdk/model/profileModelTableMcuMemory.js +3 -3
  53. package/build/sdk/studio/sdk/model/profileModelTableMcuMemory.js.map +1 -1
  54. package/build/sdk/studio/sdk/model/{profileModelInfoMemoryEon.d.ts → profileModelTableMcuMemoryTflite.d.ts} +1 -1
  55. package/build/sdk/studio/sdk/model/{profileModelInfoMemoryEon.js → profileModelTableMcuMemoryTflite.js} +7 -7
  56. package/build/sdk/studio/sdk/model/profileModelTableMcuMemoryTflite.js.map +1 -0
  57. package/build/sdk/studio/sdk/model/publicOrganizationTransformationBlock.d.ts +6 -1
  58. package/build/sdk/studio/sdk/model/publicOrganizationTransformationBlock.js +5 -0
  59. package/build/sdk/studio/sdk/model/publicOrganizationTransformationBlock.js.map +1 -1
  60. package/build/sdk/studio/sdk/model/updateAIActionRequest.d.ts +2 -10
  61. package/build/sdk/studio/sdk/model/updateAIActionRequest.js +3 -8
  62. package/build/sdk/studio/sdk/model/updateAIActionRequest.js.map +1 -1
  63. package/build/sdk/studio/sdk/model/updateOrganizationTransformationBlockRequest.d.ts +6 -1
  64. package/build/sdk/studio/sdk/model/updateOrganizationTransformationBlockRequest.js +5 -0
  65. package/build/sdk/studio/sdk/model/updateOrganizationTransformationBlockRequest.js.map +1 -1
  66. package/build/shared/viewmodels/init.d.ts +4 -1
  67. package/build/shared/viewmodels/init.js +4 -1
  68. package/build/shared/viewmodels/init.js.map +1 -1
  69. package/cli/linux/webserver/public/assets/argon-dashboard.css +20595 -0
  70. package/cli/linux/webserver/public/assets/favicon-color/favicon-120.png +0 -0
  71. package/cli/linux/webserver/public/assets/favicon-color/favicon-128.png +0 -0
  72. package/cli/linux/webserver/public/assets/favicon-color/favicon-144.png +0 -0
  73. package/cli/linux/webserver/public/assets/favicon-color/favicon-152.png +0 -0
  74. package/cli/linux/webserver/public/assets/favicon-color/favicon-16.png +0 -0
  75. package/cli/linux/webserver/public/assets/favicon-color/favicon-180.png +0 -0
  76. package/cli/linux/webserver/public/assets/favicon-color/favicon-228.png +0 -0
  77. package/cli/linux/webserver/public/assets/favicon-color/favicon-32.png +0 -0
  78. package/cli/linux/webserver/public/assets/favicon-color/favicon-57.png +0 -0
  79. package/cli/linux/webserver/public/assets/favicon-color/favicon-76.png +0 -0
  80. package/cli/linux/webserver/public/assets/favicon-color/favicon-96.png +0 -0
  81. package/cli/linux/webserver/public/assets/logo-rgb.svg +18 -0
  82. package/cli/linux/webserver/public/assets/mark.svg +20 -0
  83. package/cli/linux/webserver/public/assets/mobileclient.css +4179 -0
  84. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300.eot +0 -0
  85. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300.svg +332 -0
  86. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300.ttf +0 -0
  87. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300.woff +0 -0
  88. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300.woff2 +0 -0
  89. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300italic.eot +0 -0
  90. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300italic.svg +345 -0
  91. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300italic.ttf +0 -0
  92. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300italic.woff +0 -0
  93. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-300italic.woff2 +0 -0
  94. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600.eot +0 -0
  95. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600.svg +336 -0
  96. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600.ttf +0 -0
  97. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600.woff +0 -0
  98. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600.woff2 +0 -0
  99. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600italic.eot +0 -0
  100. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600italic.svg +349 -0
  101. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600italic.ttf +0 -0
  102. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600italic.woff +0 -0
  103. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-600italic.woff2 +0 -0
  104. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700.eot +0 -0
  105. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700.svg +334 -0
  106. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700.ttf +0 -0
  107. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700.woff +0 -0
  108. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700.woff2 +0 -0
  109. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700italic.eot +0 -0
  110. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700italic.svg +342 -0
  111. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700italic.ttf +0 -0
  112. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700italic.woff +0 -0
  113. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-700italic.woff2 +0 -0
  114. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800.eot +0 -0
  115. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800.svg +336 -0
  116. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800.ttf +0 -0
  117. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800.woff +0 -0
  118. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800.woff2 +0 -0
  119. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800italic.eot +0 -0
  120. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800italic.svg +342 -0
  121. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800italic.ttf +0 -0
  122. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800italic.woff +0 -0
  123. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-800italic.woff2 +0 -0
  124. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-italic.eot +0 -0
  125. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-italic.svg +349 -0
  126. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-italic.ttf +0 -0
  127. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-italic.woff +0 -0
  128. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-italic.woff2 +0 -0
  129. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-regular.eot +0 -0
  130. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-regular.svg +336 -0
  131. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-regular.ttf +0 -0
  132. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-regular.woff +0 -0
  133. package/cli/linux/webserver/public/fonts/open-sans-v17-latin-regular.woff2 +0 -0
  134. package/cli/linux/webserver/public/index.html +114 -0
  135. package/cli/linux/webserver/public/inference-server.js +216 -0
  136. package/cli/linux/webserver/public/webserver.js +247 -0
  137. package/package.json +5 -1
  138. package/build/sdk/studio/sdk/model/profileModelInfoMemoryEon.js.map +0 -1
  139. package/build/sdk/studio/sdk/model/profileModelInfoMemoryTflite.js.map +0 -1
@@ -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.1",
3
+ "version": "1.9.3",
4
4
  "description": "Node.js SDK and tools for Edge Impulse for Linux",
5
5
  "directories": {
6
6
  "example": "examples"
@@ -32,6 +32,9 @@
32
32
  },
33
33
  "homepage": "https://github.com/edgeimpulse/linux-sdk-node#readme",
34
34
  "dependencies": {
35
+ "@aws-sdk/client-iot-data-plane": "3.624.0",
36
+ "@aws-sdk/client-secrets-manager": "3.624.0",
37
+ "@types/uuid": "10.0.0",
35
38
  "async-mutex": "0.2.6",
36
39
  "borc": "2.1.2",
37
40
  "cbor": "5.0.2",
@@ -81,6 +84,7 @@
81
84
  "files": [
82
85
  "LICENSE",
83
86
  "README.md",
87
+ "cli/linux/webserver/public",
84
88
  "build/",
85
89
  "!build/test/",
86
90
  "!build/examples/",
@@ -1 +0,0 @@
1
- {"version":3,"file":"profileModelInfoMemoryEon.js","sourceRoot":"","sources":["../../../../../sdk/studio/sdk/model/profileModelInfoMemoryEon.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAGH,MAAa,yBAAyB;IAkBlC,MAAM,CAAC,mBAAmB;QACtB,OAAO,yBAAyB,CAAC,gBAAgB,CAAC;IACtD,CAAC;;AApBL,8DAqBC;AAjBU,uCAAa,GAAuB,SAAS,CAAC;AAE9C,0CAAgB,GAA0D;IAC7E;QACI,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,QAAQ;KACnB;IACD;QACI,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,QAAQ;KACnB;CAAK,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"profileModelInfoMemoryTflite.js","sourceRoot":"","sources":["../../../../../sdk/studio/sdk/model/profileModelInfoMemoryTflite.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAGH,MAAa,4BAA4B;IAwBrC,MAAM,CAAC,mBAAmB;QACtB,OAAO,4BAA4B,CAAC,gBAAgB,CAAC;IACzD,CAAC;;AA1BL,oEA2BC;AAtBU,0CAAa,GAAuB,SAAS,CAAC;AAE9C,6CAAgB,GAA0D;IAC7E;QACI,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,QAAQ;KACnB;IACD;QACI,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,QAAQ;KACnB;IACD;QACI,MAAM,EAAE,WAAW;QACnB,UAAU,EAAE,WAAW;QACvB,MAAM,EAAE,QAAQ;KACnB;CAAK,CAAC"}