scale-nucleus 0.17.2__py3-none-any.whl → 0.17.5__py3-none-any.whl
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.
- nucleus/dataset.py +39 -1
- nucleus/model.py +12 -3
- nucleus/utils.py +7 -1
- {scale_nucleus-0.17.2.dist-info → scale_nucleus-0.17.5.dist-info}/METADATA +1 -1
- {scale_nucleus-0.17.2.dist-info → scale_nucleus-0.17.5.dist-info}/RECORD +8 -8
- {scale_nucleus-0.17.2.dist-info → scale_nucleus-0.17.5.dist-info}/LICENSE +0 -0
- {scale_nucleus-0.17.2.dist-info → scale_nucleus-0.17.5.dist-info}/WHEEL +0 -0
- {scale_nucleus-0.17.2.dist-info → scale_nucleus-0.17.5.dist-info}/entry_points.txt +0 -0
nucleus/dataset.py
CHANGED
@@ -104,7 +104,7 @@ from .slice import (
|
|
104
104
|
from .upload_response import UploadResponse
|
105
105
|
|
106
106
|
if TYPE_CHECKING:
|
107
|
-
from . import NucleusClient
|
107
|
+
from . import Model, NucleusClient
|
108
108
|
|
109
109
|
# TODO: refactor to reduce this file to under 1000 lines.
|
110
110
|
# pylint: disable=C0302
|
@@ -2303,3 +2303,41 @@ class Dataset:
|
|
2303
2303
|
|
2304
2304
|
else:
|
2305
2305
|
print(f"Did not find any items in {dirname}.")
|
2306
|
+
|
2307
|
+
def upload_lidar_semseg_predictions(
|
2308
|
+
self,
|
2309
|
+
model: "Model",
|
2310
|
+
pointcloud_ref_id: str,
|
2311
|
+
predictions_s3_path: str,
|
2312
|
+
):
|
2313
|
+
"""Upload Lidar Semantic Segmentation predictions for a given pointcloud.
|
2314
|
+
|
2315
|
+
Assuming a pointcloud with only 4 points (three labeled as Car, one labeled as Person),
|
2316
|
+
the contents of the predictions s3 object should be formatted as such:
|
2317
|
+
|
2318
|
+
.. code-block:: json
|
2319
|
+
|
2320
|
+
{
|
2321
|
+
"objects": [
|
2322
|
+
{ "label": "Car", "index": 1},
|
2323
|
+
{ "label": "Person", "index": 2}
|
2324
|
+
],
|
2325
|
+
"point_objects": [1, 1, 1, 2],
|
2326
|
+
"point_confidence": [0.5, 0.9, 0.9, 0.3]
|
2327
|
+
}
|
2328
|
+
|
2329
|
+
The order of the points in the `"point_objects"` should be in the same order as the points that
|
2330
|
+
were originally uploaded to Scale.
|
2331
|
+
|
2332
|
+
Parameters:
|
2333
|
+
model (:class:`Model`): Nucleus model used to store these predictions
|
2334
|
+
pointcloud_ref_id (str): The reference ID of the pointcloud for which these predictions belong to
|
2335
|
+
predictions_s3_path (str): S3 path to where the predictions are stored
|
2336
|
+
|
2337
|
+
"""
|
2338
|
+
|
2339
|
+
return self._client.make_request(
|
2340
|
+
payload={"pointsSegmentationUrl": predictions_s3_path},
|
2341
|
+
route=f"dataset/{self.id}/model/{model.id}/pointcloud/{pointcloud_ref_id}/uploadLSSPrediction",
|
2342
|
+
requests_command=requests.post,
|
2343
|
+
)
|
nucleus/model.py
CHANGED
@@ -211,7 +211,9 @@ class Model:
|
|
211
211
|
)
|
212
212
|
return AsyncJob.from_json(response, self._client)
|
213
213
|
|
214
|
-
def run(
|
214
|
+
def run(
|
215
|
+
self, dataset_id: str, model_run_name: str, slice_id: Optional[str]
|
216
|
+
) -> str:
|
215
217
|
"""Runs inference on the bundle associated with the model on the dataset. ::
|
216
218
|
|
217
219
|
import nucleus
|
@@ -222,11 +224,18 @@ class Model:
|
|
222
224
|
|
223
225
|
Args:
|
224
226
|
dataset_id: The ID of the dataset to run inference on.
|
225
|
-
|
227
|
+
model_run_name: The name of the model run.
|
226
228
|
slice_id: The ID of the slice of the dataset to run inference on.
|
229
|
+
|
230
|
+
Returns:
|
231
|
+
job_id: The ID of the :class:`AsyncJob` used to track job progress.
|
227
232
|
"""
|
228
233
|
response = self._client.make_request(
|
229
|
-
{
|
234
|
+
{
|
235
|
+
"dataset_id": dataset_id,
|
236
|
+
"slice_id": slice_id,
|
237
|
+
"model_run_name": model_run_name,
|
238
|
+
},
|
230
239
|
f"model/run/{self.id}/",
|
231
240
|
requests_command=requests.post,
|
232
241
|
)
|
nucleus/utils.py
CHANGED
@@ -3,6 +3,7 @@ import glob
|
|
3
3
|
import io
|
4
4
|
import json
|
5
5
|
import os
|
6
|
+
import urllib.request
|
6
7
|
import uuid
|
7
8
|
from collections import defaultdict
|
8
9
|
from typing import IO, TYPE_CHECKING, Dict, List, Sequence, Tuple, Type, Union
|
@@ -381,9 +382,14 @@ def serialize_and_write_to_presigned_url(
|
|
381
382
|
):
|
382
383
|
"""This helper function can be used to serialize a list of API objects to NDJSON."""
|
383
384
|
request_id = uuid.uuid4().hex
|
385
|
+
route = f"dataset/{dataset_id}/signedUrl/{request_id}"
|
386
|
+
if os.environ.get("S3_ENDPOINT") is not None:
|
387
|
+
route += "?s3Endpoint=" + urllib.request.pathname2url(
|
388
|
+
os.environ["S3_ENDPOINT"]
|
389
|
+
)
|
384
390
|
response = client.make_request(
|
385
391
|
payload={},
|
386
|
-
route=
|
392
|
+
route=route,
|
387
393
|
requests_command=requests.get,
|
388
394
|
)
|
389
395
|
|
@@ -26,7 +26,7 @@ nucleus/data_transfer_object/dataset_info.py,sha256=5P_gpvAyaqXxj2ZQuzLkGN2XROaN
|
|
26
26
|
nucleus/data_transfer_object/dataset_size.py,sha256=oe-dXaMLpsQRDcJQRZ9Ja8JTagYz4dviZuTognEylp0,111
|
27
27
|
nucleus/data_transfer_object/job_status.py,sha256=hxvyNdrdVdj3UpEfwvryKC_QCJQEC9ru6IPjhPFcK44,2038
|
28
28
|
nucleus/data_transfer_object/scenes_list.py,sha256=iTHE6vA47bRB6ciyEU4LArUXEXco4ArnGvZTGTeK8xs,432
|
29
|
-
nucleus/dataset.py,sha256=
|
29
|
+
nucleus/dataset.py,sha256=rUzzzxUo6Oeo_iBOA_EvHJHqwAgyb6dNDc0V1udyQQk,91287
|
30
30
|
nucleus/dataset_item.py,sha256=y9ia47i31lX2wvw6EkVAxeHburMrrZpuyjEGlstWa2A,10166
|
31
31
|
nucleus/dataset_item_uploader.py,sha256=BD0FTgimEFYmDbnOLIaQZS3OLDfLe5wumADDmgMX598,6684
|
32
32
|
nucleus/deprecation_warning.py,sha256=5C9dVusR5UkUQnW2MrRkIXCfbc8ULc7xOaB134agNKk,976
|
@@ -52,7 +52,7 @@ nucleus/metrics/segmentation_loader.py,sha256=SdEhEYB5azCWp3iR8UaW-MXB23O-NQSTkE
|
|
52
52
|
nucleus/metrics/segmentation_metrics.py,sha256=rvjfFeyK-4ZEIgxl6nelYyDkAr767WjNTnVFkcQHDh8,29556
|
53
53
|
nucleus/metrics/segmentation_to_poly_metrics.py,sha256=92SuotttylxsTgebm3476wN21EJM19MT4rnjmiOlb68,29107
|
54
54
|
nucleus/metrics/segmentation_utils.py,sha256=AkqCbyim67K9DA0VQYOUpYHe8vOwSvanFqWB1oOz1sU,10368
|
55
|
-
nucleus/model.py,sha256=
|
55
|
+
nucleus/model.py,sha256=qZ8D7ZS0HobheEME5fZsdfWqjs472U32Q8_4RVuFZH8,11159
|
56
56
|
nucleus/model_run.py,sha256=WtGy8cD86M_6aVNAp0ELZgunwbztNeOO8nv8ZSpbwhY,9280
|
57
57
|
nucleus/package_not_installed.py,sha256=1ae0aqKAM3KrB0C-5MuPPXoz9tLWJUKtP1UZ-vw9Zik,1117
|
58
58
|
nucleus/payload_constructor.py,sha256=EI5VDt5GG4jlJMI5k4vRve0GQ-zxJ79InnyRrjf5ZUY,4887
|
@@ -66,7 +66,7 @@ nucleus/test_launch_integration.py,sha256=oFKLZWjFGeUvwVV0XAAjP1Y_oKFkaouh_SXVPX
|
|
66
66
|
nucleus/track.py,sha256=ROmOyzYZKrHVTnLBhnk-qEBtklD_EDsSnRcGYE8xG4E,3247
|
67
67
|
nucleus/upload_response.py,sha256=wR_pfZCBju1vGiGqbVgk8zhM6GhD3ebYxyGBm8y0GvY,3287
|
68
68
|
nucleus/url_utils.py,sha256=EZ3vy1FYTGvXRVNyq43Wif-ypS8LFoDrYMYJre_DVuQ,790
|
69
|
-
nucleus/utils.py,sha256=
|
69
|
+
nucleus/utils.py,sha256=cOu9TFMS-atSBK2aL6RP14eMPKV85WSe_J0ZKSYGvco,16137
|
70
70
|
nucleus/validate/__init__.py,sha256=UZx1tJHCRCosPXKdjFGaeifHOIf9R6ncYMcq77Gom54,786
|
71
71
|
nucleus/validate/client.py,sha256=c8iF-fi7CEyKSoutzwJD0rhE6DwDDKFF-xC0wITCTjE,8219
|
72
72
|
nucleus/validate/constants.py,sha256=EoR0BLKqQroyVx6TpirbcMKunOnREdtqL9OUvpejgAk,1089
|
@@ -85,8 +85,8 @@ nucleus/validate/scenario_test.py,sha256=pCmM157dblSciZCDTw-f47Fpy3OUZFgXmokdhIL
|
|
85
85
|
nucleus/validate/scenario_test_evaluation.py,sha256=Q0WzaEE9uUbPVc4EHlCoKjhJcqMNt4QbyiiJx12VOR0,4075
|
86
86
|
nucleus/validate/scenario_test_metric.py,sha256=AhVFOB1ULwBqlZ2X_Au1TXy4iQELljtzR4ZpeLB35So,1209
|
87
87
|
nucleus/validate/utils.py,sha256=VjdIJj9Pii4z4L6xbvClAc7ra_J7cX0vWB_J2X6yrGE,185
|
88
|
-
scale_nucleus-0.17.
|
89
|
-
scale_nucleus-0.17.
|
90
|
-
scale_nucleus-0.17.
|
91
|
-
scale_nucleus-0.17.
|
92
|
-
scale_nucleus-0.17.
|
88
|
+
scale_nucleus-0.17.5.dist-info/LICENSE,sha256=jaTGyQSQIZeWMo5iyYqgbAYHR9Bdy7nOzgE-Up3m_-g,1075
|
89
|
+
scale_nucleus-0.17.5.dist-info/METADATA,sha256=gq3_KsyJ_dcN5rEuyIBkemt22tvlIOm_Zz206nWftV8,7920
|
90
|
+
scale_nucleus-0.17.5.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
91
|
+
scale_nucleus-0.17.5.dist-info/entry_points.txt,sha256=fmqEzh6NZQyg9eFMILnWabKT8OWQTMSCdDzMiVq2zYs,32
|
92
|
+
scale_nucleus-0.17.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|