'how to reshape 3D to 2D with a big number?
hello i'm trying to reshape an array with shape (70,65536,18) to an array in 2D with shape (4587520,18) but i the result its a 3D array whit the same shape here its the code
img=imagenesTrain[0]
filters= scipy.io.loadmat(os.path.join('data_mp3','filterbank.mat'))['filterbank']
def calculate_filter_response_201822381_201821543(imagen,filters):
imggray=color.rgb2gray(imagen)
lista=[]
for i in range(len(filters[0,0])):
lista.append(scipy.signal.correlate(imggray,filters[:,:,i],mode='same',method='auto'))
lineal=np.array(lista)
lineal=lineal.reshape(256*256,18)
return lineal
imggray=calculate_filter_response_201822381_201821543(img,filters)
respuesta=[]
for i in imagenesTrain:
respuesta.append(calculate_filter_response_201822381_201821543(i,filters))
respuesta=np.array(respuesta)
respuesta.reshape(4587520,18)
Solution 1:[1]
You need to reassign the array, otherwise nothing happens. Reshape doesn't work in-place:
respueste = respueste.reshape(4587520, 18)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | LukasNeugebauer |
