Skip to content

Commit e12c692

Browse files
committed
Merge remote-tracking branch 'origin/master' into lidar-annotation-geometry-fix
2 parents 5eef6d7 + d66a77b commit e12c692

16 files changed

+282
-225
lines changed

.circleci/config.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# CircleCI jobs are only enabled to on Pull Requests and commits to master branch.
22
# "Only build pull requests" enabled in Project's Advanced Settings.
33
version: 2.1
4+
orbs:
5+
slack: circleci/slack@4.4.2
6+
47
jobs:
58
build_test:
69
docker:
7-
- image: python:3.6-slim-buster
10+
- image: python:3.6-buster
811
resource_class: small
912
steps:
1013
- checkout # checkout source code to working directory
1114
- run:
1215
name: Install Environment Dependencies
1316
command: | # install dependencies
17+
apt-get -y install curl
1418
pip install --upgrade pip
1519
pip install poetry
1620
poetry install
@@ -38,15 +42,17 @@ jobs:
3842
poetry run coverage run --include=nucleus/* -m pytest -s -v --junitxml=test_results/junit.xml
3943
poetry run coverage report
4044
poetry run coverage html
41-
4245
- store_test_results:
4346
path: htmlcov
44-
4547
- store_test_results:
4648
path: test_results
47-
4849
- store_artifacts:
4950
path: test_results
51+
- slack/notify:
52+
branch_pattern: master
53+
event: fail
54+
template: basic_fail_1
55+
5056
pypi_publish:
5157
docker:
5258
- image: cimg/python:3.6
@@ -83,9 +89,21 @@ jobs:
8389
fi
8490
poetry publish --username=$PYPI_USERNAME --password=$PYPI_PASSWORD
8591
workflows:
92+
nightly_build_test:
93+
triggers:
94+
- schedule:
95+
cron: "0 0 * * *"
96+
filters:
97+
branches:
98+
only:
99+
- master
100+
jobs:
101+
- build_test:
102+
context: Nucleus
86103
build_test_publish:
87104
jobs:
88105
- build_test:
106+
context: Nucleus
89107
filters:
90108
tags:
91109
only: /^v\d+\.\d+\.\d+$/ # Runs only for tags with the format [v1.2.3]

README.md

Lines changed: 1 addition & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -28,168 +28,7 @@ pip install --upgrade scale-nucleus
2828

2929
## Usage
3030

31-
The first step to using the Nucleus library is instantiating a client object.
32-
The client abstractions serves to authenticate the user and act as the gateway
33-
for users to interact with their datasets, models, and model runs.
34-
35-
### Create a client object
36-
37-
```python
38-
import nucleus
39-
client = nucleus.NucleusClient("YOUR_API_KEY_HERE")
40-
```
41-
42-
### Create Dataset
43-
44-
```python
45-
dataset = client.create_dataset("My Dataset")
46-
```
47-
48-
### List Datasets
49-
50-
```python
51-
datasets = client.list_datasets()
52-
```
53-
54-
### Delete a Dataset
55-
56-
By specifying target dataset id.
57-
A response code of 200 indicates successful deletion.
58-
59-
```python
60-
client.delete_dataset("YOUR_DATASET_ID")
61-
```
62-
63-
### Append Items to a Dataset
64-
65-
You can append both local images and images from the web. Simply specify the location and Nucleus will automatically infer if it's remote or a local file.
66-
67-
```python
68-
dataset_item_1 = DatasetItem(image_location="./1.jpeg", reference_id="1", metadata={"key": "value"})
69-
dataset_item_2 = DatasetItem(image_location="s3://srikanth-nucleus/9-1.jpg", reference_id="2", metadata={"key": "value"})
70-
```
71-
72-
The append function expects a list of `DatasetItem` objects to upload, like this:
73-
74-
```python
75-
response = dataset.append([dataset_item_1, dataset_item_2])
76-
```
77-
78-
### Get Dataset Info
79-
80-
Tells us the dataset name, number of dataset items, model_runs, and slice_ids.
81-
82-
```python
83-
dataset.info
84-
```
85-
86-
### Access Dataset Items
87-
88-
There are three methods to access individual Dataset Items:
89-
90-
(1) Dataset Items are accessible by reference id
91-
92-
```python
93-
item = dataset.refloc("my_img_001.png")
94-
```
95-
96-
(2) Dataset Items are accessible by index
97-
98-
```python
99-
item = dataset.iloc(0)
100-
```
101-
102-
(3) Dataset Items are accessible by the dataset_item_id assigned internally
103-
104-
```python
105-
item = dataset.loc("dataset_item_id")
106-
```
107-
108-
### Add Annotations
109-
110-
Upload groundtruth annotations for the items in your dataset.
111-
Box2DAnnotation has same format as https://dashboard.scale.com/nucleus/docs/api#add-ground-truth
112-
113-
```python
114-
annotation_1 = BoxAnnotation(reference_id="1", label="label", x=0, y=0, width=10, height=10, annotation_id="ann_1", metadata={})
115-
annotation_2 = BoxAnnotation(reference_id="2", label="label", x=0, y=0, width=10, height=10, annotation_id="ann_2", metadata={})
116-
response = dataset.annotate([annotation_1, annotation_2])
117-
```
118-
119-
For particularly large payloads, please reference the accompanying scripts in **references**
120-
121-
### Add Model
122-
123-
The model abstraction is intended to represent a unique architecture.
124-
Models are independent of any dataset.
125-
126-
```python
127-
model = client.add_model(name="My Model", reference_id="newest-cnn-its-new", metadata={"timestamp": "121012401"})
128-
```
129-
130-
### Upload Predictions to ModelRun
131-
132-
This method populates the model_run object with predictions. `ModelRun` objects need to reference a `Dataset` that has been created.
133-
Returns the associated model_id, human-readable name of the run, status, and user specified metadata.
134-
Takes a list of Box2DPredictions within the payload, where Box2DPrediction
135-
is formulated as in https://dashboard.scale.com/nucleus/docs/api#upload-model-outputs
136-
137-
```python
138-
prediction_1 = BoxPrediction(reference_id="1", label="label", x=0, y=0, width=10, height=10, annotation_id="pred_1", confidence=0.9)
139-
prediction_2 = BoxPrediction(reference_id="2", label="label", x=0, y=0, width=10, height=10, annotation_id="pred_2", confidence=0.2)
140-
141-
model_run = model.create_run(name="My Model Run", metadata={"timestamp": "121012401"}, dataset=dataset, predictions=[prediction_1, prediction_2])
142-
```
143-
144-
### Commit ModelRun
145-
146-
The commit action indicates that the user is finished uploading predictions associated
147-
with this model run. Committing a model run kicks off Nucleus internal processes
148-
to calculate performance metrics like IoU. After being committed, a ModelRun object becomes immutable.
149-
150-
```python
151-
model_run.commit()
152-
```
153-
154-
### Get ModelRun Info
155-
156-
Returns the associated model_id, human-readable name of the run, status, and user specified metadata.
157-
158-
```python
159-
model_run.info
160-
```
161-
162-
### Accessing ModelRun Predictions
163-
164-
You can access the modelRun predictions for an individual dataset_item through three methods:
165-
166-
(1) user specified reference_id
167-
168-
```python
169-
model_run.refloc("my_img_001.png")
170-
```
171-
172-
(2) Index
173-
174-
```python
175-
model_run.iloc(0)
176-
```
177-
178-
(3) Internally maintained dataset_item_id
179-
180-
```python
181-
model_run.loc("dataset_item_id")
182-
```
183-
184-
### Delete ModelRun
185-
186-
Delete a model run using the target model_run_id.
187-
188-
A response code of 200 indicates successful deletion.
189-
190-
```python
191-
client.delete_model_run("model_run_id")
192-
```
31+
For the most up to date documentation, reference: https://dashboard.scale.com/nucleus/docs/api?language=python.
19332

19433
## For Developers
19534

0 commit comments

Comments
 (0)