forked from abhishekrana/DeepFashion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
executable file
·124 lines (95 loc) · 3.49 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/python
### IMPORTS
from __future__ import print_function
import os
import numpy as np
import glob
import fnmatch
from random import randint
import shutil
import keras.optimizers
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential,Model
from keras.layers import Dropout, Flatten, Dense, Input
from keras.callbacks import ModelCheckpoint, CSVLogger, TensorBoard, EarlyStopping
from keras.optimizers import RMSprop, Adagrad
from keras.wrappers.scikit_learn import KerasClassifier
from keras import applications
from sklearn.utils import class_weight
from sklearn.model_selection import GridSearchCV
import PIL
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import skimage.data
import selectivesearch
import logging
import colored_traceback
colored_traceback.add_hook(always=True)
FORMAT = "[%(lineno)4s : %(funcName)-30s ] %(message)s"
#logging.basicConfig(level=logging.INFO, format=FORMAT)
logging.basicConfig(level=logging.DEBUG, format=FORMAT)
### GLOBALS
seed = 7
np.random.seed(seed)
dataset_path='dataset'
dataset_train_path=os.path.join(dataset_path, 'train')
dataset_val_path=os.path.join(dataset_path, 'validation')
dataset_test_path=os.path.join(dataset_path, 'test')
#dataset_src_path='fashion_data'
fashion_dataset_path='../Deep_Learning/DeepFashionV2/fashion_data/'
dataset_train_info=os.path.join(dataset_train_path, 'train_info.txt')
dataset_val_info=os.path.join(dataset_val_path, 'val_info.txt')
top_model_weights_path_save = 'output/bottleneck_fc_model.h5'
#top_model_weights_path_load = 'output/bottleneck_fc_model.h5'
top_model_weights_path_load = 'output/best-weights-011-1.3547.hdf5'
btl_path = 'bottleneck/'
btl_train_path = 'bottleneck/train/'
btl_val_path = 'bottleneck/validation/'
logs_path_name='logs'
output_path_name='output/'
prediction_dataset_path='dataset_prediction/images/'
img_width = 224 # For VGG16
img_height = 224 # For VGG16
img_channel = 3
epochs = 100
batch_size_train = 32
batch_size_predict = 32
predictions_class_weight=0.5
predictions_iou_weight=0.5
prediction_class_prob_threshold = 0.80
prediction_iou_threshold = 0.70
# prediction_class_prob_threshold = 0.50
# prediction_iou_threshold = 0.50
early_stopping_patience=500
input_image_width_threshold=500
input_image_height_threshold=500
# optimizer = ['SGD', 'RMSprop', 'Adagrad', 'Adadelta', 'Adam', 'Adamax', 'Nadam']
# learn_rates = [0.001, 0.01, 0.1, 0.2, 0.3]
# decays = [[0.0]]
# momentums = [0.0, 0.2, 0.4, 0.6, 0.8, 0.9]
# activations = ['softmax', 'softplus', 'softsign', 'relu', 'tanh', 'sigmoid', 'hard_sigmoid', 'linear']
# dropout_rates = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
# weight_constraint = [1, 2, 3, 4, 5]
# batch_sizes = [5, 10, 20]
# epochs_grid = [50, 100, 150]
# init_mode = ['uniform', 'lecun_uniform', 'normal', 'zero', 'glorot_normal', 'glorot_uniform', 'he_normal', 'he_uniform']
# neurons = [1, 5, 10, 15, 20, 25, 30]
#optimizer='Adagrad' # 70% Inception
#optimizer='Adam' # 44% Inception
#optimizer='RMSprop' # 70% Inception
#optimizer='Adadelta' # 65% Inception
#optimizer='Adamax' # 45% Inception
#optimizer='RMSprop' # 45% with 0.000001 lr
#optimizer='Adagrad' # Starts from 23%
#optimizer='Adadelta' # Straight line
#optimizer='Adam' # 30%
#optimizer='Adamax' # 31%
optimizer='SGD' # 42%; might go above 50
learn_rate=0.001
decay=0.0
momentum=0.0
activation='relu'
dropout_rate=0.5