kcai-data-sampling-images
The procedural slot of kcai data-sampling: transformations whose output is computed from the input sample alone. No model enters the computation, so nothing here needs a framework and nothing here needs a GPU.
These methods work in memory on a decoded (B, H, W, C) uint8 stack, where
B is the batch and (H, W, C) is one image. They return a batch of the same
shape — the sample space never changes, so the difference between a source
sample and its output stays defined and can be computed downstream.
Its only dependencies are numpy and the core contracts. It deliberately ships no input/output plugins and no image-file handling: reading and writing are a separate concern, handled by the job package.
What it ships today
horizontal_flip— mirror the width axis. Deterministic, and its own inverse, so the output determines the input.crop_resize— keep a window of a chosen fraction and resize it back to the original shape. Deterministic and lossy, so it is not invertible.ImageBatch— aBatchspecialization for images, where the sample space is fixed: axes(height, width, channel)and values(0, 255). It adds animagesalias for the stack, so the image math reads naturally.
Two methods, as examples of the slot rather than a catalogue. Both are one numpy expression in a pure function, wrapped into the transformation contract.
Install
pip install "kcai-data-sampling[images]"
Example
dataloaders:
loaders:
- name: images
type: parquet
path: /path/to/samples.parquet
id_column: id
decode: img_bytes
sample_path:
- column: path
prefix: /path/to/images
operations:
outputs:
path: /path/to/outputs/{selection}/ledger.parquet
write_samples: true
samples_dir: /path/to/outputs/{selection}/payloads
transformations:
- name: horizontal_flip
type: horizontal_flip
- name: crop_resize
type: crop_resize
fraction:
range: [0.3, 0.5]
step: 0.1
Listed transformations are applied independently to the same source sample,
not chained: the flip and the crop each get their own row, and neither sees the
other's output. fraction is given as a range plus a step, so the job
expands it into one run per value in the sweep.
Because crop_resize resizes the kept window back to the original shape,
every output shares the source's sample space and can be compared against it
pixel by pixel. A method that changed the shape would be refused, not resized.
Notes
- The regime is not declared. Whether an output is a perturbation, an augmentation or a corruption is read off the input/output pair afterwards, not asserted by the algorithm.
crop_resizeis top-left anchored. The window istop/leftoffset by the fraction ofH/W, then resized back by nearest-neighbour index replication. Offsets that would leave the image are refused rather than silently clamped.- Scaling back is lossy by construction. The crop is kept and the rest
discarded, so
crop_resizerecords itself as not reversible.
Metadata
Release files for kcai-data-sampling-images 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kcai_data_sampling_images-0.1.0.tar.gz | 9.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kcai_data_sampling_images-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.1 kB
Release files / kcai_data_sampling_images-0.1.0.tar.gz
| Download URL | kcai_data_sampling_images-0.1.0.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2eeebca9c63b04b029e8c42496566e0c5e3c26583336e2637121a49c19a4caee
|
|
BLAKE2b-256 checksum How to use checksums |
bc30b7890fb6758dc99d902ee9916dc412bfa81c7f92944771eeb8f29ab8859f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.17
|
Release files / kcai_data_sampling_images-0.1.0-py3-none-any.whl
| Download URL | kcai_data_sampling_images-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc2ddfc1d8cfc4c41c79ef88f02927f1958f90bc51a539d3df490e750f83312b
|
|
BLAKE2b-256 checksum How to use checksums |
5a189fe1a41bfe6fd97ac80f295d3567c581799e60a3be780b220bd40f8ddf9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.17
|