testCase neural-network2

This commit is contained in:
s452693 2021-06-21 11:16:59 +02:00
parent 0290293ca0
commit 62bdd80e65

View File

@ -130,7 +130,7 @@ def testing(n, testingSamples, testingLabels):
print('Performance', scorecardArray.sum() / scorecardArray.size) print('Performance', scorecardArray.sum() / scorecardArray.size)
testing(digitNetwork,dig_test_images,dig_test_labels) testing(digitNetwork,dig_test_images,dig_test_labels)
testing(letterNetwork,let_test_images,let_test_labels)
li = [] li = []
ourOwnDataset = [] ourOwnDataset = []
@ -145,8 +145,14 @@ def testCase(inputWord):
imgData = (imgData/255 * 0.99) + 0.01 imgData = (imgData/255 * 0.99) + 0.01
#inputWord[i] #inputWord[i]
word = word + recognizeLet(letterNetwork ,imgData) word = word + recognizeLet(letterNetwork ,imgData)
word = word + recognizeNum(digitNetwork, inputWord[-2])
word = word + recognizeNum(digitNetwork ,inputWord[-1]) i=len-2
for i in range(i,len):
imgArray = imageio.imread(imageFileName, as_gray=True)
imgData = 255 - imgArray.reshape(784)
imgData = (imgData/255 * 0.99) + 0.01
#inputWord[i]
word = word + recognizeNum(digitNetwork, imgData)
#assert record_cache.shape == ourOwnDataset[0].shape #assert record_cache.shape == ourOwnDataset[0].shape
@ -234,5 +240,5 @@ print('slowo: ', word)
##################################### URUCHOMIENIE TRENINGU ##################################### URUCHOMIENIE TRENINGU
trainNetwork(letterNetwork, "Lweights_test.npy", "Lhidden_test.npy", let_train_images, let_train_labels) #trainNetwork(letterNetwork, "Lweights_test.npy", "Lhidden_test.npy", let_train_images, let_train_labels)
# trainNetwork(digitNetwork, "Dweights_test.npy", "Dhidden_test.npy", let_train_images, let_train_labels) # trainNetwork(digitNetwork, "Dweights_test.npy", "Dhidden_test.npy", let_train_images, let_train_labels)