Добрый день, хотела бы исправить ошибку во второй части алгоритма на пайтон .код на пайтон:
if __name__ == "__main__":
max_index = 0
max_list_from_all_plates = []
accuracy = 0
threshold = 0.05
for single_lp in seq:
maximum_plate_prob = []
possible_plate_prob = []
max_list = []
for sign in single_lp:
high_indexes = []
for prob_id in range(0,len(sign)):
if threshold<sign[prob_id]:
high_indexes.append([sign[prob_id], prob_id, CATEGORIES[prob_id]])
max_list.append(high_indexes)
max_list_from_all_plates.append(max_list)
listy = []
lista = []
#print(max_list_from_all_plates)
print(high_indexes)
maxProbIds = []
currentMaxIDs = []
for letterProbability in max_list:
ids = []
maxValID = 0
for probabilityId in range(0, len(letterProbability)):
if(letterProbability[probabilityId]>letterProbability[maxValID]):
maxValID = probabilityId
print("letterProbability", letterProbability[probabilityId])
if(letterProbability[probabilityId][0]>threshold):
ids.append(probabilityId)
if(len(ids)==0):
ids.append(maxValID)
accuracy += letterProbability[maxValID][0]
maxProbIds.append(ids)
currentMaxIDs.append(maxValID)
accuracy /= float(len(high_indexes))
currentText = ""
predictionShow = ""
for i in range(len(currentMaxIDs)):
print("i", i)
print("currentMaxIDs", currentMaxIDs)
predictionShow += CATEGORIES[currentMaxIDs[0][i]]+ ": " + str(high_indexes[0][i][currentMaxIDs[i]]) + " "
high_indexes = список данных нп.
[[0.164, 4, ‘4’], [0.06, 6, ‘6’], [0.383, 20, ‘K’], [0.063, 22, ‘M’]]