edge-impulse-linux 1.17.9 → 1.18.1

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 (54) hide show
  1. package/build/cli/linux/runner.js +66 -32
  2. package/build/cli/linux/runner.js.map +1 -1
  3. package/build/cli/linux/webserver/public/inference-server.js +16 -17
  4. package/build/cli/linux/webserver/public/inference-server.js.map +1 -1
  5. package/build/cli/linux/webserver/public/webserver.js +37 -0
  6. package/build/cli/linux/webserver/public/webserver.js.map +1 -1
  7. package/build/cli/linux/webserver/views/inference-server-view.d.ts +1 -1
  8. package/build/cli-common/aws-iotcore-connector.d.ts +3 -2
  9. package/build/cli-common/aws-iotcore-connector.js.map +1 -1
  10. package/build/library/classifier/linux-impulse-runner-types.d.ts +2 -1
  11. package/build/library/moving-average-filter.d.ts +1 -0
  12. package/build/sdk/studio/sdk/model/deployPretrainedModelModelFreeform.d.ts +27 -0
  13. package/build/sdk/studio/sdk/model/deployPretrainedModelModelFreeform.js +30 -0
  14. package/build/sdk/studio/sdk/model/deployPretrainedModelModelFreeform.js.map +1 -0
  15. package/build/sdk/studio/sdk/model/deployPretrainedModelRequestModelInfo.d.ts +2 -1
  16. package/build/sdk/studio/sdk/model/deployPretrainedModelRequestModelInfo.js +1 -1
  17. package/build/sdk/studio/sdk/model/deployPretrainedModelRequestModelInfo.js.map +1 -1
  18. package/build/sdk/studio/sdk/model/kerasModelMetadata.d.ts +2 -3
  19. package/build/sdk/studio/sdk/model/kerasModelMetadata.js +2 -3
  20. package/build/sdk/studio/sdk/model/kerasModelMetadata.js.map +1 -1
  21. package/build/sdk/studio/sdk/model/kerasModelMetadataResponse.d.ts +2 -3
  22. package/build/sdk/studio/sdk/model/kerasModelMetadataResponse.js +2 -3
  23. package/build/sdk/studio/sdk/model/kerasModelMetadataResponse.js.map +1 -1
  24. package/build/sdk/studio/sdk/model/kerasModelMode.d.ts +1 -1
  25. package/build/sdk/studio/sdk/model/kerasModelMode.js +1 -1
  26. package/build/sdk/studio/sdk/model/kerasModelMode.js.map +1 -1
  27. package/build/sdk/studio/sdk/model/learnBlockType.d.ts +2 -2
  28. package/build/sdk/studio/sdk/model/learnBlockType.js +1 -1
  29. package/build/sdk/studio/sdk/model/learnBlockType.js.map +1 -1
  30. package/build/sdk/studio/sdk/model/models.d.ts +3 -0
  31. package/build/sdk/studio/sdk/model/models.js +11 -2
  32. package/build/sdk/studio/sdk/model/models.js.map +1 -1
  33. package/build/sdk/studio/sdk/model/savePretrainedModelRequest.d.ts +2 -1
  34. package/build/sdk/studio/sdk/model/savePretrainedModelRequest.js +1 -1
  35. package/build/sdk/studio/sdk/model/savePretrainedModelRequest.js.map +1 -1
  36. package/build/sdk/studio/sdk/model/testPretrainedModelImagesRequest.d.ts +2 -1
  37. package/build/sdk/studio/sdk/model/testPretrainedModelImagesRequest.js +1 -1
  38. package/build/sdk/studio/sdk/model/testPretrainedModelImagesRequest.js.map +1 -1
  39. package/build/sdk/studio/sdk/model/testPretrainedModelResponse.d.ts +2 -0
  40. package/build/sdk/studio/sdk/model/testPretrainedModelResponse.js +5 -0
  41. package/build/sdk/studio/sdk/model/testPretrainedModelResponse.js.map +1 -1
  42. package/build/sdk/studio/sdk/model/testPretrainedModelResponseAllOf.d.ts +2 -0
  43. package/build/sdk/studio/sdk/model/testPretrainedModelResponseAllOf.js +5 -0
  44. package/build/sdk/studio/sdk/model/testPretrainedModelResponseAllOf.js.map +1 -1
  45. package/build/sdk/studio/sdk/model/testPretrainedModelResponseAllOfFreeformResult.d.ts +26 -0
  46. package/build/sdk/studio/sdk/model/testPretrainedModelResponseAllOfFreeformResult.js +29 -0
  47. package/build/sdk/studio/sdk/model/testPretrainedModelResponseAllOfFreeformResult.js.map +1 -0
  48. package/build/sdk/studio/sdk/model/testPretrainedModelResponseAllOfFreeformResultOutputTensors.d.ts +29 -0
  49. package/build/sdk/studio/sdk/model/testPretrainedModelResponseAllOfFreeformResultOutputTensors.js +40 -0
  50. package/build/sdk/studio/sdk/model/testPretrainedModelResponseAllOfFreeformResultOutputTensors.js.map +1 -0
  51. package/build/shared/MgmtInterfaceTypes.d.ts +1 -1
  52. package/cli/linux/webserver/public/inference-server.js +17 -17
  53. package/cli/linux/webserver/public/webserver.js +43 -0
  54. package/package.json +1 -1
@@ -225,19 +225,16 @@ window.InferenceServer = async (opts) => {
225
225
  // Only the fit-shortest resizing mode crops the image
226
226
  if (result.resized && result.resizeMode === 'fit-shortest') {
227
227
  const { originalWidth, originalHeight, newWidth, newHeight } = result.resized;
228
- let maskElements = {
229
- maskLeft: els.maskLeft,
230
- maskRight: els.maskRight,
231
- maskTop: els.maskTop,
232
- maskBottom: els.maskBottom
233
- };
234
228
  const img = {
235
229
  clientWidth: originalWidth,
236
230
  clientHeight: originalHeight,
237
231
  referenceWidth: newWidth,
238
232
  referenceHeight: newHeight,
239
233
  };
240
- maskCropped(maskElements, img);
234
+ maskCropped(img);
235
+ }
236
+ else {
237
+ hideCropMasks();
241
238
  }
242
239
  };
243
240
 
@@ -289,28 +286,31 @@ window.InferenceServer = async (opts) => {
289
286
  };
290
287
 
291
288
  // Shared from bounding-box-scaling.ts
292
- const maskCropped = (maskElements, img) => {
289
+ const maskCropped = (img) => {
293
290
  const referenceAspect = img.referenceWidth / img.referenceHeight;
294
291
  const clientAspect = img.clientWidth / img.clientHeight;
295
292
 
296
293
  if (clientAspect > referenceAspect) {
297
294
  // Image is wider than reference: mask left/right
298
295
  const maskPercent = getMaskPercent('horizontal', img);
299
- maskElements.maskLeft.style.width = maskElements.maskRight.style.width = maskPercent + '%';
300
- maskElements.maskTop.style.height = maskElements.maskBottom.style.height = '0%';
301
- maskElements.maskLeft.style.height = maskElements.maskRight.style.height = '100%';
296
+ els.maskLeft.style.width = els.maskRight.style.width = maskPercent + '%';
297
+ els.maskTop.style.height = els.maskBottom.style.height = '0%';
298
+ els.maskLeft.style.height = els.maskRight.style.height = '100%';
302
299
  }
303
300
  else if (clientAspect < referenceAspect) {
304
301
  // Image is taller than reference: mask top/bottom
305
302
  const maskPercent = getMaskPercent('vertical', img);
306
- maskElements.maskLeft.style.width = maskElements.maskRight.style.width = '0%';
307
- maskElements.maskTop.style.height = maskElements.maskBottom.style.height = maskPercent + '%';
308
- maskElements.maskTop.style.width = maskElements.maskBottom.style.width = '100%';
303
+ els.maskLeft.style.width = els.maskRight.style.width = '0%';
304
+ els.maskTop.style.height = els.maskBottom.style.height = maskPercent + '%';
305
+ els.maskTop.style.width = els.maskBottom.style.width = '100%';
309
306
  }
310
307
  else {
311
- // Aspect ratios match: no mask
312
- maskElements.maskLeft.style.width = maskElements.maskRight.style.width = '0%';
313
- maskElements.maskTop.style.height = maskElements.maskBottom.style.height = '0%';
308
+ hideCropMasks();
314
309
  }
315
310
  };
311
+
312
+ const hideCropMasks = () => {
313
+ els.maskLeft.style.width = els.maskRight.style.width = '0%';
314
+ els.maskTop.style.height = els.maskBottom.style.height = '0%';
315
+ };
316
316
  };
@@ -487,6 +487,49 @@ window.WebServer = async (vmStr) => {
487
487
  els.imageClassify.row.style.display = 'none';
488
488
  }
489
489
  }
490
+ else if (result.freeform) {
491
+ if (isFirstClassification) {
492
+ for (let ix = 0; ix < result.freeform.length; ix++) {
493
+ let th = document.createElement('th');
494
+ th.scope = 'col';
495
+ th.classList.add('px-0', 'text-center');
496
+ th.textContent = th.title = `Tensor ${ix}`;
497
+ els.resultsThead.appendChild(th);
498
+ }
499
+
500
+ els.resultsTable.style.display = '';
501
+ isFirstClassification = false;
502
+ }
503
+
504
+ let tr = document.createElement('tr');
505
+ let td1 = document.createElement('td');
506
+ td1.textContent = (++inferenceIx).toString();
507
+ tr.appendChild(td1);
508
+
509
+ for (let tensor of result.freeform) {
510
+ let td = document.createElement('td');
511
+ td.classList.add('text-center', 'text-monospace');
512
+ td.textContent = tensor.map(x => x.toFixed(4)).join(', ');
513
+ tr.appendChild(td);
514
+ }
515
+
516
+ tr.classList.add('active');
517
+ setTimeout(() => {
518
+ tr.classList.remove('active');
519
+ }, 200);
520
+ if (els.resultsTbody.firstChild) {
521
+ els.resultsTbody.insertBefore(tr, els.resultsTbody.firstChild);
522
+ }
523
+ else {
524
+ els.resultsTbody.appendChild(tr);
525
+ }
526
+
527
+ // keep max n rows
528
+ if (els.resultsTbody.childElementCount >= 100) {
529
+ els.resultsTbody.removeChild(els.resultsTbody.lastChild);
530
+ }
531
+ }
532
+
490
533
  if (result.bounding_boxes) {
491
534
  let factor = els.cameraImg.naturalHeight / els.cameraImg.clientHeight;
492
535
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-impulse-linux",
3
- "version": "1.17.9",
3
+ "version": "1.18.1",
4
4
  "description": "Node.js SDK and tools for Edge Impulse for Linux",
5
5
  "directories": {
6
6
  "example": "examples"