-1

I have a custom trained yolov5 model trained on traffic sign boards. It draws a bounding box around the traffic sign board whenever it recognizes a traffic sign. I want that bounding box to be saved as an image in a custom folder.

Do I have to make changes in any file of yolo v5.

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36

1 Answers1

1

You will probably have a line in the file that looks more or less like this:

cv2.rectangle(image, (x, y), (x+w, y+h), (255, 255, 255), 3)

In this case, 'image' means the name of the variable that holds your image. With this line of code, the bounding box is applied.

To save the resulting image to a file, you can use the imwrite method:

cv2.imwrite('folder/filename.bmp', image)

where 'image' is the variable storing the image (in your case it may be named different - check the line above with "rectangle" method). Also, please specify the folder and file name in quotes. The folder does not need to be created by you before the moment of saving.

W_999
  • 11
  • 3