pyluna-pathology.luna.pathology.models package

Submodules

pyluna-pathology.luna.pathology.models.eng_tissuenet module

load_classifier Modified version of [1], rewritten to load tissue classifier models trained by the MIND team. [1] https://github.com/msk-mind/data-processing/blob/refactor-cli-fix-tests/data_processing.pathology/models/tissuenet.py

luna.pathology.models.eng_tissuenet.get_classifier(checkpoint_path: str = '/gpfs/mskmindhdp_emc/user/shared_data_folder/kohlia/tile_classifier/ckpts/1.ckpt', n_classes: int = 5)[source]

loads a model from a checkpoint and unpacks the network

Parameters
  • checkpoint_path (str) – path to model checkpoint

  • n_classes – number of classes used in training, used to set final layer in PyTorch model

Returns

PyTorch module with loaded weights

Return type

nn.Module

luna.pathology.models.eng_tissuenet.get_transform() Callable[source]

transformer which generates a torch tensor compatible with the model

Parameters

none

Returns

torchvision.Transform: transform object for tensor conversion

pyluna-pathology.luna.pathology.models.ov_tissuenet module

class luna.pathology.models.ov_tissuenet.TissueTileNet(model, n_classes, activation=None)[source]

Bases: torch.nn.modules.module.Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
luna.pathology.models.ov_tissuenet.get_classifier(checkpoint_path='/gpfs/mskmind_ess/boehmk/histocox/checkpoints/2021-01-19_21.05.24_fold-2_epoch017.torch', activation=None, n_classes=4)[source]

Return model given checkpoint_path

luna.pathology.models.ov_tissuenet.get_transform()[source]

Transformer which generates a torch tensor compatible with the model

Module contents

Created on April 27, 2021

@author: pashaa@mskcc.org