def evaluate_lenet5(learning_rate=0.1, n_epochs=200, dataset='mnist.pkl.gz', nkerns=[2,5], batch_size=50):
evaluate_lenet5
original_image = cv2.imread('dataset')
rng = numpy.random.RandomState(23455)
datasets = load_data(dataset)
train_set_x, train_set_y = datasets[0]
valid_set_x, valid_set_y = datasets[1]
test_set_x, test_set_y = datasets[2]
n_train_batches = train_set_x.get_value(borrow=True).shape[0]
n_valid_batches = valid_set_x.get_value(borrow=True).shape[0]
n_test_batches = test_set_x.get_value(borrow=True).shape[0]
n_train_batches //= batch_size
n_valid_batches //= batch_size
n_test_batches //= batch_size
index = T.lscalar()
x = T.matrix('x')
y = T.ivector('y')
print('... building the model')
layer0_input = x.reshape((batch_size, 1, 28, 28))
layer0 = LeNetConvPoolLayer(
rng,
input=layer0_input,
image_shape=(batch_size, 1, 28, 28),
filter_shape=(nkerns[0], 1, 5, 5),
poolsize=(2, 2)
)
layer1 = LeNetConvPoolLayer(
rng,
input=layer0.output,
image_shape=(batch_size, nkerns[0], 12, 12),
filter_shape=(nkerns[1], nkerns[0], 5, 5),
poolsize=(2, 2)
)
layer00_input = x.reshape((batch_size, 1, 28, 28))
layer00 = LeNetConvPoolLayer(
rng,
input=layer00_input,
image_shape=(batch_size, 1, 28, 28),
filter_shape=(nkerns[0], 1, 5, 5),
poolsize=(2, 2)
)
layer11 = LeNetConvPoolLayer(
rng,
input=layer00.output,
image_shape=(batch_size, nkerns[0], 12, 12),
filter_shape=(nkerns[1], nkerns[0], 5, 5),
poolsize=(2, 2)
)
pdb.set_trace()
layer2_input1=layer1.output.flatten(2)
layer2_input2=layer11.output.flatten(2)
input1=numpy.asarray(layer2_input1)
input2=numpy.asarray(layer2_input2)
部分代码如上所述。
为了解决操作时的错误,我使用pdb验证了我的代码。
pdb如下所示。
Reshape{2}.0
是什么意思?
我想了解Reshape{2}