Bacterial colony classification method based on Persistent Homology and improved OfficientNet algorithm
By combining Persistent Homology and improved EfficientNet algorithm, the rapid but large error problem in bacterial classification is solved by leveraging ECA and SCoT attention mechanisms, and the high accuracy classification of Candida albicans and Staphylococcus epidermis is achieved, providing efficient and reliable Bacterial recognition method.
Patent Information
- Application Number
- CN202411270529.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-09-11
AI Technical Summary
The prior art has problems in bacterial classification with fast antigen and PCR detection speed but large results errors, and accurate colony culture results but long time, making it difficult to effectively distinguish pathogenic bacteria such as Candida albicans and Staphylococcus epidermis.
The colony classification method based on Persistent Homology and improved EfficientNet algorithm is adopted. Through feature extraction and classification processing, the ECA attention mechanism and SCoT self-attention mechanism are introduced, and the data enhancement and topological feature extraction are combined to improve the recognition accuracy of the model.
The high accuracy classification of Candida albicans and Staphylococcus epidermis has been achieved, with the classification accuracy increased by about 10.29%, and efficient and reliable classification results are provided in practical applications.
Smart Images

Figure SMS_2 
Figure SMS_3 
Figure SMS_5
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and in particular relates to a colony classification method based on Persistent Homology and an improved EfficientNet algorithm. Background Art
[0002] In recent years, with the development of computer technology, image processing technology, and artificial intelligence theory and technology, computer vision technology has been rapidly developed and widely used, playing an important role in scientific research and medical fields.
[0003] Computer vision technology is a highly comprehensive technology, involving disciplines such as artificial intelligence, optics, mechanics, computer graphics and neurobiology. It has been widely used in business, military, meteorology and natural disaster prediction, bringing earth-shaking changes to people's lives. For example, the emergence of technologies such as face recognition and driverless cars cannot be separated from the support of computer vision technology. At the same time, computer vision technology is constantly being updated and iterated, and has developed from a single dimension to multiple dimensions, and the fields it involves are becoming more and more extensive. The application of computer vision technology in the medical field is mainly reflected in impact recognition and analysis, pathological image analysis, surgical guidance and navigation, health testing and remote diagnosis, personalized medicine, etc.
[0004] In today's society, most diseases are caused by bacterial or fungal infections, such as respiratory tract infections, urinary tract infections, skin infections, and so on. Although some pathogens are of different types, their infection symptoms are almost the same. For example, Candida albicans and Staphylococcus epidermidis skin infections can cause dermatitis or acne, and blood infections can cause high fever, which are difficult for ordinary people to distinguish. In response to this situation, people often use rapid antigen, PCR testing, and colony culture to confirm the strain of bacteria. However, although the rapid antigen method and PCR testing are fast, there are certain errors in the results; the colony culture results have a higher accuracy rate, but the time is longer. Summary of the invention
[0005] In order to overcome the shortcomings of the prior art, the present invention provides a colony classification method based on Persistent Homology and improved EfficientNet algorithm, which is divided into two parts: feature extraction and classification processing. In the data preprocessing stage, PH (Persistent Homology) is used to strengthen the key feature areas of the image and expand the data set. The MBConv (Mobile Inverted BottleneckConvolution) module in EfficientNet is redesigned according to the convolutional network design concept, and ECA convolution attention is introduced after the first convolution. A new self-attention mechanism is introduced after the last layer of the MBConv module, namely the SCoT self-attention mechanism module for multi-dimensional feature weight distribution learning, and finally the linear classifier Softmax is used to classify the features and output the recognition results.
[0006] The above object of the present invention is achieved through the following technical solution: a colony classification method based on Persistent Homology and improved EfficientNet algorithm, the steps are as follows:
[0007] S1: Collect data sets and filter and trim collected image data;
[0008] S2: Use Persistent Homology to extract features from images;
[0009] S3: Introducing the ECA attention mechanism into the MBConv module in the EfficientNet-B0 classification model;
[0010] S4: Secondary classification of images based on SCoT self-attention mechanism.
[0011] Furthermore, the S1 is specifically:
[0012] S1.1 Dataset collection: The datasets used are self-collected datasets of Candida albicans and Staphylococcus epidermidis.
[0013] S1.2 Screening: For the collected colony data, screen out the colony parts that are sticky, incompletely grown, and incompletely photographed, and retain the complete and single colony data.
[0014] S1.3 Cropping: For the colony images retained after screening, they are cropped into single colonies of appropriate size after comprehensive consideration. For the data set that has been screened and cropped, the data set is expanded through data augmentation methods.
[0015] Furthermore, the S2 is specifically:
[0016] S2.1 Construct point cloud: Generate a set P of data points from the provided image. These points are called point cloud, which can be points in Euclidean space or points in other metric spaces.
[0017] S2.2 Determine parameters: Select a parameter ε, which represents the size or radius of the constructed shape. ε determines the maximum distance between two points that can form a connection. Different parameters ε will form different topological feature extraction graphs.
[0018] S2.3 Construct the complex: Use an ε-dashed sphere with radius ε to surround each point in P and connect lines between this point and all other points in its circle;
[0019] S2.4 Analyze the topological structure: Obtain the topological information about the data set by analyzing the constructed complex topological structure.
[0020] Furthermore, the S3 is specifically:
[0021] S3.1 Input data to the improved EMBConv (Mobile inverted Bottleneck Convolution) structure. The image data processed by PH topological feature extraction and data enhancement and ordinary 3x3 convolution kernel is input into the EMBConv structure module.
[0022] S3.2 imports a 1×1 convolution kernel, which is used to change the number of channels of the data feature map, that is, to increase the dimension. BN and Swish achieve this goal with a smaller number of parameters, which helps reduce the amount of calculation and the risk of overfitting.
[0023] S3.3 imports 3×3Depthwise Conv convolution. Each input channel is processed using an independent 3×3 convolution kernel, keeping the number of channels unchanged, and then batch normalization is applied to standardize the data of each channel so that it has a distribution with a mean of 0 and a standard deviation of 1. Then, nonlinearity is introduced through the Swish activation function, which can effectively avoid the gradient vanishing problem and enhance the expressiveness of the model.
[0024] S3.4 enters the ECA module. The ECA attention mechanism identifies key features and important information in the data, gives higher weight to this information, and relatively unimportant information is appropriately ignored.
[0025] S3.5 imports 1x1 normal convolution. Contains BN module for data dimensionality reduction.
[0026] S3.6 finally enters the Dropout layer. This module will randomly set some elements in the input data to zero according to the set probability, thereby reducing the model's dependence on specific neurons and enhancing the model's generalization ability. It effectively prevents the neural network from overfitting and improves the model's performance on unseen data.
[0027] S3.7 imports the output data into the remaining six layers of the neural network MBConv module, and the output is input into the SCoT self-attention mechanism.
[0028] EfficientNet strengthens the network by uniformly scaling the network depth, network width, and image resolution through a set of fixed scaling factors. The number of stacked modules is the source of network depth, the width comes from the number of convolution kernels of the depthwise separable convolution, and the size of the input image determines the image resolution.
[0029] MBConv (Mobileinverted Bottleneck Convolution) is the main component of the EfficientNet model series. The structural idea of this module is similar to that of depthwise separable convolution. First, 1×1 point convolution is performed on the input feature map to increase the feature dimension, then deep convolution is used to extract information on high-dimensional features, and finally 1×1 point convolution is used to reduce the dimension. In order to focus on key features, the SE (Squeeze and Excitation) channel attention mechanism is introduced after the deep convolution inside this module. The SE module first performs a global average pooling GAP (Global Average Pooling) operation on the feature map, and then converts the high-dimensional global feature map into a low-dimensional feature vector through a squeeze and dimensionality reduction operation to obtain the global features on the channel. However, the dimensionality reduction operation is not conducive to the prediction of the channel attention mechanism, and the ability to extract the relationship between channels is weak and the efficiency is low. In order to avoid the negative impact of dimensionality reduction in the SE module, the Efficient Channel Attention (ECA) module is used to achieve efficient local cross-channel interaction and reduce the number of parameters.
[0030] Furthermore, the S4 is specifically:
[0031] S4.1 Input data. The pre-processed data is imported into the SCoT self-attention mechanism.
[0032] S4.2 Feature division. Divide the feature map S into n parts, using [S0, S1, ..., S n-1] indicates that the number of channels of each segmented part is C1=C / N. At the same time, for each channel feature map divided out, multi-scale convolution kernel group convolution is used to extract the spatial information of feature maps of different scales, and the Group size is adaptively selected according to the size of the convolution kernel.
[0033] S4.3 Spatial branch processing. In the spatial branch learning part, the self-attention block operates on the input tensor X to highlight or suppress features, maintaining high resolution in its orthogonal direction. Softmax normalization is performed on the bottleneck tensor to increase the dynamic range of attention, and then the sigmoid function is used for tone mapping.
[0034] S4.4 Context information branch processing. For the context information branch learning part, for the feature modules of different two-dimensional channels formed by the previous segmentation, k×k groups of convolutions are used for all adjacent keys in the k×k grid in space to represent each key in combination with the context content.
[0035] S4.5 combines two learning methods. 1 The attention matrix is realized by two consecutive 1×1 convolutions, including W with ReLU activation function. θ and W without activation function δ .
[0036] S4.6 outputs the processed data to the 1×1 convolution layer and pooling layer for processing, and uses the linear classifier Softmax to classify the features and output the recognition results.
[0037] The attention mechanism allows the model to focus on relevant information more effectively when processing complex input data, thereby improving performance. The attention mechanism can be seen as a dynamic weight allocation method that highlights the important parts by assigning different weights to each input element. Here, a new attention mechanism SCoT (Space Contextual Transformer) is introduced to capture the correlation of different time steps in the sequence to understand the temporal dependency in the sequence data, while processing the spatial information of multi-scale input feature maps and effectively establishing long-term dependencies between multi-scale channel attention.
[0038] Compared with the prior art, the beneficial effects of the present invention are as follows: PH extraction features are introduced into the improved EfficientNet model, the improved EMBConv is combined with the backbone network using the above-mentioned improvement strategy, and the ScoTAttention module is added to construct an improved EfficientNet feature extraction network. The colony image is input into the network, and the feature information is first extracted layer by layer through the conv layer and the MBConv module. The extracted features are learned from the two aspects of spatial and contextual information through the ScoTAttention module, and important features and irrelevant features are judged. The network reasonably allocates computing resources according to the importance of the features, so as to achieve a higher recognition accuracy with a smaller number of parameters. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0040] Figure 1 When selecting the size or radius parameter ε to represent the constructed shape, the size of ε determines the maximum distance that can form a connection between two points; for the point cloud composed of graphics, different parameters ε form different topological feature extraction graphs; the figure shows the topological graphs formed when ε takes the values of 1, 3, and 7 under this graphic, so as to select the most appropriate value to ensure the completeness of the topological features of the graphics to the greatest extent;
[0041] Figure 2 Improved MBConv module in EfficientNet;
[0042] Figure 3 This is the structure diagram of the SCoT self-attention mechanism. First, the input two-dimensional effective feature map is divided into n parts, and multi-scale convolution kernels are used to extract spatial information of feature maps of different scales to reduce the number of parameters. The spatial channel and context information are combined to guide self-attention learning. Finally, the final weight value is calculated by fusion.
[0043] Figure 4 CA and SE were inoculated in TSB medium and cultured in a 37°C incubator for 18 hours. They were placed in a 37°C incubator for 18 hours and then grown.
[0044] Figure 5It is processed by PH technology. First, the images in the data set are gray-scaled. For the gray-scale image formed, the appropriate filter is set by modifying the parameters, and its topological features are extracted to highlight the features in the data set. Among them, Figure a represents the original image of the data set without PH feature extraction, Figure b represents the gray-scale image after gray-scale processing of the original image, Figure c is the topological gray-scale image filtered by the PH filter, Figure d is the test editing component after PH processing, and Figure e is the final image data with extracted topological image features.
[0045] Figure 6 The PH topological feature representations extracted by CA and SE are respectively, that is, the persistence graph PD generated by PH. These features can capture the topological properties in the data set and are scale-invariant to a certain extent. Among them, a and b represent the PD representation and PD variant of the CA data set, and c and d represent the corresponding parts of the SE data set. It can be clearly seen from the figure that after the VR complex construction and flow filtering of PH, the birth time and death time are used to represent the different topological components of the data, and their life cycles are calculated. Components with a life cycle greater than the threshold are selected, and any components outside the selected components are eliminated to construct the final topological image.
[0046] Figure 7 It is an improved overall module structure diagram, including Persistent Homology feature extraction module, convolution layer module, EMBConv module, MBConv module, SCoT-Attention module and pooling layer module. The EMBConv module is as described in S3 of Example 1, and the SE attention mechanism in the original MBConv module is replaced by the ECA attention mechanism to assign image weights, and it is renamed as the EMBConv module. The SCoT self-attention mechanism is as described in S4 of Example 1. First, the input two-dimensional effective feature map is divided into n parts, and multi-scale convolution kernel group convolution is used to extract spatial information of feature maps of different scales to reduce the number of parameters. And combine two different learning methods of spatial channel and context information to guide self-attention learning. Finally, the final weight value is calculated by fusion.
[0047] Figure 8 The experimental results are shown in Figure 2. During the test, the accuracy of the CA and SE models in classifying CA colonies can reach 98.4%, and the accuracy of classifying SE colonies can reach 98.9%. DETAILED DESCRIPTION
[0048] The present invention is described in detail below by specific examples, but the protection scope of the present invention is not limited. Unless otherwise specified, the experimental methods used in the present invention are all conventional methods, and the experimental equipment, materials, reagents, etc. used can be obtained from commercial channels.
[0049] Example 1
[0050] An improved EfficientNet network method based on Persistent Homology and the application of EMBConv module and SCoT self-attention mechanism.
[0051] This study is divided into two parts: feature extraction and classification processing. In the data preprocessing stage, PH is used to enhance the key feature areas of the image and expand the data set. The MBConv module in EfficientNet is redesigned according to the design idea of the convolutional network, and the ECA convolution attention is introduced after the first convolution. Finally, the linear classifier Softmax is used to classify the features and output the recognition results. The experimental results show that the classification accuracy of the improved model on this data set is 98.64%, which is about 10.29% higher than the original EfficientNetB0 network.
[0052] S1: Collect data sets and filter and trim collected image data;
[0053] S1.1: The dataset is self-collected.
[0054] The dataset used is a self-collected dataset. Candida albicans and Staphylococcus epidermidis were inoculated into TSB medium, cultured in a 37°C incubator for 18 hours, and OD = 0.3 was measured. The bacterial count was calculated to be 2.4e8. Then, the original bacterial solution was diluted with TSB to 10-1, -2, -3, -4, and -5. 50ul was taken and spread on a cotton swab plate in TSA solid medium, and cultured in a 37°C incubator for 18 hours. Colony image data was collected, and the images were taken with a S4T digital microscope at a resolution of 640*480. The colony images were screened and cropped. The initial dataset is as shown in the attached figure. Figure 7 shown.
[0055] S1.2 Screening.
[0056] For the collected colony data, the colony parts that are sticky, incompletely grown, or incompletely photographed are screened out, and the complete and single colony data are retained.
[0057] S1.3 Clipping.
[0058] For the colony images retained after screening, factors such as size and shape were comprehensively considered and they were cropped into single colonies of 80*80 pixels for the convenience of the next step of processing.
[0059] For the data set that has been screened and trimmed, the data set is expanded by data augmentation method, and the final data set contains 3168 Candida albicans and 3096 Staphylococcus epidermidis. The data set is divided into training set and test set in a ratio of 8:2.
[0060] S2: Use Persistent Homology to extract features from images and integrate data enhancement;
[0061] Considering the problems of few effective features of colony images in the dataset and unclear features, the PH feature extraction method is introduced. The relevant definitions are as follows:
[0062] S2.1 build point cloud.
[0063] Generate a set P of data points from the provided image. We call these points a point cloud, which can be points in Euclidean space or points in other metric spaces.
[0064] S2.2 Determine parameters.
[0065] Select a parameter ε, which represents the size or radius of the constructed shape. ε determines the maximum distance between two points that can form a connection. Different parameters ε form different topological feature extraction graphs. The image topological features in the dataset detected by PH are introduced into the collected colony image. In the experiment, the window (window_size) parameter value is set to 5 and the border (border_width) parameter value is set to 1 to process the image.
[0066] S2.3 construct a complex.
[0067] We use an ε-dashed sphere with ε as radius to surround each point in P and connect lines between this point and all other points in its circle. The result is shown in the following figure. Figure 8 shown.
[0068] First, we construct a neighborhood graph for our point data. A neighborhood graph is an undirected weighted graph (G,ω), where G = (V,E), V is the vertex set, E is the edge set, and ω:E→R. Our edges are created by connecting points that we have defined distances between (using the parameter ε). In particular,
[0069] E ε ={{u,v}|d(u,v)≤ε,u≠v∈V} (1)
[0070] Among them, u and v are two points belonging to the vertex set V, and d(u,v) is the metric function of the two points u,v∈V. The weight function simply sets the weight of each edge to be equal to the distance between the two points on the edge. That is,
[0071]
[0072] Among them, ω is the mapping of each edge to real numbers, that is, the weight, E ε(V). represents the set of vertices that meet the distance requirement of parameter ε. Next, the domain graph generated in the first step forms a VR expansion. Given a domain graph (G,ω), the VR complex (R(G),ω) (where R is the VR complex) weight filtering is given by:
[0073]
[0074] For σ∈R(G),
[0075]
[0076] In general, a ball around a point in d-dimensional space is a generalization of a ball around that point in (d-1)-dimensional space (a ball is the set of all points in space that are at the same distance from a point). So a ball in R is a line segment around a point, R 2 The ball in is a circle, R 3 The ball in is a sphere, and so on, forming a VR complex structure. As shown in the following formula, the complex structure is contained in the ratio ε, and the set V ε All subsets σ of P in (P), that is, the distance between any different points in σ is no greater than the parameter ε.
[0077]
[0078] S2.4 Analyze the topological structure. By analyzing the topological structure of the constructed complex, we can obtain topological information about the data set, such as connectivity, the existence of holes, etc.
[0079] First, we calculate the homology group of the simplicial complex. We first add orientation to the simplex before calculating it, and define its edge as the (d-1)-dimensional simplex consisting of a point of the d-dimensional simplex removed. Since the edge of a simplex must be closed, the edge of the edge must be 0. Consider the simplicial complex V ε The simplex in (P) is a linear combination of integer coefficients, λ1σ1+λ2σ2+…+λ k σ k , we can define a group addition group,
[0080] ∑λ i (u i ,v i )+∑u i (u i ,v i )=∑(λ i +u i )(u i ,v i ) (6)
[0081] Its identity element is 0, forming an Abelian group, that is, a chain group, then the d-dimensional homology group of K of the simplicial complex is defined as
[0082] H d (K)=Z d (K) / B d (K) (7)
[0083] Among them, C d (K) represents the d-chain group on the simplicial complex K, and its left edge homomorphism B d (K), the homomorphic kernel of the unit element obtained after the submapping is the d-dimensional chain group C d (K) The subgroup d is a closed chain group, denoted by Z d (K). d All edges in (K), that is, after the homomorphic mapping δ:C d+1 (K) → C d (K) The homomorphic image obtained is the d-dimensional chain group C d (K) is also a d-dimensional closed group chain Z d The subgroup of (K) (because the edges are all closed) is called the d-dimensional edge closed chain group, or d-dimensional edge group for short, denoted by B d (K), where B n ≤Z n ≤C n . We then calculate the connectivity number of the simplicial complex. If we consider the columns of the matrix as a set of basis vectors: β1,β2,…,β k , then the dimension of the space spanned by these column vectors is the rank of the matrix, and the connectivity number can be defined as,
[0084] b n =rank(Z n )-rank(B n ) (8)
[0085] Thereby calculating the PersistentHomology topological characteristics of different data.
[0086] The persistence diagram PD (Persistence Diagram) generated by PH can be used as a feature representation of data, as shown in the attached Figure 6 These features can capture the topological properties of the dataset and are scale invariant to a certain extent. Figure 6 a and b represent the PD representation and PD variant of the CA dataset, and c and d represent the corresponding parts of the SE dataset. Figure 6It can be clearly seen that after PH's VR complex construction and flow filtering, the birth time and death time are used to represent the different topological components of the data, and their life cycles are calculated. The components with a life cycle greater than the threshold are selected, and any components outside the selected components are eliminated to construct the final topological image.
[0087] S3: Innovative EMBConv module that introduces ECA attention mechanism into the EfficientNet-B0 classification model;
[0088] EfficientNet is selected as the classification model. It optimizes the network structure by combining the scaling of network depth, width, and resolution. Its advantage is that it optimizes the balance between the efficiency and accuracy of the model, thereby achieving better performance with limited computing resources. Compared with the SE attention mechanism used in the MBConv structure in the traditional EfficientNet, the ECA attention mechanism can better apply adaptive convolution kernels on each channel to calculate the channel attention weights to enhance the perception of different channel features, rather than reducing the channel features to scalars. The resulting EMBConv structure replaces the second stage of the original EfficientNet, and is better adapted to new data sets that extract topological features through PH.
[0089] The ECA attention module first targets the valid feature map X of the network input, where X∈RH*W*C, and transforms X into X1 through the global average pooling layer, where X1∈R1*1*C. In order to transform the obtained feature map X1 into a shape that meets the needs of subsequent convolution operations, it becomes X3, where X3∈RC*1. The weight of the one-dimensional convolution operation used is:
[0090]
[0091] in Represents y i The information interaction between channels is realized by a one-dimensional convolution of size k:
[0092] w=δ(C1D K (y)) (10)
[0093] Where C1D represents one-dimensional convolution, the size of k is proportional to the channel dimension C, and there is a mapping ψ between k and C:
[0094]
[0095] If an exponential function with base 2 is used to represent the nonlinear mapping relationship:
[0096]
[0097] Finally, the ECA module adaptively calculates the convolution kernel size k as follows:
[0098]
[0099] The output feature map is then passed through the sigmoid activation function, and finally the standardized output is transformed in dimension to restore its shape to X∈R1*1*C. Finally, the channel attention weight obtained in the previous step is multiplied by the original input feature map to obtain the final result.
[0100] S4: Secondary classification of images based on the self-created SCoT self-attention mechanism;
[0101] In the previous step, the SE attention mechanism that focuses on the spatial dimension is replaced by the ECA attention mechanism, which to some extent damages the feature weight value in the spatial dimension of the model. The components that constitute the topological features of the image are interrelated, reflecting the multi-level, stable and persistent nature of the topological structure. Therefore, this paper innovates a new self-attention mechanism SCoT, which is weighted in the dual dimensions of space and scene conditions, so that the model can not only enhance the perception ability of the model by utilizing the relationship between pixels in the local area, but also adjust the allocation of attention according to different contextual information and conditions, so as to handle complex scenes and multi-object situations.
[0102] First, for the two-dimensional effective feature map S of the network input, the size is H×W×C (H: height, W: width, C: number of channels), the feature map S is divided into n parts, using [S0, S1, ..., S n-1 ] indicates that the number of channels of each segmented part is C1=C / N. At the same time, for each segmented feature map Si∈RC1*W*H, i=0,1,2,...,n-1, for each channel feature map divided out, multi-scale convolution kernel group convolution is used to extract the spatial information of feature maps of different scales. The role of group convolution is mainly to reduce the number of parameters. At the same time, the Group size is adaptively selected according to the size of the convolution kernel. The relationship between Group and Kernel size is: G=2(K-1) / 2.
[0103] Next, we combine two different learning methods, spatial channels and contextual information, to guide self-attention learning. For the spatial branch, "polarization filtering" is performed in the attention calculation. The self-attention block operates on the input tensor X to highlight or suppress features, which is very similar to an optical lens that filters light. Polarization filtering can potentially improve the contrast of photos by only allowing light orthogonal to the transverse direction. We borrowed the key factor of photography to completely fold features in one direction while maintaining high resolution in its orthogonal direction. Softmax normalization is performed on the bottleneck tensor (the smallest feature tensor in the attention block) to increase the dynamic range of attention, and then the Sigmoid function is used for tone mapping. Thus, A is obtained. sp (S)∈R 1×H×W :
[0104] A sp (S) = F SG [σ3(F SM (σ1(F GP (W q (S))))×σ2(W v (S)))] (14)
[0105] Among them, W q and W v They are standard 1×1 convolutional layers, σ1, σ2, σ3 are three tensor shaping operators, and F SM is the SoftMax operator, F GP is a global pooling operator, and × is a matrix dot product operation. In this part, the output of the spatial branch is Z SP =A SP (S)⊙ SP ,S∈R C×H×W , where SP is a multiplication operator on space.
[0106] For the contextual information branch, although the traditional self-attention triggers the feature interaction of different spatial positions well, all the paired query key relationships are learned independently on isolated query key pairs without exploring the rich context in the middle. This severely limits the ability of self-attention learning to learn visual representations on 2D feature maps. To alleviate this problem, we built a Transformer-based architecture that integrates contextual information mining and self-attention learning into a unified architecture. Thereby making full use of the contextual information between adjacent keys, promoting self-attention learning in an effective way, and enhancing the representativeness of the output aggregated feature map. For the feature modules of different two-dimensional channels formed by the previous segmentation, S∈R C×H×W Its key, query and value are defined as K=S, Q=S and V=SW respectively. v. Spatially, k×k groups of convolutions are used to represent each key in combination with the contextual content for all adjacent keys in a k×k grid. The learned contextual key K 1 ∈R C×H×W Naturally reflecting the static context information between local adjacent keys, we 1 As the static context representation of the input S. Then, with the static context key K 1 The attention matrix (W with ReLU activation function) is realized by two consecutive 1×1 convolutions. θ and W without activation function δ ):
[0107] A=[K 1 ,Q]W θ W δ (15)
[0108] That is, in this part, for each head of the attention mechanism, the local attention matrix for each spatial position of A can be learned based on the query features and the contextualized key features, rather than the isolated query-key pairs, thereby enhancing self-attention learning. Next, according to the contextual attention matrix A, we calculate the attended feature map K by aggregating all values V 2 :
[0109]
[0110] K 2 is the dynamic context representation of the input S, which is used to capture the dynamic feature interactions between inputs.
[0111] Therefore, for the branch combining context information, the output Z ct Represented as a static context K through the attention mechanism 1 and dynamic context K 2 Fusion of:
[0112]
[0113] The outputs of the above two branches are composed in a parallel layout:
[0114]
[0115] The SCoT self-attention mechanism is connected to the 8th stage, and the data processed by the MBConv structure is put into SCoT for weight distribution again, the computing resources are reorganized, and the data is reasonably classified after the convolution layer, thereby improving the classification accuracy and computing efficiency. Figure 7 As shown in the figure. Through the above steps, the data in the dataset are experimented. Figure 8As shown in the figure, during the test, the CA and SE models trained in this study can achieve an accuracy of 98.4% in classifying CA colonies and 98.9% in classifying SE colonies.
[0116] In summary, this study proposed a method for achieving colony binary classification based on Persistent Homology feature extraction technology and improved EfficientNet. VR complexes were constructed using PH, and filters were used to extract effective topological features of colony data to remove irrelevant variable information. Then, the processed data set was sent to the improved classification model SCoT-EfficientNet, which combines the EMBConv structure of the ECA attention module and the SCoT self-attention mechanism, for classification training to obtain the final classification results. The accuracy of classifying CA colonies with this method can reach 98.4%, and the accuracy of classifying SE colonies can reach 98.9%. Therefore, this method helps to provide efficient and reliable guidance for classifying CA and SE in a short time in practical scenarios.
[0117] The above-described embodiments are only preferred embodiments of the present invention, but not all feasible embodiments of the present invention. For those skilled in the art, any obvious changes made thereto without departing from the principles and spirit of the present invention should be considered to be included in the scope of protection of the claims of the present invention.
Claims
1. A colony classification method based on Persistent Homology and improved EfficientNet algorithm, characterized in that: Here are the steps: S1: Collect data sets and filter and trim collected image data; S2: Use Persistent Homology to extract features from images; S3: Introducing the ECA attention mechanism into the MBConv module in the EfficientNet-B0 classification model; S4: Secondary classification of images based on SCoT self-attention mechanism.
2. The colony classification method based on Persistent Homology and improved EfficientNet algorithm according to claim 1, characterized in that: The step S1 is specifically as follows: S1.1 Dataset collection: The datasets used were self-collected datasets of Candida albicans and Staphylococcus epidermidis; S1.2 Screening: For the collected colony data, screen out the colony parts that are glued, incompletely grown, or incompletely photographed, and retain the complete and single colony data; S1.3 Cropping: For the colony images retained after screening, they are cropped into single colonies of appropriate size after comprehensive consideration. For the data set that has been screened and cropped, the data set is expanded through data augmentation methods.
3. The colony classification method based on Persistent Homology and improved EfficientNet algorithm according to claim 1, characterized in that: The step S2 is specifically as follows: S2.1 Construct point cloud: Generate a set P of data points from the provided image. These points are called point cloud. Points are points in Euclidean space or other metric space. S2.2 Determine parameters: Select a parameter ε, which represents the size or radius of the constructed shape; S2.3 Construct the complex: Use an ε-dashed sphere with radius ε to surround each point in P and connect lines between this point and all other points in its circle; S2.4 Analyze the topological structure: Obtain the topological information about the data set by analyzing the constructed complex topological structure.
4. The colony classification method based on Persistent Homology and improved EfficientNet algorithm according to claim 1, characterized in that: The step S3 is specifically as follows: S3.1 Input data to the improved EMBConv structure: Input the image data processed by PH topology feature extraction and data enhancement and ordinary 3x3 convolution kernel into the EMBConv structure module; S3.2 imports 1×1 convolution kernel; S3.3 imports 3×3Depthwise Conv convolution: each input channel is processed using an independent 3×3 convolution kernel, keeping the number of channels unchanged, and then batch normalization is applied to standardize the data of each channel so that it has a distribution with a mean of 0 and a standard deviation of 1, and then nonlinearity is introduced through the Swish activation function; S3.4 enters the ECA module: The ECA attention mechanism is used to identify key features and important information in the data, giving higher weight to this information, while relatively unimportant information is ignored; S3.5 imports 1x1 normal convolution, including BN module; S3.6 enters the Dropout layer; S3.7 imports the output data into the remaining six layers of the MBConv module of the neural network, and the output is input into the SCoT self-attention mechanism.
5. The colony classification method based on Persistent Homology and improved EfficientNet algorithm according to claim 1, characterized in that: The step S4 is specifically as follows: S4.1 Input data: Import the pre-processed data into the SCoT self-attention mechanism; S4.2 Feature division: Divide the feature map S into n parts, using [S0, S1, ..., S n-1 ] indicates that the number of channels of each segmented part is C1=C / N. At the same time, for each channel feature map divided out, multi-scale convolution kernel group convolution is used to extract the spatial information of feature maps of different scales, and the Group size is adaptively selected according to the size of the convolution kernel; S4.3 Spatial branch part processing: In the spatial branch learning part, the self-attention block operates on the input tensor X to highlight or suppress features; Softmax normalization is performed on the bottleneck tensor to increase the dynamic range of attention, and then the Sigmoid function is used for tone mapping; S4.4 Context information branch part processing: For the context information branch learning part, for the feature modules of different two-dimensional channels formed by the previous segmentation, all adjacent keys in the k×k grid are spatially represented by k×k groups of convolutions to combine the context content for each key; S4.5 combines two learning methods: using static context key K 1 The attention matrix is realized by two consecutive 1×1 convolutions, including W with ReLU activation function. θ and W without activation function δ ; S4.6 outputs the processed data to the 1×1 convolution layer and pooling layer for processing, and uses the linear classifier Softmax to classify the features and output the recognition results.
Citation Information
Patent Citations
Liver cancer identification method based on improved OfficientNet
CN114266898A
Pulmonary nodule benign and malignant classification method based on improved OfficientNet-B0 model
CN116612313A
Image classification method based on improved OfficientNet-B0
CN117333705A
Grape leaf disease identification method
CN117475225A
Rice disease identification method based on improved MobileViT network
CN117935017A