Skip to content

Commit eae5455

Browse files
author
Ubuntu
committed
fixed finally
1 parent 8321369 commit eae5455

File tree

3 files changed

+49
-19
lines changed

3 files changed

+49
-19
lines changed

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# from the environment for the first two.
66
SPHINXOPTS ?=
77
SPHINXBUILD ?= sphinx-build
8-
SOURCEDIR = source
8+
SOURCEDIR = .
99
BUILDDIR = build
1010

1111
# Put it first so that "make" without argument is like "make help".

nucleus/model.py

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,52 @@
1111
1212
Doing the three steps above allows you to visualize model performance within Nucleus, or compare multiple models that have been run on the same Dataset.
1313
14-
Note that you can always add more predictions to a dataset, but then you will need to re-run the calculation of metrics in order to have them be correct. ::
15-
16-
17-
import nucleus
18-
client = nucleus.NucleusClient("YOUR_SCALE_API_KEY")
19-
prediction_1 = nucleus.BoxPrediction(label="label", x=0, y=0, width=10, height=10, reference_id="1", confidence=0.9, class_pdf={'label': 0.9, 'other_label': 0.1})
20-
prediction_2 = nucleus.BoxPrediction(label="label", x=0, y=0, width=10, height=10, reference_id="2", confidence=0.2, class_pdf={'label': 0.2, 'other_label': 0.8})
21-
model = client.add_model(name="My Model", reference_id="My-CNN", metadata={"timestamp": "121012401"})
22-
# For small ingestions, we recommend synchronous ingestion
23-
response = dataset.upload_predictions(model, [prediction_1, prediction_2])
24-
# For large ingestions, we recommend asynchronous ingestion
25-
job = dataset.upload_predictions([prediction_1, prediction_2], asynchronous=True)
26-
# Check current status
27-
job.status()
28-
# Sleep until ingestion is done
29-
job.sleep_until_complete()
30-
# Check errors
31-
job.errors()
14+
15+
Note that you can always add more predictions to a dataset, but then you will need to re-run the calculation of metrics in order to have them be correct.
16+
17+
::
18+
19+
import nucleus
20+
21+
client = nucleus.NucleusClient("YOUR_SCALE_API_KEY")
22+
dataset = client.get_dataset("YOUR_DATASET_ID")
23+
prediction_1 = nucleus.BoxPrediction(
24+
label="label",
25+
x=0,
26+
y=0,
27+
width=10,
28+
height=10,
29+
reference_id="1",
30+
confidence=0.9,
31+
class_pdf={"label": 0.9, "other_label": 0.1},
32+
)
33+
prediction_2 = nucleus.BoxPrediction(
34+
label="label",
35+
x=0,
36+
y=0,
37+
width=10,
38+
height=10,
39+
reference_id="2",
40+
confidence=0.2,
41+
class_pdf={"label": 0.2, "other_label": 0.8},
42+
)
43+
model = client.add_model(
44+
name="My Model", reference_id="My-CNN", metadata={"timestamp": "121012401"}
45+
)
46+
# For small ingestions, we recommend synchronous ingestion
47+
response = dataset.upload_predictions(model, [prediction_1, prediction_2])
48+
# For large ingestions, we recommend asynchronous ingestion
49+
job = dataset.upload_predictions(
50+
[prediction_1, prediction_2], asynchronous=True
51+
)
52+
# Check current status
53+
job.status()
54+
# Sleep until ingestion is done
55+
job.sleep_until_complete()
56+
# Check errors
57+
job.errors()
58+
59+
dataset.calculate_evaluation_metrics(model)
3260
"""
3361
from typing import List, Optional, Dict, Union
3462
from .dataset import Dataset

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ tqdm = "^4.41.0"
3838
dataclasses = { version = "^0.7", python = "^3.6.1, <3.7" }
3939
aiohttp = "^3.7.4"
4040
nest-asyncio = "^1.5.1"
41+
Sphinx = "^4.2.0"
4142

4243
[tool.poetry.dev-dependencies]
4344
poetry = "^1.1.5"
@@ -50,6 +51,7 @@ coverage = "^5.5"
5051
pre-commit = "^2.12.1"
5152
jupyterlab = "^3.1.10"
5253
absl-py = "^0.13.0"
54+
furo = "^2021.10.9"
5355

5456
[tool.pytest.ini_options]
5557
markers = [

0 commit comments

Comments
 (0)