edge-impulse-linux 1.2.8 → 1.3.0
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/cli/linux/camera-debug.d.ts +2 -0
- package/build/cli/linux/camera-debug.js +145 -0
- package/build/cli/linux/camera-debug.js.map +1 -0
- package/build/cli/linux/linux.js +88 -15
- package/build/cli/linux/linux.js.map +1 -1
- package/build/cli/linux/runner-downloader.js +2 -2
- package/build/cli/linux/runner-downloader.js.map +1 -1
- package/build/cli/linux/runner.js +12 -1
- package/build/cli/linux/runner.js.map +1 -1
- package/build/cli/linux/webserver/public/webserver.js +2 -0
- package/build/cli/linux/webserver/public/webserver.js.map +1 -1
- package/build/cli/make-image.d.ts +11 -0
- package/build/cli/make-image.js +39 -1
- package/build/cli/make-image.js.map +1 -1
- package/build/library/classifier/image-classifier.d.ts +1 -0
- package/build/library/classifier/image-classifier.js +58 -25
- package/build/library/classifier/image-classifier.js.map +1 -1
- package/build/library/classifier/linux-impulse-runner.d.ts +2 -1
- package/build/library/classifier/linux-impulse-runner.js +6 -0
- package/build/library/classifier/linux-impulse-runner.js.map +1 -1
- package/build/library/sensors/gstreamer.d.ts +6 -6
- package/build/library/sensors/gstreamer.js +77 -24
- package/build/library/sensors/gstreamer.js.map +1 -1
- package/build/library/sensors/icamera.d.ts +11 -5
- package/build/library/sensors/imagesnap.d.ts +5 -6
- package/build/library/sensors/imagesnap.js +5 -1
- package/build/library/sensors/imagesnap.js.map +1 -1
- package/build/library/sensors/prophesee.d.ts +36 -0
- package/build/library/sensors/prophesee.js +187 -0
- package/build/library/sensors/prophesee.js.map +1 -0
- package/build/library/sensors/spawn-helper.d.ts +1 -0
- package/build/library/sensors/spawn-helper.js +1 -1
- package/build/library/sensors/spawn-helper.js.map +1 -1
- package/build/library/sensors/video-recorder.d.ts +20 -0
- package/build/library/sensors/video-recorder.js +161 -0
- package/build/library/sensors/video-recorder.js.map +1 -0
- package/build/sdk/studio/api/adminApi.js +5 -2
- package/build/sdk/studio/api/adminApi.js.map +1 -1
- package/build/sdk/studio/api/allowsReadOnlyApi.d.ts +19 -2
- package/build/sdk/studio/api/allowsReadOnlyApi.js +111 -2
- package/build/sdk/studio/api/allowsReadOnlyApi.js.map +1 -1
- package/build/sdk/studio/api/authApi.js +2 -0
- package/build/sdk/studio/api/authApi.js.map +1 -1
- package/build/sdk/studio/api/cDNApi.js +1 -0
- package/build/sdk/studio/api/cDNApi.js.map +1 -1
- package/build/sdk/studio/api/classifyApi.js +2 -0
- package/build/sdk/studio/api/classifyApi.js.map +1 -1
- package/build/sdk/studio/api/dSPApi.js +12 -0
- package/build/sdk/studio/api/dSPApi.js.map +1 -1
- package/build/sdk/studio/api/deploymentApi.js +7 -0
- package/build/sdk/studio/api/deploymentApi.js.map +1 -1
- package/build/sdk/studio/api/devicesApi.js +6 -0
- package/build/sdk/studio/api/devicesApi.js.map +1 -1
- package/build/sdk/studio/api/exportApi.js +1 -0
- package/build/sdk/studio/api/exportApi.js.map +1 -1
- package/build/sdk/studio/api/healthApi.js +1 -0
- package/build/sdk/studio/api/healthApi.js.map +1 -1
- package/build/sdk/studio/api/impulseApi.d.ts +13 -0
- package/build/sdk/studio/api/impulseApi.js +72 -0
- package/build/sdk/studio/api/impulseApi.js.map +1 -1
- package/build/sdk/studio/api/jobsApi.d.ts +27 -0
- package/build/sdk/studio/api/jobsApi.js +161 -0
- package/build/sdk/studio/api/jobsApi.js.map +1 -1
- package/build/sdk/studio/api/learnApi.js +13 -0
- package/build/sdk/studio/api/learnApi.js.map +1 -1
- package/build/sdk/studio/api/loginApi.js +1 -0
- package/build/sdk/studio/api/loginApi.js.map +1 -1
- package/build/sdk/studio/api/optimizationApi.d.ts +16 -0
- package/build/sdk/studio/api/optimizationApi.js +80 -0
- package/build/sdk/studio/api/optimizationApi.js.map +1 -1
- package/build/sdk/studio/api/organizationBlocksApi.js +8 -0
- package/build/sdk/studio/api/organizationBlocksApi.js.map +1 -1
- package/build/sdk/studio/api/organizationCreateProjectApi.d.ts +34 -1
- package/build/sdk/studio/api/organizationCreateProjectApi.js +164 -1
- package/build/sdk/studio/api/organizationCreateProjectApi.js.map +1 -1
- package/build/sdk/studio/api/organizationDataApi.js +20 -0
- package/build/sdk/studio/api/organizationDataApi.js.map +1 -1
- package/build/sdk/studio/api/organizationJobsApi.js +6 -0
- package/build/sdk/studio/api/organizationJobsApi.js.map +1 -1
- package/build/sdk/studio/api/organizationPortalsApi.js +5 -0
- package/build/sdk/studio/api/organizationPortalsApi.js.map +1 -1
- package/build/sdk/studio/api/organizationRequiresAdminApi.d.ts +15 -0
- package/build/sdk/studio/api/organizationRequiresAdminApi.js +85 -0
- package/build/sdk/studio/api/organizationRequiresAdminApi.js.map +1 -1
- package/build/sdk/studio/api/organizationsApi.js +16 -0
- package/build/sdk/studio/api/organizationsApi.js.map +1 -1
- package/build/sdk/studio/api/projectsApi.d.ts +14 -0
- package/build/sdk/studio/api/projectsApi.js +96 -0
- package/build/sdk/studio/api/projectsApi.js.map +1 -1
- package/build/sdk/studio/api/rawDataApi.d.ts +114 -7
- package/build/sdk/studio/api/rawDataApi.js +556 -7
- package/build/sdk/studio/api/rawDataApi.js.map +1 -1
- package/build/sdk/studio/api/requiresSudoApi.js +15 -2
- package/build/sdk/studio/api/requiresSudoApi.js.map +1 -1
- package/build/sdk/studio/api/requiresThirdPartyAuthApiKeyApi.js +1 -0
- package/build/sdk/studio/api/requiresThirdPartyAuthApiKeyApi.js.map +1 -1
- package/build/sdk/studio/api/supportsRangeApi.js +1 -0
- package/build/sdk/studio/api/supportsRangeApi.js.map +1 -1
- package/build/sdk/studio/api/thirdPartyAuthApi.js +7 -0
- package/build/sdk/studio/api/thirdPartyAuthApi.js.map +1 -1
- package/build/sdk/studio/api/uploadPortalApi.js +3 -0
- package/build/sdk/studio/api/uploadPortalApi.js.map +1 -1
- package/build/sdk/studio/api/userApi.js +28 -0
- package/build/sdk/studio/api/userApi.js.map +1 -1
- package/build/sdk/studio/model/cropSampleResponse.d.ts +33 -0
- package/build/sdk/studio/model/cropSampleResponse.js +42 -0
- package/build/sdk/studio/model/cropSampleResponse.js.map +1 -0
- package/build/sdk/studio/model/cropSampleResponseAllOf.d.ts +25 -0
- package/build/sdk/studio/model/cropSampleResponseAllOf.js +32 -0
- package/build/sdk/studio/model/cropSampleResponseAllOf.js.map +1 -0
- package/build/sdk/studio/model/dSPGroupItem.d.ts +1 -0
- package/build/sdk/studio/model/dSPGroupItem.js +5 -0
- package/build/sdk/studio/model/dSPGroupItem.js.map +1 -1
- package/build/sdk/studio/model/dSPMetadata.d.ts +1 -0
- package/build/sdk/studio/model/dSPMetadata.js +5 -0
- package/build/sdk/studio/model/dSPMetadata.js.map +1 -1
- package/build/sdk/studio/model/dSPMetadataOutputConfigShape.d.ts +4 -0
- package/build/sdk/studio/model/dSPMetadataOutputConfigShape.js +5 -0
- package/build/sdk/studio/model/dSPMetadataOutputConfigShape.js.map +1 -1
- package/build/sdk/studio/model/dSPMetadataResponse.d.ts +1 -0
- package/build/sdk/studio/model/dSPMetadataResponse.js +5 -0
- package/build/sdk/studio/model/dSPMetadataResponse.js.map +1 -1
- package/build/sdk/studio/model/getJWTTokenResponse.d.ts +4 -0
- package/build/sdk/studio/model/getJWTTokenResponse.js +5 -0
- package/build/sdk/studio/model/getJWTTokenResponse.js.map +1 -1
- package/build/sdk/studio/model/getJWTTokenResponseAllOf.d.ts +4 -0
- package/build/sdk/studio/model/getJWTTokenResponseAllOf.js +5 -0
- package/build/sdk/studio/model/getJWTTokenResponseAllOf.js.map +1 -1
- package/build/sdk/studio/model/getOrganizationPortalResponse.d.ts +4 -0
- package/build/sdk/studio/model/getOrganizationPortalResponse.js +5 -0
- package/build/sdk/studio/model/getOrganizationPortalResponse.js.map +1 -1
- package/build/sdk/studio/model/getOrganizationPortalResponseAllOf.d.ts +4 -0
- package/build/sdk/studio/model/getOrganizationPortalResponseAllOf.js +5 -0
- package/build/sdk/studio/model/getOrganizationPortalResponseAllOf.js.map +1 -1
- package/build/sdk/studio/model/getUserResponse.d.ts +4 -0
- package/build/sdk/studio/model/getUserResponse.js +5 -0
- package/build/sdk/studio/model/getUserResponse.js.map +1 -1
- package/build/sdk/studio/model/getUserResponseAllOf.d.ts +4 -0
- package/build/sdk/studio/model/getUserResponseAllOf.js +5 -0
- package/build/sdk/studio/model/getUserResponseAllOf.js.map +1 -1
- package/build/sdk/studio/model/impulseBlockVersion.d.ts +4 -0
- package/build/sdk/studio/model/impulseBlockVersion.js +5 -0
- package/build/sdk/studio/model/impulseBlockVersion.js.map +1 -1
- package/build/sdk/studio/model/impulseDspBlock.d.ts +28 -0
- package/build/sdk/studio/model/impulseDspBlock.js +35 -0
- package/build/sdk/studio/model/impulseDspBlock.js.map +1 -1
- package/build/sdk/studio/model/impulseInputBlock.d.ts +33 -1
- package/build/sdk/studio/model/impulseInputBlock.js +41 -1
- package/build/sdk/studio/model/impulseInputBlock.js.map +1 -1
- package/build/sdk/studio/model/impulseLearnBlock.d.ts +29 -1
- package/build/sdk/studio/model/impulseLearnBlock.js +35 -0
- package/build/sdk/studio/model/impulseLearnBlock.js.map +1 -1
- package/build/sdk/studio/model/inputBlock.d.ts +3 -1
- package/build/sdk/studio/model/inputBlock.js +3 -2
- package/build/sdk/studio/model/inputBlock.js.map +1 -1
- package/build/sdk/studio/model/kerasResponse.d.ts +6 -2
- package/build/sdk/studio/model/kerasResponse.js +6 -1
- package/build/sdk/studio/model/kerasResponse.js.map +1 -1
- package/build/sdk/studio/model/kerasResponseAllOf.d.ts +6 -2
- package/build/sdk/studio/model/kerasResponseAllOf.js +6 -1
- package/build/sdk/studio/model/kerasResponseAllOf.js.map +1 -1
- package/build/sdk/studio/model/kerasVisualLayer.d.ts +1 -1
- package/build/sdk/studio/model/kerasVisualLayer.js +1 -1
- package/build/sdk/studio/model/kerasVisualLayer.js.map +1 -1
- package/build/sdk/studio/model/listOrganizationFilesResponse.d.ts +1 -0
- package/build/sdk/studio/model/listOrganizationFilesResponse.js +5 -0
- package/build/sdk/studio/model/listOrganizationFilesResponse.js.map +1 -1
- package/build/sdk/studio/model/listOrganizationFilesResponseAllOf.d.ts +1 -0
- package/build/sdk/studio/model/listOrganizationFilesResponseAllOf.js +5 -0
- package/build/sdk/studio/model/listOrganizationFilesResponseAllOf.js.map +1 -1
- package/build/sdk/studio/model/listOrganizationPortalsResponseAllOfPortals.d.ts +1 -0
- package/build/sdk/studio/model/listOrganizationPortalsResponseAllOfPortals.js +5 -0
- package/build/sdk/studio/model/listOrganizationPortalsResponseAllOfPortals.js.map +1 -1
- package/build/sdk/studio/model/modelVariantStats.d.ts +1 -1
- package/build/sdk/studio/model/modelVariantStats.js +1 -1
- package/build/sdk/studio/model/modelVariantStats.js.map +1 -1
- package/build/sdk/studio/model/models.d.ts +8 -0
- package/build/sdk/studio/model/models.js +28 -0
- package/build/sdk/studio/model/models.js.map +1 -1
- package/build/sdk/studio/model/optimizeConfig.d.ts +1 -1
- package/build/sdk/studio/model/optimizeConfig.js +1 -1
- package/build/sdk/studio/model/optimizeConfig.js.map +1 -1
- package/build/sdk/studio/model/optimizeStateResponse.d.ts +4 -0
- package/build/sdk/studio/model/optimizeStateResponse.js +12 -1
- package/build/sdk/studio/model/optimizeStateResponse.js.map +1 -1
- package/build/sdk/studio/model/optimizeStateResponseAllOf.d.ts +4 -0
- package/build/sdk/studio/model/optimizeStateResponseAllOf.js +12 -1
- package/build/sdk/studio/model/optimizeStateResponseAllOf.js.map +1 -1
- package/build/sdk/studio/model/organizationCreateProject.d.ts +1 -0
- package/build/sdk/studio/model/organizationCreateProject.js +5 -0
- package/build/sdk/studio/model/organizationCreateProject.js.map +1 -1
- package/build/sdk/studio/model/organizationGetCreateProjectsResponse.d.ts +2 -1
- package/build/sdk/studio/model/organizationGetCreateProjectsResponse.js +5 -0
- package/build/sdk/studio/model/organizationGetCreateProjectsResponse.js.map +1 -1
- package/build/sdk/studio/model/organizationGetCreateProjectsResponseAllOf.d.ts +2 -1
- package/build/sdk/studio/model/organizationGetCreateProjectsResponseAllOf.js +5 -0
- package/build/sdk/studio/model/organizationGetCreateProjectsResponseAllOf.js.map +1 -1
- package/build/sdk/studio/model/project.d.ts +1 -0
- package/build/sdk/studio/model/project.js +5 -0
- package/build/sdk/studio/model/project.js.map +1 -1
- package/build/sdk/studio/model/projectDataIntervalResponse.d.ts +33 -0
- package/build/sdk/studio/model/projectDataIntervalResponse.js +42 -0
- package/build/sdk/studio/model/projectDataIntervalResponse.js.map +1 -0
- package/build/sdk/studio/model/projectDataIntervalResponseAllOf.d.ts +25 -0
- package/build/sdk/studio/model/projectDataIntervalResponseAllOf.js +32 -0
- package/build/sdk/studio/model/projectDataIntervalResponseAllOf.js.map +1 -0
- package/build/sdk/studio/model/projectInfoResponseAllOfDeploySettings.d.ts +3 -1
- package/build/sdk/studio/model/projectInfoResponseAllOfDeploySettings.js +11 -1
- package/build/sdk/studio/model/projectInfoResponseAllOfDeploySettings.js.map +1 -1
- package/build/sdk/studio/model/rawSamplePayload.d.ts +0 -8
- package/build/sdk/studio/model/rawSamplePayload.js +0 -10
- package/build/sdk/studio/model/rawSamplePayload.js.map +1 -1
- package/build/sdk/studio/model/sample.d.ts +35 -0
- package/build/sdk/studio/model/sample.js +47 -1
- package/build/sdk/studio/model/sample.js.map +1 -1
- package/build/sdk/studio/model/setKerasParameterRequest.d.ts +4 -0
- package/build/sdk/studio/model/setKerasParameterRequest.js +5 -0
- package/build/sdk/studio/model/setKerasParameterRequest.js.map +1 -1
- package/build/sdk/studio/model/tunerTrial.d.ts +6 -0
- package/build/sdk/studio/model/tunerTrial.js +20 -0
- package/build/sdk/studio/model/tunerTrial.js.map +1 -1
- package/build/sdk/studio/model/tunerTrialBlocks.d.ts +29 -0
- package/build/sdk/studio/model/tunerTrialBlocks.js +52 -0
- package/build/sdk/studio/model/tunerTrialBlocks.js.map +1 -0
- package/build/sdk/studio/model/tunerTrialMetadata.d.ts +33 -0
- package/build/sdk/studio/model/tunerTrialMetadata.js +42 -0
- package/build/sdk/studio/model/tunerTrialMetadata.js.map +1 -0
- package/build/sdk/studio/model/updateOrganizationAddCollaboratorRequest.d.ts +32 -0
- package/build/sdk/studio/model/updateOrganizationAddCollaboratorRequest.js +37 -0
- package/build/sdk/studio/model/updateOrganizationAddCollaboratorRequest.js.map +1 -0
- package/build/sdk/studio/model/updateOrganizationCreateEmptyProjectRequest.d.ts +28 -0
- package/build/sdk/studio/model/updateOrganizationCreateEmptyProjectRequest.js +32 -0
- package/build/sdk/studio/model/updateOrganizationCreateEmptyProjectRequest.js.map +1 -0
- package/build/shared/MgmtInterfaceTypes.d.ts +1 -0
- package/build/shared/daemon/ei-serial-protocol.js +3 -1
- package/build/shared/daemon/ei-serial-protocol.js.map +1 -1
- package/build/shared/daemon/remote-mgmt-service.d.ts +2 -1
- package/build/shared/daemon/remote-mgmt-service.js +16 -5
- package/build/shared/daemon/remote-mgmt-service.js.map +1 -1
- package/build/shared/viewmodels/init.d.ts +2 -0
- package/build/shared/viewmodels/init.js +2 -0
- package/build/shared/viewmodels/init.js.map +1 -1
- package/cli/linux/camera-debug.ts +165 -0
- package/cli/linux/linux.ts +106 -16
- package/cli/linux/runner-downloader.ts +2 -2
- package/cli/linux/runner.ts +15 -1
- package/cli/linux/webserver/public/index.html +2 -2
- package/cli/linux/webserver/public/webserver.js +2 -0
- package/package.json +5 -4
package/cli/linux/linux.ts
CHANGED
|
@@ -5,7 +5,7 @@ import inquirer from 'inquirer';
|
|
|
5
5
|
import { initCliApp, setupCliApp } from "../init-cli-app";
|
|
6
6
|
import { RemoteMgmt, RemoteMgmtDevice, RemoteMgmtDeviceSampleEmitter } from "../../shared/daemon/remote-mgmt-service";
|
|
7
7
|
import { MgmtInterfaceSampleRequestSample } from "../../shared/MgmtInterfaceTypes";
|
|
8
|
-
import { makeImage, makeWav, upload } from '../make-image';
|
|
8
|
+
import { makeImage, makeVideo, makeWav, upload } from '../make-image';
|
|
9
9
|
import { Config, EdgeImpulseConfig } from "../config";
|
|
10
10
|
import { EventEmitter } from "tsee";
|
|
11
11
|
import { Mutex } from 'async-mutex';
|
|
@@ -19,6 +19,8 @@ import Path from 'path';
|
|
|
19
19
|
import fs from 'fs';
|
|
20
20
|
import Websocket from 'ws';
|
|
21
21
|
import TypedEmitter from 'typed-emitter';
|
|
22
|
+
import { Prophesee } from "../../library/sensors/prophesee";
|
|
23
|
+
import { VideoRecorder } from "../../library/sensors/video-recorder";
|
|
22
24
|
|
|
23
25
|
const packageVersion = (<{ version: string }>JSON.parse(fs.readFileSync(
|
|
24
26
|
Path.join(__dirname, '..', '..', '..', 'package.json'), 'utf-8'))).version;
|
|
@@ -30,6 +32,8 @@ program
|
|
|
30
32
|
.option('--hmac-key <key>', 'HMAC key to sign new data with (overrides current credentials)')
|
|
31
33
|
.option('--disable-camera', `Don't prompt for camera`)
|
|
32
34
|
.option('--disable-microphone', `Don't prompt for microphone`)
|
|
35
|
+
.option('--width <px>', 'Desired width of the camera stream')
|
|
36
|
+
.option('--height <px>', 'Desired height of the camera stream')
|
|
33
37
|
.option('--clean', 'Clear credentials')
|
|
34
38
|
.option('--silent', `Run in silent mode, don't prompt for credentials`)
|
|
35
39
|
.option('--dev', 'List development servers, alternatively you can use the EI_HOST environmental variable ' +
|
|
@@ -46,6 +50,16 @@ const apiKeyArgv = <string | undefined>program.apiKey;
|
|
|
46
50
|
const hmacKeyArgv = <string | undefined>program.hmacKey;
|
|
47
51
|
const noCamera: boolean = !!program.disableCamera;
|
|
48
52
|
const noMicrophone: boolean = !!program.disableMicrophone;
|
|
53
|
+
const isProphesee = process.env.PROPHESEE_CAM === '1';
|
|
54
|
+
const dimensions = program.width && program.height ? {
|
|
55
|
+
width: Number(program.width),
|
|
56
|
+
height: Number(program.height)
|
|
57
|
+
} : undefined;
|
|
58
|
+
|
|
59
|
+
if ((program.width && !program.height) || (!program.width && program.height)) {
|
|
60
|
+
console.error('--width and --height need to either be both specified or both omitted');
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
49
63
|
|
|
50
64
|
const SERIAL_PREFIX = '\x1b[33m[SER]\x1b[0m';
|
|
51
65
|
|
|
@@ -67,7 +81,7 @@ const cliOptions = {
|
|
|
67
81
|
};
|
|
68
82
|
|
|
69
83
|
class LinuxDevice extends (EventEmitter as new () => TypedEmitter<{
|
|
70
|
-
snapshot: (buffer: Buffer) => void
|
|
84
|
+
snapshot: (buffer: Buffer, filename: string) => void
|
|
71
85
|
}>) implements RemoteMgmtDevice {
|
|
72
86
|
private _camera: ICamera | undefined;
|
|
73
87
|
private _config: EdgeImpulseConfig;
|
|
@@ -86,24 +100,21 @@ class LinuxDevice extends (EventEmitter as new () => TypedEmitter<{
|
|
|
86
100
|
this._devKeys = devKeys;
|
|
87
101
|
|
|
88
102
|
if (this._camera) {
|
|
89
|
-
this._camera.on('snapshot', async (buffer) => {
|
|
103
|
+
this._camera.on('snapshot', async (buffer, filename) => {
|
|
90
104
|
const id = ++this._snapshotId;
|
|
91
105
|
const release = await this._snapshotMutex.acquire();
|
|
92
106
|
|
|
93
|
-
// limit to
|
|
107
|
+
// limit to 10 frames a second & no new frames should have come in...
|
|
94
108
|
try {
|
|
95
109
|
if (this._snapshotStreaming &&
|
|
96
|
-
Date.now() - +this._lastSnapshot
|
|
110
|
+
Date.now() - +this._lastSnapshot >= 100 &&
|
|
97
111
|
id === this._snapshotId) {
|
|
98
112
|
|
|
99
113
|
const jpg = sharp(buffer);
|
|
100
114
|
|
|
101
115
|
const resized = await jpg.resize(undefined, 96).jpeg().toBuffer();
|
|
102
116
|
|
|
103
|
-
|
|
104
|
-
console.log(Date.now(), 'sending snapshot');
|
|
105
|
-
}
|
|
106
|
-
this.emit('snapshot', resized);
|
|
117
|
+
this.emit('snapshot', resized, filename);
|
|
107
118
|
this._lastSnapshot = new Date();
|
|
108
119
|
}
|
|
109
120
|
}
|
|
@@ -149,11 +160,19 @@ class LinuxDevice extends (EventEmitter as new () => TypedEmitter<{
|
|
|
149
160
|
});
|
|
150
161
|
}
|
|
151
162
|
if (camera) {
|
|
163
|
+
let str = dimensions ? `(${dimensions.width}x${dimensions.height})` : `640x480`;
|
|
152
164
|
sensors.push({
|
|
153
|
-
name:
|
|
165
|
+
name: `Camera (${str})`,
|
|
154
166
|
frequencies: [],
|
|
155
167
|
maxSampleLengthS: 60000
|
|
156
168
|
});
|
|
169
|
+
if (isProphesee) {
|
|
170
|
+
sensors.push({
|
|
171
|
+
name: 'Video (1280x720)',
|
|
172
|
+
frequencies: [],
|
|
173
|
+
maxSampleLengthS: 60000
|
|
174
|
+
});
|
|
175
|
+
}
|
|
157
176
|
}
|
|
158
177
|
return sensors;
|
|
159
178
|
}
|
|
@@ -162,6 +181,10 @@ class LinuxDevice extends (EventEmitter as new () => TypedEmitter<{
|
|
|
162
181
|
return true;
|
|
163
182
|
}
|
|
164
183
|
|
|
184
|
+
supportsSnapshotStreamingWhileCapturing() {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
|
|
165
188
|
beforeConnect() {
|
|
166
189
|
return Promise.resolve();
|
|
167
190
|
}
|
|
@@ -216,6 +239,60 @@ class LinuxDevice extends (EventEmitter as new () => TypedEmitter<{
|
|
|
216
239
|
|
|
217
240
|
console.log(SERIAL_PREFIX, 'Sampling finished');
|
|
218
241
|
}
|
|
242
|
+
else if (data.sensor?.startsWith('Video')) {
|
|
243
|
+
if (!this._camera) {
|
|
244
|
+
throw new Error('Linux daemon was started with --no-camera');
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
console.log(SERIAL_PREFIX, 'Waiting 2 seconds');
|
|
248
|
+
|
|
249
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
250
|
+
|
|
251
|
+
ee.emit('started');
|
|
252
|
+
|
|
253
|
+
// give some time to emit...
|
|
254
|
+
await await new Promise((resolve) => setTimeout(resolve, 10));
|
|
255
|
+
|
|
256
|
+
let video = new VideoRecorder(this._camera, verboseArgv);
|
|
257
|
+
let videoEe = await video.record(data.length);
|
|
258
|
+
|
|
259
|
+
videoEe.on('processing', () => ee.emit('processing'));
|
|
260
|
+
|
|
261
|
+
let mp4 = await new Promise<Buffer>((resolve, reject) => {
|
|
262
|
+
if (!this._camera) {
|
|
263
|
+
return reject('No camera');
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
videoEe.on('error', err => {
|
|
267
|
+
reject(err);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
videoEe.on('done', buffer => {
|
|
271
|
+
resolve(buffer);
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
let img = makeVideo(mp4, this._devKeys.hmacKey, data.label + '.mp4');
|
|
276
|
+
|
|
277
|
+
console.log(SERIAL_PREFIX, 'Uploading sample to',
|
|
278
|
+
this._config.endpoints.internal.ingestion + data.path + '...');
|
|
279
|
+
|
|
280
|
+
ee.emit('uploading');
|
|
281
|
+
|
|
282
|
+
await upload({
|
|
283
|
+
apiKey: this._devKeys.apiKey,
|
|
284
|
+
filename: data.label + '.mp4',
|
|
285
|
+
processed: img,
|
|
286
|
+
allowDuplicates: false,
|
|
287
|
+
category: data.path.indexOf('/training') > -1 ? 'training' : 'testing',
|
|
288
|
+
config: this._config,
|
|
289
|
+
dataBuffer: mp4,
|
|
290
|
+
label: data.label,
|
|
291
|
+
boundingBoxes: undefined
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
console.log(SERIAL_PREFIX, 'Sampling finished');
|
|
295
|
+
}
|
|
219
296
|
else if (data.sensor === 'Microphone') {
|
|
220
297
|
if (noMicrophone) {
|
|
221
298
|
throw new Error('Linux daemon was started with --no-microphone');
|
|
@@ -348,7 +425,10 @@ let configFactory: Config;
|
|
|
348
425
|
await configFactory.setLinuxProjectId(projectId);
|
|
349
426
|
|
|
350
427
|
if (!noCamera) {
|
|
351
|
-
if (
|
|
428
|
+
if (isProphesee) {
|
|
429
|
+
camera = new Prophesee(verboseArgv);
|
|
430
|
+
}
|
|
431
|
+
else if (process.platform === 'darwin') {
|
|
352
432
|
camera = new Imagesnap();
|
|
353
433
|
}
|
|
354
434
|
else if (process.platform === 'linux') {
|
|
@@ -458,13 +538,23 @@ let configFactory: Config;
|
|
|
458
538
|
|
|
459
539
|
console.log(SERIAL_PREFIX, 'Using camera', cameraDevice, 'starting...');
|
|
460
540
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
541
|
+
if (isProphesee) {
|
|
542
|
+
await camera.start({
|
|
543
|
+
device: cameraDevice,
|
|
544
|
+
intervalMs: 40,
|
|
545
|
+
dimensions: dimensions
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
await camera.start({
|
|
550
|
+
device: cameraDevice,
|
|
551
|
+
intervalMs: 200,
|
|
552
|
+
dimensions: dimensions
|
|
553
|
+
});
|
|
554
|
+
}
|
|
465
555
|
|
|
466
556
|
camera.on('error', error => {
|
|
467
|
-
console.log('
|
|
557
|
+
console.log('camera error', error);
|
|
468
558
|
});
|
|
469
559
|
|
|
470
560
|
console.log(SERIAL_PREFIX, 'Connected to camera');
|
|
@@ -30,9 +30,9 @@ export class RunnerDownloader extends EventEmitter<{
|
|
|
30
30
|
|
|
31
31
|
let downloadType: string;
|
|
32
32
|
if (process.platform === 'darwin') {
|
|
33
|
-
if (process.arch !== 'x64') {
|
|
33
|
+
if (process.arch !== 'x64' && process.arch !== 'arm64') {
|
|
34
34
|
throw new Error('Unsupported architecture "' + process.arch + '", only ' +
|
|
35
|
-
'x64 supported for now');
|
|
35
|
+
'x64 or arm64 supported for now');
|
|
36
36
|
}
|
|
37
37
|
downloadType = 'runner-mac-x86_64';
|
|
38
38
|
}
|
package/cli/linux/runner.ts
CHANGED
|
@@ -20,6 +20,7 @@ import socketIO from 'socket.io';
|
|
|
20
20
|
import sharp from 'sharp';
|
|
21
21
|
import { AudioRecorder } from '../../library';
|
|
22
22
|
import { ips } from '../get-ips';
|
|
23
|
+
import { Prophesee } from '../../library/sensors/prophesee';
|
|
23
24
|
|
|
24
25
|
const RUNNER_PREFIX = '\x1b[33m[RUN]\x1b[0m';
|
|
25
26
|
const BUILD_PREFIX = '\x1b[32m[BLD]\x1b[0m';
|
|
@@ -309,7 +310,10 @@ function getModelPath(projectId: number, version: number) {
|
|
|
309
310
|
|
|
310
311
|
async function connectCamera(cf: Config) {
|
|
311
312
|
let camera: ICamera;
|
|
312
|
-
if (process.
|
|
313
|
+
if (process.env.PROPHESEE_CAM === '1') {
|
|
314
|
+
camera = new Prophesee(verboseArgv);
|
|
315
|
+
}
|
|
316
|
+
else if (process.platform === 'darwin') {
|
|
313
317
|
camera = new Imagesnap();
|
|
314
318
|
}
|
|
315
319
|
else if (process.platform === 'linux') {
|
|
@@ -412,7 +416,14 @@ function startWebServer(model: ModelInformation, camera: ICamera, imgClassifier:
|
|
|
412
416
|
// you can also get the actual image being classified from 'imageClassifier.on("result")',
|
|
413
417
|
// but then you're limited by the inference speed.
|
|
414
418
|
// here we get a direct feed from the camera so we guarantee the fps that we set earlier.
|
|
419
|
+
|
|
420
|
+
let nextFrame = Date.now();
|
|
421
|
+
let processingFrame = false;
|
|
415
422
|
camera.on('snapshot', async (data) => {
|
|
423
|
+
if (nextFrame > Date.now() || processingFrame) return;
|
|
424
|
+
|
|
425
|
+
processingFrame = true;
|
|
426
|
+
|
|
416
427
|
let img;
|
|
417
428
|
if (model.modelParameters.image_channel_count === 3) {
|
|
418
429
|
img = sharp(data).resize({
|
|
@@ -430,6 +441,9 @@ function startWebServer(model: ModelInformation, camera: ICamera, imgClassifier:
|
|
|
430
441
|
io.emit('image', {
|
|
431
442
|
img: 'data:image/jpeg;base64,' + (await img.jpeg().toBuffer()).toString('base64')
|
|
432
443
|
});
|
|
444
|
+
|
|
445
|
+
nextFrame = Date.now() + 50;
|
|
446
|
+
processingFrame = false;
|
|
433
447
|
});
|
|
434
448
|
|
|
435
449
|
imgClassifier.on('result', async (result, timeMs, imgAsJpg) => {
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
<div class="row mb-4">
|
|
64
64
|
<div class="col">
|
|
65
65
|
<div class="capture-camera-inner">
|
|
66
|
-
<img style="height: 480px">
|
|
66
|
+
<img style="min-height: 480px">
|
|
67
67
|
</div>
|
|
68
68
|
</div>
|
|
69
69
|
</div>
|
|
70
70
|
<div class="row mt-2" id="image-classification-conclusion">
|
|
71
71
|
<h2 class="col"></h2>
|
|
72
72
|
</div>
|
|
73
|
-
<div class="row mt-2">
|
|
73
|
+
<div class="row mt-2" id="time-per-inference-container" style="display: none">
|
|
74
74
|
<div class="col text-xs">Time per inference: <span id="time-per-inference"></span> ms.</div>
|
|
75
75
|
</div>
|
|
76
76
|
</div>
|
|
@@ -5,6 +5,7 @@ window.WebServer = async () => {
|
|
|
5
5
|
cameraContainer: document.querySelector('#capture-camera .capture-camera-inner'),
|
|
6
6
|
cameraImg: document.querySelector('#capture-camera img'),
|
|
7
7
|
timePerInference: document.querySelector('#time-per-inference'),
|
|
8
|
+
timePerInferenceContainer: document.querySelector('#time-per-inference-container'),
|
|
8
9
|
imageClassify: {
|
|
9
10
|
row: document.querySelector('#image-classification-conclusion'),
|
|
10
11
|
text: document.querySelector('#image-classification-conclusion .col'),
|
|
@@ -48,6 +49,7 @@ window.WebServer = async () => {
|
|
|
48
49
|
let result = opts.result;
|
|
49
50
|
|
|
50
51
|
els.timePerInference.textContent = opts.timeMs;
|
|
52
|
+
els.timePerInferenceContainer.style.display = '';
|
|
51
53
|
|
|
52
54
|
console.log('classification', opts.result, opts.timeMs);
|
|
53
55
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-impulse-linux",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Node.js SDK and tools for Edge Impulse for Linux",
|
|
5
5
|
"directories": {
|
|
6
6
|
"example": "examples"
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"bin": {
|
|
13
13
|
"edge-impulse-linux": "build/cli/linux/linux.js",
|
|
14
|
-
"edge-impulse-linux-runner": "build/cli/linux/runner.js"
|
|
14
|
+
"edge-impulse-linux-runner": "build/cli/linux/runner.js",
|
|
15
|
+
"edge-impulse-camera-debug": "build/cli/linux/camera-debug.js"
|
|
15
16
|
},
|
|
16
17
|
"main": "build/library/index.js",
|
|
17
18
|
"types": "build/library/index.d.ts",
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
},
|
|
27
28
|
"homepage": "https://github.com/edgeimpulse/linux-sdk-node#readme",
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@types/sharp": "0.
|
|
30
|
+
"@types/sharp": "0.29.1",
|
|
30
31
|
"async-mutex": "0.2.6",
|
|
31
32
|
"borc": "2.1.2",
|
|
32
33
|
"cbor": "5.0.1",
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"npm-registry-fetch": "5.0.0",
|
|
38
39
|
"request": "2.88.0",
|
|
39
40
|
"request-promise": "4.2.4",
|
|
40
|
-
"sharp": "0.
|
|
41
|
+
"sharp": "0.29.1",
|
|
41
42
|
"socket.io": "2.3.0",
|
|
42
43
|
"tiny-async-pool": "1.1.0",
|
|
43
44
|
"tsee": "1.3.0",
|