CMSIS-NN: Convolutional Neural Network Example

| CMSIS-NN Version 1.2.0 CMSIS NN Software Library

- Main Page
- Usage and Description
- Reference

All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Macros Groups Pages
Convolutional Neural Network Example

Description:

  Demonstrates a convolutional neural network (CNN) example with the use of convolution, ReLU activation, pooling and fully-connected functions.

Model definition:

  The CNN used in this example is based on CIFAR-10 example from Caffe [1]. The neural network consists of 3 convolution layers interspersed by ReLU activation and max pooling layers, followed by a fully-connected layer at the end. The input to the network is a 32x32 pixel color image, which will be classified into one of the 10 output classes. This example model implementation needs 32.3 KB to store weights, 40 KB for activations and 3.1 KB for storing the `im2col` data.

Neural Network model definition

Variables Description:

  - `conv1_wt`, `conv2_wt`, `conv3_wt` are convolution layer weight matrices
  - `conv1_bias`, `conv2_bias`, `conv3_bias` are convolution layer bias arrays
  - `ip1_wt`, ip1_bias point to fully-connected layer weights and biases
  - `input_data` points to the input image data
  - `output_data` points to the classification output
  - `col_buffer` is a buffer to store the `im2col` output
  - `scratch_buffer` is used to store the activation data (intermediate layer outputs)

CMSIS DSP Software Library Functions Used:

  - arm_convolve_HWC_q7_RGB()
  - arm_convolve_HWC_q7_fast()
  - arm_relu_q7()
  - arm_maxpool_q7_HWC()
  - arm_avepool_q7_HWC()
  - arm_fully_connected_q7_opt()
  - arm_fully_connected_q7()

Refer arm_nnexamples_cifar10.cpp

[1] https://github.com/BVLC/caffe