peal.visualization.image_grid

PIL/NumPy helpers that assemble PEAL’s annotated image grids.

Explainers and teachers render feedback collages as columns: a rotated title, then one image per row with a caption underneath. Columns of checkbox icons (<resource_dir>/imgs/checkbox_right.png / checkbox_wrong.png) mark boolean per-row facts such as “flipped”. make_image_grid() concatenates such columns into one image; the other functions build the pieces. Image tensors are [N, C, H, W] floats in [0, 1].

Functions

bool_list_to_checkboxes

Render a list of booleans as a batch of checkbox icons.

embed_text_in_image

Draw text centred on a white width x height RGB canvas.

make_column

Stack images vertically into one titled, captioned column.

make_image_grid

Compose checkbox columns and image columns into a single grid image.

zip_tensors

Interleave several image batches sample by sample along the width.