Skip to main content

Modern framework for ML-pipelines creation.

Project description

Hyppopipe Framework

Modern framework for ML-pipelines creation.

Developer: Lanin George (TG: @LaninGM)

The user (ML engineer) sets his own pipeline, defines the steps, the tasks to be solved (transformation, localization, classification, segmentation), sets up training configurations, exports training results, runs the pipeline for the image, gets the results for each step.

The project is being developed by the project group "Information systems for medical applications — ISMed".

Documentation

Read interactive docs here

Documentation is available at folder /docs in English and Russian.

Install

Create and activate .venv:

python -m venv .venv
source .venv/bin/activate
# .\.venv\Scripts\activate # For windows

Install hyppopipe package from PyPi:

pip install hyppopipe

Usage

Dataset reading

from hyppopipe.data import YAMLDataset, ImageFolderDataset, PairedImageMaskFolderDataset, split_random_fractions

image_folder = ImageFolderDataset(root="/datasets/Medical-imaging-dataset")

masks_dataset = PairedImageMaskFolderDataset(
    "/datasets/NailSegmentation/",
    image_folder="images",
    mask_folder="labels",
)

yolo_dataset = YAMLDataset("/datasets/BrainTumor/dataset.yaml", strict=False)

Dataset loaders

data_split = dataset.as_split_data(fractions=(0.7, 0.15, 0.15))
# or
data_split = split_random_fractions(dataset, (0.8, 0.2))

Pipeline

nails_pipe = Pipeline(
    steps={
        "sharpen": Step(ImageTransformer().sharpen(2.0)),
        "segment": Step(ImageSegmentator(kind="semantic")),
    }
)

Training

from hyppopipe.train import Trainer, ModelCandidate, TrainingConfig

result = nails_pipe.train(
    data=nails_split,
    step_config={
        "segment": Trainer(
            model_candidates=[
                ModelCandidate(
                    deeplabv3_resnet50, weights=[DeepLabV3_ResNet50_Weights.DEFAULT, ]
                ),
            ],
            # data=nails_split, # Separate split also supported
            config=TrainingConfig(
                epochs=20,
                device="mps",
                batch_size=8,
            ),
        )
    }
)

Export

result.export_artifacts(Path("artifacts/nails_seg"), nails_pipe)

Prediction

nail_image = Image.from_path("datasets/nail.jpg")
pred_res = nails_pipe.predict(nail_image, bundle_path=Path("artifacts/nails_seg"))
pred_res.outputs["segment"].show()

Фреймворк Hyppopipe

Фреймворк для построения ML-пайплайнов в медицинских системах

Разработчик: Георгий Ланин (TG: @LaninGM)

Пользователь (ML-инженер) задаёт свой пайплайн, определяет шаги, решаемые задачи (трансформация, локализация, классификация, сегментация), настраивает конфигурации обучения, экспортирует результаты обучения, запускает пайплайн для изображения, получает результаты для каждого шага.

Проект развивается проектной группой «Информационные системы для медицинских приложений — ИСМед».

Установка

Создаём и активируем виртуальное окружение .venv

python -m venv .venv
source .venv/bin/activate
# .\.venv\Scripts\activate # For windows

Устанавливаем зависимости проекта из индекса PyPi:

pip install hyppopipe

Документация

Интерактивная документация здесь

Документация доступна в паке /docs на английском и русском языках.

Использование

Чтение датасетов

from hyppopipe.data import YAMLDataset, ImageFolderDataset, PairedImageMaskFolderDataset, split_random_fractions

image_folder = ImageFolderDataset(root="/datasets/Medical-imaging-dataset")

masks_dataset = PairedImageMaskFolderDataset(
    "/datasets/NailSegmentation/",
    image_folder="images",
    mask_folder="labels",
)

yolo_dataset = YAMLDataset("/datasets/BrainTumor/dataset.yaml", strict=False)

Загрузчки датасетов для обучения

dataset.as_split_data(fractions=(0.7, 0.15, 0.15))
# or
split_random_fractions(dataset, (0.8, 0.2))

Описание пайплайнов

nails_pipe = Pipeline(
    steps={
        "sharpen": Step(ImageTransformer().sharpen(2.0)),
        "segment": Step(ImageSegmentator(kind="semantic")),
    }
)

Обучение

result = nails_pipe.train(
    data=nails_split,
    step_config={
        "segment": Trainer(
            model_candidates=[

                ModelCandidate(
                    deeplabv3_resnet50, weights=[DeepLabV3_ResNet50_Weights.DEFAULT, ]
                ),
            ],
            data=nails_split,
            config=TrainingConfig(
                epochs=20,
                device="mps",
                batch_size=8,
            ),
        )
    }
)

Экспорт результатов обучения

result.export_artifacts(Path("artifacts/nails_seg"), nails_pipe)

Предсказание

nail_image = Image.from_path("datasets/nail.jpg")
pred_res = nails_pipe.predict(nail_image, bundle_path=Path("artifacts/nails_seg"))
pred_res.outputs["segment"].show()

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

hyppopipe-0.1.3.tar.gz (83.0 kB view details)

Uploaded Source

Built Distribution

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

hyppopipe-0.1.3-py3-none-any.whl (110.4 kB view details)

Uploaded Python 3

File details

Details for the file hyppopipe-0.1.3.tar.gz.

File metadata

  • Download URL: hyppopipe-0.1.3.tar.gz
  • Upload date:
  • Size: 83.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hyppopipe-0.1.3.tar.gz
Algorithm Hash digest
SHA256 272df37786b27f46ed232e802b10dd5637af992494086dca3805d91794803a3b
MD5 36c347f1e45b38b9552bd4ff9166f640
BLAKE2b-256 2f335d9afa4dde730b7fec1e3b423c6636837d76f8e1c3ebba5d54caad943d71

See more details on using hashes here.

Provenance

The following attestation bundles were made for hyppopipe-0.1.3.tar.gz:

Publisher: publish-pypi.yml on hse-cs/hyppopipe

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

File details

Details for the file hyppopipe-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: hyppopipe-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 110.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hyppopipe-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 39bdebd9586708057c53e6406e84c06294c164fa1651798f676b4ca1aee543d6
MD5 021dbc8e0da7d4348543edebd27f5009
BLAKE2b-256 b8e72e6e3a4c57e651a960ad90d035c16a035c20711d82e51016542788283151

See more details on using hashes here.

Provenance

The following attestation bundles were made for hyppopipe-0.1.3-py3-none-any.whl:

Publisher: publish-pypi.yml on hse-cs/hyppopipe

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