C5W3 Trigger Word Detection (create_training_example_test)

Hi all! I am getting the following error:

TypeError                                 Traceback (most recent call last)
<ipython-input-36-6643a2b10ec5> in <module>
     17     print("\033[92m All tests passed!")
     18 
---> 19 create_training_example_test(create_training_example)

<ipython-input-36-6643a2b10ec5> in create_training_example_test(target)
      2 def create_training_example_test(target):
      3     np.random.seed(18)
----> 4     x, y = target(backgrounds[0], activates, negatives, 1375)
      5 
      6     assert type(x) == np.ndarray, "Wrong type for x"

<ipython-input-35-d40d0132a8d9> in create_training_example(background, activates, negatives, Ty)
     41 
     42         print(segment_time)
---> 43         segment_start, segment_end = get_random_time_segment(segment_time)
     44         # Insert labels in "y" at segment_end
     45         y = insert_ones(y,segment_end)

<ipython-input-11-c0fa07415697> in get_random_time_segment(segment_ms)
     10     """
     11 
---> 12     segment_start = np.random.randint(low=0, high=10000-segment_ms)   # Make sure segment doesn't run past the 10sec background
     13     segment_end = segment_start + segment_ms - 1
     14 

TypeError: unsupported operand type(s) for -: 'int' and 'tuple'

Sadly, I don’t get it. Isn’t segment_time supposed to be a tuple?

Does your create_training_example() use insert_audio_clip()?

Yes in the previous line.

Update: I tried that without using the function get_random_time_segment and apparently worked. I thought a random segment should have been taken. Could you elaborate on it?

get_random_time_segment() should be used in insert_audio_clip().