merge_batch_to_canvas¶
- merge_batch_to_canvas(blocks, output_locations, merged_shape)[source]¶
Merge patch-level predictions into a single canvas.
This function aggregates overlapping patch predictions into a unified output canvas and maintains a count map to normalize overlapping regions.
- Parameters:
blocks (np.ndarray) – Array of predicted blocks with shape (N, H, W, C), where N is the number of patches.
output_locations (np.ndarray) – Array of coordinates for each block in the format [start_x, start_y, end_x, end_y] with shape (N, 4).
merged_shape (tuple[int, int, int]) – Shape of the final merged canvas (H, W, C).
- Returns:
canvas: Merged prediction map of shape (H, W, C).
count: Count map indicating how many times each pixel was updated, shape (H, W).
- Return type:
tuple[np.ndarray, np.ndarray]