forked from Arsey/keras-transfer-learning-for-oxford102
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
68 lines (42 loc) · 1.72 KB
/
config.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
from os.path import join as join_path
import os
abspath = os.path.dirname(os.path.abspath(__file__))
lock_file = os.path.join(abspath, 'lock')
data_dir = join_path(abspath, 'data/sorted')
trained_dir = join_path(abspath, 'trained')
train_dir, validation_dir = None, None
MODEL_VGG16 = 'vgg16'
MODEL_INCEPTION_V3 = 'inception_v3'
MODEL_RESNET50 = 'resnet50'
MODEL_RESNET152 = 'resnet152'
model = MODEL_RESNET50
bf_train_path = join_path(trained_dir, 'bottleneck_features_train.npy')
bf_valid_path = join_path(trained_dir, 'bottleneck_features_validation.npy')
top_model_weights_path = join_path(trained_dir, 'top-model-{}-weights.h5')
fine_tuned_weights_path = join_path(trained_dir, 'fine-tuned-{}-weights.h5')
model_path = join_path(trained_dir, 'model-{}.h5')
classes_path = join_path(trained_dir, 'classes-{}')
activations_path = join_path(trained_dir, 'activations.csv')
novelty_detection_model_path = join_path(trained_dir, 'novelty_detection-model-{}')
plots_dir = join_path(abspath, 'plots')
# server settings
server_address = ('0.0.0.0', 4224)
buffer_size = 4096
classes = []
nb_train_samples = 0
nb_validation_samples = 0
def set_paths():
global train_dir, validation_dir
train_dir = join_path(data_dir, 'train/')
validation_dir = join_path(data_dir, 'valid/')
set_paths()
def get_top_model_weights_path():
return top_model_weights_path.format(model)
def get_fine_tuned_weights_path(checkpoint=False):
return fine_tuned_weights_path.format(model + '-checkpoint' if checkpoint else model)
def get_novelty_detection_model_path():
return novelty_detection_model_path.format(model)
def get_model_path():
return model_path.format(model)
def get_classes_path():
return classes_path.format(model)