convolution

CUDA, NPP Filters

爱⌒轻易说出口 提交于 2019-12-06 05:11:59
问题 The CUDA NPP library supports filtering of image using the nppiFilter_8u_C1R command but keep getting errors. I have no problem getting the boxFilterNPP sample code up and running. eStatusNPP = nppiFilterBox_8u_C1R(oDeviceSrc.data(), oDeviceSrc.pitch(), oDeviceDst.data(), oDeviceDst.pitch(), oSizeROI, oMaskSize, oAnchor); But if I change it to use nppiFilter_8u_C1R instead, eStatusNPP return the error -24 (NPP_TEXTURE_BIND_ERROR). The code below is the alterations I made to the original

Visualize images in intermediate layers in torch (lua)

百般思念 提交于 2019-12-06 03:57:46
问题 In the conv-nets model, I know how to visualize the filters, we can do itorch.image(model:get(1).weight) But how could I efficiently visualize the output images after the convolution? especially those images in the second or third layer in a deep neural network? Thanks. 回答1: Similarly to weight, you can use: itorch.image(model:get(1).output) 回答2: To visualize the weights: -- visualizing weights n = nn.SpatialConvolution(1,64,16,16) itorch.image(n.weight) To visualize the feature maps: --

Complex convolution in tensorflow

牧云@^-^@ 提交于 2019-12-06 03:03:28
I'm trying to run a simple convolution but with complex numbers: r = np.random.random([1,10,10,10]) i = np.random.random([1,10,10,10]) x = tf.complex(r,i) conv_layer = tf.layers.conv2d( inputs=x, filters=10, kernel_size=[3,3], kernel_initializer=utils.truncated_normal_complex(), activation=tf.nn.sigmoid) However I get this error: TypeError: Value passed to parameter 'input' has DataType complex128 not in list of allowed values: float16, float32 Does anyone know how to implement such a convolution in Tensorflow? Will I need to implement a custom op, or is there some better option here?

Python/Tensorflow - I have trained the convolutional neural network, how to test it?

北城以北 提交于 2019-12-06 02:59:23
I have trained a convolutional neural network (CNN) with the following data that I had in a binary file (label, filename, data (pixels)): [array([2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0]), array(['10_c.jpg', '10_m.jpg', '10_n.jpg', '1_c.jpg', '1_m.jpg', '1_n.jpg', '2_c.jpg', '2_m.jpg', '2_n.jpg', '3_c.jpg', '3_m.jpg', '3_n.jpg', '4_c.jpg', '4_m.jpg', '4_n.jpg', '5_c.jpg', '5_m.jpg', '5_n.jpg', '6_c.jpg', '6_m.jpg', '6_n.jpg', '7_c.jpg', '7_m.jpg', '7_n.jpg', '8_c.jpg', '8_m.jpg', '8_n.jpg', '9_c.jpg', '9_m.jpg', '9_n.jpg'], dtype='<U15'), array(

Python: 1d array circular convolution

喜夏-厌秋 提交于 2019-12-06 01:26:41
问题 I wonder if there's a function in numpy/scipy for 1d array circular convolution. The scipy.signal.convolve() function only provides "mode" but not "boundary", while the signal.convolve2d() function needs 2d array as input. I need to do this to compare open vs circular convolution as part of a time series homework. 回答1: Since this is for homework, I'm leaving out a few details. By the definition of convolution, if you append a signal a to itself, then the convolution between aa and b will

Where to center the kernel when using FFTW for image convolution?

て烟熏妆下的殇ゞ 提交于 2019-12-06 01:00:35
问题 I am trying to use FFTW for image convolution. At first just to test if the system is working properly, I performed the fft, then the inverse fft, and could get the exact same image returned. Then a small step forward, I used the identity kernel(i.e., kernel[0][0] = 1 whereas all the other components equal 0). I took the component-wise product between the image and kernel(both in the frequency domain), then did the inverse fft. Theoretically I should be able to get the identical image back.

Pooling vs Pooling-over-time

。_饼干妹妹 提交于 2019-12-05 23:27:50
问题 I understand conceptually what is happening in a max/sum pool as a CNN layer operation, but I see this term "max pool over time", or "sum pool over time" thrown around (e.g., "Convolutional Neural Networks for Sentence Classification" paper by Yoon Kim). What is the difference? 回答1: The max-over-time pooling is usually applied in NLP (unlike ordinary max-pool, which is common in CNNs for computer vision tasks), so the setup is a little bit different. The input to the max-over-time pooling is

Memory usage of tensorflow conv2d with large filters

僤鯓⒐⒋嵵緔 提交于 2019-12-05 21:30:32
I have a tensorflow model with some relatively large 135 x 135 x 1 x 3 convolution filters. I find that tf.nn.conv2d becomes unusable for such large filters - it attempts to use well over 60GB of memory, at which point I need to kill it. Here is the minimum script to reproduce my error: import tensorflow as tf import numpy as np frames, height, width, channels = 200, 321, 481, 1 filter_h, filter_w, filter_out = 5, 5, 3 # With this, output has shape (200, 317, 477, 3) # filter_h, filter_w, filter_out = 7, 7, 3 # With this, output has shape (200, 315, 475, 3) # filter_h, filter_w, filter_out =

Convolutional Neural Networks: How many pixels will be covered by each of the filters?

半城伤御伤魂 提交于 2019-12-05 16:40:41
How can I calculate the area (in the original image) covered by each of the filters in my network? e.g. Lets say the size of the image is WxW pixels. I am using the following network: layer 1 : conv : 5x5 layer 2 : pool : 3x3 layer 3 : conv : 5x5 ..... layer N : conv : 5x5 I want to calculate how much area in the original image will be covered by each filter. e.g. the filter in the layer 1 will cover 5x5 pixels in the original image. A similar problem would be, how many pixels will be covered by each activation? which is essentially the same as, how large an input image has to be in order to

How to input mask value to Convolution1D layer

寵の児 提交于 2019-12-05 05:12:36
I need to feed variable length sequences into my model. My model is Embedding + LSTM + Conv1d + Maxpooling + softmax . When I set mask_zero = True in Embedding , I fail to compile at Conv1d . How can I input mask value in Conv1d or is there another solution? orsonady Conv1D layer does not support masking at this time. Here is an open issue on the keras repo. Depending on the task you might be able to get away with embedding the mask_value just like the other values in the sequence and apply global pooling (as you're doing now). The Masking layer expects every downstream layer to support