(
original_size, grid, scale_resolution, patch_size, allow_upscale=False
)
| 512 | |
| 513 | |
| 514 | def get_refine_size( |
| 515 | original_size, grid, scale_resolution, patch_size, allow_upscale=False |
| 516 | ): |
| 517 | width, height = original_size |
| 518 | grid_x, grid_y = grid |
| 519 | |
| 520 | refine_width = ensure_divide(width, grid_x) |
| 521 | refine_height = ensure_divide(height, grid_y) |
| 522 | |
| 523 | grid_width = refine_width / grid_x |
| 524 | grid_height = refine_height / grid_y |
| 525 | |
| 526 | best_grid_size = find_best_resize( |
| 527 | (grid_width, grid_height), |
| 528 | scale_resolution, |
| 529 | patch_size, |
| 530 | allow_upscale=allow_upscale, |
| 531 | ) |
| 532 | |
| 533 | refine_size = (best_grid_size[0] * grid_x, best_grid_size[1] * grid_y) |
| 534 | |
| 535 | return refine_size |
| 536 | |
| 537 | |
| 538 | def split_to_patches(image, grid): |
no test coverage detected