Skip to content

Commit

Permalink
using more cloud-friendly layout
Browse files Browse the repository at this point in the history
  • Loading branch information
brimoor committed Aug 25, 2022
1 parent ff8760a commit f5f671b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions fiftyone/utils/labelstudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,19 @@ def _init_project(self, config, samples):
def _prepare_tasks(self, samples, label_schema, media_field):
"""Prepares Label Studio tasks for the given data."""
samples.compute_metadata()

ids, mime_types, filepaths = samples.values(
["id", "metadata.mime_type", media_field]
)

tasks = [
{
"source_id": one.id,
one.media_type: one[media_field],
"source_id": _id,
"media_type": "image",
"mime_type": one.metadata.mime_type,
"mime_type": _mime_type,
"image": _filepath,
}
for one in samples.select_fields(media_field)
for _id, _mime_type, _filepath in zip(ids, mime_types, filepaths)
]

predictions, id_map = {}, {}
Expand All @@ -244,7 +249,7 @@ def _prepare_tasks(self, samples, label_schema, media_field):
smp[label_field],
full_result={
"from_name": "label",
"to_name": smp.media_type,
"to_name": "image",
"original_width": smp.metadata["width"],
"original_height": smp.metadata["height"],
"image_rotation": getattr(smp, "rotation", 0),
Expand Down

0 comments on commit f5f671b

Please sign in to comment.