Metadata-Version: 2.5
Name: lazyslide-models
Version: 0.1.0rc0
Summary: The model zoo for LazySlide
Author-email: Yimin Zheng <yzheng@cemm.at>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
Requires-Dist: numpy>=2.0.0
Requires-Dist: opencv-python-headless
Requires-Dist: pandas
Requires-Dist: platformdirs
Requires-Dist: scikit-image
Requires-Dist: scipy
Requires-Dist: timm>=1.0.3
Requires-Dist: torch>=2.1.0
Requires-Dist: transformers>=4.49.0
Description-Content-Type: text/markdown

# LazySlide models

<p align="center">
  <i>The model zoo for <a href="https://github.com/rendeirolab/LazySlide">LazySlide</a>, the accessible whole slide image analysis framework</i>
</p>

[![Documentation Status](https://readthedocs.org/projects/lazyslide/badge/?version=stable&style=flat-square)](https://lazyslide.readthedocs.io/en/stable)
![pypi version](https://img.shields.io/pypi/v/lazyslide-models?color=0098FF&logo=python&logoColor=white&style=flat-square)
![conda version](https://img.shields.io/conda/vn/conda-forge/lazyslide-models?style=flat-square&logo=anaconda&logoColor=white&color=%2344A833)
![PyPI - License](https://img.shields.io/pypi/l/lazyslide-models?color=FFD43B&style=flat-square)

`lazyslide-models` contains all the models consumed by LazySlide. LazySlide
itself contains no model code, it is an inference and orchestration layer that
discovers models through the `MODEL_REGISTRY`. Any registered model can be used
by name with zero configuration.

## Model types

The zoo spans different task types: vision encoders, multimodal (image-text) models,
segmentation, slide encoders, tile prediction, classical hand-crafted features,
feature prediction, style transfer (HE to spatial omics or IHC stainings), image generation and chat models. Every
[timm](https://huggingface.co/timm) model is also available for feature extraction (e.g. `resnet50`).

The complete per-task model list, with licenses, gated-access badges and
citation keys, is maintained in the
[Model Zoo Website](https://rendeiro.group/lazyslide-models/).

## Usage

```python
from lazyslide_models import MODEL_REGISTRY, list_models

list_models("segmentation")          # ['cellpose', 'classpose', 'sam', ...]
model = MODEL_REGISTRY["instanseg"]()  # instantiate (weights download on first use)
```

In LazySlide, pass the registered name to any function:

```python
zs.tl.feature_extraction(wsi, model="conch")  # any vision or multimodal key
zs.seg.cells(wsi, model="instanseg")
```

## Exported models

Models that cannot be loaded directly from Hugging Face are exported to
[RendeiroLab/LazySlide-models](https://huggingface.co/RendeiroLab/LazySlide-models)
(permissive and non-commercial licenses) and
[RendeiroLab/LazySlide-models-gpl](https://huggingface.co/RendeiroLab/LazySlide-models-gpl)
(GPL). Reproduction scripts: [`scripts/export_models`](scripts/export_models).

## Contributing a new model

1. Open an [issue](https://github.com/rendeirolab/lazyslide-models/issues) with the
   `[New Model]` label to confirm the model fits the zoo.
2. Follow the [integration guide](https://lazyslide.readthedocs.io/en/stable/contributing/new_models.html).
3. Open a pull request against `main`. The CI will test the models in your PR.

## Licenses

Some models are non-commercial or gated, and licenses vary. Check each model's
registry entry before use, and please cite the original paper.