Scaling images for the YOLO's Network

In the first programming assignment of week 3 on car detection:

boxes = scale_boxes(boxes, image_shape)

YOLO’s network was trained to run on 608x608 images. If you are testing this data on a different size image – for example, the car detection dataset had 720x1280 images – this step rescales the boxes so that they can be plotted on top of the original 720x1280 image.

The sample code applies score-filtering, rescaling to the original image and non_max suppression in that order. Shouldn’t the rescaling be done after non-max suppression as the boxes are specific to the YOLO network’s 608 x 608 resolution?

(Reordering anyway works in the exercise because the image_shape (input shape) is also 608 x 608)

Hi Shr,

As far as I can see, the order does not matter because yolo_model is called before yolo_eval, so the boxes are not passed through yolo_model again in yolo_eval. Only custom code is used in yolo_non_max_suppression, where selection is based on the values in scores and boxes are only passed along to retain the link with scores.

If I understand the OP, the concern is about rescaling impacting non-max-suppression. But NMS uses IOU to compute the similarity of two boxes. Wouldn’t that be unchanged by rescaling both inputs by the same factor?

To the best of my knowledge, the rescaling is done purely for visualization so the drawn box sits correctly on the object it was derived from. It really plays no role in YOLO itself.