Create README.md
Browse files
processed_data/UO/data_examples/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UO Processed Dataset
|
| 2 |
+
|
| 3 |
+
Documentation for the **University of Ottawa (UO) bearing dataset** after running the updated preprocessing pipeline. Along with KAIST and PU, this is one of the three datasets that were refreshed most recently.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## Folder Layout
|
| 8 |
+
|
| 9 |
+
```
|
| 10 |
+
UO/
|
| 11 |
+
βββ train.pt
|
| 12 |
+
βββ val.pt
|
| 13 |
+
βββ test.pt
|
| 14 |
+
βββ args.json
|
| 15 |
+
βββ additional_features.pt
|
| 16 |
+
βββ before_sliding_window/
|
| 17 |
+
βββ train.pt
|
| 18 |
+
βββ val.pt
|
| 19 |
+
βββ test.pt
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
- `train.pt`, `val.pt`, `test.pt` β windowed tensors post sliding-window subsampling.
|
| 23 |
+
- `before_sliding_window/*.pt` β the same splits before windowing (full-length sequences).
|
| 24 |
+
- `args.json` β preprocessing arguments (window size, stride, split ratios, etc.).
|
| 25 |
+
- `additional_features.pt` β Torch-serialized metadata collected from each MAT file (including channel names and auxiliary sensor info).
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## Saved Tensor Structure
|
| 30 |
+
|
| 31 |
+
Each windowed `.pt` file is a dictionary with:
|
| 32 |
+
|
| 33 |
+
- `samples`: `torch.Tensor` of shape `[num_windows, num_channels, window_length]`
|
| 34 |
+
- `labels`: `torch.Tensor` with class ids (`0: healthy`, `1: inner race fault`, `2: outer race fault`)
|
| 35 |
+
- `sequence_ids`: indices that point back to the original MAT files
|
| 36 |
+
- `sliding_window_sequence_ids`: mapping from windows to their source sequences
|
| 37 |
+
- `size`: split ratio used when generating the split (for traceability)
|
| 38 |
+
|
| 39 |
+
The `before_sliding_window` tensors use the same keys but keep the un-windowed signals (length β 2,000,000 samples per channel).
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
## Features
|
| 44 |
+
|
| 45 |
+
Each MAT file contains several arrays; the preprocessing script keeps only the first two vibration channels (`channel_1`, `channel_2`) that provide the full 2β―000β―000 samples used in prior work. Their names are captured in `additional_features.pt` under each MAT file:
|
| 46 |
+
|
| 47 |
+
```python
|
| 48 |
+
import torch
|
| 49 |
+
|
| 50 |
+
meta = torch.load("additional_features.pt")
|
| 51 |
+
print(meta["healthy"]["H-A-1.mat"]["name_features"])
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
Use this metadata to understand the physical meaning of each channel or to filter specific features.
|
| 55 |
+
|
| 56 |
+
---
|
| 57 |
+
|
| 58 |
+
## Usage Example
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
import torch
|
| 62 |
+
|
| 63 |
+
train = torch.load("train.pt")
|
| 64 |
+
windows = train["samples"] # [N, num_channels, window_length]
|
| 65 |
+
labels = train["labels"] # bearing condition ids
|
| 66 |
+
original_indices = train["sliding_window_sequence_ids"]
|
| 67 |
+
|
| 68 |
+
print(windows.shape)
|
| 69 |
+
print(labels.unique())
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Access the un-windowed signals:
|
| 73 |
+
|
| 74 |
+
```python
|
| 75 |
+
raw = torch.load("before_sliding_window/train.pt")
|
| 76 |
+
full_sequences = raw["samples"] # [num_sequences, num_channels, original_length]
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
---
|
| 80 |
+
|
| 81 |
+
## Processing Pipeline
|
| 82 |
+
|
| 83 |
+
1. **Raw input** β MAT files organised into three lists: healthy (`H-*`), inner faults (`I-*`), outer faults (`O-*`).
|
| 84 |
+
2. **Channel selection** β For every file, the script extracts `channel_1` and `channel_2`, each of length 2β―000β―000 samples. Additional metadata (speed, load, etc.) is preserved in `additional_features.pt`.
|
| 85 |
+
3. **Class-wise sequence split** β Using `train_size`, sequences are randomly assigned to train vs. (val+test); the remaining sequences are divided into validation and test according to `val_size`/`test_size`.
|
| 86 |
+
4. **Save before-window tensors** β Full-length tensors are written to `before_sliding_window/{train,val,test}.pt` for troubleshooting.
|
| 87 |
+
5. **Sliding-window sampling** β Windows of length `window_size` are generated every `step = window_size * stride` samples from each sequence.
|
| 88 |
+
6. **Persist final datasets** β Windowed tensors and labels are stored in the root `.pt` files together with the mapping fields (`sequence_ids`, `sliding_window_sequence_ids`, `size`).
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
## Input / Output Cheat Sheet
|
| 93 |
+
|
| 94 |
+
| Stage | Shape | Description |
|
| 95 |
+
|-------|-------|-------------|
|
| 96 |
+
| Raw MAT arrays | `(2β―000β―000,)` per channel | Original vibration signals |
|
| 97 |
+
| After loading | `(1, 2, 2β―000β―000)` | Tensor for a single MAT file (two channels) |
|
| 98 |
+
| Before sliding window (train) | `[num_sequences, 2, original_length]` | Randomly selected sequences saved to `before_sliding_window/train.pt` |
|
| 99 |
+
| After sliding window (train) | `[num_windows, 2, window_size]` | Final training dataset in `train.pt` |
|
| 100 |
+
|
| 101 |
+
---
|
| 102 |
+
|
| 103 |
+
## Notes
|
| 104 |
+
|
| 105 |
+
- This README applies to the refreshed implementation; other datasets still rely on the legacy processing approach.
|
| 106 |
+
- The supplied splits rely on random shuffling with the configured ratios. Re-run the pipeline to regenerate different splits if required.
|