Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
✨ Update Lung model parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhessey committed Oct 31, 2022
1 parent 33ae7c2 commit d58c721
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,7 @@ cifar-10-python.tar.gz

.amltconfig
amlt_job.yml

## VS Code

.vscode/launch.json
57 changes: 30 additions & 27 deletions InnerEye/ML/configs/segmentation/Lung.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,51 @@ class Lung(SegmentationModelBase):
def __init__(self, **kwargs: Any) -> None:
fg_classes = ["spinalcord", "lung_r", "lung_l", "heart", "esophagus"]
fg_display_names = ["SpinalCord", "Lung_R", "Lung_L", "Heart", "Esophagus"]

azure_dataset_id = kwargs.pop("azure_dataset_id", LUNG_AZURE_DATASET_ID)

super().__init__(
adam_betas=(0.9, 0.999),
architecture="UNet3D",
feature_channels=[32],
kernel_size=3,
azure_dataset_id=LUNG_AZURE_DATASET_ID,
crop_size=(64, 224, 224),
test_crop_size=(128, 512, 512),
image_channels=["ct"],
ground_truth_ids=fg_classes,
ground_truth_ids_display_names=fg_display_names,
azure_dataset_id=azure_dataset_id,
check_exclusive=False,
class_weights=equally_weighted_classes(fg_classes, background_weight=0.02),
colours=[(255, 255, 255)] * len(fg_classes),
crop_size=(64, 256, 256),
feature_channels=[32],
fill_holes=[False] * len(fg_classes),
roi_interpreted_types=["ORGAN"] * len(fg_classes),
largest_connected_component_foreground_classes=["lung_r", "lung_l", "heart"],
num_dataload_workers=2,
norm_method=PhotometricNormalizationMethod.CtWindow,
level=40,
window=400,
class_weights=equally_weighted_classes(fg_classes, background_weight=0.02),
train_batch_size=8,
ground_truth_ids_display_names=fg_display_names,
ground_truth_ids=fg_classes,
image_channels=["ct"],
inference_batch_size=1,
inference_stride_size=(64, 256, 256),
num_epochs=140,
kernel_size=3,
l_rate_polynomial_gamma=0.9,
l_rate=1e-3,
largest_connected_component_foreground_classes=["lung_l", "lung_r", "heart"],
level=-500,
loss_type=SegmentationLoss.SoftDice,
min_l_rate=1e-5,
l_rate_polynomial_gamma=0.9,
optimizer_type=OptimizerType.Adam,
opt_eps=1e-4,
adam_betas=(0.9, 0.999),
momentum=0.9,
weight_decay=1e-4,
monitoring_interval_seconds=0,
norm_method=PhotometricNormalizationMethod.CtWindow,
num_dataload_workers=10,
num_epochs=300,
opt_eps=1e-4,
optimizer_type=OptimizerType.Adam,
roi_interpreted_types=["ORGAN"] * len(fg_classes),
test_crop_size=(128, 512, 512),
train_batch_size=10,
use_mixed_precision=True,
use_model_parallel=True,
monitoring_interval_seconds=0,
loss_type=SegmentationLoss.SoftDice,
check_exclusive=False,
weight_decay=1e-4,
window=2200,
)
self.add_and_validate(kwargs)


def get_model_train_test_dataset_splits(self, dataset_df: pd.DataFrame) -> DatasetSplits:
# The first 24 subject IDs are the designated test subjects in this dataset.
test = list(map(str, range(0, 24)))
test = list(map(str, range(0, 9)))
train_val = list(dataset_df[~dataset_df.subject.isin(test)].subject.unique())

val = list(map(str, numpy.random.choice(train_val, int(len(train_val) * 0.1), replace=False)))
Expand Down

0 comments on commit d58c721

Please sign in to comment.