Thursday, 28 March 2019

Convert Convnet.js neural network model to Keras Tensorflow

I have a neural network model that is created in convnet.js that I have to define using Keras. Does anyone have an idea how can I do that?

neural = {
          net : new convnetjs.Net(),
          layer_defs : [
            {type:'input', out_sx:4, out_sy:4, out_depth:1},
            {type:'fc', num_neurons:25, activation:"regression"},
            {type:'regression', num_neurons:5}
          ],
          neuralDepth: 1
      }

this is what I could do so far. I cannot ve sure if it's correct.

   #---Build Model-----
    model = models.Sequential()
    # Input - Layer 
    model.add(layers.Dense(4, activation = "relu", input_shape=(4,)))  
    # Hidden - Layers 
    model.add(layers.Dense(25, activation = "relu")) 
    model.add(layers.Dense(5, activation = "relu"))
    # Output- Layer
    model.add(layers.Dense(1, activation = "linear")) 
    model.summary()
    # Compile Model
    model.compile(loss= "mean_squared_error" , optimizer="adam", metrics=["mean_squared_error"])



from Convert Convnet.js neural network model to Keras Tensorflow

No comments:

Post a Comment