# open random image of dimensions 639x516 img = Image.open(open('doc/images/3wolfmoon.jpg')) # dimensions are (height, width, channel) img = numpy.asarray(img, dtype='float64') / 256.
# put image in 4D tensor of shape (1, 3, height, width) img_ = img.transpose(2, 0, 1).reshape(1, 3, 639, 516) filtered_img = f(img_)
# plot original image and first and second components of output pylab.subplot(1, 3, 1); pylab.axis('off'); pylab.imshow(img) pylab.gray(); # recall that the convOp output (filtered image) is actually a "minibatch", # of size 1 here, so we take index 0 in the first dimension: pylab.subplot(1, 3, 2); pylab.axis('off'); pylab.imshow(filtered_img[0, 0, :, :]) pylab.subplot(1, 3, 3); pylab.axis('off'); pylab.imshow(filtered_img[0, 1, :, :]) pylab.show()
if 'imshp_logical' in kwargs or 'kshp_logical' in kwargs: raise ValueError( "Keyword arguments 'imshp_logical' and 'kshp_logical' for conv2d " "are not supported anymore (and have not been a reliable way to " "perform upsampling). That feature is still available by calling " "theano.tensor.nnet.conv.conv2d() for the time being.") if len(kwargs.keys()) > 0: warnings.warn(str(kwargs.keys()) + " are now deprecated in " "`tensor.nnet.abstract_conv.conv2d` interface" " and will be ignored.", stacklevel=2)
if image_shape is not None: warnings.warn("The `image_shape` keyword argument to " "`tensor.nnet.conv2d` is deprecated, it has been " "renamed to `input_shape`.", stacklevel=2) if input_shape is None: input_shape = image_shape else: raise ValueError("input_shape and image_shape should not" " be provided at the same time.")
def conv2d(input, filters, input_shape=None, filter_shape=None, border_mode='valid', subsample=(1, 1), filter_flip=True, filter_dilation=(1, 1)): """This function will build the symbolic graph for convolving a mini-batch of a stack of 2D inputs with a set of 2D filters. The implementation is modelled after Convolutional Neural Networks (CNN).
Refer to :func:`nnet.conv2d <theano.tensor.nnet.conv2d>` for a more detailed documentation. """
class AbstractConv2d(AbstractConv): """ Abstract Op for the forward convolution. Refer to :func:`BaseAbstractConv <theano.tensor.nnet.abstract_conv.BaseAbstractConv>` for a more detailed documentation. """