labelbox / labelpandas Goto Github PK
View Code? Open in Web Editor NEWLabelbox Connector for Pandas
Labelbox Connector for Pandas
I'm trying to export a dataset to a dataframe. I'm using the boilerplate code from the example notebook labelpandas-export.ipynb.
The code I"m running is:
df = client.export_to_table( project=project_id, include_performance=True, include_agreement=True, include_metadata=True, mask_method="png", verbose=True )
Here's the error:
KeyError Traceback (most recent call last)
in <cell line: 1>()
----> 1 df = client.export_to_table(
2 project=project_id,
3 include_performance=True,
4 include_agreement=True,
5 include_metadata=True,
2 frames
/usr/local/lib/python3.10/dist-packages/labelbase/annotate.py in flatten_label(client, label_dict, ontology_index, datarow_id, mask_method, divider)
390 annotation_value = [array, [255,255,255]]
391 else:
--> 392 png = mask_to_bytes(client=client, input=obj['mask']["url"], datarow_id=datarow_id, method="url", color=[255,255,255], output="png")
393 annotation_value = [png, "null"]
394 if "classifications" in obj.keys():
KeyError: 'mask'
Thanks!
KeyError Traceback (most recent call last)
Cell In[8], line 1
----> 1 df = client.export_to_table(project=project_id)
File ~/opt/anaconda3/envs/research/lib/python3.10/site-packages/labelpandas/client.py:46, in Client.export_to_table(self, project, include_metadata, include_performance, include_agreement, verbose, mask_method, divider)
29 def export_to_table(
30 self, project,
31 include_metadata:bool=False, include_performance:bool=False, include_agreement:bool=False,
32 verbose:bool=False, mask_method:str="png", divider="///"):
33 """ Creates a Pandas DataFrame given a Labelbox Projet ID
34 Args:
35 project : Required (str / lablebox.Project) - Labelbox Project ID or lablebox.Project object to export labels from
(...)
44 divider : Optional (str) - String delimiter for schema name keys and suffix added to duplocate global keys
45 """
---> 46 flattened_labels_dict = export_and_flatten_labels(
47 client=self.lb_client, project=project,
48 include_metadata=include_metadata, include_performance=include_performance, include_agreement=include_agreement,
49 mask_method=mask_method, verbose=verbose, divider=divider
50 )
52 table = pd.DataFrame.from_dict(flattened_labels_dict)
54 if verbose:
File ~/opt/anaconda3/envs/research/lib/python3.10/site-packages/labelbase/downloader.py:59, in export_and_flatten_labels(client, project, include_metadata, include_performance, include_agreement, verbose, mask_method, divider)
51 if not label['Skipped']:
52 flat_label = {
53 "global_key" : label["Global Key"],
54 "row_data" : label["Labeled Data"],
(...)
57 "external_id" : label["External ID"]
58 }
---> 59 res = flatten_label(label_dict=label, ontology_index=ontology_index, schema_to_name_path=schema_to_name_path, mask_method=mask_method, divider=divider)
60 for key, val in res.items():
61 flat_label[f"annotation{divider}{str(key)}"] = val
File ~/opt/anaconda3/envs/research/lib/python3.10/site-packages/labelbase/annotate.py:117, in flatten_label(label_dict, ontology_index, schema_to_name_path, mask_method, divider)
115 annotation_value = [array, [255,255,255]]
116 else:
--> 117 png = mask_to_bytes(input=obj["instanceURI"], method="url", color=[255,255,255], output="png")
118 annotation_value = [png, "null"]
119 if "classifications" in obj.keys():
KeyError: 'instanceURI'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.