Metadata-Version: 2.5
Name: radimagenet-mlx
Version: 0.2.2
Summary: Native MLX implementation of RadImageNet
Project-URL: Homepage, https://github.com/MedMLX/radimagenet-mlx
Project-URL: Documentation, https://github.com/MedMLX/radimagenet-mlx/blob/main/docs/technical.md
Project-URL: Repository, https://github.com/MedMLX/radimagenet-mlx
Project-URL: Issues, https://github.com/MedMLX/radimagenet-mlx/issues
Author: Joseph Sandoval, Alfredo Sandoval Jr.
License-Expression: Apache-2.0 AND MIT
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES.md
Classifier: Operating System :: MacOS :: MacOS X
Requires-Python: <3.14,>=3.13
Requires-Dist: h5py<4,>=3.14
Requires-Dist: medmlx-core==0.2.4
Requires-Dist: numpy<3,>=2.0
Requires-Dist: pillow<14,>=13
Provides-Extra: dev
Requires-Dist: h5py-stubs>=0.1.2; extra == 'dev'
Requires-Dist: hypothesis<7,>=6.156; extra == 'dev'
Requires-Dist: pyright==1.1.414; extra == 'dev'
Requires-Dist: pytest<10,>=8.4; extra == 'dev'
Requires-Dist: ruff<1,>=0.13; extra == 'dev'
Requires-Dist: types-tensorflow>=2.18.0.20261006; extra == 'dev'
Provides-Extra: reference
Requires-Dist: keras==3.15.0; extra == 'reference'
Requires-Dist: tensorflow==2.20.0; extra == 'reference'
Description-Content-Type: text/markdown

# radimagenet-mlx

Extract radiology-image features with native MLX RadImageNet encoders: ResNet50, DenseNet121, InceptionV3 and InceptionResNetV2.

[Docs](https://github.com/MedMLX/radimagenet-mlx/blob/main/docs/technical.md) · [MedMLX](https://github.com/MedMLX)

![CT → embedding-based image retrieval, ranked by cosine similarity.](https://raw.githubusercontent.com/MedMLX/radimagenet-mlx/main/docs/showcase.png)

*CT → embedding-based image retrieval, ranked by cosine similarity.*

| Input | Output |
| :--- | :--- |
| 2D image + Keras checkpoint | Pooled and spatial features |

**Apple Silicon · Metal · Python 3.13** · [uv](https://docs.astral.sh/uv/)

## Quick start

```bash
uv venv --python 3.13
source .venv/bin/activate
uv pip install radimagenet-mlx
```

Download a [RadImageNet checkpoint](https://github.com/BMEII-AI/RadImageNet), then extract features:

```python
from radimagenet_mlx.medmlx import run

result = run(
    image_path="slice.png",
    weights_path="RadImageNet-ResNet50_notop.h5",
    output_dir="features",
)
print(result["outputs"]["features_npy"])
```

The `.h5` weights load directly; TensorFlow is not needed. Classifier predictions require a checkpoint that includes a classifier.

## License

[Apache-2.0](https://github.com/MedMLX/radimagenet-mlx/blob/main/LICENSE). See [third-party notices](https://github.com/MedMLX/radimagenet-mlx/blob/main/THIRD_PARTY_NOTICES.md). Model weights retain their publisher terms.

For research and education. Outputs require human review.
