algenta-vision

Image, vision and pixel kernels. Compiled Mojo, loaded in-process.

12 modules · 113 functions · CPU

Get started

pip install kernels torch
from kernels import get_kernel

kernel = get_kernel(
    "thyn-ai/algenta-vision",
    version=1,
    backend="cpu",
    trust_remote_code=["thyn-ai/algenta-vision"],
)
kernel.image_morphology.foreground_area_ratio_flat([0, 255, 255, 0, 255, 0, 0, 255], 4, 2, 128)  # -> 0.5  share of pixels at or above 128

backend="cpu" selects the CPU build. On a Mac the loader otherwise looks for a Metal build, which this family does not ship. trust_remote_code names the repositories you allow; Hugging Face's trusted publishers load without it.

Plain Python in, plain Python out. Lists, tuples, buffers and tensors are accepted wherever the contract expects a list; structured results are dictionaries. Some functions take a list and the number of elements to use from it, which may not exceed the list's length; multi-dimensional data is passed flattened, row-major, with its dimensions. Functions that update an argument do so in place, as help() says. Every call is checked against the published contract before it reaches native code. An invalid call raises KernelError with a stable code, never a crash.

Any function can also be called by name, with args as a list or a dict of parameter names:

kernel.execute("document_vision", "adaptive_mean_binarize_flat", [...])

What's inside

Module Functions What it does
document_vision 9 Document scans: Otsu and local-mean binarization, ink projections, skew angle, quality score
endocrinology 10 Hormone physiology: clearance from AUC, HOMA-IR, free T4 and testosterone, cortisol rhythm
geomorphology 12 Geomorphology: stream power, Shields parameter, Stokes settling, drainage density, sinuosity
image_features 11 Image features: Sobel edge density, RGB histogram comparison, dominant colours, saliency grid
image_morphology 9 Binary morphology: erode, dilate, open, close, fill holes, connected components, distance map
image_ops 11 Grayscale basics: 2D convolution, Sobel and Gaussian kernels, histogram, threshold, brightness
image_palette 8 Palette analysis: dominant colours, entropy, mean saturation, warm ratio, monochrome check
image_quality 15 Image quality: Laplacian blur score, brightness, contrast, entropy, MAD noise, composite score
image_regions 6 Region boxes: Otsu mask, connected-component boxes, largest box, saliency crop, box IoU
image_resize 9 Grayscale downscaling: box-average and bilinear resize, hash thumbnails, integral image sums
image_similarity 8 Image similarity: MSE, MAE, PSNR, normalized cross-correlation, global SSIM, duplicate score
vision_gate 5 Image routing: reuse duplicates, reject blurry or badly exposed images, flag text-heavy images

kernel.CONTRACT holds every signature, including the length rules for list arguments; help(kernel.document_vision) documents each function.

Requirements

  • Apple silicon: macOS 15 or later for the CPU build.
  • Linux arm64 and x86-64, glibc 2.35 or later.
  • kernels 0.17 or later and PyTorch 2.5 to 2.14. PyTorch has to be installed: the loader picks the build for your PyTorch version. The kernel itself never imports it.

Windows is not supported.

Notes

Calls into one kernel instance run one at a time; use processes for parallelism. Runtime state does not survive fork(); start worker processes with spawn.

License

Algenta Community License 1.1 (LICENSE). Free for personal, research and open-source use, and for internal use at organizations with fewer than 50 employees and under $5M in annual revenue. Beyond that, a commercial license is required: https://algenta.ai/pricing.

Enforced in the compiled library, not just in this text: one concurrent native worker per device (ABI §9). A second process, family or thread waits its turn rather than running in parallel. That is the Community licence's worker floor made real; parallel execution comes with a commercial license.

Support

Generally Available on the platforms listed under Requirements. Within v1, functions are only added; removals or signature changes ship as v2. Platforms, accelerators and PyTorch releases not listed are not supported. Documentation: https://docs.algenta.ai (the kernels guide: https://docs.algenta.ai/guides/kernels-on-hugging-face). Community: https://discord.gg/w8NDsph9an or this repository's Community tab. Commercial licences and support: https://algenta.ai/pricing.

Downloads last month
2
algenta
mojo
cpu
other
Torch
2.14
OS
macoslinux
Arch
x86_64aarch64