Skip to content

Commit

Permalink
In the STFT tutorial, take the images from the keras-team/keras-io re…
Browse files Browse the repository at this point in the history
…po instead of a personal repository. (#1958)
  • Loading branch information
mostafa-mahmoud authored Oct 17, 2024
1 parent c91cce7 commit 5f278fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
16 changes: 6 additions & 10 deletions examples/audio/md/stft.md
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ plt.show()



![png](https://github.com/mostafa-mahmoud/keras-io/blob/master/examples/audio/img/stft/raw_audio.png)
![png](https://github.com/keras-team/keras-io/blob/master/examples/audio/img/stft/raw_audio.png)



Expand All @@ -618,7 +618,7 @@ plot_single_spectrogram(sample_wav_data)



![png](https://github.com/mostafa-mahmoud/keras-io/blob/master/examples/audio/img/stft/spectrogram.png)
![png](https://github.com/keras-team/keras-io/blob/master/examples/audio/img/stft/spectrogram.png)



Expand All @@ -631,7 +631,7 @@ plot_multi_bandwidth_spectrogram(sample_wav_data)



![png](https://github.com/mostafa-mahmoud/keras-io/blob/master/examples/audio/img/stft/multiband_spectrogram.png)
![png](https://github.com/keras-team/keras-io/blob/master/examples/audio/img/stft/multiband_spectrogram.png)



Expand All @@ -643,9 +643,7 @@ def read_dataset(df, folds):
msk = df["fold"].isin(folds)
filenames = df["filename"][msk]
targets = df["target"][msk].values
waves = np.array(
[read_wav_file(fil) for fil in filenames], dtype=np.float32
)
waves = np.array([read_wav_file(fil) for fil in filenames], dtype=np.float32)
return waves, targets
```

Expand Down Expand Up @@ -1790,7 +1788,7 @@ plt.show()



![png](https://github.com/mostafa-mahmoud/keras-io/blob/master/examples/audio/img/stft/training.png)
![png](https://github.com/keras-team/keras-io/blob/master/examples/audio/img/stft/training.png)



Expand All @@ -1802,9 +1800,7 @@ Running the models on the test set.

```python
_, test_acc = model1d.evaluate(test_x, test_y)
print(
f"1D model wit non-trainable STFT -> Test Accuracy: {test_acc * 100:.2f}%"
)
print(f"1D model wit non-trainable STFT -> Test Accuracy: {test_acc * 100:.2f}%")
```

3/3 ━━━━━━━━━━━━━━━━━━━━ 3s 307ms/step - accuracy: 0.8148 - loss: 0.6244
Expand Down
18 changes: 7 additions & 11 deletions templates/examples/audio/stft.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
**Description:** Introducing the `STFTSpectrogram` layer to extract spectrograms for audio classification.


<div class='example_version_banner keras_3'>ⓘ This example uses Keras 3</div>
<img class="k-inline-icon" src="https://colab.research.google.com/img/colab_favicon.ico"/> [**View in Colab**](https://colab.research.google.com/github/keras-team/keras-io/blob/master/examples/audio/ipynb/stft.ipynb) <span class="k-dot">•</span><img class="k-inline-icon" src="https://github.com/favicon.ico"/> [**GitHub source**](https://github.com/keras-team/keras-io/blob/master/examples/audio/stft.py)


Expand Down Expand Up @@ -52,7 +53,6 @@ import scipy.io.wavfile
from keras import layers
from scipy.signal import resample

np.random.seed(41)
keras.utils.set_random_seed(41)
```

Expand Down Expand Up @@ -606,7 +606,7 @@ plt.show()



![png](https://github.com/mostafa-mahmoud/keras-io/blob/master/examples/audio/img/stft/raw_audio.png)
![png](https://github.com/keras-team/keras-io/blob/master/examples/audio/img/stft/raw_audio.png)



Expand All @@ -619,7 +619,7 @@ plot_single_spectrogram(sample_wav_data)



![png](https://github.com/mostafa-mahmoud/keras-io/blob/master/examples/audio/img/stft/spectrogram.png)
![png](https://github.com/keras-team/keras-io/blob/master/examples/audio/img/stft/spectrogram.png)



Expand All @@ -632,7 +632,7 @@ plot_multi_bandwidth_spectrogram(sample_wav_data)



![png](https://github.com/mostafa-mahmoud/keras-io/blob/master/examples/audio/img/stft/multiband_spectrogram.png)
![png](https://github.com/keras-team/keras-io/blob/master/examples/audio/img/stft/multiband_spectrogram.png)



Expand All @@ -644,9 +644,7 @@ def read_dataset(df, folds):
msk = df["fold"].isin(folds)
filenames = df["filename"][msk]
targets = df["target"][msk].values
waves = np.array(
[read_wav_file(fil) for fil in filenames], dtype=np.float32
)
waves = np.array([read_wav_file(fil) for fil in filenames], dtype=np.float32)
return waves, targets
```

Expand Down Expand Up @@ -1791,7 +1789,7 @@ plt.show()



![png](https://github.com/mostafa-mahmoud/keras-io/blob/master/examples/audio/img/stft/training.png)
![png](https://github.com/keras-team/keras-io/blob/master/examples/audio/img/stft/training.png)



Expand All @@ -1803,9 +1801,7 @@ Running the models on the test set.

```python
_, test_acc = model1d.evaluate(test_x, test_y)
print(
f"1D model wit non-trainable STFT -> Test Accuracy: {test_acc * 100:.2f}%"
)
print(f"1D model wit non-trainable STFT -> Test Accuracy: {test_acc * 100:.2f}%")
```

3/3 ━━━━━━━━━━━━━━━━━━━━ 3s 307ms/step - accuracy: 0.8148 - loss: 0.6244
Expand Down

0 comments on commit 5f278fd

Please sign in to comment.