Image recognition method and system of ear endoscope based on DenseNet and storage medium

By combining DenseNet with the Top_K sparse attention module and the SE module, the ear endoscope image recognition model is optimized, which solves the problems of recognition accuracy and computing resources and achieves efficient and accurate ear endoscope image recognition.

CN120726451AActive Publication Date: 2025-09-30SHANDONG PROVINCIAL PUBLIC HEALTH CLINICAL CENT

Patent Information

Application Number
CN202510869857.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-26
Publication Date
2025-09-30
Estimated Expiration
2045-06-26

AI Technical Summary

Technical Problem

Existing ear endoscope image recognition models have limited recognition accuracy, numerous parameters, and huge computing resource requirements, making them difficult to be widely promoted in practical applications.

Method used

An ear endoscope image recognition method based on DenseNet is adopted, combined with the Top_K sparse attention module and the SE module. By selectively focusing on important image information, the learning of noise and irrelevant features is reduced, the computational complexity is reduced, and a gradient checkpoint strategy is introduced to optimize the model performance.

Benefits of technology

The model's recognition accuracy and generalization ability are improved, the computational complexity is reduced, the model is suitable for scenarios with limited video memory, and the efficiency and accuracy of ear endoscope image recognition are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120726451A_ABST
    Figure CN120726451A_ABST
Patent Text Reader

Abstract

The invention discloses an image recognition method and system of an ear endoscope based on DenseNet and a storage medium, relates to the technical field of medical image processing, and aims to solve the problems that an existing ear endoscope image recognition model is limited in recognition precision, numerous in parameters and huge in required computing resources. Comprising the following steps: step 1, acquiring an ear endoscope image, and preprocessing the ear endoscope image; step 2, an ear endoscope image recognition model based on DenseNet is constructed, an SE module is embedded in a dense layer in a model dense block and is used for performing channel weighting on a feature map, and a Top-k sparse attention module is introduced and is used for selectively paying attention to important information in the image so as to improve calculation efficiency and model performance; and 3, identifying the image of the ear endoscope by adopting the ear endoscope image identification model to obtain an ear disease detection result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of medical image processing, and in particular to an image recognition method and system for an ear endoscope based on DenseNet, and a storage medium. Background Art

[0002] Otoscopy is the main means of diagnosing ear canal diseases, but traditional otoscopes can only provide superficial two-dimensional images of the tympanic membrane and external auditory canal. Doctors need to rely on subjective experience to judge the image characteristics. Non-specialists (such as pediatricians and emergency department doctors) are prone to misdiagnosis due to lack of professional knowledge. The misdiagnosis rate is particularly significant in resource-scarce areas.

[0003] With the development of artificial intelligence (AI), particularly the application of machine learning and deep learning algorithms, medical image processing has become increasingly intelligent. Computers can automatically learn and identify features in medical images, improving diagnostic accuracy and efficiency. Previous studies have applied deep learning to otological image classification, such as identifying conditions like otitis media and tympanic membrane perforation. However, these models rely on high-quality annotated data and are sensitive to image noise (such as obstruction by ear canal secretions and uneven lighting). This limited generalization capability makes it difficult to achieve high recognition accuracy. Convolutional neural networks (CNNs) and Transformer-based models, in particular, have been widely used in medical image classification and have demonstrated expert-level disease diagnosis capabilities. However, current technology still faces challenges. CNN models have numerous parameters, and more parameters generally require more computing resources (such as processor time and memory). This results in a large amount of training data and significant computing resources, limiting their practical application. Summary of the Invention

[0004] The technical problems to be solved by the present invention are:

[0005] Existing ear endoscope image recognition models often have problems such as limited recognition accuracy, numerous parameters, and huge computing resources required.

[0006] The present invention is to solve the above technical problems using the following technical solutions:

[0007] The present invention provides an image recognition method for ear endoscope based on DenseNet, comprising the following steps:

[0008] Step 1: collecting ear endoscope images and preprocessing the ear endoscope images;

[0009] Step 2: Build an ear endoscope image recognition model based on DenseNet. The dense layers in the model's dense blocks are embedded with SE modules for channel weighting of feature maps. A Top-k sparse attention module is also introduced to selectively focus on important information in the image to improve computational efficiency and model performance.

[0010] Step 3: Use the ear endoscope image recognition model to recognize the ear endoscope image and obtain the ear disease detection result.

[0011] Furthermore, the preprocessing of the ear endoscope image in step 1 includes: adjusting the image size, randomly flipping the image horizontally, and randomly flipping the image vertically.

[0012] Furthermore, the DenseNet network model includes:

[0013] Top_K sparse attention module, which performs convolution and matrix operations on otoendoscopic images to extract the K features most relevant to ear diseases;

[0014] Initialize the convolution layer for feature extraction of the otoendoscopic image and select the convolution operation based on the input otoendoscopic image size;

[0015] Four-stage progressive Dense Block, the number of DenseLayer in the four Dense Blocks is 6, 12, 24, and 16 respectively, the number of channels of each DenseLayer is 32, and the four Dense Blocks correspond to 192, 384, 768, and 512 channels respectively; each DenseLayer includes two BN layers, two ReLU layers, and two Conv layers. The two Conv layers are 1×1 convolution and 3×3 convolution respectively, and the Dropout layer is integrated in the DenseLayer to set the Dropout rate of the training process;

[0016] The DenseLayer in the Dense Block of the model is embedded with an SE module, which consists of a global average pooling layer and two fully connected layers. The global average pooling layer is used to compress the information of each channel into a scalar and extract global information. The two fully connected layers are used to learn the dependencies between channels and generate the attention weights for each channel.

[0017] The transition layer includes a BN layer, a Relu layer, a Conv layer, and an average pooling layer for feature compression. The model contains three transition layers, and each transition layer reduces the number of feature maps by half.

[0018] The classification module includes a global average pooling layer and a fully connected layer, which is used to perform global average pooling on the feature map output by the transition layer, compress the features after global average pooling into a one-dimensional vector, and then map it to the category label space through the fully connected layer to obtain the final classification result.

[0019] Furthermore, the functional implementation process of the Top_K sparse attention module is as follows:

[0020] For the input ear canal disease image, the input features are encoded with channel context through 1x1 convolution and depth-separable convolution:

[0021]

[0022] where x∈R B×C×H×W ; Q, K, V∈R B×C×H×W ; Where B, C, H, W are batch, channel, height, and width respectively, x is the basic embedding vector of the input ear disease image sequence, R represents the position-related rotation matrix, Q, K, and V are query, key, and value respectively, DWConv is depth-wise separable convolution, Conv 1×1 is a 1x1 convolution;

[0023] Calculate the attention scores of Q and K, screen out unnecessary elements with low attention weights, and adaptively select the k features with the highest attention scores:

[0024]

[0025] where Q i is the query of the i-th row of the feature graph, K j is the key of the jth column of the feature map, d is the vector dimension, and τ is the temperature parameter;

[0026] Then calculate the similarity with V, after 1x1 convolution, calculate the similarity with the initial image and output the feature result.

[0027] Furthermore, the initialized convolution layer selects a convolution operation according to the input image size, specifically: if the input size is smaller than a preset threshold, a 1x1 convolution kernel is used; otherwise, a 7×7 convolution kernel is used, and a maximum pooling layer is added for downsampling.

[0028] Furthermore, the gradient checkpoint strategy introduced by the DenseNet includes the following steps:

[0029] Divide each Dense Block of DenseNet into a "paragraph";

[0030] During forward propagation, only the checkpoint data of each Dense Block is saved, and other calculation results within the segment are directly discarded;

[0031] During backpropagation, the forward calculation of the Dense Block is re-executed from the most recent checkpoint of the Dense Block, and the gradient is calculated after the intermediate results are generated;

[0032] The Dropout random seed is fixed during the process to avoid inconsistent results when recalculating.

[0033] Furthermore, the loss function of the DenseNet-based ear endoscope image recognition model adopts the cross entropy loss combined with LogSoftmax and NLLLoss, specifically:

[0034]

[0035] Where y is the true label of the sample, is the predicted probability distribution of the model output after softmax processing, and i represents the category index.

[0036] Furthermore, during the training process of the DenseNet-based ear endoscope image recognition model, an early stopping mechanism is introduced. If the accuracy of the current validation set is greater than or equal to the best accuracy recorded previously, the best performance model is obtained.

[0037] The present invention also provides an image recognition system for an ear endoscope based on DenseNet, which has a program module corresponding to the steps of the method described in any one of the above technical solutions, and executes the steps in the above-mentioned image recognition method for an ear endoscope based on DenseNet during operation.

[0038] The present invention also provides a computer-readable storage medium, which stores a computer program, and the computer program is configured to implement the steps of the DenseNet-based ear endoscope image recognition method described in any one of the above technical solutions when called by a processor.

[0039] Compared with the prior art, the present invention has the following beneficial effects:

[0040] The present invention is based on the DenseNet model and adds a lightweight Top_K sparse attention module and an SE attention module. The Top_K sparse attention module enables the model to focus on important features, reduce the learning of noise and irrelevant features, and make the learned features more robust, thereby improving the generalization ability of the model and reducing the risk of overfitting, thereby better promoting high-quality image reconstruction. At the same time, it significantly reduces the computational complexity while ensuring model performance. The SE attention module enhances the network's attention mechanism for channel features, and by dynamically adjusting the channel weighting of the feature map, optimizes the fusion effect of multi-layer features in dense connections, improves the model's utilization efficiency of key features of otoscope images, and improves the accuracy of model recognition.

[0041] The present invention also solves the problem of the DenseNet network model having many layers and dense connections between layers, and the intermediate results occupying a large amount of memory, by introducing a gradient checkpoint mechanism and repeatedly calculating part of the forward process. This makes the model suitable for scenarios with limited video memory and has significant advantages in industry.

[0042] The DenseNet network model of the present invention encourages feature reuse, so that each layer of the network accesses the feature maps of all previous layers, thereby reducing the number of parameters and improving efficiency, without the need to relearn redundant feature maps. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 Flowchart of the image recognition method for ear endoscope based on DenseNet in an embodiment of the present invention;

[0044] Figure 2 Schematic diagram of the network architecture of the ear endoscope image recognition model based on DenseNet in an embodiment of the present invention;

[0045] Figure 3 This is an example of predicting external auditory canal tumors and the prediction results in an embodiment of the present invention.

[0046] Figure 4 Schematic diagram of the structure of the Top_K sparse attention module in an embodiment of the present invention. DETAILED DESCRIPTION

[0047] In order to enable those skilled in the art to better understand the present invention, exemplary embodiments or examples of the present invention will be described below with reference to the accompanying drawings. Obviously, the described embodiments or examples are only some of the embodiments or examples of the present invention, and not all of them. Based on the embodiments or examples of the present invention, all other embodiments or examples obtained by those skilled in the art without creative work should fall within the scope of protection of the present invention.

[0048] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0049] Specific implementation plan 1: Combined Figure 1 As shown, the present invention provides an image recognition method for ear endoscope based on DenseNet, comprising the following steps:

[0050] Step 1: collecting ear endoscope images and preprocessing the ear endoscope images;

[0051] Step 2: Build an ear endoscope image recognition model based on DenseNet. The dense layers in the model's dense blocks are embedded with SE modules for channel weighting of feature maps. A Top-k sparse attention module is also introduced to selectively focus on important information in the image to improve computational efficiency and model performance.

[0052] Step 3: Use the ear endoscope image recognition model to recognize the ear endoscope image and obtain the ear disease detection result.

[0053] In this implementation, a DenseNet-based otoscope image recognition model is used to identify otoscope images and obtain detection results for ear diseases (including otitis media, external otitis, external auditory canal fungus, external auditory canal cerumen, external auditory canal tumors, normal external auditory canal tympanic membrane, tympanic effusion, tympanic membrane perforation, and tympanic membrane perforation plus external auditory canal fungus). Data preparation begins with loading the dataset, defining data augmentation and preprocessing operations, and partitioning the dataset into training, validation, and test sets. The cross-entropy loss function and stochastic gradient descent (SGD) optimizer are used. The training process includes forward propagation, loss calculation, backpropagation, and optimizer updates. Model performance is evaluated on the validation and test sets, ultimately resulting in diagnostic results.

[0054] Specific implementation plan two: The preprocessing of the otoscope image described in step one includes: adjusting the image size to 128x128. This is because the resolution of the original images of ear canal diseases taken by the otoscope is often very high (1024x1024 or higher). Directly using high-resolution images for training will result in a huge amount of calculation. Adjusting to 128x128 will neither lose too much important information due to too low resolution nor waste computing resources due to too high resolution. Randomly flip the image horizontally and vertically, and randomly rotate the image ±20 degrees to increase data diversity and enhance the model's robustness to directional changes. This helps the model learn features that are independent of direction and symmetry features. Selecting a rotation of ±20 degrees can simulate the otoscope entering the ear canal at different angles without causing excessive deformation of the resulting ear canal image, thereby retaining the main features of the image. Convert the image to Tensor format to ensure that the data format is consistent with the input requirements of the model, avoid format mismatch errors during training, and prepare for subsequent standardization operations.

[0055] Specific implementation plan three: Figure 2 and 3 As shown, the DenseNet network model includes:

[0056] Top_K sparse attention module, which performs convolution and matrix operations on otoendoscopic images to extract the K features most relevant to ear diseases;

[0057] Initialize the convolutional layer for feature extraction of the otoendoscopic image and select the convolution operation based on the input otoendoscopic image size; the number of feature maps output by the initial convolutional layer is 64;

[0058] Four-stage progressive Dense Block, the first Dense Block includes 6 _DenseLayer, the second Dense Block includes 12 _DenseLayer, the third Dense Block includes 24 _DenseLayer, and the fourth Dense Block includes 16 _DenseLayer; the number of channels of each DenseLayer is 32, and the four Dense Blocks correspond to 192, 384, 768 and 512 channels respectively; each DenseLayer includes two BN layers, two Relu layers and two Conv layers, and the two Conv layers are 1×1 convolution and 3×3 convolution respectively, and the Dropout layer is integrated in the DenseLayer to set the Dropout rate of the training process (for regularization, enabled only in the training phase);

[0059] DenseLayer connects feature maps using dense connections, enhancing feature propagation and reducing the number of parameters. First, the input feature map is normalized to ensure a stable distribution of the feature map input to the 1×1 convolution layer. A nonlinear transformation is then performed on the normalized feature map to enhance the expressiveness of the features. By setting negative values ​​to zero, the feature map is made sparser, reducing computational complexity. A 1×1 convolution is then performed to reduce the number of channels in the input feature map. A second normalization, nonlinear transformation, and 3×3 convolution are then performed. The 3×3 convolution extracts local features and captures spatial information.

[0060] The DenseLayer in the Dense Block of the model is embedded with an SE module, which consists of a global average pooling layer and two fully connected layers. The global average pooling layer is used to compress the information of each channel into a scalar to extract global information. The two fully connected layers are used to learn the dependencies between channels and generate the attention weights for each channel.

[0061] The SE module is used to enhance the network's attention mechanism for channel features. The channel attention weight is established through the fully connected layer. The information of each channel is first compressed into one value through global adaptive average pooling, and then the attention weight of each channel is generated through two fully connected layers. Finally, the attention weight is applied to each channel to enhance the features of important channels.

[0062] The transition layer includes a BN layer, a Relu layer, a Conv layer, and an average pooling layer. The transition layer is used for feature compression. 1x1 convolution is used to reduce the number of channels in the feature map, thereby reducing computational complexity and downsampling. Average pooling is used to reduce the spatial dimension of the feature map and extract higher-level features.

[0063] The classification module, consisting of a global average pooling layer and a fully connected layer, performs global average pooling on the feature map output by the transition layer in the final step of the forward propagation, compressing each channel of the feature map into a scalar. The pooled feature map is flattened into a one-dimensional tensor. Finally, a fully connected layer is used to map the flattened features into the class label space.

[0064] The Top_K sparse attention module implements a sparse attention mechanism. It uses multi-scale Top-K filtering to select high-value attention locations, significantly reducing computational complexity while maintaining model performance. During the computation, the data undergoes a series of convolutions and matrix operations, without changing the height and width of the feature map. Convolutions are used to generate the query (Q), key (K), and value (V). Q, K, and V are then split into multiple heads and flattened into a sequence. Attention scores are then calculated and Top-K filtering is applied. This changes the weight distribution of the sequence dimension without changing the spatial size.

[0065] Specific implementation plan four: Figure 4 As shown in Figure 2, the functional implementation process of the Top_K sparse attention module is as follows:

[0066] The Top_K sparse attention module receives the input ear canal disease image, performs channel context encoding on the input features through 1x1 convolution and depth-separable convolution to generate query (Q), key (K), value (V) with a shape of B× 3C×H × W, and then splits it into Q, K, and V (each B×C×H×W).

[0067]

[0068] where x∈R B×C×H×W ; Q, K, V∈R B×C×H×W ; Where B, C, H, and W are batch, channel, height, and width respectively, x is the basic embedding vector of the input ear disease image sequence, R represents the position-related rotation matrix, DWConv is the depth-wise separable convolution, and Conv 1×1 is a 1x1 convolution;

[0069] Then calculate the similarity between Q and K:

[0070]

[0071] where Q i is the query of the i-th row of the feature graph, K j is the key of the jth column of the feature map, d is the vector dimension, and τ is the temperature parameter;

[0072] And in the transposed attention matrix, unnecessary elements with low attention weights are masked out. The k positions with the highest scores in each row (or column) are screened to generate a binary mask. The contribution scores are adaptively selected to retain the most important k components and remove useless features. k is an adjustable parameter used to dynamically control the sparsity. Through the above steps, the attention matrix is ​​transformed from dense to sparse, and only the largest k values ​​in each row are retained for attention calculation. Other elements with scores less than the top-k are replaced with 0 at the given index using the scatter function, thereby achieving dynamic selection from dense to sparse.

[0073] Then calculate the similarity with V, after 1x1 convolution, calculate the similarity with the initial image and output the feature result.

[0074] Specific implementation plan 5: The initialization convolution layer selects a convolution operation based on the input image size. Specifically, if the input size is smaller than a preset threshold, a 1x1 convolution kernel with a stride of 1 and padding of 1 is used; otherwise, a 7x7 convolution kernel with a stride of 1 and padding of 3 is used, and a max pooling layer is added for downsampling. In this implementation, the image size adjusted by the Top_K sparse attention module is 128x128, which is larger than the preset threshold. Therefore, a 7x7 convolution is performed and two downsampling operations are performed, resizing the image from (128, 128) to (32, 32).

[0075] Specific implementation plan six: The gradient checkpoint strategy introduced by the DenseNet includes the following steps:

[0076] First, because DenseBlocks store the most feature maps due to their dense connectivity, we set a gradient checkpoint at this point. Second, we check after the transition layer: the transition layer downsamples and compresses channels, reducing recalculation costs. Applying gradient checkpoints in DenseNet can significantly reduce memory usage and improve computational efficiency.

[0077] Specific implementation scheme seven: The loss function of the DenseNet-based ear endoscope image recognition model adopts the cross-entropy loss (Cross-Entropy Loss) combined with LogSoftmax and NLLLoss, specifically:

[0078]

[0079] Where y is the one-hot encoding of the true label, is the predicted probability distribution of the model output after softmax processing, i represents the category index, y i and .

[0080] nn.LogSoftmax is a PyTorch module that computes the logarithm of the softmax function of an input tensor, used in the output layer of classification tasks. nn.NLLLoss is a PyTorch module that computes the negative log likelihood loss (Negative Log Likelihood Loss) for classification tasks, especially when the model output is log-softmax. The calculation formula for nn.LogSoftmax is as follows:

[0081]

[0082] x i is the i-th element of the input tensor. is the exponential sum of all elements in the input tensor.

[0083] For the input tensor y and target label t, the calculation formula of nn.NLLLoss is:

[0084]

[0085] Where y is the output of the model (log-softmax value), t is the index of the target label, and y t is the element in y that corresponds to the target label.

[0086] Cross-entropy loss is a method for measuring the difference between two probability distributions. It is applicable to the multi-classification problem of the present invention and can directly calculate the cross-entropy loss between the output of the model and the target label.

[0087] Specific Implementation Plan 8: During the training process of the DenseNet-based ear endoscope image recognition model, precision, recall, F1 score, and accuracy are used to evaluate the model, and an early stopping mechanism is introduced. If the accuracy of the current validation set is greater than or equal to the previously recorded best accuracy, the current model is considered to have better performance, and the accuracy is updated and the model is saved. The early stopping mechanism is used to obtain the best accuracy and validation loss, dynamically monitor model performance, and terminate training early when the validation set loss stops decreasing to prevent model overfitting.

[0088] The DenseNet-based otoscope image recognition method (algorithm) proposed in the present invention is the underlying technical core of the present invention, and various products can be derived based on the algorithm.

[0089] Based on the method proposed in the present invention, a DenseNet-based otoscope image recognition system is developed using a programming language. The system has program modules corresponding to the steps of the above-mentioned technical solution, and executes the steps in the above-mentioned DenseNet-based otoscope image recognition method during operation.

[0090] The developed system (software) is stored on a computer-readable storage medium as a computer program. The computer program is configured to implement the steps of the DenseNet-based otoscope image recognition method described above when invoked by a processor. This materializes the present invention on a carrier, becoming a computer program product.

[0091] Various implementations of the systems and techniques described herein can be realized in digital electronic circuitry, integrated circuitry, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0092] The computer programs (also referred to as programs, software, software applications, or code) herein comprise machine instructions for a programmable processor and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or apparatus (e.g., a magnetic disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0093] Although the present invention is disclosed as above, the scope of protection disclosed by the present invention is not limited thereto. Those skilled in the art of the present invention may make various changes and modifications without departing from the spirit and scope of the present invention, and these changes and modifications will fall within the scope of protection of the present invention.

Claims

1. A method for image recognition of ear endoscope based on DenseNet, characterized in that: The steps include: Step 1: collecting ear endoscope images and preprocessing the ear endoscope images; Step 2: Build an ear endoscope image recognition model based on DenseNet. The dense layers in the model's dense blocks are embedded with SE modules for channel weighting of feature maps. A Top-k sparse attention module is also introduced to selectively focus on important information in the image to improve computational efficiency and model performance. Step 3: Use the ear endoscope image recognition model to recognize the ear endoscope image and obtain the ear disease detection result.

2. The image recognition method for ear endoscope based on DenseNet according to claim 1, characterized in that: The preprocessing of the ear endoscope image in step 1 includes: adjusting the image size, randomly flipping the image horizontally, and randomly flipping the image vertically.

3. The image recognition method for ear endoscope based on DenseNet according to claim 1, characterized in that: The DenseNet network model includes: Top_K sparse attention module, which performs convolution and matrix operations on otoendoscopic images to extract the K features most relevant to ear diseases; Initialize the convolution layer for feature extraction of the otoendoscopic image and select the convolution operation based on the input otoendoscopic image size; Four-stage progressive Dense Block, the number of DenseLayer in the four Dense Blocks is 6, 12, 24, and 16 respectively, the number of channels of each DenseLayer is 32, and the four Dense Blocks correspond to 192, 384, 768, and 512 channels respectively; each DenseLayer includes two BN layers, two ReLU layers, and two Conv layers. The two Conv layers are 1×1 convolution and 3×3 convolution respectively, and the Dropout layer is integrated in the DenseLayer to set the Dropout rate of the training process; The DenseLayer in the Dense Block of the model is embedded with an SE module, which consists of a global average pooling layer and two fully connected layers. The global average pooling layer is used to compress the information of each channel into a scalar and extract global information. The two fully connected layers are used to learn the dependencies between channels and generate the attention weights for each channel. The transition layer includes a BN layer, a Relu layer, a Conv layer, and an average pooling layer for feature compression. The model contains three transition layers, and each transition layer reduces the number of feature maps by half. The classification module includes a global average pooling layer and a fully connected layer, which is used to perform global average pooling on the feature map output by the transition layer, compress the features after global average pooling into a one-dimensional vector, and then map it to the category label space through the fully connected layer to obtain the final classification result.

4. The image recognition method for ear endoscope based on DenseNet according to claim 3, characterized in that: The functional implementation process of the Top_K sparse attention module is as follows: For the input ear canal disease image, the input features are encoded with channel context through 1x1 convolution and depth-separable convolution: ; where x∈R B×C×H×W ; Q, K, V∈R B×C×H×W ; Where B, C, H, W are batch, channel, height, and width respectively, x is the basic embedding vector of the input ear disease image sequence, R represents the position-related rotation matrix, Q, K, and V are query, key, and value respectively, DWConv is depth-wise separable convolution, Conv 1×1 is a 1x1 convolution; Calculate the attention scores of Q and K, screen out unnecessary elements with low attention weights, and adaptively select the k features with the highest attention scores: ; where Q i is the query of the i-th row of the feature graph, K j is the key of the jth column of the feature map, d is the vector dimension, and τ is the temperature parameter; Then calculate the similarity with V, after 1x1 convolution, calculate the similarity with the initial image and output the feature result.

5. The image recognition method for ear endoscope based on DenseNet according to claim 4, characterized in that: The initialization convolution layer selects the convolution operation according to the input image size. Specifically, if the input size is smaller than a preset threshold, a 1x1 convolution kernel is used; otherwise, a 7x7 convolution kernel is used and a maximum pooling layer is added for downsampling.

6. The image recognition method for ear endoscope based on DenseNet according to claim 5, characterized in that: The gradient checkpoint strategy introduced by DenseNet includes the following steps: Divide each Dense Block of DenseNet into a "paragraph"; During forward propagation, only the checkpoint data of each Dense Block is saved, and other calculation results within the segment are directly discarded; During backpropagation, the forward calculation of the Dense Block is re-executed from the most recent checkpoint of the Dense Block, and the gradient is calculated after the intermediate results are generated; The Dropout random seed is fixed during the process to avoid inconsistent results when recalculating.

7. The image recognition method for ear endoscope based on DenseNet according to claim 6, characterized in that: The loss function of the DenseNet-based ear endoscope image recognition model adopts the cross entropy loss combined with LogSoftmax and NLLLoss, specifically: ; Where y is the true label of the sample, is the predicted probability distribution of the model output after softmax processing, and i represents the category index.

8. The image recognition method for ear endoscope based on DenseNet according to claim 7, characterized in that: During the training process of the DenseNet-based ear endoscope image recognition model, an early stopping mechanism is introduced. If the accuracy of the current validation set is greater than or equal to the best accuracy recorded previously, the best performance model is obtained.

9. An image recognition system for ear endoscope based on DenseNet, characterized in that: The system has a program module corresponding to the steps of the method described in any one of claims 1 to 8 above, and executes the steps in the above-mentioned DenseNet-based ear endoscope image recognition method when running.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is configured to implement the steps of the DenseNet-based ear endoscope image recognition method according to any one of claims 1 to 8 when called by a processor.

Citation Information

Patent Citations

  • Hyperspectral image classification method based on self-paced learning double-flow multi-scale dense connection network

    CN112733659A

  • Grape leaf disease identification method based on improved Xception algorithm

    CN115690543A

  • Mobile remote sensing image acquisition method and road maintenance monitoring method

    CN116958825A

  • Pollen image classification method based on convolutional neural network and multi-scale cavity attention fusion

    CN117496260A

  • Artificial intelligence capsule endoscopy image recognition method

    CN117974764A

Cited By

  • Muskmelon powdery mildew scab detection method and system combining text label self-prompting and soft hypergraph reasoning

    CN121686474A