No models fix
This commit is contained in:
parent
a7b611c090
commit
17af113484
15
src/suite.py
15
src/suite.py
@ -360,9 +360,7 @@ class CVSuite:
|
|||||||
# Normalise data using loaded scalers
|
# Normalise data using loaded scalers
|
||||||
for idx, value in enumerate(data):
|
for idx, value in enumerate(data):
|
||||||
d = np.array(value)
|
d = np.array(value)
|
||||||
data[idx] = self.scaler[idx].transform(d.astype(np.float32).reshape(1, -1))[
|
data[idx] = self.scaler[idx].transform(d.astype(np.float32).reshape(1, -1))[0][0]
|
||||||
0
|
|
||||||
][0]
|
|
||||||
|
|
||||||
data = np.array([data], dtype=np.float32)
|
data = np.array([data], dtype=np.float32)
|
||||||
|
|
||||||
@ -397,13 +395,19 @@ class CVSuite:
|
|||||||
modelnr = (idx * 2) + idy
|
modelnr = (idx * 2) + idy
|
||||||
guesses = self.models[modelnr][2]
|
guesses = self.models[modelnr][2]
|
||||||
|
|
||||||
|
for guess in guesses:
|
||||||
|
print(guess)
|
||||||
|
|
||||||
# Convert guess array
|
# Convert guess array
|
||||||
tag_true = [guess[0] for guess in guesses ]
|
tag_true = [guess[0] for guess in guesses ]
|
||||||
tag_predict = [guess[1] for guess in guesses ]
|
tag_predict = [guess[1] for guess in guesses ]
|
||||||
|
|
||||||
labels = [Tree(tag).name for tag in range(0, 8)]
|
labels = [Tree(tag).name for tag in range(0, 8)]
|
||||||
|
|
||||||
sns.heatmap(confusion_matrix(tag_true, tag_predict), xticklabels=labels, yticklabels=labels, ax=graph, annot=True, cbar=False, fmt='g')
|
cm = confusion_matrix(tag_true, tag_predict)
|
||||||
|
cmn = cmn = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
|
||||||
|
sns.heatmap(cmn, xticklabels=labels, yticklabels=labels, ax=graph, annot=True, cbar=False, fmt='.2f')
|
||||||
|
|
||||||
graph.set_title(self.models[modelnr][0])
|
graph.set_title(self.models[modelnr][0])
|
||||||
graph.set_xlabel("Predicted")
|
graph.set_xlabel("Predicted")
|
||||||
graph.set_ylabel("Actual")
|
graph.set_ylabel("Actual")
|
||||||
@ -508,7 +512,7 @@ class CVSuite:
|
|||||||
img_sobel = img_gray
|
img_sobel = img_gray
|
||||||
|
|
||||||
self.canvas.add(img_sobel, "Sobel_edge")
|
self.canvas.add(img_sobel, "Sobel_edge")
|
||||||
self.log.add("Sobel nonzero", cv2.countNonZero(img_sobel))
|
# self.log.add("Sobel nonzero", cv2.countNonZero(img_sobel))
|
||||||
|
|
||||||
# Canny edge
|
# Canny edge
|
||||||
img_canny = cv2.Canny(image=img_blur, threshold1=ct1, threshold2=ct2)
|
img_canny = cv2.Canny(image=img_blur, threshold1=ct1, threshold2=ct2)
|
||||||
@ -551,6 +555,7 @@ class CVSuite:
|
|||||||
|
|
||||||
# Write results to CSV file
|
# Write results to CSV file
|
||||||
if not part_update:
|
if not part_update:
|
||||||
|
if self.models != []:
|
||||||
self.runTest(self.log.data)
|
self.runTest(self.log.data)
|
||||||
self.drawConfusionMatrix()
|
self.drawConfusionMatrix()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user