-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathcopy_xml_fields_testing.py
58 lines (45 loc) · 1.58 KB
/
copy_xml_fields_testing.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
# -*- coding: utf-8 -*-
"""
Copyright (c) 2018 Image Processing Research Group of University Federico II of Naples ('GRIP-UNINA').
All rights reserved. This work should only be used for nonprofit purposes.
"""
"""
save all parameters loaded from .xml file in dictionaries:
save some parameters in variables to get suitable in next steps
-test_setting: parameters for testing phase
-path: input and output path
-fine_tuning_setting: parameters for fine tuning phase
"""
from copy import deepcopy
test_setting=model['test_setting']
path=model['path']
fine_tuning_setting=test_setting['fine_tuning_setting']
testset_path=path['testset_path']
test_dir_out=path['test_dir_out']
model_path=path['pretrained_model']
sensor = test_setting['sensor']
mode=test_setting['mode']
epochs=fine_tuning_setting['epochs']
ftnetwork_dir_out=path['ftnetwork_dir_out']
if test_setting.has_key('area'):
area=test_setting['area']
PNN_model=deepcopy(sio.loadmat(model_path,squeeze_me=True))
residual = PNN_model['residual']
pretrained_lr=PNN_model['lr']
cost=PNN_model['cost']
regol=PNN_model['regol']
if PNN_model.has_key('net_scope'):
net_scope=PNN_model['net_scope']
else:
layers=[PNN_model['layers'][i] for i in xrange(0,len(PNN_model['layers']),2)]
net_scope=0
for lay in layers:
net_scope+=lay.shape[2]-1
net_scope=net_scope+1
PNN_model['net_scope']=net_scope
if PNN_model.has_key('patch_size') :
patch_size=PNN_model['patch_size']
else:
patch_size=PNN_model['block_size']
del PNN_model['block_size']
PNN_model['patch_size']=patch_size