Image classification method and device, storage medium and program product

By introducing the partition channel attention module into the image classification model, and using the global average pooling and global maximum pooling algorithms to partition the feature map, the problem of low image classification accuracy is solved, and classification accuracy and model performance are improved.

CN118968175APending Publication Date: 2024-11-15PICC INFORMATION TECH CO LTD

Patent Information

Application Number
CN202411099530.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

The existing image classification model has low accuracy in image classification tasks, especially because the global average pooling algorithm cannot effectively highlight the prominent features and edges in the image, resulting in inaccurate classification results.

Method used

By introducing the partition channel attention module in the image classification model, the initial feature map is divided into multiple partitions, and each partition is aggregated and activated by using global average pooling and global maximum pooling algorithms to generate a new feature map , to enhance the number of channel features and highlight the distinctive features.

Benefits of technology

It improves the accuracy of image classification and model performance, enhances the understanding and classification performance of image content, and reduces the risk of error and misjudgment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118968175A_ABST
    Figure CN118968175A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an image classification method and device, a storage medium and a program product, and the method comprises the steps: obtaining a to-be-classified image, inputting the to-be-classified image into an image classification model, and obtaining a classification result of the to-be-classified image, the image classification model comprises a partition channel attention module, the image classification model is used for carrying out feature extraction on the to-be-classified image to obtain an initial feature map, and is also used for segmenting the initial feature map into a plurality of partitions through the partition channel attention module, and carrying out aggregation and activation on each partition based on a global average pooling algorithm and a global maximum pooling algorithm to obtain an initial feature map; and obtaining a new feature map corresponding to the initial feature map. According to the image classification method provided by the embodiment of the invention, the classification accuracy and the model performance are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to an image classification method, device, storage medium and program product. Background Art

[0002] Attention Mechanism is a key technology in the field of deep learning. In image classification tasks, the application of attention mechanism helps to improve the performance of image classification models based on deep learning.

[0003] In related technologies, when a channel attention mechanism is used, a global average pooling operation is usually performed on the input feature map to obtain the weight.

[0004] However, in the process of implementing the present application, the inventors found that there are at least the following problems in the prior art: in the existing method, the accuracy of image classification is low. Summary of the invention

[0005] The embodiments of the present application provide an image classification method, device, storage medium and program product to improve the accuracy of image classification.

[0006] In a first aspect, an embodiment of the present application provides an image classification method, comprising:

[0007] Get the image to be classified;

[0008] The image to be classified is input into an image classification model to obtain a classification result of the image to be classified; wherein the image classification model includes a partitioned channel attention module; the image classification model is used to extract features of the image to be classified to obtain an initial feature map; and is also used to divide the initial feature map into multiple partitions through the partitioned channel attention module; and each partition is aggregated and activated based on a global average pooling algorithm and a global maximum pooling algorithm to obtain a new feature map corresponding to the initial feature map.

[0009] In a possible design, the initial feature map includes the number of channels, width, and height; and dividing the initial feature map into a plurality of partitions includes:

[0010] The initial feature map is divided along width and / or height to obtain multiple partitions; the number of channels of each partition is the same as the number of channels of the initial feature map.

[0011] In a possible design, aggregating and activating the partitions based on a global average pooling algorithm and a global maximum pooling algorithm to obtain a new feature map corresponding to the partition includes:

[0012] For the sub-feature map under each channel of each partition, the sub-feature map is aggregated and activated based on the global average pooling algorithm to obtain a first weight, the sub-feature map is aggregated and activated based on the global maximum pooling algorithm to obtain a second weight, and the first weight and the second weight are fused to obtain a target weight of the sub-feature map;

[0013] A new feature map corresponding to the initial feature map is generated according to the initial feature map and the target weights of the multiple channels of the multiple partitions.

[0014] In a possible design, aggregating and activating the sub-feature maps based on a global average pooling algorithm to obtain a first weight includes:

[0015] Performing global average pooling on the sub-feature map to obtain a first global spatial feature corresponding to the sub-feature map; performing excitation on the first global spatial feature to obtain a first weight of the sub-feature map;

[0016] The aggregating and activating the sub-feature maps based on the global maximum pooling algorithm to obtain the second weight includes:

[0017] For the sub-feature map under each channel of each partition, global maximum pooling is performed on the sub-feature map to obtain a second global spatial feature corresponding to the sub-feature map; and the second global spatial feature is stimulated to obtain a second weight of the sub-feature map.

[0018] In a possible design, before inputting the image to be classified into the image classification model to obtain the classification result of the image to be classified, the method further includes:

[0019] Obtain multiple historical images to be classified and construct a sample set;

[0020] Performing category labeling on each historical image to be classified in the sample set to obtain a labeled sample set;

[0021] Dividing the labeled sample set into a training set and a validation set;

[0022] The neural network model is trained based on the training set to obtain an initial classification model; the neural network model includes a partitioned channel attention module; wherein, during the training process, the partitioned channel attention module is used to divide the training feature map corresponding to the input sample into multiple partitions; based on the global average pooling algorithm and the global maximum pooling algorithm, each partition is aggregated and activated respectively to obtain a new feature map corresponding to the training feature map.

[0023] The initial classification model is adjusted based on the validation set to obtain the image classification model.

[0024] In a second aspect, an embodiment of the present application provides an image classification device, including:

[0025] An acquisition module, used for acquiring images to be classified;

[0026] An input module is used to input the image to be classified into an image classification model to obtain a classification result of the image to be classified; wherein the image classification model includes a partition channel attention module; the image classification model is used to extract features of the image to be classified to obtain an initial feature map; and is also used to divide the initial feature map into multiple partitions through the partition channel attention module; based on the global average pooling algorithm and the global maximum pooling algorithm, each partition is aggregated and activated respectively to obtain a new feature map corresponding to the initial feature map.

[0027] In a third aspect, an embodiment of the present application provides an image classification device, including: at least one processor and a memory;

[0028] The memory stores computer-executable instructions;

[0029] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method described in the first aspect and various possible designs of the first aspect.

[0030] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method described in the first aspect and various possible designs of the first aspect are implemented.

[0031] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the method described in the first aspect and various possible designs of the first aspect.

[0032] The image classification method, device, storage medium and program product provided in the present embodiment include obtaining an image to be classified, inputting the image to be classified into an image classification model, and obtaining a classification result of the image to be classified, wherein the image classification model includes a partitioned channel attention module, the image classification model is used to extract features of the image to be classified, obtain an initial feature map, and is also used to divide the initial feature map into multiple partitions through the partitioned channel attention module, and aggregate and activate each partition based on the global average pooling algorithm and the global maximum pooling algorithm to obtain a new feature map corresponding to the initial feature map. The image classification method provided in the embodiment of the present application increases the number of channel features by partitioning the feature map, and adds global maximum pooling to highlight the significant features and edges in the image during the processing by the channel attention module, thereby effectively improving the classification accuracy and model performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0034] Figure 1 A schematic diagram of an application scenario of the image classification method provided in an embodiment of the present application;

[0035] Figure 2 A schematic diagram of the process of an image classification method provided in an embodiment of the present application;

[0036] Figure 3a A schematic diagram of the structure of an image classification model provided in an embodiment of the present application;

[0037] Figure 3b A schematic diagram of the principle of a partitioned channel attention module provided in an embodiment of the present application;

[0038] Figure 4 A flowchart of a method for training an image classification model provided in an embodiment of the present application;

[0039] Figure 5 A schematic diagram of the structure of an image classification device provided in an embodiment of the present application;

[0040] Figure 6 A schematic diagram of the hardware structure of an image classification device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0042] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0043] It should be noted that the image classification method, device, storage medium and program product provided in the present application can be used in the field of image processing, and can also be used in any field other than the field of image processing. The application field of the image classification method, device, storage medium and program product provided in the present application is not limited.

[0044] In various industries, such as the insurance industry, the classification of card images has a wide range of applications. In the existing methods of using deep learning models to classify card images, the original images are interfered by factors such as background and similar card styles, resulting in large errors in category classification. If different categories of images can be accurately classified according to needs, the errors in subsequent processing can be significantly reduced, and the accuracy and stability of overall recognition can be improved. This will ensure that the system can adapt to normal operation under various background conditions, thereby improving the reliability of the overall service and reducing the risk of errors and misjudgments, thereby improving user experience and business efficiency.

[0045] Attention Mechanism is a key technology in the field of deep learning. It simulates the selective attention ability of humans when processing information, that is, focusing on only a part of important information among many stimuli. Its application in the model allows the network to automatically learn the "important" part of the input data, thereby improving the performance of the model.

[0046] Attention mechanisms are widely used in various fields. In image classification tasks, the application of attention mechanisms helps improve the performance of deep learning-based image classification models. By introducing these mechanisms, the model can better understand the image and make more accurate classification decisions, thereby enhancing its ability to understand the image content and classification performance. Existing channel attention mechanisms usually perform global average pooling on feature maps. However, a large number of spatial features will be lost after global average pooling, and global average pooling cannot highlight the significant features and edges in the image, resulting in the accuracy of the final classification results being not good enough.

[0047] In view of the above technical problems, the inventors of the present application have found that the feature map can be divided into blocks, and an attention mechanism can be used for each block. On this basis, global average pooling and global maximum pooling can be used at the same time to make up for the defects of global average pooling. Based on this, the embodiment of the present application provides an image classification method.

[0048] Figure 1 Schematic diagram of application scenarios of the image classification method provided in the embodiment of the present application. Figure 1 As shown, the terminal device may be installed with a business system for receiving images to be classified uploaded by users to the business system, inputting the images to be classified into an image classification model for image classification, and obtaining classification results of the images to be classified.

[0049] In the specific implementation process, when the user needs to handle business, he can upload the document image and other related images to be classified to the business system of the terminal device. The terminal device inputs the received image to be classified into the image classification model to obtain the classification result of the image to be classified; wherein, the image classification model includes a partitioned channel attention module; the image classification model is used to extract features of the image to be classified to obtain an initial feature map; it is also used to divide the initial feature map into multiple partitions through the partitioned channel attention module; based on the global average pooling algorithm and the global maximum pooling algorithm, each partition is respectively aggregated and activated to obtain a new feature map corresponding to the initial feature map. The image classification method provided in the embodiment of the present application partitions the feature map, uses the channel attention module to process each partition, increases the number of channel features, and adds global maximum pooling to highlight the significant features and edges in the image during the processing through the channel attention module, thereby effectively improving the classification accuracy and model performance.

[0050] It should be noted that Figure 1The scene diagram shown is only an example. The image classification method and scene described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the system and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.

[0051] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0052] Figure 2 The following is a flow chart of the image classification method provided in the embodiment of the present application. Figure 2 As shown, the method includes:

[0053] 201. Obtain an image to be classified.

[0054] The execution subject of this embodiment may be a terminal device or a server.

[0055] The image to be processed may be an ID photo or other image.

[0056] 202. Input the image to be classified into an image classification model to obtain a classification result of the image to be classified; wherein the image classification model includes a partitioned channel attention module; the image classification model is used to extract features of the image to be classified to obtain an initial feature map; and is also used to divide the initial feature map into multiple partitions through the partitioned channel attention module; and based on the global average pooling algorithm and the global maximum pooling algorithm, each partition is aggregated and activated respectively to obtain a new feature map corresponding to the initial feature map.

[0057] In this embodiment, the image classification model can be a model obtained by introducing a partitioned channel attention module into a convolutional neural network model such as LeNet, AlexNet, VGGNet, GoogleNet, or ResNet. The partitioned channel attention module can be set after any processing layer for outputting a feature map, and the feature map output by the processing layer is partitioned by the partitioned channel attention module, and global average pooling and global maximum pooling are simultaneously used for each partition to learn the weights, and the importance of different channels is adaptively adjusted to obtain a new feature map, so that the classification accuracy is improved and the performance of the model is improved.

[0058] For example, Figure 3aAs shown in the figure, the network architecture includes a 1x1 convolutional layer for dimensionality increase, a depth-separable layer, a partitioned channel attention module, a 1x1 convolutional layer for dimensionality reduction, a dropout layer, and a residual connection. By using the partitioned channel attention module, the feature map can be partitioned, and the channel attention module is used for processing each partition, which increases the number of channel features. In addition, the global maximum pooling is added during the processing of the channel attention module to highlight the significant features and edges in the image, thereby effectively improving the classification accuracy and model performance.

[0059] In some embodiments, the initial feature map includes the number of channels, width and height; dividing the initial feature map into multiple partitions may include: dividing the initial feature map along the width and / or height respectively to obtain multiple partitions; the number of channels of each partition is the same as the number of channels of the initial feature map.

[0060] Specifically, the initial feature map is partitioned, the number of channels can be kept unchanged, and the feature map of each channel is divided into width and height. For example, the width is divided into n parts, and the height is divided into n parts, where n is a positive integer greater than 1, such as Figure 3b As shown, the initial feature map of the original size [C, H, W] (C is the number of channels, H is the height, and W is the width) is divided into n*n partitions of size [C, H / n, W / n], each partition representing an area of ​​the initial feature map.

[0061] In this embodiment, the number of channels may be kept unchanged, and only the width of the feature map of each channel may be divided, or only the height of the feature map of each channel may be divided. This embodiment does not limit this, and it may be specifically set according to needs.

[0062] In some embodiments, the aggregating and activating the partitions based on the global average pooling algorithm and the global maximum pooling algorithm to obtain a new feature map corresponding to the partition may include: for the sub-feature map under each channel of each partition, aggregating and activating the sub-feature map based on the global average pooling algorithm to obtain a first weight, aggregating and activating the sub-feature map based on the global maximum pooling algorithm to obtain a second weight, and fusing the first weight and the second weight to obtain a target weight of the sub-feature map; generating a new feature map corresponding to the initial feature map according to the initial feature map and the target weights under multiple channels of the multiple partitions.

[0063] Exemplarily, the first weight and the second weight may be combined by adding the first weight and the second weight to obtain an average value, and the average value is determined as the target weight. In an achievable manner, the two weights may also be processed by weighted averaging to obtain the target weight, which is not limited in this embodiment.

[0064] In some embodiments, the aggregating and activating the sub-feature maps based on the global average pooling algorithm to obtain the first weight may include: performing global average pooling on the sub-feature maps to obtain a first global spatial feature corresponding to the sub-feature maps; stimulating the first global spatial feature to obtain the first weight of the sub-feature maps; the aggregating and activating the sub-feature maps based on the global maximum pooling algorithm to obtain the second weight may include: performing global maximum pooling on the sub-feature maps under each channel of each partition to obtain the second global spatial feature corresponding to the sub-feature maps; stimulating the second global spatial feature to obtain the second weight of the sub-feature maps.

[0065] For example, Figure 3b As shown in the figure, for each partition, global average pooling and global maximum pooling are performed respectively, and the global spatial features of each channel of each partition are extracted and mapped to the dimension of [C, 1, 1]. Each dimension is stimulated (sigmoid function can be used) to obtain the weight corresponding to each channel, and the weight corresponding to the global average pooling and the weight corresponding to the global maximum pooling are weighted and summed to obtain the final weight. A new feature map is obtained based on the final weight.

[0066] The image classification method provided in this embodiment partitions the feature map and uses a channel attention module to process each partition, thereby increasing the number of channel features. In the process of processing through the channel attention module, global maximum pooling is added to highlight the significant features and edges in the image, thereby effectively improving the classification accuracy and model performance.

[0067] Figure 4 The following is a flow chart of the training method of the image classification model provided in the embodiment of the present application. Figure 4 As shown, the method includes:

[0068] 401. Obtain multiple historical images to be classified and construct a sample set.

[0069] 402. Label each historical image to be classified in the sample set according to its category to obtain a labeled sample set.

[0070] 403. Divide the labeled sample set into a training set and a validation set.

[0071] In this embodiment, the collected card image data is manually classified according to the requirements, and the classified data set is divided into a training set and a validation set for training.

[0072] 404. Train the neural network model based on the training set to obtain an initial classification model; the neural network model includes a partitioned channel attention module; wherein, during the training process, the partitioned channel attention module is used to divide the training feature map corresponding to the input sample into multiple partitions; based on the global average pooling algorithm and the global maximum pooling algorithm, each partition is aggregated and activated respectively to obtain a new feature map corresponding to the training feature map.

[0073] Specifically, Figure 3a As shown in , the neural network model is obtained by introducing the partition channel attention module into the classification network, such as Figure 3b As shown in the figure, the partition attention module mainly adopts the new LS-SE attention mechanism based on channel attention, which divides the feature map from the original size [C, H, W] into n*n parts of the same size [C, H / n, W / n] according to the situation. Each part represents an area of ​​the original feature map. Subsequently, two global spatial features of each channel in each region are extracted by global average pooling and global maximum pooling, and they are mapped to the dimensions of [C, 1, 1] respectively. Each dimension is stimulated to obtain the weight corresponding to each channel. The two weights are fused to obtain the final weight, and a new feature map is generated according to the weight. The network can be trained to calculate the loss function and then back-propagate to update the model parameters. After each round of training, the model accuracy is verified on the validation set and the optimal network model is saved. The loss function can be BCE_loss (Binary Cross Entropy loss), which is a loss function for binary classification problems. It measures the difference between the model's predicted probability distribution and the true label.

[0074] 405. Adjust the initial classification model based on the validation set to obtain the image classification model.

[0075] Specifically, the classification model that introduced the partitioned channel attention module after training was compared with the classification model that introduced the channel attention module before, and the accuracy of classifying card images was greatly improved.

[0076] The image classification method provided in this embodiment partitions the feature map and uses a channel attention module to process each partition. The original global average pooling only retains "number of channels" features, while this solution can retain n*n "number of channels" features, thereby increasing the number of channel features. In addition, global maximum pooling is added during processing through the channel attention module to highlight significant features and edges in the image, thereby effectively improving classification accuracy and model performance.

[0077] Figure 5 This is a schematic diagram of the structure of the image classification device provided in the embodiment of the present application. Figure 5 As shown, the image classification device 50 includes: an acquisition module 501 and an input module 502.

[0078] The acquisition module 501 is used to acquire the image to be classified.

[0079] The input module 502 is used to input the image to be classified into the image classification model to obtain the classification result of the image to be classified; wherein the image classification model includes a partition channel attention module; the image classification model is used to extract features of the image to be classified to obtain an initial feature map; and is also used to divide the initial feature map into multiple partitions through the partition channel attention module; based on the global average pooling algorithm and the global maximum pooling algorithm, each partition is aggregated and activated respectively to obtain a new feature map corresponding to the initial feature map.

[0080] The image classification device provided in the embodiment of the present application partitions the feature map and uses a channel attention module to process each partition, thereby increasing the number of channel features, and adds global maximum pooling during the processing by the channel attention module to highlight the significant features and edges in the image, thereby effectively improving the classification accuracy and model performance.

[0081] In some embodiments, the initial feature map includes the number of channels, width and height; when the input module 502 divides the initial feature map into a plurality of partitions, it is specifically used to:

[0082] The initial feature map is divided along width and / or height to obtain multiple partitions; the number of channels of each partition is the same as the number of channels of the initial feature map.

[0083] In some embodiments, when the input module 502 aggregates and activates the partitions based on the global average pooling algorithm and the global maximum pooling algorithm to obtain a new feature map corresponding to the partition, it is specifically used to:

[0084] For the sub-feature map under each channel of each partition, the sub-feature map is aggregated and activated based on the global average pooling algorithm to obtain a first weight, the sub-feature map is aggregated and activated based on the global maximum pooling algorithm to obtain a second weight, and the first weight and the second weight are fused to obtain a target weight of the sub-feature map;

[0085] A new feature map corresponding to the initial feature map is generated according to the initial feature map and the target weights of the multiple channels of the multiple partitions.

[0086] In some embodiments, when the input module 402 aggregates and activates the sub-feature map based on the global average pooling algorithm to obtain the first weight, it is specifically used to:

[0087] Performing global average pooling on the sub-feature map to obtain a first global spatial feature corresponding to the sub-feature map; performing excitation on the first global spatial feature to obtain a first weight of the sub-feature map;

[0088] The aggregating and activating the sub-feature maps based on the global maximum pooling algorithm to obtain the second weight includes:

[0089] For the sub-feature map under each channel of each partition, global maximum pooling is performed on the sub-feature map to obtain a second global spatial feature corresponding to the sub-feature map; and the second global spatial feature is stimulated to obtain a second weight of the sub-feature map.

[0090] In some embodiments, the device 50 further includes a training module (the training module is not shown), the training module being configured to:

[0091] Obtain multiple historical images to be classified and construct a sample set;

[0092] Performing category labeling on each historical image to be classified in the sample set to obtain a labeled sample set;

[0093] Dividing the labeled sample set into a training set and a validation set;

[0094] The neural network model is trained based on the training set to obtain an initial classification model; the neural network model includes a partitioned channel attention module; wherein, during the training process, the partitioned channel attention module is used to divide the training feature map corresponding to the input sample into multiple partitions; based on the global average pooling algorithm and the global maximum pooling algorithm, each partition is aggregated and activated respectively to obtain a new feature map corresponding to the training feature map.

[0095] The initial classification model is adjusted based on the validation set to obtain the image classification model.

[0096] The image classification device provided in the embodiment of the present application can be used to execute the above-mentioned method embodiment. Its implementation principle and technical effects are similar, and this embodiment will not be repeated here.

[0097] Figure 6 A schematic diagram of the hardware structure of an image classification device provided in an embodiment of the present application. The device may be a computer, a message sending and receiving device, a tablet device, a server, etc.

[0098] The device 60 may include one or more of the following components: a processing component 601 , a memory 602 , a power component 603 , a multimedia component 604 , an audio component 605 , an input / output (I / O) interface 606 , a sensor component 607 , and a communication component 608 .

[0099] The processing component 601 generally controls the overall operation of the device 60, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 601 may include one or more processors 609 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 601 may include one or more modules to facilitate the interaction between the processing component 601 and other components. For example, the processing component 601 may include a multimedia module to facilitate the interaction between the multimedia component 604 and the processing component 601.

[0100] The memory 602 is configured to store various types of data to support operations on the device 60. Examples of such data include instructions for any application or method operating on the device 60, contact data, phone book data, messages, pictures, videos, etc. The memory 602 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0101] The power supply component 603 provides power to the various components of the device 60. The power supply component 603 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 60.

[0102] The multimedia component 604 includes a screen that provides an output interface between the device 60 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 604 includes a front camera and / or a rear camera. When the device 60 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0103] The audio component 605 is configured to output and / or input audio signals. For example, the audio component 605 includes a microphone (MIC), and when the device 60 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 602 or sent via the communication component 608. In some embodiments, the audio component 605 also includes a speaker for outputting audio signals.

[0104] I / O interface 606 provides an interface between processing component 601 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0105] The sensor assembly 607 includes one or more sensors for providing various aspects of status assessment for the device 60. For example, the sensor assembly 607 can detect the open / closed state of the device 60, the relative positioning of components, such as the display and keypad of the device 60, and the sensor assembly 607 can also detect the position change of the device 60 or a component of the device 60, the presence or absence of user contact with the device 60, the orientation or acceleration / deceleration of the device 60, and the temperature change of the device 60. The sensor assembly 607 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 607 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 607 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0106] The communication component 608 is configured to facilitate wired or wireless communication between the device 60 and other devices. The device 60 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 608 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 608 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0107] In an exemplary embodiment, the device 60 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0108] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 602 including instructions, and the instructions can be executed by a processor 609 of the device 60 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0109] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0110] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0111] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0112] An embodiment of the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the image classification method performed by the above image classification device is implemented.

[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. An image classification method, It is characterized in that include: Get the image to be classified; Inputting the image to be classified into an image classification model to obtain a classification result of the image to be classified; wherein the image classification model includes a partition channel attention module; The image classification model is used to extract features of the image to be classified to obtain an initial feature map; it is also used to divide the initial feature map into multiple partitions through the partition channel attention module; based on the global average pooling algorithm and the global maximum pooling algorithm, each partition is aggregated and activated respectively to obtain a new feature map corresponding to the initial feature map.

2. The method according to claim 1, It is characterized in that The initial feature map includes the number of channels, width and height; the initial feature map is divided into a plurality of partitions, including: The initial feature map is divided along the width and / or height to obtain multiple partitions; the number of channels of each partition is the same as the number of channels of the initial feature map.

3. The method according to claim 1, It is characterized in that The aggregating and activating the partitions based on the global average pooling algorithm and the global maximum pooling algorithm to obtain a new feature map corresponding to the partitions includes: For the sub-feature map under each channel of each partition, the sub-feature map is aggregated and activated based on the global average pooling algorithm to obtain a first weight, the sub-feature map is aggregated and activated based on the global maximum pooling algorithm to obtain a second weight, and the first weight and the second weight are fused to obtain a target weight of the sub-feature map; A new feature map corresponding to the initial feature map is generated according to the initial feature map and the target weights of the multiple channels of the multiple partitions.

4. The method according to claim 3, It is characterized in that The aggregating and activating the sub-feature maps based on the global average pooling algorithm to obtain the first weight includes: Performing global average pooling on the sub-feature map to obtain a first global spatial feature corresponding to the sub-feature map; performing excitation on the first global spatial feature to obtain a first weight of the sub-feature map; The aggregating and activating the sub-feature maps based on the global maximum pooling algorithm to obtain the second weight includes: For the sub-feature map under each channel of each partition, global maximum pooling is performed on the sub-feature map to obtain a second global spatial feature corresponding to the sub-feature map; and the second global spatial feature is stimulated to obtain a second weight of the sub-feature map.

5. The method according to claim 1, It is characterized in that Before inputting the image to be classified into the image classification model to obtain the classification result of the image to be classified, the method further includes: Obtain multiple historical images to be classified and construct a sample set; Performing category labeling on each historical image to be classified in the sample set to obtain a labeled sample set; Dividing the labeled sample set into a training set and a validation set; The neural network model is trained based on the training set to obtain an initial classification model; the neural network model includes a partitioned channel attention module; wherein, during the training process, the partitioned channel attention module is used to divide the training feature map corresponding to the input sample into multiple partitions; based on the global average pooling algorithm and the global maximum pooling algorithm, each partition is respectively aggregated and activated to obtain a new feature map corresponding to the training feature map; The initial classification model is adjusted based on the validation set to obtain the image classification model.

6. The method according to claim 1, It is characterized in that The image classification model is an efficient convolutional neural network EfficientNet.

7. An image classification device, It is characterized in that include: An acquisition module, used for acquiring images to be classified; An input module, used for inputting the image to be classified into an image classification model to obtain a classification result of the image to be classified; wherein the image classification model includes a partition channel attention module; The image classification model is used to extract features of the image to be classified to obtain an initial feature map; it is also used to divide the initial feature map into multiple partitions through the partition channel attention module; based on the global average pooling algorithm and the global maximum pooling algorithm, each partition is aggregated and activated respectively to obtain a new feature map corresponding to the initial feature map.

8. An image classification device, It is characterized in that include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the image classification method according to any one of claims 1 to 6.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the image classification method according to any one of claims 1 to 6 is implemented.

10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the image classification method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Image processing method and device, electronic equipment and storage medium

    CN110348537A

  • Feature graph enhancement method and device of convolutional neural network, equipment and medium

    CN110490813A

  • Fully supervised shielded pedestrian re-identification method based on deep learning

    CN114387621A

  • Image classification method and device based on improved residual network, and storage medium

    CN114782737A

  • Automatic driving image segmentation method and device, equipment and storage medium

    CN116740355A

Cited By

  • Article automatic classification method and system based on artificial intelligence

    CN120047931A

  • An artificial intelligence-based automatic article classification method and system

    CN120047931B