我使用 nolearn 库创建了神经网络。
net = NeuralNet(
layers=[
('input', layers.InputLayer),
('conv1', layers.Conv2DLayer),
('pool1', layers.MaxPool2DLayer),
('dropout1', layers.DropoutLayer),
('conv2', layers.Conv2DLayer),
('pool2', layers.MaxPool2DLayer),
('dropout2', layers.DropoutLayer),
('conv3', layers.Conv2DLayer),
('pool3', layers.MaxPool2DLayer),
('dropout3', layers.DropoutLayer),
('hidden4', layers.DenseLayer),
('output', layers.DenseLayer),
],
input_shape=(None, 1, imgSize, imgSize),
conv1_num_filters=32, conv1_filter_size=(param1, param1), pool1_pool_size=(2, 2),
dropout1_p=0.4,
conv2_num_filters=64, conv2_filter_size=(param2, param2), pool2_pool_size=(2, 2),
dropout2_p=0.4,
conv3_num_filters=128, conv3_filter_size=(param3, param3), pool3_pool_size=(2, 2),
dropout3_p=0.4,
hidden4_num_units=1000,
output_num_units=classNum, output_nonlinearity=lasagne.nonlinearities.softmax,
update_learning_rate=0.01,
update_momentum=0.9,
regression=False,
max_epochs=100,
verbose=1,
)
net.fit(trainD, trainL)
如何在某些 x 上获得隐藏层神经元的值?我不会获得这些值并将它们用于其他算法以获得更好的结果。