edge-impulse-api 1.92.1 → 1.92.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 (25) hide show
  1. package/build/library/sdk/api/rawDataApi.d.ts +34 -0
  2. package/build/library/sdk/api/rawDataApi.js +231 -0
  3. package/build/library/sdk/api/rawDataApi.js.map +1 -1
  4. package/build/library/sdk/model/datasetStratificationOptions.d.ts +40 -0
  5. package/build/library/sdk/model/datasetStratificationOptions.js +44 -0
  6. package/build/library/sdk/model/datasetStratificationOptions.js.map +1 -0
  7. package/build/library/sdk/model/datasetStratificationPreviewData.d.ts +26 -0
  8. package/build/library/sdk/model/datasetStratificationPreviewData.js +29 -0
  9. package/build/library/sdk/model/datasetStratificationPreviewData.js.map +1 -0
  10. package/build/library/sdk/model/datasetStratificationPreviewDataData.d.ts +28 -0
  11. package/build/library/sdk/model/datasetStratificationPreviewDataData.js +44 -0
  12. package/build/library/sdk/model/datasetStratificationPreviewDataData.js.map +1 -0
  13. package/build/library/sdk/model/datasetStratificationPreviewResponse.d.ts +34 -0
  14. package/build/library/sdk/model/datasetStratificationPreviewResponse.js +39 -0
  15. package/build/library/sdk/model/datasetStratificationPreviewResponse.js.map +1 -0
  16. package/build/library/sdk/model/models.d.ts +4 -0
  17. package/build/library/sdk/model/models.js +12 -0
  18. package/build/library/sdk/model/models.js.map +1 -1
  19. package/build/library/sdk/model/projectInfoResponse.d.ts +2 -0
  20. package/build/library/sdk/model/projectInfoResponse.js +5 -0
  21. package/build/library/sdk/model/projectInfoResponse.js.map +1 -1
  22. package/build/library/sdk/model/projectInfoResponseAllOf.d.ts +2 -0
  23. package/build/library/sdk/model/projectInfoResponseAllOf.js +5 -0
  24. package/build/library/sdk/model/projectInfoResponseAllOf.js.map +1 -1
  25. package/package.json +1 -1
@@ -21,6 +21,8 @@ import { CropSampleRequest } from '../model/cropSampleRequest';
21
21
  import { CropSampleResponse } from '../model/cropSampleResponse';
22
22
  import { DataExplorerPredictionsResponse } from '../model/dataExplorerPredictionsResponse';
23
23
  import { DataExplorerSettings } from '../model/dataExplorerSettings';
24
+ import { DatasetStratificationOptions } from '../model/datasetStratificationOptions';
25
+ import { DatasetStratificationPreviewResponse } from '../model/datasetStratificationPreviewResponse';
24
26
  import { EditSampleLabelRequest } from '../model/editSampleLabelRequest';
25
27
  import { FindSegmentSampleRequest } from '../model/findSegmentSampleRequest';
26
28
  import { FindSegmentSampleResponse } from '../model/findSegmentSampleResponse';
@@ -1074,6 +1076,16 @@ export declare class RawDataApi {
1074
1076
  [name: string]: string;
1075
1077
  };
1076
1078
  }): Promise<GetSampleResponse>;
1079
+ /**
1080
+ * Returns the results of a previously requested stratification preview job. This endpoint is used to retrieve the results after a stratification preview job has been started.
1081
+ * @summary Get stratify preview results
1082
+ * @param projectId Project ID
1083
+ */
1084
+ getStratifyPreviewResults(projectId: number, options?: {
1085
+ headers: {
1086
+ [name: string]: string;
1087
+ };
1088
+ }): Promise<DatasetStratificationPreviewResponse>;
1077
1089
  /**
1078
1090
  * Get the original, uncropped, downsampled data.
1079
1091
  * @summary Get the original downsampled data
@@ -1338,6 +1350,28 @@ export declare class RawDataApi {
1338
1350
  [name: string]: string;
1339
1351
  };
1340
1352
  }): Promise<GenericApiResponse>;
1353
+ /**
1354
+ * Performs a deterministic, in-place stratified split of the project\'s dataset into \"training\" and \"testing\" sets, based on the chosen stratification options. Stratification can use the label, one or more metadata keys, or both as a composite group. This is a deterministic process based on the hash of the name of the data. Returns immediately on small datasets, or starts a job on larger datasets. For example: { \"stratifyByLabel\": true, \"metadataKeys\": [\"site\", \"scanner\"], \"excludeDisabledSamples\": false, \"splitRatio\": 0.8 } With these options, samples are grouped by the combination of label, site, and scanner. Within each group, 80% are set to \"training\" and the rest to \"testing\".
1355
+ * @summary Stratify dataset
1356
+ * @param projectId Project ID
1357
+ * @param datasetStratificationOptions
1358
+ */
1359
+ stratifyDataset(projectId: number, datasetStratificationOptions: DatasetStratificationOptions, options?: {
1360
+ headers: {
1361
+ [name: string]: string;
1362
+ };
1363
+ }): Promise<GenericApiResponse | StartJobResponse>;
1364
+ /**
1365
+ * Returns a preview of how the project\'s dataset would be balanced if the current stratification options were applied. For each group (composite of label and/or metadata keys), shows the number and percentage of samples that would be assigned to each split (\"training\"/\"testing\"). This does not update the dataset, only provides a summary. Returns immediately on small datasets, or starts a job on larger datasets.
1366
+ * @summary Stratify dataset preview
1367
+ * @param projectId Project ID
1368
+ * @param datasetStratificationOptions
1369
+ */
1370
+ stratifyDatasetPreview(projectId: number, datasetStratificationOptions: DatasetStratificationOptions, options?: {
1371
+ headers: {
1372
+ [name: string]: string;
1373
+ };
1374
+ }): Promise<DatasetStratificationPreviewResponse | StartJobResponse>;
1341
1375
  /**
1342
1376
  * Track objects between two samples. Source sample should have bounding boxes set.
1343
1377
  * @summary Track objects
@@ -4214,6 +4214,79 @@ class RawDataApi {
4214
4214
  const response = await fetch(url, requestOptions);
4215
4215
  return this.handleResponse(response, 'GetSampleResponse');
4216
4216
  }
4217
+ /**
4218
+ * Returns the results of a previously requested stratification preview job. This endpoint is used to retrieve the results after a stratification preview job has been started.
4219
+ * @summary Get stratify preview results
4220
+ * @param projectId Project ID
4221
+ */
4222
+ async getStratifyPreviewResults(projectId, options = { headers: {} }) {
4223
+ const localVarPath = this.basePath + '/api/{projectId}/get-stratify-preview-results'
4224
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
4225
+ let localVarQueryParameters = {};
4226
+ let localVarHeaderParams = {
4227
+ 'User-Agent': 'edgeimpulse-api nodejs',
4228
+ 'Content-Type': 'application/json',
4229
+ ...this.defaultHeaders,
4230
+ };
4231
+ const produces = ['application/json'];
4232
+ // give precedence to 'application/json'
4233
+ if (produces.indexOf('application/json') >= 0) {
4234
+ localVarHeaderParams.Accept = 'application/json';
4235
+ }
4236
+ else {
4237
+ localVarHeaderParams.Accept = produces.join(',');
4238
+ }
4239
+ let localVarFormParams;
4240
+ // verify required parameter 'projectId' is not null or undefined
4241
+ if (projectId === null || projectId === undefined) {
4242
+ throw new Error('Required parameter projectId was null or undefined when calling getStratifyPreviewResults.');
4243
+ }
4244
+ localVarHeaderParams = {
4245
+ ...localVarHeaderParams,
4246
+ ...options.headers,
4247
+ ...this.opts.extraHeaders,
4248
+ };
4249
+ const queryString = Object.entries(localVarQueryParameters)
4250
+ .filter(([, value]) => value !== undefined)
4251
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
4252
+ .join('&');
4253
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
4254
+ let localVarRequestOptions = {
4255
+ method: 'GET',
4256
+ headers: { ...localVarHeaderParams },
4257
+ };
4258
+ let requestOptions = localVarRequestOptions;
4259
+ let url = localVarUrl;
4260
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
4261
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
4262
+ url = auth_ApiKeyAuthentication.url;
4263
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
4264
+ requestOptions = auth_JWTAuthentication.requestOptions;
4265
+ url = auth_JWTAuthentication.url;
4266
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
4267
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
4268
+ url = auth_JWTHttpHeaderAuthentication.url;
4269
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
4270
+ requestOptions = auth_OAuth2.requestOptions;
4271
+ url = auth_OAuth2.url;
4272
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
4273
+ requestOptions = authDefault.requestOptions;
4274
+ url = authDefault.url;
4275
+ if (localVarFormParams) {
4276
+ delete requestOptions.headers['Content-Type'];
4277
+ if (localVarFormParams instanceof FormData) {
4278
+ // FormData: fetch will handle Content-Type automatically.
4279
+ requestOptions.body = localVarFormParams;
4280
+ }
4281
+ else if (Object.keys(localVarFormParams).length > 0) {
4282
+ // URL-encoded form
4283
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
4284
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
4285
+ }
4286
+ }
4287
+ const response = await fetch(url, requestOptions);
4288
+ return this.handleResponse(response, 'DatasetStratificationPreviewResponse');
4289
+ }
4217
4290
  /**
4218
4291
  * Get the original, uncropped, downsampled data.
4219
4292
  * @summary Get the original downsampled data
@@ -6017,6 +6090,164 @@ class RawDataApi {
6017
6090
  const response = await fetch(url, requestOptions);
6018
6091
  return this.handleResponse(response, 'GenericApiResponse');
6019
6092
  }
6093
+ /**
6094
+ * Performs a deterministic, in-place stratified split of the project\'s dataset into \"training\" and \"testing\" sets, based on the chosen stratification options. Stratification can use the label, one or more metadata keys, or both as a composite group. This is a deterministic process based on the hash of the name of the data. Returns immediately on small datasets, or starts a job on larger datasets. For example: { \"stratifyByLabel\": true, \"metadataKeys\": [\"site\", \"scanner\"], \"excludeDisabledSamples\": false, \"splitRatio\": 0.8 } With these options, samples are grouped by the combination of label, site, and scanner. Within each group, 80% are set to \"training\" and the rest to \"testing\".
6095
+ * @summary Stratify dataset
6096
+ * @param projectId Project ID
6097
+ * @param datasetStratificationOptions
6098
+ */
6099
+ async stratifyDataset(projectId, datasetStratificationOptions, options = { headers: {} }) {
6100
+ const localVarPath = this.basePath + '/api/{projectId}/stratify'
6101
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
6102
+ let localVarQueryParameters = {};
6103
+ let localVarHeaderParams = {
6104
+ 'User-Agent': 'edgeimpulse-api nodejs',
6105
+ 'Content-Type': 'application/json',
6106
+ ...this.defaultHeaders,
6107
+ };
6108
+ const produces = ['application/json'];
6109
+ // give precedence to 'application/json'
6110
+ if (produces.indexOf('application/json') >= 0) {
6111
+ localVarHeaderParams.Accept = 'application/json';
6112
+ }
6113
+ else {
6114
+ localVarHeaderParams.Accept = produces.join(',');
6115
+ }
6116
+ let localVarFormParams;
6117
+ // verify required parameter 'projectId' is not null or undefined
6118
+ if (projectId === null || projectId === undefined) {
6119
+ throw new Error('Required parameter projectId was null or undefined when calling stratifyDataset.');
6120
+ }
6121
+ // verify required parameter 'datasetStratificationOptions' is not null or undefined
6122
+ if (datasetStratificationOptions === null || datasetStratificationOptions === undefined) {
6123
+ throw new Error('Required parameter datasetStratificationOptions was null or undefined when calling stratifyDataset.');
6124
+ }
6125
+ localVarHeaderParams = {
6126
+ ...localVarHeaderParams,
6127
+ ...options.headers,
6128
+ ...this.opts.extraHeaders,
6129
+ };
6130
+ const queryString = Object.entries(localVarQueryParameters)
6131
+ .filter(([, value]) => value !== undefined)
6132
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
6133
+ .join('&');
6134
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
6135
+ let localVarRequestOptions = {
6136
+ method: 'POST',
6137
+ headers: { ...localVarHeaderParams },
6138
+ };
6139
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(datasetStratificationOptions, "DatasetStratificationOptions"));
6140
+ let requestOptions = localVarRequestOptions;
6141
+ let url = localVarUrl;
6142
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
6143
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
6144
+ url = auth_ApiKeyAuthentication.url;
6145
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
6146
+ requestOptions = auth_JWTAuthentication.requestOptions;
6147
+ url = auth_JWTAuthentication.url;
6148
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
6149
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
6150
+ url = auth_JWTHttpHeaderAuthentication.url;
6151
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
6152
+ requestOptions = auth_OAuth2.requestOptions;
6153
+ url = auth_OAuth2.url;
6154
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
6155
+ requestOptions = authDefault.requestOptions;
6156
+ url = authDefault.url;
6157
+ if (localVarFormParams) {
6158
+ delete requestOptions.headers['Content-Type'];
6159
+ if (localVarFormParams instanceof FormData) {
6160
+ // FormData: fetch will handle Content-Type automatically.
6161
+ requestOptions.body = localVarFormParams;
6162
+ }
6163
+ else if (Object.keys(localVarFormParams).length > 0) {
6164
+ // URL-encoded form
6165
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
6166
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
6167
+ }
6168
+ }
6169
+ const response = await fetch(url, requestOptions);
6170
+ return this.handleResponse(response, 'GenericApiResponse | StartJobResponse');
6171
+ }
6172
+ /**
6173
+ * Returns a preview of how the project\'s dataset would be balanced if the current stratification options were applied. For each group (composite of label and/or metadata keys), shows the number and percentage of samples that would be assigned to each split (\"training\"/\"testing\"). This does not update the dataset, only provides a summary. Returns immediately on small datasets, or starts a job on larger datasets.
6174
+ * @summary Stratify dataset preview
6175
+ * @param projectId Project ID
6176
+ * @param datasetStratificationOptions
6177
+ */
6178
+ async stratifyDatasetPreview(projectId, datasetStratificationOptions, options = { headers: {} }) {
6179
+ const localVarPath = this.basePath + '/api/{projectId}/stratify-preview'
6180
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
6181
+ let localVarQueryParameters = {};
6182
+ let localVarHeaderParams = {
6183
+ 'User-Agent': 'edgeimpulse-api nodejs',
6184
+ 'Content-Type': 'application/json',
6185
+ ...this.defaultHeaders,
6186
+ };
6187
+ const produces = ['application/json'];
6188
+ // give precedence to 'application/json'
6189
+ if (produces.indexOf('application/json') >= 0) {
6190
+ localVarHeaderParams.Accept = 'application/json';
6191
+ }
6192
+ else {
6193
+ localVarHeaderParams.Accept = produces.join(',');
6194
+ }
6195
+ let localVarFormParams;
6196
+ // verify required parameter 'projectId' is not null or undefined
6197
+ if (projectId === null || projectId === undefined) {
6198
+ throw new Error('Required parameter projectId was null or undefined when calling stratifyDatasetPreview.');
6199
+ }
6200
+ // verify required parameter 'datasetStratificationOptions' is not null or undefined
6201
+ if (datasetStratificationOptions === null || datasetStratificationOptions === undefined) {
6202
+ throw new Error('Required parameter datasetStratificationOptions was null or undefined when calling stratifyDatasetPreview.');
6203
+ }
6204
+ localVarHeaderParams = {
6205
+ ...localVarHeaderParams,
6206
+ ...options.headers,
6207
+ ...this.opts.extraHeaders,
6208
+ };
6209
+ const queryString = Object.entries(localVarQueryParameters)
6210
+ .filter(([, value]) => value !== undefined)
6211
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
6212
+ .join('&');
6213
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
6214
+ let localVarRequestOptions = {
6215
+ method: 'POST',
6216
+ headers: { ...localVarHeaderParams },
6217
+ };
6218
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(datasetStratificationOptions, "DatasetStratificationOptions"));
6219
+ let requestOptions = localVarRequestOptions;
6220
+ let url = localVarUrl;
6221
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
6222
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
6223
+ url = auth_ApiKeyAuthentication.url;
6224
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
6225
+ requestOptions = auth_JWTAuthentication.requestOptions;
6226
+ url = auth_JWTAuthentication.url;
6227
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
6228
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
6229
+ url = auth_JWTHttpHeaderAuthentication.url;
6230
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
6231
+ requestOptions = auth_OAuth2.requestOptions;
6232
+ url = auth_OAuth2.url;
6233
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
6234
+ requestOptions = authDefault.requestOptions;
6235
+ url = authDefault.url;
6236
+ if (localVarFormParams) {
6237
+ delete requestOptions.headers['Content-Type'];
6238
+ if (localVarFormParams instanceof FormData) {
6239
+ // FormData: fetch will handle Content-Type automatically.
6240
+ requestOptions.body = localVarFormParams;
6241
+ }
6242
+ else if (Object.keys(localVarFormParams).length > 0) {
6243
+ // URL-encoded form
6244
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
6245
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
6246
+ }
6247
+ }
6248
+ const response = await fetch(url, requestOptions);
6249
+ return this.handleResponse(response, 'DatasetStratificationPreviewResponse | StartJobResponse');
6250
+ }
6020
6251
  /**
6021
6252
  * Track objects between two samples. Source sample should have bounding boxes set.
6022
6253
  * @summary Track objects