Skip to content

Added memmap for tiles#740

Open
kuang-da wants to merge 1 commit intovanvalenlab:masterfrom
kuang-da:mesmer_predict_memmap
Open

Added memmap for tiles#740
kuang-da wants to merge 1 commit intovanvalenlab:masterfrom
kuang-da:mesmer_predict_memmap

Conversation

@kuang-da
Copy link
Copy Markdown

What

This PR introduces memory-mapped arrays (np.memmap) to the tile prediction step in Model._run_model. The tiles are temporarily stored on disk instead of being held in RAM during processing.

Why

When dealing with large images, storing all tiles in memory after _tile_input() can lead to high RAM usage, causing crashes or out-of-memory errors. Using np.memmap significantly reduces memory load by writing tile data to disk and reading it as needed, enabling the model to process larger images more efficiently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant