Course 5 - Week 3 - Assignment 2: Spectrogram is wrong

Hello,

I can’t understand why the create_training_example funciton is returning a wrong Spectrogram.

My insert_audio_clip functions where used firstly as
background, segment_time = insert_audio_clip(background, random_activate, previous_segments)
and then as
background, _ = insert_audio_clip(background, random_negative, previous_segments)

Can someone help?

Maybe the problem is in your insert_audio_clip() function.

1 Like

Even if the unit tests of that function were passing, I refactored it and now everything works fine.

Thanks for the support

Passing the unit tests does not mean your code is perfect. There are lots of errors that the unit tests do not catch.

@TMosh and @Orty , I am getting the exact same error in Ex4:

“Spectrogram is wrong. Check the parameters passed to the insert_audio_clip function”

I am passing the exact same thing as Orty writes here above. So I assume that the error then is in insert_audio_clip(). Is there any hint on what can be wrong in the insert_audio_clip()? I am also getting “all tests passed”, so a hint on where the students normally makes mistakes here would be appreciated :slight_smile:

Thanks!

There isn’t much of a trend of errors on this function, because it’s not reported on the forum very often.

@TMosh Ok, I continued with the last exercise in the assignment and then got 100% on the grader. I see that some others encounter this as well. Maybe something for the @DeepLearning.AI-Team to look into?

Regardless, thanks for your answer TMosh.

It’s important to run all of the cells in the notebook in order each time you open it to begin work, and in some cases you can’t even go back and re-run specific cells because it corrupts some global variables.

Maybe you bumped into this limitation.