An image recognition method, system, and storage medium for otoscopes based on DenseNet
By combining DenseNet with the Top_K sparse attention module and the SE module, the otoscopy image recognition model was optimized, solving the problems of recognition accuracy and computational resources, and achieving efficient and accurate otoscopy image recognition.
Patent Information
- Application Number
- CN202510869857.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2045-06-26
AI Technical Summary
Existing endoscopic image recognition models suffer from limited recognition accuracy, numerous parameters, and huge computational resource requirements, making them difficult to apply effectively, especially in resource-scarce regions.
We adopt a DenseNet-based method for endoscopic ear image recognition, combining a Top_K sparse attention module and an SE module. By selectively focusing on important information in the image, we reduce the learning of noise and irrelevant features, thereby reducing computational complexity. Furthermore, we introduce a gradient checkpoint strategy to optimize model performance.
It improves the model's recognition accuracy and generalization ability, reduces computational complexity, makes the model applicable to scenarios with limited video memory, and enhances the efficiency and accuracy of endoscopic image recognition.
Smart Images

Figure CN120726451B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing technology, and more specifically, to an image recognition method, system, and storage medium for otoscopes based on DenseNet. Background Technology
[0002] Otoscopy is the main means of diagnosing ear canal diseases. However, 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 features. Non-specialist doctors (such as pediatricians and emergency 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 technology, especially the application of machine learning and deep learning algorithms, medical image processing technology has become more intelligent. Computers can automatically learn and recognize features in medical images, improving the accuracy and efficiency of diagnosis. Existing research has applied deep learning to the classification of endoscopic ear images, such as identifying diseases like otitis media and tympanic membrane perforation. However, these models rely on high-quality labeled data and are sensitive to image noise (such as ear canal secretions obscuring images or uneven lighting), limiting their generalization ability and making 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 detection, demonstrating expert-level disease diagnostic capabilities. However, current technologies still face some challenges. CNN models have numerous parameters; the more parameters, the more computational resources (such as processor time and memory) are typically required, leading to a need for large amounts of training data and significant computational resources, which limits their practical application. Summary of the Invention
[0004] The technical problem to be solved by this invention is:
[0005] Existing endoscopic image recognition models often suffer from limited recognition accuracy, numerous parameters, and require enormous computational resources.
[0006] The technical solution adopted by the present invention to solve the above-mentioned technical problems is as follows:
[0007] This invention provides an image recognition method for otoscopes based on DenseNet, comprising the following steps:
[0008] Step 1: Acquire endoscopic images of the ear and preprocess them;
[0009] Step 2: Construct an endoscope image recognition model based on DenseNet. The dense layer in the model's dense block embeds an SE module to perform channel weighting on the feature map, and introduces a Top-k sparse attention module to improve computational efficiency and model performance by selectively focusing on important information in the image.
[0010] Step 3: Use an ear endoscope image recognition model to identify the images from the ear endoscope and obtain the ear disease detection results.
[0011] Furthermore, the preprocessing of the otoscope image in step one includes: adjusting the image size, randomly flipping the image horizontally, and randomly flipping the image vertically.
[0012] Furthermore, the DenseNet network model includes:
[0013] The Top_K sparse attention module is used to perform convolution and matrix operations on endoscopic images of the ear to extract the K features most relevant to ear diseases.
[0014] Initialize the convolutional layer to extract features from the ear endoscope image, and select the convolution operation according to the size of the input ear endoscope image;
[0015] The four-stage progressive Dense Blocks have 6, 12, 24, and 16 DenseLayers respectively, with each DenseLayer having 32 channels. Therefore, the four Dense Blocks correspond to 192, 384, 768, and 512 channels respectively. Each DenseLayer includes two Batch Normalization (BN) layers, two ReLU layers, and two Conv layers. The two Conv layers are 1×1 convolutions and 3×3 convolutions respectively. The DenseLayer also integrates a Dropout layer to set the Dropout rate during training.
[0016] The DenseLayer in the Dense Block model embeds an SE module, which contains 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, and 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, consisting of a BN layer, a ReLU layer, a Conv layer, and an average pooling layer, is used for feature compression. The model contains three transition layers, each of which halves the number of feature maps.
[0018] The classification module includes a global average pooling layer and a fully connected layer. It is used to perform global average pooling on the feature map output by the transition layer, compress the global average pooled features into a one-dimensional vector, and then map it to the class 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 image of an ear canal disease, channel context encoding is performed on the input features using 1x1 convolution and depthwise separable convolution:
[0021]
[0022] where x∈R B×C×H×W Q, K, V∈R B×C×H×W Where B, C, H, and W represent 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 the query, key, and value, respectively; DWConv is the depthwise separable convolution; and Conv... 1×1 It is a 1x1 convolution;
[0023] Calculate the attention scores for Q and K, filter out unnecessary elements with low attention weights, and adaptively select the k features with the highest attention scores:
[0024]
[0025] Q i For the query in the i-th row of the feature map, K j τ is the key in the j-th column of the feature map, d is the vector dimension, and τ is the temperature parameter;
[0026] Then calculate the similarity with V, perform a 1x1 convolution, and then calculate the similarity with the initial image to output the feature result.
[0027] Furthermore, the initial convolutional layer selects the convolution operation based on the input image size. Specifically, if the input size is less than a preset threshold, a 1x1 convolution kernel is used; otherwise, a 7×7 convolution kernel is used, and a max pooling layer is added for downsampling.
[0028] Furthermore, the DenseNet also introduces a gradient checkpointing strategy, which includes the following steps:
[0029] Divide each Dense Block of DenseNet into a "segment";
[0030] During forward propagation, only the checkpoint data of each Dense Block is saved, and other calculation results within the segment are discarded directly;
[0031] During backpropagation, the forward computation of the Dense Block is re-executed from the nearest checkpoint of the Dense Block, intermediate results are generated, and then the gradient is calculated.
[0032] A fixed Dropout random seed is used during the process to avoid inconsistent results when recalculating.
[0033] Furthermore, the loss function of the DenseNet-based endoscopic image recognition model adopts a cross-entropy loss combining LogSoftmax and NLLLoss, specifically as follows:
[0034]
[0035] In the formula, y is the true label of the sample. It is the predicted probability distribution output by the model after softmax processing, where i represents the class index.
[0036] Furthermore, during the training process of the DenseNet-based endoscopic image recognition model, 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 best performance model is obtained.
[0037] The present invention also provides an image recognition system for an otoscope based on DenseNet, the system having a program module corresponding to the steps of the method described in any of the above technical solutions, and executing the steps in the above-described image recognition method for an otoscope based on DenseNet when running.
[0038] The present invention also provides a computer-readable storage medium storing a computer program configured to, when invoked by a processor, implement the steps of the image recognition method for an otoscope based on DenseNet as described in any of the above technical solutions.
[0039] Compared with the prior art, the beneficial effects of the present invention are:
[0040] This invention builds upon the DenseNet model by adding a lightweight Top-K sparse attention module and a SE attention module. The Top-K sparse attention module focuses the model on important features, reducing the learning of noise and irrelevant features, making the learned features more robust, thereby improving the model's generalization ability, reducing the risk of overfitting, and better promoting high-quality image reconstruction. Simultaneously, it significantly reduces computational complexity while maintaining model performance. The SE attention module enhances the network's attention mechanism for channel features, dynamically adjusting the channel weights of feature maps to optimize the fusion effect of multi-layer features in dense connections, improving the model's efficiency in utilizing key features of endoscopy images and increasing the model's recognition accuracy.
[0041] This invention also solves the problem of the DenseNet network model having many layers and dense inter-layer connections, resulting in intermediate results consuming a large amount of memory, by introducing a gradient checkpoint mechanism to repeatedly calculate part of the forward process. This makes the model suitable for scenarios with limited GPU memory and has significant advantages in industrial applications.
[0042] The DenseNet network model of this 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. Attached Figure Description
[0043] Figure 1 This is a flowchart of the image recognition method for an otoscope based on DenseNet in an embodiment of the present invention;
[0044] Figure 2 This is a 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 Examples and prediction results of predicting external auditory canal masses are provided in this embodiment of the invention.
[0046] Figure 4 This is a schematic diagram of the Top_K sparse attention module in an embodiment of the present invention. Detailed Implementation
[0047] 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 in conjunction with the accompanying drawings. Obviously, the described embodiments or examples are merely some, not all, of the embodiments or examples of the present invention. All other embodiments or examples obtained by those skilled in the art based on the embodiments or examples of the present invention without inventive effort should fall within the scope of protection of the present invention.
[0048] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0049] Specific Implementation Plan 1: Combining Figure 1 As shown, this invention provides an image recognition method for otoscopes based on DenseNet, comprising the following steps:
[0050] Step 1: Acquire endoscopic images of the ear and preprocess them;
[0051] Step 2: Construct an endoscope image recognition model based on DenseNet. The dense layer in the model's dense block embeds an SE module to perform channel weighting on the feature map, and introduces a Top-k sparse attention module to improve computational efficiency and model performance by selectively focusing on important information in the image.
[0052] Step 3: Use an ear endoscope image recognition model to identify the images from the ear endoscope and obtain the ear disease detection results.
[0053] This implementation scheme uses a DenseNet-based otoscope image recognition model to identify otoscope images and obtain detection results for ear diseases (including otitis media, otitis externa, external auditory canal fungi, external auditory canal cerumen, external auditory canal masses, normal external auditory canal tympanic membrane, tympanic effusion, tympanic membrane perforation, and tympanic membrane perforation with external auditory canal fungi). The data preparation section first includes loading the dataset, defining data augmentation and preprocessing operations, and splitting the dataset into training, validation, and test sets. A cross-entropy loss function and a stochastic gradient descent (SGD) optimizer are used. The training process includes forward propagation, loss calculation, backpropagation, and optimizer update. The model performance is evaluated based on the validation and test sets to obtain the final diagnostic results.
[0054] Specific Implementation Plan Two: The preprocessing of the otoscope images described in Step One includes: adjusting the image size to 128x128. This is because the original images of ear canal diseases captured by otoscopes often have a very high resolution (1024x1024 or higher). Directly using high-resolution images for training results in a huge computational burden. Adjusting to 128x128 avoids losing too much important information due to excessively low resolution, while also avoiding wasting computational resources due to excessively high resolution. Randomly flipping the image horizontally and vertically, and randomly rotating the image by ±20 degrees, increases data diversity and enhances the model's robustness to changes in orientation. This helps the model learn orientation-independent and symmetric features. Choosing a ±20-degree rotation can simulate the otoscope entering the ear canal at different angles without causing excessive distortion of the resulting ear canal image, thus preserving the main features of the image. Converting the image to Tensor format ensures that the data format is consistent with the model's input requirements, avoiding format mismatch errors during training and preparing for subsequent standardization operations.
[0055] Specific Implementation Plan Three: (e.g.) Figure 2 and 3 As shown, the DenseNet network model includes:
[0056] The Top_K sparse attention module is used to perform convolution and matrix operations on endoscopic images of the ear to extract the K features most relevant to ear diseases.
[0057] Initialize the convolutional layer to extract features from the ear endoscope image, and select the convolution operation according to the size of the input ear endoscope image; the number of feature maps output by the initial convolutional layer is 64;
[0058] The four-stage progressive Dense Block architecture consists of four layers: the first Dense Block contains 6 DenseLayers, the second contains 12, the third contains 24, and the fourth contains 16. Each DenseLayer has 32 channels, resulting in 192, 384, 768, and 512 channels for the four blocks, respectively. Each DenseLayer includes two Batch Normalization (BN) layers, two ReLU layers, and two Conv layers. The two Conv layers are a 1×1 convolution and a 3×3 convolution, respectively. Each DenseLayer also integrates a Dropout layer to set the Dropout rate during training (for regularization, enabled only during training).
[0059] DenseLaye connects feature maps using dense connections, thereby enhancing feature propagation and reducing the number of parameters. First, the input feature map is normalized to ensure a stable distribution of features input to the 1×1 convolutional layer. A non-linear transformation is then applied to the normalized feature map to enhance its expressive power. Negative values are set to zero to make the feature map sparser, reducing computational complexity. A further 1×1 convolution reduces the number of channels in the input feature map. A second normalization, non-linear transformation, and 3×3 convolution are then performed. The 3×3 convolution extracts local features, capturing spatial information.
[0060] The DenseLayer in the Dense Block model embeds an SE module, which contains 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, and 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. Channel attention weights are established through fully connected layers. First, global adaptive average pooling is used to compress the information of each channel into a single value. Then, two fully connected layers are used to generate attention weights for each channel. Finally, the attention weights are applied to each channel to enhance the features of important channels.
[0062] The transition layer consists of a Batch Normalization (BN) layer, a ReLU layer, a Conv layer, and an average pooling layer. The role of the transition layer is feature compression. It reduces the number of channels in the feature map through 1x1 convolution, thereby reducing computational complexity and downsampling. It also reduces the spatial dimension of the feature map through average pooling, thereby extracting higher-level features.
[0063] The classification module includes a global average pooling layer and a fully connected layer. In the final step of the forward propagation, global average pooling is performed on the feature map output by the transition layer, compressing each channel of the feature map into a scalar. The pooled feature map is then flattened into a one-dimensional tensor. Finally, a fully connected layer maps the flattened features to the class label space.
[0064] The Top_K Sparse Attention module implements a sparse attention mechanism. It uses a multi-proportion Top-K selection process to filter high-value attention locations, significantly reducing computational complexity while maintaining model performance. During computation, the data undergoes a series of convolutions and matrix operations, but the height and width of the feature maps remain unchanged. Convolutions generate queries (Q), keys (K), and values (V). Q, K, and V are then split into multi-head forms and flattened into sequences. Attention scores are calculated, and Top-K filtering is applied, altering the weight distribution across the sequence dimensions without changing the spatial dimensions.
[0065] Specific Implementation Plan Four: (e.g.) Figure 4 As shown, the functional implementation process of the Top_K sparse attention module is as follows:
[0066] The Top_K sparse attention module receives an input image of an ear canal disease and performs channel context encoding on the input features through 1x1 convolution and depthwise separable convolution to generate a query (Q), key (K), and value (V) with a shape of B×3C×H×W. It is then split 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 represent 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 depthwise separable convolution; and Conv... 1×1 It is a 1x1 convolution;
[0069] Then, the similarity between Q and K is calculated:
[0070]
[0071] Q i For the query in the i-th row of the feature map, K j τ is the key in the j-th column of the feature map, d is the vector dimension, and τ is the temperature parameter;
[0072] The transposed attention matrix then masks out unnecessary elements with low attention weights. The k positions with the highest scores in each row (or column) are selected to generate a binary mask. An adaptive selection process is applied to the contribution scores, retaining the k most important components and removing useless features. k is an adjustable parameter used to dynamically control the sparsity. Through these steps, the attention matrix transforms from dense to sparse, retaining only the k largest values in each row for attention calculation. Other elements with scores less than the top-k are replaced with 0 at a given index using a scatter function, thus achieving a dynamic selection from dense to sparse.
[0073] Then calculate the similarity with V, perform a 1x1 convolution, and then calculate the similarity with the initial image to output the feature result.
[0074] Specific Implementation Scheme 5: The initialization convolutional layer selects the convolution operation based on the input image size. Specifically, if the input size is less 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 scheme, the Top_K sparse attention module adjusts the image size to 128x128, which is greater than the preset threshold, so a 7x7 convolution is performed and downsampling is performed twice, adjusting the image size from (128, 128) to (32, 32).
[0075] Specific implementation plan six: The DenseNet also introduces a gradient checkpointing strategy, including the following steps:
[0076] First, because DenseBlock blocks store the most feature maps due to their dense connectivity, a gradient checkpoint is set at this point. The second step involves checking after the transition layer: the transition layer downsamples and compresses channels, reducing the cost of recalculation. 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 endoscopic image recognition model adopts the cross-entropy loss (Cross-Entropy Loss) combining LogSoftmax and NLLLoss, specifically as follows:
[0078]
[0079] In the formula, y is the one-hot encoding of the actual label. It is the predicted probability distribution output by the model after softmax processing, where i represents the class index, y i and .
[0080] `nn.LogSoftmax` is a PyTorch module used to compute the logarithm of the softmax function of the input tensor, used in the output layer of classification tasks. `nn.NLLLoss` is a PyTorch module used to compute the negative log-likelihood loss, used for classification tasks, especially when the model's output is log-softmax. The formula for calculating `nn.LogSoftmax` is as follows:
[0081]
[0082] x i It is the i-th element of the input tensor. It is the sum of the exponents of all elements in the input tensor.
[0083] For input tensor y and target label t, the formula for calculating nn.NLLLoss is:
[0084]
[0085] Where y is the model output (log-softmax value), and t is the index of the target label. t It is the element in y that corresponds to the target tag.
[0086] Cross-entropy loss is a method for measuring the difference between two probability distributions. It is applicable to the multi-class classification problem of this invention and can directly calculate the cross-entropy loss between the model's output and the target label.
[0087] Specific Implementation Scheme Eight: During the training process of the DenseNet-based endoscopic image recognition model, precision, recall, F1 score, and accuracy are used to evaluate the model. An early stopping mechanism is introduced: if the current accuracy on the 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. Through the early stopping mechanism, the optimal accuracy and optimal validation loss are obtained, the model's performance is dynamically monitored, and training is terminated early when the validation set loss no longer decreases, preventing overfitting.
[0088] The image recognition method (algorithm) for otoscopes based on DenseNet proposed in this invention is the underlying technical core of this invention, and various products can be derived based on the algorithm.
[0089] Based on the method proposed in this invention, an image recognition system for otoscopes based on DenseNet is developed using a programming language. This system has program modules corresponding to the steps of the above-described technical solution, and executes the steps in the above-described image recognition method for otoscopes based on DenseNet when running.
[0090] The developed system (software) computer program is stored on a computer-readable storage medium, and the computer program is configured to implement the steps of the above-described DenseNet-based image recognition method for otoscopic endoscopy when called by a processor. In other words, the invention is materialized on a carrier, becoming a computer program product.
[0091] Various implementations of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, application-specific integrated circuits (ASICs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0092] The computational programs (also referred to as programs, software, software applications, or code) of this invention include machine instructions of 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., 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] While the present invention has been disclosed above, its scope of protection is not limited thereto. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, and all such changes and modifications will fall within the scope of protection of the present invention.
Claims
1. A DenseNet-based image recognition method for an otoscope, characterized in that, The method comprises the following steps: Step one, collecting ear endoscope images, and pre-processing the ear endoscope images; Step two, constructing an ear endoscope image recognition model based on DenseNet, wherein a dense layer in a dense block of the model is embedded with an SE module for channel weighting of a feature map, and a Top-k sparse attention module is introduced for selectively focusing on important information in the image to improve computational efficiency and model performance; Step three, identifying the images of the ear endoscope by using the ear endoscope image recognition model to obtain ear disease detection results; The ear endoscope image recognition model based on DenseNet comprises: A Top_K sparse attention module for performing convolution and matrix operation on the ear endoscope images to extract K features most relevant to ear diseases; An initialization convolution layer for feature extraction of the ear endoscope images and selection of convolution operation according to the size of the input ear endoscope images; A four-stage progressive Dense Block, wherein the number of DenseLayers 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 channel numbers respectively; each DenseLayer comprises two BN layers, two Relu layers and two Conv layers, the two Conv layers are 1x1 convolution and 3x3 convolution respectively, and a Dropout layer is integrated in the DenseLayer for setting the Dropout rate in the training process; The DenseLayer in the Dense Block of the model is embedded with an SE module, and the SE module comprises 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, and the two fully connected layers are used to learn the dependency between channels to generate attention weights for each channel; A transition layer comprising a BN layer, a Relu layer, a Conv layer and an average pooling layer for feature compression, wherein the model comprises three transition layers, and each transition layer halves the number of feature maps; A classification module comprising a global average pooling layer and a fully connected layer for performing global average pooling on the feature maps output by the transition layer, compressing the feature maps after the global average pooling into a one-dimensional vector, and then mapping the one-dimensional vector to a class label space through the fully connected layer to obtain the final classification result; The function implementation process of the Top_K sparse attention module is as follows: For the input ear canal disease image, the input features are subjected to channel context encoding 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, width in turn, x is the base 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 a depth separable convolution, Conv 1×1 is a 1x1 convolution; The attention scores of Q and K are calculated, unnecessary elements with low attention weights are shielded, and the k features with the highest attention scores are adaptively selected: where Q i is the query of the i-th row of the feature map, K j is the key of the j-th column of the feature map, d is the vector dimension, and τ is the temperature parameter. The similarity with V is calculated, and the similarity with the initial image is calculated after 1x1 convolution to output the feature result. 2.The Densenet-based otoscopic image recognition method of claim 1, wherein, The pre-processing of the ear endoscope images in step one comprises adjusting the image size, randomly horizontally flipping the image and randomly vertically flipping the image. 3.The Densenet-based otoscopic image recognition method of claim 2, wherein, The initialization convolutional layer selects a convolution operation according to the size of an input image, specifically: if the input size is less than a preset threshold, a 1x1 convolution kernel is used; otherwise, a 7x7 convolution kernel is used, and a max pooling layer is added for down-sampling. 4.The Densenet-based otoscopic image recognition method of claim 3, wherein, The otoscopic image recognition model based on DenseNet also introduces a gradient checkpoint strategy, including the following steps: Each Dense Block of DenseNet is divided into a "paragraph"; During forward propagation, only the checkpoint data of each Dense Block is saved, and other calculation results within the paragraph are discarded directly; During backward propagation, the forward calculation of the Dense Block is re-executed from the latest checkpoint of the Dense Block, and the gradient is calculated after the intermediate result is generated; The Dropout random seed is fixed during the process to avoid inconsistent results when re-calculating. 5.The Densenet-based otoscopic image recognition method of claim 4, wherein, The loss function of the otoscopic image recognition model based on DenseNet adopts a cross-entropy loss combined with LogSoftmax and NLLLoss, specifically: where y is the true label of the sample, is the softmax processed prediction probability distribution output by the model, i denotes the class index. 6.The Densenet-based otoscopic image recognition method of claim 5, wherein, During the training process of the otoscopic image recognition model based on DenseNet, an early stopping mechanism is introduced, and if the accuracy of the current validation set is greater than or equal to the best accuracy recorded before, the best performance model is obtained.
7. A DenseNet-based image recognition system for an otoscope, the system comprising: The system has program modules corresponding to the steps of the method of any one of claims 1-6, and when running, the steps of the otoscopic image recognition method based on DenseNet are executed.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is configured to realize the steps of the otoscopic image recognition method based on DenseNet in any one of claims 1-6 when called by the processor.
Citation Information
Patent Citations
Hyperspectral image classification method based on self-paced learning double-flow multi-scale dense connection network
CN112733659A
Mobile remote sensing image acquisition method and road maintenance monitoring method
CN116958825A