The seamless integration of continuous casting and rolling stands as the cornerstone for determining final steel product quality and production efficiency. Among the various quality challenges inherent to this process, the surface slag inclusion defect represents a persistent and detrimental flaw. These non-metallic inclusions, trapped within or just beneath the slab surface, possess a strong hereditary characteristic. Minor slag inclusions, if not addressed, inevitably transfer to subsequent rolled plates, manifesting as surface defects such as scabs or blisters. This not only degrades surface quality and reduces metallic yield but also necessitates costly rework or downgrading. In severe cases, large or clustered slag entrapment can act as initiation points for catastrophic breakouts during casting, causing significant production disruptions and safety hazards.

Traditionally, the detection of the slag inclusion defect has relied on manual visual inspection or offline sampling and laboratory analysis. These methods suffer from inherent limitations: they are inefficient, subjective, labor-intensive, and critically, cannot provide real-time predictions necessary for proactive process control. While machine vision-based techniques offer automation, their effectiveness is often compromised by interfering factors like oxide scale and unevenly distributed mold powder residues on the hot slab surface, leading to unacceptably high rates of missed detections (false negatives). Consequently, machine learning (ML)-based predictive modeling has emerged as a promising research focus for the online prediction of the slag inclusion defect, leveraging its powerful function approximation and self-learning capabilities to correlate process parameters with defect occurrence.
However, a prevalent issue persists in existing ML-based models for slag inclusion defect prediction. Models often achieve high accuracy on training data but fail to maintain reliable, generalizable performance when applied to unseen test data or in online deployment. This discrepancy stems from the lack of a systematic methodology to optimize model hyperparameters, which are crucial for balancing model complexity (fitting ability) with generalization capability. Simply maximizing training accuracy does not guarantee robust real-world performance. Therefore, the core challenge is to establish a principled approach for hyperparameter optimization that explicitly targets the improvement of test sample accuracy, even when that accuracy is unknown during the model tuning phase.
This study addresses this challenge head-on. Leveraging a comprehensive slab sample dataset acquired from an industrial casting production line and its associated quality tracking system, we develop and compare prediction models for the slag inclusion defect using three distinct algorithms: Support Vector Machine (SVM), Random Forest (RF), and Adaptive Boosting (AdaBoost). A critical preparatory step involves rigorous data preprocessing, including the handling of outliers using the Z’-Score method to ensure data quality. Our analysis identifies SVM as offering the most favorable balance between fitting and generalization. We then make a key contribution by constructing a relational model that quantitatively links the test sample accuracy metric (F2-score) to the readily observable training sample accuracy metrics (false positive rate, false negative rate, and F2-score). This relationship model enables the estimation of test performance during training. Finally, we employ the Particle Swarm Optimization (PSO) algorithm to systematically search for the optimal SVM hyperparameters, using the predicted test F2-score from our relational model as the fitness function. This integrated PSO-SVM framework allows for the rational optimization of model parameters to enhance practical prediction accuracy, thereby facilitating the more reliable identification of slabs with the slag inclusion defect for timely corrective grinding, ultimately improving downstream product quality stability and metallic yield.
1. Influencing Factors and Data Foundation for the Slag Inclusion Defect
The formation of the slag inclusion defect is a complex phenomenon primarily attributed to the entrapment of non-metallic inclusions at the solidifying shell in the mold, especially near the meniscus region. The sources of these inclusions are diverse, including exogenous particles (such as ladle slag, refractory erosion products, and entrained mold flux) and endogenous particles (like deoxidation products and precipitates). The key mechanism facilitating their capture is meniscus turbulence and fluctuations that lead to flux or slag entrainment. Therefore, any process parameter influencing inclusion generation, fluid flow, heat transfer, and meniscus stability in the casting mold can be a potential predictor for the occurrence of the slag inclusion defect.
Based on metallurgical principles and process analysis, we identified a comprehensive set of 60 potential influencing factors spanning the entire steelmaking and casting route. These factors can be categorized as follows:
- Steelmaking & Refining: Parameters like main blowing time/oxygen, reblowing operations, number and duration of ladle furnace (LF) treatments, stirring times, holding times, Ruhrstahl-Heraeus (RH) degassing parameters, and chemical compositions of both steel ([C], [Si], [Mn], [P], [S], [Alt], [Als], [Ca]) and slag (SiO2, CaO, MgO, Al2O3, TiO2).
- Continuous Casting: A wide array of parameters including tundish conditions, casting sequence length, superheat, stopper rod position and its fluctuation, submerged entry nozzle (SEN) life and immersion depth, mold level fluctuation, casting speed and its variation, mold powder consumption/properties (viscosity, basicity), and mold thermal monitoring data (inlet/outlet water temperatures, heat flux densities for wide and narrow faces, and various derived thermal asymmetry indices). Oscillation parameters (frequency, stroke, negative strip time) are also critical.
- Operational Events: Discrete events such as tundish changes, mold powder line changes, and SEN replacements.
To operationalize this knowledge for online prediction, a Slab Quality Analysis and Monitoring System was implemented. This system integrates high-frequency data acquisition from Level 1 and Level 2 systems, manual offline data entry, and soft-sensor techniques to collect the aforementioned parameters. A core function of this system is a spatio-temporal matching model that accurately associates the time-series data of each high-frequency parameter (e.g., stopper position, SEN depth, mold level, casting speed, mold water temperature) with the specific slab being cast at that moment. The system tracks the precise time each slab enters and exits the mold region. For each slab and each parameter, integrated features (e.g., mean value during the slab’s casting period) are calculated. These features, combined with the final defect inspection result from the downstream rolled plate surface inspection system (which provides the ground truth label for the presence of the slag inclusion defect), form the structured slab sample dataset used for model development. A schematic representation of this data association is conceptually vital, showing how high-frequency traces are segmented and attributed to individual slabs.
2. Methodological Framework
2.1 Data Preprocessing
Industrial data is inherently noisy. Missing values and outliers are common due to sensor failures, communication errors, or manual recording mistakes. Effective preprocessing is essential for building robust models.
- Missing Values: Were handled using a combination of direct deletion (for instances with excessive missing data) and mean imputation (for parameters with sporadic missing points).
- Outlier Detection and Treatment: The Z’-Score method, based on the median and median absolute deviation (MAD), was employed for its robustness against extreme values. For a feature vector \( \mathbf{x} \), the Z’-score for each data point \( x_i \) is calculated as:
$$ Z’_i = \frac{x_i – M(\mathbf{x})}{1.4826 \times D} $$
where \( M(\mathbf{x}) \) is the median of the feature data and \( D \) is the median absolute deviation, \( D = \text{median}(|x_i – M(\mathbf{x})|) \). Data points with \( |Z’_i| > 3 \) are considered outliers. Right-skewed outliers are replaced by \( M(\mathbf{x}) + 3 \times 1.4826 \times D \), and left-skewed outliers are replaced by \( M(\mathbf{x}) – 3 \times 1.4826 \times D \). This method effectively preserves the central tendency of the data while mitigating the influence of anomalous readings.
2.2 Modeling Algorithms
Three prominent machine learning algorithms were selected for constructing the slag inclusion defect classifier.
- Support Vector Machine (SVM): A powerful classifier that finds an optimal hyperplane to separate classes by maximizing the margin. For a non-separable case, slack variables \( \xi_i \) are introduced. The standard primal optimization problem for a binary classifier (label \( y_i \in \{-1, +1\} \)) is:
$$ \min_{\mathbf{w}, b, \boldsymbol{\xi}} \frac{1}{2} \|\mathbf{w}\|^2 + C \sum_{i=1}^{n} \xi_i $$
subject to \( y_i (\mathbf{w}^T \phi(\mathbf{x}_i) + b) \geq 1 – \xi_i, \quad \xi_i \geq 0, \quad i=1,\ldots,n \),
where \( \mathbf{w} \) is the weight vector, \( b \) is the bias, \( C \) is the regularization parameter, and \( \phi(\mathbf{x}_i) \) maps the input to a higher-dimensional space. To address the inherent class imbalance in our dataset (fewer defective slabs), a class-weighted SVM was used. The objective function is modified to:
$$ \min_{\mathbf{w}, b, \boldsymbol{\xi}} \frac{1}{2} \|\mathbf{w}\|^2 + C_{+} \sum_{i: y_i=+1} \xi_i + C_{-} \sum_{i: y_i=-1} \xi_i $$
where \( C_{+} \) and \( C_{-} \) are penalty parameters for the positive (defect) and negative (non-defect) classes, respectively. - Random Forest (RF): An ensemble method that constructs a multitude of decision trees during training and outputs the mode of their classes for classification. It is robust to overfitting and can handle non-linear relationships well.
- Adaptive Boosting (AdaBoost): An ensemble meta-algorithm that combines multiple weak classifiers (typically decision stumps) by adjusting the weights of misclassified samples iteratively, forcing subsequent learners to focus on harder cases.
2.3 Handling Class Imbalance
The slab dataset is naturally imbalanced, with a significantly smaller number of samples containing the slag inclusion defect. To mitigate this, oversampling of the minority class (defective slabs) was performed before model training. The optimal oversampling ratio was determined by analyzing the stability of correlation coefficients between key process parameters and the defect label as the minority class was progressively enlarged. It was found that when the defective sample count was increased by a factor of four, the correlation coefficients stabilized, indicating a sufficient representation of the defect class characteristics. This 4x oversampling ratio was subsequently used in all model training procedures.
2.4 Model Evaluation Metrics
For a defect prediction task, standard accuracy can be misleading, especially with imbalanced data. Therefore, the following metrics were employed, derived from the confusion matrix:
- False Positive Rate (FPR): Proportion of non-defective slabs incorrectly flagged as defective.
$$ \text{FPR} = \frac{FP}{FP + TN} $$ - False Negative Rate (FNR): Proportion of defective slabs incorrectly passed as non-defective. This is critically important from a quality perspective.
$$ \text{FNR} = \frac{FN}{TP + FN} $$ - Fβ-Score: The harmonic mean of precision and recall, weighted by β. Since missing a defective slab (high FNR) is more costly than a false alarm, we set β=2 to emphasize recall.
$$ F_{\beta} = \frac{(1 + \beta^2) \cdot \text{Precision} \cdot \text{Recall}}{\beta^2 \cdot \text{Precision} + \text{Recall}} = \frac{(1 + \beta^2) \cdot TP}{(1 + \beta^2)\cdot TP + \beta^2 \cdot FN + FP} $$
where Precision \( (Pr) = TP/(TP+FP) \) and Recall \( (Rc) = TP/(TP+FN) \). The \( F_2 \)-score is our primary metric for overall model performance.
The following table summarizes the core components of the model evaluation framework:
| Metric | Formula | Interpretation in Slab Inspection Context |
|---|---|---|
| False Positive Rate (FPR) | $$ \text{FPR} = \frac{FP}{FP + TN} $$ | Rate of unnecessary grinding or inspection of good slabs. |
| False Negative Rate (FNR) | $$ \text{FNR} = \frac{FN}{TP + FN} $$ | Rate of defective slabs missed, leading to potential downstream plate defects. |
| F₂-Score (Primary Metric) | $$ F_2 = \frac{5 \cdot Pr \cdot Rc}{4 \cdot Pr + Rc} $$ | Balanced score prioritizing the detection of defective slabs (Recall) over false alarms. |
2.5 Hyperparameter Optimization via Particle Swarm Optimization (PSO)
To systematically find the optimal hyperparameters (e.g., \( C_{+}, C_{-} \), kernel parameters for SVM), the Particle Swarm Optimization algorithm was employed. PSO is a population-based stochastic optimization technique inspired by social behavior.
- Each particle \( i \) has a position vector \( \mathbf{X}_i = [X_{i1}, X_{i2}, …, X_{iD}] \) in a D-dimensional search space, representing a candidate set of hyperparameters.
- Each particle also has a velocity vector \( \mathbf{V}_i \) and remembers its personal best position \( \mathbf{P}_{\text{best},i} \). The swarm shares the global best position \( \mathbf{G}_{\text{best}} \).
- In each iteration \( k \), the velocity and position are updated:
$$ \mathbf{V}_i^{k+1} = \omega \mathbf{V}_i^k + c_1 r_1 (\mathbf{P}_{\text{best},i}^k – \mathbf{X}_i^k) + c_2 r_2 (\mathbf{G}_{\text{best}}^k – \mathbf{X}_i^k) $$
$$ \mathbf{X}_i^{k+1} = \mathbf{X}_i^k + \mathbf{V}_i^{k+1} $$
where \( \omega \) is the inertia weight, \( c_1 \) and \( c_2 \) are acceleration coefficients, and \( r_1, r_2 \) are random numbers in [0,1]. - The fitness function evaluating each particle’s position is central to our approach and is detailed in the next section.
3. Core Innovation: Relating Training and Test Performance
The fundamental challenge in tuning the slag inclusion defect predictor is that the test accuracy (generalization performance) is unknown during the model development and hyperparameter search phase. We overcome this by constructing a predictive model for the test \( F_2 \)-score based solely on the training performance metrics.
We conducted 5,000 randomized training-test experiments using the SVM algorithm. In each experiment, hyperparameters were randomly selected, and the dataset was randomly split into 70% training and 30% test sets (maintaining the original class ratio before oversampling the training set only). For each run, we recorded the training metrics \( t_1 \) (FPR), \( t_2 \) (FNR), and \( t_3 \) (F₂-score), and the corresponding test metric \( f \) (F₂-score). A correlation analysis confirmed that \( f \) was related to \( t_1, t_2, \) and \( t_3 \).
To model this relationship, we constructed a second-order polynomial regression model:
- Feature Expansion: The original training metrics \( (t_1, t_2, t_3) \) were expanded to a second-order polynomial space, including square and interaction terms: \( t_1, t_2, t_3, t_1^2, t_2^2, t_3^2, t_1 t_2, t_1 t_3, t_2 t_3 \).
- Standardization: Each original feature was standardized: \( t’_j = (t_j – \mu_j) / \sigma_j \), where \( \mu_j \) and \( \sigma_j \) are the mean and standard deviation of the metric \( j \) across the 5,000 experiments.
- Model Fitting & Simplification: A polynomial regression was fitted, and the most significant terms were selected based on the magnitude of their coefficients. The resulting model for the predicted test \( F_2 \)-score \( \hat{f} \) is:
$$ \hat{f} = 0.62 – 1.19 t’_2 t’_3 – 0.89 t’_3^2 – 0.4 t’_2^2 – 0.35 t’_1 t’_3 – 0.28 t’_1 t’_2 $$
where \( t’_1, t’_2, t’_3 \) are the standardized training FPR, FNR, and F₂-score, respectively.
This model had a mean squared error (MSE) of 0.002564 and an R² value of 0.6103 on the experimental data, indicating it captures a significant portion of the variance in the test performance based on training behavior. This relational model \( \hat{f}(t’_1, t’_2, t’_3) \) becomes the crucial fitness function for the PSO algorithm.
4. Model Comparison, Optimization, and Results
4.1 Algorithm Comparison
The average performance metrics over the 5,000 random runs for the three algorithms are summarized below. The training performance reflects fitting ability, while the test performance reflects generalization.
| Algorithm | Training Sample Performance (Average) | Test Sample Performance (Average) | ||||
|---|---|---|---|---|---|---|
| FPR (t₁) | FNR (t₂) | F₂-Score (t₃) | FPR | FNR | F₂-Score (f) | |
| Random Forest (RF) | ~0.00 | ~0.00 | ~1.00 | 0.201 | 0.413 | 0.543 |
| AdaBoost | 0.092 | 0.083 | 0.845 | 0.158 | 0.332 | 0.638 |
| Support Vector Machine (SVM) | 0.110 | 0.061 | 0.868 | 0.187 | 0.265 | 0.685 |
Analysis: RF shows perfect fitting on training data but poor generalization (high test FNR), indicating severe overfitting. AdaBoost shows better generalization than RF but has a higher test FNR than SVM. While SVM has a slightly higher test FPR than AdaBoost, its test FNR is significantly lower. Since minimizing missed defects (FNR) is the primary industrial objective, and because SVM’s test \( F_2 \)-score is highest, the SVM algorithm was selected as the base model for further optimization.
4.2 PSO-SVM Optimization
The PSO algorithm was configured to optimize the SVM hyperparameters (e.g., \( C_{+}, C_{-} \), kernel coefficient \( \gamma \) for an RBF kernel). The fitness of each particle (hyperparameter set) was evaluated as follows:
- Train an SVM model with the hyperparameters on the (oversampled) training set.
- Calculate the training metrics \( t_1, t_2, t_3 \).
- Standardize these metrics using the precomputed \( \mu_j, \sigma_j \) from the 5,000-experiment dataset.
- Compute the predicted test \( F_2 \)-score \( \hat{f} \) using the relational model: \( \hat{f} = 0.62 – 1.19 t’_2 t’_3 – 0.89 t’_3^2 – 0.4 t’_2^2 – 0.35 t’_1 t’_3 – 0.28 t’_1 t’_2 \).
- Use \( \hat{f} \) as the fitness value for the PSO particle. A higher \( \hat{f} \) indicates a better particle position.
The PSO swarm iteratively explored the hyperparameter space, guided by this fitness function that inherently rewards parameter sets expected to generalize well.
4.3 Optimal Model Performance
The PSO algorithm converged to an optimal set of SVM hyperparameters. The performance of the final optimized PSO-SVM model is summarized below:
| Dataset | FPR | FNR | F₂-Score | Note |
|---|---|---|---|---|
| Training Samples | 0.110 | 0.015 | 0.920 | Actual measured performance. |
| Test Samples (Predicted) | N/A | N/A | 0.752 | Predicted by the relational model \( \hat{f} \) using the optimal training metrics. |
| Test Samples (Actual) | 0.229 | 0.186 | 0.727 | Actual measured performance on the held-out test set. |
The optimized model successfully balances the metrics. The test FNR of 18.6% means over 80% of slabs with the slag inclusion defect are correctly identified. The test FPR of 22.9% indicates a manageable false alarm rate. The actual test \( F_2 \)-score of 0.727 is close to the predicted value of 0.752, validating the effectiveness of the relational model and the PSO optimization strategy. This performance represents a significant improvement over the average SVM performance (F₂=0.685) obtained from random hyperparameter selection, demonstrating the value of our systematic optimization approach focused on estimated generalization.
5. Conclusion and Practical Implementation Strategy
This study presents a robust methodological framework for developing and optimizing a predictive model for the surface slag inclusion defect in continuous casting slabs. The core challenge of ensuring high generalization performance (test accuracy) was addressed by establishing a quantitative relationship between training and test performance metrics. The key findings and contributions are:
- Model Selection: Among SVM, RF, and AdaBoost, the class-weighted SVM algorithm demonstrated the most favorable equilibrium between fitting the training data and generalizing to unseen test data for the slag inclusion defect prediction task, particularly in achieving a lower false negative rate.
- Relational Model: A second-order polynomial model was successfully derived to predict the test \( F_2 \)-score (\( \hat{f} \)) based on standardized training performance metrics (FPR, FNR, F₂-score). This model, expressed as
$$ \hat{f} = 0.62 – 1.19 t’_2 t’_3 – 0.89 t’_3^2 – 0.4 t’_2^2 – 0.35 t’_1 t’_3 – 0.28 t’_1 t’_2 $$
provides a viable proxy for generalization performance during model training. - Integrated Optimization: The Particle Swarm Optimization algorithm was effectively integrated with SVM, using the predicted \( \hat{f} \) from the relational model as the fitness function. This PSO-SVM framework enables a systematic, goal-oriented search for hyperparameters that are expected to yield high test accuracy, moving beyond mere minimization of training error.
- Performance Outcome: The optimally tuned PSO-SVM model achieved a test false negative rate of 18.6% and an \( F_2 \)-score of 0.727, representing a reliable and practical level of performance for industrial slab screening. The close agreement between the predicted (0.752) and actual (0.727) test \( F_2 \)-score underscores the utility of the approach.
For practical deployment in a continuous casting plant, the real-time prediction output—a probability value between 0 and 1 indicating the likelihood of the slag inclusion defect—can be used to implement a tiered inspection and grinding strategy:
- Low Risk (Prediction < 0.4): Slabs are classified as low risk. No mandatory inspection is required, optimizing operational throughput.
- Medium Risk (0.4 ≤ Prediction ≤ 0.7): Slabs are flagged for selective sampling and inspection. A statistically significant sample from this batch is checked to confirm model performance and catch potential defects.
- High Risk (Prediction > 0.7): Slabs are classified as high risk for containing the slag inclusion defect. These slabs undergo 100% mandatory surface inspection and/or preventive grinding to ensure the defect is removed before rolling.
This data-driven, optimized prediction system enables the proactive identification and treatment of slabs with the slag inclusion defect. By intercepting these defective slabs before they proceed to the rolling mill, the hereditary transmission of the defect to the final product is drastically reduced. This leads to a direct improvement in rolled plate surface quality, a decrease in product downgrades and scrappage, and an overall enhancement in production yield and cost-effectiveness. The methodology of linking training and test performance for guided optimization is also broadly applicable to other quality prediction challenges in metallurgical and manufacturing processes.
