Na execução da célula:
img = io.imread('1200x630wa.png')
img = color.rgb2gray(img)
img = transform.resize(img, (img.shape[0]//10, img.shape[1]//10) )
saida = convolve(img, kernel_v, 'valid')
plt.imshow(img, cmap='gray')
plt.title('Imagem')
plt.figure(figsize=(8, 5))
plt.imshow(np.abs(saida), cmap='gray')
plt.colorbar()
plt.title('Mapa de ativação')
tive o seguinte retorno no collab:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-8-b066116ea6cf> in <cell line: 2>()
1 img = io.imread('1200x630wa.png')
----> 2 img = color.rgb2gray(img)
3 img = transform.resize(img, (img.shape[0]//10, img.shape[1]//10) )
4
5 saida = convolve(img, kernel_v, 'valid')
2 frames
/usr/local/lib/python3.10/dist-packages/skimage/color/colorconv.py in _prepare_colorarray(arr, force_copy, channel_axis)
138 msg = (f'the input array must have size 3 along `channel_axis`, '
139 f'got {arr.shape}')
--> 140 raise ValueError(msg)
141
142 float_dtype = _supported_float_type(arr.dtype)
ValueError: the input array must have size 3 along `channel_axis`, got (630, 1200, 4)---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-8-b066116ea6cf> in <cell line: 2>()
1 img = io.imread('1200x630wa.png')
----> 2 img = color.rgb2gray(img)
3 img = transform.resize(img, (img.shape[0]//10, img.shape[1]//10) )
4
5 saida = convolve(img, kernel_v, 'valid')
2 frames
/usr/local/lib/python3.10/dist-packages/skimage/color/colorconv.py in _prepare_colorarray(arr, force_copy, channel_axis)
138 msg = (f'the input array must have size 3 along `channel_axis`, '
139 f'got {arr.shape}')
--> 140 raise ValueError(msg)
141
142 float_dtype = _supported_float_type(arr.dtype)
ValueError: the input array must have size 3 along `channel_axis`, got (630, 1200, 4)---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-8-b066116ea6cf> in <cell line: 2>()
1 img = io.imread('1200x630wa.png')
----> 2 img = color.rgb2gray(img)
3 img = transform.resize(img, (img.shape[0]//10, img.shape[1]//10) )
4
5 saida = convolve(img, kernel_v, 'valid')
2 frames
/usr/local/lib/python3.10/dist-packages/skimage/color/colorconv.py in _prepare_colorarray(arr, force_copy, channel_axis)
138 msg = (f'the input array must have size 3 along `channel_axis`, '
139 f'got {arr.shape}')
--> 140 raise ValueError(msg)
141
142 float_dtype = _supported_float_type(arr.dtype)
ValueError: the input array must have size 3 along `channel_axis`, got (630, 1200, 4)---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-8-b066116ea6cf> in <cell line: 2>()
1 img = io.imread('1200x630wa.png')
----> 2 img = color.rgb2gray(img)
3 img = transform.resize(img, (img.shape[0]//10, img.shape[1]//10) )
4
5 saida = convolve(img, kernel_v, 'valid')
2 frames
/usr/local/lib/python3.10/dist-packages/skimage/color/colorconv.py in _prepare_colorarray(arr, force_copy, channel_axis)
138 msg = (f'the input array must have size 3 along `channel_axis`, '
139 f'got {arr.shape}')
--> 140 raise ValueError(msg)
141
142 float_dtype = _supported_float_type(arr.dtype)
ValueError: the input array must have size 3 along `channel_axis`, got (630, 1200, 4)---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-8-b066116ea6cf> in <cell line: 2>()
1 img = io.imread('1200x630wa.png')
----> 2 img = color.rgb2gray(img)
3 img = transform.resize(img, (img.shape[0]//10, img.shape[1]//10) )
4
5 saida = convolve(img, kernel_v, 'valid')
2 frames
/usr/local/lib/python3.10/dist-packages/skimage/color/colorconv.py in _prepare_colorarray(arr, force_copy, channel_axis)
138 msg = (f'the input array must have size 3 along `channel_axis`, '
139 f'got {arr.shape}')
--> 140 raise ValueError(msg)
141
142 float_dtype = _supported_float_type(arr.dtype)
ValueError: the input array must have size 3 along `channel_axis`, got (630, 1200, 4)
como posso tratar esse erro de input de canais?