Ifi6057w11
11. Nädal
Perceptron. Närvivõrgud. AIMA 18.6.3-18.7.4
Lineaarne klassifitseerija Pythonis.
Loenguslaidid: PDF
Harjutustund
bmp laadimine (paint.net 8-bit grayscale peal VIST töötab)
import struct
def load_bmp(fn):
with open(fn, "rb") as f:
header = f.read(54)
offset = header[10:14]
offs = struct.unpack("@L", offset)
f.read(offs[0]-54)
data = list(f.read(28*28))
inv_data = []
for i in range(27, -1, -1):
inv_data += data[i*28: (i+1)*28]
return inv_data