-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreset.py
36 lines (27 loc) · 1.07 KB
/
reset.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
import yaml
import shutil
import os
source_file_path = 'init.yaml'
server_dest_file_path = f'server/config/train.yaml'
client1_dest_file_path = f'client1/config/train.yaml'
client2_dest_file_path = f'client2/config/train.yaml'
# Overwrite the config file to init
with open(source_file_path, 'r') as file:
source_data = yaml.safe_load(file)
source_data['names'] = source_data['names']
source_data['nc'] = source_data['nc']
source_data['test'] = source_data['test']
source_data['train'] = source_data['train']
source_data['val'] = source_data['val']
with open(server_dest_file_path, 'w') as file:
yaml.safe_dump(source_data, file, default_flow_style=False)
with open(client1_dest_file_path, 'w') as file:
yaml.safe_dump(source_data, file, default_flow_style=False)
with open(client2_dest_file_path, 'w') as file:
yaml.safe_dump(source_data, file, default_flow_style=False)
shutil.rmtree('runs/')
# Remove the labels.cache files
for root, dirs, files in os.walk('.'):
for file in files:
if file == 'labels.cache':
os.remove(os.path.join(root, file))