chenjun2hao / DDRNet.pytorch

This is the unofficial code of Deep Dual-resolution Networks for Real-time and Accurate Semantic Segmentation of Road Scenes. which achieve state-of-the-art trade-off between accuracy and speed on cityscapes and camvid, without using inference acceleration and extra data
Other
157 stars 42 forks source link

UnboundLocalError on resume #30

Open visualDust opened 10 months ago

visualDust commented 10 months ago

UnboundLocalErrors occur on resume training. valid_loss and mean_IoU are obtained by code below:

in train.py:

if epoch % 10:
    valid_loss, mean_IoU, IoU_array = validate(config, testloader, model, writer_dict)

That means valid_loss and mean_IoU are calculated on each 10 steps. However, they are printed on each step. Therefore, if you make RESUME: true in configs, and your previous model was NOT on epochs that are multiples of 10, errors will occur:

UnboundLocalError: local variable 'valid_loss' referenced before assignment.
UnboundLocalError: local variable 'mean_IoU' referenced before assignment.
visualDust commented 10 months ago

I've added a few lines that simply run validate on resume to ensure variables are assigned in #31 Check if it is useful.

jixiuy commented 5 months ago

@visualDust Can you tell me what lines you added?

jixiuy commented 5 months ago

ok,I finded it from #31