From 1154f39d373036ba62e3cf50c042de684b57adcf Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 11 Jun 2026 05:13:48 +0200 Subject: [PATCH 1/3] Improve README accuracy and links --- README.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b9c26ed..bd4d130 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,15 @@ The primary goal of this project is to develop and share advanced [Machine Learn Before diving into waveform vector exploitation with WAVE, ensure your environment meets the following prerequisites: -- [Python](https://www.python.org/) 3.7 or later. -- Essential Python packages installed via `pip3 install -U -r requirements.txt`: +- A [Python](https://www.python.org/) environment compatible with the PyTorch and TensorFlow examples. +- Essential Python packages installed from [`requirements.txt`](requirements.txt): + ```bash + python -m pip install -U -r requirements.txt + ``` - `numpy` - `scipy` - - `torch` (version 0.4.0 or later) - - `tensorflow` (version 1.8.0 or later) + - `torch` + - `tensorflow` (the [`train_tf.py`](train_tf.py) example uses TensorFlow 1.x APIs) - `plotly` (optional, for enhanced visualization) You can easily install these packages using [pip](https://pip.pypa.io/en/stable/), the Python package installer. @@ -40,14 +43,14 @@ You can easily install these packages using [pip](https://pip.pypa.io/en/stable/ Execute the WAVE models using the provided scripts: -- **PyTorch Implementation**: Run `wave_pytorch.py` for the [PyTorch](https://pytorch.org/)-based model. -- **TensorFlow Implementation**: Use `wave_tf.py` if you prefer [TensorFlow](https://www.tensorflow.org/). -- **Google Cloud Deployment**: Explore `gcp/wave_pytorch_gcp.py` for running on [Google Cloud Platform](https://cloud.google.com/). +- **PyTorch Implementation**: Run `python train.py --epochs 5000 --var 3` for the [PyTorch](https://pytorch.org/)-based model. The script downloads `wavedata25ns.mat` into `data/` if it is missing. +- **TensorFlow Implementation**: Use `python train_tf.py` in a TensorFlow 1.x environment if you prefer [TensorFlow](https://www.tensorflow.org/). +- **Google Cloud Deployment**: Explore [`gcp/wave_pytorch_gcp.py`](gcp/wave_pytorch_gcp.py) and the helper scripts in [`gcp/`](gcp/) for running on [Google Cloud Platform](https://cloud.google.com/). Visualize the intricacies of waveform signals and the training process with these example images: -![Waveform Signals](https://raw.githubusercontent.com/ultralytics/wave/main/data/waveforms.png) -![Training Visualization](https://raw.githubusercontent.com/ultralytics/wave/main/data/wave.png) +![Waveform Signals](data/waveforms.png) +![Training Visualization](data/wave.png) ## 📜 Citation @@ -65,7 +68,7 @@ We highly value community contributions and invite you to participate in advanci Ultralytics provides two licensing options to suit different needs: -- **AGPL-3.0 License**: This [OSI-approved](https://opensource.org/license) [open-source license](https://github.com/ultralytics/wave/blob/main/LICENSE) is ideal for students and researchers, promoting open collaboration and knowledge sharing. See the [LICENSE](https://github.com/ultralytics/wave/blob/main/LICENSE) file for details. +- **AGPL-3.0 License**: This [OSI-approved](https://opensource.org/license/agpl-3-0/) open-source license is ideal for students and researchers, promoting open collaboration and knowledge sharing. See the [LICENSE](LICENSE) file for details. - **Enterprise License**: Designed for commercial applications, this license allows for the integration of Ultralytics software and AI models into commercial products and services. Visit [Ultralytics Licensing](https://www.ultralytics.com/license) for more information. ## 📬 Contact Us From 2e3bcc1c8038ec983d563232ac1ed849043f4002 Mon Sep 17 00:00:00 2001 From: UltralyticsAssistant Date: Thu, 11 Jun 2026 03:14:43 +0000 Subject: [PATCH 2/3] Auto-format by https://ultralytics.com/actions --- README.md | 1 + gcp/wave_pytorch_gcp.py | 9 ++++----- train.py | 4 ++-- train_tf.py | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index bd4d130..91cf4b3 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Before diving into waveform vector exploitation with WAVE, ensure your environme ```bash python -m pip install -U -r requirements.txt ``` + - `numpy` - `scipy` - `torch` diff --git a/gcp/wave_pytorch_gcp.py b/gcp/wave_pytorch_gcp.py index 0fb90e8..189e586 100644 --- a/gcp/wave_pytorch_gcp.py +++ b/gcp/wave_pytorch_gcp.py @@ -41,11 +41,11 @@ def runexample(H, model, str, lr=0.001, amsgrad=False): mat = scipy.io.loadmat(pathd + data) x = mat["inputs"] # inputs (nx512) [waveform1 waveform2] y = mat["outputs"][:, 1:2] # outputs (nx4) [position(mm), time(ns), PE, E(MeV)] - nz, nx = x.shape + _nz, _nx = x.shape ny = y.shape[1] x, _, _ = normalize(x, 1) # normalize each input row - y, ymu, ys = normalize(y, 0) # normalize each output column + y, _ymu, ys = normalize(y, 0) # normalize each output column x, y = torch.Tensor(x), torch.Tensor(y) x, y, xv, yv, xt, yt = splitdata(x, y, train=0.70, validate=0.15, test=0.15, shuffle=True) labels = ["train", "validate", "test"] @@ -209,8 +209,7 @@ def forward(self, x): def tslr(): # TS learning rate - """Generate and save learning rate (LR) logs for time-series models with varying LRs using WAVE and TanH - activation. + """Generate and save learning rate (LR) logs for time-series models with varying LRs using WAVE and TanH activation. """ tsv = np.logspace(-5, -2, 13) tsy = [] @@ -224,7 +223,7 @@ def tsams(): # TS AMSgrad tsv = [False, True] tsy = [] for a in tsv: - tsy.extend(runexample(H, model=WAVE(H), str=f".TanhAMS{str(a)}", amsgrad=a) for _ in range(3)) + tsy.extend(runexample(H, model=WAVE(H), str=f".TanhAMS{a!s}", amsgrad=a) for _ in range(3)) scipy.io.savemat(f"{pathr}TS.AMSgrad.mat", dict(tsv=tsv, tsy=np.array(tsy))) diff --git a/train.py b/train.py index 910bb8e..154c351 100644 --- a/train.py +++ b/train.py @@ -35,11 +35,11 @@ def train(H, model, str, lr=0.001): mat = scipy.io.loadmat(pathd + data) x = mat["inputs"][:] # inputs (nx512) [waveform1 waveform2] y = mat["outputs"][:, 0:2] # outputs (nx4) [position(mm), time(ns), PE, E(MeV)] - nz, nx = x.shape + _nz, _nx = x.shape ny = y.shape[1] x, _, _ = normalize(x, 1) # normalize each input row - y, ymu, ys = normalize(y, 0) # normalize each output column + y, _ymu, ys = normalize(y, 0) # normalize each output column x, y = torch.Tensor(x), torch.Tensor(y) x, y, xv, yv, xt, yt = splitdata(x, y, train=0.70, validate=0.15, test=0.15, shuffle=False) diff --git a/train_tf.py b/train_tf.py index aa41c65..84e02a8 100644 --- a/train_tf.py +++ b/train_tf.py @@ -38,7 +38,7 @@ def runexample(H, model, str): mat = scipy.io.loadmat(path + data) x = mat["inputs"] # inputs (nx512) [waveform1 waveform2] y = mat["outputs"][:, 0:2] # outputs (nx4) [position(mm), time(ns), PE, E(MeV)] - nz, nx = x.shape + _nz, _nx = x.shape ny = y.shape[1] if model is None: @@ -56,7 +56,7 @@ def runexample(H, model, str): ) x, _, _ = normalize(x, 1) # normalize each input row - y, ymu, ys = normalize(y, 0) # normalize each output column + y, _ymu, ys = normalize(y, 0) # normalize each output column x, y, xv, yv, xt, yt = splitdata(x, y, train=0.70, validate=0.15, test=0.15, shuffle=False) labels = ["train", "validate", "test"] @@ -130,4 +130,4 @@ def criteria(y_pred, y): # MSE if __name__ == "__main__": H = [128, 32, 8] for i in range(1): - runexample(H, None, f".{str(i)}") + runexample(H, None, f".{i!s}") From 9a0af1c111ae0d8905b42d4962868284c1b280fe Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 11 Jun 2026 05:15:22 +0200 Subject: [PATCH 3/3] Restore README-only scope [skip ci] --- README.md | 1 - gcp/wave_pytorch_gcp.py | 9 +++++---- train.py | 4 ++-- train_tf.py | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 91cf4b3..bd4d130 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ Before diving into waveform vector exploitation with WAVE, ensure your environme ```bash python -m pip install -U -r requirements.txt ``` - - `numpy` - `scipy` - `torch` diff --git a/gcp/wave_pytorch_gcp.py b/gcp/wave_pytorch_gcp.py index 189e586..0fb90e8 100644 --- a/gcp/wave_pytorch_gcp.py +++ b/gcp/wave_pytorch_gcp.py @@ -41,11 +41,11 @@ def runexample(H, model, str, lr=0.001, amsgrad=False): mat = scipy.io.loadmat(pathd + data) x = mat["inputs"] # inputs (nx512) [waveform1 waveform2] y = mat["outputs"][:, 1:2] # outputs (nx4) [position(mm), time(ns), PE, E(MeV)] - _nz, _nx = x.shape + nz, nx = x.shape ny = y.shape[1] x, _, _ = normalize(x, 1) # normalize each input row - y, _ymu, ys = normalize(y, 0) # normalize each output column + y, ymu, ys = normalize(y, 0) # normalize each output column x, y = torch.Tensor(x), torch.Tensor(y) x, y, xv, yv, xt, yt = splitdata(x, y, train=0.70, validate=0.15, test=0.15, shuffle=True) labels = ["train", "validate", "test"] @@ -209,7 +209,8 @@ def forward(self, x): def tslr(): # TS learning rate - """Generate and save learning rate (LR) logs for time-series models with varying LRs using WAVE and TanH activation. + """Generate and save learning rate (LR) logs for time-series models with varying LRs using WAVE and TanH + activation. """ tsv = np.logspace(-5, -2, 13) tsy = [] @@ -223,7 +224,7 @@ def tsams(): # TS AMSgrad tsv = [False, True] tsy = [] for a in tsv: - tsy.extend(runexample(H, model=WAVE(H), str=f".TanhAMS{a!s}", amsgrad=a) for _ in range(3)) + tsy.extend(runexample(H, model=WAVE(H), str=f".TanhAMS{str(a)}", amsgrad=a) for _ in range(3)) scipy.io.savemat(f"{pathr}TS.AMSgrad.mat", dict(tsv=tsv, tsy=np.array(tsy))) diff --git a/train.py b/train.py index 154c351..910bb8e 100644 --- a/train.py +++ b/train.py @@ -35,11 +35,11 @@ def train(H, model, str, lr=0.001): mat = scipy.io.loadmat(pathd + data) x = mat["inputs"][:] # inputs (nx512) [waveform1 waveform2] y = mat["outputs"][:, 0:2] # outputs (nx4) [position(mm), time(ns), PE, E(MeV)] - _nz, _nx = x.shape + nz, nx = x.shape ny = y.shape[1] x, _, _ = normalize(x, 1) # normalize each input row - y, _ymu, ys = normalize(y, 0) # normalize each output column + y, ymu, ys = normalize(y, 0) # normalize each output column x, y = torch.Tensor(x), torch.Tensor(y) x, y, xv, yv, xt, yt = splitdata(x, y, train=0.70, validate=0.15, test=0.15, shuffle=False) diff --git a/train_tf.py b/train_tf.py index 84e02a8..aa41c65 100644 --- a/train_tf.py +++ b/train_tf.py @@ -38,7 +38,7 @@ def runexample(H, model, str): mat = scipy.io.loadmat(path + data) x = mat["inputs"] # inputs (nx512) [waveform1 waveform2] y = mat["outputs"][:, 0:2] # outputs (nx4) [position(mm), time(ns), PE, E(MeV)] - _nz, _nx = x.shape + nz, nx = x.shape ny = y.shape[1] if model is None: @@ -56,7 +56,7 @@ def runexample(H, model, str): ) x, _, _ = normalize(x, 1) # normalize each input row - y, _ymu, ys = normalize(y, 0) # normalize each output column + y, ymu, ys = normalize(y, 0) # normalize each output column x, y, xv, yv, xt, yt = splitdata(x, y, train=0.70, validate=0.15, test=0.15, shuffle=False) labels = ["train", "validate", "test"] @@ -130,4 +130,4 @@ def criteria(y_pred, y): # MSE if __name__ == "__main__": H = [128, 32, 8] for i in range(1): - runexample(H, None, f".{i!s}") + runexample(H, None, f".{str(i)}")