Problem in scale_boxes(boxes, image_shape) function in C4W3 Assignment "Car detection with YOLO"

In the yolo_eval() function two functions are called named “yolo_boxes_to_corners(box_xy,box_wh)” and “scale_boxes(boxes, image_shape)”. But there is no function named “scale_boxes(boxes, image_shape)” defined in the jupyter notebook. Due to this I am getting syntax error.
Any assistance will be highly appreciated.

In the first cell, please see that scale_boxes is imported from yad2k.utils.utils.

from yad2k.utils.utils import draw_boxes, get_colors_for_classes, scale_boxes, read_classes, read_anchors, preprocess_image

Have you run all the above cells? Please share your full error.

1 Like

I figured out the error. The syntax error was due to previous line in which I forgot to add the closing bracket. Also then I checked that, this function is defined in the “utils” sub directory. Still thanks for your help.

1 Like

This is very common in Python. The interpreter ingests tokens until something happens that either ends an expression or breaks a rule. When a rule is broken, the syntax error output shows you where the issue was detected even though that is frequently not the root cause. When the error message points at the beginning of a line of code, always start debugging by looking back one line. HTH

2 Likes