guoqing bakeup
This commit is contained in:
@ -39,30 +39,23 @@ def read_one2one_data(filepath):
|
||||
if len(simi_dict): simiList.append(simi_dict)
|
||||
|
||||
return simiList
|
||||
|
||||
def main():
|
||||
filepath = r"\\192.168.1.28\share\测试_202406\0910\images\OneToOneCompare.txt"
|
||||
|
||||
def plot_pr_curve(matrix):
|
||||
|
||||
simiList = read_one2one_data(filepath)
|
||||
simimax, simimean = [], []
|
||||
small = []
|
||||
for simidict in simiList:
|
||||
need_analysis = []
|
||||
for simidict in matrix:
|
||||
simimax.append(simidict["simi_max"])
|
||||
simimean.append(simidict["simi_min"])
|
||||
if simidict["simi_max"]<0.6:
|
||||
small.append(simidict)
|
||||
|
||||
|
||||
if simidict["simi_max"]>0.6:
|
||||
need_analysis.append(simidict)
|
||||
|
||||
simimax = np.array(simimax)
|
||||
simimean = np.array(simimean)
|
||||
|
||||
|
||||
|
||||
|
||||
TPFN_max = len(simimax)
|
||||
TPFN_mean = len(simimean)
|
||||
|
||||
|
||||
|
||||
|
||||
fig, axs = plt.subplots(2, 1)
|
||||
axs[0].hist(simimax, bins=60, edgecolor='black')
|
||||
axs[0].set_xlim([-0.2, 1])
|
||||
@ -71,14 +64,12 @@ def main():
|
||||
axs[1].set_xlim([-0.2, 1])
|
||||
axs[1].set_title(f'Cross Barcode, Num: {TPFN_mean}')
|
||||
# plt.savefig(f'./result/{file}_hist.png') # svg, png, pdf
|
||||
|
||||
|
||||
|
||||
|
||||
Recall_Pos = []
|
||||
Thresh = np.linspace(-0.2, 1, 100)
|
||||
for th in Thresh:
|
||||
TP = np.sum(simimax > th)
|
||||
Recall_Pos.append(TP/TPFN_max)
|
||||
TN = np.sum(simimax < th)
|
||||
Recall_Pos.append(TN/TPFN_max)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
ax.plot(Thresh, Recall_Pos, 'b', label='Recall_Pos: TP/TPFN')
|
||||
@ -91,19 +82,48 @@ def main():
|
||||
plt.show()
|
||||
# plt.savefig(f'./result/{file}_pr.png') # svg, png, pdf
|
||||
|
||||
print("Have done!")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print("Have done!")
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
filepaths = [r"\\192.168.1.28\share\测试_202406\0913_扫A放B\0913_1\OneToOneCompare.txt",
|
||||
r"\\192.168.1.28\share\测试_202406\0913_扫A放B\0913_2\OneToOneCompare.txt",
|
||||
r"\\192.168.1.28\share\测试_202406\0914_扫A放B\0914_1\OneToOneCompare.txt",
|
||||
r"\\192.168.1.28\share\测试_202406\0914_扫A放B\0914_2\OneToOneCompare.txt"
|
||||
]
|
||||
|
||||
simiList = []
|
||||
for fp in filepaths:
|
||||
slist = read_one2one_data(fp)
|
||||
|
||||
simiList.extend(slist)
|
||||
|
||||
|
||||
|
||||
|
||||
plot_pr_curve(simiList)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user