Metadata-Version: 2.4
Name: dqm-ml-images
Version: 2.0.0rc1
Summary: Python library designed provide core dqm-ml metrics without huge dependencies, as well as common API shared by metrics
Author-email: SafenAI <support@safenai.io>
License-Expression: Apache-2.0
Project-URL: Homepage, https://irt-systemx.github.io/dqm-ml
Project-URL: Documentation, https://irt-systemx.github.io/dqm-ml
Project-URL: Repository, https://github.com/IRT-SystemX/dqm-ml
Keywords: ml,metrics,data
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: dqm-ml-core>=2.0.0rc0
Requires-Dist: pillow>=12.1.1
Requires-Dist: scipy>=1.7.0

# DQM-ML Images

Image feature extraction package for DQM-ML V2. Provides metrics for assessing image dataset quality.

## Installation

```bash
pip install dqm-ml-images
```

> **Note:** `dqm-ml-images` provides metric processors only — no CLI or job orchestration. Use directly via Python or with `dqm-ml-job` for YAML config execution.

## Usage

### Using Python Directly

```python
import numpy as np
from pathlib import Path
from dqm_ml_images import VisualFeaturesProcessor
from PIL import Image

# Load or generate sample images
images = [Image.open("path/to/image1.jpg"), Image.open("path/to/image2.jpg")]

# Create and configure the processor
processor = VisualFeaturesProcessor(
    name="image_quality",
    config={
        "input_columns": ["image_bytes"],
        "grayscale": True
    }
)

# Process images to extract features
batch = {"image_bytes": images}
features = processor.compute_features(batch)
print(f"Luminosity: {features['m_luminosity']}")
print(f"Contrast: {features['m_contrast']}")
print(f"Blur: {features['m_blur_level']}")
print(f"Entropy: {features['m_entropy']}")
```

### With dqm-ml-job

For running from a YAML config, install together with `dqm-ml-job`:

```bash
pip install dqm-ml-job dqm-ml-images
```

Then use this config:

```yaml
metrics_processor:
  image_quality:
    type: visual_metric
    input_columns: ["image_data"]
    grayscale: true
```

## Features

| Feature | Description |
|---------|-------------|
| **Luminosity** | Mean gray level — measures overall brightness |
| **Contrast** | RMS contrast — measures tonal range |
| **Blur** | Variance of Laplacian — estimates sharpness/focus |
| **Entropy** | Shannon entropy — measures information content |

## Output

The processor adds these columns to your data:
- `m_luminosity`
- `m_contrast`
- `m_blur_level`
- `m_entropy`

## Requirements

- `opencv-python`
- `pillow`
- `numpy`

## Dependencies

DQM-ML is modular. For visual features:

```bash
# Minimal: use as library only
pip install dqm-ml-images

# For YAML config execution
pip install dqm-ml-job dqm-ml-images

# Full stack with all metrics
pip install dqm-ml-job dqm-ml-core dqm-ml-images dqm-ml-pytorch
```

## See Also

- [Visual Features Documentation](https://safenai.github.io/dqm-ml-workspace/docs/metrics/visual_features/)
- [Configuration Guide](https://safenai.github.io/dqm-ml-workspace/docs/configuration/)
