Skip to content

Commit bdf6c35

Browse files
Merge pull request #607 from Labelbox/develop
3.23.2
2 parents 516f137 + 9c1fa53 commit bdf6c35

18 files changed

+210
-158
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
# Version 3.23.2 (2022-06-15)
4+
## Added
5+
* `Data Row` object now has a new field, `metadata`, which returns metadata associated with data row as a list of `DataRowMetadataField`
6+
* Note: When importing Data Rows with metadata, use the existing field, `metadata_fields`
7+
38
# Version 3.23.1 (2022-06-08)
49
## Added
510
* `Task` objects now have the following properties:

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,11 @@ test-onprem: build
3131
-e LABELBOX_TEST_API_KEY_ONPREM=${LABELBOX_TEST_API_KEY_ONPREM} \
3232
-e LABELBOX_TEST_ONPREM_HOSTNAME=${LABELBOX_TEST_ONPREM_HOSTNAME} \
3333
local/labelbox-python:test pytest $(PATH_TO_TEST)
34+
35+
test-custom: build
36+
docker run -it -v ${PWD}:/usr/src -w /usr/src \
37+
-e LABELBOX_TEST_ENVIRON="custom" \
38+
-e DA_GCP_LABELBOX_API_KEY=${DA_GCP_LABELBOX_API_KEY} \
39+
-e LABELBOX_TEST_API_KEY_CUSTOM=${LABELBOX_TEST_API_KEY_CUSTOM} \
40+
-e LABELBOX_TEST_GRAPHQL_API_ENDPOINT=${LABELBOX_TEST_GRAPHQL_API_ENDPOINT} \
41+
local/labelbox-python:test pytest $(PATH_TO_TEST)

e2e_tests_codefresh_pipeline.yaml

Lines changed: 0 additions & 71 deletions
This file was deleted.
Binary file not shown.

examples/integrations/databricks/labelbox_databricks_example.html

Lines changed: 7 additions & 7 deletions
Large diffs are not rendered by default.

examples/integrations/databricks/labelbox_databricks_example.ipynb

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

examples/integrations/databricks/labelbox_databricks_example.py

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,38 @@
7676
# COMMAND ----------
7777

7878
# MAGIC %md
79-
# MAGIC ## Fetch seed data
79+
# MAGIC ## Create seed data
8080
# MAGIC
81-
# MAGIC Next we'll load a demo dataset into a Spark table so you can see how to easily load assets into Labelbox via URL. For simplicity, you can get a Dataset ID from Labelbox and we'll load those URLs into a Spark table for you (so you don't need to worry about finding data to get this demo notebook to run). Below we'll grab the "Example Nature Dataset" included in Labelbox trials.
81+
# MAGIC Next we'll load a demo dataset into a Spark table so you can see how to easily load assets into Labelbox via URLs with the Labelbox Connector for Databricks.
8282
# MAGIC
8383
# MAGIC Also, Labelbox has native support for AWS, Azure, and GCP cloud storage. You can connect Labelbox to your storage via [Delegated Access](https://docs.labelbox.com/docs/iam-delegated-access) and easily load those assets for annotation. For more information, you can watch this [video](https://youtu.be/wlWo6EmPDV4).
84+
# MAGIC
85+
# MAGIC You can also add data to Labelbox [using the Labelbox SDK directly](https://docs.labelbox.com/docs/datasets-datarows). We recommend using the SDK if you have complicated dataset creation requirements (e.g. including metadata with your dataset) which aren't handled by the Labelbox Connector for Databricks.
8486

8587
# COMMAND ----------
8688

87-
sample_dataset = next(
88-
client.get_datasets(where=(Dataset.name == "Example Nature Dataset")))
89-
sample_dataset.uid
89+
sample_dataset_dict = {
90+
"external_id": [
91+
"sample1.jpg", "sample2.jpg", "sample3.jpg", "sample4.jpg",
92+
"sample5.jpg", "sample6.jpg", "sample7.jpg", "sample8.jpg",
93+
"sample9.jpg", "sample10.jpg"
94+
],
95+
"row_data": [
96+
"https://storage.googleapis.com/diagnostics-demo-data/coco/COCO_train2014_000000247422.jpg",
97+
"https://storage.googleapis.com/diagnostics-demo-data/coco/COCO_train2014_000000484849.jpg",
98+
"https://storage.googleapis.com/diagnostics-demo-data/coco/COCO_train2014_000000215782.jpg",
99+
"https://storage.googleapis.com/diagnostics-demo-data/coco/COCO_val2014_000000312024.jpg",
100+
"https://storage.googleapis.com/diagnostics-demo-data/coco/COCO_train2014_000000486139.jpg",
101+
"https://storage.googleapis.com/diagnostics-demo-data/coco/COCO_train2014_000000302713.jpg",
102+
"https://storage.googleapis.com/diagnostics-demo-data/coco/COCO_train2014_000000523272.jpg",
103+
"https://storage.googleapis.com/diagnostics-demo-data/coco/COCO_train2014_000000094514.jpg",
104+
"https://storage.googleapis.com/diagnostics-demo-data/coco/COCO_val2014_000000050578.jpg",
105+
"https://storage.googleapis.com/diagnostics-demo-data/coco/COCO_train2014_000000073727.jpg"
106+
]
107+
}
108+
109+
df = pd.DataFrame.from_dict(sample_dataset_dict).to_spark(
110+
) #produces our demo Spark table of datarows for Labelbox
90111

91112
# COMMAND ----------
92113

@@ -96,18 +117,13 @@
96117
tblList = spark.catalog.listTables()
97118

98119
if not any([table.name == SAMPLE_TABLE for table in tblList]):
99-
100-
df = pd.DataFrame([{
101-
"external_id": dr.external_id,
102-
"row_data": dr.row_data
103-
} for dr in sample_dataset.data_rows()]).to_spark()
104-
df.registerTempTable(SAMPLE_TABLE)
120+
df.createOrReplaceTempView(SAMPLE_TABLE)
105121
print(f"Registered table: {SAMPLE_TABLE}")
106122

107123
# COMMAND ----------
108124

109125
# MAGIC %md
110-
# MAGIC You should now have a temporary table "sample_unstructured_data" which includes the file names and URLs for some demo images. We're going to share this table with Labelbox using the Labelbox Connector for Databricks!
126+
# MAGIC You should now have a temporary table "sample_unstructured_data" which includes the file names and URLs for some demo images. We're going to use this table with Labelbox using the Labelbox Connector for Databricks!
111127

112128
# COMMAND ----------
113129

@@ -167,14 +183,13 @@
167183
ontology = OntologyBuilder()
168184

169185
tools = [
170-
Tool(tool=Tool.Type.BBOX, name="Frog"),
186+
Tool(tool=Tool.Type.BBOX, name="Car"),
171187
Tool(tool=Tool.Type.BBOX, name="Flower"),
172188
Tool(tool=Tool.Type.BBOX, name="Fruit"),
173189
Tool(tool=Tool.Type.BBOX, name="Plant"),
174190
Tool(tool=Tool.Type.SEGMENTATION, name="Bird"),
175191
Tool(tool=Tool.Type.SEGMENTATION, name="Person"),
176-
Tool(tool=Tool.Type.SEGMENTATION, name="Sleep"),
177-
Tool(tool=Tool.Type.SEGMENTATION, name="Yak"),
192+
Tool(tool=Tool.Type.SEGMENTATION, name="Dog"),
178193
Tool(tool=Tool.Type.SEGMENTATION, name="Gemstone"),
179194
]
180195
for tool in tools:
@@ -223,26 +238,26 @@
223238
# COMMAND ----------
224239

225240
labels_table = labelspark.get_annotations(client, project_demo.uid, spark, sc)
226-
labels_table.registerTempTable(LABEL_TABLE)
241+
labels_table.createOrReplaceTempView(LABEL_TABLE)
227242
display(labels_table)
228243

229244
# COMMAND ----------
230245

231246
# MAGIC %md
232247
# MAGIC ## Other features of Labelbox
233248
# MAGIC
234-
# MAGIC <h3> [Model Assisted Labeling](https://docs.labelbox.com/docs/model-assisted-labeling) </h3>
235-
# MAGIC Once you train a model on your initial set of unstructured data, you can plug that model into Labelbox to support a Model Assisted Labeling workflow. Review the outputs of your model, make corrections, and retrain with ease! You can reduce future labeling costs by >50% by leveraging model assisted labeling.
249+
# MAGIC [Model Assisted Labeling](https://docs.labelbox.com/docs/model-assisted-labeling)
250+
# MAGIC <br>Once you train a model on your initial set of unstructured data, you can plug that model into Labelbox to support a Model Assisted Labeling workflow. Review the outputs of your model, make corrections, and retrain with ease! You can reduce future labeling costs by >50% by leveraging model assisted labeling.
236251
# MAGIC
237252
# MAGIC <img src="https://files.readme.io/4c65e12-model-assisted-labeling.png" alt="MAL" width="800"/>
238253
# MAGIC
239-
# MAGIC <h3> [Catalog](https://docs.labelbox.com/docs/catalog) </h3>
240-
# MAGIC Once you've created datasets and annotations in Labelbox, you can easily browse your datasets and curate new ones in Catalog. Use your model embeddings to find images by similarity search.
254+
# MAGIC [Catalog](https://docs.labelbox.com/docs/catalog)
255+
# MAGIC <br>Once you've created datasets and annotations in Labelbox, you can easily browse your datasets and curate new ones in Catalog. Use your model embeddings to find images by similarity search.
241256
# MAGIC
242257
# MAGIC <img src="https://files.readme.io/14f82d4-catalog-marketing.jpg" alt="Catalog" width="800"/>
243258
# MAGIC
244-
# MAGIC <h3> [Model Diagnostics](https://labelbox.com/product/model-diagnostics) </h3>
245-
# MAGIC Labelbox complements your MLFlow experiment tracking with the ability to easily visualize experiment predictions at scale. Model Diagnostics helps you quickly identify areas where your model is weak so you can collect the right data and refine the next model iteration.
259+
# MAGIC [Model Diagnostics](https://labelbox.com/product/model-diagnostics)
260+
# MAGIC <br>Labelbox complements your MLFlow experiment tracking with the ability to easily visualize experiment predictions at scale. Model Diagnostics helps you quickly identify areas where your model is weak so you can collect the right data and refine the next model iteration.
246261
# MAGIC
247262
# MAGIC <img src="https://images.ctfassets.net/j20krz61k3rk/4LfIELIjpN6cou4uoFptka/20cbdc38cc075b82f126c2c733fb7082/identify-patterns-in-your-model-behavior.png" alt="Diagnostics" width="800"/>
248263

@@ -255,12 +270,12 @@
255270
# MAGIC * Checkout our [notebook examples](https://github.com/Labelbox/labelspark/tree/master/notebooks) to follow along with interactive tutorials
256271
# MAGIC * view our [API reference](https://labelbox.com/docs/python-api/api-reference).
257272
# MAGIC
258-
# MAGIC <h4>Questions or comments? Reach out to us at [ecosystem+databricks@labelbox.com](mailto:ecosystem+databricks@labelbox.com)
273+
# MAGIC <b>Questions or comments? Reach out to us at [ecosystem+databricks@labelbox.com](mailto:ecosystem+databricks@labelbox.com)
259274

260275
# COMMAND ----------
261276

262277
# MAGIC %md
263-
# MAGIC Copyright Labelbox, Inc. 2021. The source in this notebook is provided subject to the [Labelbox Terms of Service](https://docs.labelbox.com/page/terms-of-service). All included or referenced third party libraries are subject to the licenses set forth below.
278+
# MAGIC Copyright Labelbox, Inc. 2022. The source in this notebook is provided subject to the [Labelbox Terms of Service](https://docs.labelbox.com/page/terms-of-service). All included or referenced third party libraries are subject to the licenses set forth below.
264279
# MAGIC
265280
# MAGIC |Library Name|Library license | Library License URL | Library Source URL |
266281
# MAGIC |---|---|---|---|

examples/model_diagnostics/custom_metrics_basics.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@
106106
"from labelbox.data.annotation_types import (ScalarMetric, Label, ImageData,\n",
107107
" Point, Rectangle, ObjectAnnotation,\n",
108108
" ClassificationAnnotation,\n",
109-
" ClassificationAnswer, Radio)"
109+
" ClassificationAnswer, Radio)\n",
110+
"import json"
110111
]
111112
},
112113
{

labelbox/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "labelbox"
2-
__version__ = "3.23.1"
2+
__version__ = "3.23.2"
33

44
from labelbox.client import Client
55
from labelbox.schema.project import Project

labelbox/orm/db_object.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ def _set_field_values(self, field_values):
7070
"field %s", value, field)
7171
elif isinstance(field.field_type, Field.EnumType):
7272
value = field.field_type.enum_cls(value)
73+
elif isinstance(field.field_type, Field.ListType):
74+
if field.field_type.list_cls.__name__ == "DataRowMetadataField":
75+
mdo = self.client.get_data_row_metadata_ontology()
76+
try:
77+
value = mdo.parse_metadata_fields(value)
78+
except ValueError:
79+
logger.warning(
80+
"Failed to convert value '%s' to metadata for field %s",
81+
value, field)
7382
setattr(self, field.name, value)
7483

7584
def __repr__(self):

0 commit comments

Comments
 (0)