Skip to content

Commit

Permalink
add masks and heatmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmarks committed Jul 17, 2024
1 parent d2387c9 commit 7f57f9b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions fiftyone/utils/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,36 @@ def _get_files_to_download(sample_collection):
]
filepaths.extend(media_field_values)

try:
heatmap_fields = list(
sample_collection.get_field_schema(
embedded_doc_type=fo.Heatmap
).keys()
)
for heatmap_field in heatmap_fields:
map_path_name = f"{heatmap_field}.map_path"
map_paths = sample_collection.exists(map_path_name).values(
map_path_name
)
map_paths = [val for val in map_paths if not os.path.exists(val)]
filepaths.extend(map_paths)

mask_fields = list(
sample_collection.get_field_schema(
embedded_doc_type=fo.Segmentation
).keys()
)

for mask_field in mask_fields:
mask_path_name = f"{mask_field}.mask_path"
mask_paths = sample_collection.exists(mask_path_name).values(
mask_path_name
)
mask_paths = [val for val in mask_paths if not os.path.exists(val)]
filepaths.extend(mask_paths)
except:
pass

return filepaths


Expand Down

0 comments on commit 7f57f9b

Please sign in to comment.