Dynamic scale adaptive bacterium detection method and device and storage medium
By introducing the boundary feature enhancement module and the deformable attention encoder module into the backbone network and combining it with the fine-grained feature enhancement module, the problem of decreased detection accuracy in bacterial AST images is solved, and the detection accuracy of adhered and small-sized bacteria is improved.
Patent Information
- Application Number
- CN202510678369.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2025-09-19
AI Technical Summary
When existing detection methods are directly applied to bacterial AST images, the detection accuracy decreases and they cannot effectively deal with the problems of bacterial adhesion, diverse morphologies and small size.
A boundary feature enhancement module is introduced into the backbone network to extract the boundary features of bacteria. Combined with the deformable attention encoder module and the fine-grained feature enhancement module, it adapts to the characteristics of bacterial AST images and improves detection accuracy.
It effectively reduces the problem of missed detection caused by bacterial adhesion and diverse morphologies, improves the detection accuracy of adherent bacteria and smaller bacteria, and enhances the ability to capture detailed bacterial information.
Smart Images

Figure CN120673029A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a dynamic scale-adaptive bacteria detection method, device and storage medium. Background Art
[0002] Antibiotic Susceptibility Test (AST) is a method that guides clinical drug use by detecting the sensitivity of pathogenic microorganisms to antibiotics. Combined with microscopic time-lapse imaging technology, this test can monitor the growth, inhibition or death of bacteria under the action of antibiotics in real time and dynamically at the microscopic scale, thereby providing more accurate drug sensitivity results. Therefore, this method has a wide range of applications in clinical practice. For example, Cobo et al. used time-lapse imaging to visualize the morphology of bacterial clusters, and Ungphakorn et al. used a new method based on time-lapse microscopy to evaluate the in vitro antibacterial effect of antibiotics. The analysis of bacterial AST image sequences involves multiple processing steps, including tracking, quantitative evaluation and visualization, which traditionally requires a lot of manual intervention. However, when the image quality is not ideal or the bacterial morphology is complex, traditional algorithms often cannot achieve accurate detection. In addition, manual intervention is time-consuming and labor-intensive, limiting its applicability in high-throughput clinical settings.
[0003] To address these issues, researchers have proposed automated bacterial detection methods based on single-stage growth images. These methods aim to detect the location and category of bacteria in bacterial AST images, significantly improving the efficiency and accuracy of clinical microbiological testing. For example, Lenseigne et al. used support vector machines to detect Mycobacterium tuberculosis, and Verikas et al. used random forests to detect the smallest algal cells in phytoplankton images. However, these methods are based on manually extracted features and suffer from insufficient representational capabilities, resulting in poor model robustness and generalization.
[0004] Subsequently, deep learning was gradually applied to bacterial detection, addressing the shortcomings of feature-based extraction methods. For example, Priyadharshini et al. used Faster R-CNN to detect tomato leaf diseases, and Inbar et al. used the YOLOv5 model to detect microorganisms in wastewater to prevent secondary water pollution. Kang et al. proposed a hybrid deep learning framework based on Fusion-Net for foodborne pathogen detection. Chotayapa et al. combined the YOLOX and Cascade R-CNN models to predict antibiotic treatment type and automatically extract bacterial morphology.
[0005] However, most existing detection methods are designed for natural images, without considering the characteristics of bacterial AST images based on time-lapse imaging algorithms. Figure 1As shown in the figure, due to the characteristics of bacterial AST images such as bacterial adhesion, diverse bacterial morphology, and relatively small bacterial size relative to the image, directly applying existing methods to bacterial AST images for bacterial detection will lead to a decrease in detection accuracy. Summary of the Invention
[0006] Therefore, the technical problem to be solved by the present invention is to overcome the problem that the prior art directly applies bacterial AST images to perform bacterial detection, which leads to a decrease in detection accuracy.
[0007] To solve the above technical problems, the present invention provides a dynamic scale-adaptive bacteria detection method, comprising:
[0008] The bacterial AST image is input into the backbone network of the bacterial detection model, and features are extracted through multiple convolution blocks and boundary feature enhancement modules to obtain multiple hierarchical features of different scales;
[0009] Multiple levels of feature maps are input into the neck network. The features of the last level are passed through the deformable attention encoder module to obtain their corresponding enhanced features. The features of the remaining levels are passed through the convolution blocks to obtain their corresponding enhanced features. The multiple enhanced features are input into the fine-grained feature enhancement module to obtain the target features.
[0010] The target features are input into the prediction head to obtain the bacteria detection results.
[0011] Preferably, the bacterial AST image is input into the backbone network of the bacterial detection model, and features are extracted through multiple convolution blocks and boundary feature enhancement modules to obtain multiple hierarchical features of different scales, including:
[0012] The bacterial AST image is passed through the initial convolution block to obtain the initial features;
[0013] The initial features are sequentially passed through four feature extraction modules to output first-level features, second-level features, third-level features, and fourth-level features respectively;
[0014] Each feature extraction module consists of a convolution block and a boundary feature enhancement module connected in sequence.
[0015] Preferably, the convolution block comprises a convolution layer, a batch normalization layer and a SiLU activation layer connected in sequence.
[0016] Preferably, the boundary feature enhancement module includes:
[0017] The input features of the boundary feature enhancement module are respectively passed through the boundary guide positioning module, the convolution block and the frequency domain perception module to obtain the first feature, the second feature and the third feature;
[0018] The first feature and the second feature are added together and then pass through a convolution block. The output is added to the third feature and then passes through another convolution block to obtain the output feature of the boundary feature enhancement module.
[0019] Preferably, the boundary guide positioning module includes:
[0020] The input features of the boundary guide positioning module are respectively passed through the convolution layer composed of the horizontal Scharr edge operator and the convolution layer composed of the vertical Scharr edge operator to obtain horizontal features and vertical features;
[0021] After the weighted summation of horizontal features and vertical features, the output features of the boundary guide positioning module are obtained through the convolution block.
[0022] Preferably, the frequency domain sensing module includes:
[0023] After the input features of the frequency domain perception module are subjected to a two-dimensional fast Fourier transform, the real and imaginary parts are obtained separately and spliced. The spliced features pass through a convolution block, and their output undergoes a two-dimensional inverse fast Fourier transform; the output of the two-dimensional inverse fast Fourier transform passes through another convolution block to obtain the output features of the frequency domain perception module.
[0024] Preferably, multiple enhanced features are input into a fine-grained feature enhancement module to obtain target features, including:
[0025] The enhanced features of the fourth-level features are passed through the convolution block to obtain the third intermediate features;
[0026] The third intermediate feature is passed through the upsampling layer, and its output is spliced with the enhanced feature of the third level feature to obtain the third fusion feature;
[0027] Pass the third fusion feature through the RepC3 block and the convolution block to obtain the second intermediate feature;
[0028] The second intermediate feature is passed through the upsampling layer, and its output is spliced with the enhanced feature of the second-level feature to obtain the second fused feature;
[0029] Pass the second fused feature through the deep convolution layer to obtain the first intermediate feature;
[0030] The first intermediate feature is passed through the upsampling layer, and its output is concatenated with the enhanced feature of the first-level feature to obtain the first fused feature;
[0031] Pass the first fusion feature through the deep convolution layer to obtain the first target feature;
[0032] The first target feature passes through the convolution block, its output is concatenated with the first intermediate feature, and then passes through the deep convolution layer to obtain the second target feature;
[0033] The second target feature passes through the convolution block, its output is concatenated with the second intermediate feature, and then passes through the RepC3 block to obtain the third target feature;
[0034] The third target feature is passed through the convolution block, its output is concatenated with the third intermediate feature, and then passed through the RepC3 block to obtain the fourth target feature.
[0035] Preferably, the deformable attention encoder module comprises:
[0036] The input features of the deformable attention encoder module are passed through the deformable attention mechanism, and its output is added to the input features of the deformable attention encoder module through a skip connection and then passed through a normalization layer to obtain the attention features;
[0037] The attention feature passes through the feedforward network, and its output is added to the intermediate feature through a jump connection and then passed through a normalization layer to obtain the output feature of the deformable attention encoder module.
[0038] The present invention also provides a dynamic scale adaptive bacteria detection device, comprising
[0039] The feature extraction unit is used to input the bacterial AST image into the backbone network of the bacterial detection model, extract features through multiple convolution blocks and boundary feature enhancement modules, and obtain multiple hierarchical features of different scales;
[0040] The feature enhancement unit is used to input multiple levels of feature maps into the neck network. The features of the last level are passed through the deformable attention encoder module to obtain their corresponding enhanced features, and the features of the remaining levels are passed through the convolution blocks to obtain their corresponding enhanced features. The multiple enhanced features are input into the fine-grained feature enhancement module to obtain the target features.
[0041] The detection unit is used to input the target features into the prediction head to obtain the bacteria detection results.
[0042] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the above-mentioned dynamic scale adaptive bacteria detection method are implemented.
[0043] The above technical solution of the present invention has the following beneficial effects compared with the prior art:
[0044] The present invention discloses a dynamic scale-adaptive bacteria detection method. Based on the characteristics of bacterial AST images, a boundary feature enhancement module is introduced into the backbone network to extract the boundary features of bacteria. This can better focus on the boundaries of adhered bacteria, avoid detecting adhered bacteria as one bacterium, and improve the detection accuracy of adhered bacteria. A deformable attention encoder module is introduced into the neck network to focus on the bacterial area, adapt to the diverse bacterial morphology, and avoid distraction. The fine-grained feature enhancement module is then used to retain rich bacterial fine-grained spatial features, so that the model can better capture object detail information, thereby improving the detection capability of smaller targets. The present invention is suitable for bacteria detection based on AST images, and can effectively reduce the problem of missed detection caused by bacterial adhesion, diverse morphology, and smaller bacterial size, thereby improving the accuracy of bacteria detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below based on specific embodiments of the present invention in conjunction with the accompanying drawings, wherein:
[0046] Figure 1 This is an example of a bacterial AST image sequence;
[0047] Figure 2 It is the structural diagram of the RT-DETR target detection algorithm;
[0048] Figure 3 It is a structural diagram of the bacteria detection model provided by the present invention;
[0049] Figure 4 It is the structural diagram of the boundary feature enhancement module, where Figure 4 (a) is the structural diagram of the boundary feature enhancement module. Figure 4 (b) is the structural diagram of the frequency domain perception module. Figure 4 (c) is the structural diagram of the boundary guide positioning module;
[0050] Figure 5 This is the structural diagram of the deformable attention encoder module;
[0051] Figure 6 It is the structural diagram of the fine-grained feature enhancement module;
[0052] Figure 7 It is the structural diagram of the convolution block. DETAILED DESCRIPTION
[0053] The present invention will be further described below with reference to the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it. However, the embodiments are not intended to limit the present invention.
[0054] Common target detection algorithms such as RT-DETR, whose structure refers to Figure 2 As shown in the figure, it is mainly divided into three parts: backbone network, feature fusion network and prediction head; the specific steps include:
[0055] (1) The image is subjected to feature extraction through the backbone network to obtain the corresponding feature map;
[0056] (2) The feature fusion network generates a feature map with more extensive context information and multiple perspectives based on the feature map extracted by the backbone network. This feature is very important for target detection.
[0057] (3) The prediction head performs classification and regression to obtain the final target detection frame.
[0058] However, the RT-DETR algorithm was designed for object detection in natural images and cannot address the challenges of bacterial AST images. The detection frames generated by its detection head cannot distinguish between adherent bacteria, resulting in missed detections. Furthermore, it cannot successfully detect bacteria of various morphologies, exacerbating missed detections. Furthermore, because bacteria are relatively small relative to the image, the RT-DETR algorithm cannot retain sufficient target features, which can also lead to missed detections.
[0059] In order to address the defects of existing detection algorithms in detecting bacteria in bacterial AST images, the present invention provides a dynamic scale-adaptive bacteria detection method based on the RT-DETR algorithm, including:
[0060] Construct a bacterial detection model, its structure refers to Figure 3 As shown;
[0061] The bacterial AST image is input into the backbone network of the bacterial detection model, and features are extracted through multiple convolution blocks and boundary feature enhancement modules to obtain multiple hierarchical features of different scales;
[0062] Multiple levels of feature maps are input into the neck network. The features of the last level are passed through the deformable attention encoder module to obtain their corresponding enhanced features. The features of the remaining levels are passed through the convolution blocks to obtain their corresponding enhanced features. The multiple enhanced features are input into the fine-grained feature enhancement module to obtain the target features.
[0063] The target features are input into the prediction head to obtain the bacteria detection results.
[0064] Specifically, the bacterial AST image is input into the backbone network of the bacterial detection model. After multiple convolutional blocks and the Boundary Feature Enhancement Module (BFEM) are used to extract features, multiple hierarchical features at different scales are obtained, including:
[0065] The bacterial AST image is passed through the initial convolution block to obtain the initial features;
[0066] The initial features are sequentially passed through four feature extraction modules to output first-level features, second-level features, third-level features, and fourth-level features respectively;
[0067] Each feature extraction module consists of a convolution block and a boundary feature enhancement module connected in sequence.
[0068] The boundary feature enhancement module extracts features for extracting the boundary features of bacteria. At the same time, the enhanced high-frequency information can further help detect adherent bacteria. Its structure refers to Figure 4 As shown, Figure 4 (a) is the structural diagram of the boundary feature enhancement module, which specifically includes:
[0069] The input features of the boundary feature enhancement module are respectively passed through the boundary guide positioning module, the convolution block and the frequency domain perception module to obtain the first feature, the second feature and the third feature;
[0070] The first feature and the second feature are added together and then pass through a convolution block. The output is added to the third feature and then passes through another convolution block to obtain the output feature of the boundary feature enhancement module.
[0071] The formula of the boundary feature enhancement module is expressed as:
[0072] F BFEM =CBS (k,s) (CBS (k,s) (BGLM(F BFEM_in )+CBS (k,s) (F in ))+FAM(F BFEM_in ))
[0073] Among them, F BFEM represents the output feature of the boundary feature enhancement module, F BFEM_in represents the input features of the boundary feature enhancement module, BGLM(·) represents the boundary guide positioning module (BGLM), FAM(·) represents the frequency domain perception module (FAM), CBS (k,s) (·) represents the convolution block, k represents the size of the convolution kernel, and s represents the stride.
[0074] Figure 4(b) in the figure shows the structure of the frequency domain perception module. The frequency domain perception module includes a fast Fourier transform (FFT) operation. The FFT operation uses sine / cosine basis functions to convert image features from the spatial domain to the frequency domain. The rapid oscillation of high-frequency sine waves is suitable for capturing high-frequency information in images, enabling the frequency domain perception module to capture high-frequency components of the image in the frequency domain to assist in bacterial detection.
[0075] The structure of the frequency domain perception module specifically includes:
[0076] After the input features of the frequency domain perception module are subjected to a two-dimensional fast Fourier transform, the real and imaginary parts are obtained separately and spliced. The spliced features pass through a convolution block, and their output undergoes a two-dimensional inverse fast Fourier transform; the output of the two-dimensional inverse fast Fourier transform passes through another convolution block to obtain the output features of the frequency domain perception module.
[0077] The formula of the frequency domain perception module is expressed as:
[0078] F FAM =CBS (k,s) (IFFT2D(CBS (k,s) (Cat(Re(FFT2D(F FAM_in )),Im(FFT2D(F FAM_in )))))
[0079] Among them, F FAM Represents the output features of the frequency domain perception module, F FAM_in represents the input features of the frequency domain perception module; IFFT2D(·) represents the two-dimensional inverse fast Fourier transform, and FFT2D(·) represents the two-dimensional fast Fourier transform; Cat(·) represents the concatenation operation, Re(·) and Im(·) represent the operations of obtaining the real part and imaginary part, respectively.
[0080] Figure 4 (c) is the structural diagram of the boundary guide positioning module. The boundary guide positioning module includes a parallel structure consisting of a convolution consisting of a horizontal Scharr edge operator (Scharr_x) and a convolution consisting of a vertical Scharr edge operator (Scharr_y). The Scharr edge operator can be used to extract the boundary features of bacteria in different directions in the time domain.
[0081] The structure of the boundary guide positioning module specifically includes:
[0082] The input features of the boundary guide positioning module are respectively passed through the convolution layer composed of the horizontal Scharr edge operator and the convolution layer composed of the vertical Scharr edge operator to obtain horizontal features and vertical features;
[0083] After the weighted summation of horizontal features and vertical features, the output features of the boundary guide positioning module are obtained through the convolution block.
[0084] The formula of the boundary guide positioning module is expressed as:
[0085] F BGLM =CBS (k,s) (0.5*CBS (Scharr_x,s) (F BGLM_in )+0.5*CBS (Scharr_y,s) (F BGLM_in ))
[0086] Among them, F BGLM represents the output features of the boundary guide localization module, F BGLM_in Represents the input features of the boundary guide positioning module, Scharr_x represents the horizontal Scharr edge operator, Scharr_y represents the vertical Scharr edge operator, and s represents the step size; CBS (Scharr_x,s) and CBS (Scharr_y,s) They represent the convolutional layers composed of horizontal Scharr edge operators and vertical Scharr edge operators respectively.
[0087] The values of the horizontal Scharr edge operator and the vertical Scharr edge operator are shown in Table 1.
[0088] Table 1. Scharr edge operator values
[0089]
[0090] The boundary feature enhancement module includes a boundary guide positioning module and a frequency domain perception module; wherein the boundary guide positioning module realizes feature extraction of the bacterial boundary in the time domain through the Scharr edge operator, and the frequency domain perception module enables the model to focus on the image frequency domain information through the fast Fourier transform. The combination of the two has the mutual compensation capability of the space-frequency domain dual paths. Traditional feature enhancement technologies such as the Inception module use traditional convolution kernels and are difficult to capture the anisotropic morphology of bacteria, and lack the frequency domain modeling capability, and have low sensitivity to bacterial boundaries. Frequency domain-based feature enhancement technologies such as wavelet transform rely on the frequency domain and result in loss of spatial positioning accuracy, making the model insensitive to local information. Therefore, the boundary feature enhancement module used in the present invention has the ability to extract boundary features in the space-frequency domain, which can better focus on the boundaries of adherent bacteria, avoid detecting adherent bacteria as one bacterium, and cause false detection, thereby improving the detection accuracy of adherent bacteria.
[0091] Reference Figure 5As shown, the deformable attention encoder module is an encoder that includes a deformable attention mechanism, which dynamically adjusts the position of key-value pairs in self-attention by learning offsets to focus on different bacterial areas, reduce attention distraction, and help the model effectively detect bacteria of different morphologies.
[0092] The structure of the deformable attention encoder module specifically includes:
[0093] The input features of the deformable attention encoder module are passed through the deformable attention mechanism, and its output is added to the input features of the deformable attention encoder module through a skip connection and then passed through a normalization layer to obtain the attention features;
[0094] The attention feature passes through the feedforward network, and its output is added to the intermediate feature through a jump connection and then passed through a normalization layer to obtain the output feature of the deformable attention encoder module.
[0095] The formula of the deformable attention encoder module is expressed as:
[0096] F DAEM =LN(LN(F DAEM_in +DAT(F DAEM_in ))+FFN(LN(F DAEM_in +DAT(F DAEM_in ))))
[0097] Among them, F DAEM represents the output features of the deformable attention encoder module, F DAEM_in represents the input features of the deformable attention encoder module; LN represents the layer normalization operation, DAT(·) represents the deformable attention mechanism, and FFN(·) represents the feedforward network.
[0098] Specifically, the deformable attention mechanism includes: setting a reference point on the input feature of the deformable attention mechanism and using the query weight W q Get the query of input features. The query passes through the offset network θ offset The offset is calculated. The offset network includes a deep convolutional layer (DWConv), a GELU activation function, and a 1×1 convolutional layer connected in sequence. The offset is combined with the reference point to generate a deformation point. The deformation key and value are projected from the input feature according to the deformation point. The relative position offset R is calculated using the deformation point. Finally, the query, deformation key, value, and relative position offset are input into the multi-head attention mechanism to obtain the output features of the deformable attention mechanism. For clear presentation, Figure 5 Only four reference points are shown in FIG. 4 , but in practical applications, there are usually more than four reference points.
[0099] The deformable attention mechanism enables the model to focus more on target areas, adapt to their morphological changes, and avoid distraction. Therefore, this paper integrates the deformable attention mechanism into the deformable attention encoder module to capture the characteristics of bacteria with different morphologies. Regardless of the morphological differences of bacteria, the deformable attention encoder module can effectively detect different bacterial morphologies and avoid false detections.
[0100] The structure of the fine-grained feature enhancement module refers to Figure 6 As shown in Figure 2, multiple enhanced features are input into the fine-grained feature enhancement module to obtain target features, including:
[0101] The enhanced features of the fourth-level features are passed through the convolution block to obtain the third intermediate features;
[0102] The third intermediate feature is passed through the upsampling layer, and its output is spliced with the enhanced feature of the third level feature to obtain the third fusion feature;
[0103] Pass the third fusion feature through the RepC3 block and the convolution block to obtain the second intermediate feature;
[0104] The second intermediate feature is passed through the upsampling layer, and its output is spliced with the enhanced feature of the second-level feature to obtain the second fused feature;
[0105] Pass the second fused feature through the deep convolution layer to obtain the first intermediate feature;
[0106] The first intermediate feature is passed through the upsampling layer, and its output is concatenated with the enhanced feature of the first-level feature to obtain the first fused feature;
[0107] Pass the first fusion feature through the deep convolution layer to obtain the first target feature;
[0108] The first target feature passes through the convolution block, its output is concatenated with the first intermediate feature, and then passes through the deep convolution layer to obtain the second target feature;
[0109] The second target feature passes through the convolution block, its output is concatenated with the second intermediate feature, and then passes through the RepC3 block to obtain the third target feature;
[0110] The third target feature is passed through the convolution block, its output is concatenated with the third intermediate feature, and then passed through the RepC3 block to obtain the fourth target feature.
[0111] The fine-grained feature enhancement module is used to preserve the rich fine-grained spatial features of bacteria. Its main concept is to introduce additional high-resolution feature maps during the model's feature fusion phase, which are enhanced features of the first-level features. Because high-resolution feature maps retain more detailed information than low-resolution feature maps, they are beneficial for detecting small targets, allowing the network to better capture object details, thereby improving the model's detection capabilities for smaller targets. In addition, to address the problem of a significant increase in computational load due to the addition of additional network layers, the present invention uses low-computational depth convolution layers in the fine-grained feature enhancement module, which can minimize the model's computational complexity while ensuring detection accuracy. The RepC3 block is a reparameterized convolution module, a feature extraction module in the RT-DETR algorithm. The present invention adopts this module, which allows the network to use different structures during the training and inference phases. During the training phase, the RepC3 block can be represented as a standard convolution layer, but during the inference phase, it can be reparameterized into a more efficient structure, thereby reducing the computational load and improving inference speed.
[0112] In order to illustrate the superiority of the neck network proposed in the present invention compared to the neck network without adding high-resolution feature maps, the relevant experimental results of this embodiment are shown in Table 2, where the bold indicates the optimal result.
[0113] Table 2. Comparison results between traditional neck network and neck network of the present invention
[0114]
[0115]
[0116] As can be seen from Table 2, the detection results of the neck network designed by the present invention are better than those of the traditional neck network in all indicators.
[0117] Reference Figure 7 As shown in FIG, the convolution blocks used in the bacteria detection model constructed by the present invention include a convolutional layer, a batch normalization layer, and a SiLU activation layer connected in sequence.
[0118] Specifically, the detection head used in the present invention is a detection head of the RT-DETR algorithm.
[0119] Specifically, the bacterial AST images used in this embodiment have a resolution between 3842x2198 and 5453x3599, which is approximately equal to 3000x4000 pixels. A total of 1220 images were collected. After screening (label checking and removal of images without bacteria), a total of 1049 images remained for training and testing the method of the present invention. All bacterial AST images used were manually annotated and verified by relevant experts. The target size distribution in the bacterial AST images is shown in Table 3, where the definitions of small, medium, and large are based on the standard definitions of the MS COCO dataset.
[0120] Table 3. Target size distribution of bacterial AST images
[0121]
[0122] Specifically, when training the bacteria detection model, the optimizer used was the AdamW optimizer, and the parameters were set as follows: learning rate lr = 0.0001, momentum = 0.9, weight-decay = 0.0001. After training, the model with the best mAP.50 was saved.
[0123] To verify the effectiveness of the method of the present invention, this example conducted an experiment to compare the bacteria detection model proposed in the present invention with existing advanced detectors. The results are shown in Table 4.
[0124] Table 4. Comparison of test results
[0125]
[0126]
[0127] As can be seen from Table 4, the bacteria detection model proposed in the present invention outperforms other detectors currently studied in related research fields, including single-stage detectors, dual-stage detectors, and end-to-end detectors. This demonstrates the outstanding advantages of the method of the present invention.
[0128] In summary, the dynamic scale-adaptive bacteria detection method described in the present invention, targeting the characteristics of bacterial AST images, introduces a boundary feature enhancement module in the backbone network to extract the boundary features of bacteria, which can better focus on the boundaries of adhered bacteria, avoid detecting adhered bacteria as one bacterium, and cause false detection, thereby improving the detection accuracy of adhered bacteria; introduces a deformable attention encoder module in the neck network to focus on the bacterial area, adapt to the diverse bacterial morphology, and avoid distraction; and then utilizes a fine-grained feature enhancement module to retain rich bacterial fine-grained spatial features, so that the model can better capture object detail information, thereby improving the detection capability of smaller targets. The present invention is suitable for bacteria detection based on AST images, and can effectively reduce the problem of missed detection caused by bacterial adhesion, diverse morphology and smaller bacterial size, and improve the accuracy of bacteria detection.
[0129] Based on the above-mentioned dynamic scale-adaptive bacteria detection method, this embodiment further provides a dynamic scale-adaptive bacteria detection device, including:
[0130] The feature extraction unit is used to input the bacterial AST image into the backbone network of the bacterial detection model, extract features through multiple convolution blocks and boundary feature enhancement modules, and obtain multiple hierarchical features of different scales;
[0131] The feature enhancement unit is used to input multiple levels of feature maps into the neck network. The features of the last level are passed through the deformable attention encoder module to obtain their corresponding enhanced features, and the features of the remaining levels are passed through the convolution blocks to obtain their corresponding enhanced features. The multiple enhanced features are input into the fine-grained feature enhancement module to obtain the target features.
[0132] The detection unit is used to input the target features into the prediction head to obtain the bacteria detection results.
[0133] This embodiment further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the above-mentioned dynamic scale-adaptive bacteria detection method are implemented.
[0134] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0135] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0136] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0137] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0138] Obviously, the above embodiments are merely examples for clarity of explanation and are not intended to limit the implementation methods. Those skilled in the art will appreciate that other variations or modifications can be made based on the above description. It is not necessary and impossible to enumerate all implementation methods here. Obvious variations or modifications arising therefrom remain within the scope of protection of the present invention.
Claims
1. A dynamic scale-adaptive bacteria detection method, characterized in that: include: The bacterial AST image is input into the backbone network of the bacterial detection model, and features are extracted through multiple convolution blocks and boundary feature enhancement modules to obtain multiple hierarchical features of different scales; Multiple levels of feature maps are input into the neck network. The features of the last level are passed through the deformable attention encoder module to obtain their corresponding enhanced features. The features of the remaining levels are passed through the convolution blocks to obtain their corresponding enhanced features. The multiple enhanced features are input into the fine-grained feature enhancement module to obtain the target features. The target features are input into the prediction head to obtain the bacteria detection results.
2. A dynamic scale adaptive bacteria detection method according to claim 1, characterized in that: The bacterial AST image is input into the backbone network of the bacterial detection model. After multiple convolution blocks and boundary feature enhancement modules are used to extract features, multiple hierarchical features of different scales are obtained, including: The bacterial AST image is passed through the initial convolution block to obtain the initial features; The initial features are sequentially passed through four feature extraction modules to output first-level features, second-level features, third-level features, and fourth-level features respectively; Each feature extraction module consists of a convolution block and a boundary feature enhancement module connected in sequence.
3. A dynamic scale adaptive bacteria detection method according to claim 2, characterized in that: The convolution block includes a convolution layer, a batch normalization layer and a SiLU activation layer connected in sequence.
4. A dynamic scale-adaptive bacteria detection method according to claim 2, characterized in that: The boundary feature enhancement module includes: The input features of the boundary feature enhancement module are respectively passed through the boundary guide positioning module, the convolution block and the frequency domain perception module to obtain the first feature, the second feature and the third feature; The first feature and the second feature are added together and then pass through a convolution block. The output is added to the third feature and then passes through another convolution block to obtain the output feature of the boundary feature enhancement module.
5. A dynamic scale-adaptive bacteria detection method according to claim 4, characterized in that: The boundary guide positioning module includes: The input features of the boundary guide positioning module are respectively passed through the convolution layer composed of the horizontal Scharr edge operator and the convolution layer composed of the vertical Scharr edge operator to obtain horizontal features and vertical features; After the weighted summation of horizontal features and vertical features, the output features of the boundary guide positioning module are obtained through the convolution block.
6. A dynamic scale-adaptive bacteria detection method according to claim 4, characterized in that: The frequency domain sensing module includes: After the input features of the frequency domain perception module are subjected to a two-dimensional fast Fourier transform, the real and imaginary parts are obtained separately and spliced. The spliced features pass through a convolution block, and their output undergoes a two-dimensional inverse fast Fourier transform; the output of the two-dimensional inverse fast Fourier transform passes through another convolution block to obtain the output features of the frequency domain perception module.
7. A dynamic scale-adaptive bacteria detection method according to claim 2, characterized in that: Multiple enhanced features are input into the fine-grained feature enhancement module to obtain target features, including: The enhanced features of the fourth-level features are passed through the convolution block to obtain the third intermediate features; The third intermediate feature is passed through the upsampling layer, and its output is concatenated with the enhanced features of the third level features. Obtain the third fusion feature; Pass the third fusion feature through the RepC3 block and the convolution block to obtain the second intermediate feature; The second intermediate feature is passed through the upsampling layer, and its output is concatenated with the enhanced features of the second level features. Obtain the second fusion feature; Pass the second fused feature through the deep convolution layer to obtain the first intermediate feature; The first intermediate feature is passed through the upsampling layer, and its output is concatenated with the enhanced features of the first level features. Get the first fusion feature; Pass the first fusion feature through the deep convolution layer to obtain the first target feature; The first target feature passes through the convolution block, its output is concatenated with the first intermediate feature, and then passes through the deep convolution layer to obtain the second target feature; The second target feature passes through the convolution block, its output is concatenated with the second intermediate feature, and then passes through the RepC3 block to obtain the third target feature; The third target feature is passed through the convolution block, its output is concatenated with the third intermediate feature, and then passed through the RepC3 block to obtain the fourth target feature.
8. The method for dynamic scale-adaptive bacteria detection according to claim 1, characterized in that: The deformable attention encoder module includes: The input features of the deformable attention encoder module are passed through the deformable attention mechanism, and its output is added to the input features of the deformable attention encoder module through a jump connection and then passed through a normalization layer. Get attention features; The attention feature passes through the feedforward network, and its output is added to the intermediate feature through a jump connection and then passed through a normalization layer to obtain the output feature of the deformable attention encoder module.
9. A dynamic scale adaptive bacteria detection device, characterized in that: include: The feature extraction unit is used to input the bacterial AST image into the backbone network of the bacterial detection model, extract features through multiple convolution blocks and boundary feature enhancement modules, and obtain multiple hierarchical features of different scales; The feature enhancement unit is used to input multiple levels of feature maps into the neck network. The features of the last level are passed through the deformable attention encoder module to obtain their corresponding enhanced features, and the features of the remaining levels are passed through the convolution blocks to obtain their corresponding enhanced features. The multiple enhanced features are input into the fine-grained feature enhancement module to obtain the target features. The detection unit is used to input the target features into the prediction head to obtain the bacteria detection results.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the dynamic scale-adaptive bacteria detection method according to any one of claims 1 to 8.