dataverse-sdk 2.7.0__tar.gz → 2.9.0__tar.gz
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.
- dataverse_sdk-2.9.0/MANIFEST.in +2 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/PKG-INFO +294 -15
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/README.md +292 -11
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/__init__.py +14 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/apis/backend.py +58 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/client.py +518 -15
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/export/coco.py +2 -4
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/export/constant.py +3 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/export/exporter.py +59 -5
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/export/vqa.py +106 -3
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/export/yolo.py +2 -2
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/schemas/api.py +54 -1
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/schemas/client.py +152 -20
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/schemas/common.py +87 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/utils/utils.py +1 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk.egg-info/PKG-INFO +294 -15
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk.egg-info/SOURCES.txt +7 -1
- dataverse_sdk-2.9.0/dataverse_sdk.egg-info/requires.txt +8 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/setup.py +2 -4
- dataverse_sdk-2.9.0/tools/export_dataslice.py +118 -0
- dataverse_sdk-2.9.0/tools/export_dataslice_large.py +133 -0
- dataverse_sdk-2.9.0/tools/import_dataset_from_local.py +176 -0
- dataverse_sdk-2.9.0/tools/import_vqa_dataset.py +175 -0
- dataverse_sdk-2.9.0/tools/upload_videos_create_session.py +135 -0
- dataverse_sdk-2.7.0/dataverse_sdk.egg-info/requires.txt +0 -10
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/apis/__init__.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/apis/third_party.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/connections.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/constants.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/exceptions/__init__.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/exceptions/client.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/export/__init__.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/export/base.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/export/utils.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/export/visionai.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/schemas/__init__.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/schemas/format.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk/utils/__init__.py +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk.egg-info/dependency_links.txt +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/dataverse_sdk.egg-info/top_level.txt +0 -0
- {dataverse_sdk-2.7.0 → dataverse_sdk-2.9.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dataverse-sdk
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9.0
|
|
4
4
|
Summary: Dataverse SDK For Python
|
|
5
5
|
Home-page:
|
|
6
6
|
Author: LinkerVision
|
|
@@ -12,11 +12,9 @@ Requires-Dist: requests
|
|
|
12
12
|
Requires-Dist: httpx>=0.23.0
|
|
13
13
|
Requires-Dist: tqdm
|
|
14
14
|
Requires-Dist: aiofiles
|
|
15
|
-
Requires-Dist: visionai-data-format
|
|
15
|
+
Requires-Dist: visionai-data-format>=2.1.0
|
|
16
16
|
Requires-Dist: aiohttp
|
|
17
17
|
Requires-Dist: aiohttp_retry
|
|
18
|
-
Requires-Dist: numpy<2,>=1.21
|
|
19
|
-
Requires-Dist: opencv-contrib-python==4.8.1.78
|
|
20
18
|
Dynamic: author
|
|
21
19
|
Dynamic: classifier
|
|
22
20
|
Dynamic: description
|
|
@@ -32,8 +30,10 @@ Use Dataverse-SDK for Python to help you to interact with the Dataverse platform
|
|
|
32
30
|
- Get Project by project-id
|
|
33
31
|
- Create Dataset from your AWS storage or local
|
|
34
32
|
- Get Dataset by dataset-id
|
|
33
|
+
- Create Dataslice from a whole dataset, or look one up by name
|
|
35
34
|
- List models for your selected project-id
|
|
36
35
|
- Get and download your model
|
|
36
|
+
- Convert a model to ONNX/TensorRT and read the convert record's metrics
|
|
37
37
|
|
|
38
38
|
[Package (PyPi)](https://pypi.org/project/dataverse-sdk/) | [Source code](https://github.com/linkervision/dataverse-sdk)
|
|
39
39
|
|
|
@@ -104,9 +104,14 @@ The following sections provide examples for the most common DataVerse tasks incl
|
|
|
104
104
|
* [Create Dataset](#create-dataset)
|
|
105
105
|
* [List Dataset](#list-and-get-dataset)
|
|
106
106
|
* [List Dataslices](#list-and-get-dataslices)
|
|
107
|
+
* [Get Dataslice by Name](#get-dataslice-by-name)
|
|
108
|
+
* [Create Dataslice from Dataset](#create-dataslice-from-dataset)
|
|
107
109
|
* [Export Dataslice](#export-dataslice-and-download)
|
|
108
110
|
* [List Models](#list-models)
|
|
109
111
|
* [Get and Download Model](#get-model)
|
|
112
|
+
* [Get Convert Model File](#get-convert-model-file)
|
|
113
|
+
* [Convert Model to ONNX/TRT](#convert-model-to-onnxtrt)
|
|
114
|
+
* [Retrieve Convert Record](#retrieve-convert-record-and-its-metrics)
|
|
110
115
|
* [Create VQA Project](#create-vqa-project)
|
|
111
116
|
* [Edit VQA Ontology](#edit-vqa-ontology)
|
|
112
117
|
* [Get Question List](#get-question-list)
|
|
@@ -199,9 +204,9 @@ project = client.create_project(name="Sample project", ontology=ontology, sensor
|
|
|
199
204
|
|
|
200
205
|
| Argument name | Type/Options | Default | Description |
|
|
201
206
|
| :--- | :--- | :--- | :--- |
|
|
202
|
-
| name | str |
|
|
203
|
-
| ontology | Ontology |
|
|
204
|
-
| sensors | list[Sensor] |
|
|
207
|
+
| name | str | *-- | name of your project |
|
|
208
|
+
| ontology | Ontology | *-- | the Ontology basemodel data of current project |
|
|
209
|
+
| sensors | list[Sensor] | *-- | the list of Sensor basemodel data of your project |
|
|
205
210
|
| project_tag | ProjectTag | None | your project tags |
|
|
206
211
|
| description | str | None | your project description |
|
|
207
212
|
|
|
@@ -445,6 +450,87 @@ dataslice_data = client.get_dataslice(dataslice_id=504)
|
|
|
445
450
|
|
|
446
451
|
```
|
|
447
452
|
|
|
453
|
+
### Get Dataslice by Name
|
|
454
|
+
|
|
455
|
+
Dataslice names are unique across the site, so a name identifies exactly one dataslice.
|
|
456
|
+
|
|
457
|
+
```Python
|
|
458
|
+
dataslice = client.get_dataslice_by_name(project_id=101, dataslice_name="my-dataslice")
|
|
459
|
+
# OR from the project object
|
|
460
|
+
project = client.get_project(project_id=101)
|
|
461
|
+
dataslice = project.get_dataslice_by_name(dataslice_name="my-dataslice")
|
|
462
|
+
|
|
463
|
+
dataslice.id
|
|
464
|
+
dataslice.status # DataSliceStatus
|
|
465
|
+
dataslice.image_count
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
`DataSliceStatus`: `CREATING`, `CREATING_FAIL`, `READY`, `ANNOTATION_UPDATING`,
|
|
469
|
+
`IQA_UPDATING`, `TAGGING_UPDATING`, `DELETING`.
|
|
470
|
+
|
|
471
|
+
`image_count` and `pcd_count` read the per-type datarow counts in `dataslice.metadata`.
|
|
472
|
+
Which of them carries a number follows the slice's own `type`:
|
|
473
|
+
|
|
474
|
+
| `dataslice.type` | `image_count` | `pcd_count` |
|
|
475
|
+
| -------------------- | ------------- | ----------- |
|
|
476
|
+
| `image` | images | `None` |
|
|
477
|
+
| `pcd` | `None` | pcds |
|
|
478
|
+
| `frame` / `sequence` | images | pcds |
|
|
479
|
+
|
|
480
|
+
The last row is the fused camera-plus-lidar case, where both are counted and both can be
|
|
481
|
+
non-zero. `None` means "this slice holds no datarow of that type", never zero.
|
|
482
|
+
|
|
483
|
+
`get_dataslice` and `get_dataslice_by_name` return `metadata`; `list_dataslices` answers
|
|
484
|
+
with plain dicts carrying only `id`, `name` and `file_count` — the slice's image and pcd
|
|
485
|
+
datarows counted together.
|
|
486
|
+
|
|
487
|
+
This is the only method that takes a name: everything downstream — `convert_model`
|
|
488
|
+
included — takes ids, so this is how a name becomes one.
|
|
489
|
+
|
|
490
|
+
Raises `ValueError` when the project holds no dataslice of that name.
|
|
491
|
+
|
|
492
|
+
### Create Dataslice from Dataset
|
|
493
|
+
|
|
494
|
+
`create_dataslice_from_dataset` turns a whole dataset into a dataslice — the equivalent of
|
|
495
|
+
opening it in Data Visualization and hitting **Save Data Slice** without narrowing the
|
|
496
|
+
selection. It is **asynchronous**: the returned dataslice starts out `creating` with no
|
|
497
|
+
file count, and turns `ready` once the datarows are in.
|
|
498
|
+
|
|
499
|
+
```Python
|
|
500
|
+
dataslice = client.create_dataslice_from_dataset(
|
|
501
|
+
project_id=101,
|
|
502
|
+
dataset_id=5,
|
|
503
|
+
dataslice_name="whole-dataset-slice",
|
|
504
|
+
)
|
|
505
|
+
# OR from the project object
|
|
506
|
+
dataslice = project.create_dataslice_from_dataset(
|
|
507
|
+
dataset_id=5, dataslice_name="whole-dataset-slice"
|
|
508
|
+
)
|
|
509
|
+
|
|
510
|
+
# Poll until it settles
|
|
511
|
+
import time
|
|
512
|
+
|
|
513
|
+
from dataverse_sdk import DataSliceStatus
|
|
514
|
+
|
|
515
|
+
SETTLED = (DataSliceStatus.READY, DataSliceStatus.CREATING_FAIL)
|
|
516
|
+
while dataslice.status not in SETTLED:
|
|
517
|
+
time.sleep(10)
|
|
518
|
+
dataslice = client.get_dataslice(dataslice_id=dataslice.id)
|
|
519
|
+
print(dataslice.status, dataslice.image_count) # "ready" 11
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
A convert record polls the same way through `get_convert_record`, with
|
|
523
|
+
`ConvertRecordStatus.READY` and `ConvertRecordStatus.FAILED` as its settled states.
|
|
524
|
+
|
|
525
|
+
| Argument name | Type | Default | Description |
|
|
526
|
+
| -------------- | ---- | ------- | -------------------------------------------------- |
|
|
527
|
+
| project_id | int | *-- | Project the dataset belongs to |
|
|
528
|
+
| dataset_id | int | *-- | Every datarow of this dataset goes into the slice |
|
|
529
|
+
| dataslice_name | str | *-- | Must be unused **site-wide** |
|
|
530
|
+
| description | str | None | |
|
|
531
|
+
|
|
532
|
+
`*--`: required argument without default
|
|
533
|
+
|
|
448
534
|
### Export Dataslice and Download
|
|
449
535
|
```Python
|
|
450
536
|
# Trigger export and get export record id
|
|
@@ -454,6 +540,12 @@ client.download_export_dataslice_data(dataslice_id=504, export_record_id=export_
|
|
|
454
540
|
|
|
455
541
|
```
|
|
456
542
|
|
|
543
|
+
> **Note:** Direct export via `export_dataslice` is limited to 1,000 records. For
|
|
544
|
+
> dataslices exceeding this limit, use
|
|
545
|
+
> [`tools/export_dataslice_large.py`](tools/export_dataslice_large.py) instead
|
|
546
|
+
> (see [Export Large Dataslice and download files](#export-large-dataslice-and-download-files)),
|
|
547
|
+
> which exports the dataslice in batches.
|
|
548
|
+
|
|
457
549
|
|
|
458
550
|
### List Models
|
|
459
551
|
|
|
@@ -470,6 +562,18 @@ project = client.get_project(project_id=1)
|
|
|
470
562
|
models = project.list_models()
|
|
471
563
|
```
|
|
472
564
|
|
|
565
|
+
Each model carries a `status`, which is what a listing is usually narrowed by:
|
|
566
|
+
|
|
567
|
+
```Python
|
|
568
|
+
from dataverse_sdk import MLModelStatus
|
|
569
|
+
|
|
570
|
+
ready = [model for model in models if model.status == MLModelStatus.READY]
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
`MLModelStatus`: `PROCESSING`, `READY`, `DELETING`.
|
|
574
|
+
|
|
575
|
+
Disabled models (`model.enabled` is `False`, e.g. a custom model whose upload failed) are listed only with `include_disabled=True`.
|
|
576
|
+
|
|
473
577
|
#### Filtering by Model Type
|
|
474
578
|
|
|
475
579
|
You can filter models by type using strings or lists of strings. The SDK supports multiple model types:
|
|
@@ -499,11 +603,12 @@ models = client.list_models(
|
|
|
499
603
|
|
|
500
604
|
#### Input Arguments
|
|
501
605
|
|
|
502
|
-
| Argument name
|
|
503
|
-
|
|
|
504
|
-
| project_id
|
|
505
|
-
| client_alias
|
|
506
|
-
| type
|
|
606
|
+
| Argument name | Type/Options | Default | Description |
|
|
607
|
+
| ---------------- | ----------------------------------------------------------------- | ------------------- | -------------------------------------------- |
|
|
608
|
+
| project_id | int | *-- | The project ID |
|
|
609
|
+
| client_alias | str | None | The client alias |
|
|
610
|
+
| type | "trained", "byom", "uploaded", list["trained", "byom", "uploaded] | ["trained", "byom"] | Model types to filter by |
|
|
611
|
+
| include_disabled | bool | False | Also list disabled models, e.g. failed ones |
|
|
507
612
|
|
|
508
613
|
`*--`: required argument without default
|
|
509
614
|
|
|
@@ -571,7 +676,7 @@ Pass an explicit `save_path` whenever you need a predictable location — it alw
|
|
|
571
676
|
|
|
572
677
|
| Argument name | Type/Options | Default | Description |
|
|
573
678
|
| ----------------- | -------------------------------------------------------------- | ----------------------------- | -------------------------------------------------------------------- |
|
|
574
|
-
| convert_record_id | int |
|
|
679
|
+
| convert_record_id | int | *-- | The convert record to download from |
|
|
575
680
|
| file_type | ConvertModelFileType, "triton", "model", "raw_onnx", "calib_cache" | ConvertModelFileType.TRITON | Which artifact to download |
|
|
576
681
|
| save_path | str | None | Local path to write the file; when omitted the server's filename is used (see above) |
|
|
577
682
|
| timeout | int | 3000 | Maximum timeout of the request |
|
|
@@ -588,6 +693,180 @@ Pass an explicit `save_path` whenever you need a predictable location — it alw
|
|
|
588
693
|
<br>
|
|
589
694
|
|
|
590
695
|
|
|
696
|
+
### Convert Model to ONNX/TRT
|
|
697
|
+
|
|
698
|
+
`convert_model` starts a model conversion. It is **asynchronous**: the call returns the
|
|
699
|
+
ids of the created convert records, and the conversion itself finishes later.
|
|
700
|
+
|
|
701
|
+
```Python
|
|
702
|
+
from dataverse_sdk import ConvertFormat, ConvertPrecision, QuantizationMethod
|
|
703
|
+
|
|
704
|
+
# Method 1: Using client -- model 6418 is a YOLOv9, which is NMS-based
|
|
705
|
+
record_ids = client.convert_model(
|
|
706
|
+
model_id=6418,
|
|
707
|
+
name="onnx-fp16",
|
|
708
|
+
target_dataslice_id=504, # ids only; see Get Dataslice by Name
|
|
709
|
+
model_type=ConvertFormat.ONNX,
|
|
710
|
+
data_type=ConvertPrecision.FP16,
|
|
711
|
+
confidence_score=10,
|
|
712
|
+
nms_threshold=50,
|
|
713
|
+
client_alias=client.alias,
|
|
714
|
+
)
|
|
715
|
+
|
|
716
|
+
# Method 2: Using the model object -- model 7201 is a D-FINE, which is NMS-free
|
|
717
|
+
model = client.get_model(model_id=7201, client_alias=client.alias)
|
|
718
|
+
record_ids = model.convert(
|
|
719
|
+
name="trt-int8-ptq",
|
|
720
|
+
target_dataslice_id=504,
|
|
721
|
+
model_type=ConvertFormat.TRT,
|
|
722
|
+
data_type=ConvertPrecision.INT8,
|
|
723
|
+
quantizations=[QuantizationMethod.PTQ],
|
|
724
|
+
quantize_dataslice_id=508,
|
|
725
|
+
)
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
#### Input Arguments
|
|
729
|
+
|
|
730
|
+
| Argument name | Type/Options | Default | Description |
|
|
731
|
+
| ------------------ | ------------------------------------- | --------- | ------------------------------------------------------------------------------- |
|
|
732
|
+
| model_id | int | *-- | The source model to convert |
|
|
733
|
+
| name | str | *-- | Convert record name; must be unused **under this model** |
|
|
734
|
+
| target_dataslice_id| int | *-- | Dataslice the converted model is evaluated on |
|
|
735
|
+
| model_type | ConvertFormat \| str | *-- | Target format |
|
|
736
|
+
| data_type | ConvertPrecision \| str | *-- | Numeric precision; `fp32` is D-FINE only |
|
|
737
|
+
| confidence_score | int | 10 | Confidence threshold, 10-90 |
|
|
738
|
+
| iou | int | 50 | IoU threshold, 1-99 |
|
|
739
|
+
| topk | int | None | 50-300; 300 for D-FINE, 100 for every other structure |
|
|
740
|
+
| main_obj_low | int | 1024 | Main object size lower bound |
|
|
741
|
+
| main_obj_high | int | 9216 | Main object size upper bound |
|
|
742
|
+
| resolution_width | int | None | Defaults to the source model's own resolution |
|
|
743
|
+
| resolution_height | int | None | Defaults to the source model's own resolution |
|
|
744
|
+
| nms_threshold | int | None | 10-90; required for every structure except D-FINE |
|
|
745
|
+
| nms_class_agnostic | bool | None | **Rejected for D-FINE** |
|
|
746
|
+
| machine_type | str | None | |
|
|
747
|
+
| quantize_dataslice_id | int | None | Calibration dataslice; has to be given together with `quantizations` |
|
|
748
|
+
| quantizations | list[QuantizationMethod \| str] | None | Exactly one method; **required for `int8`, rejected for every other `data_type`**; only `PTQ` is supported for D-FINE |
|
|
749
|
+
| model_structure | ModelStructure \| str | None | The source model's architecture; sets the topk default and the D-FINE rules. Read back from the model when omitted |
|
|
750
|
+
|
|
751
|
+
`*--`: required argument without default
|
|
752
|
+
|
|
753
|
+
Every enum below is a `str` enum, so the member and its plain string are interchangeable:
|
|
754
|
+
|
|
755
|
+
| Enum | Members | Strings |
|
|
756
|
+
| -------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------- |
|
|
757
|
+
| `ConvertFormat` | `ONNX`, `TRT` | `"onnx"`, `"trt"` |
|
|
758
|
+
| `ConvertPrecision` | `FP32`, `FP16`, `INT8` | `"fp32"`, `"fp16"`, `"int8"` |
|
|
759
|
+
| `QuantizationMethod` | `PTQ`, `QAT_TRAIN`, `QAT_DISTILL` | `"ptq"`, `"qat_train"`, `"qat_distill"` |
|
|
760
|
+
| `ModelStructure` | `YOLOV9_C`, `YOLOV9_E`, `YOLOV9_S` | `"yolov9-c"`, `"yolov9-e"`, `"yolov9-s"` |
|
|
761
|
+
| | `DFINE_N`, `DFINE_S`, `DFINE_M`, `DFINE_L`, `DFINE_X` | `"dfine-n"`, `"dfine-s"`, `"dfine-m"`, `"dfine-l"`, `"dfine-x"` |
|
|
762
|
+
|
|
763
|
+
`convert_model`, `get_convert_record`, `get_convert_record_by_name` and
|
|
764
|
+
`list_convert_records` are static methods, so they need `client_alias` (or `client`)
|
|
765
|
+
passed in; without either they raise `ValueError`. The dataslice methods above are
|
|
766
|
+
instance methods and fall back to the client's own alias.
|
|
767
|
+
|
|
768
|
+
Supported resolutions are `640x480`, `640x640`, `1024x576`, `1024x768` and `1024x1024`; an unsupported one raises `APIValidationError` without sending the request.
|
|
769
|
+
|
|
770
|
+
The server decides the rest, so these can change; at the time of writing:
|
|
771
|
+
|
|
772
|
+
| `model_structure` | `data_type` | `model_type` | `quantizations` |
|
|
773
|
+
| ----------------- | ----------- | --------------- | --------------------------------- |
|
|
774
|
+
| yolov9 | `fp16` | `onnx` or `trt` | none |
|
|
775
|
+
| yolov9 | `int8` | `trt` | `ptq`, `qat_train`, `qat_distill` |
|
|
776
|
+
| D-FINE | `fp32` | `onnx` | none |
|
|
777
|
+
| D-FINE | `fp16` | `trt` | none |
|
|
778
|
+
| D-FINE | `int8` | `trt` | `ptq` |
|
|
779
|
+
|
|
780
|
+
`int8` must carry exactly one quantization method and every other `data_type` must
|
|
781
|
+
carry none -- that holds for both families, so a yolov9 `int8` convert without
|
|
782
|
+
`quantizations` raises `APIValidationError` instead of reaching the backend. The
|
|
783
|
+
method itself is what differs: D-FINE's `int8` only takes `ptq`, while yolov9 takes
|
|
784
|
+
any of the three. A structure the SDK does not know is left to the server.
|
|
785
|
+
|
|
786
|
+
#### Return
|
|
787
|
+
|
|
788
|
+
`list[int]` — ids of the created convert records, one per quantization method. The
|
|
789
|
+
backend takes only one quantization method for now, so today the list always holds
|
|
790
|
+
exactly one id.
|
|
791
|
+
|
|
792
|
+
#### Keeping it to one request
|
|
793
|
+
|
|
794
|
+
Both dataslices are given by id, so the only extra request left is the read-back of the
|
|
795
|
+
source model — and passing `model_structure` **together with both resolutions** skips
|
|
796
|
+
that too, which is what `model.convert()` does with the three it already holds. Chaining
|
|
797
|
+
from objects you already have is therefore the cheapest form:
|
|
798
|
+
|
|
799
|
+
```Python
|
|
800
|
+
model = client.get_model(model_id=6418, client_alias=client.alias)
|
|
801
|
+
dataslice = project.get_dataslice_by_name("my-eval-dataslice")
|
|
802
|
+
|
|
803
|
+
record_ids = model.convert(
|
|
804
|
+
name="onnx-fp16",
|
|
805
|
+
target_dataslice_id=dataslice.id,
|
|
806
|
+
model_type=ConvertFormat.ONNX,
|
|
807
|
+
data_type=ConvertPrecision.FP16,
|
|
808
|
+
nms_threshold=50,
|
|
809
|
+
)
|
|
810
|
+
|
|
811
|
+
record = client.get_convert_record(convert_record_id=record_ids[0], client_alias=client.alias)
|
|
812
|
+
record.status
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
<br>
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
### Retrieve Convert Record and its Metrics
|
|
819
|
+
|
|
820
|
+
A convert name is only unique **per source model** — two models may each own a record
|
|
821
|
+
called `onnx-fp16` — so a lookup by name takes the model alongside it.
|
|
822
|
+
|
|
823
|
+
```Python
|
|
824
|
+
# By id
|
|
825
|
+
record = client.get_convert_record(convert_record_id=2212, client_alias=client.alias)
|
|
826
|
+
|
|
827
|
+
# By name, under a given model
|
|
828
|
+
record = client.get_convert_record_by_name(
|
|
829
|
+
model_id=6418, convert_name="onnx-fp16", client_alias=client.alias
|
|
830
|
+
)
|
|
831
|
+
# OR from the model object
|
|
832
|
+
model = client.get_model(model_id=6418, client_alias=client.alias)
|
|
833
|
+
record = model.get_convert_record_by_name(convert_name="onnx-fp16")
|
|
834
|
+
|
|
835
|
+
record.status # ConvertRecordStatus
|
|
836
|
+
record.id
|
|
837
|
+
record.model_type # "onnx" / "trt" -- reads configuration["format"]
|
|
838
|
+
record.data_type # "fp32"/"fp16"/"int8" -- reads configuration["precision"]
|
|
839
|
+
record.f1_score # and .precision, .recall, .map_5_95
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
`record.configuration` carries every other convert setting. The four metrics read as
|
|
843
|
+
`0.0` until the conversion finishes, and `None` when the server did not return them at all
|
|
844
|
+
— mind that `record.precision` is one of them, and the precision the model was converted
|
|
845
|
+
at is `record.data_type`.
|
|
846
|
+
|
|
847
|
+
Looking a record up by name, filtering a listing, and reading the ids back from
|
|
848
|
+
`convert_model` all need a Dataverse recent enough to serialise them; against an older
|
|
849
|
+
site the SDK falls back to filtering the full listing itself.
|
|
850
|
+
|
|
851
|
+
#### List Convert Records
|
|
852
|
+
|
|
853
|
+
```Python
|
|
854
|
+
# Every convert record in a project
|
|
855
|
+
records = client.list_convert_records(project_id=1992, client_alias=client.alias)
|
|
856
|
+
# OR
|
|
857
|
+
records = project.list_convert_records()
|
|
858
|
+
|
|
859
|
+
# Narrow by model / name / status
|
|
860
|
+
records = client.list_convert_records(
|
|
861
|
+
model_id=6418, status="ready", client_alias=client.alias
|
|
862
|
+
)
|
|
863
|
+
# OR
|
|
864
|
+
records = model.list_convert_records(status="ready")
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
<br>
|
|
868
|
+
|
|
869
|
+
|
|
591
870
|
### Create VQA Project
|
|
592
871
|
|
|
593
872
|
The `create_vqa_project` method will create project on the connected site with the defined questions/answer_type.
|
|
@@ -610,8 +889,8 @@ project = client.create_vqa_project(name="vqa-project", sensor_name="camera1", o
|
|
|
610
889
|
|
|
611
890
|
| Argument name | Type/Options | Default | Description |
|
|
612
891
|
| :--- | :--- | :--- | :--- |
|
|
613
|
-
| name | str |
|
|
614
|
-
| sensor_name | str |
|
|
892
|
+
| name | str | *-- | name of your project |
|
|
893
|
+
| sensor_name | str | *-- | the camera sensor name |
|
|
615
894
|
| ontology_name | str | *-- | the ontology name |
|
|
616
895
|
| question_answer| list[QuestionClass] | *-- | your question/answer_type. `QuestionClass.answer_type` valid values: `boolean`, `option`, `number`, `text` |
|
|
617
896
|
| description | str | None | your project description |
|