infer_tiles
Run inference using a model and transform definition (either local or using torch.hub)
Decorates existing slide_tiles with additional columns corresponding to class prediction/scores from the model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
slide_urlpath |
str
|
url/path to slide image (virtual slide formats compatible with TiffSlide, .svs, .tif, .scn, ...) |
''
|
tiles_urlpath |
str
|
path to a slide-tile manifest file (.tiles.csv) |
''
|
tile_size |
Optional[int]
|
size of tiles to use (at the requested magnification) |
None
|
filter_query |
str
|
pandas query by which to filter tiles based on their various tissue detection scores |
''
|
requested_magnification |
Optional[int]
|
Magnification scale at which to perform computation |
None
|
torch_model_repo_or_dir |
str
|
repository root name like (namespace/repo) at github.com to serve torch.hub models. Or path to a local model (e.g. msk-mind/luna-ml) |
'???'
|
model_name |
str
|
torch hub model name (a nn.Module at the repo repo_name) |
'???'
|
num_cores |
int
|
Number of cores to use for CPU parallelization |
4
|
batch_size |
int
|
size in batch dimension to chuck inference (8-256 recommended, depending on memory usage) |
8
|
output_urlpath |
str
|
output/working directory |
'.'
|
force |
bool
|
overwrite outputs if they exist |
False
|
kwargs |
dict
|
additional keywords to pass to model initialization |
{}
|
use_gpu |
bool
|
use GPU if available |
False
|
dask_options |
dict
|
options to pass to dask client |
{}
|
insecure |
bool
|
insecure SSL |
False
|
storage_options |
dict
|
storage options to pass to reading functions |
{}
|
output_storage_options |
dict
|
storage options to pass to writing functions |
{}
|
Returns:
Name | Type | Description |
---|---|---|
dict |
metadata |
Source code in src/luna/pathology/cli/infer_tile_labels.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|