Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 2d_classification/mednist_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"from monai.apps import download_and_extract\n",
"from monai.config import print_config\n",
"from monai.metrics import compute_roc_auc\n",
"from monai.networks.nets import densenet121\n",
"from monai.networks.nets import DenseNet121\n",
"from monai.transforms import (\n",
" AddChannel,\n",
" Compose,\n",
Expand Down Expand Up @@ -423,7 +423,7 @@
"outputs": [],
"source": [
"device = torch.device(\"cuda:0\")\n",
"model = densenet121(spatial_dims=2, in_channels=1,\n",
"model = DenseNet121(spatial_dims=2, in_channels=1,\n",
" out_channels=num_class).to(device)\n",
"loss_function = torch.nn.CrossEntropyLoss()\n",
"optimizer = torch.optim.Adam(model.parameters(), 1e-5)\n",
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/ignite/densenet_evaluation_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def main():
val_ds = ImageDataset(image_files=images, labels=labels, transform=val_transforms, image_only=False)
# create DenseNet121
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
net = monai.networks.nets.densenet.densenet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
net = monai.networks.nets.DenseNet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)

metric_name = "Accuracy"
# add evaluation metric to the evaluator engine
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/ignite/densenet_evaluation_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def main():

# create DenseNet121
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
net = monai.networks.nets.densenet.densenet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
net = monai.networks.nets.DenseNet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)

def prepare_batch(batch, device=None, non_blocking=False):
return _prepare_batch((batch["img"], batch["label"]), device, non_blocking)
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/ignite/densenet_training_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def main():

# create DenseNet121, CrossEntropyLoss and Adam optimizer
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
net = monai.networks.nets.densenet.densenet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
net = monai.networks.nets.DenseNet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
loss = torch.nn.CrossEntropyLoss()
lr = 1e-5
opt = torch.optim.Adam(net.parameters(), lr)
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/ignite/densenet_training_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def main():

# create DenseNet121, CrossEntropyLoss and Adam optimizer
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
net = monai.networks.nets.densenet.densenet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
net = monai.networks.nets.DenseNet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
loss = torch.nn.CrossEntropyLoss()
lr = 1e-5
opt = torch.optim.Adam(net.parameters(), lr)
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/torch/densenet_evaluation_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def main():

# Create DenseNet121
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = monai.networks.nets.densenet.densenet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
model = monai.networks.nets.DenseNet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)

model.load_state_dict(torch.load("best_metric_model_classification3d_array.pth"))
model.eval()
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/torch/densenet_evaluation_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def main():

# Create DenseNet121
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = monai.networks.nets.densenet.densenet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
model = monai.networks.nets.DenseNet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)

model.load_state_dict(torch.load("best_metric_model_classification3d_dict.pth"))
model.eval()
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/torch/densenet_training_array.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
"\n",
"# Create DenseNet121, CrossEntropyLoss and Adam optimizer\n",
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
"model = monai.networks.nets.densenet.densenet121(\n",
"model = monai.networks.nets.DenseNet121(\n",
" spatial_dims=3, in_channels=1, out_channels=2).to(device)\n",
"loss_function = torch.nn.CrossEntropyLoss()\n",
"optimizer = torch.optim.Adam(model.parameters(), 1e-5)\n",
Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/torch/densenet_training_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def main():

# Create DenseNet121, CrossEntropyLoss and Adam optimizer
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = monai.networks.nets.densenet.densenet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
model = monai.networks.nets.DenseNet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
loss_function = torch.nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), 1e-5)

Expand Down
2 changes: 1 addition & 1 deletion 3d_classification/torch/densenet_training_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def main():

# Create DenseNet121, CrossEntropyLoss and Adam optimizer
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = monai.networks.nets.densenet.densenet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
model = monai.networks.nets.DenseNet121(spatial_dims=3, in_channels=1, out_channels=2).to(device)
loss_function = torch.nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), 1e-5)

Expand Down
4 changes: 2 additions & 2 deletions modules/interpretability/class_lung_lesion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
},
"outputs": [],
"source": [
"model = monai.networks.nets.densenet.densenet121(\n",
"model = monai.networks.nets.DenseNet121(\n",
" spatial_dims=3, in_channels=1, out_channels=2\n",
").to(device)\n",
"bce = torch.nn.BCEWithLogitsLoss()\n",
Expand Down Expand Up @@ -494,7 +494,7 @@
],
"source": [
"# Reload the best network and display info\n",
"model_3d = monai.networks.nets.densenet.densenet121(\n",
"model_3d = monai.networks.nets.DenseNet121(\n",
" spatial_dims=3, in_channels=1, out_channels=2\n",
").to(device)\n",
"model_3d.load_state_dict(\n",
Expand Down
4 changes: 2 additions & 2 deletions modules/interpretability/covid_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"\n",
"import monai\n",
"from monai.networks.utils import eval_mode\n",
"from monai.networks.nets import densenet121\n",
"from monai.networks.nets import DenseNet121\n",
"from monai.transforms import (\n",
" Compose, LoadImage, Lambda, AddChannel,\n",
" ScaleIntensity, ToTensor, RandRotate,\n",
Expand Down Expand Up @@ -301,7 +301,7 @@
"outputs": [],
"source": [
"def create_new_net():\n",
" return densenet121(\n",
" return DenseNet121(\n",
" spatial_dims=2,\n",
" in_channels=1,\n",
" out_channels=num_class\n",
Expand Down
4 changes: 2 additions & 2 deletions modules/layer_wise_learning_rate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
" ToTensord,\n",
")\n",
"from monai.optimizers import generate_param_groups\n",
"from monai.networks.nets import densenet121\n",
"from monai.networks.nets import DenseNet121\n",
"from monai.inferers import SimpleInferer\n",
"from monai.handlers import StatsHandler\n",
"from monai.engines import SupervisedTrainer\n",
Expand Down Expand Up @@ -304,7 +304,7 @@
"outputs": [],
"source": [
"device = torch.device(\"cuda:0\")\n",
"net = densenet121(pretrained=True, progress=False,\n",
"net = DenseNet121(pretrained=True, progress=False,\n",
" spatial_dims=2, in_channels=1, out_channels=6).to(device)\n",
"loss = torch.nn.CrossEntropyLoss()"
]
Expand Down
4 changes: 2 additions & 2 deletions modules/public_datasets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
" Spacingd,\n",
" ToTensord,\n",
")\n",
"from monai.networks.nets import UNet, densenet121\n",
"from monai.networks.nets import UNet, DenseNet121\n",
"from monai.networks.layers import Norm\n",
"from monai.losses import DiceLoss\n",
"from monai.inferers import SimpleInferer\n",
Expand Down Expand Up @@ -316,7 +316,7 @@
"outputs": [],
"source": [
"device = torch.device(\"cuda:0\")\n",
"net = densenet121(spatial_dims=2, in_channels=1, out_channels=6).to(device)\n",
"net = DenseNet121(spatial_dims=2, in_channels=1, out_channels=6).to(device)\n",
"loss = torch.nn.CrossEntropyLoss()\n",
"opt = torch.optim.Adam(net.parameters(), 1e-5)"
]
Expand Down