Skip to content

Commit

Permalink
Don't download single-slotted items as multi-slotted items when force…
Browse files Browse the repository at this point in the history
…_slots=False
JBWilkie committed Aug 21, 2024
1 parent 530244b commit bf2a033
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions darwin/dataset/download_manager.py
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ def download_all_images_from_annotations(
if is_file_extension_allowed(image.name)
}

annotations_to_download_path = []
annotations_to_download_path: List = []
for annotation_path in annotations_path.glob(f"*.{annotation_format}"):
annotation = parse_darwin_json(annotation_path, count=0)
if annotation is None:
@@ -108,13 +108,18 @@ def download_all_images_from_annotations(
):
continue

annotations_to_download_path.append(annotation_path)
if len(annotation.slots) > 1:
force_slots = True
if not force_slots:
force_slots_for_item = False
if len(annotation.slots) > 1:
force_slots_for_item = True

for slot in annotation.slots:
if len(slot.source_files) > 1:
force_slots = True
for slot in annotation.slots:
if len(slot.source_files) > 1:
force_slots_for_item = True
else:
force_slots_for_item = True

annotations_to_download_path.append((annotation_path, force_slots_for_item))

if remove_extra:
annotations = (
@@ -138,7 +143,7 @@ def download_all_images_from_annotations(

# Create the generator with the partial functions
download_functions: List = []
for annotation_path in annotations_to_download_path:
for annotation_path, force_slots in annotations_to_download_path:
file_download_functions = lazy_download_image_from_annotation(
api_key,
annotation_path,

0 comments on commit bf2a033

Please sign in to comment.