Ambiguous-Medical-Image-Segmentation-using-Diffusion-Models
Ambiguous-Medical-Image-Segmentation-using-Diffusion-Models copied to clipboard
About train_util.py
During training, the while loop in the 'run_loop' function does not seem to terminate because self. lr_ annel_ Steps=0, not self. lr_ annel_ Steps are always true.
the code is below: segmentation_train.py def create_argparser(): defaults = dict( data_dir="./data/training", schedule_sampler="uniform", lr=1e-4, weight_decay=0.0, lr_anneal_steps=0, batch_size=1, microbatch=-1, # -1 disables microbatches ema_rate="0.9999", # comma-separated list of EMA values log_interval=100, save_interval=5000, resume_checkpoint='',#'"./results/pretrainedmodel.pt", use_fp16=False, fp16_scale_growth=1e-3, ) train_util.py class TrainLoop: def init( self, *, model, classifier, diffusion, data, dataloader, prior, posterior, batch_size, microbatch, lr, ema_rate, log_interval, save_interval, resume_checkpoint, use_fp16=False, fp16_scale_growth=1e-3, schedule_sampler=None, weight_decay=0.0, lr_anneal_steps=0, ):
def run_loop(self):
i = 0
totseg = 0
totcls = 0
totrec=0
data_iter = iter(self.dataloader)
while (
not self.lr_anneal_steps
or self.step + self.resume_step < self.lr_anneal_steps
):