# Week 3 Autonomous\_driving\_application\_Car\_detection

**URL:** <https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720>\
**Category:** Convolutional Neural Networks\
**Tags:** coursera-platform\
**Created:** [June 15, 2022, 3:53pm UTC](https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720 "2022-06-15T15:53:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![amulya](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@amulya](https://community.deeplearning.ai/u/amulya)\
**Post date:** [June 15, 2022, 3:53pm UTC](https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720/1 "2022-06-15T15:53:48Z")

</div>

ValueError: operands could not be broadcast together with shapes (19,19,5,4) (19,19,5,80)  
please help !

---

<div class="post-metadata">

**Author:** ![gent.spah](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/gent.spah/32/136423_2.png) [@gent.spah](https://community.deeplearning.ai/u/gent.spah)\
**Post date:** [June 15, 2022, 4:05pm UTC](https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720/2 "2022-06-15T16:05:44Z")

</div>

The error means that because those lists/tensors/arrays do not have the same shape then mathematical operations can not be performed. Try to arrange those such that they have the same shape!

---

<div class="post-metadata">

**Author:** ![MayankGhogale](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@MayankGhogale](https://community.deeplearning.ai/u/MayankGhogale)\
**Post date:** [June 15, 2022, 4:57pm UTC](https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720/3 "2022-06-15T16:57:21Z")

</div>

Hey,

Yes,please check your code once for the shapes and if the error still exists then please do let us know

Hope this helps

Thanks and Regards,

Mayank Ghogale

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [June 15, 2022, 7:21pm UTC](https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720/4 "2022-06-15T19:21:43Z")

</div>

> [@amulya](#):
>
> ValueError: operands could not be broadcast together with shapes (19,19,5,4) (19,19,5,80)  
> please help !

You don’t say which function threw this error, but it’s a common problem. I’m guessing it’s _yolo\_filter\_boxes_. I added a bunch of print statements to my code and here’s what I see from the test cell for _yolo\_filter\_boxes_:

```auto
boxes.shape (19, 19, 5, 4)
boxes.dtype <dtype: 'float32'>
box_scores.shape (19, 19, 5, 80)
box_scores.dtype <dtype: 'float32'>
box_classes.shape (19, 19, 5)
box_classes.dtype <dtype: 'int64'>
box_class_scores.shape (19, 19, 5)
box_class_scores.dtype <dtype: 'float32'>
filtering_mask.shape (19, 19, 5)
filtering_mask.dtype <dtype: 'bool'>
scores[2] = 9.270486
boxes[2] = [4.6399336 3.2303846 4.431282 -2.202031]
classes[2] = 8
scores.shape = (1789,)
boxes.shape = (1789, 4)
classes.shape = (1789,)
 All tests passed!

```

Compare that to what you see and perhaps that will point you to where your code is going off the rails.

If that doesn’t get you there, it would be useful to actually see the full exception trace that you get when it fails.

---

<div class="post-metadata">

**Author:** ![amulya](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@amulya](https://community.deeplearning.ai/u/amulya)\
**Post date:** [June 17, 2022, 4:35am UTC](https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720/5 "2022-06-17T04:35:49Z")

</div>

This error is only occuring when I call yolo\_eval function! I passed all the above tests! I tried your method and the vector shapes match so I can’t figure out what is the real issue

---

<div class="post-metadata">

**Author:** ![amulya](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@amulya](https://community.deeplearning.ai/u/amulya)\
**Post date:** [June 17, 2022, 4:36am UTC](https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720/6 "2022-06-17T04:36:56Z")

</div>

This error is only occuring when I call yolo\_eval function! I passed all the above tests! I tried your method and the vector shapes match so I can’t figure out what is the real issue

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [June 17, 2022, 4:41am UTC](https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720/7 "2022-06-17T04:41:14Z")

</div>

Did you copy your solution from the Internet? If so, you might want to compare the way you are invoking the function _yolo\_filter\_boxes_ when you call it from _yolo\_eval_ with the definition of that function. They changed the definition of that API in the April 2021 upgrade to these courses and old solutions you find on the Internet use a different API definition. The order of the arguments changed.

---

<div class="post-metadata">

**Author:** ![amulya](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@amulya](https://community.deeplearning.ai/u/amulya)\
**Post date:** [June 17, 2022, 4:54am UTC](https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720/8 "2022-06-17T04:54:29Z")

</div>

Thank you very much! Indeed it was the order placement that was throwing the error! resolved it!

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [June 17, 2022, 4:56am UTC](https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720/9 "2022-06-17T04:56:02Z")

</div>

I’m glad to hear that you were able to find the error. Just as a general matter, please note that copying code off the Internet is a) a violation of the rules and b) doesn’t always work, as in this case, and can thus end up just wasting your time. 🤓 Please note that these courses were significantly changed in April of 2021, so there is no guarantee that solutions you find on the internet still work. They might be from the old version of the courses.

---

<div class="post-metadata">

**Author:** ![amulya](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@amulya](https://community.deeplearning.ai/u/amulya)\
**Post date:** [June 17, 2022, 4:57am UTC](https://community.deeplearning.ai/t/week-3-autonomous-driving-application-car-detection/138720/10 "2022-06-17T04:57:27Z")

</div>

I am not really copying the code! I use it as a reference but then last block only involved calling the functions hence I didn’t bother writing it on my own! Will ensure that I don’t repeat this mistake! thank you!
