# A Lightweight Fault Diagnosis with Domain Adaptation for Defected Bearings
## 2 Methodology
### Domain Adaptation  
In real-world industrial scenarios, bearing fault diagnosis often faces the challenge of domain shift, where the distribution of data collected under different working conditions (e.g., varying loads, speeds, or environments) differs significantly. This domain shift can severely degrade the performance of fault diagnosis models trained on one domain (source domain) when applied to another domain (target domain). To address this issue, domain adaptation techniques are introduced into the proposed framework, enabling the model to generalize across different domains and achieve robust cross-domain fault diagnosis.  
Domain adaptation aims to align the feature distributions of the source and target domains, allowing the model to learn domain-invariant features that are robust to changes in working conditions. In the context of bearing fault diagnosis, the source domain consists of labeled vibration data collected under specific operating conditions, while the target domain contains unlabeled or sparsely labeled data from different conditions. The domain shift arises due to differences in signal characteristics caused by variations in load, speed, or environmental noise. To mitigate this, domain adaptation techniques are integrated into the deep learning framework to ensure that the model performs well on both source and target domains.  
One of the most effective approaches for domain adaptation is adversarial training, which aligns the feature distributions of the source and target domains by introducing a domain discriminator. In this framework, the feature extraction network (MobileNet backbone) is trained to generate domain-invariant features that confuse the domain discriminator, while the discriminator is trained to distinguish between the source and target domains. This adversarial process encourages the feature extractor to learn representations that are invariant to domain-specific variations.  
The adversarial loss for domain adaptation can be formulated as follows:  
\[\mathcal{L}_{\text{adv}}=-\mathbb{E}_{x_{s}\sim\mathcal{D}_{t}}[\log(D(G(x_{s} )))]-\mathbb{E}_{x_{t}\sim\mathcal{D}_{t}}[\log(1-D(G(x_{t})))] \tag{6}\]  
where \(G\) represents the feature extractor (MobileNet backbone), \(D\) is the domain discriminator, \(x_{s}\) and \(x_{t}\) are samples from the source and target domains, respectively, and \(\mathcal{D}_{s}\) and \(\mathcal{D}_{t}\) denote the source and target domain distributions. By minimizing this adversarial loss, the feature extractor learns to generate features that are indistinguishable between the two domains.  
To ensure that the model maintains high diagnostic accuracy while achieving domain adaptation, a multi-loss optimization strategy is employed. The total loss function combines the classification loss, distillation loss, and adversarial loss:  
\[\mathcal{L}_{\text{total}}=\alpha\cdot\mathcal{L}_{\text{classification}}+ \beta\cdot\mathcal{L}_{\text{distillation}}+\gamma\cdot\mathcal{L}_{\text{adv}} \tag{7}\]  
where \(\alpha\), \(\beta\), and \(\gamma\) are hyperparameters that control the relative weights of the three losses. The classification loss ensures accurate fault diagnosis on the source domain, the distillation loss compresses the model for efficient deployment, and the adversarial loss aligns the feature distributions across domains. This multi-loss optimization strategy enablesthe model to achieve robust performance in cross-domain scenarios while maintaining computational efficiency.