repzo 1.0.291 → 1.0.293

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 (34) hide show
  1. package/changelog.md +28 -0
  2. package/lib/index.d.ts +244 -2
  3. package/lib/index.js +541 -0
  4. package/lib/types/index.d.ts +4533 -1
  5. package/package.json +1 -1
  6. package/src/index.ts +1270 -0
  7. package/src/oas/activity-ai-object-detection-session-frame.yaml +600 -0
  8. package/src/oas/ai-object-detection-assigned-missions.yaml +283 -0
  9. package/src/oas/ai-object-detection-assignment-rule.yaml +357 -0
  10. package/src/oas/ai-object-detection-category.yaml +338 -0
  11. package/src/oas/ai-object-detection-dataset.yaml +342 -0
  12. package/src/oas/ai-object-detection-detection-settings.yaml +410 -0
  13. package/src/oas/ai-object-detection-inference.yaml +818 -0
  14. package/src/oas/ai-object-detection-label-group.yaml +265 -0
  15. package/src/oas/ai-object-detection-label-report.yaml +366 -0
  16. package/src/oas/ai-object-detection-label.yaml +395 -0
  17. package/src/oas/ai-object-detection-metric-result.yaml +734 -0
  18. package/src/oas/ai-object-detection-metric.yaml +559 -0
  19. package/src/oas/ai-object-detection-mission-results.yaml +370 -0
  20. package/src/oas/ai-object-detection-mission-set.yaml +250 -0
  21. package/src/oas/ai-object-detection-mission.yaml +349 -0
  22. package/src/oas/ai-object-detection-model-version-epoch.yaml +214 -0
  23. package/src/oas/ai-object-detection-model-version-train-agent.yaml +88 -0
  24. package/src/oas/ai-object-detection-model-version.yaml +567 -0
  25. package/src/oas/ai-object-detection-model.yaml +369 -0
  26. package/src/oas/ai-object-detection-segment.yaml +301 -0
  27. package/src/oas/ai-object-detection-session-analysis.yaml +1306 -0
  28. package/src/oas/ai-object-detection-session-election.yaml +193 -0
  29. package/src/oas/ai-object-detection-session-insight.yaml +418 -0
  30. package/src/oas/ai-object-detection-session.yaml +840 -0
  31. package/src/oas/ai-object-detection-settings.yaml +249 -0
  32. package/src/oas/ai-object-detection-task.yaml +1007 -0
  33. package/src/oas/object-detection-analytics-report.yaml +674 -0
  34. package/src/types/index.ts +5159 -1
@@ -0,0 +1,567 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: Repzo API - AI Object Detection Model Version
4
+ version: 1.0.0
5
+ description: |
6
+ Manages **training versions** of an object-detection model. A version pins a
7
+ `model`, one or more `dataset`s (whose labels are unioned into
8
+ `dataset_labels`), the `initial_weight` to start from, a
9
+ `task_selection_mode` and optional `train_settings[]`; the server assigns a
10
+ per-model `version_code`, stamps the `creator` from the JWT and sets
11
+ `status: initiated`.
12
+
13
+ **Async dataset prep.** Creating a version enqueues a job (via the
14
+ `svFifoAlarm` SQS queue) that builds a YOLO dataset from the qualifying
15
+ `ai-object-detection-task`s of the selected datasets — tasks with media, a
16
+ non-`ignore` subset and at least one usable & confirmed annotation group
17
+ (`smart` mode keeps only `manual` / `auto_edited` groups, `all` also keeps
18
+ untouched `auto` groups). Unpinned tasks are dealt into train/val/test by the
19
+ parent model's `validation_size` / `test_size`, the folder is zipped and
20
+ stored as `train_data`, and `tasks_size`, `annotations_size` and
21
+ `annotations_per_label[]` record what went into the zip. Progress is
22
+ visible in `status` (`building_folder_in_progress` → … →
23
+ `zip_file_completed`); failures set a `*_failed` status and append to
24
+ `_errors[]`. A selection with no qualifying tasks fails with
25
+ `building_folder_failed` instead of shipping an empty zip.
26
+
27
+ **Training.** The run itself happens on a self-hosted agent using the
28
+ snippet from `ai-object-detection-model-version-train-agent`. Per-epoch
29
+ metrics stream into `ai-object-detection-model-version-epoch`; when the
30
+ weights (`weight_best` / `weight_last`) and plots are uploaded through the
31
+ `ul-hub` endpoints the version flips to `trained`, its best-epoch `metrics`
32
+ / `model_stats` are snapshotted, and the parent model's
33
+ `current_model_version` auto-advances (forward-only).
34
+
35
+ **Who calls it.** Back-office admins. Scoped by `company_namespace[]`;
36
+ soft-delete via `disabled`. Child of `ai-object-detection-model`.
37
+
38
+ **Methods.** `find`, `get`, `create`, `remove`. `update` and `patch` return
39
+ 400 (a version's definition is immutable once created). `model`, `dataset`,
40
+ `dataset_labels` and every media-backed field can be populated with
41
+ `populatedKeys[]`; populated documents are returned under
42
+ `<field>_populated` while the original field keeps the id(s).
43
+ servers:
44
+ - url: https://sv.api.repzo.me
45
+ security:
46
+ - ApiKeyAuth: []
47
+ - JwtAuth: []
48
+ paths:
49
+ /ai-object-detection-model-version:
50
+ get:
51
+ summary: Find model versions
52
+ operationId: findAiObjectDetectionModelVersions
53
+ parameters:
54
+ - in: query
55
+ name: _id
56
+ description: "Filter by version `_id`. Pass once or as `?_id[]=...` for multiple."
57
+ schema:
58
+ oneOf:
59
+ - type: string
60
+ - type: array
61
+ items: { type: string }
62
+ - in: query
63
+ name: model
64
+ description: Filter by parent model id (one or many).
65
+ schema:
66
+ oneOf:
67
+ - type: string
68
+ - type: array
69
+ items: { type: string }
70
+ - in: query
71
+ name: version_code
72
+ description: Filter by the per-model version number (one or many).
73
+ schema:
74
+ oneOf:
75
+ - type: integer
76
+ - type: array
77
+ items: { type: integer }
78
+ - in: query
79
+ name: dataset
80
+ description: Versions pinning any of the given dataset ids.
81
+ schema:
82
+ oneOf:
83
+ - type: string
84
+ - type: array
85
+ items: { type: string }
86
+ - in: query
87
+ name: dataset_labels
88
+ description: Versions whose label set contains any of the given label ids.
89
+ schema:
90
+ oneOf:
91
+ - type: string
92
+ - type: array
93
+ items: { type: string }
94
+ - in: query
95
+ name: name
96
+ description: Accepted by the backend but the schema has no `name` field — effectively a no-op.
97
+ schema: { type: string }
98
+ - in: query
99
+ name: disabled
100
+ description: Include soft-deleted versions. Defaults to `false`.
101
+ schema: { type: boolean, default: false }
102
+ - in: query
103
+ name: from_updatedAt
104
+ description: Only versions with `updatedAt` on/after this Unix timestamp (ms), start of that day in the caller's timezone.
105
+ schema: { type: number }
106
+ - in: query
107
+ name: to_updatedAt
108
+ description: Only versions with `updatedAt` on/before this Unix timestamp (ms), end of that day.
109
+ schema: { type: number }
110
+ - in: query
111
+ name: from_createdAt
112
+ description: Only versions with `createdAt` on/after this Unix timestamp (ms).
113
+ schema: { type: number }
114
+ - in: query
115
+ name: to_createdAt
116
+ description: Only versions with `createdAt` on/before this Unix timestamp (ms).
117
+ schema: { type: number }
118
+ - in: query
119
+ name: populatedKeys
120
+ description: "Refs to populate. Each is returned under `<field>_populated`; the original field keeps the id(s). Encode as `?populatedKeys[]=model&populatedKeys[]=weight_best`."
121
+ schema:
122
+ type: array
123
+ items:
124
+ type: string
125
+ enum:
126
+ [
127
+ model,
128
+ train_data,
129
+ dataset,
130
+ dataset_labels,
131
+ confusion_matrix_normalized,
132
+ args,
133
+ confusion_matrix,
134
+ F1_curve,
135
+ labels_correlogram,
136
+ labels,
137
+ P_curve,
138
+ PR_curve,
139
+ R_curve,
140
+ results_csv,
141
+ results,
142
+ val_batch0_labels,
143
+ val_batch0_pred,
144
+ weight_best,
145
+ weight_last,
146
+ ]
147
+ - in: query
148
+ name: per_page
149
+ schema: { type: integer, minimum: 1, maximum: 50000 }
150
+ example: 20
151
+ - in: query
152
+ name: page
153
+ schema: { type: integer, minimum: 1 }
154
+ example: 1
155
+ - in: query
156
+ name: sort
157
+ description: Field to sort by. Defaults to `_id`.
158
+ schema: { type: string }
159
+ - in: query
160
+ name: sortPageOrder
161
+ description: Sort direction. Defaults to descending.
162
+ schema: { type: string, enum: [asc, dsc] }
163
+ responses:
164
+ "200":
165
+ {
166
+ description: Paginated list of model versions.,
167
+ content:
168
+ {
169
+ application/json:
170
+ {
171
+ schema:
172
+ { $ref: "#/components/schemas/OdModelVersionFindResult" },
173
+ },
174
+ },
175
+ }
176
+ post:
177
+ summary: Create a model version (starts dataset prep)
178
+ description: |
179
+ Validates that `model` exists in the namespace, derives `dataset_labels`
180
+ from the selected datasets, assigns the next `version_code` for that
181
+ model, stamps `creator` from the JWT, sets `status: initiated` and
182
+ enqueues the dataset-prep job. If the queue call fails the request
183
+ fails (the version stays `initiated`).
184
+ operationId: createAiObjectDetectionModelVersion
185
+ requestBody:
186
+ {
187
+ required: true,
188
+ content:
189
+ {
190
+ application/json:
191
+ {
192
+ schema:
193
+ { $ref: "#/components/schemas/OdModelVersionCreateBody" },
194
+ },
195
+ },
196
+ }
197
+ responses:
198
+ "201":
199
+ description: "The created version with `dataset`, `model` and `dataset_labels` populated in place; the prep job is queued (`status` is still `initiated` in the response)."
200
+ content:
201
+ application/json:
202
+ schema:
203
+ { $ref: "#/components/schemas/OdModelVersionCreateResult" }
204
+ "400":
205
+ {
206
+ description: "`model` missing or not found in the namespace, or `dataset` empty.",
207
+ }
208
+ /ai-object-detection-model-version/{id}:
209
+ get:
210
+ summary: Get a model version by id
211
+ operationId: getAiObjectDetectionModelVersion
212
+ parameters:
213
+ - { in: path, name: id, required: true, schema: { type: string } }
214
+ - in: query
215
+ name: populatedKeys
216
+ description: Refs to populate (same semantics as on find).
217
+ schema:
218
+ type: array
219
+ items:
220
+ type: string
221
+ enum:
222
+ [
223
+ model,
224
+ train_data,
225
+ dataset,
226
+ dataset_labels,
227
+ confusion_matrix_normalized,
228
+ args,
229
+ confusion_matrix,
230
+ F1_curve,
231
+ labels_correlogram,
232
+ labels,
233
+ P_curve,
234
+ PR_curve,
235
+ R_curve,
236
+ results_csv,
237
+ results,
238
+ val_batch0_labels,
239
+ val_batch0_pred,
240
+ weight_best,
241
+ weight_last,
242
+ ]
243
+ responses:
244
+ "200":
245
+ {
246
+ description: The model version (with metrics/artifacts once trained).,
247
+ content:
248
+ {
249
+ application/json:
250
+ {
251
+ schema:
252
+ { $ref: "#/components/schemas/OdModelVersionSchema" },
253
+ },
254
+ },
255
+ }
256
+ "400": { description: No version with that id. }
257
+ delete:
258
+ summary: Soft-delete a model version
259
+ description: "Sets `disabled: true`."
260
+ operationId: removeAiObjectDetectionModelVersion
261
+ parameters:
262
+ [{ in: path, name: id, required: true, schema: { type: string } }]
263
+ responses:
264
+ "200":
265
+ {
266
+ description: The version after soft-deletion.,
267
+ content:
268
+ {
269
+ application/json:
270
+ {
271
+ schema:
272
+ { $ref: "#/components/schemas/OdModelVersionSchema" },
273
+ },
274
+ },
275
+ }
276
+ components:
277
+ securitySchemes:
278
+ ApiKeyAuth:
279
+ {
280
+ type: apiKey,
281
+ in: header,
282
+ name: api-key,
283
+ description: "Server-issued API key. Also `x-api-key` header or `?apiKey=` query.",
284
+ }
285
+ JwtAuth:
286
+ {
287
+ type: apiKey,
288
+ in: header,
289
+ name: Authorization,
290
+ description: "Raw JWT — no `Bearer ` prefix. From `POST /authenticate`.",
291
+ }
292
+ schemas:
293
+ OdModelVersionCreator:
294
+ type: object
295
+ description: Creator stamp taken from the JWT; only admins create versions.
296
+ properties:
297
+ _id: { type: string }
298
+ type: { type: string, enum: [admin] }
299
+ admin: { type: string }
300
+ name: { type: string }
301
+ OdModelVersionAnnotationPerLabel:
302
+ type: object
303
+ description: Per-label box count written into the YOLO label files — the class balance of the export.
304
+ properties:
305
+ label_id: { type: string }
306
+ name: { type: string }
307
+ size: { type: integer }
308
+ OdModelVersionTrainSettings:
309
+ type: object
310
+ additionalProperties: true
311
+ description: "Free-form Ultralytics train args. The HUB endpoint reads `epochs` and `imgsz` from the first element."
312
+ properties:
313
+ epochs: { type: integer }
314
+ imgsz: { type: integer }
315
+ batch: { type: integer }
316
+ OdModelVersionMetrics:
317
+ type: object
318
+ description: |
319
+ Headline metrics of the BEST epoch (highest mAP50-95 — the epoch
320
+ `best.pt` was saved from), snapshotted when the weights upload
321
+ completes training. The full per-epoch series lives in
322
+ `ai-object-detection-model-version-epoch`; this copy exists so lists
323
+ can show mAP without fetching a whole run. Absent on versions
324
+ trained before this snapshot existed.
325
+ properties:
326
+ mAP50: { type: number }
327
+ mAP50_95: { type: number }
328
+ precision: { type: number }
329
+ recall: { type: number }
330
+ best_epoch:
331
+ { type: integer, description: "`_index` of the best epoch." }
332
+ epochs_reported: { type: integer }
333
+ OdModelVersionModelStats:
334
+ type: object
335
+ description: Architecture cost reported by Ultralytics during training.
336
+ properties:
337
+ parameters: { type: integer }
338
+ GFLOPs: { type: number }
339
+ speed_PyTorch_ms: { type: number }
340
+ OdModelVersionSchema:
341
+ type: object
342
+ description: "Object-detection model version. Prep-job outputs (`train_data`, sizes, per-label counts) appear as the job runs; weights, plots and metrics appear after training."
343
+ properties:
344
+ _id: { type: string }
345
+ version_code:
346
+ {
347
+ type: integer,
348
+ description: Server-assigned,
349
+ 1-based,
350
+ increments per model within the namespace.,
351
+ }
352
+ model: { type: string, description: "`ai-object-detection-model` id." }
353
+ dataset:
354
+ {
355
+ type: array,
356
+ items: { type: string },
357
+ description: "`ai-object-detection-dataset` ids.",
358
+ }
359
+ dataset_labels:
360
+ {
361
+ type: array,
362
+ items: { type: string },
363
+ description: Server-derived union of the datasets' labels.,
364
+ }
365
+ status:
366
+ type: string
367
+ enum:
368
+ [
369
+ initiated,
370
+ setting_alarm_completed,
371
+ building_folder_in_progress,
372
+ building_folder_failed,
373
+ building_yaml_file_in_progress,
374
+ building_yaml_file_completed,
375
+ stream_tasks_in_progress,
376
+ stream_tasks_failed,
377
+ compress_folder_in_progress,
378
+ compress_folder_failed,
379
+ uploading_zip_to_s3_in_progress,
380
+ uploading_zip_to_s3_failed,
381
+ zip_file_completed,
382
+ trained,
383
+ ]
384
+ description: "Dataset-prep lifecycle, then `trained` once `ul-hub` receives the weights."
385
+ suppress_exceeding_sizes:
386
+ {
387
+ type: boolean,
388
+ description: Reserved flag; the split logic currently clamps shortfalls at 0 regardless.,
389
+ }
390
+ train_data:
391
+ {
392
+ type: string,
393
+ description: Media id of the YOLO dataset zip produced by the prep job.,
394
+ }
395
+ creator: { $ref: "#/components/schemas/OdModelVersionCreator" }
396
+ task_selection_mode:
397
+ {
398
+ type: string,
399
+ enum: [smart, all],
400
+ description: "`smart` = only manual / auto_edited annotation groups; `all` also includes untouched auto groups.",
401
+ }
402
+ tasks_size:
403
+ {
404
+ type: integer,
405
+ description: Tasks that produced an image + label file in the zip.,
406
+ }
407
+ validation_size: { type: number }
408
+ test_size: { type: number }
409
+ train_settings:
410
+ {
411
+ type: array,
412
+ items: { $ref: "#/components/schemas/OdModelVersionTrainSettings" },
413
+ }
414
+ annotations_per_label:
415
+ {
416
+ type: array,
417
+ items:
418
+ { $ref: "#/components/schemas/OdModelVersionAnnotationPerLabel" },
419
+ description: Sorted by `size` descending.,
420
+ }
421
+ annotations_size:
422
+ { type: integer, description: Boxes written into the label files. }
423
+ confusion_matrix_normalized:
424
+ { type: string, description: Media id (uploaded after training). }
425
+ args:
426
+ { type: string, description: "Media id of the run's `args.yaml`." }
427
+ confusion_matrix: { type: string, description: Media id. }
428
+ F1_curve: { type: string, description: Media id. }
429
+ labels_correlogram: { type: string, description: Media id. }
430
+ labels: { type: string, description: Media id. }
431
+ P_curve: { type: string, description: Media id. }
432
+ PR_curve: { type: string, description: Media id. }
433
+ R_curve: { type: string, description: Media id. }
434
+ results_csv: { type: string, description: Media id. }
435
+ results: { type: string, description: Media id. }
436
+ val_batch0_labels: { type: string, description: Media id. }
437
+ val_batch0_pred: { type: string, description: Media id. }
438
+ initial_weight:
439
+ {
440
+ type: string,
441
+ description: "Base weights the run starts from (e.g. `yolov8n.pt` or a weights URL).",
442
+ }
443
+ weight_best:
444
+ {
445
+ type: string,
446
+ description: "Media id of `best.pt` — set by the `ul-hub` weights upload.",
447
+ }
448
+ weight_last: { type: string, description: "Media id of `last.pt`." }
449
+ metrics: { $ref: "#/components/schemas/OdModelVersionMetrics" }
450
+ model_stats: { $ref: "#/components/schemas/OdModelVersionModelStats" }
451
+ model_populated:
452
+ {
453
+ type: object,
454
+ nullable: true,
455
+ additionalProperties: true,
456
+ description: "Present when `populatedKeys[]` includes `model`.",
457
+ }
458
+ dataset_populated:
459
+ {
460
+ type: array,
461
+ items: { type: object, additionalProperties: true },
462
+ description: "Present when `populatedKeys[]` includes `dataset`.",
463
+ }
464
+ dataset_labels_populated:
465
+ {
466
+ type: array,
467
+ items: { type: object, additionalProperties: true },
468
+ description: "Present when `populatedKeys[]` includes `dataset_labels`.",
469
+ }
470
+ train_data_populated:
471
+ {
472
+ type: object,
473
+ nullable: true,
474
+ additionalProperties: true,
475
+ description: "Media document; present when `populatedKeys[]` includes `train_data`. Every other media-backed field has the same `<field>_populated` counterpart.",
476
+ }
477
+ disabled: { type: boolean }
478
+ _errors:
479
+ {
480
+ type: array,
481
+ items: { type: object, additionalProperties: true },
482
+ description: Adapted errors pushed by the async prep pipeline.,
483
+ }
484
+ company_namespace: { type: array, items: { type: string } }
485
+ createdAt: { type: string, format: date-time }
486
+ updatedAt: { type: string, format: date-time }
487
+ OdModelVersionCreateBody:
488
+ type: object
489
+ description: "Body for creating a version. The tenant key (`company_namespace`) is optional for SDK callers and is otherwise injected from the caller's session. `version_code`, `creator`, `status` and `dataset_labels` are server-assigned."
490
+ required: [model, dataset, initial_weight]
491
+ properties:
492
+ model:
493
+ {
494
+ type: string,
495
+ description: "`ai-object-detection-model` id; must exist in the namespace.",
496
+ }
497
+ dataset:
498
+ {
499
+ type: array,
500
+ minItems: 1,
501
+ items: { type: string },
502
+ description: "One or more `ai-object-detection-dataset` ids.",
503
+ }
504
+ dataset_labels:
505
+ {
506
+ type: array,
507
+ items: { type: string },
508
+ description: Ignored — recomputed by the server as the union of the datasets' labels.,
509
+ }
510
+ initial_weight:
511
+ { type: string, description: "Base weights, e.g. `yolov8n.pt`." }
512
+ task_selection_mode: { type: string, enum: [smart, all], default: all }
513
+ suppress_exceeding_sizes: { type: boolean, default: false }
514
+ train_settings:
515
+ {
516
+ type: array,
517
+ items: { $ref: "#/components/schemas/OdModelVersionTrainSettings" },
518
+ }
519
+ validation_size: { type: number }
520
+ test_size: { type: number }
521
+ company_namespace:
522
+ type: array
523
+ items: { type: string }
524
+ description: Optional tenant namespace override for SDK callers.
525
+ OdModelVersionCreateResult:
526
+ allOf:
527
+ - $ref: "#/components/schemas/OdModelVersionSchema"
528
+ - type: object
529
+ description: "`create` returns the version with these three refs populated in place."
530
+ properties:
531
+ model:
532
+ {
533
+ type: object,
534
+ additionalProperties: true,
535
+ description: "The `ai-object-detection-model` document.",
536
+ }
537
+ dataset:
538
+ {
539
+ type: array,
540
+ items: { type: object, additionalProperties: true },
541
+ description: "The `ai-object-detection-dataset` documents.",
542
+ }
543
+ dataset_labels:
544
+ type: array
545
+ items:
546
+ type: object
547
+ properties:
548
+ _id: { type: string }
549
+ name: { type: string }
550
+ OdModelVersionFindResult:
551
+ type: object
552
+ properties:
553
+ data:
554
+ {
555
+ type: array,
556
+ items: { $ref: "#/components/schemas/OdModelVersionSchema" },
557
+ }
558
+ total_result: { type: number }
559
+ current_count: { type: number }
560
+ total_pages: { type: number }
561
+ current_page: { type: number }
562
+ per_page: { type: number }
563
+ first_page_url: { type: string }
564
+ last_page_url: { type: string }
565
+ next_page_url: { type: string, nullable: true }
566
+ prev_page_url: { type: string, nullable: true }
567
+ path: { type: string }