diff --git a/cellmap_flow/blockwise/blockwise_processor.py b/cellmap_flow/blockwise/blockwise_processor.py index 87b6fd6..f1c6dc4 100644 --- a/cellmap_flow/blockwise/blockwise_processor.py +++ b/cellmap_flow/blockwise/blockwise_processor.py @@ -152,13 +152,15 @@ def process_fn(self, block): print(f"empty write roi: {write_roi}") return + # Check if block is already processed before expensive inference computation + fill_value = getattr(self.output_arrays[0], 'fill_value', self.dtype(0)) + if not (self.output_arrays[0][write_roi] == fill_value).all(): + return + chunk_data = self.inferencer.process_chunk(self.idi_raw, block.write_roi) chunk_data = chunk_data.astype(self.dtype) - if self.output_arrays[0][block.write_roi].any(): - return - for i, array in enumerate(self.output_arrays): if chunk_data.shape == 3: @@ -217,8 +219,8 @@ def run(self): ), read_write_conflict=True, fit="overhang", - max_retries=0, - timeout=None, + max_retries=2, + timeout=1800, num_workers=self.workers, )