KIE Grid Slice:
The KIE_GridSlice node is designed to efficiently divide a grid image into smaller, equal-sized tiles. This functionality is particularly useful for AI artists who need to process or analyze individual sections of a larger image. By slicing the image into tiles, you can focus on specific areas without altering the entire image. The node offers flexibility in terms of grid layout, allowing you to choose from predefined configurations such as 2x2, 2x3, or 3x3. Additionally, it provides options to crop borders and remove gutters, ensuring that the resulting tiles are clean and ready for further processing. This node is essential for tasks that require detailed examination or manipulation of image segments, enhancing your workflow by providing precise control over image slicing.
KIE Grid Slice Input Parameters:
image
This parameter represents the grid image batch that you want to slice. It should be a tensor with a shape of [B, H, W, 3], where B is the batch size, H is the height, W is the width, and 3 represents the RGB color channels. The image should be in float32 format with values ranging from 0 to 1.
grid
The grid parameter determines the layout of the tiles. You can choose from "2x2", "2x3", or "3x3" configurations. This choice affects how the image is divided into tiles, with each option resulting in a different number of tiles per image.
outer_crop_px
This parameter specifies the number of pixels to trim from each side of the image before slicing. It allows you to remove unwanted borders, ensuring that the tiles contain only the desired content. The value must be an integer between 0 and 8192, with a default of 0.
gutter_px
Gutter pixels are the spaces between tiles within the grid. This parameter lets you specify how many pixels to remove from these spaces, helping to create clean, distinct tiles. The value must be an integer between 0 and 8192, with a default of 0.
order
The order parameter determines the sequence in which tiles are arranged. You can choose between "row-major" and "column-major" ordering. This affects how the tiles are processed and can be important for maintaining the correct sequence in subsequent operations.
process_batch
This parameter controls whether the node processes only the first image in the batch or all images. You can select "first" to process just the initial image or "all" to process every image in the batch. This flexibility allows you to manage processing time and resources effectively.
log
The log parameter is a boolean that enables or disables console logging. When set to True, the node will output log messages to the console, which can be useful for debugging and monitoring the slicing process.
KIE Grid Slice Output Parameters:
tiles
The output of the KIE_GridSlice node is a batch of image tiles. Depending on the grid configuration chosen, each processed image will yield 4, 6, or 9 tiles. These tiles are stacked along the batch dimension, allowing for easy access and further processing. The tiles retain the original image's color information and are ready for any subsequent operations you may wish to perform.
KIE Grid Slice Usage Tips:
- To ensure clean and precise tiles, adjust the
outer_crop_pxandgutter_pxparameters according to the specific needs of your image. This can help remove unwanted borders and spaces between tiles. - Use the
process_batchparameter to manage processing time effectively. If you only need to slice the first image in a batch, set this parameter to "first" to save resources.
KIE Grid Slice Common Errors and Solutions:
Unsupported grid '<grid>'
- Explanation: This error occurs when an invalid grid configuration is specified.
- Solution: Ensure that the grid parameter is set to one of the supported options: "2x2", "2x3", or "3x3".
IMAGE input must have shape [B, H, W, 3]
- Explanation: The input image does not have the correct shape or number of channels.
- Solution: Verify that your input image is a tensor with the shape [B, H, W, 3] and that it contains RGB color channels.
outer_crop_px must be >= 0
- Explanation: The outer_crop_px parameter has been set to a negative value.
- Solution: Adjust the outer_crop_px parameter to a non-negative integer.
gutter_px must be >= 0
- Explanation: The gutter_px parameter has been set to a negative value.
- Solution: Adjust the gutter_px parameter to a non-negative integer.
