Skip to content

Commit

Permalink
Cache the get_volume call from Serie.
Browse files Browse the repository at this point in the history
Avoid repeat processing.
  • Loading branch information
jsilter committed Jul 26, 2024
1 parent a8c4369 commit 0d85c12
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 0 additions & 2 deletions sybil/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ def _calibrate(self, scores: np.ndarray) -> np.ndarray:
Parameters
----------
calibrator: Optional[dict]
Dictionary of sklearn.calibration.CalibratedClassifierCV for each year, otherwise None.
scores: np.ndarray
risk scores as numpy array
Expand Down
2 changes: 2 additions & 0 deletions sybil/serie.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import functools
from typing import List, Optional, NamedTuple, Literal
from argparse import Namespace

Expand Down Expand Up @@ -137,6 +138,7 @@ def get_raw_images(self) -> List[np.ndarray]:
images = [i["input"] for i in input_dicts]
return images

@functools.cache
def get_volume(self) -> torch.Tensor:
"""
Load loaded 3D CT volume
Expand Down

0 comments on commit 0d85c12

Please sign in to comment.