Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Error #1

Open
omariosc opened this issue Jun 24, 2024 · 0 comments
Open

Import Error #1

omariosc opened this issue Jun 24, 2024 · 0 comments

Comments

@omariosc
Copy link

omariosc commented Jun 24, 2024

Missing line from 02_monai_components.ipynb.

from monai.data import CacheDataset

Full cell:

from monai.networks.nets import UNet
from monai.losses import DiceLoss
from monai.engines import SupervisedTrainer
from monai.data import CacheDataset # Missing line

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
network = UNet(3,1,3,[8,16,32],[2,2,2]).to(device)
loss = DiceLoss(softmax=True,to_onehot_y=True)

ds = CacheDataset(filenames, transform=trans) # Does not run
dl = DataLoader(ds,batch_size=6, num_workers=8)

trainer=SupervisedTrainer(
    device=device,
    max_epochs=4,
    train_data_loader=dl,
    network=network,
    optimizer=torch.optim.Adam(network.parameters()),
    loss_function=loss
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant