added dense-relu/softmax layers to segment output

master
Malar Kannan 2017-12-11 12:30:08 +05:30
parent 52bbb69c65
commit d387922f7d
1 changed files with 9 additions and 5 deletions

View File

@ -54,12 +54,16 @@ def segment_model(input_dim):
return Model(inp, oup)
def simple_segment_model(input_dim):
# input_dim = (1000,300)
inp = Input(shape=input_dim)
b_gr1 = Bidirectional(GRU(256, return_sequences=True),merge_mode='sum')(inp)
# b_gr1
b_gr2 = Bidirectional(GRU(64, return_sequences=True),merge_mode='sum')(b_gr1)
b_gr3 = Bidirectional(GRU(1, return_sequences=True),merge_mode='sum')(b_gr2)
oup = Reshape(target_shape=(input_dim[0],))(b_gr3)
# b_gr2 = Bidirectional(GRU(64, return_sequences=True),merge_mode='sum')(b_gr1)
b_gr3 = Bidirectional(GRU(64, return_sequences=True),merge_mode='sum')(b_gr2)
d1 = Dense(32, activation='relu')(b_gr3)
d2 = Dense(8, activation='relu')(d1)
d3 = Dense(1, activation='softmax')(d2)
oup = Reshape(target_shape=(input_dim[0],))(d3)
return Model(inp, oup)
def write_model_arch(mod,mod_file):
@ -132,5 +136,5 @@ def train_segment(collection_name = 'test',resume_weights='',initial_epoch=0):
if __name__ == '__main__':
# pass
train_segment('story_phrases','./models/segment/story_phrases.1000/speech_segment_model-final.h5',1001)
pass
# train_segment('story_phrases','./models/segment/story_phrases.1000/speech_segment_model-final.h5',1001)