cosmic-cortex / pytorch-UNet

2D and 3D UNet implementation in PyTorch.
MIT License
147 stars 40 forks source link

UnboundLocalError when training without validation set #15

Open JFHoelscher opened 3 years ago

JFHoelscher commented 3 years ago

File ".../unet/model.py", line 212, in fit_dataset **val_logs, **train_logs} UnboundLocalError: local variable 'val_logs' referenced before assignment

The val_dataset argument to fit_dataset is optional. However, if none is provided, val_logs is not assigned. Anyway it is referenced, leading to this error.

Suggested fix: Add val_logs = {} to the else clause of if val_dataset is not None: in fit_dataset