-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall_acc_copy.py
73 lines (56 loc) · 2.17 KB
/
all_acc_copy.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
'''
2024.5.12: copy all the accuracy files
2024.5.27: copy all files except the last model weights
'''
import os
from os.path import join
from pathlib import Path
import shutil
def copy_txt():
citylist = ['Vaihingen', 'Zurich', 'uavid']
oldroot = '/localssd/yinxia/CRGNetdata/'
newroot = '/localssd/yinxia/CRGNetdata/copytxt'
for city in citylist:
oldpath = join(oldroot, city)
newpath = join(newroot, city)
# copy accuracy, loss, and predicted maps
filelist = [str(i) for i in Path(oldpath).rglob(f'*.txt')] + [str(i) for i in Path(oldpath).rglob(f'*events*')]
#filelist = filelist + [str(i) for i in Path(oldpath).rglob('*.png')]
print(len(filelist))
# 113
for file in filelist:
pstart = file.find(city)+len(city) # the start of Exp
value = file[pstart:]
newfile = newpath + value
# print(newfile)
rootdir = os.path.dirname(newfile)
# print(rootdir)
os.makedirs(rootdir, exist_ok=True)
# if not os.path.exists(newfile):
# shutil.copy(file, newfile)
shutil.copy(file, newfile)
def copy_png():
citylist = ['Vaihingen', 'Zurich', 'uavid']
oldroot = '/localssd/yinxia/CRGNetdata/'
newroot = '/localssd/yinxia/CRGNetdata/copypng'
for city in citylist:
oldpath = join(oldroot, city)
newpath = join(newroot, city)
# copy accuracy, loss, and predicted maps
# filelist = [str(i) for i in Path(oldpath).rglob(f'*.txt')] + [str(i) for i in Path(oldpath).rglob(f'*.DESKTOP-MN7FM45')]
filelist = [str(i) for i in Path(oldpath).rglob('*.png')]
print(len(filelist))
# 113
for file in filelist:
pstart = file.find(city)+len(city) # the start of Exp
value = file[pstart:]
newfile = newpath + value
# print(newfile)
rootdir = os.path.dirname(newfile)
# print(rootdir)
os.makedirs(rootdir, exist_ok=True)
if not os.path.exists(newfile):
shutil.copy(file, newfile)
if __name__=="__main__":
copy_txt()
copy_png()