Для себя Здравствуйте. У меня есть вопрос. Я хочу найти изображения с наибольшей вероятностью предсказания (т. е. ближе всего к 1,0) с предсказанным классом NORMAL (т. е. 1). indices = get_images_with_sorted_probabilities(prediction_table, get_highest_probability=True, label=1, number_of_items=10, only_false_predictions=False) message = 'Images with the highest probability of containing NORMAL' display(indices, message) Он пишет ошибку ValueError Traceback (most recent call last) in () 30 only_false_predictions=False) 31 message = 'Images with the highest probability of containing NORMAL' ---> 32 display(indices, message) 33 34 # display(indices[:10], message) - в учебнике 6 frames /usr/local/lib/python3.10/dist-packages/matplotlib/gridspec.py in __init__(self, nrows, ncols, height_ratios, width_ratios) 47 “““ 48 if not isinstance(nrows, Integral) or nrows <= 0: ---> 49 raise ValueError( 50 f“Number of rows must be a positive integer, not {nrows!r}“) 51 if not isinstance(ncols, Integral) or ncols <= 0: ValueError: Number of rows must be a positive integer, not 2.25 ValueError: Количество строк должно быть целым положительным числом, а не 2,25. Если найдем изображения, опознанные моделью как 'NORMAL', но с малой долей уверенности : indices_2 = get_images_with_sorted_probabilities(prediction_table, get_highest_probability=False, label=1, number_of_items=10, only_false_predictions=False) message = 'Images with lowest probability of containing NORMAL' display(indices_2, message) то получим ошибку ValueError Traceback (most recent call last) in | () 6 only_false_predictions=False) 7 message = 'Images with lowest probability of containing NORMAL' ----> 8 display(indices_2, message) 6 frames /usr/local/lib/python3.10/dist-packages/matplotlib/gridspec.py in __init__(self, nrows, ncols, height_ratios, width_ratios) 47 “““ 48 if not isinstance(nrows, Integral) or nrows <= 0: ---> 49 raise ValueError( 50 f“Number of rows must be a positive integer, not {nrows!r}“) 51 if not isinstance(ncols, Integral) or ncols <= 0: ValueError: Number of rows must be a positive integer, not 3.0 ValueError: количество строк должно быть положительным целым числом, а не 3,0. Отсюда вопросы: 1. Ну, с 2,25 все понятно, но что не устроило в 3,0. Это же положительное целое число. 2. Как написать код,чтобы все устроило. Спасибо. | |