0
我正在學習卷積如何工作的話,我遇到了我this..when試試這個使用移調有什麼區別?
rng = numpy.random.RandomState(23455)
input = T.tensor4(name='input')
w_shp = (2, 3, 9, 9)
w_bound = numpy.sqrt(3 * 9 * 9)
print w_bound
W = theano.shared(numpy.asarray(
rng.uniform(
low=-1.0/w_bound,
high=1.0/w_bound,
size=w_shp),
dtype=input.dtype), name ='W')
b_shp = (2,)
b = theano.shared(numpy.asarray(
rng.uniform(low=-.5, high=.5, size=b_shp),
dtype=input.dtype), name ='b')
conv_out = conv2d(input, W,subsample=(2,2))
pooled=downsample.max_pool_2d(conv_out,(2,2),ignore_border=True)
output = T.nnet.sigmoid(pooled + b.dimshuffle('x', 0, 'x', 'x'))
f = theano.function([input], output)
img = Image.open('2.jpg')
img = numpy.asarray(img, dtype='float64')/256.
l,w,r=img.shape
img_ = img.transpose(2, 0, 1).reshape(1, 3, l, w)
print img_.shape
filtered_img = f(img_)
pylab.subplot(1, 3, 1); pylab.axis('off'); pylab.imshow(img)
pylab.gray();
pylab.subplot(1, 3, 2); pylab.axis('off'); pylab.imshow(filtered_img[0, 1, :, :])
pylab.subplot(1, 3, 3); pylab.axis('off'); pylab.imshow(filtered_img[0, 0, :, :])
當我不移調輸入圖像即...
img_ = img.reshape(1, 3, l, w)
有人可以解釋有什麼區別?
是的,明白了!謝謝 – Sush