Skip to content

How to create a TFJS model? #297

Answered by kahst
Mattk70 asked this question in Q&A
Mar 31, 2024 · 2 comments · 7 replies
Discussion options

You must be logged in to vote

Ah, yes, that's tricky. You need the original Keras model.

Can you try the following workflow (using TF 2.15)?

  • download the .h5 file here
  • implement the custom spectrogram layer like this:
import tensorflow as tf

class MelSpecLayerSimple(tf.keras.layers.Layer):

    def __init__(self, sample_rate, spec_shape, frame_step, frame_length, fmin, fmax, data_format, **kwargs):
        super(MelSpecLayerSimple, self).__init__(**kwargs)
        self.sample_rate = sample_rate
        self.spec_shape = spec_shape
        self.data_format = data_format
        self.frame_step = frame_step
        self.frame_length = frame_length
        self.fmin=fmin
        self.fmax=fmax

        self.mel_filter…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
6 replies
@Mattk70
Comment options

@Mattk70
Comment options

@tphakala
Comment options

@Mattk70
Comment options

@tphakala
Comment options

Answer selected by Mattk70
Comment options

You must be logged in to vote
1 reply
@Mattk70
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants