The suggested methodology uses a system-based Industry 5.0 Cyber-physical human system (CPHS) approach that combines explainable deep learning with a cyber-physical collaboration framework enabled by edge computing to support sustainable manufacturing processes. First, the problem is addressed by recognizing certain limitations of current CPHS solutions, such as a lack of AI-powered intelligence, explainability, and human-centric collaboration. To address the challenges, the proposed solution leverages the MIMII dataset for industrial machine condition monitoring using acoustic signal processing.
The proposed framework begins by feeding the generated spectrograms to a CNN model that extracts spatial features by recognizing significant frequency patterns associated with different machine conditions. The extracted spatial features will be converted into sequences and fed into a transformer encoder module to capture temporal dependencies via self-attention. The transformed feature representation is subsequently passed to a fully connected classifier module to classify machine states as normal or abnormal. In addition, to ensure transparency and facilitate human-centric decision-making, the SHAP explainability approach is employed to explain predictions by selecting significant time-frequency regions in the model output. The designed model will be implemented in an edge-enabled CPS setting, enabling real-time inference with low computational latency and energy expenditure. In addition, a human-in-the-loop scheme will be integrated to enable human operators to validate using explainability results. Performance is validated using accuracy, precision, recall, and F1-score, as well as other system-level metrics such as latency and energy efficiency.
The proposed framework is an XAI-driven CPHS mechanism for sustainable manufacturing in the context of Industry 5.0, and its workflow is presented as a pipeline from data acquisition to intelligent decision-making and execution, as shown in Figure 1. In the initial stage of the data acquisition procedure, sound signals are collected from machines in industries such as motors, pumps, and bearings using datasets including MIMII. Data signals thus obtained are forwarded to the next stage, referred to as data preprocessing, where they undergo filtering, normalization, and segmentation. The segmented data signals are finally converted to a spectrogram using the short-time Fourier transform (STFT) at the feature representation layer.
Then, the AI model layer uses the spectrogram images to extract features via the CNN module, identifying spatial patterns and anomalies. Then, the extracted features are reshaped and fed into the transformer encoder, which learns temporal dependencies and long-range relationships via self-attention mechanisms. The resulting feature vectors are classified as normal or abnormal using the classification layer. To ensure transparency in the prediction process, the explainability layer uses SHAP to highlight significant time-frequency regions in the spectrogram.
Additionally, there is a human-in-the-loop process in which operators interpret and provide feedback on the model's outcomes. In the deployment layer, the model runs on an edge-based CPHS infrastructure, ensuring fast inference and low power consumption, while optionally interfacing with cloud systems for storage requirements or advanced analytics. Altogether, the framework ensures accurate fault detection, explainability, and efficient real-time operation in line with the requirements of Industry 5.0.
Problem definition and requirement analysis
Cyber-physical human systems (CPHS) in Industry 5.0 settings promise intelligence, sustainability, and human-centeredness. Still, contemporary frameworks for building CPHS are hindered by a lack of advanced AI-enabled capabilities, explainability, and adequate support for human-machine collaboration. Indeed, conventional CPHS are based on rule-based or uninterpretable models, which impede adaptation to changing industry conditions and limit the operators' confidence in automation. Moreover, conventional CPHS cannot effectively analyze highly sophisticated data, such as industrial acoustic signals containing both spatial (i.e., frequency) and time-dependent components, which are important for predictive maintenance. Hence, it is necessary to create a framework that can detect machine anomalies with high precision, provide explanations, and operate at the edge, thereby enabling CPS.
Here x(t) is the acoustic input signal, S(f,t) is the spectrogram representation of the signal,
is the label and θ is the parameter set of the CNN-Transformer architecture. Symbols used in subsequent equations are introduced right after their first appearance in order to preserve mathematical correctness.
From a mathematical point of view, the task can be formalized as a supervised learning problem. Let the industrial acoustic signal be denoted by x(t). The STFT of x(t) is computed according to the formula:
(1)
where ω(.) is the window function and f is the frequency. The generated spectrogram
serves as the input to the deep learning algorithm. The goal is to train the mapping function
(2)
where
is the class label (either normal or abnormal), and where S is the spectrogram input, y is the predicted output label and θ is the set of learnable parameters of the CNN-Transformer architecture. The optimization problem is formulated as the minimization of the classification loss:
(3)
subject to the constraints of minimum latency
, energy efficiency
, and interpretability, wherein the explanation ∅(SHAP) captures the importance of features in the prediction process,
(4)
where
is the contribution of each individual feature. In line with the foregoing, the design requirements include the following: (i) reliable anomaly detection based on hybrid deep learning, (ii) interpretable outputs for human intervention, and (iii) implementation in an edge-enhanced CPS framework.
Dataset acquisition and preprocessing
In this regard, to assess the proposed Explainable AI-based CPHS framework, the MIMII Dataset13 has been selected. This dataset is a widely used benchmark for detecting anomalies in industrial machinery using acoustic signals. This database contains sound recordings of various machines, such as slide rails, fans, pumps, and valves, under both normal and faulty operating conditions. For each machine, recordings vary with different settings and noise environments. This makes it suitable for training and evaluating models under real-time industrial conditions.
Whereas the MIMII dataset is widely used in unsupervised anomaly detection studies that rely solely on normal samples during training, it includes explicit annotations of both normal and anomalous machine states. The problem is posed as a supervised binary classification task to test the ability of the proposed Explainable AI-based CNN-Transformer architecture to separate healthy from faulty machine states. Specifically, the official MIMII labels are used, assigning class label 0 to normal samples and class label 1 to anomalous samples.
Table 1 shows the Dataset Description Details. Approximately 12,000 recordings of acoustic signals are considered in the current research, including both normal and faulty machinery operations. As per the requirements, all recordings in this study have been captured at 16 kHz and are 10 s long. Although the dataset contains approximately 12,000 recordings, a class-balanced subset of 2,000 test recordings was selected solely to visualize the confusion matrix. All reported performance metrics were computed using the complete test set (approximately 2,400 recordings). Furthermore, training and test samples are separated at an 80:20 ratio for model training. This database is well-suited for Industry 5.0 applications because it includes real-time noise conditions. The recording distribution used in this study is given in Table 2. From this dataset, approximately 12,000 recordings covering all machine types and signal-to-noise ratio (SNR) conditions were selected for the supervised binary classification experiments using an 80:20 train/test split, shows the industrial machine types, corresponding machine IDs, total numbers of normal and anomalous acoustic recordings, SNR conditions, and the experimental train/test partition employed for supervised binary classification.
The experiment was carried out using the MIMII (Malfunctioning Industrial Machine Investigation and Inspection) dataset version 1.0, which comprises four types of industrial machines: fans, pumps, valves, and slide rails. Data were collected from different machine IDs (ID00–ID06, depending on the machine type) and conditions. The MIMII database comprises data acquired at signal-to-noise ratios (SNRs) of −6 dB, 0 dB, and +6 dB. Normal data corresponds to the healthy condition of the industrial machine, while anomalous data corresponds to an anomalous condition. The classes were labeled based on the database annotation, with normal data labeled class 0 and anomalous data labeled class 1.
A fair evaluation procedure required that the split between train and test sets occur at the original audio-recording level prior to any splitting, augmentation, or spectrogram creation steps. As a result, audio segments from the same recording could not appear in both the train and test sets. For the evaluation experiment, recordings with different signal-to-noise ratios (−6 dB, 0 dB, and +6 dB) were used, which provided an opportunity to evaluate the suggested framework under various industrial conditions.
To prevent data leakage, the train/test split was performed using the original audio file as the basis, prior to any segmentation or spectrogram generation. Segments from the same 10 s audio recording were assigned exclusively to either the training or the testing set, with no segments present in both sets. Afterward, spectrograms were generated and augmented separately for each dataset. This way, the problem of data leakage is avoided, thereby preventing an overly optimistic assessment of performance.
Dataset preprocessing
The unprocessed acoustic signals from the MIMII dataset are then processed to improve signal quality and enable effective feature extraction. The input signal is denoted by x(t), where t is time. The first process is noise filtering, whereby background noises are filtered using a filtering function such that:
(5)
where ∗ represents the convolution process and h(t) is the filter's impulse response. This process enhances the clarity of the acoustic signal and minimizes the effects of noise often prevalent in industrial environments. Signal normalization is used to ensure that the amplitudes of all audio signals are comparable before feeding them into the deep learning model. The normalized signal, denoted as xn(t), is calculated as:
(6)
where μ and σ are the mean value and standard deviation of the input signal, respectively. All input signals are guaranteed to have zero means and unit variances thanks to this procedure. Finally, for processing, the normalized input signal is divided into multiple tiny pieces. Given that the length of the entire signal is T, it is broken down into N overlapping frames, each having a length L using a sliding window function:
(7)
where H is the hop size. The spectrogram can be defined by the formula below:
(8)
The spectrograms obtained in this way are fed into the CNN-transformer-based framework to extract spatial and temporal features for successful anomaly detection. Figure 2 shows the preprocessing pipeline.
Figure 2 illustrates a vertical preprocessing pipeline that may be employed for acoustic data acquired in industry. Firstly, the raw audio signals are extracted from the MIMII dataset and fed into the noise-removal stage to reduce noise. This is followed by normalizing the signal to remove amplitude inconsistencies, ensuring the signal is consistent. The signal is later split into smaller overlapping sections. Following segmentation, STFT transforms will be applied to the data to convert time-domain signals into time-frequency signals. Then, the power spectrum is calculated as part of generating the signal's spectrogram. Preprocessed spectrograms will thus be the output generated in the process and will be used in the proposed CNN-transformer model.
Spectrogram generation
After data normalization and segmentation, acoustic signals are converted into a time-frequency representation using the Short-Time Fourier Transform (STFT). The resulting spectrogram provides a pictorial representation of changes in frequency composition over the period of analysis. In industrial settings, machine faults usually manifest as frequency patterns, making spectrograms more useful for detecting machine anomalies.
The resulting processed data is therefore converted into spectrogram images to distinguish between normal and abnormal instances within the machines. The audio data will be converted into multiple spectrograms to enable the learning model to analyze local frequency components and temporal changes within the machine process. These images are used as input data for the CNN-transformer model, where the CNN handles spatial (frequency) patterns while Transformers handle temporal relationships.
Algorithm 1: Spectrogram Generation from Acoustic Signals
Input: Raw audio signal x(t)
Output: Spectrogram S(t, f)
Step 1: Load audio signal x(t)
Step 2: Apply noise filtering
Step 3: Normalize signal xn(t)
Step 4: Segment signal into frames:
for k = 1 to N do

end for
Step 5: Apply a window function w(t) to each segment
Step 6: Compute STFT:
(9)
Step 7: Compute magnitude:
(10)
Step 8: Store spectrogram S(t, f)
Step 9: Return spectrogram dataset
The process of generating spectrograms starts with acquiring the original audio signal, followed by preprocessing steps such as noise reduction and signal normalization to ensure signal integrity and quality. After that, the normalized audio is sliced into multiple overlapping windows to capture the temporal characteristics of both long- and short-term periods. To prevent spectral leakage, each of the slices is multiplied by the window function before being passed through the Short-Time Fourier Transform. Afterward, the transformed signal is represented as a complex-valued function in the frequency domain, and its magnitudes are squared. Thus, the energy of the frequencies over the given time is represented by the spectrograms. Finally, they are stored as image-like data and fed to the neural network for training.
Spatial feature extraction using CNN
After the process of creating spectrograms, the output time-frequency images are taken as inputs and are given to a Convolutional Neural Network (CNN). Assuming the input spectrogram as
, where H is the frequency domain and W is the time domain. The purpose of using the CNN here is to learn discriminative spatial features from the input spectrogram. These discriminative spatial features will help differentiate between normal and abnormal machine behavior in an industrial environment.
A basic operation performed by the Convolutional Neural Network (CNN) is convolution. Convolution with a given filter
is given as:
(11)
The operation described above enables the neural network to identify local spatial features, such as edges, frequencies, and harmonic content, in the spectrogram. This is done through multiple filter operations that generate various feature representations, producing several feature maps. Convolution is followed by a non-linear activation function, as shown below:
(12)
This non-linearity enables the network to capture and represent complex relationships among variables. The next stage in a convolutional neural network involves the application of pooling operations. The common technique of max pooling is expressed mathematically as follows:
(13)
where Ω refers to the pooling window. Pooling helps to achieve translation invariance and retain only the relevant information while discarding redundancy. From low-level variables such as frequencies to complex machine behavior, higher-level features can be extracted hierarchically using a convolutional neural network. Consequently, feature maps can be used to depict the network's ultimate output:
(14)
where represents the learnable parameters of the CNN. The feature maps contain rich spatial information and are transformed into sequences to serve as inputs to the transformer encoder in the next phase. The above-described spatial feature extraction process is crucial for enabling the model to detect minute anomalies in industrial acoustic signals.
Figure 3 demonstrates how spatial features are extracted horizontally from the spectrogram input using a CNN model. It starts with the input spectrogram, which encodes time-frequency properties of the audio signal in a pictorial form. The input spectrogram is then passed through a convolutional layer, in which several types of filters extract spatial features such as frequency bands, edges, and textures, thereby producing feature maps. Thereafter, the extracted feature maps undergo a nonlinear activation function, rectified linear unit (ReLU), allowing the neural network to detect dependencies in the input data. The feature maps are then passed through a pooling layer, where the map size is reduced while retaining its most important characteristics. This process of convolutional, activation, and pooling layers repeats itself multiple times, creating a hierarchy of feature representation that begins with simple features and evolves toward more sophisticated ones related to machine operations.
Temporal modeling using a transformer encoder
Once the spatial features have been extracted using the CNN, the next step is to derive high-level feature maps that capture frequency-based patterns learned from the spectrogram. The resulting feature maps are then flattened and reshaped into sequences to capture temporal information in the acoustic signal. Assuming the feature maps are represented by
, where H', W', and C are height, width, and channels, respectively, the following sequence is derived:
(15)
where T represents the sequence length, and d is the feature dimension. The Transformer then uses the above sequence to model long-term dependencies using a self-attention mechanism. The transformer model, in contrast to conventional recurrent models, processes each element of the sequence in parallel and uses attention weights to determine each piece's relative relevance. The way the attention mechanism works is by using Query Q, Key K, and Value V vectors generated for each input xt according to:
(16)
whereas WQ, WK, WV are trainable weights. The similarities among the elements are determined through:
(17)
dk is important vectors' dimension. This procedure makes it easier for the model to learn dependencies from distant time steps in the signal and focus just on the pertinent time segments. To increase the network's capacity for learning, multihead attention is used, which refers to the process whereby several heads of attention learn from the input in parallel:
(18)
Each head attends to distinct features of the temporal input sequence. This is followed by feed-forward neural networks and residual connections:
(19)
The resulting encoded sequence captures both the spatial and temporal features of the input. This sequence is sent to the classifier layer to detect anomalies.
Figure 4 shows the overall process of Temporal modeling using a transformer Encoder on features extracted from the CNN. First, the feature maps extracted from the CNN are used; they contain spatial information from the spectrogram. The feature maps are flattened into a sequence, with each item corresponding to a timestamp. After that, the sequence passes through a linear transformation that maps the data into vectors of a specific dimension. As transformer models lack the ability to capture temporal dependencies, positional encoding is also added to the embedding vectors to preserve the sequence's temporal structure. Finally, the sequence passes through a transformer encoder, consisting of a stack of multiple layers, in which a multi-head self-attention mechanism is employed to enable the model to learn connections between timestamps in the sequence. The feed-forward neural network further improves these embeddings, while residual connections ensure that gradients propagate efficiently. The process is repeated across the stacked transformer encoder layers, which capture progressively more complex temporal interactions. In the end, the sequence embeddings are combined into a fixed-length representation via pooling (e.g., average pooling or the classification token (CLS)), yielding a global temporal feature representation.
Classification layer
Following temporal encoding with the transformer encoder, the outputs will be a sequence of encoded vectors, each with features related to both the spatial and temporal aspects of the input signal. The first step toward classification from the encoded outputs is to aggregate all those features into a single vector. This is achieved either by applying mean pooling to the sequence of feature vectors or by employing the so-called "classification token". Suppose the output of the Transformer is
, where each
. The aggregated feature h is computed as:
(20)
Then, the aggregated feature vector h represents the input in a compact form and serves as the classifier's input. The classification part comprises one or more dense layers, which transform the learned representation into the output space. A dense layer implements a transformation that is defined as follows:
(21)
where o is the output (logits), b is the bias vector, and W is the weight matrix. The latter are the class scores in an unnormalized form. To incorporate nonlinearity into the model, activation functions such as ReLU are often used. Finally, a softmax activation function is applied to the logits to obtain a probability for each class:
(22)
where C represents the number of classes, (C = 2; normal and abnormal). The class prediction will be based on the maximum probability value. During training, the optimal values of the model’s parameters are obtained by minimizing the cross-entropy loss between the actual and predicted labels, thereby achieving accurate classification of machine states. In summary, the classification layer serves an essential function in transforming the extracted temporal features using the Transformer architecture into practical decisions. Through proper discrimination between healthy and faulty machine states, anomaly detection and intelligent decision-making become possible within the Industry 5.0 paradigm.
Figure 5 shows how the classification layer works, which comes after the transformer Encoder. The process starts with the encoded sequence output, in which each vector contains temporal information learned from the input. These vectors are combined into a single vector, known as the global feature vector. The next step is to pass the global feature vector through several dense neural network layers. In each dense layer, matrix multiplication operations are performed to create linear combinations of the inputs. After that, a non-linear activation function, such as ReLU, can be applied to increase the flexibility in learning decision boundaries. At the end of the last dense layer, there are logit scores for each class. These logit scores can be used on the Softmax function to calculate probability scores for each class. These probability scores are used to determine whether the input belongs to Class 0 (Normal) or Class 1 (Abnormal).
Explainability using SHAP
After the model classifies input signals, predictions are generated based on whether the machine operates normally or abnormally. Nonetheless, within the Industry 5.0 environment, it is not enough to produce predictions; the system must also provide transparency and explainability to support human decision-making. The following framework uses SHAP, a game-theory-based model that quantifies the importance of each feature in determining the prediction. In doing so, SHAP assigns weights to features, allowing one to evaluate the relative importance of different sections of the spectrogram input to the overall prediction.
The mathematical formulation of SHAP is based on a decomposition of the model f(x):
(23)
where ∅0 is the baseline value (mean model output), ∅i is the effect of the i-th feature, and M is the number of input features. For the purpose of this study, the features are the time-frequency bins from the spectrogram. SHAP values are positive if they contribute to the probability of the abnormal state and negative otherwise. This formulation guarantees a unique, locally consistent explanation for each prediction. The SHAP method can be applied to a trained CNN-transformer model to provide an explanation based on feature importance. The visual representation will show the most important time-frequency bins in the spectrogram that affect the decision-making process. For instance, abnormal behavior of the equipment may result in certain high-energy frequency bands that the SHAP framework identifies as important contributors to the decision process.
In addition, SHAP can foster cooperation between people and machines in a cyber-physical setting. This is because the predictions can be explained using intuitive visuals, allowing the operators and decision-making systems to verify predictions, analyze the problem, and take appropriate steps. This not only increases trust but also makes AI-based manufacturing processes reliable and accountable. By integrating deep learning algorithms that meet current performance standards with SHAP, which provides explainability, the proposed architecture fulfills the requirements of Industry 5.0.
Algorithm 2: SHAP-based Explainability for Model Prediction
Input: Trained model f(x), input spectrogram S
Output: SHAP values
and explanation map
Step 1: Input spectrogram S into a trained model
Step 2: Compute prediction: y = f(S)
Step 3: Initialize a deep learning-oriented SHAP explainer
Step 4: Compute SHAP values:

Step 5: For each feature i in S:
Calculate contribution 
Step 6: Generate explanation map:
Highlight regions with high 
Step 7: Visualize feature importance (heatmap)
Step 8: Return SHAP values and explanation map
The SHAP-based explainability algorithm starts by obtaining a preprocessed spectrogram image as input and feeding it into the trained CNN-transformer architecture to make predictions (e.g., normal or abnormal machine condition). After making predictions using the trained architecture, the SHAP method is used to interpret the model. In particular, the SHAP values (ϕ) are computed for each input feature to find out which time-frequency components of the input contribute most to the prediction. To calculate these values, the model outputs for inputs with and without certain features must be compared.
After calculating the SHAP values for each feature, its influence on the prediction can be evaluated by the sign and magnitude of the SHAP value. For example, features with higher SHAP values are more likely to influence the outcome, and a positive or negative sign indicates that the feature pushes the prediction toward the normal/abnormal class, respectively. Based on the results, an explanation map can be made in the form of a heatmap.
Lastly, the algorithm outputs both the SHAP values and the visualizations, providing insight into how humans can analyze the model's decision. The technique makes the process more transparent and allows humans to engage in decision-making, thus ensuring that both the algorithm's predictions and its reliability are achieved in the AI-driven industry. Representative test samples were selected from accurately diagnosed anomalous instances across various machine types to improve the reliability of the explainability analysis. While global SHAP feature-importance analysis was performed by aggregating SHAP values across the test dataset to identify consistently influential time-frequency locations, local SHAP explanations were generated for these representative cases. Without requiring expert annotation, this integrated local and global analysis offers a reliable interpretation of the model predictions.
Edge-enabled CPS Integration
This proposed solution is used within the edge-enabled CPS, which aims to achieve efficiency, sustainability, and real-time industrial operations. Once the model has been trained, the CNN-transformer will be deployed via an edge computing approach. The edge computing layer in question is near the industrial Internet of Things (IIoT) devices, including the sensors and machinery. Rather than transmitting all collected data to the cloud, the edge device performs inference on the incoming acoustic signal without first transferring it there. Therefore, the system can detect machinery abnormalities almost instantly and take the necessary steps before the situation deteriorates further. Another advantage of this edge-enabled approach is improved latency and efficiency since data is analyzed near the point of generation. In other words, unlike in the cloud approach, where inference time Tinf
(24)
The latency, in general, will be considerably reduced through a decrease in Tcommunication. Another benefit is reduced bandwidth consumption and power expended when transmitting data continuously. This system is therefore scalable and sustainable for large industrial plants with numerous connected devices. In addition, the CPS enables interaction with the physical layer (machines), the AI (computational layer), and the human layer.
Human-in-the-loop collaboration
A key component of the suggested Industry 5.0 CPS, which includes human operators actively involved in the decision-making process alongside AI models, is human-in-the-loop collaboration. Namely, according to the designed framework, the system does not become an autonomous black box but instead allows operators to interact with it and observe explainable prediction results in the form of SHAP explanations. The predictions in question refer to the outcomes (normal/abnormal), accompanied by visualizations of parts of the spectrograms used to make them.
Such an interaction helps operators better understand exactly how the prediction is formed and which factors contribute to it. Human involvement implies verifying the system's results and allowing operators to override them when necessary, based on their professional judgment. Collaboration with human operators makes the system more trustworthy, efficient, safe, and reliable, helping prevent errors.