Deep learning 基于Keras时空自动编码器的视频异常事件检测

Deep learning 基于Keras时空自动编码器的视频异常事件检测,deep-learning,keras,lstm,autoencoder,Deep Learning,Keras,Lstm,Autoencoder,我正试图提高异常事件检测模型的准确性(AUC),我根据这篇研究论文()使用keras库实现了该模型。使用的数据仅为著名的UCSDped1。 模型AUC最初为50%,在去除COnvLSTM层之间的批量标准化后,AUC变为63%,并且在多次尝试不同的损失、优化器和改变参数后,似乎没有任何增加。 我怀疑问题在于该模型不能正确地进行时间学习 我对模型的理解如下:在训练阶段,结果将是学习的权重,使用这些权重,具有高重建误差的帧(原始帧-重建帧)将被视为异常。 培训阶段的损失约为0.0013。 那么有什么不

我正试图提高异常事件检测模型的准确性(AUC),我根据这篇研究论文()使用keras库实现了该模型。使用的数据仅为著名的UCSDped1。 模型AUC最初为50%,在去除COnvLSTM层之间的批量标准化后,AUC变为63%,并且在多次尝试不同的损失、优化器和改变参数后,似乎没有任何增加。 我怀疑问题在于该模型不能正确地进行时间学习

我对模型的理解如下:在训练阶段,结果将是学习的权重,使用这些权重,具有高重建误差的帧(原始帧-重建帧)将被视为异常。 培训阶段的损失约为0.0013。 那么有什么不对呢

如有任何反馈,将不胜感激

代码如下:

model = Sequential()

#2 convolution layers
model.add(TimeDistributed(Convolution2D(128, 11, 11 , border_mode='valid',activation = 'tanh', subsample = (4,4)), input_shape=(None,227, 227, 1)))
model.add(TimeDistributed(Convolution2D(64, 5, 5, border_mode='valid',activation = 'tanh', subsample = (2,2))))
#3 ConvLSTM layers
model.add(ConvLSTM2D(nb_filter=64, nb_row=3, nb_col=3,
                   border_mode='same', return_sequences=True))
#model.add(BatchNormalization())
model.add(ConvLSTM2D(nb_filter=32, nb_row=3, nb_col=3,
                   border_mode='same', return_sequences=True))
#model.add(BatchNormalization())
model.add(ConvLSTM2D(nb_filter=64, nb_row=3, nb_col=3,
                   border_mode='same', return_sequences=True))
#model.add(BatchNormalization())
#2 Deconvolution layers
model.add(TimeDistributed(Deconvolution2D(128, 5, 5,border_mode='valid',activation = 'tanh', output_shape=(None,55, 55, 128), subsample = (2,2))))
model.add(TimeDistributed(Deconvolution2D(1, 11, 11,border_mode='valid',activation = 'tanh', output_shape=(None,227, 227, 1), subsample = (4,4))))

model.compile(optimizer='adam', loss='mse')
model.fit(train_data,train_data, batch_size=64,nb_epoch=10)
reconstructed = model.predict(test_data)

e = (test_data-reconstructed)**2

ex = []
for i in e:
    ex.append(np.sqrt(np.sum(i)))

e_min = min(ex)
e_max = max(ex)
abnormality_score = (ex-e_min)/(e_max-e_min)

from sklearn import metrics
#y_test contains 1's for abnormal frame and 0's for normal frame 
fpr, tpr, thresholds = metrics.roc_curve(y_test, abnormality_score )
roc_auc = metrics.auc(fpr, tpr)

print fpr,tpr,thresholds

import matplotlib.pyplot as plt
plt.title('Receiver Operating Characteristic')
plt.plot(fpr, tpr, 'b', label = 'AUC = %0.2f' % roc_auc)
plt.legend(loc = 'lower right')
plt.plot([0, 1], [0, 1],'r--')
plt.xlim([0, 1])
plt.ylim([0, 1])
plt.ylabel('True Positive Rate')
plt.xlabel('False Positive Rate')
plt.show()

培训
LSTM
10个时代并不是最好的主意。即使是
ConvLstm
。首先尝试更多的历元我以前训练过35和45历元的模型,但AUC没有变化,仍然保持在63%。更多历元的意思是几K,而不是50你们说的“K”是什么意思?千/公斤