# Problem in scale\_boxes(boxes, image\_shape) function in C4W3 Assignment "Car detection with YOLO"

**URL:** <https://community.deeplearning.ai/t/problem-in-scale-boxes-boxes-image-shape-function-in-c4w3-assignment-car-detection-with-yolo/410457>\
**Category:** Convolutional Neural Networks\
**Tags:** coursera-platform\
**Created:** [August 7, 2023, 6:47am UTC](https://community.deeplearning.ai/t/problem-in-scale-boxes-boxes-image-shape-function-in-c4w3-assignment-car-detection-with-yolo/410457 "2023-08-07T06:47:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sengourav012](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@sengourav012](https://community.deeplearning.ai/u/sengourav012)\
**Post date:** [August 7, 2023, 6:47am UTC](https://community.deeplearning.ai/t/problem-in-scale-boxes-boxes-image-shape-function-in-c4w3-assignment-car-detection-with-yolo/410457/1 "2023-08-07T06:47:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![saifkhanengr](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/saifkhanengr/32/152858_2.png) [@saifkhanengr](https://community.deeplearning.ai/u/saifkhanengr)\
**Post date:** [August 7, 2023, 6:57am UTC](https://community.deeplearning.ai/t/problem-in-scale-boxes-boxes-image-shape-function-in-c4w3-assignment-car-detection-with-yolo/410457/2 "2023-08-07T06:57:55Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![sengourav012](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@sengourav012](https://community.deeplearning.ai/u/sengourav012)\
**Post date:** [August 7, 2023, 7:27am UTC](https://community.deeplearning.ai/t/problem-in-scale-boxes-boxes-image-shape-function-in-c4w3-assignment-car-detection-with-yolo/410457/3 "2023-08-07T07:27:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ai\_curious](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/ai_curious/32/128003_2.png) [@ai\_curious](https://community.deeplearning.ai/u/ai_curious)\
**Post date:** [August 7, 2023, 12:39pm UTC](https://community.deeplearning.ai/t/problem-in-scale-boxes-boxes-image-shape-function-in-c4w3-assignment-car-detection-with-yolo/410457/4 "2023-08-07T12:39:42Z")

</div>

> [@sengourav012](#):
>
> The syntax error was due to previous line

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
