MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / createModel

Function createModel

quantization/model_fashion_mnist.js:26–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24 * https://github.com/cmasch/zalando-fashion-mnist/blob/master/Simple_Convolutional_Neural_Network_Fashion-MNIST.ipynb
25 */
26export function createModel() {
27 const model = tf.sequential();
28 model.add(tf.layers.batchNormalization({
29 inputShape: [28, 28, 1]
30 }));
31 model.add(tf.layers.conv2d({
32 filters: 64,
33 kernelSize: 4,
34 padding: 'same',
35 activation: 'relu',
36 }));
37 model.add(tf.layers.maxPooling2d({poolSize: 2}));
38 model.add(tf.layers.dropout({rate: 0.1}));
39 model.add(tf.layers.conv2d({
40 filters: 64,
41 kernelSize: 4,
42 activation: 'relu',
43 }));
44 model.add(tf.layers.maxPooling2d({poolSize: 2}));
45 model.add(tf.layers.dropout({rate: 0.3}));
46 model.add(tf.layers.flatten());
47 model.add(tf.layers.dense({units: 256, activation: 'relu'}));
48 model.add(tf.layers.dropout({rate: 0.5}));
49 model.add(tf.layers.dense({units: 64, activation: 'relu'}));
50 model.add(tf.layers.batchNormalization());
51 model.add(tf.layers.dense({units: 10, activation: 'softmax'}));
52
53 compileModel(model);
54 return model;
55}
56
57export function compileModel(model) {
58 const optimizer = 'adam';

Callers

nothing calls this directly

Calls 1

compileModelFunction · 0.70

Tested by

no test coverage detected