Skip to content

Commit

Permalink
fix brats3d bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BaiduIHU committed Feb 11, 2023
1 parent 801cd88 commit cfdb328
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions guided_diffusion/gaussian_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,18 +571,7 @@ def p_sample_loop_known(
progress=progress,
):
final = sample
i += 1
'''vis each step sample'''
if i % 5 == 0:

o1 = th.tensor(img)[:,0,:,:].unsqueeze(1)
o2 = th.tensor(img)[:,1,:,:].unsqueeze(1)
o3 = th.tensor(img)[:,2,:,:].unsqueeze(1)
o4 = th.tensor(img)[:,3,:,:].unsqueeze(1)
s = th.tensor(final["sample"])[:,-1,:,:].unsqueeze(1)
tup = (o1/o1.max(),o2/o2.max(),o3/o3.max(),o4/o4.max(),s)
compose = th.cat(tup,0)
vutils.save_image(compose, fp = os.path.join('/home/users/wujunde/medsegdif/res_temp_norm_3000_100', name+str(i)+".jpg"), nrow = 1, padding = 10)


if dice_score(final["sample"][:,-1,:,:].unsqueeze(1), final["cal"]) < 0.65:
cal_out = torch.clamp(final["cal"] + 0.25 * final["sample"][:,-1,:,:].unsqueeze(1), 0, 1)
Expand Down

0 comments on commit cfdb328

Please sign in to comment.