Image recognition methods, devices, equipment, media and program products
By converting images into color mode maps and obtaining the weights of color mode values, a color feature map is constructed and fused with a deep neural network feature map. This solves the problem that deep neural networks are susceptible to noise interference and improves recognition accuracy.
Patent Information
- Application Number
- CN202210841430.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-18
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2042-07-18
AI Technical Summary
Deep neural networks are susceptible to artificially added noise, leading to recognition errors. Existing preprocessing methods are ineffective and have a high false recognition rate.
The image to be processed is converted into a color mode map, the weights of the color mode values are obtained, a color feature map is constructed, and it is then weighted and fused with the feature map of the deep neural network to improve the anti-interference ability.
It improves the recognition accuracy of deep neural networks when faced with artificially added noise images and enhances their anti-interference ability.
Smart Images

Figure CN115187813B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology, and more particularly to an image recognition method, apparatus, device, medium, and program product. Background Technology
[0002] Deep neural networks are widely used in image recognition. However, research has shown that if noise that is imperceptible to the human eye is deliberately added to an image, it may deceive the deep neural network and cause recognition errors. Therefore, intervention is needed to address this situation.
[0003] In the prior art, in order to avoid the above situation, various preprocessing devices are added in advance to purify the image in order to filter out as much artificially added noise as possible, and then the purified image is used as the input of a deep neural network for image recognition.
[0004] However, the above method is very ineffective at filtering out noise during preprocessing, which results in a large recognition error rate in the subsequent deep neural network. Summary of the Invention
[0005] This application provides an image recognition method, apparatus, device, medium, and program product to address the problem that existing deep neural networks are easily affected by noise and suffer from misclassification.
[0006] In a first aspect, embodiments of this application provide an image recognition method, including:
[0007] Obtain the image to be processed, convert the image to be processed into a color mode map, the image to be processed includes at least one category object to be identified and the category object to be identified includes at least one element, and the color mode map includes the color mode value of each element;
[0008] Based on the color mode value of each element in the color mode diagram, obtain the color weight of each color mode value from the preset color weight model;
[0009] Based on the color mode map and the color weight of each color mode value, a color feature map is obtained;
[0010] The color feature map and the feature map in the preset deep neural network are weighted and fused to obtain a fused feature map. The fused feature map is used by the preset deep neural network to identify the category of the image to be processed. The feature map is obtained by the preset deep neural network processing the image to be processed.
[0011] In one possible design of the first aspect, converting the image to be processed into a color mode map includes:
[0012] Obtain the parameter value of each element in the image to be processed under a preset color mode, wherein each element in the image to be processed under the preset color mode includes at least two parameter values;
[0013] Based on the parameter value of each element, obtain the color mode value of each element;
[0014] The image to be processed is converted into the color mode map based on the color mode value of each element.
[0015] In another possible design of the first aspect, obtaining the color mode value of each element based on the parameter value of each element includes:
[0016] Convert each parameter value of each element into a binary value;
[0017] According to the preset numerical range, perform a binary shift operation on each binary value to obtain the shifted binary value;
[0018] Based on the shifted binary value, obtain the color mode value of each element.
[0019] In another possible design of the first aspect, the method further includes:
[0020] Acquire at least one set of image data, each set of image data including at least one training image, each training image including a category object, and the category objects included in each training image of each set of image data belong to the same category;
[0021] Each training image is converted into the color mode map, and the probability distribution of each color mode value in each color mode map is obtained.
[0022] Based on the distribution probability of each color mode value in each color mode map, obtain the color weight of the color mode value of each element in the category object;
[0023] The preset color weight model is obtained based on the color weight of each element's color mode value.
[0024] In another possible design of the first aspect, obtaining the color weight of the color mode value of each element in the category object based on the distribution probability of each color mode value in each color mode map includes:
[0025] Based on the probability distribution of each color mode value in each color mode image and the total number of training images, obtain the first average probability distribution of the category object in the training images;
[0026] Based on the first average distribution probability and the number of categories of the category objects, obtain the second average distribution probability;
[0027] Based on the first average distribution probability and the second average distribution probability, obtain the color weight of the color mode value of each element in the category object.
[0028] In another possible design of the first aspect, obtaining the color feature map based on the color mode map and the color weight of each color mode value includes:
[0029] Obtain the number of color weights for each color mode value in the color mode diagram;
[0030] The number of channels in the color feature map is determined based on the number of color weights.
[0031] The color feature map is constructed based on the color mode map, the number of channels, and the color weight of each color mode value.
[0032] In another possible design of the first aspect, obtaining the number of color weights for each color mode value in the color mode diagram includes:
[0033] Obtain the number of categories of the object to be identified;
[0034] Based on the number of categories of the object to be identified, obtain the number of color weights for each color mode value in the color mode diagram.
[0035] Secondly, embodiments of this application provide an image recognition device, comprising:
[0036] An image conversion module is used to acquire an image to be processed and convert the image to be processed into a color mode map. The image to be processed includes at least one category object to be identified, and the category object to be identified includes at least one element. The color mode map includes the color mode value of each element.
[0037] The weight acquisition module is used to acquire the color weight of each color mode value from a preset color weight model based on the color mode value of each element in the color mode diagram.
[0038] The feature map acquisition module is used to acquire a color feature map based on the color mode map and the color weight of each color mode value;
[0039] The image fusion module is used to perform weighted fusion of the color feature map and the feature map in the preset deep neural network to obtain a fused feature map. The fused feature map is used by the preset deep neural network to identify the category of the image to be processed. The feature map is obtained by the preset deep neural network processing the image to be processed.
[0040] Thirdly, embodiments of this application provide a computer device, including: a processor, and a memory communicatively connected to the processor;
[0041] The memory stores computer-executed instructions;
[0042] The processor executes computer execution instructions stored in the memory to implement the above-described method.
[0043] Fourthly, embodiments of this application provide a readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the above-described method.
[0044] Fifthly, embodiments of this application provide a computer program product, including computer execution instructions, which, when executed by a processor, implement the above-described method.
[0045] The image recognition method, apparatus, device, medium, and program products provided in this application first convert the image to be processed into a color mode map when the deep neural network recognizes the image to be processed, and obtain the weights of the color mode values in the color mode map. Based on the weights, a color feature map is constructed, and then fused with the feature map of the deep neural network. This can improve the anti-interference ability of the deep neural network, so that the deep neural network can accurately recognize and classify images with artificially added noise, thereby improving the recognition accuracy. Attached Figure Description
[0046] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application;
[0047] Figure 1 This is a schematic diagram of an image recognition process based on a deep neural network, provided in an embodiment of this application.
[0048] Figure 2 A schematic flowchart illustrating the image recognition method provided in this application embodiment;
[0049] Figure 3 This is a schematic diagram of image conversion provided in this embodiment;
[0050] Figure 4 A schematic diagram illustrating the construction process of the preset color weight model provided in this application embodiment;
[0051] Figure 5 A schematic diagram illustrating the process of obtaining color weights as provided in an embodiment of this application;
[0052] Figure 6 This is a schematic diagram of the structure of the image recognition device according to an embodiment of this application;
[0053] Figure 7 A schematic diagram of the structure of a computer device provided in an embodiment of this application.
[0054] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0055] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0056] It should be noted that the image recognition methods, apparatus, devices, media, and program products disclosed herein can be used in the financial field. They can also be used in any field other than finance, such as the field of biometrics. The application areas of the image recognition methods, apparatus, devices, media, and program products disclosed herein are not limited.
[0057] First, let me explain the terms used in this application:
[0058] Deep Neural Networks (DNNs) are a technique in the field of machine learning. Currently, commonly used deep neural network models include Convolutional Neural Networks (CNNs) and Recursive Neural Networks (RNNs). Convolutional Neural Networks (CNNs) are a representative algorithm of deep learning. They are a type of feedforward neural network that includes convolutional computations and has a deep structure. They can automatically learn features from large-scale data and generalize the results to unknown data of the same type. Deep neural networks are widely used in image recognition. As researchers have studied them, deep neural networks have become increasingly sophisticated, extracting richer and richer features. However, while deep neural networks have developed rapidly, a researcher discovered a strange phenomenon: adding noise imperceptible to the human eye to an image can trick deep neural networks into misclassifying it. This poses a significant challenge to the application of deep neural networks in fields such as transportation and banking.
[0059] Figure 1 This is a schematic diagram of an image recognition process based on a deep neural network provided in an embodiment of this application, such as... Figure 1 As shown, after feature extraction from the input image by a deep neural network, a feature map is obtained. The deep neural network then uses this feature map to determine the category of the object in the input image, thus classifying the input image. For example, taking a cat as an example, the deep neural network, through feature extraction and recognition, determines that the object in the input image is a cat and classifies the input image into the "cat" category. In practical applications, if noise imperceptible to the human eye is added to the input image, it can deceive the deep neural network into misclassifying it. For instance, the deep neural network might incorrectly classify an input image that should be classified as "cat" as "dog" due to noise interference. In the financial field, which involves numerous image processing operations, intentionally adding interference factors to the input image in deep neural network recognition scenarios would severely disrupt the normal operation of banking business, posing a significant risk to transactions. Therefore, improving the security and stability of image recognition is an unavoidable issue. In related technologies, two main approaches are mentioned to improve the security and stability of image recognition. One approach is based on enhancing the robustness of the deep network itself, which achieves anti-interference by incorporating adversarial examples into the training data. However, this requires extensive training, is costly, and is not stable enough. The other approach involves adding various preprocessing devices, such as cleaning the input image before feeding it into the deep neural network. However, the false positive and false negative rates remain relatively high.
[0060] To address the aforementioned issues, the image recognition methods, apparatus, devices, media, and program products provided in this application aim to improve the anti-interference capability of deep neural networks in order to enable them to accurately classify and recognize images with added noise. Specifically, when the deep neural network recognizes the image to be processed, it first converts the image into a color mode map and obtains the weights of the color mode values in the color mode map. Based on the weights, a color feature map is constructed and then fused with the feature map of the deep neural network. This improves the anti-interference capability of the deep neural network, enabling it to accurately classify and recognize images with added noise, thereby increasing the recognition accuracy.
[0061] The technical solution of this application will now be described in detail through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0062] Figure 2This is a flowchart illustrating the image recognition method provided in an embodiment of this application. The method can be applied to a computer device. Taking a computer device as the executing entity as an example, the method includes the following steps:
[0063] Step S201: Obtain the image to be processed and convert it into a color mode map. The image to be processed includes at least one category object to be identified, and each category object includes at least one element. The color mode map includes the color mode value for each element.
[0064] In this embodiment, the category objects in the image to be processed may include cats, dogs, birds, vehicles, etc., and each image to be processed may include one or more category objects (for example, including both cats and dogs). An element can refer to a pixel at a certain location in the image to be processed, and typically there are K pixels in the image to be processed (K is a positive integer greater than 1).
[0065] In this embodiment, when converting the image to be processed into a color mode map, the conversion can be performed based on the parameter values of each pixel in the image. Specifically, the parameter values of each pixel are obtained (the parameter values can be the color channel values of the pixel, such as the common red-green-blue color mode image (also known as an RGB image), where each pixel has corresponding channel values in the red (R), green (G), and blue (B) channels), then transcoding is performed based on the parameter values of each pixel to obtain the color mode value corresponding to each pixel, and finally, a color mode map is constructed based on the color mode values of each pixel.
[0066] Step S202: Based on the color mode value of each element in the color mode diagram, obtain the color weight of each color mode value from the preset color weight model.
[0067] In this embodiment, the preset color weight model is constructed from several training images. Specifically, the preset color weight model can be expressed as:
[0068]
[0069] In the above formula, X represents the total number of category objects, where each training image includes one category object (e.g., cat, dog, bird, or vehicle), and different training images may include different category objects. x represents the category object (e.g., cat, dog, bird, or vehicle), and i represents the color mode value. M represents the color weight of category object x at color mode value i. x This indicates a preset color weight model.
[0070] Step S203: Obtain the color feature map based on the color mode map and the color weight of each color mode value.
[0071] In this embodiment, for each position n in the color mode diagram, there is a corresponding color mode value Z(n). Based on this color mode value Z(n), x color weights can be obtained from the preset color weight model. Based on these color weights and the color mode diagram Z... w×h (Where w represents width and h represents height), a color feature map G can be generated. w×h×x .
[0072] Step S204: Weightedly fuse the color feature map and the feature map in the preset deep neural network to obtain a fused feature map. The fused feature map is used by the preset deep neural network to identify the category of objects in the image to be processed.
[0073] In this embodiment, when the deep neural network identifies target category objects, pooling technology can be used to weight and fuse the color feature map and the feature map of the deep neural network at different levels. This can improve the anti-interference ability of the deep neural network and enhance its robustness and accuracy in the direction of target category object recognition.
[0074] This application embodiment converts an image into a color mode map, obtains the weights of the color mode values in the color mode map, constructs a color feature map based on the weights, and then fuses it with the feature map of a deep neural network. This can improve the anti-interference ability of the deep neural network, enabling the deep neural network to accurately identify and classify images with artificially added noise, thereby improving the recognition accuracy.
[0075] In some embodiments, converting the image to be processed into a color mode image can be achieved through the following steps: obtaining the parameter value of each element in the image to be processed under a preset color mode; obtaining the color mode value of each element based on the parameter value of each element; and converting the image to be processed into a color mode image based on the color mode value of each element. Each element in the image to be processed under the preset color mode includes at least two parameter values.
[0076] In this embodiment, the parameter value can refer to the channel value of each element. The preset color mode can be the hue-saturation-value color mode (also known as the HSV color mode). In the HSV color mode, each element has three channel values, namely the hue (H) value, the saturation (S) value, and the value (V) value.
[0077] For example, let the image to be processed be I w×h×3(w represents width, h represents height, and 3 indicates that the image to be processed is in three-channel color mode). The image to be processed, I, is converted into a color mode image, Z, using the mode encoding operation θ. w×h This is denoted as: Z = θ(I)
[0078] The mode encoding operation θ is a binary representation of the hue-saturation-brightness color model. Specifically, it quantizes the values of the H, S, and V channels of the image to be processed to the range [0, 12) through binary shifting. For example, with the three channel values at position n of the image to be processed being (n1, n2, n3), the final color mode value obtained by the mode encoding operation θ is Z(n), where Z(n) takes the value [0, 4095].
[0079] This application embodiment converts the image to be processed into a color pattern map, which enables the learning and storage of important color features and allows for the rapid acquisition of corresponding color weights for targets of interest, thereby improving the deep neural network's ability to identify key targets.
[0080] Furthermore, in some embodiments, the color mode value can be obtained through the following steps: converting each parameter value of each element into a binary value; performing a binary shift operation on each binary value according to a preset numerical range to obtain the shifted binary value; and obtaining the color mode value of each element based on the shifted binary value.
[0081] In this embodiment, the preset data range can be between [0, 12), and the specific calculation process of the binary shift operation can be expressed as follows:
[0082] Z=θ(I=(I) H >>4)<<8+(I S >>4)<<4+(I V >>4)
[0083] In the above formula, I H This represents the value of the image I to be processed in the H channel. S This represents the value of the image I to be processed in the S channel. V This represents the value of the image I to be processed in the V channel. Each position n in the color mode map obtained by performing pattern encoding on the image I has a corresponding binary value Z(n) as the color mode value. The value range of Z(n) is [0, 4095].
[0084] For example, Figure 3 This is a schematic diagram of image conversion provided in this embodiment, such as... Figure 3 As shown, each position n in the image to be processed has a corresponding (I H IS I V ), that is, the channel value, is the color mode map obtained after the mode encoding operation. The position n corresponds to a binary value Z(n).
[0085] This application embodiment uses a three-channel color mode encoding to express a color weighted model. The values of the three channels are quantized to a preset value range by binary shifting, which can reduce the amount of calculation after mode encoding while maintaining the color feature expression level of the verification.
[0086] In other embodiments, Figure 4 This is a schematic diagram illustrating the construction process of the preset color weight model provided in the embodiments of this application, as follows: Figure 4 As shown, the specific steps include: Step S401, acquiring at least one set of image data. Each set of image data includes at least one training image, each training image includes a category object, and the category objects included in each training image of each set of image data belong to the same category. Step S402, converting each training image into a color mode map, and obtaining the distribution probability of each color mode value in each color mode map. Step S403, based on the distribution probability of each color mode value in each color mode map, obtaining the color weight of the color mode value of each element in the category object. Step S404, based on the color weight of the color mode value of each element, obtaining a preset color weight model.
[0087] For example, the training images can be grouped according to different categories. For instance, there are three groups of training images: the first group has 20 images, each containing the category of cat; the second group has 20 images, each containing the category of dog; and the third group has 20 images, each containing the category of bird.
[0088] In this embodiment, in a visual scene, observed targets will always cluster within a certain statistical interval due to similar features such as intensity and color. This distinguishes them from background target features. Therefore, for the color pattern map after pattern encoding, each training image can be converted into a color pattern map through the color pattern encoding operation described above. Then, the distribution probability of each color pattern value is obtained statistically using a histogram.
[0089] The probability distribution can be expressed as:
[0090]
[0091] In the above formula, P x,j Denotes the probability distribution. θ(I) represents the probability of color mode value i occurring in the j-th training image of the x-th category object. Histogram is the statistical histogram function.x,j ) represents the color pattern map of the j-th training image, which includes objects of the x-th category.
[0092] In this embodiment, the higher the occurrence frequency (i.e., distribution probability) of color mode value i of category x, the higher the weight of category x; conversely, the lower the occurrence frequency (i.e., distribution probability), the lower the weight of category x. This is used to construct the preset color weight model.
[0093] The embodiments of this application construct a color weight model, which can weight the feature maps of deep neural networks, thereby improving the anti-interference ability and recognition ability of deep neural networks.
[0094] Furthermore, Figure 5 This is a schematic diagram of the color weight acquisition process provided in the embodiments of this application, such as... Figure 5 As shown, step S403 can be implemented through the following steps: Step S501, obtain the first average distribution probability of the category object in the training images based on the distribution probability of each color mode value in each color mode image and the total number of training images. Step S502, obtain the second average distribution probability based on the first average distribution probability and the number of categories of the category object. Step S503, obtain the color weight of the color mode value of each element in the category object based on the first average distribution probability and the second average distribution probability.
[0095] In this embodiment, the probability distribution of color mode values for objects of the same category can be calculated by averaging the probability distributions of all color mode values within that category, specifically expressed as follows:
[0096]
[0097] In the above formula, P x Let X represent the probability of the first average distribution. j This represents the total number of training images corresponding to a certain category of objects. This represents the probability of color mode value i occurring in the j-th training image of the x-th category object.
[0098] While this statistically accumulates the distribution probabilities of color mode values for different categories of objects, it still falls short of representing color weights. Image information in a visual scene is competitive, based on human cognitive experience. From the perspective of a pre-defined color weight model, if the color mode value i of category x occurs frequently, then this category's color mode value should be given higher weight, meaning more image information resources. Conversely, color mode values of categories with low occurrence frequencies should be allocated fewer information resources. Therefore, statistically analyzing the color mode probabilities of all training images to simulate a natural scene is expressed as:
[0099]
[0100] In the above formula, N represents the second average distribution probability, n i X represents the average probability distribution of the color mode value i, and X represents the total number of categories of objects. This represents the probability of color mode value i occurring for category object x.
[0101] In this embodiment, based on the first and second average distribution probabilities described above, a preset color weight model can be constructed:
[0102]
[0103] In the above formula, M x For the preset color weight model, The color weight represents the color mode value I of category object x. n represents the probability of color mode value i occurring for category object x. i This represents the average probability distribution of the color mode value i.
[0104] This application embodiment further defines the specific calculation process of the color weight model. If a certain color mode value of a category object occurs more frequently, it is given a higher weight. At the same time, by introducing a visual competition mechanism, the saliency expression of the model is improved.
[0105] Based on the above embodiments, in some embodiments, when obtaining the distribution probability of each color mode value in each color mode map, the occurrence frequency of each color mode value in each color mode map can be obtained, and then the distribution probability of each color mode value in each color mode map can be obtained based on the occurrence frequency and the total number of color mode values in the color mode map.
[0106] In this embodiment, the probability distribution of each color mode value can be statistically analyzed by establishing a coordinate system. Specifically, the color mode value i is used as the horizontal axis (with values in the range of [0, 4095]), and the number of times each color mode value appears in each color mode image is counted as the vertical axis. After the statistics are completed, the probability distribution of each color mode value can be determined.
[0107] This application embodiment obtains the color mode probability distribution of category object x in each training image by constructing a coordinate system and performing statistical methods. In this way, it can be fitted to the visual scene, and the observed targets are aggregated in a certain statistical interval due to similar features such as intensity and color to distinguish background target features.
[0108] In some embodiments, step S203 can be implemented by the following steps: obtaining the number of color weights for each color mode value in the color mode map; determining the number of channels in the color feature map based on the number of color weights; and constructing the color feature map based on the color mode map, the number of channels, and the color weights for each color mode value.
[0109] In this embodiment, for each point n in the color mode diagram, Z(n) represents the color mode value of that point. Based on the color mode value Z(n), the aforementioned preset color weight model M is read. x When the color mode value Z(n) is used, the color weight corresponding to the color mode value Z(n) is taken as the color feature at position n in the color mode map. For each color mode map, position n can be determined using a preset color weight model M. x Having read x color features, a multi-channel color feature map G can ultimately be constructed. w×h×x .
[0110] This application further defines that for each color mode map, x color features can be read at each element position using a color weight model to generate a color feature map with x channels.
[0111] Furthermore, in some embodiments, when determining the number of color weights, the number of categories of the object to be identified can be obtained; based on the number of categories of the object to be identified, the number of color weights for each color mode value in the color mode diagram can be obtained.
[0112] In this embodiment, the number of category objects is related to the number of color weights. For each color pattern image, x color weights can be read at position n using a preset color weight model. Taking the image to be processed as an example, if the image to be processed contains x category objects, then at position n, x probability distributions can be indexed from the preset color weight model based on the color pattern value Z(n), and each probability distribution corresponds to a weight.
[0113] This application embodiment further limits the number of category objects x and determines the number of color weights (i.e. color features) read, which are then used as the color feature map to perform weighted fusion with the feature map in the deep neural network to obtain a fused feature map, thereby improving the anti-interference ability of the deep neural network.
[0114] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0115] Figure 6This is a schematic diagram of the structure of an image recognition device according to an embodiment of this application. The image recognition device can be integrated into a computer device, or it can be implemented independently of a computer device while cooperating with it. Figure 6 As shown, the image recognition device 600 includes an image conversion module 610, a weight acquisition module 620, a feature map acquisition module 630, and an image fusion module 640. The image conversion module 610 acquires an image to be processed and converts it into a color mode map. The image to be processed includes at least one category object to be identified, and the category object includes at least one element. The color mode map includes the color mode value of each element. The weight acquisition module 620 acquires the color weight of each color mode value from a preset color weight model based on the color mode value of each element in the color mode map. The feature map acquisition module 630 acquires a color feature map based on the color mode map and the color weight of each color mode value. The image fusion module 640 performs a weighted fusion of the color feature map and the feature map in a preset deep neural network to obtain a fused feature map. The fused feature map is used by the preset deep neural network to identify the category object in the image to be processed; the feature map is obtained by the preset deep neural network processing the image to be processed.
[0116] In some embodiments, the image conversion module described above can be specifically used to: obtain the parameter value of each element in the image to be processed under a preset color mode; obtain the color mode value of each element based on the parameter value of each element; and convert the image to be processed into a color mode image based on the color mode value of each element. Each element in the image to be processed under the preset color mode includes at least two parameter values.
[0117] Optionally, in some embodiments, the image conversion module described above can be used to: convert each parameter value of each element into a binary value; perform a binary shift operation on each binary value according to a preset numerical range to obtain the shifted binary value; and obtain the color mode value of each element based on the shifted binary value.
[0118] In some embodiments, the image recognition device may further include a model building module, configured to acquire at least one set of image data; convert each training image into a color mode map, and acquire the distribution probability of each color mode value in each color mode map; acquire the color weight of the color mode value of each element in the category object based on the distribution probability of each color mode value in each color mode map; and acquire a preset color weight model based on the color weight of the color mode value of each element. Each set of image data includes at least one training image, each training image includes a category object, and the category objects included in each training image of each set of image data belong to the same category.
[0119] Optionally, in some embodiments, the above-mentioned model building module may be specifically used to: obtain a first average distribution probability of the category object in the training images based on the distribution probability of each color mode value in each color mode image and the total number of training images; obtain a second average distribution probability based on the first average distribution probability and the number of categories of the category object; and obtain the color weight of the color mode value of each element in the category object based on the first average distribution probability and the second average distribution probability.
[0120] Optionally, in some embodiments, the above-mentioned model building module can be specifically used to: obtain the occurrence count of each color mode value in each color mode map; and obtain the distribution probability of each color mode value in each color mode map based on the occurrence count and the total number of color mode values in the color mode map.
[0121] In some embodiments, the feature map acquisition module described above can be used to: acquire the number of color weights for each color mode value in the color mode map; determine the number of channels in the color feature map based on the number of color weights; and construct a color feature map based on the color mode map, the number of channels, and the color weights for each color mode value.
[0122] Optionally, in some embodiments, the feature map acquisition module described above can be specifically used to: acquire the number of categories of the category object to be identified; and acquire the number of color weights for each color mode value in the color mode map based on the number of categories of the category object to be identified.
[0123] The apparatus provided in this application embodiment can be used to execute the methods in the above embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.
[0124] It should be noted that the division of the various modules in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely in software via processing elements; they can be fully implemented in hardware; or some modules can be implemented by processing elements calling software, while others are implemented in hardware. For example, the image conversion module can be a separate processing element, or it can be integrated into a chip in the above device. Alternatively, it can be stored as program code in the memory of the above device, and its functions can be called and executed by a processing element. The implementation of other modules is similar. Moreover, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.
[0125] Figure 7 A schematic diagram of the structure of a computer device provided in an embodiment of this application. For example... Figure 7 As shown, the computer device 700 includes at least one processor 710, a memory 720, a bus 730, and a communication interface 740. The processor 710, communication interface 740, and memory 720 communicate with each other via the bus 730. The communication interface 740 is used to communicate with other devices. This communication interface includes a communication interface for data transmission and a display interface or operation interface for human-computer interaction. The processor 710 executes computer execution instructions stored in the memory 720, specifically performing the relevant steps in the methods described in the above embodiments. The processor may be a central processing unit, an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computer device may be processors of the same type, such as one or more CPUs; or they may be processors of different types, such as one or more CPUs and one or more ASICs.
[0126] Memory 720 is used to store instructions executed by the computer. Memory may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device.
[0127] This embodiment also provides a readable storage medium storing computer instructions. When at least one processor of a computer device executes the computer instructions, the computer device performs the image recognition method provided in the various embodiments described above.
[0128] This embodiment also provides a program product including computer instructions stored in a readable storage medium. At least one processor of a computer device can read the computer instructions from the readable storage medium, and the at least one processor executes the computer instructions to cause the computer device to implement the image recognition methods provided in the various embodiments described above.
[0129] In this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates an "or" relationship between the preceding and following related objects; in formulas, the character " / " indicates a "division" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0130] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application. In the embodiments of this application, the order of the above-mentioned process numbers does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0131] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. An image recognition method, characterized in that, include: Obtain the image to be processed; Obtain the parameter value of each element in the image to be processed under a preset color mode, wherein each element in the image to be processed under the preset color mode includes at least two parameter values; Convert each parameter value of each element into a binary value; According to the preset numerical range, perform a binary shift operation on each binary value to obtain the shifted binary value; Based on the shifted binary value, obtain the color mode value of each element; The image to be processed is converted into a color mode map based on the color mode value of each element. The image to be processed includes at least one category object to be identified, and the category object to be identified includes at least one element. The color mode map includes the color mode value of each element. Based on the color mode value of each element in the color mode diagram, obtain the color weight of each color mode value from the preset color weight model; Based on the color mode map and the color weight of each color mode value, a color feature map is obtained; The color feature map and the feature map in the preset deep neural network are weighted and fused to obtain a fused feature map. The fused feature map is used by the preset deep neural network to identify the category of the image to be processed. The feature map is obtained by the preset deep neural network processing the image to be processed. The method further includes: acquiring at least one set of image data, each set of image data including at least one training image, each training image including a category object and the category objects included in each training image of each set of image data belonging to the same category; Each training image is converted into the color mode map, and the probability distribution of each color mode value in each color mode map is obtained. Based on the distribution probability of each color mode value in each color mode map, obtain the color weight of the color mode value of each element in the category object; The preset color weight model is obtained based on the color weight of each element's color mode value.
2. The method according to claim 1, characterized in that, The step of obtaining the color weight of the color mode value of each element in the category object based on the distribution probability of each color mode value in each color mode map includes: Based on the probability distribution of each color mode value in each color mode image and the total number of training images, obtain the first average probability distribution of the category object in the training images; Based on the first average distribution probability and the number of categories of the category objects, obtain the second average distribution probability; Based on the first average distribution probability and the second average distribution probability, obtain the color weight of the color mode value of each element in the category object.
3. The method according to claim 1, characterized in that, The step of obtaining the distribution probability of each color mode value in each color mode image includes: Get the number of occurrences of each color mode value in each color mode image; Based on the occurrence frequency and the total number of color mode values in the color mode diagram, obtain the distribution probability of each color mode value in each color mode diagram.
4. The method according to claim 1, characterized in that, The step of obtaining a color feature map based on the color mode map and the color weight of each color mode value includes: Obtain the number of color weights for each color mode value in the color mode diagram; The number of channels in the color feature map is determined based on the number of color weights. The color feature map is constructed based on the color mode map, the number of channels, and the color weight of each color mode value.
5. The method according to claim 4, characterized in that, The step of obtaining the number of color weights for each color mode value in the color mode diagram includes: Obtain the number of categories of the object to be identified; Based on the number of categories of the object to be identified, obtain the number of color weights for each color mode value in the color mode diagram.
6. An image recognition apparatus, wherein the image recognition apparatus is used to implement the image recognition method according to any one of claims 1-5 when executed, characterized in that, include: An image conversion module is used to acquire an image to be processed and convert the image to be processed into a color mode map. The image to be processed includes at least one category object to be identified, and the category object to be identified includes at least one element. The color mode map includes the color mode value of each element. The weight acquisition module is used to acquire the color weight of each color mode value from a preset color weight model based on the color mode value of each element in the color mode diagram. The feature map acquisition module is used to acquire a color feature map based on the color mode map and the color weight of each color mode value; The image fusion module is used to perform weighted fusion of the color feature map and the feature map in the preset deep neural network to obtain a fused feature map. The fused feature map is used by the preset deep neural network to identify the category of the image to be processed. The feature map is obtained by the preset deep neural network processing the image to be processed.
7. A computer device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-5.
8. A readable storage medium, characterized in that, The readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-5.
9. A computer program product comprising computer-executable instructions, characterized in that, When the computer executes the instructions, the processor performs the method described in any one of claims 1-5.
Citation Information
Patent Citations
Static gesture image recognition method based on multi-feature fusion
CN111160194A
Image recognition method and device, electronic equipment and storage medium
CN113537248A