Skip to content

Commit 1053ab7

Browse files
committed
Update README with Pytorch fix. Update poetry dependencies. Update scripts with package imports.
1 parent d1d39ed commit 1053ab7

15 files changed

+1327
-40
lines changed

README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
This repo provides the pipeline for working with RF datasets, labeling them and training both IQ and spectrogram based models. The SigMF standard is used for managing RF data and the labels/annotations on the data. It also uses the Torchsig framework for performing RF related augmentation of the data to help make the trained models more robust and functional in the real world.
44

5+
56
## Prerequisites
67

78
### Poetry
@@ -44,10 +45,23 @@ See [Poetry docs](https://python-poetry.org/docs/basic-usage/#activating-the-vir
4445
git clone https://github.com/IQTLabs/rfml-dev.git
4546
cd rfml-dev
4647
git submodule update --init --recursive
47-
poetry add ./torchsig
4848
poetry install
4949
```
5050

51+
## Verify install with GPU support (optional)
52+
53+
```bash
54+
$ python -c 'import torch; print(torch.cuda.is_available())'
55+
True
56+
```
57+
58+
If the output does not match or errors occur, try installing Pytorch manually ([current version](https://pytorch.org/get-started/locally/) or [previous versions](https://pytorch.org/get-started/previous-versions/)).
59+
#### Example
60+
61+
```bash
62+
pip install torch==2.0.1 torchvision==0.15.2
63+
```
64+
5165

5266
# Building a model
5367

label_scripts/label_bladerf_wifi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pathlib import Path
44
from tqdm import tqdm
55

6-
import annotation_utils
6+
import rfml.annotation_utils as annotation_utils
77

88
s3_data = {
99
"anom_wifi": [

label_scripts/label_env.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import os
66
import sys
77
sys.path.insert(1, os.path.join(sys.path[0], '..'))
8-
import annotation_utils
9-
import data as data_class
8+
import rfml.annotation_utils as annotation_utils
9+
import rfml.data as data_class
1010

1111

1212

label_scripts/label_mavic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import os
66
import sys
77
sys.path.insert(1, os.path.join(sys.path[0], '..'))
8-
import annotation_utils
9-
import data as data_class
8+
import rfml.annotation_utils as annotation_utils
9+
import rfml.data as data_class
1010

1111

1212

label_scripts/label_mini2.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from pathlib import Path
44
from tqdm import tqdm
55

6-
import annotation_utils
7-
import data as data_class
6+
import rfml.annotation_utils as annotation_utils
7+
import rfml.data as data_class
88

99

1010

label_scripts/label_nz_wifi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pathlib import Path
44
from tqdm import tqdm
55

6-
import annotation_utils
6+
import rfml.annotation_utils as annotation_utils
77

88
s3_data = {
99
"anom_wifi": [

label_scripts/label_nz_wifi_multiprocessing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pathlib import Path
1010
from tqdm import tqdm
1111

12-
import annotation_utils
12+
import rfml.annotation_utils as annotation_utils
1313

1414
def worker_wrapper(fn, kwargs):
1515
def try_fn():

poetry.lock

+1,285-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[tool.poetry]
2-
name = "rfml-dev"
2+
name = "rfml"
33
version = "0.1.0"
44
description = ""
55
authors = ["Lucas Tindall <[email protected]>"]
66
readme = "README.md"
77

88
[tool.poetry.dependencies]
9-
python = "^3.10"
9+
python = ">=3.10, <3.12"
1010
scikit-image = "^0.22.0"
1111
matplotlib = "^3.8.3"
1212
numpy = "^1.26.4"
@@ -18,8 +18,10 @@ pillow = "^10.2.0"
1818
python-on-whales = "^0.69.0"
1919
sigmf = "^1.2.0"
2020
tqdm = "^4.66.4"
21-
cupy = "^13.2.0"
2221
torch-model-archiver = "^0.11.1"
22+
torchsig = {path = "torchsig"}
23+
cupy-cuda12x = "^13.2.0"
24+
ultralytics = "^8.2.79"
2325

2426

2527
[tool.poetry.group.dev.dependencies]

rfml/annotation_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
from cupyx.scipy.signal import spectrogram as cupyx_spectrogram
66
from cupyx.scipy.ndimage import gaussian_filter as cupyx_gaussian_filter
77

8-
from spectrogram import *
8+
from rfml.spectrogram import *
99

10-
import data as data_class
10+
import rfml.data as data_class
1111
import matplotlib.pyplot as plt
1212
import numpy as np
1313

rfml/data.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
from python_on_whales import docker
2222
from tqdm import tqdm
2323

24-
from auto_label import auto_label, auto_label_configs
25-
from zst_parse import parse_zst_filename
26-
from spectrogram import spectrogram, spectrogram_cmap
24+
from rfml.auto_label import auto_label, auto_label_configs
25+
from rfml.zst_parse import parse_zst_filename
26+
from rfml.spectrogram import spectrogram, spectrogram_cmap
2727

2828
SIGMF_META_DEFAULT = {
2929
"global": { # https://github.com/sigmf/SigMF/blob/sigmf-v1.x/sigmf-spec.md#global-object

rfml/run_experiments.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from pathlib import Path
22

3-
from experiment import *
4-
from train_iq import *
5-
from train_spec import *
3+
from rfml.experiment import *
4+
from rfml.train_iq import *
5+
from rfml.train_spec import *
66

77

88
# Ensure that data directories have sigmf-meta files with annotations

rfml/test_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Tests and helper scripts for data.py
22

3-
from data import Data, labels_to_sigmf, yield_label_metadata
3+
from rfml.data import Data, labels_to_sigmf, yield_label_metadata
44

55

66
def test_spectrogram_generation(filename):

rfml/train_iq.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# I/Q model training script
22

33
from argparse import ArgumentParser, BooleanOptionalAction
4-
from sigmf_pytorch_dataset import SigMFDataset
4+
from rfml.sigmf_pytorch_dataset import SigMFDataset
55
from torchsig.utils.visualize import IQVisualizer, SpectrogramVisualizer, two_channel_to_complex
66
from torchsig.utils.dataset import SignalDataset
77
from torchsig.datasets.sig53 import Sig53
@@ -33,9 +33,8 @@
3333
import torchsig
3434
import torch
3535
import os
36-
from sigmf_db_dataset import SigMFDB
37-
from sigmf_pytorch_dataset import SigMFDataset
38-
from models import ExampleNetwork
36+
from rfml.sigmf_pytorch_dataset import SigMFDataset
37+
from rfml.models import ExampleNetwork
3938

4039
from torchsig.transforms import (
4140
Compose,

rfml/train_spec.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import yaml
66
from pathlib import Path
77
from tqdm import tqdm
8-
from data import *
8+
from rfml.data import *
99
import shutil
1010

1111

0 commit comments

Comments
 (0)