Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

KeyError with df = client.export_to_table(project=project_id) #3

Open
shorng-medknowts opened this issue Mar 31, 2023 · 1 comment
Open

Comments

@shorng-medknowts
Copy link


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'

@shorng-medknowts
Copy link
Author

the problem, I think is that I'm trying to export text annotations, so there is no mask per say.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant