Skip to main content

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 — a Batch specialization for images, where the sample space is fixed: axes (height, width, channel) and values (0, 255). It adds an images alias 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 an augmentation or a corruption is judged downstream, against a task, not asserted by the algorithm.
  • crop_resize is top-left anchored. The window is top/left offset by the fraction of H/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_resize records itself as not reversible.

Metadata

Release files for kcai-data-sampling-images 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kcai-data-sampling-images 0.8.1
File Size Uploaded Provenance Actions
kcai_data_sampling_images-0.8.1.tar.gz 9.4 kB Without provenance Details for kcai_data_sampling_images-0.8.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kcai-data-sampling-images 0.8.1
File Interpreter ABI Platform Actions
kcai_data_sampling_images-0.8.1-py3-none-any.whl Python 3 none any Details for kcai_data_sampling_images-0.8.1-py3-none-any.whl

Total release size: 21.1 kB

Release files / kcai_data_sampling_images-0.8.1.tar.gz

Download URL kcai_data_sampling_images-0.8.1.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
31e883c026cadb1f8b94438c52252d0c2508d12ce6092d149ce684e4e1c5d963
BLAKE2b-256 checksum
How to use checksums
832b2318d400678b464f366ac2c3950514b38dd82324d5198fa8808810341923
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.17

Release files / kcai_data_sampling_images-0.8.1-py3-none-any.whl

Download URL kcai_data_sampling_images-0.8.1-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a8cdc5c6c4c4670e180c2d18b875e57e775289b760ebe37641ced5a2058de28
BLAKE2b-256 checksum
How to use checksums
63fbc8a98da9b23d91a43a1a5f91c3381ef5b7da0d4d82c3abd580a1def60476
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.17

Security for kcai-data-sampling-images 0.8.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page