Sequential Models: Trigger word attention

Hello everybody!

I’m having slight problems on the trigger word detection at week3 of sequential models course. I am stuck on exercise 4 because it outputs this problem which I can’t resolve. I have passed the previous function tests. I have searched similar problems on this forum but it didn’t help much.

If anybody could spend some of your precious time and look at my notebook, it would be greatly appreciated!

Personally I think the problem comes from the empty previous_segments that we set up.
Because it is empty, there is no segments to be iterated.
Repository link: GitHub - JakeDaDogg/trigger-word-detection

Much thanks,

Please share full error…

1 Like

I don’t see any mistake in your code. Have you changed any of the pre-written code, especially the below one:

# Select 0-4 random "activate" audio clips from the entire list of "activates" recordings
number_of_activates = np.random.randint(0, 5)
random_indices = np.random.randint(len(activates), size=number_of_activates)
random_activates = [activates[i] for i in random_indices]
1 Like

Not that I would recall! I did update my lab to a new environment due to too much modifications in this session!

I did recognize that this is the pre-written code in the cell, I think I didn’t do any thing to it.

Please send me your notebook in a private message. Click my name and message.

Thank you for sending me your notebook @Chiang_Yuhan.

Alright. The mistake is in your insert_audio_clip function. It is given that:

# Step 3: Append the new segment_time to the list of previous_segments (≈ 1 line

Please use the append() or .append method, instead of += operator, to append the new segment_time to the list of previous_segments.

Here is the output of using your method and the one that is recommended to use:

Your method's output:
previous_segments: [(0, 4400), 7286, 8201]

Recommended method's output:
previous_segments: [(0, 4400), (7286, 8201)]

Did you see the difference?
Your method: the individual elements of segment_time added separately to previous_segments
Recommended method: each time segment represented as a tuple in the list

1 Like

I see the difference! Changing the code right now!