Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions thingsvision/core/extraction/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ def extract_features(
del batch

for module_name in module_names:
if output_dir:
os.makedirs(os.path.join(output_dir, module_name), exist_ok=True)
features[module_name].append(modules_features[module_name])

if output_dir and (i % step_size == 0 or i == len(batches)):
Expand Down
4 changes: 4 additions & 0 deletions thingsvision/core/extraction/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ def extract_features(
output_type: str = "ndarray",
output_dir: Optional[str] = None,
step_size: Optional[int] = None,
file_name_suffix: str = "",
save_in_one_file: bool = False,
):
if not bool(module_name) ^ bool(module_names):
raise ValueError(
Expand All @@ -225,6 +227,8 @@ def extract_features(
output_type=output_type,
output_dir=output_dir,
step_size=step_size,
file_name_suffix=file_name_suffix,
save_in_one_file=save_in_one_file,
)
self._unregister_hooks()
return features
Expand Down
Loading