Multi class segmentation of prostate images #1402
Unanswered
Muhammad-Raza156
asked this question in
Q&A
Replies: 3 comments 8 replies
-
hi, @Nic-Ma would be thankful |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @yiheng-wang-nv , Could you please help take a look at this question? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @Muhammad-Raza156 , I'm curious about what is the performance on the training set?
|
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi , i am segmenting prostate mri images , my dataset consists of 120 training and 20 validation samples with each image having different size. It genrates poor results some times infinite also I am unable to resolve this i have already searched for similar discussions
this is my transformation code
class ConvertToMultiChannelBasedOnPancreaClassesd(MapTransform):
"""
Convert labels to multi channels:
label 0 is Background
label 1 is CZ(Central Zone)
label 2 is PZ(Peripheral Zone)
"""
train_transforms = Compose(
)
val_transforms = Compose(
)
This is my rest of the code
model= build_unet().to(device)
loss_function = DiceLoss(squared_pred=True, to_onehot_y=False, sigmoid=True)
optimizer= torch.optim.Adam(model.parameters(), lr=0.001)
dice_metric = DiceMetric(include_background=True, reduction="mean")
dice_metric_batch = DiceMetric(include_background=True, reduction="mean_batch")
hd95_metric = HausdorffDistanceMetric(include_background=True, percentile=95, reduction="mean")
hd95_metric_batch = HausdorffDistanceMetric(include_background=True, percentile=95, reduction="mean_batch")
sd_metric = SurfaceDistanceMetric(include_background=True, symmetric=True, reduction="mean")
sd_metric_batch = SurfaceDistanceMetric(include_background=True, symmetric=True, reduction="mean_batch")
post_trans = Compose(
[EnsureType(), Activations(sigmoid=True), AsDiscrete(threshod=0.5)]
)
max_epochs = 40
val_interval = 2
best_metric = -1
best_metric_epoch = -1
epoch_loss_values = []
cor_hd=0
cor_asd=0
metric_values = []
metric_values_CZ = []
metric_values_PZ = []
hd_metric_values = []
hd_metric_values_CZ = []
hd_metric_values_PZ = []
ssd_metric_values = []
ssd_metric_values_CZ = []
ssd_metric_values_PZ = []
for epoch in range(max_epochs):
print("-" * 10)
print(f"epoch {epoch + 1}/{max_epochs}")
model.train()
epoch_loss = 0
step = 0
for batch_data in train_loader:
step += 1
inputs, labels = (
batch_data["image"].to(device),
batch_data["label"].to(device),
)
optimizer.zero_grad()
with autocast():
outputs = model(inputs)
loss = loss_function(outputs, labels)
Beta Was this translation helpful? Give feedback.
All reactions