Add PyTorch/ONNX prediction models with physics fallback
- Train 3 MLP networks (acid speed 14→1, tension 4→10, quality 6→2) on 12,000 synthetic samples generated from physics models + noise - Export pre-trained ONNX models to pt_models/ directory - Rewrite prediction.py: ONNX inference first, physics fallback if unavailable - Add onnxruntime + numpy to requirements.txt (Aliyun mirror for Docker) - Use Tsinghua mirror in Dockerfile for pip installs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
BIN
backend/app/services/pt_models/acid_speed.onnx
Normal file
BIN
backend/app/services/pt_models/acid_speed.onnx
Normal file
Binary file not shown.
BIN
backend/app/services/pt_models/quality.onnx
Normal file
BIN
backend/app/services/pt_models/quality.onnx
Normal file
Binary file not shown.
118
backend/app/services/pt_models/scalers.json
Normal file
118
backend/app/services/pt_models/scalers.json
Normal file
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"acid_speed": {
|
||||
"X_mean": [
|
||||
4.279637813568115,
|
||||
11.041364669799805,
|
||||
150.61114501953125,
|
||||
149.8550262451172,
|
||||
150.01771545410156,
|
||||
150.00747680664062,
|
||||
150.5503692626953,
|
||||
149.680419921875,
|
||||
69.46580505371094,
|
||||
69.35639953613281,
|
||||
69.35671997070312,
|
||||
69.52980041503906,
|
||||
69.55128479003906,
|
||||
69.26476287841797
|
||||
],
|
||||
"X_std": [
|
||||
2.1389975547790527,
|
||||
4.052000999450684,
|
||||
51.74678421020508,
|
||||
52.34047317504883,
|
||||
51.52565383911133,
|
||||
52.03013610839844,
|
||||
51.94683074951172,
|
||||
51.77798080444336,
|
||||
10.097525596618652,
|
||||
10.071165084838867,
|
||||
10.012657165527344,
|
||||
10.097661018371582,
|
||||
10.077392578125,
|
||||
10.07375717163086
|
||||
],
|
||||
"y_mean": [
|
||||
92.42212677001953
|
||||
],
|
||||
"y_std": [
|
||||
30.15455436706543
|
||||
]
|
||||
},
|
||||
"tension": {
|
||||
"X_mean": [
|
||||
4.211259365081787,
|
||||
1104.45068359375,
|
||||
376.4231262207031,
|
||||
0.25053057074546814
|
||||
],
|
||||
"X_std": [
|
||||
2.1753084659576416,
|
||||
290.6602783203125,
|
||||
129.755859375,
|
||||
0.057579852640628815
|
||||
],
|
||||
"y_mean": [
|
||||
439.6892395019531,
|
||||
373.8921203613281,
|
||||
342.94708251953125,
|
||||
316.7646179199219,
|
||||
298.9944763183594,
|
||||
298.7807312011719,
|
||||
307.93359375,
|
||||
334.0721740722656,
|
||||
387.0394592285156,
|
||||
439.63824462890625
|
||||
],
|
||||
"y_std": [
|
||||
341.6143798828125,
|
||||
290.6787109375,
|
||||
266.5653991699219,
|
||||
246.12326049804688,
|
||||
232.24676513671875,
|
||||
231.9054412841797,
|
||||
239.40611267089844,
|
||||
259.3957214355469,
|
||||
300.75,
|
||||
341.000244140625
|
||||
],
|
||||
"zone_names": [
|
||||
"inlet",
|
||||
"s1_roller",
|
||||
"acid_entry",
|
||||
"acid1",
|
||||
"acid2",
|
||||
"acid3",
|
||||
"rinse",
|
||||
"leveler",
|
||||
"s2_roller",
|
||||
"outlet"
|
||||
]
|
||||
},
|
||||
"quality": {
|
||||
"X_mean": [
|
||||
4.245825290679932,
|
||||
99.6146011352539,
|
||||
150.18072509765625,
|
||||
70.02484893798828,
|
||||
10.967876434326172,
|
||||
74.14215850830078
|
||||
],
|
||||
"X_std": [
|
||||
2.18487548828125,
|
||||
46.58076858520508,
|
||||
51.831016540527344,
|
||||
11.553886413574219,
|
||||
4.02312707901001,
|
||||
31.69878578186035
|
||||
],
|
||||
"y_mean": [
|
||||
92.10986328125,
|
||||
89.79142761230469
|
||||
],
|
||||
"y_std": [
|
||||
11.346452713012695,
|
||||
8.92744255065918
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
backend/app/services/pt_models/tension.onnx
Normal file
BIN
backend/app/services/pt_models/tension.onnx
Normal file
Binary file not shown.
Reference in New Issue
Block a user