Step3 插值:多进程内存雪崩二次补丁(mask copy + workers 上限 6)
This commit is contained in:
@ -508,7 +508,8 @@ def interpolate_zero_pixels_batch(
|
||||
cpu_count = multiprocessing.cpu_count() or 1
|
||||
except (NotImplementedError, OSError):
|
||||
cpu_count = 1
|
||||
effective_workers = max(1, cpu_count)
|
||||
# 为了内存安全,强制将物理进程数限制在最高 6 个
|
||||
effective_workers = min(6, max(1, cpu_count))
|
||||
|
||||
n_blocks_y = (height + block_size - 1) // block_size
|
||||
n_blocks_x = (width + block_size - 1) // block_size
|
||||
@ -531,7 +532,7 @@ def interpolate_zero_pixels_batch(
|
||||
col_offset = x0 - ex0
|
||||
mask_segment_ext = None
|
||||
if mask_array is not None:
|
||||
mask_segment_ext = mask_array[ey0:ey1, ex0:ex1]
|
||||
mask_segment_ext = mask_array[ey0:ey1, ex0:ex1].copy()
|
||||
tasks.append((
|
||||
x0, y0, ey0, ex0, ey1, ex1,
|
||||
row_offset, col_offset, inner_h, inner_w,
|
||||
|
||||
Reference in New Issue
Block a user