Skip to content

Commit afb3b46

Browse files
author
tuttyfrutyee
committed
rename variables to be same with the paper
1 parent 32e3d74 commit afb3b46

File tree

3 files changed

+178
-170
lines changed

3 files changed

+178
-170
lines changed

README.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,21 @@ where .mat files has shape of (#images, width, height) and image values are betw
4444
## Train
4545

4646
<br />
47+
4748
```
4849
python3 train.py --image_size 256 --exp exp_syndiff --num_channels 2 --num_channels_dae 64 --ch_mult 1 1 2 2 4 4 --num_timesteps 4 --num_res_blocks 2 --batch_size 1 --contrast1 T1 --contrast2 T2 --num_epoch 500 --ngf 64 --embedding_type positional --use_ema --ema_decay 0.999 --r1_gamma 1. --z_emb_dim 256 --lr_d 1e-4 --lr_g 1.6e-4 --lazy_reg 10 --num_process_per_node 1 --save_content --local_rank 0 --input_path /input/path/for/data --output_path /output/for/results
4950
```
50-
<br />
51-
<br />
5251

52+
<br />
5353

5454
## Test
5555

5656
<br />
57+
5758
```
5859
python test.py --image_size 256 --exp exp_syndiff --num_channels 2 --num_channels_dae 64 --ch_mult 1 1 2 2 4 4 --num_timesteps 4 --num_res_blocks 2 --batch_size 1 --embedding_type positional --z_emb_dim 256 --contrast1 T1 --contrast2 T2 --which_epoch 50 --gpu_chose 0 --input_path /input/path/for/data --output_path /output/for/results
5960
```
61+
6062
<br />
6163
<br />
6264

@@ -74,4 +76,10 @@ You are encouraged to modify/distribute this code. However, please acknowledge t
7476
```
7577
For any questions, comments and contributions, please contact Muzaffer Özbey (muzafferozbey94[at]gmail.com ) <br />
7678

77-
(c) ICON Lab 2022
79+
(c) ICON Lab 2022
80+
81+
<br />
82+
83+
# Acknowledgements
84+
85+
This code uses libraries from the StyleGAN-2 (https://github.com/NVlabs/stylegan2) and DD-GAN (https://github.com/NVlabs/denoising-diffusion-gan) repositories.

test.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,16 @@ def sample_and_test(args):
162162
shuffle=False,
163163
num_workers=4)
164164
#Initializing and loading network
165-
netG1 = NCSNpp(args).to(device)
166-
netG2 = NCSNpp(args).to(device)
165+
gen_diffusive_1 = NCSNpp(args).to(device)
166+
gen_diffusive_2 = NCSNpp(args).to(device)
167167

168168
exp = args.exp
169169
output_dir = args.output_path
170170
exp_path = os.path.join(output_dir,exp)
171171

172172
checkpoint_file = exp_path + "/{}_{}.pth"
173-
load_checkpoint(checkpoint_file, netG1,'netG1',epoch=str(epoch_chosen), device = device)
174-
load_checkpoint(checkpoint_file, netG2,'netG2',epoch=str(epoch_chosen), device = device)
173+
load_checkpoint(checkpoint_file, gen_diffusive_1,'gen_diffusive_1',epoch=str(epoch_chosen), device = device)
174+
load_checkpoint(checkpoint_file, gen_diffusive_2,'gen_diffusive_2',epoch=str(epoch_chosen), device = device)
175175

176176

177177
T = get_time_schedule(args, device)
@@ -194,7 +194,7 @@ def sample_and_test(args):
194194

195195
x1_t = torch.cat((torch.randn_like(real_data),source_data),axis=1)
196196
#diffusion steps
197-
fake_sample1 = sample_from_model(pos_coeff, netG1, args.num_timesteps, x1_t, T, args)
197+
fake_sample1 = sample_from_model(pos_coeff, gen_diffusive_1, args.num_timesteps, x1_t, T, args)
198198

199199
fake_sample1 = to_range_0_1(fake_sample1) ; fake_sample1 = fake_sample1/fake_sample1.max()
200200
real_data = to_range_0_1(real_data) ; real_data = real_data/real_data.max()
@@ -218,7 +218,7 @@ def sample_and_test(args):
218218

219219
x2_t = torch.cat((torch.randn_like(real_data),source_data),axis=1)
220220
#diffusion steps
221-
fake_sample2 = sample_from_model(pos_coeff, netG2, args.num_timesteps, x2_t, T, args)
221+
fake_sample2 = sample_from_model(pos_coeff, gen_diffusive_2, args.num_timesteps, x2_t, T, args)
222222

223223

224224
fake_sample2 = to_range_0_1(fake_sample2) ; fake_sample2 = fake_sample2/fake_sample2.max()

0 commit comments

Comments
 (0)