How to draw bounding rectangles on the detected parts of the image

Hey there, I was wondering if anyone can help me with my inference code.

So, my script is predicting the class of the image. Say I have classes as a ball, a bat and an apple. My code predicts its a ball ( suppose I passed an image of the ball). My question is how can I draw a bounding rectangle around the ball.

From a very quick read it looks like your model is only doing classification no? btw the link is broken as you changed the name of the file.

You will need a model that does detection so that it will provide you with bounding boxes for objects it detects.

I got your point could you please point me at a example or a project, I can get reference from ??

Hi. If you didnt know already the class of problems you are referring to are called “object detection”.

There a multiple deep learning approaches to this problem such as R-CNN, Fast R-CNN, YOLO etc.
Here is an example of one such implementation https://github.com/eriklindernoren/PyTorch-YOLOv3.git
I strongly suggest you this lecture for an overview https://www.youtube.com/watch?v=nDPWywWRIRo

1 Like