Skip to content

Commit bed9a4d

Browse files
author
Marina Samuel
committed
Fix json file formatting on save().
1 parent b4c1e8c commit bed9a4d

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

ocr/nn.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

ocr/ocr.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ def normalize(self, intensity, newMax, newMin):
9595
def save(self):
9696
nnFile = open(ocrNN.NN_FILE_PATH,'w');
9797
json.dump({
98-
"theta1":[npArr.tolist() for npArr in self.theta1],
99-
"theta2":[npArr.tolist() for npArr in self.theta2],
100-
"b1":self.b1[0].tolist(),
101-
"b2":self.b2[0].tolist()
98+
"theta1":[npMat.tolist()[0] for npMat in self.theta1],
99+
"theta2":[npMat.tolist()[0] for npMat in self.theta2],
100+
"b1":self.b1[0].tolist()[0],
101+
"b2":self.b2[0].tolist()[0]
102102
}, nnFile)
103103
nnFile.close()
104104

@@ -124,7 +124,7 @@ def __init__(self, numHiddenNodes):
124124

125125
# Train using sample data
126126
self.train([{"y0":self.dataMatrix[i], "label":int(ocrNN.dataLabels[i])} for i in ocrNN.sampleIndices[:3500]])
127-
self.test()
128127
self.save()
129128
else:
130-
self.load()
129+
self.load()
130+
#self.test()

0 commit comments

Comments
 (0)