This project implements an end-to-end Predictive Maintenance (PdM) solution to estimate the Remaining Useful Life (RUL) of turbofan jet engines using the NASA C-MAPSS (FD001) dataset.
The system utilizes a Deep Learning approach (LSTM - Long Short-Term Memory) to model the temporal degradation patterns of engine sensors. It features a complete pipeline including signal processing, feature engineering, model training, evaluation, and a production-ready REST API built with FastAPI.
- High Accuracy: Achieved an RMSE of 13.87 on the unseen test set (outperforming standard benchmarks of ~15.0).
- Robust Preprocessing: Implemented Moving Average Filtering and Variance Thresholding to reduce sensor noise.
- Microservice Architecture: Deployed the trained model as a REST API capable of real-time inference.
- Dynamic Windowing: Utilizes a sliding window technique (Sequence Length = 50) for time-series forecasting.
The raw sensor data from NASA contains high-frequency noise. The pipeline applies:
- Feature Selection: 7 constant sensors (
s_1,s_5, etc.) were removed based on variance analysis. - Noise Reduction: A Moving Average Filter (window=5) smoothens the sensor readings to reveal degradation trends.
- Normalization: MinMax Scaling ensures all 14 active sensors are within the [0, 1] range.
The core model is designed to capture long-term dependencies in time-series data:
- Input Layer: Shape
(50, 14)representing 50 flight cycles of 14 sensors. - LSTM Layers: Two stacked LSTM layers (128 & 64 units) with
return_sequences=True/False. - Regularization: Dropout (0.3) to prevent overfitting.
- Output: Dense layer predicting a single continuous value (RUL).
- Framework: FastAPI with Uvicorn server.
- Structure:
lifespanmanager for efficient model loading. - Validation: Pydantic models ensure data integrity for input sequences.
Turbofan_Project/
│
├── api/ # Microservice & Serving Layer
│ ├── main.py # FastAPI Application Entry Point
│ └── test_api.py # Client Script for API Testing
│
├── data/ # Dataset Directory
│ └── raw/ # C-MAPSS Data (train_FD001.txt, etc.)
│
├── models/ # Artifacts Store
│ ├── saved_models/ # .h5 Model and .pkl Scaler
│ └── test_result_plot.png # Evaluation Graphs
│
├── notebooks/ # Research & Experiments
│ ├── 1_Exploratory_Data_Analysis.ipynb
│ ├── 2_Signal_Processing.ipynb
│ └── 3_Model_Evaluation.ipynb
│
├── src/ # Source Code Modules
│ ├── data_loader.py # Data Ingestion
│ ├── preprocessing.py # Feature Engineering & Windowing
│ ├── model_def.py # LSTM Architecture Definition
│ └── evaluate.py # Evaluation Pipeline
│
├── train.py # Main Training Script
├── requirements.txt # Dependencies
└── README.md # Project Documentation
git clone [https://github.com/yourusername/turbofan-rul-prediction.git](https://github.com/yourusername/turbofan-rul-prediction.git)
cd turbofan-rul-prediction
pip install -r requirements.txtThis script loads raw data, processes it, trains the LSTM model, and saves the best weights.
python train.pyGenerates predictions on the Test set and calculates RMSE/MAE metrics.
python src/evaluate.pyStart the FastAPI server for real-time predictions.
uvicorn api.main:app --reload
Access Swagger UI at: http://127.0.0.1:8000/docsThe model was evaluated on 100 test engines.
RMSE: 13.87
MAE: 10.24
Prediction vs. Actual (Test Set):
(Note: The red line represents the LSTM predictions, closely tracking the actual degradation path shown in black.)
Endpoint: POST /predict
Request Body (JSON): Must contain a list of 50 time steps (dictionaries).
JSON
{
"data": [
{ "s_2": 641.82, "s_3": 1589.70, "s_4": 1400.15, ... },
...
{ "s_2": 642.15, "s_3": 1590.20, "s_4": 1401.05, ... }
]
}
JSON
{
"status": "success",
"predicted_rul": 112.45,
"unit": "cycles"
}
This project is licensed under the MIT License.