5

My datasets is MNIST, and ML library is MXNet

I used the CNN algorithm to practice ML. Then I found the reference tutorial, page 6 and 7.

smoothly kernel

I guess the default kernel is all '1' instances in a matrix (kernel in MXNet). How to make the smoothly kernel like above slide.


This is the MXNet code with R.

mx.symbol.Convolution(data=data, kernel=c(5,5), num_filter=20)
Leopd
  • 41,333
  • 31
  • 129
  • 167
Husky
  • 542
  • 5
  • 22
  • 1
    Please consider including the data and all the relevant code in your question to sever the ties to off-site resources that may go offline without notice. – Roman Luštrik Jan 18 '16 at 13:06
  • What are you trying to accomplish? If you are trying to do image filtering using `MXNet`, you may be using the wrong tool. There is a way to specify array initialization, but you will be changing the weights if you want to do any learning with backprop. If you just want to convolve a kernel over an image, look at `spatialfil` or `imager` packages. – ultradian Mar 17 '17 at 19:50

1 Answers1

0

As mentioned by others, MXNet is a framework for deep-learning. The slides that you referenced are image processing tasks that have other optimized tools, OpenCV being one of the most popular ones. Nevertheless, you can perform simple convolution using MXNet as well. In python, it would look like this:

# Replace img with an actual image
img = np.random.uniform(size=(1, 1, 480, 640))
img = mx.nd.array(img)
w = mx.nd.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])
w.reshape((1, 1, 3, 3))
out = mx.nd.Convolution(
    img, w, kernel=(3, 3), num_filter=1, no_bias=True, pad=(1, 1))
Sina Afrooze
  • 960
  • 6
  • 11