Milestone 1 of 8

Verify images, groups, and patch configuration

Check source-array identities, one shared channel count, complete image groups, positive patch and stride dimensions, pad values, edge policy, batch size, and the fixed keep-remainder rule.

Before generating a grid, prove that the images, groups, and configuration describe one compatible dataset. A patch from the wrong source cannot be repaired by a correct slice.

Goal

Validate image identities and array contracts, complete group assignment, shared channel count, patch dimensions and strides, edge policy, pad values, batch size, and the fixed remainder rule.

Inputs

Read the versioned image arrays, plans/image_groups.csv, plans/patch_config.json, and tiny fixtures. Every image has a unique image_id, source and transformation identity, shape, and digest. All images in this run have one configured channel count, either 1 or 3.

Patch height PH, width PW, row stride SH, and column stride SW are non-boolean positive integers with:

0 < SH <= PH
0 < SW <= PW

The edge policy is drop or pad. Pad values contain one valid uint8 value per channel. Batch size is positive and the remainder policy is exactly keep.

Deliverables

Implement checks in src/config.py and src/images.py (or clearly separated loaders). Produce ordered records containing image identity, group, shape, dtype, channel count, grid settings, pad values, batch settings, and source digest.

Checks

Reject changed or duplicate images, missing or extra group rows, duplicate or unknown image IDs, mixed channel counts, wrong dtype or shape, unsafe paths, boolean or non-integer dimensions and strides, strides larger than patches, unsupported edge policies, wrong pad count or range, non-positive batch size, and any remainder policy other than keep.

Check grayscale and RGB datasets separately, one-pixel and narrow images, empty groups, and a deliberately mixed-channel run. Confirm inputs and configuration are not mutated.

Workspace

Keep identity, array, group, and configuration checks here. Do not construct grid origins or patches yet.

Hints

HintCheck one run's channel boundary
A grayscale image and an RGB image may both be valid alone but are incompatible in one configured stack. Reject the mixed run before extraction.
HintThe remainder is a rule
keep means the smaller final batch is part of the output. It is not permission to drop a few patches for convenience.

Review

Follow one image from its source digest through its group and patch settings. Which identity would be unsafe to omit from the manifest? Why must a bad pad value be rejected before the first grid is generated?

How to check your work

Checks compare source, groups, channel count, limits, policy, and identity with the fixtures. The supplied fixture refuses incompatible inputs instead of guessing or repairing them.

LLM PrimerVerify images, groups, and patch configurationhttps://llmprimer.com/python/projects/build-an-image-patch-dataset/verify-images-groups-and-patch-configuration© 2026 LLM Primer