@ -25,7 +25,7 @@ class ValOptions():
self . parser = argparse . ArgumentParser ( formatter_class = argparse . ArgumentDefaultsHelpFormatter )
self . parser . add_argument ( ' --model_path ' , type = str , default = " ../models/last.pth " , help = " Model path. " )
self . parser . add_argument ( ' --datasets_dir ' , type = str , default = " ../data/ " , help = " Path to datasets. " )
self . parser . add_argument ( ' -- val _datasets' , type = str , default = ' Set5,Set14 ' , help = " Names of validation datasets." )
self . parser . add_argument ( ' -- test _datasets' , type = str , default = ' Set5,Set14 ' , help = " Names of test datasets." )
self . parser . add_argument ( ' --save_predictions ' , action = ' store_true ' , default = True , help = ' Save model predictions to exp_dir/val/dataset_name ' )
self . parser . add_argument ( ' --device ' , type = str , default = ' cuda ' , help = ' Device of the model ' )
self . parser . add_argument ( ' --color_model ' , type = str , default = " RGB " , help = " Color model for train and test dataset. " )
@ -33,7 +33,7 @@ class ValOptions():
def parse_args ( self ) :
args = self . parser . parse_args ( )
args . datasets_dir = Path ( args . datasets_dir ) . resolve ( )
args . val_datasets = args . val _datasets. split ( ' , ' )
args . test_datasets = args . test _datasets. split ( ' , ' )
args . exp_dir = Path ( args . model_path ) . resolve ( ) . parent . parent
args . model_path = Path ( args . model_path ) . resolve ( )
args . model_name = args . model_path . stem
@ -79,7 +79,7 @@ if __name__ == "__main__":
print ( model )
test_datasets = { }
for test_dataset_name in config . val _datasets:
for test_dataset_name in config . test _datasets:
test_datasets [ test_dataset_name ] = SRTestDataset (
hr_dir_path = Path ( config . datasets_dir ) / test_dataset_name / " HR " ,
lr_dir_path = Path ( config . datasets_dir ) / test_dataset_name / " LR " / f " X { model . scale } " ,
@ -89,7 +89,8 @@ if __name__ == "__main__":
results = valid_steps ( model = model , datasets = test_datasets , config = config , log_prefix = f " Model { config . model_name } " )
results . to_csv ( config . results_path )
print ( config . exp_dir . stem , config . model_name )
print ( )
print ( f " experiment dir: { config . exp_dir . stem } , model: { config . model_name } , test color model: { config . color_model } " )
print ( results )
print ( )
print ( f " Results saved to { config . results_path } " )