Overview
Tensor Flow can be used to create convolutional neural networks.
A convolutional neural network is just a standard neural network, but includes a few extra layer types.
- Convolution Layers - implements a convolution on image data
- Pooling Layers - downsamples the image data
- Flatten Layer - flattens multi-dimensional data into 1-d array data.
Convolution Layers
model.add(tf.layers.conv2d({
inputShape: [IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_CHANNELS],
kernelSize: 5,
filters: 8,
strides: 1,
activation: 'relu',
kernelInitializer: 'varianceScaling'
}));
Max Pooling Layers
model.add(tf.layers.maxPooling2d({poolSize: [2, 2], strides: [2, 2]}));
Flatten Layers
model.add(tf.layers.flatten());