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 TestPyPi:

pip install -i https://test.pypi.org/simple/ 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

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

pip install -i https://test.pypi.org/simple/ hyppopipe

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

Read interactive docs here Документация доступна в паке /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.1.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.1-py3-none-any.whl (110.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hyppopipe-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 1e3bbc9fea14da643c17ad914e9b141c5ea00894d47c42a11d9e88f8a79af6df
MD5 9b83e0afb7c615de82960a89c56c6452
BLAKE2b-256 9346cc09e2b7b4edf44c803df358c736d5e90b38a5f48b8ae3b04d0b6b454694

See more details on using hashes here.

Provenance

The following attestation bundles were made for hyppopipe-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: hyppopipe-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95e37aece848b2b842540aa440071cfe51ae75137ec4a314f4a11f4a56a78ca6
MD5 966de2ba1aefa504cc2ead2e44bb1ef9
BLAKE2b-256 953b8d8e9d69173c609c25ef60478d880eaf248a07849dee21a26fff539d5880

See more details on using hashes here.

Provenance

The following attestation bundles were made for hyppopipe-0.1.1-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