# Deep Feature Fusion via Transfer Learning for Multi-Class Network Intrusion Detection
## 4 Proposed Method
### Detailed Description of the Proposed Model Structure
Finally, multi-head attention is defined as a process where multiple independent attention mechanisms are executed in parallel. The outputs from each attention mechanism are then concatenated, followed by multiplication with the weight matrix \(W_{O}\) to generate the final output. This can be expressed in Equation (8) as follows:  
\[MultiHead(Q,K,V)=Concat(head_{1},\ldots,head_{h})W_{O}\, \tag{8}\]  
where h represents the number of heads, and \(W_{O}\) represents the weight matrix applied to the combined heads. Next, the Flatten layer converts the 2D feature map into a 1D vector, which is then processed through Dense and Dropout layers to reconstruct the features into a format suitable for classification. Finally, Source Model #1 performs binary classification, determining normal and attack status using the Sigmoid function, and Source Model #2 classifies six attack types through the Softmax function. This structure allows both models to share the same network architecture. Still, their roles differ based on the activation function used in the final output layer, enabling binary and multi-class classification, respectively. Figure 4 illustrates the detailed structure of the binary and multi-class classification models in the target domain. In the target domain, two pre-trained models from the source domain, Source Model #1 and Source Model #2 are retrained using the CIC-IDS 2018 dataset through transfer learning techniques. During this process, the architecture and parameters of each model remain identical to those of Source Model #1 and Source Model #2 in the source domain, except for the classifier. As the model structure remains the same in the target domain, the training process follows a similar approach to that of the source domain, allowing the models to learn the features of the CIC-IDS2018 dataset. Source Model #1 performs binary classification, determining whether the traffic is normal or an attack. Source Model #2 conducts multi-class classification for six attack types, including previously learned attack types from the source domain and newly emerging attack types in the target domain. Finally, after feature fusion using the retrained Source Model #1 and Source Model #2 in the target domain, the final classification process is carried out for six attack types in the CIC-IDS2018 dataset. Figure 5 illustrates the overall structure of the proposed network intrusion detection model, incorporating transfer learning and feature fusion. The upper section of Figure 5 summarizes the overall model training process, while the lower section illustrates the  
Figure 4: Detailed structure of binary and multi-class classification models in the target domain. detailed training procedure, including the feature fusion process. Both sections visually represent the same overall workflow. During the model training process, once training in the source domain is completed, Source Model #1 and Source Model #2 are transferred to the target domain through transfer learning. Here, #1 represents the transfer learning process of Source Model #1, while #2 represents that of Source Model #2. Next, in the target domain, the previously trained binary classification model (Source Model #1) and multi-class classification model (Source Model #2) are retrained. During this phase, the classifier layers are excluded, and only the remaining model structure is used for feature extraction. Once both models complete training, the trained models are saved. At this stage, the extracted features from both models are structured as (1, 64) each, and these features are concatenated to form fused features in the shape of (1, 128). Finally, the fused features are processed through a Softmax classifier, enabling multi-class classification into six attack types. In this feature fusion process, the features output from Source Model #1 and Source Model #2 are combined, creating a richer feature map than single-model training while integrating more information.