-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Keras 3 example for "Audio track separation" #2003
Add Keras 3 example for "Audio track separation" #2003
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! This is excellent work, I enjoyed reading through it 👍
import numpy as np | ||
import soundfile as sf | ||
from IPython import display | ||
from keras import callbacks, layers, ops, optimizers, saving, utils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only keep layers, ops, callbacks -- they are used many times. However optimizers, saving, utils are only used 1-2x so you can just do e.g. keras.optimizers.Adam
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up needing many more uses of saving in refactor, so I kept that import, removed the rest
|
||
|
||
@saving.register_keras_serializable() | ||
class TDF(layers.Layer): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can there be a more explicit name?
|
||
|
||
@saving.register_keras_serializable() | ||
class TFC(layers.Layer): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here?
else: | ||
model = tfc_tdf_net(keras.Input(sample_batch_x.shape[1:]), name="tfc_tdf_net") | ||
|
||
model.summary() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be useful to plot the model, or is the result too busy? e.g. keras.utils.plot_model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok -- your call on whether to include it.
Hi @fchollet , Thanks for the feedback! I did a small refactor to further group TFC_TDF and Downsample/Upsample blocks into custom layers so they could be better visualized in a plot. I also renamed symbols to further avoid abbreviations and updated some docstrings to reflect the changes. The code is currently working on all frameworks after these changes. Also the convert script still runs correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update -- the changes are looking good! Please add the generated files.
Hi again, I have just pushed the generated files. I also updated layer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Thank you for the excellent contribution!
Hi, I saw "Audio track separation" in the call for contributions, so I implemented an example that separates the vocal track from songs in the MUSDB18 dataset.
Some notes:
Please let me know if there is anything wrong with the provided script I may have missed.
Thanks!