MCPcopy Create free account
hub / github.com/tensorflow/tfjs / exportCNNModel

Function exportCNNModel

e2e/integration_tests/create_save_predict.js:91–120  ·  view source on GitHub ↗
(exportPath)

Source from the content-addressed store, hash-verified

89
90// Convolutional neural network (CNN).
91async function exportCNNModel(exportPath) {
92 const model = tfl.sequential();
93
94 // Cover separable and non-separable convoluational layers.
95 const inputShape = [40, 40, 3];
96 model.add(tfl.layers.conv2d({
97 filters: 32,
98 kernelSize: [3, 3],
99 strides: [2, 2],
100 inputShape,
101 padding: 'valid',
102 }));
103 model.add(tfl.layers.batchNormalization({}));
104 model.add(tfl.layers.activation({activation: 'relu'}));
105 model.add(tfl.layers.dropout({rate: 0.5}));
106 model.add(tfl.layers.maxPooling2d({poolSize: 2}));
107 model.add(tfl.layers.separableConv2d({
108 filters: 32,
109 kernelSize: [4, 4],
110 strides: [3, 3],
111 }));
112 model.add(tfl.layers.batchNormalization({}));
113 model.add(tfl.layers.activation({activation: 'relu'}));
114 model.add(tfl.layers.dropout({rate: 0.5}));
115 model.add(tfl.layers.avgPooling2d({poolSize: [2, 2]}));
116 model.add(tfl.layers.flatten({}));
117 model.add(tfl.layers.dense({units: 100, activation: 'softmax'}));
118
119 await saveModelAndRandomInputs(model, exportPath);
120}
121
122async function exportDepthwiseCNNModel(exportPath) {
123 const model = tfl.sequential();

Callers 1

Calls 5

saveModelAndRandomInputsFunction · 0.85
conv2dMethod · 0.80
separableConv2dMethod · 0.80
flattenMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…