Skip to content
Merged
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
15 changes: 14 additions & 1 deletion src/main/python/systemds/scuro/dataloader/video_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class VideoStats:
max_height: int
max_channels: int
num_instances: int
num_total_instances: int

@property
def output_shape(self):
Expand Down Expand Up @@ -132,8 +133,20 @@ def get_stats(self, source_path: str):
max_height = max(max_height, height)
max_num_channels = max(max_num_channels, num_channels)
num_instances += 1
num_total_instances = num_instances
num_instances = (
min(num_instances, self.chunk_size)
if self.chunk_size is not None
else num_instances
)
return VideoStats(
fps, max_length, max_width, max_height, max_num_channels, num_instances
fps,
max_length,
max_width,
max_height,
max_num_channels,
num_instances,
num_total_instances,
)

def estimate_peak_memory_bytes(self) -> dict:
Expand Down
23 changes: 23 additions & 0 deletions src/main/python/systemds/scuro/drsearch/modality_shared_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,3 +401,26 @@ def add_shared_memory_candidate(data: Any, resident_bytes: int = 0) -> bool:
return data, shm.name, data_nbytes, resident_bytes

return None, None, 0, resident_bytes


_SHARED_MEMORY_WRAPPER_TYPES = (
SharedStringList,
SharedGroupedArrayList,
SharedArrayList,
SharedNDArray,
)


def collect_shm_names_from_payload(data: Any) -> List[str]:
if data is None:
return []
if isinstance(data, _SHARED_MEMORY_WRAPPER_TYPES):
return [data.shm_name]
if hasattr(data, "data"):
return collect_shm_names_from_payload(data.data)
if isinstance(data, (list, tuple)):
names: List[str] = []
for item in data:
names.extend(collect_shm_names_from_payload(item))
return names
return []
Loading
Loading