yt8m_frame_model2.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:Youtube8mdataset_kagglechallenge 作者: jasonlee27 项目源码 文件源码
def load_model(self, frm_modelweights=''):

        first_model = Sequential()
        first_model.add(LSTM(2048,
                             input_shape=(m, self.feature_size),
                             return_sequences=False,
                             activation='relu',
                             name='fc1_left'))
        first_model.add(Dropout(0.5))
        first_model.add(LSTM(2048,
                             return_sequences=False,
                             activation='relu',
                             name='fc1_left'))

        second_model = Sequential()
        second_model.add(LSTM(2048,
                              input_shape=(n - m, self.feature_size),
                              return_sequences=False,
                              activation='relu',
                              name='fc1_right'))
        second_model.add(Dropout(0.5))
        second_model.add(LSTM(2048,
                              return_sequences=False,
                              activation='relu',
                              name='fc1_right'))

        model = Sequential()
        model.add(Merge([first_model, second_model], mode='concat'))
        model.add(Dense(4096, activation='relu', name='fc2'))
        model.add(Dropout(0.5))
        model.add(Dense(self.numclasses, activation='softmax', name='prediction'))

        if frm_modelweights:
            model.load_weights(frm_modelweights, by_name=True)
            print("Frame model loaded with weights from %s." % frm_modelweights)
        else:
            print "Empty frame model loaded."

        return model
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号