da-steve101 / radio_modulation

Classify modulation of signals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Real-time Automatic Moduation Classification

Classify modulation of signals

This package uses the twn_generator You can install it by running

pip3 install twn_generator

This code was created using python 3.6 and tensorflow 1.14

This project is based on the RFSoC ZCU111 board and the radio modulation dataset created by O'Shea et. al available at deepsig.io

The directory train_tnn contains all scripts to train the models in tensorflow and extract the weights and various test vectors to csvs. models contains the trained models used in this paper and the extracted weights in .csv format. scripts contains some helper files that create tensorflows .rcrd files from the raw dataset and a verification script using vivado for testing. verilog_generation has scripts to load the csv weights and generate verilog using the twn_generator package. verilog contains system verilog files that implement various CNN components needed. verilog_test has a few test benches for verification of the verilog. c_generation has scripts to load the the csv weights and generate c code using the twn_generator package. c has code to implement quantized cnn components to mimic the precision of the verilog. It also has files to create a python module for a given model.

Running

Verilog

The following command

./generate_networks.sh

will generate all code in c and verilog for all the models. This code is stored in models/network_name.

For using the verilog model, copy the .sv files from the models directory and the verilog files from verilog. There are three top level modules in verilog which are either the default twn, for binary activations and for incremental activations. They have corresponding testbenches for the default twn, for binary activations and for incremental activations.

C

In the c directory

export MODEL_DIR=../models/vgg_twn_nu_1.2_0.7_bin_64
python3 setup.py build

Will create a loadable python module in build/lib.xxx/pyvgg.xxx.so

If this is in the path it can be loaded and used with

import pyvgg
import numpy as np
# whatever input you want
I_data = np.random.randint( -300, 300, [1024] )
Q_data = np.random.randint( -300, 300, [1024] )
x = np.concatenate( [ I_data, Q_data] ).tolist()
y = pyvgg.compute( x ) # compute the prediction in C

To test the quantized performance on all models run

./test_quant.sh

Citations

@article{Tridgell:2019:UTN:3361265.3359983,
 author = {Tridgell, Stephen and Kumm, Martin and Hardieck, Martin and Boland, David and Moss, Duncan and Zipf, Peter and Leong, Philip H. W.},
 title = {Unrolling Ternary Neural Networks},
 journal = {ACM Trans. Reconfigurable Technol. Syst.},
 issue_date = {November 2019},
 volume = {12},
 number = {4},
 month = oct,
 year = {2019},
 issn = {1936-7406},
 pages = {22:1--22:23},
 articleno = {22},
 numpages = {23},
 url = {http://doi.acm.org/10.1145/3359983},
 doi = {10.1145/3359983},
 acmid = {3359983},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {Low-precision machine learning, sparse matrix operations, ternary neural networks},
} 

About

Classify modulation of signals

License:GNU Lesser General Public License v3.0


Languages

Language:SystemVerilog 32.1%Language:Python 29.6%Language:Verilog 22.8%Language:Shell 11.3%Language:C 3.9%Language:Makefile 0.3%