An image recognition model training method, an image recognition method and device
By adjusting the scaling factor and loss value of the image recognition network and combining training with both difficult and non-difficult samples, the problem of low accuracy of neural network models in difficult image recognition is solved, and the model's recognition accuracy and generalization ability for difficult examples are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING IQIYI TECH CO LTD
- Filing Date
- 2023-10-24
- Publication Date
- 2026-07-31
AI Technical Summary
Neural network models have low recognition accuracy when dealing with difficult images, such as faces that are occluded, blurred, or distorted. Furthermore, training with only difficult examples can lead to the model relying on easily distinguishable features for recognition, resulting in low accuracy.
By acquiring the image quality of sample images, adjusting the scaling factor, and using the positive correlation of image quality with the magnification or the negative correlation with the reduction, the image recognition network is trained by combining hard and non-hard samples. The network parameters are then adjusted using the loss value until convergence, thus forming an image recognition model.
This improves the image recognition model's focus on difficult samples, enhances the model's accuracy and generalization ability in identifying difficult examples, and ensures that the model can more accurately identify the specified objects in the image.
Smart Images

Figure CN117456303B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image recognition model training method, an image recognition method, and an apparatus. Background Technology
[0002] Image recognition using neural network models can determine the category of objects within an image and / or their location within the image. However, real-world applications present various challenging scenarios where neural network models struggle to accurately recognize faces. For example, in face recognition, models often fail to accurately identify faces that are largely occluded, blurred, or distorted, making them difficult to distinguish.
[0003] This is because neural network models are usually trained on clear and complete images, resulting in low accuracy in recognizing difficult examples. However, if only difficult examples are used to train the neural network model, it will cause the model to rely solely on features that are not easily distinguishable, such as color and contours, for image recognition, which also leads to low accuracy in the trained neural network model. Summary of the Invention
[0004] The purpose of this application is to provide an image recognition model training method, an image recognition method, and an apparatus to improve the accuracy of image recognition. The specific technical solution is as follows:
[0005] In a first aspect of this application, an image recognition model training method is provided, the method comprising:
[0006] Acquire sample images and training labels, wherein the training labels are the standard recognition results of the sample images;
[0007] The sample image is used to extract features using an image recognition network to obtain a feature map, and the image recognition result of the sample image is determined based on the feature map;
[0008] Determine the image quality of the sample image, whereby the image quality represents the degree of completeness and / or sharpness of a specified object in the image;
[0009] Based on the image quality, the scaling factor is adjusted; wherein, when the image quality is within the acceptable range, the magnification of the scaling factor is positively correlated with the image quality; when the image quality is outside the acceptable range, the reduction of the scaling factor is negatively correlated with the image quality, and the acceptable range is the image quality range of difficult samples;
[0010] Based on the adjusted scaling factor, the image recognition result, and the training label, a loss value is determined, wherein the scaling factor is positively correlated with the loss value.
[0011] The network parameters of the image recognition network are adjusted using the loss value, and the step of using the image recognition network to extract features from the sample image is returned until the image recognition network converges. The current image recognition network is then used as the image recognition model, which is used to identify a specified object in the image.
[0012] Optionally, determining the image quality of the sample image includes:
[0013] The feature map is then processed using an attention mechanism to extract features, resulting in a recoded feature map.
[0014] The L2 norm is calculated for the recoded feature map, and the calculation result is used as the image quality of the sample image.
[0015] Optionally, the step of using an attention mechanism to extract features from the feature map to obtain a recoded feature map includes:
[0016] Determine the channel weights for each channel included in the feature map;
[0017] The recoded feature map is obtained by multiplying the features of each channel in the feature map by the channel weights.
[0018] Optionally, determining the channel weights of each channel included in the feature map includes:
[0019] The feature map is subjected to global average pooling to obtain average pooled features;
[0020] Using a multilayer perceptron based on the average pooling features, the first sub-weight of each channel in the feature map is determined;
[0021] The feature map is subjected to global max pooling to obtain max pooled features;
[0022] The second sub-weights of each channel in the feature map are determined using the multilayer perceptron based on the max-pooling features;
[0023] The channel weight is determined based on the first sub-weight and the second sub-weight of each channel included in the feature map.
[0024] Optionally, adjusting the scaling factor based on the image quality includes:
[0025] Based on the preset correspondence between each quality sub-range and the weight coefficient, the target weight coefficient corresponding to the quality sub-range to which the image quality belongs is determined. The image quality represented by each quality sub-range included in the quality compliance range is positively correlated with the corresponding weight coefficient, while the image quality represented by each quality sub-range included in the non-quality compliance range is negatively correlated with the corresponding weight coefficient.
[0026] The scaling factor is adjusted to be the product of the image quality of the sample image and the target weight factor.
[0027] Optionally, determining the loss value based on the adjusted scaling factor, the image recognition result, and the training label includes:
[0028] Determine the error between the image recognition result and the training label;
[0029] The loss value is determined based on the product of the error and the adjusted scaling factor.
[0030] In a second aspect of this application, an image recognition method is also provided, the method comprising:
[0031] Acquire the image to be recognized;
[0032] The image to be identified is subjected to feature extraction using an image recognition model to obtain a feature map, wherein the image recognition model is a model trained based on the method described in any one of the first aspects;
[0033] The image recognition model is used to identify a specified object in the image to be recognized based on the feature map.
[0034] Optionally, after extracting features from the image to be recognized using an image recognition model to obtain a feature map, the method further includes:
[0035] The image quality of the image to be identified is determined using the image recognition model based on the feature map, whereby the image quality represents the degree of completeness and / or sharpness of a specified object in the image.
[0036] The image recognition model is used to determine whether the image quality of the image to be recognized is higher than the preset image quality.
[0037] If so, then the step of using the image recognition model to identify the specified object in the image to be recognized based on the feature map is performed;
[0038] If not, then obtain the specified error data output by the image recognition model.
[0039] In a third aspect of this application, an image recognition model training apparatus is also provided, the apparatus comprising:
[0040] The acquisition module is used to acquire sample images and training labels, wherein the training labels are the standard recognition results of the sample images;
[0041] The recognition module is used to extract features from the sample image acquired by the acquisition module using an image recognition network to obtain a feature map, and to determine the image recognition result of the sample image based on the feature map;
[0042] A determination module is used to determine the image quality of the sample image, wherein the image quality is used to represent the degree of integrity and / or sharpness of a specified object in the image;
[0043] An adjustment module is used to adjust the scaling factor based on the image quality determined by the determining module; wherein, when the image quality is within the acceptable range, the magnification of the scaling factor is positively correlated with the image quality; when the image quality is outside the acceptable range, the reduction of the scaling factor is positively correlated with the image quality, and the acceptable range is the image quality range of difficult samples;
[0044] The determining module is further configured to determine a loss value based on the scaling factor adjusted by the adjusting module, the image recognition result recognized by the recognition module, and the training labels obtained by the acquiring module, wherein the scaling factor is positively correlated with the loss value;
[0045] The adjustment module is further configured to adjust the network parameters of the image recognition network using the loss value determined by the determination module, and call the recognition module to perform the step of using the image recognition network to extract features from the sample image obtained by the acquisition module, until the image recognition network converges, and use the current image recognition network as the image recognition model, which is used to identify a specified object in the image.
[0046] Optionally, the determining module is specifically used for:
[0047] The feature map is then processed using an attention mechanism to extract features, resulting in a recoded feature map.
[0048] The L2 norm is calculated for the recoded feature map, and the calculation result is used as the image quality of the sample image.
[0049] Optionally, the determining module is specifically used for:
[0050] Determine the channel weights for each channel included in the feature map;
[0051] The recoded feature map is obtained by multiplying the features of each channel in the feature map by the channel weights.
[0052] Optionally, the determining module is specifically used for:
[0053] The feature map is subjected to global average pooling to obtain average pooled features;
[0054] Using a multilayer perceptron based on the average pooling features, the first sub-weight of each channel in the feature map is determined;
[0055] The feature map is subjected to global max pooling to obtain max pooled features;
[0056] The second sub-weights of each channel in the feature map are determined using the multilayer perceptron based on the max-pooling features;
[0057] The channel weight is determined based on the first sub-weight and the second sub-weight of each channel included in the feature map.
[0058] Optionally, the adjustment module is specifically used for:
[0059] Based on the preset correspondence between each quality sub-range and the weight coefficient, the target weight coefficient corresponding to the quality sub-range to which the image quality belongs is determined. The image quality represented by each quality sub-range included in the quality compliance range is positively correlated with the corresponding weight coefficient, while the image quality represented by each quality sub-range included in the non-quality compliance range is negatively correlated with the corresponding weight coefficient.
[0060] The scaling factor is adjusted to be the product of the image quality of the sample image and the target weight factor.
[0061] Optionally, the determining module is specifically used for:
[0062] Determine the error between the image recognition result and the training label;
[0063] The loss value is determined based on the product of the error and the adjusted scaling factor.
[0064] In a fourth aspect of this application, an image recognition device is also provided, the device comprising:
[0065] The acquisition module is used to acquire the image to be recognized;
[0066] The feature extraction module is used to extract features from the image to be recognized obtained by the acquisition module using an image recognition model to obtain a feature map, wherein the image recognition model is a model trained based on the method described in any one of the first aspects;
[0067] The recognition module is used to identify a specified object in the image to be recognized based on the feature map extracted by the feature extraction module using the image recognition model.
[0068] Optionally, the device further includes:
[0069] The determination module is used to determine the image quality of the image to be identified based on the feature map after the image recognition model is used to extract features from the image to be identified and obtain a feature map. The image quality is used to represent the degree of integrity and / or clarity of a specified object in the image.
[0070] The judgment module is used to determine whether the image quality of the image to be recognized is higher than the preset image quality using the image recognition model;
[0071] The calling module is used to call the recognition module to perform the step of using the image recognition model to identify the specified object in the image to be recognized based on the feature map if the judgment result of the judgment module is yes;
[0072] The acquisition module is further configured to acquire the specified error data output by the image recognition model if the judgment result of the judgment module is negative.
[0073] In a fifth aspect of the embodiments of this application, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0074] Memory, used to store computer programs;
[0075] A processor, when executing a program stored in memory, implements the steps of the method described in either the first or second aspect.
[0076] In a sixth aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements the method steps described in any one of the first or second aspects above.
[0077] In a seventh aspect of the embodiments of this application, a computer program product including instructions is also provided, which, when run on a computer, causes the computer to perform the method steps described in any one of the first or second aspects.
[0078] The image recognition model training method, image recognition method, and apparatus provided in this application, when the image quality of the sample image is within the acceptable range, the amplification of the scaling factor is positively correlated with the image quality; when the image quality of the sample image is outside the acceptable range, the reduction of the scaling factor is positively correlated with the image quality. This increases the scaling factor for difficult samples and decreases the scaling factor for non-difficult samples. Furthermore, the scaling factor is positively correlated with the loss value, thus the image recognition network can focus more on learning from difficult samples during training. In addition, this application uses image quality to distinguish the attention the image recognition network pays to different sample images, without requiring all sample images to be either difficult or non-difficult. Therefore, this application can train the image recognition network by combining difficult and non-difficult samples, and also allows the image recognition network to focus more on learning from difficult samples, enabling the trained image recognition model to perform image recognition more accurately. Attached Figure Description
[0079] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0080] Figure 1 A flowchart illustrating an image recognition model training method provided in this application embodiment;
[0081] Figure 2 A flowchart illustrating a method for determining image quality provided in an embodiment of this application;
[0082] Figure 3 An exemplary schematic diagram of a recoding process provided in an embodiment of this application;
[0083] Figure 4 A flowchart illustrating a method for adjusting a scaling factor provided in this application embodiment;
[0084] Figure 5 A flowchart illustrating another image recognition model training method provided in this application embodiment;
[0085] Figure 6 A flowchart of an image recognition method provided in an embodiment of this application;
[0086] Figure 7 This is a schematic diagram of the structure of an image recognition model training device provided in an embodiment of this application;
[0087] Figure 8 This is a schematic diagram of the structure of an image recognition device provided in an embodiment of this application;
[0088] Figure 9This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0089] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0090] To improve the accuracy of image recognition, embodiments of this application provide an image recognition model training method. This method is applied to electronic devices, such as servers, desktop computers, or tablet computers, which are devices with image processing capabilities. Figure 1 As shown, the method includes the following steps:
[0091] S101. Obtain sample images and training labels. The training labels are the standard recognition results of the sample images.
[0092] S102. Use an image recognition network to extract features from the sample image to obtain a feature map, and determine the image recognition result of the sample image based on the feature map.
[0093] S103. Determine the image quality of the sample image. Image quality refers to the degree of completeness and / or sharpness of a specified object in the image.
[0094] S104. Adjust the scaling factor based on image quality. Specifically, when the image quality is within the acceptable range, the magnitude of the scaling factor is positively correlated with the image quality; when the image quality is outside the acceptable range, the magnitude of the reduction in the scaling factor is positively correlated with the image quality. The acceptable range refers to the image quality range of difficult samples.
[0095] S105. Based on the adjusted scaling factor, image recognition results, and training labels, determine the loss value. The scaling factor is positively correlated with the loss value.
[0096] S106. Adjust the network parameters of the image recognition network using the loss value, and return to the step in S102 where the image recognition network extracts features from the sample image, until the image recognition network converges. Then, use the current image recognition network as the image recognition model. The image recognition model is used to identify a specified object in the image.
[0097] The image recognition model training method provided in this application provides a method where, when the image quality of the sample images is within the acceptable range, the scaling factor is positively correlated with the image quality; conversely, when the image quality is outside the acceptable range, the scaling factor is positively correlated with the image quality. This increases the scaling factor for difficult samples and decreases the scaling factor for non-difficult samples. Furthermore, the scaling factor is positively correlated with the loss value, allowing the image recognition network to focus more on learning from difficult samples during training. In addition, this application uses image quality to differentiate the attention the image recognition network pays to different sample images, without requiring all sample images to be either difficult or non-difficult. Therefore, this application can train the image recognition network by combining difficult and non-difficult samples, while also allowing the image recognition network to focus more on learning from difficult samples, resulting in a more accurate image recognition model after training.
[0098] The training method of the image recognition model provided in the embodiments of this application is described in detail below:
[0099] For S101, obtain sample images and training labels.
[0100] The training label is the standard recognition result of the sample image. That is, the training label for each sample image is the expected recognition result of the image recognition network for that sample image. The accuracy of the image recognition result represented by the training label is higher than a threshold, that is, the accuracy of the training label is high. For example, the training label can be the recognition result of manually annotating the sample image.
[0101] Taking a face recognition scenario as an example, the sample image is an image containing a face, i.e., a face image. The specified object is a face, and the training labels can include: the type of the face in the sample image labeled manually and / or the position of the face in the sample image, etc. The type of the face can be the name, gender, or age group of the person to whom the face belongs, etc. The position of the face in the sample image can be the position of the smallest bounding rectangle of the face or the position of the face region, etc. For example, the position of the smallest bounding rectangle includes: the length and width of the rectangle and the coordinates of its center point in the sample image, or the length and width of the rectangle and the coordinates of its top-left corner in the sample image, etc. The position of the face region can be the coordinates of each pixel in the sample image that belongs to the face region.
[0102] The embodiments of this application can also be applied to scenarios involving the recognition of other objects. For example, in a trademark recognition scenario, the designated object is the trademark; in a product recognition scenario, the designated object is the product, etc. The embodiments of this application do not specifically limit the application scenarios or the designated objects within those scenarios.
[0103] This application embodiment can obtain multiple sample images and training labels for each sample image from a publicly available image set, or it can obtain multiple sample images from a publicly available dataset and obtain training labels manually labeled for each sample image. Alternatively, sample images and training labels can be obtained through other methods, which are not specifically limited in this application embodiment.
[0104] For S102, feature extraction is performed on the sample image using an image recognition network to obtain a feature map, and the image recognition result of the sample image is determined based on the feature map.
[0105] Taking face recognition as an example, the feature map includes facial features. The image recognition result includes the type of the face in the sample image and / or the location of the face in the sample image, etc.
[0106] Optionally, the image recognition network can be a network capable of processing images, such as a transformer or a mobile network.
[0107] Image recognition networks consist of a backbone network and a recognition network. A sample image is input into the backbone network, which extracts features from the image to obtain a feature map. This feature map is then input into the recognition network, which determines the image recognition result based on the feature map. For example, the backbone network could be a residual network 101 (ResNet101), and the feature map extracted using ResNet101 could have a size of 7×7×2048.
[0108] In this embodiment, the image quality of the sample image determined in S103 above represents the completeness and / or clarity of the specified object in the sample image. Taking a face image as an example, a clear and complete face image has higher image quality and belongs to ordinary samples, or simple samples or non-difficult samples. Generally, the error between the prediction result of a conventional face recognition model for non-difficult samples and the training label of non-difficult samples is less than a threshold.
[0109] Images with partial occlusion, such as profile views, images of people wearing masks or sunglasses, and slightly blurred faces, are considered medium-to-high quality and thus medium-difficulty examples. Images with mostly obscured faces or faces that are too blurred to be distinguishable are of low quality and are considered high-difficulty examples. Both medium- and high-difficulty examples can be referred to as difficult samples. Typically, the error between the prediction result of a conventional face recognition model for a difficult sample and the training label of the difficult sample is greater than or equal to a threshold.
[0110] To make image recognition models pay more attention to difficult samples during training, the image quality of the sample images can be used to distinguish between difficult and non-difficult samples.
[0111] See Figure 2 The method for determining the image quality of the sample image in S103 above may include the following steps:
[0112] S201. Use the attention mechanism to extract features from the feature map to obtain the recoded feature map.
[0113] S202. Calculate the L2 norm of the recoded feature map and use the calculation result as the image quality of the sample image.
[0114] The L2 norm of the recoded feature map is the square root of the largest eigenvalue of the product of the transpose conjugate matrix of the recoded feature map and the recoded feature map.
[0115] Taking face recognition as an example, preliminary experiments have confirmed that the L2 norm of the recoded feature map can reflect the completeness and / or clarity of the face in the face image. For example, the higher the degree of occlusion and / or blurriness of the face in the face image, the more difficult it is to recognize the face, and the lower the L2 norm of the recoded feature map obtained from the face image; conversely, the lower the degree of occlusion and / or blurriness of the face in the face image, the easier it is to recognize the face, and the higher the L2 norm of the recoded feature map obtained from the face image.
[0116] Using the above method, the embodiments of this application can further extract features from the feature map based on the attention mechanism to achieve recoding, thereby distinguishing high-response regions and low-response regions in the feature map, resulting in higher accuracy in determining image quality. Furthermore, this application has confirmed through prior experiments that image quality is positively correlated with, for example, proportional to, the L2 norm of the recoded feature map; therefore, the L2 norm of the recoded feature map can be used to represent image quality.
[0117] Alternatively, the second method for determining the image quality of the sample image based on the feature map in S103 above can be: using a preset error algorithm to calculate the image error between the sample image and the clear image, and then, according to the preset correspondence between each error range and the image quality, obtaining the image quality corresponding to the error range to which the calculated image error belongs, as the image quality of the sample image.
[0118] The sample image can be an image obtained by adding noise to a clear image. For example, the sample image can be an image obtained by blurring, deforming, and / or partially occluding a clear image.
[0119] The preset correspondence between each error range and image quality can be manually set. Specifically, the larger the error range, the lower the corresponding image quality.
[0120] Optionally, the preset error algorithm can be mean square error or peak signal-to-noise ratio, etc., and the embodiments of this application do not specifically limit it.
[0121] A third way to determine the image quality of a sample image is to obtain the image quality of the sample image that has been manually labeled.
[0122] In this embodiment of the application, the above-mentioned method of using the attention mechanism to extract features from the feature map to obtain the recoded feature map can be implemented as follows: determine the channel weight of each channel included in the feature map, and multiply the features of each channel included in the feature map by the channel weight to obtain the recoded feature map.
[0123] Let w be the size of the feature map. h c, where w represents the width of the feature map, h represents the height of the feature map, and c represents the number of channels in the feature map. For example, if the feature map size is 7×7×2048, then the feature map has 2048 channels.
[0124] For example, suppose the feature map size is 2×2×2048, and the feature of the first channel of the feature map is... And since the channel weight of the first channel is 0.5, the feature of the first channel is multiplied by the channel weight to obtain... The calculation method is the same for other channels, and the feature map obtained after multiplication is used as the recoded feature map.
[0125] Multiplying the features of each channel of the feature map by its channel weights allows for further feature extraction from each channel, resulting in richer, deeper features. Furthermore, each channel has its own channel weights, which distinguish the importance of features in different channels. Therefore, the recoded feature map obtained after multiplication can more accurately determine the image quality of the sample image.
[0126] Optionally, the channel weights of each channel in the feature map can be preset. Therefore, one method for determining the channel weights of each channel in the feature map can be: obtaining the preset channel weights corresponding to each channel in the feature map.
[0127] Alternatively, the channel weights of each channel in the feature map can be determined based on the feature map. Therefore, the second method for determining the channel weights of each channel in the feature map described above can include the following steps:
[0128] Step 1: Perform Global Average Pooling (GAP) on the feature map to obtain average pooled features.
[0129] That is, for each channel included in the feature map, the average value of each feature included in that channel is taken to obtain the average pooled feature.
[0130] For example, if the feature map has a size of 7×7×2048, after performing global average pooling on the feature map, each channel includes an average value, so the size of the resulting average pooled feature is 1×1×2048.
[0131] Step 2: Using a multilayer perceptron (MLP) based on average pooling features, determine the first sub-weight of each channel included in the feature map.
[0132] The average pooling features are input into the MLP to obtain the first sub-weights of each channel in the feature map output by the MLP.
[0133] Step 3: Perform Global Max Pooling (GMP) on the feature map to obtain max-pooled features.
[0134] That is, for each channel included in the feature map, the maximum value is selected from the features included in that channel to obtain the max pooling feature.
[0135] For example, if the feature map has a size of 7×7×2048, after performing global max pooling on the feature map, each channel includes a maximum value, so the size of the resulting max pooled feature is 1×1×2048.
[0136] Step 4: Using a multilayer perceptron based on max pooling features, determine the second sub-weights of each channel in the feature map.
[0137] Input the max-pooling features into the MLP to obtain the second sub-weights of each channel in the feature map output by the MLP.
[0138] Step 5: Determine the channel weight of each channel based on the first and second sub-weights of each channel included in the feature map.
[0139] In one implementation, the first and second sub-weights of each channel in the feature map can be summed, and then the summation results of each channel can be passed through a preset activation function to obtain the channel weights of each channel. For example, the preset activation function is the normalized exponential function (softmax).
[0140] In another implementation, for each channel included in the feature map, the first sub-weight and the second sub-weight of that channel can be summed to obtain the channel weight.
[0141] Using the methods described above, this application embodiment can perform global average pooling and global max pooling on the feature map respectively. Since global average pooling focuses more on the overall feature map, while global max pooling focuses more on the extreme values of the feature map, it achieves the preservation of channel features from different perspectives. Then, the channel features obtained from different perspectives are fused, achieving the best of both worlds and obtaining more comprehensive and richer deep features, i.e., obtaining the channel weights of each channel, making the subsequent image quality determination based on the channel weights more accurate.
[0142] The following combination Figure 3 The process of determining the recoded feature map in the embodiments of this application will be described in detail below:
[0143] The feature maps are input into a global average pooling layer and a global max pooling layer, respectively, to obtain the average pooling features output by the global average pooling layer and the max pooling features output by the global max pooling layer. The average pooling features and max pooling features are then input into a multilayer perceptron to obtain the first and second sub-weights of each channel in the feature map output by the multilayer perceptron. The first and second sub-weights of each channel in the feature map are summed, and then the summation results for each channel are passed through a preset activation function to obtain the channel weights. Finally, the features of each channel in the feature map are multiplied bitwise by the channel weights to obtain the recoded feature map.
[0144] After determining the image quality of the sample images, see [link / reference]. Figure 4 The method described above for adjusting the scaling factor based on image quality in S104 may include the following steps:
[0145] S401. Based on the preset correspondence between each quality sub-range and the weight coefficient, determine the target weight coefficient corresponding to the quality sub-range to which the image quality belongs.
[0146] The quality compliance range includes multiple quality sub-ranges, and the image quality represented by each quality sub-range is positively correlated with its corresponding weight coefficient. That is, the higher the image quality represented by the quality sub-range within the quality compliance range, the larger the corresponding weight coefficient.
[0147] For example, suppose the quality compliance range includes four quality sub-ranges: [0,40], (40,50], (50,60], and (60,70]. Let the weight coefficient be s. Then, [0,40] corresponds to s=0.1, (40,50] corresponds to s=0.2, (50,60] corresponds to s=0.3, and (60,70] corresponds to s=0.7.
[0148] The non-quality-compliant range includes multiple quality sub-ranges, and the image quality represented by each quality sub-range within the non-quality-compliant range is negatively correlated with its corresponding weight coefficient. That is, the higher the image quality represented by the quality sub-range within the non-quality-compliant range, the smaller the corresponding weight coefficient.
[0149] For example, suppose the non-quality compliance range includes three quality sub-ranges: (70,80], (80,90], and (90,100]. Let the weight coefficient be s. Then, (70,80] corresponds to s=0.6, (80,90] corresponds to s=0.2, and (90,100] corresponds to s=0.1.
[0150] S402. Adjust the scaling factor to the product of the sample image quality and the target weight coefficient.
[0151] When the image quality of the sample image is within the acceptable quality range, the initial value of the scaling factor of the sample image can be: the product of the image quality of the sample image and the first initial weight coefficient, where the first initial weight coefficient is the weight coefficient corresponding to the lowest quality sub-range represented in the acceptable quality range.
[0152] Therefore, the difference between the weight coefficient corresponding to the quality sub-range to which the image quality of the sample image belongs and the first initial weight coefficient is equivalent to the amplification of the scaling factor. That is, the higher the image quality represented by the quality sub-range to which the image quality of the sample image belongs, the greater the amplification of the scaling factor.
[0153] When the image quality of the sample image is in the non-standard quality range, the initial value of the scaling factor of the sample image can be: the product of the image quality of the sample image and the second initial weight coefficient, where the second initial weight coefficient is the weight coefficient corresponding to the lowest quality sub-range represented in the non-standard quality range.
[0154] Therefore, the difference between the weight coefficient corresponding to the quality sub-range to which the image quality of the sample image belongs and the second initial weight coefficient is equivalent to the reduction of the scaling factor. That is, the higher the image quality represented by the quality sub-range to which the image quality of the sample image belongs, the greater the reduction of the scaling factor.
[0155] As can be seen in this embodiment, the image quality represented by each quality sub-range within the quality-compliant range is relatively low, and the higher the image quality represented by each quality sub-range, the larger the corresponding weight coefficient, and therefore the larger the adjusted scaling coefficient. Conversely, the image quality represented by each quality sub-range within the non-quality-compliant range is relatively high, and the higher the image quality represented by each quality sub-range, the smaller the corresponding weight coefficient, and therefore the smaller the adjusted scaling coefficient. Therefore, this embodiment, by adjusting the scaling coefficient based on image quality, can increase the scaling coefficient for high-quality difficult samples and decrease the scaling coefficient for high-quality non-difficult samples, thereby increasing the image recognition model's focus on high-quality difficult samples and reducing its focus on high-quality non-difficult samples. This improves the image recognition network's ability to identify difficult samples and enhances its generalization and robustness.
[0156] Meanwhile, in this embodiment, the difficult samples with low image quality, such as face images with most of the face obscured or face images with extremely high blur, contain mostly features that are difficult to distinguish. Therefore, the scaling factor of the difficult samples with low image quality in this embodiment will not be too high. This can reduce the image recognition network from overlearning features that are difficult to distinguish and improve the recognition accuracy of the image recognition network.
[0157] In this embodiment, the initial values of the weight coefficients corresponding to each mass subrange can be preset. Then, during the training process of the image recognition network, the network parameters of the image recognition model can be adjusted using the loss value. The network parameters include the weight coefficients corresponding to each mass subrange, making the weight coefficients more accurate.
[0158] Alternatively, during training, only the weight coefficients corresponding to a portion of the quality subranges can be adjusted, while keeping the weight coefficients corresponding to another portion of the quality subranges unchanged. For example, when there is a pressing problem of identifying difficult examples in image recognition, the weight coefficient corresponding to the quality subrange [0,40] can be fixed at 0.5, thereby increasing the image recognition network's ability to learn difficult samples with image quality within the range [0,40].
[0159] After adjusting the scaling factor, the above-mentioned S105 method for determining the loss value based on the adjusted scaling factor, the image recognition result, and the training label can be implemented as follows: determine the error between the image recognition result and the training label, and determine the loss value based on the product of the error and the adjusted scaling factor.
[0160] Optionally, the loss value can be calculated based on the mean squared error (MSE) between the image recognition results and training labels for each sample image:
[0161]
[0162] Where MSE is the loss value, This refers to the number of sample images used in each iteration during training. The training label represents the sample image i. This represents the image recognition result of the image recognition model on sample image i. This represents the scaling factor of sample image i.
[0163] Alternatively, the loss value can be calculated using the cross-entropy between the image recognition results and training labels for each sample image.
[0164]
[0165] Where C is the loss value, This refers to the number of sample images used in each iteration during training. The training label represents the sample image i. This represents the image recognition result of the image recognition model on sample image i. This represents the scaling factor of sample image i.
[0166] Alternatively, the loss value can be calculated using other algorithms, but this application does not specifically limit the specific algorithms used in this embodiment.
[0167] Multiplying the error between the image recognition result and the training label by the adjusted scaling factor allows for adjusting the proportion of the error corresponding to sample images of different image quality in the loss value. This enables the image recognition network to focus more on sample images with a higher proportion in the loss value when training with the loss value. In other words, it allows the image recognition model to focus more on learning to recognize difficult samples while simultaneously learning to recognize both easy and difficult samples, thereby improving the recognition accuracy and generalization of the image recognition network.
[0168] After determining the loss value, before adjusting the network parameters of the image recognition network using the loss value in S106, it is also possible to determine whether the image recognition network has converged based on the loss value. If it has, the current image recognition network is used as the image recognition model; if not, the step of adjusting the network parameters of the image recognition network using the loss value in S106 is executed, and the process returns to S102 for the next round of training.
[0169] For example, it can be determined whether the loss value is less than a preset value. If it is, the image recognition network is considered to have converged; if not, the image recognition network is considered to have not converged.
[0170] Alternatively, determine whether the difference between the loss value calculated in this round and the loss value calculated in the previous round is less than a preset value. If yes, the image recognition network is determined to have converged; otherwise, the image recognition network is determined to have not converged.
[0171] Alternatively, other methods can be used to determine whether the image recognition network has converged, and this application does not specifically limit this method.
[0172] See Figure 5 The image recognition model training method provided in this application embodiment will be described below in conjunction with practical application scenarios:
[0173] S501. Obtain sample images and training labels.
[0174] S502. Use an image recognition network to extract features from the sample image to obtain a feature map, and determine the image recognition result of the sample image based on the feature map.
[0175] S503. Use the attention mechanism to extract features from the feature map to obtain the recoded feature map. Calculate the L2 norm of the recoded feature map and use the calculation result as the image quality of the sample image.
[0176] S504. Based on the preset correspondence between each quality sub-range and the weight coefficient, determine the target weight coefficient corresponding to the quality sub-range to which the image quality belongs, and adjust the scaling factor to be the product of the image quality of the sample image and the target weight coefficient.
[0177] S505. Determine the error between the image recognition result and the training label for each sample image. Based on the product of the error of each sample image and the adjusted scaling factor, determine the loss value.
[0178] S506. Adjust the network parameters of the image recognition network using the loss value, and return to the step of using the image recognition network to extract features from the sample image in S502 until the image recognition network converges. Then, use the current image recognition network as the image recognition model.
[0179] Figure 5 The specific implementation methods of each step can be found in the above description, and will not be repeated here.
[0180] Based on the same inventive concept, this application also provides an image recognition method applicable to electronic devices, such as servers, desktop computers, tablets, or mobile phones, which are devices with image processing capabilities. The image recognition model training method and the image recognition method can be applied to the same electronic device or to different electronic devices.
[0181] See Figure 6The image recognition method provided in this application includes the following steps:
[0182] S601. Obtain the image to be recognized.
[0183] Optionally, the image to be recognized can be any image that requires image recognition, such as an image selected by the user or an image acquired in real time.
[0184] Taking facial recognition as an example, the image to be recognized can be a facial image selected by the user from their album, or a facial image captured in real time by an indoor camera or a roadside camera.
[0185] S602. Use an image recognition model to extract features from the image to be recognized to obtain a feature map.
[0186] The image recognition model is a model trained based on the image recognition model training method described above.
[0187] The structure and specific processing steps of the image recognition model can be referred to the above description, and will not be repeated here.
[0188] S603. Use an image recognition model to identify a specified object in the image to be recognized based on the feature map.
[0189] Taking face recognition as an example, the recognition results of an image recognition model can include: the type of the face in the image to be recognized and / or the location of the face in the image to be recognized, etc.
[0190] The image recognition method provided in this application can distinguish the attention given to different sample images by the image recognition network based on image quality, without requiring all sample images to be either difficult or non-difficult. Therefore, this application can train the image recognition network by combining difficult and non-difficult samples, and also allow the image recognition network to focus more on learning from difficult samples, resulting in more accurate recognition results from the trained image recognition model. Thus, this application can utilize the trained image recognition model to perform more accurate image recognition of the image to be recognized.
[0191] In this embodiment, the image recognition model includes a backbone network, an attention network, and a recognition network. The backbone network is used to extract feature maps of the input image, the attention network is used to determine the image quality of the input image based on the feature maps, and the recognition network is used to determine the image recognition result of the input image based on the feature maps when the image quality is higher than a preset quality.
[0192] Based on this, after the above-mentioned S602 uses the image recognition model to extract features from the image to be recognized and obtains the feature map, the electronic device can also perform the following steps:
[0193] Step 1: Using an image recognition model based on feature maps, determine the image quality of the image to be recognized. Image quality refers to the degree of completeness and / or sharpness of a specified object in the image.
[0194] The steps for determining image quality can be found above. Figure 2 The relevant descriptions in the document will not be repeated here.
[0195] Step 2: Use an image recognition model to determine whether the image quality of the image to be recognized is higher than the preset image quality. If yes, then execute the step S603 above, which uses an image recognition model to identify the specified object in the image to be recognized based on the feature map. If no, then execute step 3.
[0196] For example, when the image quality value range is [0,1], the preset image quality is 0.5.
[0197] Step 3: Obtain the specified error data output by the image recognition model.
[0198] For example, specifying the error data as "001" means that the image quality of the input image to be recognized is too low to be recognized.
[0199] After receiving specified error data, the electronic device can display an error message on the screen. For example, the error message could be "Unable to recognize, please re-upload." This indicates to the user that the image quality of the image to be recognized is too low to perform image recognition.
[0200] Using the above method, the embodiments of this application can determine the image quality of the image to be identified. When the image quality is high, it indicates that the specified object in the image is relatively complete and clear. Therefore, image recognition can be performed on the image to be identified, and the accuracy of the obtained image recognition result is high. Conversely, when the image quality is low, it indicates that the specified object in the image to be identified is difficult to distinguish. If image recognition is performed on the image to be identified, the obtained image recognition result is likely to be inaccurate. Therefore, image recognition of the image to be identified can be abandoned, saving computing resources.
[0201] Based on the same inventive concept, embodiments of this application also provide an image recognition model training device, such as... Figure 7 As shown, the device includes: an acquisition module 701, an identification module 702, a determination module 703, and an adjustment module 704;
[0202] The acquisition module 701 is used to acquire sample images and training labels, where the training labels are the standard recognition results of the sample images;
[0203] The recognition module 702 is used to extract features from the sample image acquired by the acquisition module 701 using an image recognition network, obtain a feature map, and determine the image recognition result of the sample image based on the feature map;
[0204] The determination module 703 is used to determine the image quality of the sample image, where image quality represents the degree of integrity and / or sharpness of a specified object in the image;
[0205] The adjustment module 704 is used to adjust the scaling factor based on the image quality determined by the determination module 703; wherein, when the image quality is within the acceptable range, the magnification of the scaling factor is positively correlated with the image quality; when the image quality is outside the acceptable range, the reduction of the scaling factor is positively correlated with the image quality, and the acceptable range is the image quality range of difficult samples;
[0206] The determination module 703 is also used to determine the loss value based on the scaling factor adjusted by the adjustment module 704, the image recognition result recognized by the recognition module 702, and the training labels obtained by the acquisition module 701. The scaling factor is positively correlated with the loss value.
[0207] The adjustment module 704 is also used to adjust the network parameters of the image recognition network using the loss value determined by the determination module 703, and to call the recognition module 702 to perform the step of using the image recognition network to extract features from the sample images obtained by the acquisition module until the image recognition network converges. Then, the current image recognition network is used as the image recognition model, and the image recognition model is used to identify the specified object in the image.
[0208] Optionally, module 703 is determined, specifically for:
[0209] Feature extraction is performed on the feature map using an attention mechanism to obtain a recoded feature map;
[0210] The L2 norm is calculated for the recoded feature map, and the result is used as the image quality of the sample image.
[0211] Optionally, module 703 is determined, specifically for:
[0212] Determine the channel weights for each channel included in the feature map;
[0213] The recoded feature map is obtained by multiplying the features of each channel in the feature map by the channel weights.
[0214] Optionally, module 703 is determined, specifically for:
[0215] Global average pooling is performed on the feature map to obtain average pooled features;
[0216] The first sub-weight of each channel in the feature map is determined using a multilayer perceptron based on average pooling features.
[0217] Perform global max pooling on the feature map to obtain max pooled features;
[0218] The second sub-weights of each channel in the feature map are determined using a multilayer perceptron based on max pooling features.
[0219] The channel weight is determined based on the first and second sub-weights of each channel included in the feature map.
[0220] Optionally, adjust module 704, specifically for:
[0221] Based on the preset correspondence between each quality sub-range and the weight coefficient, the target weight coefficient corresponding to the quality sub-range to which the image quality belongs is determined. Among them, the image quality represented by each quality sub-range included in the quality compliance range is positively correlated with the corresponding weight coefficient, and the image quality represented by each quality sub-range included in the non-quality compliance range is negatively correlated with the corresponding weight coefficient.
[0222] Adjust the scaling factor to the product of the sample image quality and the target weight coefficient.
[0223] Optionally, module 703 is determined, specifically for:
[0224] Determine the error between the image recognition result and the training label;
[0225] The loss value is determined by multiplying the error by the adjusted scaling factor.
[0226] Based on the same inventive concept, embodiments of this application also provide an image recognition device, such as... Figure 8 As shown, the device includes: an acquisition module 801, a feature extraction module 802, and a recognition module 803;
[0227] The acquisition module 801 is used to acquire the image to be recognized;
[0228] The feature extraction module 802 is used to extract features from the image to be recognized acquired by the acquisition module 801 using an image recognition model to obtain a feature map, wherein the image recognition model is a model trained based on any of the methods in the first aspect.
[0229] The recognition module 803 is used to identify a specified object in the image to be recognized based on the feature map extracted by the feature extraction module 802 using an image recognition model.
[0230] Optionally, the device may also include:
[0231] The determination module is used to determine the image quality of the image to be recognized based on the feature map after the image recognition model extracts features from the image to be recognized. The image quality is used to represent the degree of integrity and / or sharpness of a specified object in the image.
[0232] The judgment module is used to determine whether the image quality of the image to be recognized is higher than the preset image quality using an image recognition model.
[0233] The calling module is used to call the recognition module 803 to perform the step of using the image recognition model to identify the specified object in the image to be recognized based on the feature map if the judgment result of the judgment module is yes;
[0234] The acquisition module 801 is also used to acquire the specified error data output by the image recognition model if the judgment result of the judgment module is negative.
[0235] This application also provides an electronic device, such as... Figure 9 As shown, it includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904. The processor 901, communication interface 902, and memory 903 communicate with each other via the communication bus 904.
[0236] Memory 903 is used to store computer programs;
[0237] The processor 901, when executing the program stored in the memory 903, implements the method steps in the above-mentioned image recognition model training method and image recognition method.
[0238] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0239] The communication interface is used for communication between the aforementioned terminal and other devices.
[0240] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0241] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0242] In another embodiment provided in this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, it implements the image recognition model training method and the image recognition method described in any of the above embodiments.
[0243] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the image recognition model training methods and image recognition methods described in the above embodiments.
[0244] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0245] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0246] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0247] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A method for training an image recognition model, characterized in that, The method includes: Acquire sample images and training labels, wherein the training labels are the standard recognition results of the sample images; The sample image is used to extract features using an image recognition network to obtain a feature map, and the image recognition result of the sample image is determined based on the feature map; Determine the image quality of the sample image, whereby the image quality represents the degree of completeness and / or sharpness of a specified object in the image; Based on the image quality, the scaling factor is adjusted; wherein, when the image quality is within the acceptable range, the magnification of the scaling factor is positively correlated with the image quality; when the image quality is outside the acceptable range, the reduction of the scaling factor is positively correlated with the image quality, and the acceptable range is the image quality range of difficult samples; Based on the adjusted scaling factor, the image recognition result, and the training label, a loss value is determined, wherein the scaling factor is positively correlated with the loss value. The network parameters of the image recognition network are adjusted using the loss value, and the step of using the image recognition network to extract features from the sample image is returned until the image recognition network converges. The current image recognition network is then used as the image recognition model, which is used to identify a specified object in the image.
2. The method according to claim 1, characterized in that, Determining the image quality of the sample image includes: The feature map is then processed using an attention mechanism to extract features, resulting in a recoded feature map. The L2 norm is calculated for the recoded feature map, and the calculation result is used as the image quality of the sample image.
3. The method according to claim 2, characterized in that, The step of extracting features from the feature map using an attention mechanism to obtain a recoded feature map includes: Determine the channel weights for each channel included in the feature map; The recoded feature map is obtained by multiplying the features of each channel in the feature map by the channel weights.
4. The method according to claim 3, characterized in that, Determining the channel weights of each channel in the feature map includes: The feature map is subjected to global average pooling to obtain average pooled features; Using a multilayer perceptron based on the average pooling features, the first sub-weight of each channel in the feature map is determined; The feature map is subjected to global max pooling to obtain max pooled features; The second sub-weights of each channel in the feature map are determined using the multilayer perceptron based on the max-pooling features; The channel weight is determined based on the first sub-weight and the second sub-weight of each channel included in the feature map.
5. The method according to any one of claims 1-4, characterized in that, Adjusting the scaling factor based on the image quality includes: Based on the preset correspondence between each quality sub-range and the weight coefficient, the target weight coefficient corresponding to the quality sub-range to which the image quality belongs is determined. The image quality represented by each quality sub-range included in the quality compliance range is positively correlated with the corresponding weight coefficient, while the image quality represented by each quality sub-range included in the non-quality compliance range is negatively correlated with the corresponding weight coefficient. The scaling factor is adjusted to be the product of the image quality of the sample image and the target weight factor.
6. The method according to any one of claims 1-4, characterized in that, The step of determining the loss value based on the adjusted scaling factor, the image recognition result, and the training labels includes: Determine the error between the image recognition result and the training label; The loss value is determined based on the product of the error and the adjusted scaling factor.
7. An image recognition method, characterized in that, The method includes: Acquire the image to be recognized; The image to be identified is subjected to feature extraction using an image recognition model to obtain a feature map, wherein the image recognition model is a model trained based on the method described in any one of claims 1-6; The image recognition model is used to identify a specified object in the image to be recognized based on the feature map.
8. The method according to claim 7, characterized in that, After extracting features from the image to be recognized using an image recognition model to obtain a feature map, the method further includes: The image quality of the image to be identified is determined using the image recognition model based on the feature map, whereby the image quality represents the degree of completeness and / or sharpness of a specified object in the image. The image recognition model is used to determine whether the image quality of the image to be recognized is higher than the preset image quality. If so, then the step of using the image recognition model to identify the specified object in the image to be recognized based on the feature map is performed; If not, then obtain the specified error data output by the image recognition model.
9. An image recognition model training device, characterized in that, The device includes: The acquisition module is used to acquire sample images and training labels, wherein the training labels are the standard recognition results of the sample images; The recognition module is used to extract features from the sample image acquired by the acquisition module using an image recognition network to obtain a feature map, and to determine the image recognition result of the sample image based on the feature map; A determination module is used to determine the image quality of the sample image, wherein the image quality is used to represent the degree of integrity and / or sharpness of a specified object in the image; An adjustment module is used to adjust the scaling factor based on the image quality determined by the determining module; wherein, when the image quality is within the acceptable range, the magnification of the scaling factor is positively correlated with the image quality; when the image quality is outside the acceptable range, the reduction of the scaling factor is positively correlated with the image quality, and the acceptable range is the image quality range of difficult samples; The determining module is further configured to determine a loss value based on the scaling factor adjusted by the adjusting module, the image recognition result recognized by the recognition module, and the training labels obtained by the acquiring module, wherein the scaling factor is positively correlated with the loss value; The adjustment module is further configured to adjust the network parameters of the image recognition network using the loss value determined by the determination module, and call the recognition module to perform the step of using the image recognition network to extract features from the sample image obtained by the acquisition module, until the image recognition network converges, and use the current image recognition network as the image recognition model, which is used to identify a specified object in the image.
10. An image recognition device, characterized in that, The device includes: The acquisition module is used to acquire the image to be recognized; The feature extraction module is used to extract features from the image to be recognized acquired by the acquisition module using an image recognition model to obtain a feature map, wherein the image recognition model is a model trained based on the method described in any one of claims 1-6; The recognition module is used to identify a specified object in the image to be recognized based on the feature map extracted by the feature extraction module using the image recognition model.
11. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method according to any one of claims 1-6, 7, or 8.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-6, 7, or 8.