智能秤分析

This commit is contained in:
lee
2025-08-06 17:03:28 +08:00
parent 54898e30ec
commit 3392d76e38
17 changed files with 572 additions and 54 deletions

View File

@ -17,7 +17,7 @@ from configs import trainer_tools
import yaml
from datetime import datetime
with open('../configs/test.yml', 'r') as f:
with open('./configs/test.yml', 'r') as f:
conf = yaml.load(f, Loader=yaml.FullLoader)
# Constants from config
@ -141,7 +141,7 @@ def threshold_search(y_score, y_true):
def showgrid(recall, recall_TN, PrecisePos, PreciseNeg, Correct):
x = np.linspace(start=0, stop=1.0, num=50, endpoint=True).tolist()
x = np.linspace(start=-1, stop=1.0, num=100, endpoint=True).tolist()
plt.figure(figsize=(10, 6))
plt.plot(x, recall, color='red', label='recall:TP/TPFN')
plt.plot(x, recall_TN, color='black', label='recall_TN:TN/TNFP')
@ -151,6 +151,7 @@ def showgrid(recall, recall_TN, PrecisePos, PreciseNeg, Correct):
plt.legend()
plt.xlabel('threshold')
# plt.ylabel('Similarity')
plt.grid(True, linestyle='--', alpha=0.5)
plt.savefig('grid.png')
plt.show()
@ -162,19 +163,19 @@ def showHist(same, cross):
Cross = np.array(cross)
fig, axs = plt.subplots(2, 1)
axs[0].hist(Same, bins=50, edgecolor='black')
axs[0].set_xlim([-0.1, 1])
axs[0].hist(Same, bins=100, edgecolor='black')
axs[0].set_xlim([-1, 1])
axs[0].set_title('Same Barcode')
axs[1].hist(Cross, bins=50, edgecolor='black')
axs[1].set_xlim([-0.1, 1])
axs[1].hist(Cross, bins=100, edgecolor='black')
axs[1].set_xlim([-1, 1])
axs[1].set_title('Cross Barcode')
plt.savefig('plot.png')
def compute_accuracy_recall(score, labels):
th = 0.1
squence = np.linspace(-1, 1, num=50)
squence = np.linspace(-1, 1, num=100)
recall, PrecisePos, PreciseNeg, recall_TN, Correct = [], [], [], [], []
Same = score[:len(score) // 2]
Cross = score[len(score) // 2:]