Еще один способ сделать это – использовать Читать
image = Chitra(img_path, box, label) # Chitra can rescale your bounding box automatically based on the new image size. image.resize_image_with_bbox((224, 224)) print('rescaled bbox:', image.bounding_boxes) plt.imshow(image.draw_boxes())
https://chitra.readthedocs.io/en/latest/
Пип Установите Chitra
📝 Документы: https://chitra.readthedocs.io/en/latest/
Оригинал: “https://dev.to/aniketmaurya/answer-resizing-image-and-its-bounding-box-5c5d”