siec neuronowa upgreade
This commit is contained in:
parent
b141c4ef80
commit
1f68e0d82d
BIN
src/Lhidden_test.npy
Normal file
BIN
src/Lhidden_test.npy
Normal file
Binary file not shown.
BIN
src/Lweights_test.npy
Normal file
BIN
src/Lweights_test.npy
Normal file
Binary file not shown.
@ -131,15 +131,53 @@ def testing(n, testingSamples, testingLabels):
|
|||||||
|
|
||||||
testing(digitNetwork,dig_test_images,dig_test_labels)
|
testing(digitNetwork,dig_test_images,dig_test_labels)
|
||||||
|
|
||||||
|
record_cache = None
|
||||||
|
def testCase(inputWord):
|
||||||
|
len = len(inputWord)
|
||||||
|
li = []
|
||||||
|
ourOwnDataset = []
|
||||||
|
word = ""
|
||||||
|
imgArray = imageio.imread(imageFileName, as_gray=True)
|
||||||
|
for i in len-2:
|
||||||
|
imgData = 255 - imgArray.reshape(784)
|
||||||
|
imgData = (imgData/255 * 0.99) + 0.01
|
||||||
|
word = word + recognizeLet(inputWord[i],imgData)
|
||||||
|
word = word + recognizeNum[inputWord[-2]]
|
||||||
|
word = word + recognizeNum[inputWord[-1]]
|
||||||
|
|
||||||
|
|
||||||
|
assert record_cache.shape == ourOwnDataset[0].shape
|
||||||
|
labelInput = np.asfarray(li)
|
||||||
|
#print(labelInput)
|
||||||
|
print('slowo: ', word)
|
||||||
|
pass
|
||||||
|
|
||||||
|
def recognizeLet(let,imgData):
|
||||||
|
letters=['','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
|
||||||
|
record = np.append(label,imgData)
|
||||||
|
label = np.argmax(outputs)
|
||||||
|
return letters[int(label)]
|
||||||
|
|
||||||
|
def recognizeNum():
|
||||||
|
pass
|
||||||
|
|
||||||
|
record = np.append(label,imgData)
|
||||||
|
#print('Record: ',record)
|
||||||
|
ourOwnDataset.append(record)
|
||||||
|
if record_cache is None:
|
||||||
|
record_cache = record
|
||||||
|
#print(ood[0])
|
||||||
|
li.append(label)
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
li = []
|
li = []
|
||||||
|
#ourOwnDataset = np.asfarray(ood)
|
||||||
ourOwnDataset = []
|
ourOwnDataset = []
|
||||||
|
|
||||||
record_cache = None
|
record_cache = None
|
||||||
for imageFileName in glob.glob('litery/?.png'):
|
for imageFileName in glob.glob('cyfry/?.png'):
|
||||||
label = int(imageFileName[-5:-4])
|
label = int(imageFileName[-5:-4])
|
||||||
print('loading...', imageFileName)
|
print('loading...', imageFileName)
|
||||||
|
|
||||||
@ -169,20 +207,20 @@ labelInput = np.asfarray(li)
|
|||||||
|
|
||||||
|
|
||||||
word = ""
|
word = ""
|
||||||
for item in range(0,5):
|
for item in range(0,9):
|
||||||
correctLabels = labelInput[item]
|
correctLabels = labelInput[item]
|
||||||
outputs = letterNetwork.query(ourOwnDataset[item][1:])
|
outputs = n.query(ourOwnDataset[item][1:])
|
||||||
print(outputs)
|
print(outputs)
|
||||||
|
|
||||||
label = np.argmax(outputs)
|
label = np.argmax(outputs)
|
||||||
print('label: ',label)
|
|
||||||
#print('Network says: ', label)
|
#print('Network says: ', label)
|
||||||
#labelString = np.array_str(label)
|
#labelString = np.array_str(label)
|
||||||
letters=['','a','b','c']
|
|
||||||
word = word + str(label)
|
word = word + str(label)
|
||||||
|
|
||||||
print('slowo: ', word)
|
print('slowo: ', word)
|
||||||
print('yep')
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user