zhengchen1999 / DAT

PyTorch code for our ICCV 2023 paper "Dual Aggregation Transformer for Image Super-Resolution"
Apache License 2.0
350 stars 27 forks source link

UnboundLocalError: local variable 'idx' referenced before assignment #41

Open buhuiya opened 2 months ago

buhuiya commented 2 months ago

Traceback (most recent call last): File "basicsr/train.py", line 218, in train_pipeline(root_path) File "basicsr/train.py", line 194, in train_pipeline model.validation(val_loader, current_iter, tb_logger, opt['val']['save_img']) File "/home/cnu105/WJQ/code/DAT/DAT-main/basicsr/models/base_model.py", line 48, in validation self.nondist_validation(dataloader, current_iter, tb_logger, save_img) File "/home/cnu105/WJQ/code/DAT/DAT-main/basicsr/models/sr_model.py", line 197, in nondist_validation self.metric_results[metric] /= (idx + 1) UnboundLocalError: local variable 'idx' referenced before assignment

zhengchen1999 commented 2 months ago

This issue might be due to having no validation data while still needing to calculate metrics. You could either remove the part that calculates metrics from the yml file or check the path to your validation data to make sure it's not empty.