convolution

Preparing feeding data to 1D CNN

不羁的心 提交于 2021-01-28 10:28:14
问题 I am getting into a similar problem with reshaping data for 1-D CNN: I am loading data (training and testing data sets ) from a csv file with 24,325 lines. Each line is a vector of 256 numbers - independent variables plus 11 numbers of expected outcome ( labels ) [0,0,0,0,1,0,0,0,0,0,0] I am using TensorFlow backend. The code looks like that: import matplotlib.pyplot as plt import pandas as pd import numpy as np #Importing training set training_set = pd.read_csv("Data30.csv") X_train =

Preparing feeding data to 1D CNN

帅比萌擦擦* 提交于 2021-01-28 10:27:25
问题 I am getting into a similar problem with reshaping data for 1-D CNN: I am loading data (training and testing data sets ) from a csv file with 24,325 lines. Each line is a vector of 256 numbers - independent variables plus 11 numbers of expected outcome ( labels ) [0,0,0,0,1,0,0,0,0,0,0] I am using TensorFlow backend. The code looks like that: import matplotlib.pyplot as plt import pandas as pd import numpy as np #Importing training set training_set = pd.read_csv("Data30.csv") X_train =

3D convolution in python

眉间皱痕 提交于 2021-01-28 05:04:10
问题 I need to wite a code to perform a 3D convolution in python using numpy, with 3x3 kernels. I've done it right for 2D arrays like B&W images but when i try to extend it to 3D arrays like RGB is a mess. I need help to improve my method. Here is the 2D code: def convolucion_3x3(arreglo, kernel): (dim_x, dim_y) = arreglo.shape (ker_x, ker_y) = kernel.shape matriz_convolucionada = np.zeros((dim_x, dim_y)) for i in range(dim_x): for j in range(dim_y): resultado = 0 for x in range(-1, 2): try: if i

why does my convolution routine differ from numpy & scipy's?

淺唱寂寞╮ 提交于 2021-01-27 05:58:43
问题 I wanted to manually code a 1D convolution because I was playing around with kernels for time series classification, and I decided to make the famous Wikipedia convolution image, as seen here. Here's my script. I'm using the standard formula for convolution for a digital signal. import numpy as np import matplotlib.pyplot as plt import scipy.ndimage plt.style.use('ggplot') def convolve1d(signal, ir): """ we use the 'same' / 'constant' method for zero padding. """ n = len(signal) m = len(ir)

why does my convolution routine differ from numpy & scipy's?

痞子三分冷 提交于 2021-01-27 05:58:34
问题 I wanted to manually code a 1D convolution because I was playing around with kernels for time series classification, and I decided to make the famous Wikipedia convolution image, as seen here. Here's my script. I'm using the standard formula for convolution for a digital signal. import numpy as np import matplotlib.pyplot as plt import scipy.ndimage plt.style.use('ggplot') def convolve1d(signal, ir): """ we use the 'same' / 'constant' method for zero padding. """ n = len(signal) m = len(ir)

why does my convolution routine differ from numpy & scipy's?

喜你入骨 提交于 2021-01-27 05:57:23
问题 I wanted to manually code a 1D convolution because I was playing around with kernels for time series classification, and I decided to make the famous Wikipedia convolution image, as seen here. Here's my script. I'm using the standard formula for convolution for a digital signal. import numpy as np import matplotlib.pyplot as plt import scipy.ndimage plt.style.use('ggplot') def convolve1d(signal, ir): """ we use the 'same' / 'constant' method for zero padding. """ n = len(signal) m = len(ir)

why does my convolution routine differ from numpy & scipy's?

吃可爱长大的小学妹 提交于 2021-01-27 05:56:45
问题 I wanted to manually code a 1D convolution because I was playing around with kernels for time series classification, and I decided to make the famous Wikipedia convolution image, as seen here. Here's my script. I'm using the standard formula for convolution for a digital signal. import numpy as np import matplotlib.pyplot as plt import scipy.ndimage plt.style.use('ggplot') def convolve1d(signal, ir): """ we use the 'same' / 'constant' method for zero padding. """ n = len(signal) m = len(ir)