Skip to content

UNet does not work for my own data #1630

Answered by rijobro
Cpresident asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, the problem is the depth of your image being just 8. This doesn't allow for the number of convolutions you have requested.

With a bigger image it works fine:

import torch
from monai.networks.nets import UNet
device = torch.device("cuda:0")
model = UNet(
    dimensions=3,
    in_channels=2,
    out_channels=11,
    channels=(16, 32, 64, 128, 256),
    strides=(2, 2, 2, 2),
    num_res_units=2,
).to(device)
model(torch.rand((2,2,400,400,16), device=device))

Or with a smaller network, your original image works fine, too:

import torch
from monai.networks.nets import UNet
device = torch.device("cuda:0")
model = UNet(
    dimensions=3,
    in_channels=2,
    out_channels=11,
    channels=(16, 

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@Cpresident
Comment options

@Cpresident
Comment options

Answer selected by Cpresident
Comment options

You must be logged in to vote
2 replies
@rijobro
Comment options

@Vivekrpg
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants