Proton exchange membrane fuel cell fault diagnosis method based on improved YOLOv5

By improving the YOLOv5 model, combining GSConv and CG-ASA attention layer, the accuracy and efficiency of the proton exchange membrane fuel cell fault diagnosis in the prior art are solved, achieving higher fault diagnosis accuracy and lower computing cost.

CN119128707APending Publication Date: 2024-12-13HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410051998.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-12
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The existing proton exchange membrane fuel cell fault diagnosis methods cannot be accurately classified, cannot ensure the stable operation of the system, cannot reduce the power loss caused by the failure, and cannot extend the healthy operation time.

Method used

Using the improved YOLOv5 model, the GSConv convolution layer and CG-ASA attention layer are built by replacing the backbone network of the EfficientViT network model, and the He initialization is optimized with the sparrow search algorithm to improve the fault diagnosis accuracy.

Benefits of technology

It improves the accuracy of fault diagnosis, reduces calculation cost and model size, improves the flexibility and generalization ability of the model, achieves finer-grained spatial attention, and enhances feature representation ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119128707A_ABST
    Figure CN119128707A_ABST
Patent Text Reader

Abstract

The invention discloses a proton exchange membrane fuel cell fault diagnosis method based on improved YOLOv5, and the method comprises the following steps: collecting a plurality of variables during the operation of a proton exchange membrane fuel cell system, and building a proton exchange membrane fuel cell sample set; the method comprises the following steps of: constructing a GSConv convolutional layer, and improving an Efficient ViT network model; the method comprises the following steps of: replacing a BackBone part in a YOLOv5 network structure by using an improved OfficientViT network model, and constructing a network model based on the improved YOLOv5; he initialization is optimized by using a sparrow search algorithm, so that the YOLOv5 model obtains an optimal initial weight matrix, the problem of gradient explosion or gradient disappearance can be avoided, and convergence is accelerated; the improved YOLOv5 model is trained; and evaluating the improved YOLOv5 proton exchange membrane fuel cell fault diagnosis model. Compared with a method of replacing a BackBone part in a YOLOv5 network structure with an original OfficientViT network model, the method has the advantages that the accuracy, the reasoning speed and the model size are better; compared with other lightweight networks, optimization of various parameters is more balanced; compared with a traditional machine algorithm which is put into production, the method is higher in accuracy and diagnosis speed, and can be embedded into hardware equipment to serve as a fault diagnosis instrument of a mobile terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of fault detection, and in particular to a proton exchange membrane fuel cell fault diagnosis method based on improved YOLOv5. Background Art

[0002] As an emerging clean energy technology, proton exchange membrane fuel cell (PEMFC) has the advantages of high efficiency, environmental protection, and low noise, and has become one of the most promising clean energy sources in recent years. However, fuel cell failure will lead to reduced reliability and poor durability, which is still the main problem restricting the development of fuel cell technology. Therefore, accurate and timely fault diagnosis is crucial to maintain the performance of PEMFC and extend its service life.

[0003] Existing fault diagnosis methods cannot accurately classify the status of the locomotive proton exchange membrane fuel cell system, cannot ensure the stable operation of the locomotive proton exchange membrane fuel cell system, cannot reduce the power loss caused by the fault, avoid the irreversible damage to the fuel cell system caused by the fault, and extend its healthy operation time.

[0004] At present, there are three main methods for PEMFC fault diagnosis: experimental test method, model-based method and data-driven method. The experimental test method generally has high requirements for equipment, and usually requires the system to be shut down for a large number of tests and analyses, so it is impossible to perform online diagnosis and continuous monitoring and fault prevention of the system. The model-based method requires the establishment of accurate PEMFC physical and mathematical models, but PEMFC is a nonlinear complex system with multiple physical fields and multiple parameters coupled, so it is difficult to establish its fault model. Data-driven methods, especially deep learning neural networks, can use a large amount of experimental data for training and automatically learn features, thereby reducing dependence on prior knowledge. It is suitable for the diagnosis of complex systems and can diagnose unknown faults. It does not need to rely on physical models or experimental equipment, and can adapt to a variety of fault types and scenarios, which has significant advantages. Summary of the invention

[0005] Purpose of the invention: In view of the problems existing in the prior art, the present invention provides a proton exchange membrane fuel cell fault diagnosis method based on improved YOLOv5. The improved EfficientViT replaces the backbone network of the YOLOv5s model, thereby increasing the accuracy of fault diagnosis.

[0006] Technical solution: The present invention provides a proton exchange membrane fuel cell fault diagnosis method based on improved YOLOv5, comprising the following steps:

[0007] S100: A 100kW EC proton exchange membrane fuel cell system is used to obtain multiple variables during the operation of the fuel cell system, and a total of 5,000 sets of characteristic signal images under different states of the fuel cell are obtained as a sample set after screening and normalization;

[0008] S200: Build the GSConv convolution layer to replace the deep separable convolution DWConv in the EfficientViT network model. At the same time, combine CGA and ASA to build a new attention layer CG-ASA to obtain the improved EfficientViT network model.

[0009] S300: Use the improved EfficientViT network model to replace the BackBone part in the YOLOv5 network structure, and build an improved YOLOv5 network model;

[0010] S400: training the improved YOLOv5 model, using the sparrow search algorithm to optimize and initialize, so that the YOLOv5 model obtains the optimal initial weight matrix;

[0011] S500: Evaluation of the improved YOLOv5 proton exchange membrane fuel cell fault diagnosis model.

[0012] Furthermore, in step S200, the EfficientViT network model is improved, and the structure specifically includes:

[0013] S201, in step S200, build a GSConv convolution layer, and use the GSConv convolution layer to replace the deep separable convolution DWConv in the EfficientViT network model;

[0014] S202: Build an improved EfficientViT Block as the basic module, and combine CGA and ASA to build a new attention layer CG-ASA; the input features of each EfficientViT Block first pass through N FFNs, then pass through a new attention layer CG-ASA, and finally pass through N FFN layers to obtain the output features. Before each FFN layer, GSConv in S201 is used to replace DWConv as the information interaction between local tokens and help introduce inductive bias;

[0015] S203, adds overlap patchEmBed, SuBsample, and AvgPool layers to improve the network structure, and together with the improved EfficientViT Block constitutes a complete improved EfficientViT network model.

[0016] Furthermore, in the FFN layer In between, use the CG-ASA attention layer For spatial fusion, the calculation formula is:

[0017]

[0018] Among them, X i is the complete input feature of the ith Block. The entire structure converts X i Transformed to X with N FFN layers i+1 , N FFN layers are located before and after the attention layer CG-ASA;

[0019] The CG-ASA module splits the input features, and the attention calculation adopts a head-by-head cascade method, adding the output of each head to the subsequent head to gradually refine the feature representation; in each sub-region, ASA is applied to model the spatial and temporal relationship within the sub-region. ASA decomposes the spatial dimension of the input feature into two directions, and then performs self-attention calculation on each direction separately. Finally, the outputs of the two directions are added, which is expressed as:

[0020]

[0021]

[0022]

[0023]

[0024]

[0025] in, and Respectively represent the output features of self-attention calculation in row and column directions, represents the final output feature of axial self-attention, X ij is the input feature X i The jth segmentation of , h is the total number of heads, and It is a projection layer that maps the input feature segmentation into different subspaces. It is a linear layer that projects the concatenated output features back to the same dimension as the input, denoted by X' ij Replace X ij As the new input features of the j-th head, self-attention can jointly capture local and global relationships and further enhance the feature representation.

[0026] Furthermore, the step S300 uses the improved EfficientViT network model to replace the BackBone part in the YOLOv5 network structure to build an improved YOLOv5 network model, including the steps of:

[0027] S301, build the input end of the YOLOv5 network model. The input end has three parts: Mosaic data enhancement method; adaptive anchor box calculation and adaptive image scaling;

[0028] S302, using the improved EfficientViT network model to replace the backbone network in the YOLOv5 network structure, i.e., the BackBone part;

[0029] S303, build the neck of the YOLOv5 network model, that is, the Neak part; the Neak part consists of the FPN+PAN structure, which is used to extract multi-scale feature information, aggregate high-level and low-level features of the image, and improve the effect of target detection;

[0030] S304, build the detection part of the YOLOv5 network model, that is, the Prediction part; the prediction layer is mainly composed of the loss function and non-maximum suppression, using GIOU_Loss as the loss function, and selecting the box with the highest confidence as the final detection result through NMS.

[0031] Furthermore, the step S400 uses the sparrow search algorithm to optimize He initialization so that the YOLOv5 model obtains the optimal initial weight matrix, including the following steps:

[0032] S401, taking the GIOU_Loss loss function as the objective function;

[0033] S402, determine the hyperparameters initialized by He and the search range of the sparrow search algorithm, that is, the possible initialization methods and the value range of the hyperparameters.

[0034] S403, in each iteration, the sparrow search algorithm can generate new He-initialized hyperparameters; then obtain a candidate initialization weight matrix through He initialization, and use the objective function to evaluate the performance of each candidate initialization weight matrix;

[0035] S404, training the model using each generated candidate initialization weight matrix, and verifying it in a validation set;

[0036] S405, the sparrow search algorithm stops searching after iterating a specified number of times, and outputs a weight matrix that minimizes GIOU_Loss, that is, the optimal initial weight matrix.

[0037] Furthermore, in step S500, when evaluating the improved YOLOv5 proton exchange membrane fuel cell fault diagnosis model, evaluation indicators are set: model size, parameter quantity, GFLOPs, FPS, and mAP are used as evaluation indicators to evaluate the model.

[0038] Beneficial effects:

[0039] 1. The present invention uses the sparrow search algorithm to optimize He initialization, so that the YOLOv5 model obtains the optimal initial weight matrix, and the convergence speed is improved by 12.6%;

[0040] 2. The improved EfficientVit uses GSConv to replace DWConv in the original model. Compared with the original DWConv, the new model can better utilize channel information and improve the accuracy of the model; reduce the computational cost of the model by 15%; GSConv can adjust the number and proportion of grouped convolutions according to different tasks and data sets, making the model more flexible;

[0041] 3. Combining CGA (Cascaded Group Attention) and ASA (Axial Self-Attention) to build a new attention layer CG-ASA. CG-ASA retains the cascade and grouping structure of CGA, reduces computational redundancy, increases network depth and attention diversity, and uses ASA to decompose the spatial dimension of the input feature into two directions, then performs self-attention calculations on each direction, and finally adds the outputs of the two directions. This reduces computational complexity while retaining spatial information and achieving more fine-grained spatial attention.

[0042] 4. The improved EfficientViT replaces the backbone network of the YOLOv5s model. Compared with the original EfficientViT replacing the backbone network of the YOLOv5s model, the number of parameters is reduced by 2.3%, GFLOPs is reduced by 1.3%, FPS is increased by 14, the model size is reduced by 0.03MB, and the accuracy is improved by 1.1%. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 GSConv convolutional layer;

[0044] Figure 2 EfficientViT Block;

[0045] Figure 3 EfficientViT network model;

[0046] Figure 4 Improve the network model of YOLOv5. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described below with reference to the accompanying drawings.

[0048] The present invention uses an improved YOLOv5 network model to perform fault diagnosis on PEMFC flooding fault, membrane dry fault, normal state and unknown state, including the following steps:

[0049] S100: A 100kW EC proton exchange membrane fuel cell system is used to obtain multiple variables during the operation of the fuel cell system. After screening and normalization, a total of 5,000 sets of characteristic signal images under different states of the fuel cell are obtained as a sample set.

[0050] A 100kW EC-type PEMFC system was used to obtain multiple variables during the operation of the PEMFC system. After screening and normalization, a total of 5,000 sets of characteristic signal images under different PEMFC states were obtained as sample sets, including the following steps:

[0051] S101, collecting multi-sensor data of the proton exchange membrane fuel cell system and the current system status during the operation of the locomotive.

[0052] S102, after screening and normalization, 5000 sets of characteristic signal images of the fuel cell in the water flooding fault, membrane dry fault, normal state and unknown state are obtained as sample sets. The training set is 1000 sets each of the water flooding fault, membrane dry fault, normal state and unknown state. The test set is 250 sets each of the water flooding fault, membrane dry fault, normal state and unknown state.

[0053] S200: Build the GSConv convolution layer and improve the EfficientViT network model.

[0054] S201, in step S200, build a GSConv convolution layer, such as Figure 1 As shown, the steps include:

[0055] S2011, Conv: The input data is processed through a convolution layer. The input data changes from C1 channels to C2 / 2 channels. This can reduce the dimension of the data and extract the features of the data at the same time.

[0056] S2012, DWConv: The data processed by the convolution layer enters the depthwise separable convolution (DWConv) for further processing. Depthwise separable convolution is an efficient convolution method that decomposes the standard convolution into two steps: depthwise convolution and pointwise convolution. Depthwise convolution performs convolution on each input channel separately, while pointwise convolution combines different input channels. This can reduce the amount of computation and the number of parameters while keeping the number of channels of the data unchanged.

[0057] S2013, Concat: The output of the depthwise separable convolution is concatenated with the original data after the convolution layer. Concatenation is a method of data fusion that connects two or more data along a certain dimension to form a larger data. Here, concatenation is performed along the channel dimension, which doubles the number of channels of the data to C2 / 2+C2 / 2=C2.

[0058] S2014, Shuffle: The concatenated data is shuffled to change the order or structure of the data. Shuffling is a data enhancement method that can break the fixed pattern of data and increase the diversity and randomness of data. Here, shuffling is performed on the channel dimension, making the channels of data more mixed and interactive.

[0059] S2015, get the final output, the characteristic of GSConv is that it divides the channels of the data into two groups, the channels in each group are independent of each other, and the channels between groups are related to each other. This can increase the multi-scale features of the data while reducing the redundancy and complexity of the data.

[0060] S202, build the improved EfficientViT Block as the basic module, such as Figure 2 As shown in the figure, a new attention layer CG-ASA is constructed by combining CGA (Cascaded Group Attention) and ASA (Axial Self-Attention). The input features of each EfficientViT Block first pass through N FFNs, then pass through a new attention layer CG-ASA, and finally pass through N FFN layers to obtain the output features. At the same time, GSConv is used before each FFN layer to replace DWConv in the original model as information interaction between local tokens and to help introduce inductive bias. In the FFN layer In between, use the CG-ASA attention layer For spatial fusion, the calculation formula is:

[0061]

[0062] Where X i is the complete input feature of the i-th Block. The entire structure converts X i Transformed to X with N FFN layers i+1, N FFN layers are located before and after the attention layer CG-ASA. This basic module reduces the use of attention and alleviates the problem of memory access time consumption caused by attention calculation. The CG-ASA module splits the input features and only provides a part of the input features to each attention head to reduce computational redundancy. At the same time, the attention calculation adopts a head-by-head cascade method, which adds the output of each head to the subsequent head to gradually refine the feature representation, thereby improving the depth and expression ability of the lightweight network without adding additional parameters. In each sub-region, ASA is applied to model the spatial and temporal relationships within the sub-region. The main idea of ​​ASA is to decompose the spatial dimension of the input feature into two directions, and then perform self-attention calculations on each direction separately, and finally add the outputs of the two directions. This can reduce computational complexity while retaining spatial information. Formally, this self-attention can be expressed as:

[0063]

[0064]

[0065]

[0066]

[0067]

[0068] and Respectively represent the output features of self-attention calculation in row and column directions, represents the final output feature of axial self-attention, X ij is the input feature X i The jth segmentation of , h is the total number of heads, and It is a projection layer that maps the input feature segmentation into different subspaces. It is a linear layer that projects the concatenated output features back to the same dimension as the input. ij Replace X ij As the new input features of the j-th head, self-attention can jointly capture local and global relationships and further enhance the feature representation.

[0069] S203, adding overlapping patch embedding overlap patchEmBed, downsampling SuBsample, and average pooling AvgPool layer to improve the network structure, together with the improved EfficientViT Block, constitutes a complete improved EfficientViT network model, such as Figure 3 shown.

[0070] S300: Use the improved EfficientViT network model to replace the BackBone part in the YOLOv5 network structure, and build a network model based on the improved YOLOv5.

[0071] S301, build the input end of the YOLOv5 network model. The input end has three parts: Mosaic data enhancement method; Adaptive input end has three parts: Mosaic data enhancement method; Adaptive anchor box calculation and adaptive image scaling. Mosaic data enhancement method provides more background information and object context; Adaptive anchor box calculation enables the model to adapt to targets of different sizes and image changes; Adaptive image scaling ensures that the input image has a uniform size. These technologies work together on the input end of YOLOv5 to improve the detection performance and robustness of the model.

[0072] S302, using the improved EfficientViT network model to replace the backbone network in the YOLOv5 network structure, namely the BackBone part.

[0073] S303, build the neck of the YOLOv5 network model, that is, the Neak part. The Neck part consists of the FPN+PAN structure, which is mainly used to extract multi-scale feature information, aggregate high- and low-level features of the image, and improve the effect of target detection.

[0074] S304, build the detection part of the YOLOv5 network model, that is, the Prediction part. The prediction layer is mainly composed of a loss function and non-maximum suppression (NMS). Use GIOU_Loss as the loss function to solve the problem that the bounding boxes of the previous YOLO version do not overlap. Through NMS, the box with the highest confidence is selected as the final detection result to improve the accuracy and reliability of target detection.

[0075] S400: Use the sparrow search algorithm to optimize He initialization so that the YOLOv5 model can obtain the optimal initial weight matrix, which helps to avoid gradient explosion or gradient vanishing problems, accelerate convergence, and improve the generalization ability of the model.

[0076] S401, taking GIOU_Loss as the loss function as the objective function.

[0077] S402, determine the hyperparameters of He initialization (such as the standard deviation in He initialization) and the search range of the sparrow search algorithm, that is, the possible initialization methods and the value range of the hyperparameters.

[0078] S403, in each iteration, the sparrow search algorithm can generate new He-initialized hyperparameters (e.g., standard deviation). These hyperparameters can be used when initializing model parameters to adjust the behavior of He initialization. Then, the candidate initialization weight matrix is ​​obtained through He initialization, and the performance of each candidate initialization weight matrix is ​​evaluated using the objective function.

[0079] S404, using each generated candidate initialization weight matrix to train the model and verify it in the verification set.

[0080] S405, the sparrow search algorithm stops searching after iterating a specified number of times, and outputs a weight matrix that minimizes GIOU_Loss, that is, the optimal initial weight matrix.

[0081] S500: Train the improved YOLOv5 model.

[0082] S501, the experimental environment is Windows 10 operating system, the GPU is NVIDIA GeForce GTX 1050, the CPU is i5-7300HQ, and the programming environment is Python 3.10, Pytorch 1.12.1, and CUDA 12.2.

[0083] S502, the parameters for model training are set as follows: the total number of training iterations is 300 times, the weight file is efficientViT_m0.pth, the initial learning rate is 0.01, and the number of samples selected for each training is 4.

[0084] S503, sending 1000 sets of feature signal images of flooding fault, membrane dry fault, normal state and unknown state in the training set to the improved YOLOv5 model for training;

[0085] S504, randomly mix 250 sets of feature signal images of flooding fault, membrane dry fault, normal state and unknown state in the test set, and input the total 1000 sets of feature signal images into the improved YOLOv5 model for fault diagnosis and classification.

[0086] S600: Evaluate the improved YOLOv5 proton exchange membrane fuel cell fault diagnosis model.

[0087] S601, set evaluation indicators: use model size, parameter quantity, GFLOPs, FPS, and mAP as evaluation indicators to evaluate the model;

[0088] S602, use EfficientViT to replace the backbone network of the YOLOv5s model, denoted as YOLOv5-EfficientViT; use the improved EfficientViT to replace the backbone network of the YOLOv5s model, denoted as YOLOv5-EfficientViT (CG-AS Attention) and then use the popular lightweight networks FasterNet and EMO to replace the backbone network of the YOLOv5s model, denoted as YOLOv5-FasterNet and YOLOv5-EMO, respectively, and compare them with the YOLOv5s model. The results are shown in Table 1.

[0089] S603, the traditional machine learning algorithms SVM, KNN and deep learning algorithms CNN are currently widely used in fault diagnosis of bearings, motors, fuel cells, etc., and have shown good fault diagnosis effects. The feasibility of this method for fault diagnosis is further verified by comparing YOLOv5-EfficientViT (CG-AS Attention) with traditional algorithms. The experimental results are shown in Table 2.

[0090] Table 1 Comparison results of lightweight models

[0091]

[0092] Table 2 Comparison results with traditional machine learning algorithms

[0093]

[0094] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent transformation or modification made according to the essence of the present invention should be included in the protection scope of the present invention.

Claims

1. A proton exchange membrane fuel cell fault diagnosis method based on improved YOLOv5, characterized in that: The steps include: S100: A 100kW EC proton exchange membrane fuel cell system is used to obtain multiple variables during the operation of the fuel cell system, and a total of 5,000 sets of characteristic signal images under different states of the fuel cell are obtained as a sample set after screening and normalization; S200: Build the GSConv convolution layer to replace the deep separable convolution DWConv in the EfficientViT network model. At the same time, combine CGA and ASA to build a new attention layer CG-ASA to obtain the improved EfficientViT network model. S300: Use the improved EfficientViT network model to replace the BackBone part in the YOLOv5 network structure, and build an improved YOLOv5 network model; S400: training the improved YOLOv5 model, using the sparrow search algorithm to optimize and initialize, so that the YOLOv5 model obtains the optimal initial weight matrix; S500: Evaluation of the improved YOLOv5 proton exchange membrane fuel cell fault diagnosis model.

2. The proton exchange membrane fuel cell fault diagnosis method based on improved YOLOv5 according to claim 1, characterized in that: The EfficientViT network model is improved in step S200, and the structure specifically includes: S201, in step S200, build a GSConv convolution layer, and use the GSConv convolution layer to replace the deep separable convolution DWConv in the EfficientViT network model; S202: Build an improved EfficientViT Block as the basic module, and combine CGA and ASA to build a new attention layer CG-ASA; the input features of each EfficientViT Block first pass through N FFNs, then pass through a new attention layer CG-ASA, and finally pass through N FFN layers to obtain the output features. Before each FFN layer, GSConv in S201 is used to replace DWConv as the information interaction between local tokens and help introduce inductive bias; S203, adds overlap patchEmBed, SuBsample, and AvgPool layers to improve the network structure, and together with the improved EfficientViT Block constitutes a complete improved EfficientViT network model.

3. The proton exchange membrane fuel cell fault diagnosis method based on improved YOLOv5 according to claim 2, characterized in that: At the FFN layer In between, use the CG-ASA attention layer For spatial fusion, the calculation formula is: Among them, X i is the complete input feature of the ith Block. The entire structure converts X i Transformed to X with N FFN layers i+1 , N FFN layers are located before and after the attention layer CG-ASA; The CG-ASA module splits the input features, and the attention calculation adopts a head-by-head cascade method, adding the output of each head to the subsequent head to gradually refine the feature representation; in each sub-region, ASA is applied to model the spatial and temporal relationship within the sub-region. ASA decomposes the spatial dimension of the input feature into two directions, and then performs self-attention calculation on each direction separately. Finally, the outputs of the two directions are added, which is expressed as: in, and Respectively represent the output features of self-attention calculation in row and column directions, represents the final output feature of axial self-attention, X ij is the input feature X i The jth segmentation of , h is the total number of heads, and It is a projection layer that maps the input feature segmentation into different subspaces. It is a linear layer that projects the concatenated output features back to the same dimension as the input, denoted by X' ij Replace X ij As the new input features of the j-th head, self-attention can jointly capture local and global relationships and further enhance the feature representation.

4. The proton exchange membrane fuel cell fault diagnosis method based on improved YOLOv5 according to claim 1, characterized in that: The step S300 uses the improved EfficientViT network model to replace the BackBone part in the YOLOv5 network structure, and builds an improved YOLOv5 network model, including the steps of: S301, build the input end of the YOLOv5 network model. The input end has three parts: Mosaic data enhancement method; Adaptive anchor box calculation and adaptive image scaling; S302, using the improved EfficientViT network model to replace the backbone network in the YOLOv5 network structure, i.e., the BackBone part; S303, build the neck of the YOLOv5 network model, that is, the Neak part; the Neak part consists of the FPN+PAN structure, which is used to extract multi-scale feature information, aggregate high-level and low-level features of the image, and improve the effect of target detection; S304, build the detection part of the YOLOv5 network model, that is, the Prediction part; the prediction layer is mainly composed of the loss function and non-maximum suppression, using GIOU_Loss as the loss function, and selecting the box with the highest confidence as the final detection result through NMS.

5. The proton exchange membrane fuel cell fault diagnosis method based on improved YOLOv5 according to claim 1, characterized in that: The step S400 uses the sparrow search algorithm to optimize He initialization so that the YOLOv5 model obtains the optimal initial weight matrix, including the following steps: S401, taking the GIOU_Loss loss function as the objective function; S402, determine the hyperparameters initialized by He and the search range of the sparrow search algorithm, that is, the possible initialization methods and the value range of the hyperparameters. S403, in each iteration, the sparrow search algorithm can generate new He-initialized hyperparameters; Then, the candidate initialization weight matrix is ​​obtained through He initialization, and the performance of each candidate initialization weight matrix is ​​evaluated using the objective function; S404, training the model using each generated candidate initialization weight matrix, and verifying it in a validation set; S405, the sparrow search algorithm stops searching after iterating a specified number of times, and outputs a weight matrix that minimizes GIOU_Loss, that is, the optimal initial weight matrix.

6. The proton exchange membrane fuel cell fault diagnosis method based on improved YOLOv5 according to claim 1, characterized in that: In step S500, when evaluating the improved YOLOv5 proton exchange membrane fuel cell fault diagnosis model, evaluation indicators are set: model size, parameter quantity, GFLOPs, FPS, and mAP are used as evaluation indicators to evaluate the model.