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
Metadata
Release files for lightstream 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lightstream-1.0.7.tar.gz | 2.0 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lightstream-1.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.0 MB
Release files / lightstream-1.0.7.tar.gz
| Download URL | lightstream-1.0.7.tar.gz |
|---|---|
| Size | 2.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eca9b5dbc5b6d336b0b8a6af55b0928683e4ef18cb2072b36894b413d118b173
|
|
BLAKE2b-256 checksum How to use checksums |
089d41c6b4a5980a37c3fe5e47037547fbd81b692a89062ea62f9e51fa0a5b15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.6
|
Release files / lightstream-1.0.7-py3-none-any.whl
| Download URL | lightstream-1.0.7-py3-none-any.whl |
|---|---|
| Size | 38.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a38ed84a1beb6ae8fed810e98f4317391e9f75ffa2f52b83310497321582199b
|
|
BLAKE2b-256 checksum How to use checksums |
26e98048c8ff50cc9ad479a9fcc24bd124fa07cc906389c58183487f286fbbef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.6
|
Security for lightstream 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.