Skip to main content

Image preprocessing and Apple Vision framework interop for MLX on Apple Silicon

Project description

mlx-vision

Image preprocessing and Apple Vision framework interop for MLX on Apple Silicon.

mlx-vision provides two layers:

  • MLX-native image loading and preprocessing for model pipelines
  • optional Apple Vision framework integration for OCR, face detection, classification, and saliency

GitHub: https://github.com/AmiraniLabs/mlx-vision

Install

Base install:

pip install mlx-vision

With Apple Vision support:

pip install mlx-vision[vision]

Development install:

pip install mlx-vision[dev]

Full install:

pip install mlx-vision[all]

Quickstart

import mlx_vision as mv

image = mv.load("photo.jpg")
image = mv.resize(image, (256, 256))
image = mv.center_crop(image, (224, 224))
image = mv.normalize(image)
image = mv.to_chw(image)

Batch Loading

import mlx_vision as mv

batch = mv.load_batch(["a.jpg", "b.jpg"], size=(224, 224))
batch = mv.normalize(batch)
batch = mv.to_chw(batch)

Apple Vision Integration

import mlx_vision as mv

if mv.is_vision_available():
    faces = mv.detect_faces("portrait.jpg")
    text = mv.detect_text("document.jpg")
    classes = mv.classify_image("photo.jpg")
    saliency = mv.attention_saliency_map("photo.jpg")

API

Core image preprocessing:

  • load(path, color="rgb")
  • load_batch(paths, color="rgb", size=None)
  • resize(image, size, interpolation="linear")
  • center_crop(image, size)
  • pad(image, padding, fill=0, mode="constant")
  • horizontal_flip(image)
  • to_float(image, scale=True)
  • normalize(image, mean=..., std=...)
  • to_chw(image)
  • to_hwc(image)

Apple Vision framework:

  • is_vision_available()
  • detect_faces(image)
  • detect_text(image, recognition_level="accurate", languages=None)
  • classify_image(image)
  • saliency_map(image, kind="attention")
  • attention_saliency_map(image)

Positioning

What mlx-vision is:

mlx-vision is the image and computer vision entry point for MLX pipelines on Apple Silicon. It provides model-ready image transforms and optional access to Apple's native Vision framework with outputs compatible with MLX workflows.

What it is not:

  • not a full replacement for OpenCV
  • not a training framework
  • not a visionOS SDK
  • not a general multimedia library

Publishing

This package is configured for PyPI Trusted Publishing from the AmiraniLabs/mlx-vision GitHub repository using .github/workflows/publish.yml.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlx_vision-0.1.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlx_vision-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file mlx_vision-0.1.0.tar.gz.

File metadata

  • Download URL: mlx_vision-0.1.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mlx_vision-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fd234ee8f3efc0f1046def7a432a3011e321074811112eda496aa0c958ef1b64
MD5 209e767a72bd78c24830958e4d3b8e45
BLAKE2b-256 af777ed138f8f231665e975406188cbe4f82db60403578959b11deec540603b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_vision-0.1.0.tar.gz:

Publisher: publish.yml on AmiraniLabs/mlx-vision

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mlx_vision-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mlx_vision-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mlx_vision-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d37b604aa5051e4280548f6514818bc35f1938ed89393a2331114ad931a54baf
MD5 32166426dab92eb920d0d6db62d4b1fc
BLAKE2b-256 9fb75695d83b811113fff8f94cfc4e7f38a9dff711b0304df9e7686db2e9d8fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_vision-0.1.0-py3-none-any.whl:

Publisher: publish.yml on AmiraniLabs/mlx-vision

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page