-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathallrun_uavid_testacc.py
37 lines (34 loc) · 1.32 KB
/
allrun_uavid_testacc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'''
2024.5.14: test uavid dataset
'''
import os
from pathlib import Path
from glob import glob
SAVE_WEIGHT_PATH = '/localssd/yinxia/CRGNetdata/'
if __name__=="__main__":
city = 'uavid'
#############################
# backbonelist = ['effiSAM', ]
backbonelist = ['effiSAM', 'unetformer', 'FCNcls']
# suffix = '_nocrf'
suffix = '_wcrf'
for backbone in backbonelist:
# directly find the 5000.pth
respath = f'{SAVE_WEIGHT_PATH}/{city}/{backbone}/'
# print(respath)
weightlist1 = Path(f'{SAVE_WEIGHT_PATH}/{city}/{backbone}/').rglob('*batch5000*.pth')
weightlist2 = Path(f'{SAVE_WEIGHT_PATH}/{city}/{backbone}/').rglob('*batch5001*.pth')
weightlist = [i for i in weightlist1] + [i for i in weightlist2]
print(len(weightlist))
# process each
for file in weightlist:
dirpath = str(file.parent)
savetxtfile = glob(os.path.join(dirpath, 'Test*.txt'))
if len(savetxtfile)!=0:
continue
print('process: %s'%dirpath)
dirpath2 = os.path.basename(dirpath)
method =dirpath2.split('_')[0]
os.system(
f"python all_test_acc{suffix}.py --city {city} --backbone {backbone} --method {method} "
f"--restore_path {dirpath} --restore_iter 5000")