如何将卷积层的输出绘制为散点图?可能吗

时间:2019-03-23 16:17:45

标签: python numpy opencv matplotlib deep-learning

为了分类,我想绘制并查看数据点在经过卷积层后在任何n维平面上的位置。有可能吗?

model = Sequential()
model.add(TimeDistributed(Conv2D(64, (2, 2), activation='relu', padding='same'), 
                          input_shape=(20,128, 128 ,1))) 

model.add(TimeDistributed(MaxPooling2D(pool_size=(2, 2))))
model.add(TimeDistributed(Conv2D(32, (3, 3), activation='relu', padding='same')))
model.add(TimeDistributed(MaxPooling2D(pool_size=(2, 2))))
model.add(TimeDistributed(Conv2D(16, (3, 3), activation='relu', padding='same')))
model.add(TimeDistributed(MaxPooling2D(pool_size=(2, 2))))

model.add(TimeDistributed(Flatten()))
model.add(LSTM(units=64, return_sequences=True))

model.add(TimeDistributed(Reshape((8, 8, 1))))
model.add(TimeDistributed(UpSampling2D((2,2))))
model.add(TimeDistributed(Conv2D(16, (3,3), activation='relu', padding='same')))
model.add(TimeDistributed(UpSampling2D((2,2))))
model.add(TimeDistributed(Conv2D(32, (3,3), activation='relu', padding='same')))
model.add(TimeDistributed(UpSampling2D((2,2))))
model.add(TimeDistributed(Conv2D(64, (2,2), activation='relu', padding='same')))
model.add(TimeDistributed(UpSampling2D((2,2))))
model.add(TimeDistributed(Conv2D(1, (3,3), padding='same')))

上面给出的是模型。我想绘制LSTM单位的输出。谢谢

1 个答案:

答案 0 :(得分:0)

有关受过训练以识别手语的LSTM模型的一些可视化效果,请参见下文:

https://medium.com/asap-report/visualizing-lstm-networks-part-i-f1d3fa6aace7

这里是他们的代码存储库:https://github.com/asap-report/lstm-visualisation