Documentos de Académico
Documentos de Profesional
Documentos de Cultura
largo,ancho,canales = imagen.shape;
imagen_columna = imagen.reshape(-1,3);
print(imagen_columna.shape)
print(imagen_columna)
plt.imshow(imagen)
(240, 320, 3)
(76800, 3)
[[156 191 245]
[154 189 243]
[154 189 243]
...
[148 181 216]
[147 180 215]
[145 178 213]]
<matplotlib.image.AxesImage at 0x7fac3d69c748>
#etiquetas
cuaderno, impresora, pared, pizarra, mueble_azul, mueble_gris = range(6)
0, 1, 2, 3, 4, 5,
print(cuaderno, impresora, pared, pizarra, mueble_azul, mueble_gris)
#np.full((3, 5), 7)
#numpy.array(n * [value])
entrenos = np.concatenate((cu,im,im2,pa,pi,ma,mg))
etiquetas = np.concatenate((eti_cu,eti_im,eti_im2,eti_pa,eti_pi,eti_ma,eti_mg))
print(entrenos.shape, etiquetas.shape)
0 1 2 3 4 5
(135, 3) (135,)
(126, 3) (126,)
(70, 3) (70,)
(160, 3) (160,)
(294, 3) (294,)
(209, 3) (209,)
(216, 3) (216,)
(1210, 3) (1210,)
<matplotlib.image.AxesImage at 0x7fac3b987588>
pred_mpl = perceptron.predict(imagen_columna)
print(pred_mpl)
pred_mpl = pred_mpl.reshape(240,320)
plt.imshow(pred_mpl)
[2 2 2 ... 2 2 2]
<matplotlib.image.AxesImage at 0x7fa53809d7b8>