|
@@ -22,7 +22,7 @@ from keras import regularizers
|
22
|
22
|
from keras.callbacks import EarlyStopping
|
23
|
23
|
|
24
|
24
|
epochs= 330
|
25
|
|
-early_stopping = EarlyStopping(monitor='accuracy', patience=5, verbose=2)
|
|
25
|
+early_stopping = EarlyStopping(monitor='accuracy', patience=30, verbose=2)
|
26
|
26
|
|
27
|
27
|
|
28
|
28
|
def curce_data(x,y,y_pred):
|
|
@@ -102,9 +102,11 @@ def demo_1(file, model_file):
|
102
|
102
|
# our final FC layer head will have two dense layers, the final one
|
103
|
103
|
# being our regression head
|
104
|
104
|
x = Dense(128, activation="relu", kernel_regularizer=regularizers.l1(0.003))(cnn_0.input)
|
105
|
|
- x = Dropout(0.2)(x)
|
106
|
|
- x = Dense(128, activation="relu")(x)
|
107
|
|
- x = Dense(256, activation="relu")(x)
|
|
105
|
+ x = Dropout(0.1)(x)
|
|
106
|
+ x = Dense(56, activation="relu")(x)
|
|
107
|
+ x = Dense(56, activation="relu")(x)
|
|
108
|
+ x = Dense(56, activation="relu")(x)
|
|
109
|
+ x = Dense(56, activation="relu")(x)
|
108
|
110
|
x = Flatten()(x)
|
109
|
111
|
# 在建设一层
|
110
|
112
|
x = Dense(2, activation="sigmoid")(x)
|
|
@@ -129,7 +131,7 @@ def demo_1(file, model_file):
|
129
|
131
|
print("[INFO] training model...")
|
130
|
132
|
model.fit(
|
131
|
133
|
[train_x_a], Ytrain,
|
132
|
|
- # validation_data=([testAttrX, testImagesX], testY),
|
|
134
|
+ validation_data=([test_x_a], Ytest),
|
133
|
135
|
# epochs=int(3*train_x_a.shape[0]/1300),
|
134
|
136
|
epochs=epochs,
|
135
|
137
|
batch_size=1024, shuffle=True,
|
|
@@ -143,11 +145,11 @@ def demo_1(file, model_file):
|
143
|
145
|
|
144
|
146
|
|
145
|
147
|
windows = 5
|
146
|
|
-x_lenth = 15
|
|
148
|
+x_lenth = 19
|
147
|
149
|
|
148
|
150
|
if __name__ == '__main__':
|
149
|
151
|
root_dir = 'D:\\data\\quantization\\jqxx2\\'
|
150
|
152
|
model_dir = 'D:\\data\\quantization\\jqxx2_svm_model\\'
|
151
|
|
- m = '000004.SH.log' # 12
|
|
153
|
+ m = '000007.SH.log' # 12
|
152
|
154
|
demo_1(root_dir + m, model_dir + str(m)[:6] + '.pkl')
|
153
|
155
|
|