An image recognition method, device, electronic equipment and storage medium
By converting images into original image tensors and training tensor shrunk, the problems of inaccurate feature extraction and excessive parameters in image recognition are solved, achieving more efficient and accurate target recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA CONSTRUCTION BANK
- Filing Date
- 2022-05-20
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, target feature extraction in image recognition methods is not accurate enough, and the training parameters of convolutional neural networks are too numerous, resulting in a large computational burden and affecting the accuracy and efficiency of image recognition.
The image to be recognized is converted into an original image tensor, and tensor shrunk by training a preset target recognition model to reduce redundant parameters, extract high-order tensors as target features, and preserve the geometric structure of the image.
It improves the accuracy of target features and image recognition, reduces the training parameter requirements of the model, and enhances feature extraction efficiency.
Smart Images

Figure CN115205613B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision processing technology, and in particular to an image recognition method, apparatus, electronic device, and storage medium. Background Technology
[0002] Image recognition (IR) is a computer vision processing technology that uses neural networks, deep learning, and other methods to extract image features that represent the differentiated information of a target object from a specified image. Based on the matching results of the extracted target features and preset sample features, it identifies and authenticates the accurate identity of the target object. It has played an important role in fields such as intelligent monitoring and public safety.
[0003] Specifically, related technologies commonly employ a local perception approach, combining a specified number of local features perceived from the input image to obtain more comprehensive image features. For example, in Convolutional Neural Networks (CNNs), the target image in the input network model is convolved with several convolutional kernels (also called filters) in the convolutional layer according to their set strides, thereby rearranging the obtained convolutional integrals to extract the corresponding target features.
[0004] However, since the integral values extracted in the above process only represent some of the features contained in the target image, the target features obtained after rearranging the obtained integral values in the above manner often cannot accurately contain the original structural information in the target image, resulting in insufficient accuracy of the obtained target features and affecting the accuracy of image recognition.
[0005] On the other hand, during the processing of the target image by the convolution kernel, the network model learns multiple training parameters for the target object under the above conditions based on factors such as the size and number of the currently selected convolution kernel. When the size of the convolution kernel is small and the number of convolution kernels is large, the training parameters of the network model increases significantly, resulting in a large computational burden and affecting the efficiency of target feature extraction. Summary of the Invention
[0006] This application provides an image recognition method, apparatus, electronic device, and storage medium to improve the efficiency and accuracy of target feature extraction.
[0007] In a first aspect, embodiments of this application provide an image recognition method, including:
[0008] Obtain the image to be identified containing the target object, transform the image to be identified, and obtain the corresponding original image tensor.
[0009] Based on a preset target recognition model, the original image tensor is condensed using a set training tensor to obtain the target features of the target object, wherein the target features are located at a specified data order.
[0010] From a pre-defined feature information database, at least one feature information that matches the target feature is obtained, and based on the obtained feature information, the target recognition result of the target object is determined.
[0011] Secondly, embodiments of this application provide an image recognition device, comprising:
[0012] The acquisition module is used to acquire the image to be recognized containing the target object, transform the image to be recognized, and obtain the corresponding original image tensor.
[0013] The feature extraction module is used to condense the original image tensor using a set training tensor based on a preset target recognition model to obtain the target features of the target object, wherein the target features are located at a specified data order.
[0014] The recognition module is used to obtain at least one feature information that matches the target feature from a preset feature information database, and to determine the target recognition result of the target object based on the obtained feature information.
[0015] In an optional embodiment, before acquiring the image to be identified containing the target object, the acquisition module is further configured to:
[0016] Obtain a training sample set, wherein each training sample includes: input information for determining the object category of the target object and entity labels.
[0017] Using training samples from the training sample set, the preset image recognition model is trained iteratively through multiple rounds. When the preset convergence condition is met, the target recognition model is output. During one round of iterative training, the following operations are performed:
[0018] An image recognition model is used to obtain corresponding prediction results based on the input information in the training samples. The training parameters of the image recognition model are then adjusted based on the loss value between the prediction results and the corresponding entity labels.
[0019] In one optional embodiment, based on a preset target recognition model, the original image tensor is shrunk using a set training tensor to obtain the target features of the target object. The feature extraction module is specifically used for:
[0020] Using M pre-defined shrinking filters as training tensors, the original image tensor is shrunk to obtain the target features of the target object. Here, M is an integer greater than or equal to one, the shrinking filters are at the same data order as the original image tensor, and the shrinking filters contain at least one data metric that is the same as the original image tensor.
[0021] or,
[0022] Based on a preset L convolution kernels, the original image tensor is convolved, and the preset M shrinking filters are used as training tensors to shrink the convolved original image tensor to obtain the target features of the target object, where L is an integer greater than or equal to one.
[0023] In one optional embodiment, M preset shrinking filters are used as training tensors to shrink the original image tensor. The feature extraction module is specifically used for:
[0024] The original image tensor is shrunk with each of the M preset shrunk filters to obtain the corresponding M target mixing matrices.
[0025] Based on the preset target feature order, the obtained M target mixing matrices are aggregated to obtain the target features of the target object.
[0026] In one optional embodiment, the original image tensor is shrunk with M preset shrunk filters to obtain M corresponding target mixing matrices. The feature extraction module is specifically used for:
[0027] For each of the M ablation filters, perform the following operations:
[0028] Based on the summation protocol, the original image tensor is summed with the same data metric of a shrinking filter to obtain the corresponding target mixing matrix.
[0029] In one optional embodiment, based on the obtained feature information, the target recognition result of the target object is determined, and the recognition module is specifically used for:
[0030] Determine the target features of the target object and their similarity to at least one obtained feature information.
[0031] Feature information with similarity greater than a preset threshold is used as target feature information, and the target recognition result of the target object is determined based on the obtained target feature information.
[0032] Thirdly, embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and when the computer program is executed by the processor, the processor enables the processor to implement any of the image recognition methods described in the first aspect above.
[0033] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the image recognition method of the first aspect.
[0034] Fifthly, embodiments of this application also provide a computer program product that, when invoked by a computer, causes the computer to execute the method described in the first aspect.
[0035] This application provides an image recognition method, apparatus, electronic device, and storage medium. The method involves converting an image containing a target object into a corresponding original image tensor, and then, based on a preset target recognition model, shrinking the original image tensor using a set training tensor. This tensor shrinkage method compresses redundant parameters in the convolution kernel, significantly reducing the training parameters required for the target recognition model. Furthermore, the extracted high-order tensor is used as the extracted target features, allowing the target features to store the original geometric structure of the target image, thus ensuring the accuracy of the extracted target features and the final accuracy of the target recognition result. Attached Figure Description
[0036] Figure 1 A schematic diagram of a convolutional neural network provided in an embodiment of this application;
[0037] Figure 2 This is a schematic diagram of an application scenario provided by an embodiment of this application;
[0038] Figure 3 An example diagram of the model structure of a target recognition model provided in an embodiment of this application;
[0039] Figure 4 A flowchart of an image recognition method provided in an embodiment of this application;
[0040] Figure 5 A schematic diagram of a tensor shrinking operation provided for an embodiment of this application;
[0041] Figure 6 A schematic diagram illustrating the process of shrinking an original image tensor as provided in an embodiment of this application;
[0042] Figure 7 This is a schematic diagram of the structure of an image recognition device provided in an embodiment of this application;
[0043] Figure 8 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0044] The technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this invention.
[0045] It should be noted that in the description of this application, "multiple" is understood as "at least two". "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. A connected to B can represent: A and B directly connected, or A and B connected through C. Furthermore, in the description of this application, terms such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order.
[0046] The acquisition, transmission, storage, and use of data in this application all comply with the requirements of relevant national laws and regulations.
[0047] The design concept of this application is as follows:
[0048] With the powerful advantages of convolutional neural networks in feature extraction, deep learning has achieved certain results in the field of image recognition. (See also...) Figure 1 As shown, the main technique of convolutional neural networks is to perform convolution operations on the target image input into the network model with several convolutional kernels (also called filters) in the convolutional layer according to their set strides. After rearranging the obtained convolutional integrals, subsequent pooling and final flattening operations are performed to extract the corresponding target features from the target image. However, the above method still has the following problems:
[0049] 1. The target features are not precise enough.
[0050] Specifically, in convolutional neural networks, the feature tensors represented by the convolution kernel are generally converted into corresponding feature vectors through fully connected layers. This flattening operation, which converts tensors into vectors, often destroys the geometric structure of the data and loses the multilinear information of the data, making the extracted target features less accurate and the image recognition accuracy low.
[0051] 2. The model has too many training parameters.
[0052] Specifically, since the number of training parameters in a convolutional neural network mainly depends on the parameters set in the convolutional layers (such as kernel size and stride), during the training of a CNN-based network model, factors such as a small kernel size and a large number of kernels and convolutional layers may result in a large number of training parameters, which significantly increases the computational burden required for feature extraction from the target image, affecting the efficiency of target feature extraction and the deployment of the model on low-performance devices.
[0053] To address the aforementioned deficiencies in related technologies, embodiments of this application provide an image recognition method, apparatus, electronic device, and storage medium. By converting an image to be recognized containing a target object into a corresponding original image tensor, and based on a preset target recognition model, the original image tensor is shrunk using a set training tensor. This tensor shrinkage method compresses redundant parameters in the convolution kernel, significantly reducing the training parameters required for the target recognition model. Furthermore, the extracted higher-order tensors are used as extracted target features, allowing the target features to store the original geometric structure of the target image, thereby ensuring the accuracy of the extracted target features and the final accuracy of the target recognition result.
[0054] For ease of understanding, the following explanations are provided for some of the nouns or terms that appear in the description of the embodiments of this application:
[0055] Tensor: refers to a multilinear mapping defined on the Cartesian product of a vector space and its dual space, which can be characterized as High-dimensional arrays of order, for example, tensors. , recorded as .
[0056] Tensor shrinking: refers to algebraic operations performed on the same data dimensions (denoted as the axes of the tensors) of two different tensors. For example, there exist tensors... tensor Among them, having Then, after performing the shrinking operation on the same axis as above, we can obtain a result with... tensor of order , recorded as As shown in the following formula:
[0057]
[0058] It is important to note that the above tensor shrinking will only take effect if the two tensors have the same data dimension, and that data dimension is a specific data dimension.
[0059] Furthermore, when tensor When completely identical For the exception of the first Tensor shrinkage performed on all axes other than the first axis can be expressed by the following equation:
[0060]
[0061] At this point, the calculated result The resulting second-order array (i.e., represented as a matrix) is represented, and the following relationship exists:
[0062]
[0063] in, , Represented as tensors model Expanding, that is, splitting the tensors separately The corresponding element matrices formed by reordering the elements are denoted as follows: .
[0064] Furthermore, when there exists a tensor When it is a second-order tensor (i.e., a matrix), and its size is restricted to 1 / 2. On a specific axis Below, for tensors When performing tensor shrinking, the following results can be obtained:
[0065]
[0066] It can be observed that in tensors undergoing tensor shrinking... It is a second-order tensor, and this tensor The size is In the case of tensor The tensor contraction between the two can also be expressed as the modulus between them. product The tensor's module The product is a special form of tensor contraction, in which it is necessary to understand the modulus of the tensor. Product is primarily used to reduce the dimensionality of data, while tensor shrinking is primarily used to reduce the order of data.
[0067] Multidimensional Tensor Contraction Operation Layer (MTCOL): This refers to a neural network layer based on tensor contraction. The main computational method of this operation layer is the tensor contraction mentioned above. The basic operation definition of MTCOL is as follows:
[0068]
[0069] in, , If there exist data with the same dimension, and this data dimension is a higher-order tensor of a specific data dimension, then the gradients of the basic operations of MTCOL are as follows:
[0070]
[0071] Based on the above operational definitions, it can be seen that through the tensor shrinking operation in the multidimensional tensor shrinking operation layer, the corresponding original tensor can be shrunk. Transform it into the corresponding target mixing matrix.
[0072] Based on the above explanations of terms and nouns, the image recognition method provided in the embodiments of this application will be further described in detail below with reference to the accompanying drawings.
[0073] See Figure 2 The diagram shown illustrates a possible application scenario provided by an embodiment of this application. This application scenario includes an image acquisition device 201 and a terminal device 202. The image acquisition device 201 and the terminal device 202 can communicate via data transmission, for example, through wireless or wired communication.
[0074] In one alternative embodiment, the terminal device 202 can access the network via cellular mobile communication technology to communicate with one or more image acquisition devices 201, such as 5th Generation Mobile Networks (5G) technology.
[0075] In an optional embodiment, the terminal device 202 can also access the network and communicate with one or more image acquisition devices 201 via short-range wireless communication, such as Wireless Fidelity (Wi-Fi) technology.
[0076] It should be noted that the aforementioned terminal device 202 can be connected to one or more image acquisition devices 201 simultaneously. This application does not impose any restrictions on this. For ease of description, this application embodiment takes one image acquisition device 201 as an example.
[0077] Furthermore, the image acquisition device 201 is an electronic device used to acquire images or record videos, including handheld image acquisition devices with wireless connectivity, head-mounted image acquisition devices, and fixed image acquisition devices.
[0078] For example, in an optional embodiment, the image acquisition device 201 may be a camera, video camera, digital still camera (DSC), single-lens reflex camera (SLRC), other image acquisition devices with photo-taking function (mobile phone, tablet computer, etc.), video capture card or gate device, etc., to acquire the image to be identified containing the target object mentioned in the embodiments of this application. The target object includes: people, animals, or other physical objects. The image to be identified includes, but is not limited to, static or dynamic images containing human faces, human bodies or other distinguishable biological features. This application does not limit this.
[0079] Furthermore, the aforementioned terminal device 202 is a device that can provide voice and / or data connectivity to users, including handheld terminal devices with wireless connectivity, vehicle-mounted terminal devices, etc.
[0080] Optionally, the terminal device 202 may be: a mobile phone, tablet computer, laptop computer, handheld computer, mobile internet device (MID), wearable device, virtual reality (VR) device, augmented reality (AR) device, wireless terminal device in industrial control, wireless terminal device in autonomous driving, wireless terminal device in smart grid, wireless terminal device in transportation safety, wireless terminal device in smart city, or wireless terminal device in smart home, etc. In this embodiment, the terminal device 202 may be any of the above-mentioned electronic devices, and the electronic device may be equipped with a target recognition model to implement the image recognition method mentioned in the embodiment of this application.
[0081] Furthermore, in this embodiment, the terminal device 202 may be equipped with a trained target recognition model, which is used to extract target features from the image to be recognized.
[0082] Specifically, to ensure the accuracy of the extracted target features, the target recognition model can be trained using a specified training sample set and backpropagation to train the preset image recognition model.
[0083] For example, to obtain a target recognition model related to face recognition, multiple captured images containing faces can be used as a training sample set. Based on the forward propagation of a preset image recognition model, the loss value between each training sample and the entity label of the corresponding sample (usually represented as the actual category of the specified object in the sample) is calculated through the prediction results of each training sample. Before the preset convergence condition is met, the training parameters of the image recognition model are continuously adjusted to improve the accuracy of feature extraction.
[0084] Furthermore, in an optional embodiment, the aforementioned preset image recognition model may include multiple predefined neural network layers, used to output prediction results for the corresponding training samples after multiple processing. To reduce the training parameters required for the image recognition model, the multidimensional tensor shrinking operation layer mentioned in this application embodiment can be used as the neural network layer included in the image recognition model; alternatively, convolutional layers and pooling layers in a convolutional neural network can also be used as neural network layers included in the image recognition model, so as to jointly construct the preset image recognition model based on the multi-layer structure of the aforementioned neural network. For ease of understanding, in this application embodiment, a convolutional layer, a pooling layer, a multidimensional tensor shrinking operation layer, and a fully connected layer are used as an example, and the model structure of the trained target recognition model can be as follows. Figure 3 As shown.
[0085] See Figure 4 As shown, based on the model structure of the above target recognition model, this application proposes an image recognition method, including:
[0086] S401: Obtain the image to be recognized containing the target object, transform the image to be recognized, and obtain the corresponding original image tensor.
[0087] Specifically, for the image to be identified acquired by the image acquisition device, it can be converted into the corresponding original image tensor based on the specified image parameters of the image.
[0088] For example, for an image A to be recognized, it can be converted into a corresponding original image tensor based on its image height, image width, and color depth (such as RGB values). Specifically, assuming the image A to be recognized is an original image with RGB 3 channels, and the size of the image A to be recognized is h... w (i.e., the image A to be identified contains h rows and w columns of pixels), can then be converted into the corresponding original image tensor [h, w, 3] using the image parameters given above.
[0089] S402: Based on the preset target recognition model, the original image tensor is condensed using a set training tensor to obtain the target features of the target object.
[0090] Specifically, by using the training tensor in the target recognition model, the original image tensor is shrunk accordingly. This reduces the data order of the original image tensor while preserving its structural information, and eliminates a large number of redundant parameters in the convolution kernel in related techniques, thereby reducing the training parameters required for the target recognition model.
[0091] In this embodiment of the application, for ease of description, each training tensor that performs a shrinking operation with the original image tensor is regarded as a shrinking filter in the corresponding multidimensional tensor shrinking operation layer. As can be seen from the basic operation definition of MTCOL above, in order to achieve parametric shrinking of the original image tensor under a specific axis, each shrinking filter should be at the same data order as the original image tensor, and each shrinking filter should contain at least one data index that is the same as the original image tensor. Based on the shrinking operation performed by each set shrinking filter and the original image tensor, the original image tensor is shrunk into the corresponding target mixing matrix in each of its specified data axes.
[0092] Understandably, see Figure 5 As shown, since tensor shrinking is represented as the sum of all data of two different tensors on the same data index, each shrinking filter in this embodiment can calculate the representation of each position by the weighted sum of all positional elements. Unlike convolutional filters using local receptive fields, the above method enables the shrinking filter to have a global receptive field, so that each shrinking filter can extract all identifiable information contained in the image to be identified at the same time during the shrinking operation of the original image tensor, thus ensuring the accuracy of extracting target features.
[0093] Specifically, the shrinking operation of the original image tensor by the above-mentioned shrinking filter can be based on the Einstein summation convention, which is characterized by summing the original image tensor with the same data index of a shrinking filter. The summation convention is as follows:
[0094]
[0095] Furthermore, in an optional embodiment, in order to make the extracted target features richer, the original image tensor can be shrunk based on M preset shrinking filters, so as to extract more distinctive multi-angle target features of the target object under multiple different angles and different viewpoints, where M is an integer greater than or equal to one.
[0096] For example, see Figure 6The diagram illustrates the merging process of the original image tensor and the set M merging filters. As shown in the diagram, based on the merging operation performed on each merging filter and the original image tensor, the target blending matrix corresponding to each specified data axis of the original image tensor is obtained. It can be understood that since the data between each pair of target blending matrices is usually similar, in this embodiment, the obtained multiple target blending matrices are aggregated according to the specified data order to further obtain the distinctive target features of the target object under multiple angles and multiple views.
[0097] In an optional embodiment, considering the effectiveness of convolutional layers in a convolutional neural network for feature extraction, the original image tensor can be convolved based on a preset L convolutional kernels, and then the original image tensor after convolution can be shrunk using a preset M shrinking filter to obtain the target features of the target object.
[0098] For example, for a certain original image tensor obtained from an image to be identified, it can also be processed by passing a specified number of convolutional and pooling layers and performing corresponding convolution / pooling processing, and then the output convolutional image tensor can be shrunk until the target features of the target object are output.
[0099] It is understood that by replacing the subsequent convolutional layer corresponding to the current convolutional operation with the multidimensional tensor shrinking operation layer provided in the embodiments of this application, compared with the total number of training parameters of the two convolutional layers, the above method can significantly reduce the total number of training parameters required while keeping the accuracy of the output features obtained by the original image tensor through every two convolutional layers unchanged, thereby reducing the number of parameters required by the model and further improving the extraction efficiency of target features.
[0100] Furthermore, to preserve the original structural information of the image to be identified, in this embodiment, the higher-order tensor obtained by aggregating the above M target mixing matrices according to the specified data order is used as the target feature output by the target recognition model for the target object. It can be understood that, based on this storage method of higher-order data, this embodiment can preserve all structural information in the target image. Therefore, based on the image recognition method mentioned in this embodiment, the higher-order tensor obtained by condensation can replace the data vector obtained by flattening in the original convolutional neural network, further preserving the structural information and multilinear information of the original image tensor, and ensuring the accuracy of the extracted target features.
[0101] S403: Obtain at least one feature information that matches the target feature from the preset feature information database, and determine the target recognition result of the target object based on the obtained feature information.
[0102] Specifically, after inputting the image to be recognized into the trained target recognition model and obtaining the corresponding target features, the terminal device 202 can further match and obtain at least one associated feature information from the preset feature information library, thereby determining the target recognition result of the target object based on the combination of matched feature information.
[0103] In an optional embodiment, the target feature information that matches the preset feature information can be determined by determining the similarity between each preset feature information and the obtained target feature. Specifically, the similarity can include cosine similarity, etc. This application does not limit this. Based on the set similarity threshold, the terminal device 202 can further determine the target recognition result of the target object.
[0104] For example, assuming that the target features extracted from the image to be identified represent the distinctive features of face A, by sequentially determining the similarity between the collected target features and a large number of feature information in the preset feature information database, the distinctive information associated with face A can be further inferred from the various similar feature information to determine the actual identity of face A and its associated information.
[0105] In an optional embodiment, target feature information that meets the similarity threshold can be selected from the feature information database based on a preset similarity threshold. In the subsequent process, the terminal device 202 can determine the target recognition result in the image to be recognized based on the obtained target feature information, thereby further improving the accuracy and efficiency of the target recognition result.
[0106] The image recognition method proposed in this application will be further elaborated and explained below with examples.
[0107] To evaluate the effectiveness of the multidimensional tensor shrinking operation layer mentioned in the embodiments of this application in replacing the flattening operation of the original convolutional layer and fully connected layer, the embodiments of this application use the LeNet-5 network to compare and verify the technical defects mentioned in related technologies. Specifically, in this comparison and verification, LeNet-5 consists of two convolutional layers, two pooling layers, and two fully connected layers, wherein the convolutional kernel size in the convolutional layer is 5 x 5 and the stride is 1.
[0108] Furthermore, to prevent random results during the verification process, the number of replaced image recognition models was set to 4. The four target recognition models respectively replaced the original convolutional model's convolutional layer C3, convolutional layer C3 and fully connected layer FC, convolutional layer C2, convolutional layers C2, C3 and fully connected layer FC with the multidimensional tensor shrinking operation layer mentioned in the embodiments of this application. The corresponding verification results are shown in Table 1 below:
[0109] Table 1
[0110]
[0111] Where C1, C2, and C3 represent the three convolutional layers of the original convolutional model, Avg1, Avg2, and Avg3 represent the three average pooling layers of the original convolutional model, Flatten represents the flattening operation, FC represents the fully connected layer in the original convolutional model, MTCOL||10,10,6 means that the corresponding output shape is replaced with (10,10,6), and MTCOL||1,1,16->>16 means that the corresponding output shape becomes 16 after the replacement. As can be seen from Table 1 above, after replacing the convolutional layer C2 in the original convolutional model with the above-mentioned multidimensional tensor shrinking operation layer, the output shape of this layer is effectively reduced.
[0112] Furthermore, the recognition accuracy and total number of training parameters for each of the image recognition models mentioned above are determined, as shown in Table 2 below:
[0113] Table 2
[0114]
[0115] Wherein, Parameters represents the total number of training parameters in the model, Avg_time represents the average duration, and Avg_accuracy represents the recognition accuracy of the model. In this embodiment, space savings (SA) are also used to quantify the simplified parameters in the entire network model, as shown below:
[0116]
[0117] in, This is the total number of training parameters of the original convolutional model before replacement. It represents the total number of training parameters for the replaced image recognition model.
[0118] As can be seen from Table 2 above, the image recognition method provided in this application embodiment, through a preset target recognition model, performs a shrinking operation on the original image tensor after the image to be recognized is transformed using a set training tensor. Based on the reduced output shape after shrinking, the redundant parameters in the convolution kernel are compressed, which greatly reduces the training parameters required by the target recognition model. Furthermore, the extracted high-order tensor is used as the extracted target feature, so that the target feature can further store the original geometric structure of the target image, thereby ensuring the accuracy of the extracted target features and the accuracy of the final target recognition result.
[0119] See Figure 7As shown, an image recognition device provided in an embodiment of this application includes an acquisition module 701, a feature extraction module 702, and a recognition module 703, wherein:
[0120] The acquisition module 701 is used to acquire the image to be recognized containing the target object, transform the image to be recognized, and obtain the corresponding original image tensor.
[0121] The feature extraction module 702 is used to condense the original image tensor using a set training tensor based on a preset target recognition model to obtain the target features of the target object, wherein the target features are located at a specified data order.
[0122] The recognition module 703 is used to obtain at least one feature information that matches the target feature from a preset feature information database, and to determine the target recognition result of the target object based on the obtained feature information.
[0123] In an optional embodiment, before acquiring the image to be identified containing the target object, the acquisition module 701 is further configured to:
[0124] Obtain a training sample set, wherein each training sample includes: input information for determining the object category of the target object and entity labels.
[0125] Using training samples from the training sample set, the preset image recognition model is trained iteratively through multiple rounds. When the preset convergence condition is met, the target recognition model is output. During one round of iterative training, the following operations are performed:
[0126] An image recognition model is used to obtain corresponding prediction results based on the input information in the training samples. The training parameters of the image recognition model are then adjusted based on the loss value between the prediction results and the corresponding entity labels.
[0127] In an optional embodiment, based on a preset target recognition model, the original image tensor is shrunk using a set training tensor to obtain the target features of the target object. The feature extraction module 702 is specifically used for:
[0128] Using M pre-defined shrinking filters as training tensors, the original image tensor is shrunk to obtain the target features of the target object. Here, M is an integer greater than or equal to one, the shrinking filters are at the same data order as the original image tensor, and the shrinking filters contain at least one data metric that is the same as the original image tensor.
[0129] or,
[0130] Based on a preset L convolution kernels, the original image tensor is convolved, and the preset M shrinking filters are used as training tensors to shrink the convolved original image tensor to obtain the target features of the target object, where L is an integer greater than or equal to one.
[0131] In one optional embodiment, M preset shrinking filters are used as training tensors to shrink the original image tensor. The feature extraction module 702 is specifically used for:
[0132] The original image tensor is shrunk with each of the M preset shrunk filters to obtain the corresponding M target mixing matrices.
[0133] Based on the preset target feature order, the obtained M target mixing matrices are aggregated to obtain the target features of the target object.
[0134] In one optional embodiment, the original image tensor is shrunk with M preset shrunk filters to obtain M corresponding target mixing matrices. The feature extraction module 702 is specifically used for:
[0135] For each of the M ablation filters, perform the following operations:
[0136] Based on the summation protocol, the original image tensor is summed with the same data metric of a shrinking filter to obtain the corresponding target mixing matrix.
[0137] In an optional embodiment, based on the obtained feature information, the target recognition result of the target object is determined, and the recognition module 703 is specifically used for:
[0138] Determine the target features of the target object and their similarity to at least one obtained feature information.
[0139] Feature information with similarity greater than a preset threshold is used as target feature information, and the target recognition result of the target object is determined based on the obtained target feature information.
[0140] Based on the same inventive concept as the embodiments described above, this application also provides an electronic device that can be used for image recognition. In one embodiment, the electronic device can be a server, a terminal device, or other electronic equipment. In this embodiment, the structure of the electronic device can be as follows: Figure 8 As shown, it includes a memory 801, a communication interface 803, and one or more processors 802.
[0141] The memory 801 is used to store computer programs executed by the processor 802. The memory 801 may mainly include a program storage area and a data storage area. The program storage area may store the operating system and programs required to run instant messaging functions, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.
[0142] Memory 801 may be volatile memory, such as random-access memory (RAM); memory 801 may also be non-volatile memory, such as read-only memory, flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 801 may be any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 801 may be a combination of the above-mentioned memories.
[0143] The processor 802 may include one or more central processing units (CPUs) or digital processing units, etc. The processor 802 is used to implement the image recognition method described above when it calls the computer program stored in the memory 801.
[0144] The communication interface 803 is used to communicate with terminal devices and other servers.
[0145] This application embodiment does not limit the specific connection medium between the memory 801, the communication interface 803, and the processor 802. This application embodiment... Figure 8 The memory 801 and the processor 802 are connected via a bus 804, and the bus 804 is in Figure 8 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The 804 bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, Figure 8 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0146] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform any of the image recognition methods described in the above embodiments. The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.
[0147] According to one aspect of this application, this application also provides a computer program product that, when invoked by a computer, causes the computer to perform the method as described in the first aspect.
[0148] This application provides an image recognition method, apparatus, electronic device, and storage medium. The method involves converting an image containing a target object into a corresponding original image tensor, and then, based on a preset target recognition model, shrinking the original image tensor using a set training tensor. This tensor shrinkage method compresses redundant parameters in the convolution kernel, significantly reducing the training parameters required for the target recognition model. Furthermore, the extracted high-order tensor is used as the extracted target features, allowing the target features to store the original geometric structure of the target image, thus ensuring the accuracy of the extracted target features and the final accuracy of the target recognition result.
[0149] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1A device that provides the functions specified in one or more boxes.
[0150] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0151] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0152] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. An image recognition method, characterized in that, include: Obtain the image to be identified containing the target object, transform the image to be identified, and obtain the corresponding original image tensor; The original image tensor is condensed with M preset condensation filters to obtain M corresponding target blending matrices. Based on a preset target feature order, the obtained M target blending matrices are aggregated to obtain the target features of the target object, where M is an integer greater than or equal to one. The condensation filters are at the same data order as the original image tensor, and the condensation filters contain at least one data index that is the same as the original image tensor. The condensation filters are used for parametric shrinkage under a specific axis, and the target features are at a specified data order. From a preset feature information database, at least one feature information matching the target feature is obtained, and based on the obtained feature information, the target recognition result of the target object is determined.
2. The method as described in claim 1, characterized in that, Before acquiring the image to be identified containing the target object, the process also includes: Obtain a training sample set, wherein each training sample includes: input information for determining the object category of the target object and entity labels; Using training samples from the aforementioned training sample set, a preset image recognition model is trained iteratively through multiple rounds. When a preset convergence condition is met, the target recognition model is output. During one round of iterative training, the following operations are performed: Using the image recognition model, based on the input information in the training samples, the corresponding prediction results are obtained, and the training parameters of the image recognition model are adjusted based on the loss value between the prediction results and the corresponding entity labels.
3. The method as described in claim 1 or 2, characterized in that, The method further includes: Based on a preset L convolution kernels, the original image tensor is convolved, and a preset M shrinking filter is used as a training tensor to shrink the convolved original image tensor to obtain the target features of the target object, where L is an integer greater than or equal to one.
4. The method as described in claim 1, characterized in that, The step of shrinking the original image tensor with each of the preset M shrinking filters to obtain the corresponding M target mixing matrices includes: For each of the M abbreviated filters, perform the following operations: Based on the summation protocol, the original image tensor is summed with the same data index of a shrinking filter to obtain the corresponding target mixing matrix.
5. The method according to any one of claims 1-2 and 4, characterized in that, The determination of the target recognition result of the target object based on the obtained feature information includes: Determine the target features of the target object and their similarity to at least one obtained feature information; The feature information with similarity greater than a preset threshold is used as target feature information, and the target recognition result of the target object is determined based on the obtained target feature information.
6. An image recognition device, characterized in that, include: The acquisition module is used to acquire an image to be identified containing the target object, transform the image to be identified, and obtain the corresponding original image tensor. The feature extraction module is used to shrink the original image tensor with M preset shrinking filters to obtain M corresponding target mixing matrices; based on a preset target feature order, the obtained M target mixing matrices are aggregated to obtain the target features of the target object, where M is an integer greater than or equal to one, the shrinking filter is at the same data order as the original image tensor, and the shrinking filter contains at least one data index that is the same as the original image tensor. The shrinking filter is used for parametric shrinking under a specific axis, and the target feature is at a specified data order. The recognition module is used to obtain at least one feature information that matches the target feature from a preset feature information database, and to determine the target recognition result of the target object based on the obtained feature information.
7. The apparatus as claimed in claim 6, characterized in that, Before acquiring the image to be identified containing the target object, the acquisition module is further configured to: Obtain a training sample set, wherein each training sample includes: input information for determining the object category of the target object and entity labels; Using training samples from the aforementioned training sample set, a preset image recognition model is trained iteratively through multiple rounds. When a preset convergence condition is met, the target recognition model is output. During one round of iterative training, the following operations are performed: Using the image recognition model, based on the input information in the training samples, the corresponding prediction results are obtained, and the training parameters of the image recognition model are adjusted based on the loss value between the prediction results and the corresponding entity labels.
8. The apparatus as claimed in claim 6 or 7, characterized in that, The feature extraction module is specifically used for: Based on a preset L convolution kernels, the original image tensor is convolved, and a preset M shrinking filter is used as a training tensor to shrink the convolved original image tensor to obtain the target features of the target object, where L is an integer greater than or equal to one.
9. The apparatus as claimed in claim 6, characterized in that, The original image tensor is shrunk with each of the M preset shrinking filters to obtain the corresponding M target mixing matrices. The feature extraction module is specifically used for: For each of the M abbreviated filters, perform the following operations: Based on the summation protocol, the original image tensor is summed with the same data index of a shrinking filter to obtain the corresponding target mixing matrix.
10. The apparatus according to any one of claims 6-7 and 9, characterized in that, The target recognition result of the target object is determined based on the obtained feature information, and the recognition module is specifically used for: Determine the target features of the target object and their similarity to at least one obtained feature information; The feature information with similarity greater than a preset threshold is used as target feature information, and the target recognition result of the target object is determined based on the obtained target feature information.
11. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the image recognition method as described in any one of claims 1-5.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1-5.
13. A computer program product, characterized in that, When the computer program product is invoked by a computer, it causes the computer to perform the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Convolutional neural network model compression method suitable for image recognition
CN112734010A
Microexpression-based image recognition method and apparatus, and related device
US20210174072A1