Code for Radio-Frequency Convolutional Neural Networks (Gao, Ma, Chen, Englund, Chen, 2026).
A frequency mixer multiplies two signals in time, which is a correlation in frequency, i.e. the operation of a convolutional layer. RF-CNN maps the input X and the weights W onto frequency tones (tone mapping), so that a passive computing mixer performs a whole multi-channel convolution in one pass. Models are trained digitally and then run through RF-CNN without retraining.
This README covers the simulation mode (the default): an ideal mixer with AWGN, implemented in PyTorch. Hardware experiments on USRPs are enabled with --exp.
pip install torch torchvision numpy scipy matplotlib tqdm numba
pip install "torchmetrics[image]" # GAN / FID onlyRun all scripts from the RFCNN/ directory. Data is read from ../Data/ and results are written to ../Result/<DATA>_size<SIZE>_<token>/.
../Data/
├── MNIST/ mnist_train.csv, mnist_test.csv
├── FMNIST/ fashion-mnist_train.csv, fashion-mnist_test.csv
├── SVHN/ train_32x32.mat, test_32x32.mat
├── CIFAR-10/ cifar-10-batches-py/
├── DeepSig/ data_<m>_<snr>.mat (RadioML 2018.01A split per modulation m=1..24 and SNR; variable `wave`)
└── CelebA/ auto-downloaded by torchvision
Images are not resampled, so --size must match the native resolution: 28 for MNIST/FMNIST, 32 for SVHN/CIFAR-10, and 1024 for DeepSig. CelebA is resized to --size.
1. Train digitally
python main_classify_digital.py --data CIFAR-10 --size 32 --param VGG11 --tokenOut VGG11-best
python main_classify_digital.py --data SVHN --size 32 --param VGG11 --tokenOut VGG11-best
python main_classify_digital.py --data DeepSig --size 1024 --model ConvNet1D --param VGG-DeepSig-new --tokenOut VGG-v2-best
python main_gan_digital.py --data MNIST --size 28 --param GRAY --tokenOut pixel-GRAY
python main_gan_digital.py --data CelebA --size 128 --param High --tokenOut pixel-High2. Run RF-CNN inference in simulation (default --snr 20)
python main_classify_analog.py --data CIFAR-10 --size 32 --param VGG11 --tokenIn VGG11-best --snr 20
python main_gan_analog.py --data MNIST --size 28 --param GRAY --batch 10 --tokenIn pixel-GRAY3. Compute the FID (GAN only)
python main_gan_evaluate.py --data MNIST --size 28 --tokenOut pixel-GRAY-simEach analog run also performs a full-precision pass for reference. It reports accuracy, confusion matrices, normalized RMSE, resolution bit and ENOB (classification), or generated image grids (GAN).
| Preset | Paper model |
|---|---|
VGG-DeepSig-new + ConvNet1D |
6-layer DeepSig classifier (Fig. 3a) |
VGG11 |
9-layer SVHN / CIFAR-10 classifier (Fig. 3b) |
GRAY (--size 28) |
4-layer MNIST / FMNIST InfoGAN generator (Fig. 4a) |
High (--size 128) |
7-layer CelebA generator (Fig. 4b) |
RGB (--size 64) |
extra 64×64 CelebA variant |
- Tone mapping (Core/interface_torch.py,
ConvAcc/FCAcc): each input channel is unrolled row by row onto tones, with zero guard tones between rows. Channels occupy adjacent sub-bands, so the mixer also sums over input channels. Zadoff-Chu phases reduce the waveform PAPR. - Mixer (Tx2Rx_sim_torch.py): the two OFDM waveforms are multiplied (
s_X · conj(s_W), down-conversion), low-pass filtered, given AWGN at--snr, and decimated. The output tones are then decoded by FFT, with phase correction from the preamble and postamble. - Network (analog.py): all layers are complex-valued.
AnalogZoommatches each layer's output scale to full precision, andAnalogInferchains the layers.engineListis set per dataset inmain_classify_analog.pyand per preset inmain_gan_analog.py. A layer whose entry isNoneruns digitally (e.g. DeepSigConv1, as in the paper). In simulation the numericengineListvalues are unused; they are per-layer backoffs for hardware. - Link parameters are in Core/GetParam.py:
waveAmp, padding,sampleRate, carriers,upsample,shrinkMax.
- Results are cached per batch in
Details/, and the default--tokenOut(<tokenIn>-sim) does not include the SNR. Use a different--tokenOutfor each--snr, or delete the old folder. - Simulation is slow for large models; use a GPU and
--batch 1for CelebA. - The DeepSig loader uses all 24 modulation classes, while the paper merges them into 10.
@article{gao2026radio,
title = {Radio-frequency convolutional neural networks},
author = {Gao, Zhihui and Ma, Shi-Yuan and Chen, Yiran and Englund, Dirk and Chen, Tingjun},
journal = {arXiv preprint arXiv:2609.19279},
year = {2026},
}