Skip to content

AllisonOge/iqmoco

Repository files navigation

IQMoCo

MoCo pretraining and linear probing for radio IQ data with a single dataset (train_norm_030_preprocessed.h5) with two downstream tasks: AoA (angles regression) and AMC (modulation classification).

Contents

  • moco_experiment.py pretraining + finetuning pipeline (AoA + AMC).
  • mtc_grid-search.py crop-length grid search with KNN + silhouette metrics.
  • moco/ MoCo models and dataloaders.
  • utils/ training, finetune, and dataset helpers.
  • models/ shufflenet, mobilenet, resnet backbones.
  • nbs/moco_multi_task_analysis.ipynb analysis notebook.
  • nbs/IQ_dataset_n_tasks.ipynb preprocessing pipeline for dataset creation.
  • configs/label_encoder_angles.yaml and configs/label_encoder_mods.yaml.

Data

  • Place datasets under data_h5py_files/.
  • Required files: train_norm_030_preprocessed.h5, test_norm_030_preprocessed.h5.
  • Use nbs/IQ_dataset_n_tasks.ipynb to generate the preprocessed HDF5 files.

Setup

  1. python -m venv venv
  2. ./venv/bin/pip install -r requirements.txt

Run

  1. Pretrain + finetune AoA and AMC: python moco_experiment.py
  2. Optional config override: python moco_experiment.py -c path/to/config.yaml

Loss (Batch-Decoupled Queue) When use_queue is enabled, we keep the original in-batch logits and append queue negatives. This preserves the diagonal positives from the current batch while adding extra negatives from the queue:

logits = [Q @ K^T | Q @ V^T] / T
Q: [N, C]  (queries), K: [M, C] (in-batch keys), V: [C, K] (queue)
labels = arange(M)  # positives are the diagonal in the first M columns
loss = CE(logits, labels)

Example (no DDP): N = M = 4, K = 8logits is [4, 12], labels = [0, 1, 2, 3]. Each row has 1 positive (diagonal), N-1 in-batch negatives, and K queue negatives.

Grid Search

  • Example: python mtc_grid-search.py --dataset-path ./data_h5py_files --train-file train_norm_030_preprocessed.h5 --test-file test_norm_030_preprocessed.h5 --task aoa

Notes

  • Only shufflenet, mobilenet, and resnet18 backbones are supported in this project.

About

A multitask learning solution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors