Programming Assignment error: Car detection with YOLO - Non max suppression

When creating a post, please add:

  • Week # must be added in the tags option of the post.
  • Link to the classroom item you are referring to:
  • Description (include relevant info but please do not post solution code or your entire notebook)

Hello

Struggling with something clearly very basic. I get a “‘yolo_non_max_suppression’ is not defined” error when I try to run the code and I am not sure what I am doing wrong.


{moderator edit - solution code removed}

What am I doing wrong here?
Thanks

If you are getting a “function not defined” error, then it must be something structural. Are you sure you didn’t accidentally turn the function cell into a “Markdown” cell instead of a code cell? Also note the more basic point that just typing code into a cell doesn’t have any effect until you actually execute that cell by clicking it and either clicking “Shift-Enter” or “Cell → Run Cells”.

Also notice that in the loop there, we are handling the boxes and scores that match one particular label, but that is not what your code is doing, right?

But that should not cause a “function not defined” error … So there may be at least two layers of issues here. Once you solve the structural problem and can run the code, it’s likely going to fail the test cases. :nerd_face:

Thank you Paul.

I am getting a syntax error when I try to concatenate which should be straightforward but I cannot see what I am doing wrong. Maybe I am messing up the tensor shapes which is causing the error but that doesnt seem to be the case.

Please show us a screenshot of the actual error trace that you are getting. If it’s a syntax error, then it can’t have to do with shapes, right?

Actually you can see the syntax error in the source that you posted earlier: you are missing a close paren on the “append” line.

Note that the editor in the notebook is “syntax aware”: just click on a paren or brace and it will highlight the matching one. Or not :scream_cat:

Ah yes, thanks. That is embarrassingly silly of me !

The code still doesnt compile as I get the below error when I run the unit test for yolo_non_max_suppression. I’ll go through the code again from scratch and see whats going on.

InvalidArgumentError: indices[1] = 1 is not in [0, 1) [Op:GatherV2]

Did you take care of the other point that I made above? The fact that in the loop, we are handling the boxes and scores only for one label. That’s not how you had originally written the code.