refactor(test_IVF): 重构测试代码以提高灵活性和可维护性
- 引入变量 pth_path 以动态构建模型权重路径 - 使用 pth_path替代直接使用时间戳创建输出文件夹 - 优化代码结构,提高可读性和可维护性
This commit is contained in:
parent
6738c9057d
commit
f87a65e68e
@ -17,14 +17,16 @@ current_time = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
|||||||
|
|
||||||
|
|
||||||
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
||||||
ckpt_path= r"/home/star/whaiDir/PFCFuse/models/whaiFusion11-15-17-48.pth"
|
pth_path = "whaiFusion11-15-17-48"
|
||||||
|
ckpt_path= r"/home/star/whaiDir/PFCFuse/models/"+pth_path+".pth"
|
||||||
|
print("path_pth:{}".format(ckpt_path))
|
||||||
|
|
||||||
for dataset_name in ["sar"]:
|
for dataset_name in ["sar"]:
|
||||||
print("\n"*2+"="*80)
|
print("\n"*2+"="*80)
|
||||||
model_name="PFCFuse 最基本版本 "
|
model_name="PFCFuse 最基本版本 "
|
||||||
print("The test result of "+dataset_name+' :')
|
print("The test result of "+dataset_name+' :')
|
||||||
test_folder = os.path.join('test_img', dataset_name)
|
test_folder = os.path.join('test_img', dataset_name)
|
||||||
test_out_folder=os.path.join('test_result',current_time,dataset_name)
|
test_out_folder=os.path.join('test_result',pth_path,dataset_name)
|
||||||
|
|
||||||
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
||||||
Encoder = nn.DataParallel(Restormer_Encoder()).to(device)
|
Encoder = nn.DataParallel(Restormer_Encoder()).to(device)
|
||||||
|
Loading…
Reference in New Issue
Block a user