File size: 6,624 Bytes
733d776 7101d42 733d776 7101d42 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | ---
license: mit
language:
- en
tags:
- machining
- tool-wear
- manufacturing
- time-series
- foundation-model
- physics-informed
datasets:
- phm2010
metrics:
- mae
- rmse
- r2
pipeline_tag: time-series-classification
---
# MachiningFM 2.0 β Physics-Guided Foundation Model for Machining
A pretrained foundation model for CNC machining sensor data,
extended with a **classical physics calibration layer** for downstream tasks.
## Architecture
```
Raw Machining Signal (force, vibration, AE, NC program, ...)
β
βΌ
MachiningFMV2 (CausalFusionTransformer, d_model=384)
β
βΌ
Latent Embedding
β
βΌ
Downstream Head (Ridge / MLP)
β
βΌ
Raw Prediction
β
βββ Taylor Tool-Life (r_T = t / T_Taylor)
βββ Kienzle Force (F_measured / F_Kienzle)
βββ Cutting Energy (E_c = β« F_c Β· V_c Β· dt)
β
βΌ
Physics Calibration (y_final = y_FM + Ξ± Β· g(physics))
β
βΌ
Final Prediction
```
### Model Config (pretrained/machiningfm_v2_base.pt)
| Parameter | Value |
|-----------|-------|
| d_model | 384 |
| fusion_layers | 6 |
| num_heads | 8 |
| dropout | 0.1 |
| forecast_horizons | [64, 1280, 12800] |
| output_channels | 3 |
| trained steps | 5,432 |
| training loss | -1.94 |
### Supported Input Modalities
| Modality | Description |
|----------|-------------|
| `raw_waveform` | High-rate sensor signals (force, vibration, AE) |
| `spectral` | FFT / STFT / CWT spectral features |
| `cnc` | CNC SEFC (Servo Error / Feed / Current) data |
| `nc_tokens` | NC program token sequences |
| `image` | Tool wear images |
| `metadata_vector` | Machining condition scalars |
---
## Files
```
MachiningFM2.0/
βββ pretrained/
β βββ machiningfm_v2_base.pt # 170MB β primary pretrained checkpoint
βββ configs/
β βββ model/base.yaml # Model architecture config
β βββ physics/default.yaml # Generic steel/carbide parameters
β βββ physics/ti6al4v_carbide.yaml # Ti-6Al-4V parameters
βββ README.md
```
> **Note**: The large v1 pretraining checkpoint (7.4GB) is not included due to file size constraints.
> The v2 base checkpoint above was initialized from it and fine-tuned with the v2 architecture.
---
## Usage
```bash
git clone https://github.com/junseokShim/MachiningFM.git
cd MachiningFM
pip install -e .
```
Download this checkpoint:
```python
from huggingface_hub import hf_hub_download
ckpt_path = hf_hub_download(
repo_id="Junseok2/MachiningFM2.0",
filename="pretrained/machiningfm_v2_base.pt",
)
```
Load and encode:
```python
import torch
from machiningfm.models.backbone import MachiningFMBackbone
backbone = MachiningFMBackbone(
checkpoint_path=ckpt_path,
backbone_mode="frozen", # frozen | linear_probe | partial_finetune | full_finetune
)
batch = {"raw_waveform": torch.randn(1, 4096, 3)}
encoded = backbone.encode(batch)
embedding = encoded["embedding"] # shape: (1, 384)
```
Tool wear regression with physics calibration:
```python
from machiningfm.tasks.tool_wear import ToolWearRegressor
from machiningfm.physics.calibration import PhysicsCalibrator, PhysicsFeatures
from machiningfm.physics.taylor import TaylorParams, compute_tool_life_ratio
# Extract embeddings from backbone (offline)
# X_train, X_val, X_test: (N, 384) numpy arrays
# y_train, y_val, y_test: (N,) VB wear in mm
# Build physics features
params = TaylorParams(C=200.0, n=0.25)
pf = [
PhysicsFeatures(tool_life_ratio=compute_tool_life_ratio(t, 250.0, 0.25, 0.125, params))
for t in elapsed_times
]
# Fit with physics calibration
cal = PhysicsCalibrator(method="ridge")
reg = ToolWearRegressor(feature_dim=384, calibrator=cal)
reg.fit(X_train, y_train, pf_train, X_val, y_val, pf_val)
preds = reg.predict(X_test, pf_test)
```
---
## Downstream Tasks
| Task | Input | Output | Evaluation |
|------|-------|--------|-----------|
| A. Wear Regression | embedding | VB (mm) | MAE, RMSE, RΒ² |
| B. Stage Classification | embedding | healthy/moderate/severe | Acc, Macro F1 |
| C. RUL Prediction | embedding | remaining time (min) | MAE, RMSE, RΒ² |
| D. Dimensional Compensation | wear + condition | offset (mm) | physics-derived interface |
### Wear Stage Thresholds (ISO 8688-1:1989)
- Healthy: VB < 0.1 mm
- Moderate: 0.1 β€ VB < 0.2 mm
- Severe: VB β₯ 0.2 mm
---
## Physics Models
| Model | Status | Required Data |
|-------|--------|--------------|
| Taylor Tool-Life | Enabled | speed, feed, depth |
| Kienzle Force | Enabled | chip thickness, width |
| Cutting Energy | Enabled | force series, speed |
| Archard Wear | **Disabled** | F_N, L (not in standard datasets) |
| Usui Wear Rate | **Disabled** | cutting temperature (not in standard datasets) |
Physics parameters are stored in YAML configs (see `configs/physics/`).
All parameter sources are documented (`literature` / `dataset_calibrated` / `manufacturer` / `user_defined`).
---
## Dataset
**PHM Society Data Challenge 2010**
- URL: https://www.phmsociety.org/competition/phm/10
- Sensor data: force (x/y/z), vibration (x/y/z), acoustic emission RMS
- Labels: flank wear VB (mm) per cut, per condition (real measurements)
- Citation: PHM Society (2010). PHM Data Challenge. Prognostics and Health Management Society.
**Data Integrity Notes:**
- PHM2010 does NOT contain dimensional accuracy measurements.
Task D (dimensional compensation) outputs are physics-derived estimates, not experimental results.
- Archard/Usui models are disabled by default because PHM2010 lacks the required quantities.
- All splits use leave-one-condition-out to prevent temporal leakage.
---
## Limitations
- Pretrained on proprietary CNC machining data β domain gap to new materials/machines is expected.
- PHM2010 benchmarks with synthetic data demonstrate code correctness, not production performance.
- Physics calibration provides marginal improvement on clean synthetic data; real benefit expected on noisy real-world data.
- Archard and Usui models require data not typically available in standard machining datasets.
- The 7.4GB v1 pretraining checkpoint is not included due to file size constraints.
---
## Citation
If you use this model or framework, please cite:
```
@software{machiningfm2026,
author = {Shim, Junseok},
title = {MachiningFM: Physics-Guided Foundation Model for Machining},
year = {2026},
url = {https://github.com/junseokShim/MachiningFM}
}
```
---
## Source Code
- GitHub: https://github.com/junseokShim/MachiningFM
- License: MIT
|