Image recognition method, device and product based on lightweight image recognition model
By introducing the Ghost module and SE attention module into the convolutional neural network, and combining them with the Mish activation function, the problems of large parameter size and inability to dynamically adjust the importance of feature channels in traditional convolutional neural networks are solved, thus achieving efficient and accurate feature extraction of a lightweight image recognition model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-03-13
AI Technical Summary
Traditional convolutional neural network models have a large number of parameters and high computational energy consumption, resulting in low operating efficiency and the inability to dynamically adjust the importance of feature channels, which limits the model's expressive power and accuracy.
The Ghost module is used to replace the standard convolutional layer. Combined with the SE attention module and the Mish activation function, feature maps are generated through linear transformation and channel weights are dynamically calibrated to enhance the ability to focus on key features.
It significantly reduces the number of model parameters and computational complexity, improves running efficiency and feature extraction accuracy, and ensures the real-time performance and accuracy of the model.
Smart Images

Figure CN121661465A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and in particular to image recognition methods, devices and products based on lightweight image recognition models. Background Technology
[0002] In traditional machine learning algorithms, analyzing object contours plays a positive role in classification and diagnosis. In recent years, deep learning has made breakthrough progress in the field of image processing. Among them, convolutional neural networks (CNNs), with their "end-to-end" learning mode, have shown significant advantages in image classification tasks and have gradually replaced traditional methods that rely on manual feature design.
[0003] However, as the number of network layers increases and the model complexity rises, the number of model parameters and the size of weight files in convolutional neural networks increase significantly. This leads to frequent memory accesses and increased computational energy consumption during inference, thus affecting the model's running efficiency and real-time performance. Secondly, convolutional neural networks typically treat all channels or feature regions equally during feature extraction, lacking the ability to adaptively focus on key information and dynamically adjust the importance of feature channels. This limits further improvement in the model's expressive power, resulting in a significant reduction in the accuracy of the model's output. Summary of the Invention
[0004] In view of this, exemplary embodiments of the present disclosure provide an image recognition method, device, and product based on a lightweight image recognition model to solve the problems existing in the related art.
[0005] One aspect of an exemplary embodiment of this disclosure provides an image recognition method based on a lightweight image recognition model, the method comprising: Obtain the image to be processed; The image to be processed is input into a pre-trained image recognition model to obtain the image recognition result corresponding to the image to be processed. The image recognition model is built based on a residual network architecture, and a Ghost module and an SE attention module are introduced sequentially in at least one residual unit. The Ghost module is used to generate an output feature map with the same number of channels as the standard convolution through linear transformation. The SE attention module is connected to the output of the Ghost module and is used to adaptively calibrate the channel weights of the output feature map.
[0006] In another aspect of exemplary embodiments of this disclosure, an image recognition apparatus based on a lightweight image recognition model is provided, the apparatus comprising: The data acquisition module is used to acquire the image to be processed; A data processing module is used to input the image to be processed into a pre-trained image recognition model to obtain the image recognition result corresponding to the image to be processed; wherein, the image recognition model is constructed based on a residual network architecture, and a Ghost module and an SE attention module are sequentially introduced into at least one residual unit; the Ghost module is used to generate an output feature map with the same number of channels as a standard convolution through linear transformation; the SE attention module is connected to the output of the Ghost module, and the SE attention module is used to adaptively calibrate the channel weights of the output feature map.
[0007] In another aspect of exemplary embodiments of this disclosure, a computer device is provided, including a memory, a processor, and a computer program stored in the memory, the processor executing the computer program to implement the methods described in exemplary embodiments of this disclosure.
[0008] In another aspect of exemplary embodiments of this disclosure, a computer-readable storage medium is provided having a computer program / instructions stored thereon that, when executed by a processor, implements the methods described in exemplary embodiments of this disclosure.
[0009] In another aspect of exemplary embodiments of this disclosure, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the methods described in exemplary embodiments of this disclosure.
[0010] As will be described in detail below, an image recognition method based on a lightweight image recognition model according to an embodiment of the present disclosure involves acquiring an image to be processed; inputting the image to be processed into a pre-trained image recognition model to obtain an image recognition result corresponding to the image to be processed; wherein, the image recognition model is constructed based on a residual network architecture, and a Ghost module and an SE attention module are sequentially introduced into at least one residual unit; the Ghost module is used to generate an output feature map with the same number of channels as a standard convolution through linear transformation; the SE attention module is connected to the output of the Ghost module, and the SE attention module is used to adaptively calibrate the channel weights of the output feature map.
[0011] Therefore, the method provided in this disclosure introduces a Ghost module to replace the standard convolutional layer in the original residual unit, decomposing the single convolutional computation into two steps: generating a small number of feature maps and expanding multiple ghost feature maps. The Ghost module, through its generation-expansion mechanism, enables the network to generate feature maps with the exact same number of channels as the standard convolutional layer with fewer parameters and less computational complexity. This effectively solves the technical problems of large memory access, high energy consumption, slow running speed, and poor real-time performance caused by the large weight files in traditional convolutional neural networks.
[0012] Furthermore, an SE attention module is introduced in series after the Ghost module. By performing compression and activation operations on the feature map output by the Ghost module, the weights of each feature channel are dynamically learned and calibrated. This enables the network to adaptively enhance key features and suppress useless or noisy features based on global information. This precisely solves the technical problem that traditional neural networks cannot dynamically adjust the importance of feature channels during feature extraction, resulting in limited model expressive power and insufficient discriminative feature extraction. Attached Figure Description
[0013] The above and other objects, features, and advantages of this disclosure will become more apparent from the more detailed description of the embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0014] Figure 1 A flowchart illustrating the principle of an image recognition method based on a lightweight image recognition model provided in this embodiment of the disclosure; Figure 2 This is a schematic diagram of the Ghost module structure provided in an embodiment of the present disclosure; Figure 3 This is a schematic diagram of the SE attention module structure provided in an embodiment of this disclosure; Figure 4 This is a schematic diagram of the network structure of the SE attention module provided in an embodiment of this disclosure; Figure 5 This is a schematic diagram illustrating the ReLU function behavior provided in an embodiment of this disclosure; Figure 6 This is a schematic diagram of the Mish activation function provided in an embodiment of the present disclosure; Figure 7 A schematic block diagram of the functional modules of an image recognition device based on a lightweight image recognition model provided in the embodiments of this disclosure; Figure 8 A structural block diagram of an electronic device provided in an embodiment of this disclosure; Figure 9 A schematic diagram of a computer program product provided in an embodiment of this disclosure. Detailed Implementation
[0015] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0016] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0017] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc., used in this disclosure are only used to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.
[0018] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0019] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0020] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0021] In traditional machine learning algorithms, analyzing object contours plays a positive role in classification and diagnosis. In recent years, deep learning has made groundbreaking progress in the field of image processing, especially convolutional neural networks (CNNs), which, with their "end-to-end" learning model, have shown significant advantages in image classification tasks and have gradually replaced traditional methods that rely on manual feature design.
[0022] However, as the number of network layers and the complexity of the model increase, the number of model parameters and the size of the weight file in convolutional neural networks increase significantly. This leads to frequent memory access and increased computational energy consumption during inference, thus affecting the model's running efficiency and real-time performance. Secondly, convolutional neural networks typically treat all channels or feature regions equally during feature extraction, lacking the ability to adaptively focus on key information and dynamically adjust the importance of feature channels, thus limiting further improvement in the model's expressive power. Furthermore, although ReLU, as a widely used activation function in mainstream network architectures, alleviates the gradient vanishing problem to some extent, its output is always zero in the negative region, causing some neurons to fail and resulting in the loss of feature information, further restricting the improvement of model classification accuracy.
[0023] Therefore, to address the aforementioned issues, this exemplary embodiment provides an image recognition method based on a lightweight image recognition model. First, a Ghost module is used to replace the standard convolutional module. Utilizing the linear transformation mechanism of the Ghost module, rich feature maps are generated while significantly reducing the number of parameters, thus achieving model lightweighting from the outset. Furthermore, a Squeeze-and-Excitation (SE) attention mechanism is introduced. By dynamically calibrating the weights of feature channels, the network can adaptively strengthen key information and suppress redundant features, thereby improving the model's expressive power. Finally, the Mish activation function is used instead of the ReLU function, effectively alleviating the problem of neuron failure in the negative interval, ensuring the complete transmission of feature information, and guaranteeing the model's accuracy and training stability.
[0024] For example, Figure 1 A flowchart illustrating the principle of the image recognition method based on a lightweight image recognition model provided in this disclosure is shown below. Figure 1 As shown, the specific steps may include: Step S110: Obtain the image to be processed.
[0025] Step S120: Input the image to be processed into a pre-trained image recognition model to obtain the image recognition result corresponding to the image to be processed. The image recognition model is built based on a residual network architecture, and a Ghost module and an SE attention module are sequentially introduced into at least one residual unit. The Ghost module is used to generate an output feature map with the same number of channels as a standard convolution through linear transformation. The SE attention module is connected to the output of the Ghost module and is used to adaptively calibrate the channel weights of the output feature map.
[0026] In this embodiment, the image to be processed includes one or more target objects to be identified.
[0027] The image to be processed is input into a pre-trained image recognition model to obtain the image recognition result corresponding to the target object in the image to be processed.
[0028] The image recognition model uses a residual network as its basic framework, and integrates a Ghost module and an SE attention module sequentially in at least one core residual unit.
[0029] Specifically, the Ghost module is used to replace the original standard convolutional layer of the residual network. Instead of generating all feature maps at once, the standard convolutional layer adopts a two-stage generation strategy. The final output feature map has the same number of channels as the feature map generated by the standard convolution, which significantly reduces the number of model parameters and computational complexity, and solves the problem of the model being bulky and difficult to run in real time.
[0030] The two-stage generation strategy consists of two phases: First, a relatively low-computation conventional convolution is used to generate a small number of highly representative initial feature maps. Second, a series of low-cost linear operations are used to transform and expand these initial feature maps, generating ghosting feature maps. Finally, the original feature maps and the ghosting feature maps are concatenated to obtain an output feature map with the exact same number of channels as a standard convolutional layer.
[0031] Furthermore, the output of the Ghost module is connected to the SE attention module. The SE attention module dynamically learns the importance weight of each feature channel through a compression-excitation mechanism and adaptively calibrates the feature map accordingly, thereby enhancing the network's ability to focus on key features and improving the model's expressive power and discrimination accuracy.
[0032] Based on this, by introducing the Ghost module to replace the standard convolutional layer in the original residual unit, the single convolutional computation is decomposed into two steps: generating a small number of feature maps and expanding multiple ghost feature maps. With its generation-expansion mechanism, the Ghost module enables the network to generate feature maps with the exact same number of channels as the standard convolutional layer with fewer parameters and less computational complexity. This effectively solves the technical problems of large memory access, high energy consumption, slow running speed, and poor real-time performance caused by the large weight files in traditional convolutional neural networks.
[0033] Furthermore, an SE attention module is introduced in series after the Ghost module. By performing compression and activation operations on the feature map output by the Ghost module, the weights of each feature channel are dynamically learned and calibrated. This enables the network to adaptively enhance key features and suppress useless or noisy features based on global information. This precisely solves the technical problem that traditional neural networks cannot dynamically adjust the importance of feature channels during feature extraction, resulting in limited model expressive power and insufficient discriminative feature extraction.
[0034] Based on the above embodiments, in another embodiment provided in this disclosure, the network structure of the above image recognition model includes: a first convolutional layer, a feature extraction layer group, and an output layer; The first convolutional layer includes the Mish activation function and a max pooling layer; The feature extraction layer group includes multiple feature extraction layers, each of which includes a feature extraction module. The feature extraction module includes a Ghost module, an SE attention module, and a Mish activation function. The output layer consists of a global average pooling layer, a fully connected layer, and a Softmax classifier.
[0035] In this embodiment, the lightweight image recognition model uses a deep residual network as its basic framework and introduces a Ghost module, SE attention mechanism, and Mish activation function, which significantly reduces computational complexity while ensuring feature extraction capabilities.
[0036] For example, Table 1 shows the network architecture of a lightweight image recognition model: Table 1 Network Architecture of Lightweight Image Recognition Model
[0037] As shown in Table 1, the model input first passes through a first convolutional layer consisting of a 7×7 convolution and a 3×3 max pooling. The first convolutional layer uses the Mish activation function to initially extract low-level features of the image while enhancing nonlinear expressive power.
[0038] The feature extraction layer group consists of four progressive layers (Conv2_x to Conv5_x), each using an improved feature extraction module as its basic building block. This module includes a Ghost module, an SE attention module, and a Mish activation function. This design allows the network to progressively increase feature diversity at deeper layers, while controlling computational costs through the parameter efficiency of the Ghost module. Each Ghost module is followed by a Mish activation function to ensure the network's non-linear modeling capability.
[0039] At the end of each layer, we introduce an SE attention module. This module dynamically calibrates the weights of each feature channel through a compression-excitation mechanism, enabling the network to autonomously enhance important features and suppress redundant information, significantly improving the quality of feature representation.
[0040] Specifically, taking the Conv2_x layer as an example, the complete processing chain that a data sample goes through when passing through the entire Conv2_x layer can be represented as: input data → [Ghost → Ghost → SE → Mish] → [Ghost → Ghost → SE → Mish] → [Ghost → Ghost → SE → Mish] → output data.
[0041] The output layer uses a global average pooling layer (avgpool) instead of a traditional fully connected layer, transforming spatial features into channel feature vectors, which significantly reduces the number of model parameters. Finally, a fully connected layer (FC) and a Softmax classifier are used to output the class probability distribution.
[0042] Based on this, the above architecture achieves a balance between accuracy and efficiency through the parameter efficiency of the Ghost module, the feature intelligent calibration of the SE module, and the gradient optimization of the Mish activation function, making it particularly suitable for deployment on resource-constrained mobile devices.
[0043] Based on the above embodiments, in another embodiment provided in this disclosure, the Ghost module is used to generate an output feature map with the same number of channels as the standard convolution through linear transformation, and may include: Perform a convolution operation on the input feature map to generate m initial feature maps; where m Less than n , n Indicates the number of target output feature maps; right m Each initial feature map is processed separately. s Different linear operations generate m × s One-image feature map; Will m The initial feature map is concatenated with the ghosting feature map to generate the output feature map.
[0044] In this embodiment, the Ghost module is used as the convolution module. Through the two-stage generation-expansion mechanism, the parameters and computational complexity of the model are significantly reduced while ensuring that the number of output channels of the feature map remains unchanged.
[0045] Specifically, the execution flow of the Ghost module can be divided into two stages. In the first stage, the module first uses convolution operations to compress the input feature map, generating a small amount of... m (1) original feature map with basic representativeness. This stage can be represented as: (1) in, Y'∈R ( h',w',m () represents the output after the convolution operation. m One original feature map; f'∈R ( c,k,k,m () represents the convolution kernel used in regular convolution operations, and the number of output channels. m <n This simplifies the bias term.
[0046] The second stage aims to further obtain a number of layers equivalent to those in a standard convolutional layer.n The Ghost module generates one output feature map from the first stage. m Linear operations are performed on each of the original feature maps to generate a result for each original feature map. s One feature is double image.
[0047] For example, linear operations can be depthwise separable convolutions or affine transformations. Linear operations spatially transform and enrich the original features with minimal computational cost, thereby deriving diverse feature representations.
[0048] This stage can be represented as: (2) in, express Y’ The first in i One original feature map; Indicates the first j The nth linear operation is used to generate the nth linear operation. j Ghosting of feature maps .
[0049] Finally, the first stage generated m The original feature map and the one generated by the second stage through linear transformation m × s The ghosting feature maps are stitched together along the channel dimension to form the final output of the module.
[0050] For example, Figure 2 This is a schematic diagram of the Ghost module structure provided in an embodiment of this disclosure, as shown below. Figure 2 As shown, the Ghost module's processing flow consists of two stages: First, a standard convolution operation generates a partial original feature map. Then, a linear transformation is used to further derive multiple ghosting feature maps. Finally, the outputs of the two stages are concatenated along the channel dimension to form the module's complete output.
[0051] Based on this, the Ghost module, with its generation-expansion mechanism, can significantly reduce the parameters and computational load required by the model while keeping the number of output channels constant.
[0052] Based on the above embodiments, in another embodiment provided in this disclosure, the SE attention module is used to adaptively calibrate the channel weights of the feature map, and may include: The output feature map is subjected to global average pooling to generate a compressed feature vector; The compressed feature vector is input into the channel weight generation module to generate the weight coefficients for each channel. The weighting coefficients are multiplied channel by channel with the output feature map to obtain the adaptively calibrated target feature map.
[0053] In this embodiment, to address the limitation of convolutional neural networks in treating all channels or feature regions equally during feature extraction, an SE (Squeeze-and-Excitation) attention mechanism is introduced. The SE attention mechanism dynamically models the dependencies between channels, enabling the network to adaptively calibrate feature responses. Based on global information, it selectively enhances valuable feature channels and suppresses useless feature channels, thereby significantly improving the model's expressive power.
[0054] The SE attention mechanism consists of two phases: Squeeze and Excitation.
[0055] During the compression phase, the module performs global average pooling on the feature mapping layer, compressing the two-dimensional feature map of each channel into a single scalar. This operation aggregates the global spatial information of that channel, transforming each channel into a statistic representing its global response, thus obtaining a compressed feature vector corresponding to the number of channels.
[0056] During the excitation phase, the compressed feature vector is input into a channel weight generation module to generate weight coefficients for each channel.
[0057] For example, Figure 3 This is a schematic diagram of the SE attention module structure provided in an embodiment of this disclosure, as shown below. Figure 3 As shown, the output feature map X (size X) will be... W’ × H’ × C’ Using this as input data, a convolution operation is performed. F tr The feature map U (with dimensions W×H×C) is obtained. Then, a compression operation is performed. F sq ( The two-dimensional spatial features of each channel are compressed into a single global feature value, resulting in a 1×1× C The channel description vector. Then, through activation operations. F ex ( , W Learn the weights of each channel and generate a weight vector of the same dimension (size 1×1×). C Finally, through scaling operations... F scale ( , The learned channel weights are multiplied channel by channel with the original feature map U to achieve adaptive weighting for different feature channels, and finally the calibrated feature map is output. .
[0058] For example, Figure 4 This is a schematic diagram of the network structure of the SE attention module provided in an embodiment of this disclosure, as shown below. Figure 4 As shown, the input feature map is processed by residual convolution in the main branch and then fed into a parallel attention branch. This branch first aggregates global spatial information through a global pooling layer, and then passes through a bottleneck structure consisting of two fully connected layers (FC). The first FC layer is followed by a ReLU activation function, and the second FC layer is followed by a Sigmoid function to generate weight vectors representing the importance of each channel. Finally, the weight vectors are multiplied channel-by-channel by the original main branch output through a scaling operation to achieve adaptive calibration of the feature channels. The calibrated features are then added to the input of the residual connection to form the final output of the module.
[0059] Based on this, by performing channel-by-channel multiplication on the learned channel weights and the original input feature map, intelligent weighting of the feature map is achieved. The network automatically enhances information-rich key feature channels while suppressing channels with less information or irrelevant information. This dynamic feature optimization mechanism enables the model to focus on more discriminative information, thereby effectively improving the network's representation ability and final recognition accuracy without significantly increasing computational costs.
[0060] Based on the above embodiments, in another embodiment provided in this disclosure, the channel weight generation module includes a fully connected layer, wherein the first fully connected layer is used to perform dimensionality reduction processing on the compressed feature vector, and the second fully connected layer is used to restore the dimensionality-reduced compressed feature vector to the original channel dimension, and perform normalization processing through an activation function to generate weight coefficients corresponding to each channel.
[0061] In this embodiment, the channel weight generation module can be a bottleneck structure consisting of two fully connected layers. The first fully connected layer acts as a dimensionality reducer, decreasing the number of channels through a reduction ratio, thereby reducing model complexity and enhancing nonlinearity. The second fully connected layer is responsible for restoring the dimensionality to the original number of channels. Then, a normalized weight between 0 and 1 is generated for each channel using a sigmoid activation function. The magnitude of the normalized weight directly reflects the importance of the feature information contained in the corresponding channel. The weighted feature map is then used as the input data for the next layer of the network.
[0062] Based on the above embodiments, in another embodiment provided in this disclosure, the image recognition method based on the lightweight image recognition model further includes: The image recognition model uses the Mish activation function as a non-linear activation function; the expression for the Mish activation function is: .
[0063] In this embodiment, while the ReLU function is widely used due to its stable gradient in the positive interval, it has a significant drawback in the negative interval. Specifically, when the input value is negative, the ReLU output is forced to zero, and the corresponding gradient is also zero. This means that once a neuron falls into a negative activation state during training, its weights cannot be updated using gradient descent, resulting in the neuron permanently failing. This not only reduces the number of neurons participating in effective computation and lowers the model capacity, but also causes the complete loss of feature information in the negative interval, ultimately affecting the model's convergence and classification accuracy.
[0064] The ReLU function can be represented as: (3) For example, Figure 5 This is a schematic diagram illustrating the ReLU function as provided in an embodiment of this disclosure.
[0065] To address the neuron death problem caused by the ReLU activation function outputting zero in the negative region, this embodiment uses the Mish activation function as an alternative to ReLU, thereby enhancing the model's nonlinear expressiveness and gradient flow.
[0066] In contrast, the Mish activation function does not forcibly truncate to zero in the negative range, but rather allows a small and smooth negative output. This ensures that negative information continues to be passed to later layers of the network, fundamentally avoiding the problem of neuron failure. Secondly, Mish is a continuous and smooth function with superior gradient properties across the entire range. This helps gradients flow more stably and efficiently in deep networks, thus mitigating the problems of vanishing or exploding gradients.
[0067] The Mish activation function can be expressed as: (4) For example, Figure 6 This is a schematic diagram illustrating the behavior of the Mish activation function provided in an embodiment of this disclosure.
[0068] Therefore, using the Mish function instead of ReLU can significantly improve the network's ability to learn features, especially negative features, while retaining the advantages of ReLU, enhancing the model's nonlinear fitting effect and the stability of the training process, thereby improving the model's overall performance in complex image recognition tasks.
[0069] In this embodiment, after constructing the image recognition model, a lightweight image recognition model is trained using a training dataset. Once the model has converged and training is complete, it is saved. Saving the model includes persistently storing key information such as the learned network architecture, optimized weight parameters, and training configuration to a non-volatile medium such as a hard disk, forming an independent model file.
[0070] This model file can include all the knowledge the network has learned from the data, enabling it to operate independently as a complete prediction system even after being removed from the training environment. In practical applications, simply loading this model file allows for fast forward propagation inference on new, unprocessed images, outputting the probability distribution of their respective categories, thereby completing the image classification task.
[0071] One or more technical solutions provided in the exemplary embodiments of this disclosure replace standard convolutional modules with Ghost modules. Utilizing the linear transformation mechanism of Ghost modules, they generate rich feature maps while significantly reducing the number of parameters, thus achieving model lightweighting from the source. Furthermore, an SE (Squeeze-and-Excitation) attention mechanism is introduced. By dynamically calibrating the weights of feature channels, the network can adaptively strengthen key information and suppress redundant features, thereby improving the model's expressive power. Finally, the Mish activation function is used instead of the ReLU function, effectively alleviating the problem of neuron failure in the negative interval, ensuring the complete transmission of feature information, and guaranteeing the model's accuracy and training stability.
[0072] Therefore, the image recognition method based on a lightweight image recognition model provided in the exemplary embodiments of this disclosure not only greatly improves the model's running efficiency and expressive power, but also ensures the accuracy of the model's output results.
[0073] The foregoing primarily describes the solutions provided by exemplary embodiments of this disclosure. It is understood that, in order to achieve the above functions, the electronic device includes corresponding hardware structures and / or software modules for performing each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.
[0074] The exemplary embodiments of this disclosure can divide the electronic device into functional units according to the above method examples. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into a single processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in the exemplary embodiments of this disclosure is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0075] In the case of dividing each function into different modules, an exemplary embodiment of this disclosure provides an image recognition device based on a lightweight image recognition model, which can be a server or a chip applied to a server. Figure 7 This is a schematic block diagram illustrating the functional modules of an image recognition device based on a lightweight image recognition model, provided in an embodiment of this disclosure. Figure 7 As shown, the image recognition device 700 based on a lightweight image recognition model includes: Data acquisition module 710 is used to acquire the image to be processed; The data processing module 720 is used to input the image to be processed into a pre-trained image recognition model to obtain the image recognition result corresponding to the image to be processed; wherein, the image recognition model is constructed based on a residual network architecture, and a Ghost module and an SE attention module are sequentially introduced into at least one residual unit; the Ghost module is used to generate an output feature map with the same number of channels as a standard convolution through linear transformation; the SE attention module is connected to the output of the Ghost module, and the SE attention module is used to adaptively calibrate the channel weights of the output feature map.
[0076] In another embodiment provided in this disclosure, the data processing module 720 further includes the network structure of the image recognition model, comprising: a first convolutional layer, a feature extraction layer group, and an output layer; wherein the first convolutional layer includes a Mish activation function and a max pooling layer; the feature extraction layer group includes multiple feature extraction layers, each feature extraction layer including a feature extraction module, which includes a Ghost module, an SE attention module, and a Mish activation function; and the output layer includes a global average pooling layer, a fully connected layer, and a Softmax classifier.
[0077] In another embodiment provided in this disclosure, the data processing module 720 is further configured to perform a convolution operation on the input feature map to generate m initial feature maps; where m Less than n , n Indicates the number of target output feature maps; for the mEach initial feature map is processed separately. s Different linear operations generate m × s Each ghosting feature map; the aforementioned m The initial feature map is concatenated with the ghosting feature map to generate the output feature map.
[0078] In another embodiment provided in this disclosure, the data processing module 720 is further configured to perform global average pooling on the output feature map to generate a compressed feature vector; input the compressed feature vector into the channel weight generation module to generate weight coefficients corresponding to each channel; and multiply the weight coefficients with the output feature map channel by channel to obtain the adaptively calibrated target feature map.
[0079] In another embodiment provided in this disclosure, the data processing module 720 further includes: the channel weight generation module includes a fully connected layer, wherein the first fully connected layer is used to perform dimensionality reduction processing on the compressed feature vector, and the second fully connected layer is used to restore the dimensionality-reduced compressed feature vector to the original channel dimension and perform normalization processing through an activation function to generate weight coefficients corresponding to each channel.
[0080] In another embodiment provided in this disclosure, the data processing module 720 is further configured to use the Mish activation function as a non-linear activation function in the image recognition model; the expression of the Mish activation function is: .
[0081] Exemplary embodiments of this disclosure also provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to cause the electronic device to perform a method according to an embodiment of this disclosure.
[0082] Exemplary embodiments of this disclosure also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a computer's processor, is used to cause the computer to perform a method according to embodiments of this disclosure.
[0083] Figure 8The structural block diagram of the electronic device provided in the embodiments of this disclosure will now be described as follows: An electronic device 800 that can serve as a server or client of this disclosure is an example of a hardware device that can be applied to various aspects of this disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the disclosure described and / or claimed herein.
[0084] like Figure 8 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 may also store various programs and data required for the operation of the electronic device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0085] Multiple components in electronic device 800 are connected to I / O interface 805, including: input unit 806, output unit 807, storage unit 808, and communication unit 809. Input unit 806 can be any type of device capable of inputting information to electronic device 800. Input unit 806 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device. Output unit 807 can be any type of device capable of presenting information and may include, but is not limited to, a display, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 808 may include, but is not limited to, disks and optical discs. Communication unit 809 allows electronic device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and / or chipsets, such as Bluetooth™ devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.
[0086] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above. The various methods described above can all be implemented as computer software programs, which are tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809.
[0087] Figure 9 The diagram illustrates a computer program product provided in an embodiment of this disclosure. An exemplary embodiment of this disclosure also provides a computer program product 900, including a computer program 901, wherein the computer program 901, when executed by a computer's processor, is used to cause the computer to perform a method according to an embodiment of this disclosure.
[0088] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0089] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0090] As used in this disclosure, 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.
[0091] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0092] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0093] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.
[0094] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this disclosure are performed, in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a terminal, a user equipment, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center integrating one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc (DVD); or it can be a semiconductor medium, such as a solid-state drive (SSD).
[0095] Although this disclosure has been described in conjunction with specific features and embodiments, it will be apparent that various modifications and combinations can be made therein without departing from the spirit and scope of this disclosure. Accordingly, this specification and drawings are merely exemplary illustrations of the disclosure as defined by the appended claims and are to be considered as covering any and all modifications, variations, combinations, or equivalents within the scope of this disclosure. It is obvious that those skilled in the art can make various alterations and modifications to this disclosure without departing from its spirit and scope. Thus, this disclosure is also intended to include any such modifications and modifications that fall within the scope of the claims of this disclosure and their equivalents.
Claims
1. An image recognition method based on a lightweight image recognition model, characterized in that, The method includes: Obtain the image to be processed; The image to be processed is input into a pre-trained image recognition model to obtain the image recognition result corresponding to the image to be processed. The image recognition model is built based on a residual network architecture, and a Ghost module and an SE attention module are introduced sequentially in at least one residual unit. The Ghost module is used to generate an output feature map with the same number of channels as the standard convolution through linear transformation. The SE attention module is connected to the output of the Ghost module and is used to adaptively calibrate the channel weights of the output feature map.
2. The method according to claim 1, characterized in that, The network structure of the image recognition model includes: a first convolutional layer, a feature extraction layer group, and an output layer; The first convolutional layer includes the Mish activation function and a max pooling layer; The feature extraction layer group includes multiple feature extraction layers, each of which includes a feature extraction module. The feature extraction module includes a Ghost module, an SE attention module, and a Mish activation function. The output layer consists of a global average pooling layer, a fully connected layer, and a Softmax classifier.
3. The method according to claim 1, characterized in that, The Ghost module is used to generate an output feature map with the same number of channels as standard convolution through linear transformation, including: Perform a convolution operation on the input feature map to generate m initial feature maps; where m Less than n , n Indicates the number of target output feature maps; Regarding the m Each initial feature map is processed separately. s Different linear operations generate m × s One-image feature map; The m The initial feature map is concatenated with the ghosting feature map to generate the output feature map.
4. The method according to claim 1, characterized in that, The SE attention module is used to adaptively calibrate the channel weights of the feature map, including: The output feature map is subjected to global average pooling to generate a compressed feature vector; The compressed feature vector is input into the channel weight generation module to generate weight coefficients for each channel. The weighting coefficients are multiplied channel by channel with the output feature map to obtain the adaptively calibrated target feature map.
5. The method according to claim 4, characterized in that, The channel weight generation module includes a fully connected layer, wherein the first fully connected layer is used to perform dimensionality reduction processing on the compressed feature vector, and the second fully connected layer is used to restore the dimensionality-reduced compressed feature vector to the original channel dimension and perform normalization processing through an activation function to generate the weight coefficients corresponding to each channel.
6. The method according to claim 1, characterized in that, The method further includes: The image recognition model uses the Mish activation function as a non-linear activation function; the expression for the Mish activation function is: .
7. An image recognition device based on a lightweight image recognition model, characterized in that, The device includes: The data acquisition module is used to acquire the image to be processed; A data processing module is used to input the image to be processed into a pre-trained image recognition model to obtain the image recognition result corresponding to the image to be processed; wherein, the image recognition model is constructed based on a residual network architecture, and a Ghost module and an SE attention module are sequentially introduced into at least one residual unit; the Ghost module is used to generate an output feature map with the same number of channels as a standard convolution through linear transformation; the SE attention module is connected to the output of the Ghost module, and the SE attention module is used to adaptively calibrate the channel weights of the output feature map.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method of claim 1.
9. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instruction is executed by the processor, it implements the method of claim 1.
10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the method of claim 1.
Citation Information
Patent Citations
Image classification method and device based on improved residual network, and storage medium
CN114782737A
Construction method of lightweight model for low-resolution algae image recognition
CN115063783A
Lightweight facial expression recognition method and system based on attention mechanism
CN115527253A
Gene mutation prediction method under cooperative driving of residual network and channel attention
CN116703867A
Power station equipment defect identification method and related equipment
CN117173148A