Skip to content

Commit 47bc94b

Browse files
committed
slow progress
1 parent 5d1dcac commit 47bc94b

8 files changed

+114
-257
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@
1212
*-checkpoint.ipynb
1313
.DS_Store
1414
.python-version
15+
experiment_logs/
16+
lightning_logs/
17+
spec_logs/
18+

poetry.lock

+55-225
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ scikit-image = "^0.22.0"
1111
matplotlib = "^3.8.3"
1212
numpy = "^1.26.4"
1313
opencv-python = "^4.8.0.74"
14-
scipy = "^1.12.0"
14+
scipy = "1.11.4"
1515
zstandard = "^0.22.0"
1616
pyyaml = "^6.0.1"
1717
pillow = "^10.2.0"
1818
python-on-whales = "^0.69.0"
1919
sigmf = "^1.2.0"
2020
tqdm = "^4.66.4"
2121
cupy = "^13.2.0"
22-
torchsig = {path = "../torchsig"}
22+
torchsig = {path = "torchsig"}
2323

2424
[tool.poetry.group.dev.dependencies]
2525
jupyter = "^1.0.0"

rfml-dev/README.md

+23-2
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,37 @@
22

33
## Poetry
44

5+
Follow the instructions here to install Poetry: https://python-poetry.org/docs/#installation
6+
57
## Torchsig
68

7-
Download and install from [Github](https://github.com/TorchDSP/torchsig)
9+
Download from [Github](https://github.com/TorchDSP/torchsig) and then use Poetry to install it.
810

911
```
1012
git clone https://github.com/TorchDSP/torchsig.git
1113
cd torchsig
12-
sudo pip install .
14+
git checkout 8049b43
15+
```
16+
17+
Make you have the Poetry environment activated, using `poetry shell`, then run:
18+
19+
```
20+
poetry add ./torchsig
1321
```
1422

23+
(update it with the correct path the directoy where Torchsig is)
24+
25+
## Torch Model Archiver
26+
27+
Install the Torch Model Archiver:
28+
```
29+
sudo pip install torch-model-archiver
30+
```
31+
32+
More information about this tool is available here:
33+
https://github.com/pytorch/serve/blob/master/model-archiver/README.md
34+
35+
## Inspectrum (optional)
1536

1637

1738
# Building a Model

rfml-dev/annotation_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def get_occupied_bandwidth(samples, sample_rate, center_frequency, spectral_ener
176176
else:
177177
upper_idx += 1
178178

179-
if freq_power_normalized[lower_idx:upper_idx].sum() >= spectral_energy_threshold:
179+
if freq_power_normalized[lower_idx:upper_idx+1].sum() >= spectral_energy_threshold:
180180
break
181181

182182
if lower_idx == 0 and upper_idx == freq_power_normalized.shape[0]-1:

rfml-dev/run_experiments.py

+26-26
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
# Ensure that data directories have sigmf-meta files with annotations
99
# Annotations can be generated using Label_WiFi.ipynb and Label_DJI.ipynb
1010
experiments = {
11-
"experiment_0": {
12-
"experiment_name": "experiment_0",
13-
"class_list": ["mavic3_video","mavic3_remoteid","env"],
11+
"experiment_1": {
12+
"experiment_name": "experiment_1",
13+
"class_list": ["mavic3_video","mavic3_remoteid","environment"],
1414
"train_dir": ["/home/iqt/lberndt/gamutrf-depoly/data/samples/mavic-30db", "/home/iqt/lberndt/gamutrf-depoly/data/samples/mavic-0db", "/home/iqt/lberndt/gamutrf-depoly/data/samples/environment"],
1515
"iq_epochs": 10,
1616
"spec_epochs": 10,
@@ -138,39 +138,39 @@
138138

139139
if __name__ == "__main__":
140140

141-
for i in [9]: #range(7):
141+
for i in [1]: #range(7):
142142
print(f"Experiment {i}")
143143
try:
144144
exp = Experiment(**experiments[f"experiment_{i}"])
145145

146146
logs_timestamp = datetime.now().strftime("%m_%d_%Y_%H_%M_%S")
147147

148-
# train_iq(
149-
# train_dataset_path = exp.train_dir,
150-
# val_dataset_path = exp.val_dir,
151-
# num_iq_samples = exp.iq_num_samples,
152-
# only_use_start_of_burst = exp.iq_only_start_of_burst,
153-
# epochs = exp.iq_epochs,
154-
# batch_size = exp.iq_batch_size,
155-
# class_list = exp.class_list,
156-
# output_dir = Path("experiment_logs",exp.experiment_name),
157-
# logs_dir = Path("iq_logs", logs_timestamp),
158-
# )
159-
160-
161-
train_spec(
148+
train_iq(
162149
train_dataset_path = exp.train_dir,
163150
val_dataset_path = exp.val_dir,
164-
n_fft = exp.spec_n_fft,
165-
time_dim = exp.spec_time_dim,
166-
epochs = exp.spec_epochs,
167-
batch_size = exp.spec_batch_size,
151+
num_iq_samples = exp.iq_num_samples,
152+
only_use_start_of_burst = exp.iq_only_start_of_burst,
153+
epochs = exp.iq_epochs,
154+
batch_size = exp.iq_batch_size,
168155
class_list = exp.class_list,
169-
yolo_augment = exp.spec_yolo_augment,
170-
skip_export = exp.spec_skip_export,
171-
force_yolo_label_larger = exp.spec_force_yolo_label_larger,
172156
output_dir = Path("experiment_logs",exp.experiment_name),
173-
logs_dir = Path("spec_logs", logs_timestamp),
157+
logs_dir = Path("iq_logs", logs_timestamp),
174158
)
159+
160+
161+
# train_spec(
162+
# train_dataset_path = exp.train_dir,
163+
# val_dataset_path = exp.val_dir,
164+
# n_fft = exp.spec_n_fft,
165+
# time_dim = exp.spec_time_dim,
166+
# epochs = exp.spec_epochs,
167+
# batch_size = exp.spec_batch_size,
168+
# class_list = exp.class_list,
169+
# yolo_augment = exp.spec_yolo_augment,
170+
# skip_export = exp.spec_skip_export,
171+
# force_yolo_label_larger = exp.spec_force_yolo_label_larger,
172+
# output_dir = Path("experiment_logs",exp.experiment_name),
173+
# logs_dir = Path("spec_logs", logs_timestamp),
174+
# )
175175
except Exception as error:
176176
print(f"Error: {error}")

rfml-dev/train_iq.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ def train_iq(
294294

295295
print(f"\n\nI/Q TRAINING COMPLETE\n\n")
296296
print(f"Find results in {str(Path(logs_dir))}\n")
297-
297+
print(f"Total Accuracy: {acc*100:.2f}%")
298+
print(f"Best Model Checkpoint: {checkpoint_callback.best_model_path}")
298299

299300

300301
def visualize_dataset(dataset_path, num_iq_samples, logs_dir, class_list):

torchsig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 8049b430baca5d7892f68c4436e5cf7884f5c416

0 commit comments

Comments
 (0)