Skip to main content

A Pytorch lightning framework for streaming CNN's

Reason this release was yanked:

amp decorator bug breaks streaming

Project description

Lightstream

Lightstream is a Pytorch library to train CNN's with large input images. Parsing large inputs is achieved through a combination of gradient checkpointing and tiling the input image. For a full overview of the streaming algorithm, please read the article:

[1] H. Pinckaers, B. van Ginneken and G. Litjens, "Streaming convolutional neural networks for end-to-end learning with multi-megapixel images," in IEEE Transactions on Pattern Analysis and Machine Intelligence, doi: 10.1109/TPAMI.2020.3019563

Installation

The lightstream repository can be installed using pip, or you can alternatively clone the git repository and build the wheel.

pip install lightstream

We also recommend to install the albumentationsxl package, which is an albumentations fork with a pyvips backend to preprocess large images

pip install albumentationsxl

Requirements

The lightstream package requires PyTorch version 2.0 or greater to be installed, along with Pytorch lightning version 2.0.0 or greater.

  • PyTorch 2.0.0 or greater
  • Pytorch Lightning 2.0.0 or greater
  • Albumentationsxl (recommended) Furthermore, we recommend a GPU with at least 10 GB of VRAM, and a system with at least 32 GB of RAM.

Using lightstream with pre-trained networks

lightstream offers several out-of-the-box streaming equivalents of ImageNet classifiers. Currently ResNet and ConvNext architectures are supported

import torch.nn
from lightstream.models.resnet.resnet import StreamingResNet

model = StreamingResNet(model_name="resnet18", tile_size=2880, loss_fn=torch.nn.CrossEntropyLoss(), train_streaming_layers=True)

Documentation

The documentation can be found at https://diagnijmegen.github.io/lightstream/

Alternatively the documentation can be generated locally using

make docs

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

lightstream-0.0.3.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

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

lightstream-0.0.3-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file lightstream-0.0.3.tar.gz.

File metadata

  • Download URL: lightstream-0.0.3.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for lightstream-0.0.3.tar.gz
Algorithm Hash digest
SHA256 bd6ca468f101858536817411b5aa0268156056abfc1b7b8704e4e7b8132bc7f0
MD5 8b72b2aed313c9a63cfc9fb88712619a
BLAKE2b-256 2594621b25bdf16ea2ed59576da0a223951eb8ef7ed70d09a783f69e6b5d32cb

See more details on using hashes here.

File details

Details for the file lightstream-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: lightstream-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 34.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for lightstream-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 af770f5ce86e3f837df2738732546eeb01419e1475e03c7c9c06250b935d1fb1
MD5 adfe0cb67066dd5e732421e759cba3eb
BLAKE2b-256 55f388ab429b26c28f630b89fb1042a8d28ff19c49d6c3bc3ddac1b48bd3cd39

See more details on using hashes here.

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