* Creates a model consisting of only flatten, dense and dropout layers. * * The model create here has approximately the same number of parameters * (~31k) as the convnet created by `createConvModel()`, but is * expected to show a significantly worse accuracy after training, due to the * fact th
()
| 97 | * @returns {tf.Model} An instance of tf.Model. |
| 98 | */ |
| 99 | function createDenseModel() { |
| 100 | const model = tf.sequential(); |
| 101 | model.add(tf.layers.flatten({inputShape: [IMAGE_H, IMAGE_W, 1]})); |
| 102 | model.add(tf.layers.dense({units: 42, activation: 'relu'})); |
| 103 | model.add(tf.layers.dense({units: 10, activation: 'softmax'})); |
| 104 | return model; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * This callback type is used by the `train` function for insertion into |