hCNN

hCNN, Hybrid Neural Network Toolbox

hCNN, Hybrid Neural Network, a MATLAB NN toolbox that supports complex valued data and insertion of Signal Processing Modules.

GPU supported. Please use a CUDA enabled device and to.useGPU=1 if you want to enable it.

1. Overview

During the recent decade, deep learning technology, particularly deep neural network (DNN), has gained tremendous popularity in various fields including signal processing (SP). As a data-driven framework, DNN treats the learning problem as a “black-box” that extracts useful features directly from data. With sufficient training, DNN does not rely on any special structure or property of the processed data, making it universally applicable to diverse problem models. As such, DNN can help to expand the functionality of SP to handle problems that cannot be well-modeled.

As a data-driven approach, DNN suffers from some drawbacks. Usually DNN requires huge amount of data to work effectively, and its training stage is also computation costly. Specializing to the (radar) signal processing field, there are abundant highly-structured or man-made signals with known properties, such as low-rankness or sparsity. DNN, is obviously not as efficient in processing and extracting useful information from those signals with known models and properties. It means that, if we can leverage these known properties, the DNN performance is expected to be improved significantly in terms of required data amount and computation load.

Here we proposed a hybrid neural network (Hybrid-NN) as a novel scheme to improve the detection performance in terms of validation accuracy and required training data amount. The idea is to insert signal processing (SP) modules into conventional neural networks, especially CNNs. The goal is to increase the training/validation accuracy and reduce the required amount of data. Hybrid-NN also supports multiple channel structures, that each channel is composed of sub neural networks (sub-NNs), for specific objectives.

An example of overall architecture of a hybrid-NN is shown in as follows:

<img src=”https://pzhg.github.io/hCNN/hybrid-nn-example.png” width=55% align=center alt=”Architecture of an example hybrid-NN”>

This example hybrid-NN has three parallel subnetworks as three channels. The sub-NN 1 and sub-NN 2 has a PCA layer at the very beginning as the SP module for some specific objectives, and the sub-NN 3 is constructed as a traditional CNN which is intended to detect all general targets. The three subnetworks are combined with two fully connected layers.

1.1 Usage

To usage of this toolbox has four steps, which is simple and intuitive:

  1. Define hyper parameters and initialize the NN

    ```matlab
    to.epochs = 3;              % Epoch number
    to.batch = 400;             % Batch number
    to.batch_size = 150;        % Batch size
    to.alpha = 0.1;             % Learning rate
    to.momentum = 0.9;          % Momentum
    to.mom = 0.5;               % Initial momentum
    to.momIncrease = 20;        % Momemtum change iteration count
    to.lambda = 0.0001;         % Weight decay parameter (a.k.a. L2 regularization parameter)
    to.useGPU = 1;              % Use GPU
    cnn = cnnInit(to);
    ```
    
  2. Define NN structure (Add layers)

    ```matlab
    cnn = cnnAddInputLayer(cnn, [28, 28], 1);
    cnn = cnnAddConvLayer(cnn, [3, 3], 8, 'r');
    cnn = cnnAddBNLayer(cnn);
    cnn = cnnAddActivationLayer(cnn, 'relu');
    cnn = cnnAddPoolLayer(cnn, 'max', [2, 2]);
    cnn = cnnAddReshapeLayer(cnn);
    cnn = cnnAddFCLayer(cnn, 128, 'r');
    cnn = cnnAddDropOutLayer(cnn, 0.3);
    cnn = cnnAddBNLayer(cnn);
    cnn = cnnAddOutputLayer(cnn, 'softmax');
    cnn = cnnInitVelocity(cnn); 					% Initial the NN Parameters
    ```
    
  3. Train

    ```matlab
    [ERR, cnn] = cnnTrainBP(cnn, TrainData, LabelData);
    ```
    
  4. Validate

    ```matlab
    acc = cnnTestData(cnn, VData, VLabel, 1000);
    ```
    

1.2 Example

See the following file as an example of utilizing this toolbox:

`example_MNIST.m` 

Dataset used in this example is from here. The MAT file is included in this project.

See the following file as an example of utilization of Multiple channel (BLOB) layer and the insertion of SP Module:

`example_MicroDoppler.m`

Dataset used in this example is from here. You can download the MAT file used in this example from here.

2. Toolbox Manual

2.1 Supported Layers

2.2 Layer Options

2.2.1 Supported Pooling Methods

2.2.2 Supported Activation Functions

If your desired activation function is not listed above, you can easily add more activation functions in

`cnnAddActionvationLayer.m`  
`cnnActivate.m`  
`cnnDeActivate.m` 

2.2.3 Supported Output Methods

2.3 Multiple Channel (BLOB) Layer

The layer is constructed of multiple sub-NNs as multiple channels as:

           /--- sub NN ---\
          /                \
   Input------- sub NN ---------Output
          \                /
	       \--- sub NN ---/

Each sub-NN can also contain of such BLOB Layer, resulting a nested structure.

Syntax:

	SUBNET_LIST = {SUBNN_1, SUBNN_2, ...}
	cnn = cnnAddBLOBLayer(cnn, SUBNET_LIST, OUTPUT_DIM, COMBINE_TYPE);

Example:

```matlab
nets = {cnn1, cnn2};
cnn = cnnAddBLOBLayer(cnn, nets, 128, 2);
% The BLOB layer has two sub-NNs, the output dimension is 128, and the combining type is 'linking'.
```

See example_MicroDoppler.m for detail usages.

2.3.1 Supported Combining Types

2.4 Signal Processing (SP) Modules

2.4.1 General SP Layers: contain parameters that can be trained during the training of hybrid-NN.

See the example of Radar Data Layer:

`cnnAddRadarLayer.m`  
`cnnConvolveRadar.m`  
`cnnDeconvolveRadar.m`  

You can also add your own SP layers. Use the above examples as references.

2.4.2 Special SP Layers: does not contain trainable parameters

Currently the following special SP layers are supported:

More special SP layers and transformation types can be easilly added manually.

See examples of Special SP layer:

`cnnAddCSLayer.m` `cnnCS.m`  
`cnnAddCoPCALayer.m` `cnnCoPCA.m`  
`cnnAddTransformLayer.m` `cnnTransform.m`

2.5 Supported Training Method

2.6 Validation

[acc, e] = cnnTestData(NN_NAME, TEST_DATA, TEST_LABEL, TEST_SIZE);

3. Roadmap

4. Reference