class PlateString:
def __init__(self, threshold=0.05):
self.threshold = threshold
self.max_list_from_all_plates = []
for single_lp in seq:
max_list = []
plateresults = []
for sign in single_lp:
high_indexes = []
for prob_id in range(0,len(sign)):
if self.threshold<sign[prob_id]:
high_indexes.append([sign[prob_id], prob_id, CATEGORIES[prob_id]])
max_list.append(high_indexes)
self.max_list_from_all_plates.append(max_list)
self.listaMain = []
def makelist(self):
list1 = []
list2 = []
for plate in self.max_list_from_all_plates:
#maxlen = 0
#if len(plate) > maxlen:
# maxlen = len(plate)
#if len(plate) == maxlen:
# pass
textPlate : str= ""
sumplate = 0
for probabilities in plate:
znakMax : str = ""
probabilityMax : float = 0
for probability in probabilities:
if(probabilityMax<probability[0]):
probabilityMax = probability[0]
znakMax = probability[2]
valMax = probability[0]
textPlate += znakMax
sumplate += valMax
list1.append(textPlate)
list2.append(sumplate)
for i in range(len(list1)):
info = [list1[i], list2[i]]
self.listaMain.append(info)
print(self.listaMain)
self.findtotal()
def findtotal(self):
for i in self.listaMain:
print(i)
itemmax = (max(i[-1] for i in self.listaMain))
return (itemmax)
if __name__ == '__main__':
PlateString(threshold=0.05).makelist()
#PlateString(threshold=0.05).findtotal()
output:
[['JJ788RK', 2.709], ['JJ788RK', 2.601], ['JJ788RK', 2.155], ['JJ788RK', 2.4050000000000002], ['J7J88RK', 2.5060000000000002], ['JJ788RK', 2.5589999999999997], ['JJ788RK', 2.098]]
['JJ788RK', 2.709]