Skip to content
Merged
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
3 changes: 2 additions & 1 deletion reconstruction/MRI_reconstruction/varnet_demo/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def trainer(args):

final_shape = target.shape[-2:]
max_value = torch.tensor(max_value).unsqueeze(0).to(device)
loss_function.ssim_metric.data_range = max_value

# iterate through all slices
slice_dim = 1 # change this if another dimension is your slice dimension
Expand All @@ -183,7 +184,7 @@ def trainer(args):
cropper = SpatialCrop(roi_center=roi_center, roi_size=final_shape)
output_crp = cropper(output).unsqueeze(0)

loss = loss_function(output_crp, tar, max_value)
loss = loss_function(output_crp, tar)

loss.backward()
optimizer.step()
Expand Down