Image recognition method and device, computer device and storage medium

By encoding and quantizing the image at the terminal, generating hidden features and uploading them to the server for decompression and identification, the problem of user privacy information leakage in traditional image recognition is solved, and security and accuracy are improved.

CN113822129BActive Publication Date: 2025-10-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110753108.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-02
Publication Date
2025-10-17
Estimated Expiration
2041-07-28

AI Technical Summary

Technical Problem

In traditional image recognition methods, user privacy information is at risk of being leaked or stolen during transmission. How to improve the security of user privacy information has become a concern.

Method used

By encoding and quantizing the image to be identified at the terminal, quantitative features are obtained, and compression processing is performed using the target value range and discrete cumulative probability interval of each channel to generate hidden layer features, which are then uploaded to the server for decompression and identification, avoiding directly uploading the original image.

Benefits of technology

Effectively protect user privacy, reduce data transmission volume and bandwidth, and ensure the accuracy and security of identity recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113822129B_ABST
    Figure CN113822129B_ABST
Patent Text Reader

Abstract

The application relates to an image recognition method and device, computer equipment and a storage medium. The method comprises the following steps: acquiring an image to be recognized, encoding and quantizing the image to be recognized to obtain quantized features corresponding to at least one channel; compressing the quantized features of each channel by using the target value range and the corresponding discrete cumulative probability interval of each channel to obtain hidden layer features corresponding to each channel respectively; uploading the hidden layer features corresponding to each channel respectively to a server, wherein the uploaded hidden layer features are used to instruct the server to decompress the hidden layer features based on the pre-stored target value range and the corresponding discrete cumulative probability interval of each channel, and perform identity recognition based on the decompression result; and receiving an identity recognition result corresponding to the image to be recognized fed back by the server. The method can effectively improve the security of user privacy information.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to an image recognition method and device, computer equipment and storage medium. BACKGROUND

[0002] With the development of computer technology, image recognition algorithms are becoming more and more mature. Through image recognition algorithms, user images can be verified for authenticity, and services can be provided to users who pass identity verification. For example, face payment, business handling and other services can be provided to users who pass identity verification.

[0003] In the traditional image recognition method, the images collected by the terminal are uploaded to the server for recognition to save terminal resources. However, there is a risk of leakage, theft and misuse of images during transmission. How to improve the security of user privacy information has become a major concern. SUMMARY

[0004] Therefore, it is necessary to provide an image recognition method, device, computer equipment and storage medium that can effectively improve the security of user privacy information.

[0005] An image recognition method, the method comprising:

[0006] Obtaining an image to be recognized, encoding and quantizing the image to be recognized, and obtaining quantized features corresponding to at least one channel;

[0007] Compressing the quantized features of the corresponding channel by the target value range of each channel and the corresponding discrete cumulative probability interval to obtain hidden layer features corresponding to each channel respectively;

[0008] Uploading the hidden layer features corresponding to each channel respectively to a server, and the uploaded hidden layer features are used to instruct the server to decompress the hidden layer features based on the pre-stored target value range of each channel and the corresponding discrete cumulative probability interval, and perform identity recognition based on the decompression result;

[0009] Receiving the identity recognition result corresponding to the image to be recognized fed back by the server.

[0010] An image recognition device, the device comprising:

[0011] An acquisition module for acquiring an image to be recognized, encoding and quantizing the image to be recognized, and obtaining quantized features corresponding to at least one channel;

[0012] The compression module is configured to compress the quantized feature of each channel by using the target value range and the corresponding discrete cumulative probability interval of each channel, and obtain the hidden layer feature corresponding to each channel respectively.

[0013] The uploading module is configured to upload the hidden layer feature corresponding to each channel to a server, and the uploaded hidden layer feature is used to instruct the server to decompress the hidden layer feature based on the target value range and the corresponding discrete cumulative probability interval of each channel pre-stored in the server, and perform identity recognition based on the decompression result.

[0014] The result receiving module is configured to receive an identity recognition result corresponding to the image to be recognized and fed back by the server.

[0015] In an embodiment, the compression module is further configured to, for the quantized feature corresponding to each channel, determine the probability interval corresponding to each character in the quantized feature corresponding to the channel by using the target value range and the discrete cumulative probability interval corresponding to the channel; determine the encoding interval corresponding to each character based on the probability interval corresponding to each character; and for each channel, determine the hidden layer feature corresponding to the channel according to the encoding interval corresponding to each character of the channel.

[0016] In an embodiment, the compression module is further configured to, for a current character in the quantized feature of the channel, determine a matching character in the target value range corresponding to the channel that matches the current character; take the interval corresponding to the matching character in the discrete cumulative probability interval corresponding to the channel as the probability interval corresponding to the current character; determine the encoding interval corresponding to the current character according to the probability interval corresponding to the current character and the encoding interval corresponding to a previous character adjacent to the current character, and continue to process a next character in the quantized feature of the channel until the encoding interval corresponding to each character in the quantized feature is obtained.

[0017] In an embodiment, the compression module is further configured to, for each channel, randomly select a value from the encoding interval corresponding to a last character in the quantized feature corresponding to the channel; and take the randomly selected value as the hidden layer feature corresponding to the channel until the hidden layer feature corresponding to each channel is obtained.

[0018] In an embodiment, the image recognition device is implemented by using a target recognition model including a first sub-model and a second sub-model; the first sub-model is deployed on a terminal, and the second sub-model is deployed on a server; the first sub-model includes an encoder, a quantizer, the target value range of each channel, and the corresponding discrete cumulative probability interval; and the second sub-model includes the target value range of each channel, the corresponding discrete cumulative probability interval, and a feature recognition network.

[0019] In one embodiment, the apparatus further comprises:

[0020] a model determining module configured to determine a to-be-trained identification model, the to-be-trained identification model comprising an image encoder, a quantizer, an entropy network and a feature identification network;

[0021] a processing module configured to acquire a sample image and a corresponding identity label, sequentially perform encoding and quantization processing on the sample image by the encoder and the quantizer in the to-be-trained identification model, and obtain a sample quantization feature;

[0022] a probability distribution determining module configured to determine a sample probability distribution corresponding to each pixel in the sample image based on the sample quantization feature by the entropy network, and determine a sample image entropy corresponding to the sample image according to the sample probability distribution;

[0023] a calculation module configured to determine a value range corresponding to each channel in the to-be-trained identification model based on the sample quantization feature by the entropy network, and calculate a channel probability distribution corresponding to each value range;

[0024] a probability loss determining module configured to determine a channel probability loss based on the channel probability distribution corresponding to each value range;

[0025] an identification module configured to perform identification processing on the sample quantization feature by the feature identification network, and obtain a sample identification result;

[0026] a construction module configured to determine an image identification loss based on the sample identification result and the identity label, and construct a target loss function according to the image identification loss, the channel probability loss and the sample image entropy;

[0027] a training module configured to train the to-be-trained identification model by the target loss function until a training stop condition is reached to stop, and obtain a trained target identification model.

[0028] In one embodiment, the trained target identification model comprises a target value range corresponding to each channel, and a discrete cumulative probability interval corresponding to the target value range of each channel is determined by the entropy network in the trained target identification model based on the target value range of the corresponding channel.

[0029] In one embodiment, the to-be-identified image is a face image; the acquisition module is further configured to collect a face image in response to a resource transfer triggering operation on a resource amount; and perform encoding and quantization processing on the face image to obtain a quantization feature corresponding to at least one channel.

[0030] The device further comprises a resource transfer module; the resource transfer module is configured to perform a resource transfer operation when the identity recognition result is successful; the resource transfer operation is configured to transfer the resource amount from a resource account of an operation initiator to a resource account of a recipient.

[0031] In one embodiment, the image to be recognized is a human face image; the acquisition module is further configured to collect a human face image in response to a triggering operation of access control;

[0032] The device further comprises an access control module; the access control module is configured to control an access control terminal to perform an access opening operation when the identity recognition result corresponding to the human face image is successful.

[0033] A computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0034] An image to be recognized is acquired, and the image to be recognized is encoded and quantized to obtain quantized features corresponding to at least one channel;

[0035] The quantized features of the corresponding channel are compressed by using the target value range of each channel and the corresponding discrete cumulative probability interval to obtain hidden layer features corresponding to each channel respectively;

[0036] The hidden layer features corresponding to each channel respectively are uploaded to a server, and the uploaded hidden layer features are used to instruct the server to decompress the hidden layer features based on the target value range of each channel and the corresponding discrete cumulative probability interval stored in advance, and perform identity recognition based on the decompression result;

[0037] An identity recognition result corresponding to the image to be recognized is received from the server.

[0038] A computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the following steps:

[0039] An image to be recognized is acquired, and the image to be recognized is encoded and quantized to obtain quantized features corresponding to at least one channel;

[0040] The quantized features of the corresponding channel are compressed by using the target value range of each channel and the corresponding discrete cumulative probability interval to obtain hidden layer features corresponding to each channel respectively;

[0041] uploading the hidden layer features corresponding to each channel to a server, the uploaded hidden layer features being used to instruct the server to perform decompression processing on the hidden layer features based on a target value range and a corresponding discrete cumulative probability interval of each channel pre-stored by the server, and perform identity recognition based on a decompression result;

[0042] receiving an identity recognition result corresponding to the image to be recognized and fed back by the server.

[0043] The image recognition method, device, computer device, and storage medium described above obtain an image to be recognized, perform encoding and quantization processing on the image to be recognized, obtain quantized features corresponding to at least one channel, perform compression processing on the quantized features of the corresponding channel through a target value range and a corresponding discrete cumulative probability interval of each channel, upload the hidden layer features corresponding to each channel obtained after the compression processing to a server, and effectively protect user privacy while reducing the amount of data to be transmitted and the bandwidth. The hidden layer features obtained after the compression processing are uploaded to the server, and the corresponding decompression processing is required to obtain accurate image features, thereby avoiding data leakage in the process of directly uploading the image to be recognized to the server and the problem that the image to be recognized is directly leaked out. The server performs corresponding decompression processing on the hidden layer features based on a target value range and a corresponding discrete cumulative probability interval of each channel pre-stored by the server, accurately obtains decompression features to perform identity recognition, and returns an identity recognition result to a terminal, thereby effectively protecting the accuracy of user identity recognition and the security of the recognition process.

[0044] An image recognition method, the method comprising:

[0045] receiving hidden layer features corresponding to at least one channel, the hidden layer features corresponding to at least one channel being obtained by performing encoding and quantization processing on an image to be recognized to obtain quantized features corresponding to each channel, and performing compression processing on the quantized features of the corresponding channel through a target value range and a corresponding discrete cumulative probability interval of each channel;

[0046] performing decompression processing on the hidden layer features of the corresponding channel through a target value range and a corresponding discrete cumulative probability interval of each channel to obtain decompression features of the corresponding channel;

[0047] performing feature recognition based on the decompression features corresponding to each channel respectively to obtain an identity recognition result corresponding to the image to be recognized, and feeding back the identity recognition result to a terminal.

[0048] An image recognition device, the device comprising:

[0049] The feature receiving module is configured to receive the hidden layer features corresponding to at least one channel, wherein the hidden layer features corresponding to at least one channel are obtained by encoding and quantizing a to-be-identified image to obtain quantized features corresponding to each channel, and by compressing the quantized features corresponding to each channel through a target value range of each channel and a corresponding discrete cumulative probability interval.

[0050] The decompression module is configured to decompress the hidden layer features corresponding to each channel through the target value range of each channel and the corresponding discrete cumulative probability interval to obtain decompressed features corresponding to each channel.

[0051] The feedback module is configured to perform feature recognition based on the decompressed features corresponding to each channel, to obtain an identity recognition result corresponding to the to-be-identified image, and to feed back the identity recognition result to a terminal.

[0052] In an embodiment, the decompression module is further configured to, for the hidden layer features corresponding to each channel, determine a character probability interval corresponding to the hidden layer features in the discrete cumulative probability interval of the corresponding channel, and determine a first character in the hidden layer features from the target value range based on the character probability interval; take the first character as a current character, and update the discrete cumulative probability interval based on a character probability interval of the current character and an initial probability interval; determine a next character of the current character from the target value range based on a character probability interval corresponding to the hidden layer features in the updated discrete cumulative probability interval; take the next character as the current character, and return to the step of updating the discrete cumulative probability interval based on the probability interval of the current character and the initial probability interval and continue to execute until a last character in the hidden layer features is obtained; and take each character in the hidden layer features as the decompressed features of the corresponding channel.

[0053] A computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0054] The feature receiving module is configured to receive the hidden layer features corresponding to at least one channel, wherein the hidden layer features corresponding to at least one channel are obtained by encoding and quantizing a to-be-identified image to obtain quantized features corresponding to each channel, and by compressing the quantized features corresponding to each channel through a target value range of each channel and a corresponding discrete cumulative probability interval.

[0055] The decompression module is configured to decompress the hidden layer features corresponding to each channel through the target value range of each channel and the corresponding discrete cumulative probability interval to obtain decompressed features corresponding to each channel.

[0056] The identity recognition result corresponding to the to-be-recognized image is obtained based on the decompressed features corresponding to each channel respectively, and the identity recognition result is fed back to the terminal.

[0057] A computer-readable storage medium has a computer program stored thereon, and the computer program is executed by a processor to implement the following steps:

[0058] Receiving the hidden layer features corresponding to at least one channel, the hidden layer features corresponding to at least one channel being obtained by encoding and quantizing the to-be-recognized image to obtain the quantized features corresponding to each channel, and by the target value range of each channel and the corresponding discrete cumulative probability interval, the quantized features of the corresponding channel are compressed to obtain the decompressed features of the corresponding channel.

[0059] The hidden layer features of the corresponding channel are decompressed by the target value range of each channel and the corresponding discrete cumulative probability interval to obtain the decompressed features of the corresponding channel.

[0060] The identity recognition result corresponding to the to-be-recognized image is obtained based on the decompressed features corresponding to each channel respectively, and the identity recognition result is fed back to the terminal.

[0061] The image recognition method, device, computer equipment and storage medium described above, the terminal encodes and quantizes the to-be-recognized image to obtain the quantized features corresponding to at least one channel, and by the target value range of each channel and the corresponding discrete cumulative probability interval, the quantized features of the corresponding channel are compressed, and then the hidden layer features corresponding to each channel obtained after the compression are uploaded to the server, which can effectively protect the user privacy, and at the same time can reduce the amount of data transmission and bandwidth. The hidden layer features obtained after the compression are uploaded to the server, and the corresponding decompression processing is required to obtain accurate image features, avoiding the problem that data leakage occurs in the process of directly uploading the to-be-recognized image to the server, resulting in that the to-be-recognized image is directly leaked out. The server performs corresponding decompression processing on the hidden layer features based on the pre-stored target value range of each channel and the corresponding discrete cumulative probability interval, accurately obtains the decompressed features for identity recognition, thereby effectively improving the accuracy of user identity recognition and the security of the recognition process.

[0062] A recognition model training method, the method comprising:

[0063] Determining a to-be-trained recognition model, the to-be-trained recognition model comprising an image encoder, a quantizer, an entropy network and a feature recognition network;

[0064] Obtaining a sample image and a corresponding identity label, and sequentially encoding and quantizing the sample image by the encoder and the quantizer in the to-be-trained recognition model to obtain sample quantized features;

[0065] determine, by the entropy network and based on the sample quantization feature, a sample probability distribution corresponding to each pixel in the sample image, and determine a sample image entropy corresponding to the sample image according to the sample probability distribution;

[0066] determine, by the entropy network and based on the sample quantization feature, a value range corresponding to each channel in the to-be-trained recognition model, and calculate a channel probability distribution corresponding to each value range;

[0067] determine, based on the channel probability distribution corresponding to each value range, a channel probability loss;

[0068] identify the sample quantization feature by the feature recognition network to obtain a sample recognition result;

[0069] determine an image recognition loss based on the sample recognition result and the identity label, and construct a target loss function according to the image recognition loss, the channel probability loss and the sample image entropy;

[0070] train the to-be-trained recognition model by the target loss function until a training stop condition is reached to stop, and obtain a trained target recognition model; the target recognition model is used for identity recognition of a to-be-recognized image.

[0071] An identification model training device, the device comprising:

[0072] a model determination module configured to determine a to-be-trained recognition model, the to-be-trained recognition model comprising an image encoder, a quantizer, an entropy network and a feature recognition network;

[0073] a processing module configured to obtain a sample image and a corresponding identity label, and sequentially perform encoding and quantization processing on the sample image by the encoder and the quantizer in the to-be-trained recognition model to obtain a sample quantization feature;

[0074] a probability distribution determination module configured to determine, by the entropy network and based on the sample quantization feature, a sample probability distribution corresponding to each pixel in the sample image, and determine a sample image entropy corresponding to the sample image according to the sample probability distribution;

[0075] a calculation module configured to determine, by the entropy network and based on the sample quantization feature, a value range corresponding to each channel in the to-be-trained recognition model, and calculate a channel probability distribution corresponding to each value range;

[0076] a probability loss determination module configured to determine, based on the channel probability distribution corresponding to each value range, a channel probability loss;

[0077] The identification module is configured to identify the sample quantized features by using the feature identification network to obtain a sample identification result.

[0078] The construction module is configured to determine an image identification loss based on the sample identification result and the identity label, and construct a target loss function according to the image identification loss, the channel probability loss, and the sample image entropy.

[0079] The training module is configured to train the to-be-trained identification model by using the target loss function until a training stop condition is reached to stop, and obtain a trained target identification model; the target identification model is configured to perform identity identification on a to-be-identified image.

[0080] In an embodiment, the calculation module is further configured to calculate a channel probability distribution corresponding to an upper limit value and a lower limit value in each value range.

[0081] The probability loss determination module is further configured to determine a channel probability loss according to the channel probability distribution corresponding to the upper limit value and the lower limit value in each value range.

[0082] In an embodiment, the trained target identification model includes a target value range corresponding to each channel; the probability distribution determination module is further configured to determine, by using an entropy network in the target identification model, a channel probability distribution corresponding to each value in each target value range based on the target value range corresponding to each channel; for each target value range corresponding to each channel, a discrete cumulative probability interval corresponding to the corresponding target value range is calculated according to the channel probability distribution corresponding to each value in the corresponding target value range; wherein the target value range and the corresponding discrete cumulative probability interval are used to compress quantized features corresponding to a to-be-identified image into hidden layer features, and are used to decompress the hidden layer features corresponding to the to-be-identified image to obtain an identity identification result of the to-be-identified image based on a decompression result.

[0083] In an embodiment, the target identification model includes a first sub-model and a second sub-model, the first sub-model is deployed on a terminal, and the second sub-model is deployed on a server.

[0084] The first sub-model includes an encoder, a quantizer, a target value range of each channel, and a corresponding discrete cumulative probability interval; the target value range of each channel and the corresponding discrete cumulative probability interval in the first sub-model are used to compress quantized features corresponding to a to-be-identified image into hidden layer features; the second sub-model includes a target value range of each channel, a corresponding discrete cumulative probability interval, and a feature identification network; the target value range of each channel and the corresponding discrete cumulative probability interval in the second sub-model are used to decompress the hidden layer features corresponding to the to-be-identified image.

[0085] A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:

[0086] determining a to-be-trained identification model, the to-be-trained identification model comprising an image encoder, a quantizer, an entropy network and a feature identification network;

[0087] obtaining a sample image and a corresponding identity label, sequentially encoding and quantizing the sample image through the encoder and the quantizer in the to-be-trained identification model to obtain sample quantization features;

[0088] determining, through the entropy network and based on the sample quantization features, a sample probability distribution corresponding to each pixel in the sample image, and determining a sample image entropy corresponding to the sample image according to the sample probability distribution;

[0089] determining, through the entropy network and based on the sample quantization features, a value range corresponding to each channel in the to-be-trained identification model, and calculating a channel probability distribution corresponding to each value range;

[0090] determining a channel probability loss based on the channel probability distribution corresponding to each value range;

[0091] performing identification processing on the sample quantization features through the feature identification network to obtain a sample identification result;

[0092] determining an image identification loss based on the sample identification result and the identity label, and constructing a target loss function according to the image identification loss, the channel probability loss and the sample image entropy;

[0093] training the to-be-trained identification model through the target loss function until a training stop condition is reached to stop, obtaining a trained target identification model; the target identification model is used for identity recognition of a to-be-identified image.

[0094] A computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the following steps:

[0095] determining a to-be-trained identification model, the to-be-trained identification model comprising an image encoder, a quantizer, an entropy network and a feature identification network;

[0096] obtaining a sample image and a corresponding identity label, sequentially encoding and quantizing the sample image through the encoder and the quantizer in the to-be-trained identification model to obtain sample quantization features;

[0097] determine a sample probability distribution corresponding to each pixel in the sample image based on the sample quantization feature through the entropy network, and determine a sample image entropy corresponding to the sample image according to the sample probability distribution;

[0098] determine a value range corresponding to each channel in the to-be-trained recognition model based on the sample quantization feature through the entropy network, and calculate a channel probability distribution corresponding to each value range;

[0099] determine a channel probability loss based on the channel probability distribution corresponding to each value range;

[0100] perform recognition processing on the sample quantization feature through the feature recognition network to obtain a sample recognition result;

[0101] determine an image recognition loss based on the sample recognition result and the identity label, and construct a target loss function according to the image recognition loss, the channel probability loss, and the sample image entropy;

[0102] train the to-be-trained recognition model through the target loss function until a training stop condition is reached to stop, and obtain a trained target recognition model; the target recognition model is used for identity recognition on a to-be-recognized image.

[0103] In the embodiment, the sample quantization feature of the sample image is processed through the entropy network to obtain a sample probability distribution corresponding to each pixel in the sample image, so as to determine a sample image entropy corresponding to the sample image. The sample image entropy is taken as part of a target loss function, so as to determine the loss degree of the key information of the sample image. At the same time, according to the channel probability distribution corresponding to the value range of each channel of the entropy network, a channel probability loss is calculated, which is taken as part of the target loss function, so as to optimize the value range of each channel in the training process, thereby realizing the constraint on the output feature of the entropy network. Moreover, the loss between the prediction result and the real result of the sample quantization feature in the feature recognition network is taken as part of the target loss function, so as to realize the training of the feature recognition network. Through a series of constraints, the overall training of the recognition model is realized, so that the trained target recognition model has higher prediction precision and accuracy. BRIEF DESCRIPTION OF DRAWINGS

[0104] Figure 1 An application environment diagram of an image recognition method in an embodiment;

[0105] Figure 2 A flowchart of an image recognition method in an embodiment;

[0106] Figure 3A flowchart of a training step of a target recognition model in one embodiment;

[0107] Figure 4 A flowchart of a face recognition in another embodiment;

[0108] Figure 5 A flowchart of an image recognition method in another embodiment;

[0109] Figure 6 A flowchart of a decompression step of a hidden layer feature of a corresponding channel in one embodiment by using the value range of a target through each channel and the corresponding discrete cumulative probability interval;

[0110] Figure 7 A flowchart of a testing step of a recognition model in one embodiment;

[0111] Figure 8 A flowchart of a training step of a target recognition model in another embodiment;

[0112] Figure 9 A structural diagram of a part of a feature recognition network in one embodiment;

[0113] Figure 10 A framework diagram of a recognition model to be trained in one embodiment;

[0114] Figure 11 A structural block diagram of an image recognition device in one embodiment;

[0115] Figure 12 A structural block diagram of an image recognition device in another embodiment;

[0116] Figure 13 A structural block diagram of a recognition model training device in one embodiment;

[0117] Figure 14 An internal structural diagram of a computer device in one embodiment;

[0118] Figure 15 An internal structural diagram of a computer device in another embodiment. DETAILED DESCRIPTION

[0119] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application is further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.

[0120] The present application relates to the field of artificial intelligence (AI), wherein the artificial intelligence is a theory, method, technology and application system for simulating, extending and expanding human intelligence by using a digital computer or a machine controlled by a digital computer to perceive environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machine has the functions of perception, reasoning and decision-making. The scheme provided by the embodiments of the present application relates to an image recognition method of artificial intelligence, which is specifically explained by the following embodiments.

[0121] The image recognition method provided by the present application can be applied to an image recognition system as shown in Figure 1 As shown in Figure 1 The image recognition system includes a terminal 110 and a server 120. In an embodiment, the terminal 110 and the server 120 can each independently execute the image recognition method provided in the embodiments of the present application. The terminal 110 and the server 120 can also be used cooperatively to execute the image recognition method provided in the embodiments of the present application. When the terminal 110 and the server 120 are used cooperatively to execute the image recognition method provided in the embodiments of the present application, the terminal 110 acquires a to-be-recognized image, encodes and quantizes the to-be-recognized image, and obtains quantized features corresponding to at least one channel. The terminal 110 compresses the quantized features of the corresponding channel by using a target value range of each channel and a corresponding discrete cumulative probability interval, and obtains hidden layer features corresponding to each channel respectively. The terminal 110 uploads the hidden layer features corresponding to each channel respectively to the server 120. The server 120 receives the hidden layer features corresponding to at least one channel, which are obtained by encoding and quantizing the to-be-recognized image to obtain quantized features corresponding to each channel, and performing compression processing on the quantized features of the corresponding channel by using a target value range of each channel and a corresponding discrete cumulative probability interval. The server 120 decompresses the hidden layer features of the corresponding channel by using a target value range of each channel and a corresponding discrete cumulative probability interval, and obtains decompressed features of the corresponding channel. The server 120 performs feature recognition based on the decompressed features corresponding to each channel respectively, obtains an identity recognition result corresponding to the to-be-recognized image, and feeds back the identity recognition result to the terminal. The terminal 110 receives the identity recognition result corresponding to the to-be-recognized image fed back by the server.

[0122] The server 120 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services or a cloud server cluster consisting of multiple cloud servers. The terminal 110 may be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, in-vehicle terminal, smart TV, etc., but is not limited thereto. The terminal 110 and the server 120 may be connected directly or indirectly via wired or wireless communication, which is not limited in this application.

[0123] In one embodiment, multiple servers may form a blockchain, and the servers are nodes on the blockchain.

[0124] In one embodiment, data related to the image recognition method can be stored on the blockchain. For example, data such as the target value range of each channel and the corresponding discrete cumulative probability interval, the image to be recognized, quantitative features, latent features, decompression results, and identity recognition results can all be stored on the blockchain. Similarly, data related to the recognition model training method can also be stored on the blockchain.

[0125] In one embodiment, Figure 2 As shown, an image recognition method is provided, which is applied to Figure 1 The following steps are used as an example to illustrate the terminal in the figure:

[0126] Step S202: Acquire an image to be identified, encode and quantize the image to be identified, and obtain a quantized feature corresponding to at least one channel.

[0127] The image to be identified refers to an image related to user privacy, such as, but not limited to, a face image, a half-body image, a full-body image, an ID image, and a signature image. The image to be identified can be an image captured in real time, a pre-stored image, or an image obtained from another device. Quantization processing refers to converting image features into integers, for example, converting floating-point feature values ​​into integers.

[0128] Specifically, the terminal may obtain an image to be identified, perform encoding processing on the image to be identified, obtain encoding features corresponding to at least one channel, and perform quantization processing on the encoding features corresponding to the at least one channel to convert each encoding feature into an integer to obtain a quantized feature corresponding to the at least one channel.

[0129] In one embodiment, the terminal can acquire the image to be recognized in real time through a camera, select the image to be recognized from pre-captured or stored images, or obtain the image to be recognized from other devices.

[0130] In one embodiment, the encoding features obtained by the encoder can be quantized by the following formula, where round represents a rounding operation:

[0131]

[0132] wherein y is the encoding feature, yq is the quantized feature corresponding to the encoding feature y, and round(y) represents a rounding operation on the encoding feature y. For example, if the encoding feature is [0.27, 0.41, 0.50, 0.75, 0.84, 0.38], the quantized feature obtained after quantization is [0, 0, 1, 1, 1, 0]. In step S204, the quantized features of each channel are compressed to obtain the hidden layer features corresponding to each channel by using the target value range and the corresponding discrete cumulative probability interval of each channel.

[0133] wherein the target value range refers to the constraint on the output value of the channel, and the discrete cumulative probability interval refers to a set of probability intervals corresponding to each value in the target value range. Each channel corresponds to a target value range and a discrete cumulative probability interval.

[0134] In one embodiment, the target value range is an integer, i.e., each value in the target value range is an integer. Each value in the discrete cumulative probability interval is greater than the previous value, and the lower limit of the discrete cumulative probability interval is 0 and the upper limit is 1, e.g., [0, 1].

[0135] The compression processing refers to a processing mechanism for reducing the size of computer data by using a specific algorithm. This processing mechanism can reduce the total number of bytes of data, making data transmission faster, and can also reduce the storage space of data. Compression can be divided into lossy and lossless compression, which processes data losslessly or lossy to retain the most data information and make the data volume smaller. Lossy compression allows some information to be lost during compression, and the lost part has little effect on understanding the original data. Lossless compression is a compression method that uses statistical redundancy of data to compress, which can completely restore the original data without causing any distortion.

[0136]

[0137] ​Specifically, the terminal pre-stores target value ranges and corresponding discrete cumulative probability intervals of each channel. For the quantized features of each channel, the terminal can compress the quantized features of the corresponding channel by using the target value range and the corresponding discrete cumulative probability interval of the corresponding channel, so as to obtain the corresponding hidden layer features of each channel. For example, if there are 192 channels, there are 192 target value ranges and discrete cumulative probability intervals. The quantized features of the first channel are compressed by using the target value range and the discrete cumulative probability interval of the first channel, so as to obtain the hidden layer features corresponding to the first channel. In the same way, 192 hidden layer features corresponding to 192 channels can be obtained.

[0138] In step S206, the hidden layer features corresponding to each channel are uploaded to the server. The uploaded hidden layer features are used to instruct the server to decompress the hidden layer features based on the pre-stored target value ranges and corresponding discrete cumulative probability intervals of each channel, and to perform identity recognition based on the decompression result.

[0139] The decompression processing refers to decompressing the compressed data by using a processing mechanism corresponding to the compression processing, so as to restore the compressed data to the data before compression.

[0140] The server can be a physical server or a cloud server.

[0141] Specifically, the terminal uploads the hidden layer features corresponding to each channel to the server. The server pre-stores target value ranges and corresponding discrete cumulative probability intervals of each channel. The server receives the hidden layer features corresponding to each channel, and decompresses the hidden layer features of the corresponding channel by using the target value range and the corresponding discrete cumulative probability interval of the corresponding channel, so as to obtain the decompressed features of the corresponding channel. The server performs feature recognition based on the decompressed features corresponding to each channel, so as to obtain an identity recognition result corresponding to the image to be recognized. The server feeds back the identity recognition result to the terminal.

[0142] In one embodiment, the terminal encodes the hidden layer features into a binary file, and uploads the binary file to the server. The server receives the binary file, decodes the binary file, and obtains the hidden layer features of each channel.

[0143] In one embodiment, the real image and the corresponding image feature of the user are pre-stored in the server. The server performs feature recognition based on the decompressed features corresponding to each channel respectively to obtain a recognition feature. The similarity between the recognition feature and the pre-stored image feature is calculated, and the identity recognition result is determined according to the similarity. Further, when the similarity between the recognition feature and the pre-stored image feature is greater than a similarity threshold, it is determined that the to-be-recognized image and the pre-stored image correspond to the same user, indicating that the identity recognition is successful. When the similarity between the recognition feature and the pre-stored image feature is less than or equal to the similarity threshold, it is determined that the to-be-recognized image and the pre-stored image are not the same user, indicating that the identity recognition fails.

[0144] For example, when the to-be-recognized image and the pre-stored image are both face images, if the similarity between the recognition feature corresponding to the to-be-recognized image and the image feature of the pre-stored image is greater than the similarity threshold, it indicates that the to-be-recognized image and the pre-stored image are face images of the same person. If the similarity between the recognition feature corresponding to the to-be-recognized image and the image feature of the pre-stored image is less than or equal to the similarity threshold, it indicates that the to-be-recognized image and the pre-stored image are face images of different persons.

[0145] Step S208, receiving the identity recognition result corresponding to the to-be-recognized image fed back by the server.

[0146] The identity recognition result includes identity recognition success and identity recognition failure.

[0147] Specifically, the terminal receives the identity recognition result corresponding to the to-be-recognized image fed back by the server, and performs corresponding processing based on the identity recognition result. For example, when the identity recognition result is identity recognition success, the terminal allows the user to perform corresponding operations, and when the identity recognition result is identity recognition failure, the terminal prohibits the user from performing corresponding operations.

[0148] In the image recognition method, the image to be recognized is obtained, and the image to be recognized is encoded and quantized to obtain quantized features corresponding to at least one channel. The quantized features of the corresponding channel are compressed by the target value range of each channel and the corresponding discrete cumulative probability interval. The hidden layer features corresponding to each channel obtained by the compression processing are uploaded to the server, which can effectively protect the privacy of the user, and can reduce the amount of data and bandwidth of transmission. The hidden layer features uploaded to the server are compressed, and the accurate image features can be obtained by decompression processing, avoiding the problem that the image to be recognized is directly leaked out in the process of directly uploading the image to be recognized to the server. The server performs corresponding decompression processing on the hidden layer features based on the pre-stored target value range and corresponding discrete cumulative probability interval of each channel to accurately obtain the decompressed features for identity recognition and return the identity recognition result to the terminal, thereby effectively protecting the accuracy of user identity recognition and the security of the recognition process.

[0149] In one embodiment, the quantized features of the corresponding channel are compressed by the target value range of each channel and the corresponding discrete cumulative probability interval to obtain hidden layer features corresponding to each channel, including:

[0150] For the quantized features corresponding to each channel, the probability interval corresponding to each character in the quantized features corresponding to the corresponding channel is determined by the target value range and the discrete cumulative probability interval corresponding to the corresponding channel. The encoding interval corresponding to each character is determined based on the probability interval corresponding to each character. For each channel, the hidden layer features corresponding to the corresponding channel are determined based on the encoding interval corresponding to each character corresponding to the corresponding channel.

[0151] Specifically, for the quantized features corresponding to a single channel, the terminal obtains the target value range and the discrete cumulative probability interval corresponding to the channel. The characters are read from the quantized features in sequence, and for each character read, the probability interval corresponding to the character is determined from the discrete cumulative probability interval based on the target value range. The encoding interval corresponding to the character is determined according to the probability interval corresponding to the character. According to the same processing described above, the encoding interval corresponding to each character in the quantized features can be obtained, and the hidden layer features corresponding to the quantized features can be determined based on the encoding interval corresponding to each character. The hidden layer features corresponding to the quantized features are the hidden layer features corresponding to the corresponding channel.

[0152] According to the same processing, the hidden layer features corresponding to each quantized feature can be obtained, i.e., the hidden layer features corresponding to each channel can be obtained.

[0153] In the embodiment, for the quantized feature corresponding to each channel, the probability interval corresponding to each character in the quantized feature corresponding to the channel is determined through the target value range and the discrete cumulative probability interval corresponding to the channel, the encoding interval corresponding to each character is determined based on the probability interval corresponding to each character, and the hidden layer feature corresponding to the channel is determined according to the encoding interval corresponding to each character of the channel, so that the quantized feature corresponding to each channel can be compressed to reduce the data amount of the quantized feature, the quantized feature in the form of compressed feature can be uploaded to the server, and the leakage of the quantized feature in the transmission process can be avoided.

[0154] In one embodiment, the probability interval corresponding to each character in the quantized feature corresponding to the channel is determined through the target value range and the discrete cumulative probability interval corresponding to the channel, including:

[0155] For the current character in the quantized feature of the channel, a matching character matching the current character in the target value range corresponding to the channel is determined, and the interval corresponding to the matching character in the corresponding discrete cumulative probability interval is taken as the probability interval corresponding to the current character.

[0156] The encoding interval corresponding to each character is determined based on the probability interval corresponding to each character, including: the encoding interval corresponding to the current character is determined according to the probability interval corresponding to the current character and the encoding interval corresponding to the adjacent previous character, and the next character in the quantized feature of the channel is continuously processed until the encoding interval corresponding to each character in the quantized feature is obtained.

[0157] Specifically, for the quantized feature corresponding to a single channel, the terminal acquires the target value range and the discrete cumulative probability interval corresponding to the channel. Characters are read from the quantized feature in sequence, and the read character is taken as the current character. The current character in the target value range is matched with each character in the target value range to determine the matching character in the target value range that matches the current character. The interval corresponding to the matching character in the discrete cumulative probability interval corresponding to the target value range is determined, and the determined interval is taken as the probability interval corresponding to the current character.

[0158] The encoding interval corresponding to the adjacent previous character of the current character is determined, and the encoding interval corresponding to the current character is determined according to the probability interval corresponding to the current character and the encoding interval corresponding to the adjacent previous character. Further, the terminal can acquire a compression formula, and the probability interval of the current character and the encoding interval corresponding to the previous character are substituted into the compression formula to obtain the encoding interval corresponding to the current character.

[0159] After obtaining the encoding interval corresponding to the current character, the next character is read from the quantized feature, and the read character is taken as the current character to perform the same processing as described above until the encoding interval corresponding to each character in the quantized feature is obtained.

[0160] For example, the compression formula is:

[0161] low i =low i-1 +(high i-1 -low i-1 )*L i ;high i =low i-1 +(high i-1 -low i-1 )*H i

[0162] wherein low i is a lower limit value in the encoding interval corresponding to the current character i, high i is an upper limit value in the encoding interval corresponding to the current character i, and the encoding interval corresponding to the current character i is (low i , high i ]. low i-1 and high i-1 are a lower limit value and an upper limit value in the encoding interval (low i-1 , low i-1 ] corresponding to the adjacent previous character i-1. L i and H i are a lower limit value and an upper limit value in the probability interval corresponding to the current character i.

[0163] In one embodiment, when the current character is the first character in the quantized feature, the first character has no encoding interval corresponding to the adjacent previous character, and thus the initial encoding interval [0, 1] is used. The probability interval of the first character and the initial encoding interval are substituted into the compression formula to obtain the encoding interval corresponding to the first character. That is, when the encoding interval corresponding to the first character in the quantized feature is calculated, (low i-1 , low i-1 ] in the compression formula is [0, 1].

[0164] When the current character is not the first character, the encoding interval corresponding to the adjacent previous character of the current character is determined, and the probability interval of the current character and the encoding interval corresponding to the previous character are substituted into the compression formula to obtain the encoding interval corresponding to the current character. According to the same processing, the encoding interval corresponding to the last character in the quantized feature can be obtained.

[0165] After obtaining the encoding interval corresponding to the last character in the quantized feature, a value is randomly selected from the encoding interval corresponding to the last character; the randomly selected value is taken as the hidden layer feature corresponding to the quantized feature, and the hidden layer feature corresponding to the quantized feature is the hidden layer feature corresponding to the single channel.

[0166] The quantized feature corresponding to each channel is processed in the above manner, and the hidden layer feature corresponding to each channel is obtained.

[0167] In one embodiment, after determining the matching character in the target value range corresponding to the respective channel that matches the current character, the adjacent previous character of the matching character in the target value range and the matching character are taken as the upper and lower limits of the matching interval, so as to obtain the matching interval corresponding to the current character. The lower limit value in the matching interval is determined to correspond to the value in the discrete cumulative probability interval corresponding to the target value range, and the upper limit value in the matching interval is determined to correspond to the value in the discrete cumulative probability interval corresponding to the target value range. The value corresponding to the lower limit value is taken as the lower limit value of the probability interval, and the value corresponding to the upper limit value is taken as the upper limit value of the probability interval, so as to obtain the probability interval corresponding to the current character.

[0168] For example, the quantized feature of a channel is [1, 2, 3, 4], the target value range corresponding to the channel is [-1, 0, 1, 2, 3, 4], and the discrete cumulative probability interval corresponding to the target value range is [0, 0.2, 0.3, 0.5, 0.8, 1]. The matching character in the target value range that matches the first character 1 in the quantized feature is 1, and the matching interval corresponding to the first character 1 in the target value range is (0, 1]. The probability interval corresponding to the matching interval (0, 1] in the discrete cumulative probability interval is (0.2, 0.3]. The initial encoding interval is taken as [0, 1], and the probability interval corresponding to the first character 1 is (0.2, 0.3] and the initial encoding interval [0, 1], which are substituted into the compression formula low i = low i-1 +(high i-1 -low i-1 )*L i ; high i = low i-1 +(high i-1 -low i-1 )*H i , that is, low i = 0 + (1-0)*0.2; high i = 0 + (1-0)*0.3, and the encoding interval corresponding to the first character 1 is (0.2, 0.3].

[0169] The second character in the quantitative feature is 2, so the matching character that matches character 2 in the target value range is 2, and the matching interval corresponding to character 2 in the target value range is (1, 2], and the probability interval corresponding to the matching interval (1, 2] in the discrete cumulative probability interval is (0.3, 0.5].

[0170] The first character's encoding interval (0.2, 0.3] is used as the low i-1 and high i-1 , that is, get low i =0.2+(0.3-0.2)*0.3; high i =0.2+(0.3-0.2)*0.5, and the encoding interval corresponding to character 2 is (0.23, 0.25].

[0171] Following the same processing method, the coding interval corresponding to each character in the quantitative feature can be calculated. After calculating the coding interval corresponding to the last character 4, any value is selected from the coding interval of character 4 as the hidden layer feature corresponding to the quantitative feature.

[0172] In this embodiment, for the current character in the quantitative features of the corresponding channel, a matching character that matches the current character in the target value range corresponding to the corresponding channel is determined, and the interval corresponding to the matching character in the corresponding discrete cumulative probability interval is used as the probability interval corresponding to the current character, thereby determining the encoding interval corresponding to the current character based on the probability interval corresponding to the current character and the encoding interval corresponding to the previous adjacent character. The next character in the quantitative features of the corresponding channel is processed in the same manner until the encoding interval corresponding to each character in the quantitative features is obtained. The quantitative features corresponding to each channel can be compressed to reduce the data volume of the quantitative features, facilitate uploading the quantitative features to the server in the form of compressed features, reduce the bandwidth used, and improve the security during data transmission.

[0173] In one embodiment, for each channel, the hidden layer features corresponding to the corresponding channel are determined based on the encoding intervals corresponding to the characters corresponding to the corresponding channel, including:

[0174] For each channel, a value is randomly selected from the coding interval corresponding to the last character of the quantized feature corresponding to the corresponding channel; the randomly selected value is used as the hidden layer feature corresponding to the corresponding channel until the hidden layer features corresponding to each channel are obtained.

[0175] Specifically, for a single channel, after obtaining the encoding interval corresponding to the last character in the quantized feature of the channel, a value is randomly selected from the encoding interval corresponding to the last character, and the randomly selected value is taken as the hidden layer feature corresponding to the channel. In the same way, the hidden layer feature corresponding to each channel can be obtained.

[0176] In this embodiment, a value is randomly selected from the encoding interval corresponding to the last character in the quantized feature, and the randomly selected value is taken as the hidden layer feature corresponding to the channel, which can increase the randomness of data selection within a certain constraint range. Moreover, the randomly selected value in the encoding interval corresponding to the last character does not affect the subsequent decompression processing, that is, any value in the encoding interval corresponding to the last character can be taken as the hidden layer feature, and the same hidden layer feature can be obtained after subsequent decompression processing, thereby ensuring the accuracy of decompression.

[0177] In one embodiment, the image recognition method is implemented by a target recognition model including a first sub-model and a second sub-model; the first sub-model is deployed on a terminal, and the second sub-model is deployed on a server; the first sub-model includes an encoder, a quantizer, a target value range of each channel, and a corresponding discrete cumulative probability interval; the second sub-model includes a target value range of each channel and a corresponding discrete cumulative probability interval, and a feature recognition network.

[0178] The image recognition method is implemented by a target recognition model, which can include a first sub-model and a second sub-model. The first sub-model is deployed on a terminal, and the second sub-model is deployed on a server. The terminal inputs a to-be-recognized image into the first sub-model to obtain hidden layer features corresponding to each channel output by the first sub-model. The terminal uploads the hidden layer features corresponding to each channel to the server, and the server inputs the hidden layer features corresponding to each channel into the corresponding channels in the second sub-model for processing to obtain an identity recognition result output by the second sub-model.

[0179] The first sub-model includes an encoder, a quantizer, a target value range of each channel, and a corresponding discrete cumulative probability interval. The terminal inputs a to-be-recognized image into the encoder for feature encoding to output encoding features corresponding to each channel. The encoding features corresponding to each channel output by the encoder are taken as input features corresponding to each channel of the quantizer, that is, the encoding features of each channel output by the encoder are input into the corresponding channels of the quantizer for quantization processing to obtain quantized features corresponding to each channel output by the quantizer. The quantized features corresponding to each channel output by the quantizer are compressed using the target value range and the discrete cumulative probability interval of the corresponding channel, respectively, to obtain the hidden layer features corresponding to each channel output.

[0180] The terminal uploads the hidden layer features corresponding to the channels to the server, and the server inputs the hidden layer features corresponding to the channels into the second sub-model. The second sub-model uses the target value range and the discrete cumulative probability interval of each channel to decompress the hidden layer features corresponding to the channel, to obtain decompressed features corresponding to each channel. The decompressed features corresponding to each channel are taken as the input of the corresponding channel in the feature recognition network, and the feature recognition network performs feature recognition on each decompressed feature to obtain recognition features. The feature recognition network outputs an identity recognition result based on the similarity between the recognition features and pre-stored image features. The server feeds back the identity recognition result input by the feature recognition network to the terminal.

[0181] In this embodiment, the image recognition method is implemented by a target recognition model including a first sub-model and a second sub-model. The first sub-model and the second sub-model of the target recognition model are respectively deployed on the terminal and the server, so that the terminal processes the to-be-processed image into hidden layer features through the first sub-model. The data uploaded to the server is hidden layer features, and the uploaded hidden layer features are compressed by the target value range and the discrete cumulative probability interval of each channel in the first sub-model. Even if the hidden layer features are leaked during data transmission, they cannot be accurately restored without decompression by the corresponding decompression method, thereby effectively protecting the privacy information of the user.

[0182] In one embodiment, the target recognition model is determined through a training step; as shown in Figure 3 The training step includes:

[0183] Step S302, determining a to-be-trained recognition model, the to-be-trained recognition model including an image encoder, a quantizer, an entropy network, and a feature recognition network.

[0184] Specifically, the to-be-trained recognition model can be determined, and the to-be-trained recognition model includes an image encoder, a quantizer, an entropy network, and a feature recognition network.

[0185] The to-be-trained recognition model can be deployed on the terminal for training on the terminal. The to-be-trained recognition model can also be deployed on the server for training on the server.

[0186] Step S304, obtaining a sample image and a corresponding identity label, and sequentially encoding and quantizing the sample image by the encoder and the quantizer in the to-be-trained recognition model to obtain sample quantized features.

[0187] Specifically, the terminal obtains a sample image and an identity label corresponding to the sample image, and inputs the sample image and the corresponding identity label into the to-be-trained recognition model.

[0188] The identification model to be trained encodes the sample image through an encoder to output sample encoding features corresponding to each channel. The sample encoding features corresponding to each channel output by the encoder are used as input features corresponding to each channel of a quantizer. That is, the sample encoding features corresponding to each channel output by the encoder are input into the corresponding channel of the quantizer to quantize the encoding features and obtain sample quantization features corresponding to each channel output by the quantizer.

[0189] At step S306, the entropy network is used to determine sample probability distributions corresponding to each pixel in the sample image based on the sample quantization features, and a sample image entropy corresponding to the sample image is determined according to the sample probability distributions.

[0190] The probability distribution represents the information entropy contained in the pixel in the image. The greater the probability distribution, the less useful information the pixel contains. The greater the probability distribution, the more useful information the pixel contains. The sample probability distribution represents the information entropy contained in the pixel in the image.

[0191] Specifically, the sample quantization features corresponding to each channel output by the quantizer are input into the corresponding channel of the entropy network. The entropy network is used to calculate sample probability distributions corresponding to each pixel in the corresponding sample quantization features through each channel of the entropy network to obtain sample probability distributions corresponding to each pixel output by each channel. After obtaining the sample probability distributions corresponding to each pixel in the sample image, a sample image entropy corresponding to the sample image is calculated according to the sample probability distributions corresponding to each pixel.

[0192] In one embodiment, determining the sample image entropy corresponding to the sample image according to the sample probability distributions includes averaging the sample probability distributions corresponding to each pixel in the sample image, and taking the average as the sample image entropy corresponding to the sample image.

[0193] In one embodiment, determining the sample image entropy corresponding to the sample image according to the sample probability distributions includes weighting and summing the sample probability distributions corresponding to each pixel in the sample image, and averaging to obtain the sample image entropy corresponding to the sample image.

[0194] At step S308, the entropy network is used to determine value ranges corresponding to each channel of the identification model to be trained based on the sample quantization features, and channel probability distributions corresponding to each value range are calculated.

[0195] Specifically, the entropy network is configured with value ranges corresponding to each channel. For each value range, the lower limit value and the upper limit value in the value range are input into the entropy network to obtain channel probability distributions corresponding to the lower limit value and the upper limit value in each value range, respectively.

[0196] At step S310, a channel probability loss is determined based on the channel probability distributions corresponding to each value range.

[0197] Specifically, the channel probability loss is calculated according to the channel probability distribution corresponding to the lower limit value and the upper limit value in each value range.

[0198] In step S312, the sample quantized features are recognized by the feature recognition network to obtain sample recognition results.

[0199] Specifically, the sample quantized features output by each channel of the quantizer are respectively taken as the input corresponding to the corresponding channel in the feature recognition network, and the feature recognition network performs feature extraction, pooling, full connection and other processing on each sample quantized feature to obtain recognition features. The feature recognition network outputs sample recognition results based on the recognition features.

[0200] In step S314, an image recognition loss is determined based on the sample recognition results and the identity label, and a target loss function is constructed according to the image recognition loss, the channel probability loss and the sample image entropy.

[0201] Specifically, the image recognition loss is calculated according to the sample image recognition results and the corresponding identity label, and the image recognition loss, the channel probability loss and the sample image entropy are summed as the target loss function.

[0202] In one embodiment, the image recognition loss, the channel probability loss and the sample image entropy are respectively multiplied by the corresponding weights, and the products are summed as the target loss function.

[0203] In step S316, the target loss function is used to train the to-be-trained recognition model until the training stops when the training stopping condition is met, and a trained target recognition model is obtained.

[0204] The target recognition model includes target value ranges corresponding to each channel, and the discrete cumulative probability interval corresponding to each channel target value range is determined by the entropy network in the trained target recognition model based on the corresponding channel target value range.

[0205] The training stopping condition can be at least one of the loss error of the recognition model being less than or equal to a loss threshold, the number of iterations of the recognition model reaching a preset number of iterations, and the iteration time reaching a preset iteration time.

[0206] Specifically, the terminal can train the to-be-trained recognition model by the target loss function, adjust the parameters of the recognition model during the training and continue the training until the recognition model meets the target training stopping condition to stop the training, and obtain the trained target recognition model. The trained target recognition model is used for identity recognition of a to-be-recognized image to output an identity recognition result corresponding to the to-be-recognized image.

[0207] In an embodiment, the parameters of the identification model, the encoder, the quantizer, the entropy network and the feature recognition network are adjusted during the training process and the training continues until the identification model meets the target training stop condition, and the training of the identification model stops, obtaining a trained target identification model. The trained target identification network includes a trained encoder, a trained quantizer, a trained entropy network and a trained feature recognition network.

[0208] Further, the trained entropy network includes not only the processing parameters of each layer, but also the target value range corresponding to each channel.

[0209] In an embodiment, the trained target identification model includes a target value range corresponding to each channel, and the entropy network in the target identification model determines the channel probability distribution corresponding to each value in each target value range based on the target value range corresponding to each channel; for each target value range corresponding to each channel, the discrete cumulative probability interval corresponding to the corresponding target value range is calculated according to the channel probability distribution corresponding to each value in the corresponding target value range.

[0210] In this embodiment, the sample quantization features of the sample image are processed by the entropy network to obtain the sample probability distribution corresponding to each pixel in the sample image, so as to determine the sample image entropy corresponding to the sample image. The sample image entropy is used as part of the target loss function to determine the loss degree of the key information of the sample image. At the same time, according to the channel probability distribution corresponding to the value range of each channel of the entropy network, the channel probability loss is calculated, which can be used as part of the target loss function to optimize the value range of each channel during the training process, thereby realizing the constraint of the output features of the entropy network. Moreover, the loss between the prediction result and the real result of the sample quantization features in the feature recognition network is used as part of the target loss function to realize the training of the feature recognition network. Through a series of constraints, the overall training of the identification model is realized, so that the trained target identification model has higher prediction accuracy and accuracy.

[0211] In an embodiment, the image to be identified is a face image; the image to be identified is obtained, and the image to be identified is encoded and quantized to obtain quantization features corresponding to at least one channel, including:

[0212] In response to a resource transfer trigger operation on the resource amount, a face image is collected; the face image is encoded and quantized to obtain quantization features corresponding to at least one channel;

[0213] After receiving the identity recognition result corresponding to the to-be-identified image from the server, the method further includes: when the identity recognition result is a successful recognition, performing a resource transfer operation; the resource transfer operation is used to transfer the resource amount from a resource account of an operation initiator to a resource account of a receiver.

[0214] Specifically, the image recognition method can be applied to a resource transfer scenario, and the to-be-identified image can be a face image. When a user needs to perform a resource transfer operation, the user can obtain a to-be-transferred resource amount through a terminal, and trigger the resource transfer operation of the resource amount.

[0215] In an embodiment, a resource transfer application is installed on the terminal, the user enters the resource transfer application, calls a graphical code collection function in the resource transfer application to collect a graphical code of the receiver, enters a resource transfer interface, and inputs the to-be-transferred resource amount in the resource transfer interface, or enters the resource transfer interface through the collection of the graphical code of the receiver, and the resource transfer interface already includes the to-be-transferred resource amount. The user can trigger the resource transfer application to collect the current face image through the resource amount.

[0216] In an embodiment, the user can input a resource account of the receiver in the resource transfer application to enter the resource transfer interface, and input the to-be-transferred resource amount in the resource transfer interface.

[0217] The terminal collects the current face image through the camera in response to the resource transfer trigger operation of the user on the resource amount. The terminal encodes and quantizes the face image to obtain quantized features corresponding to at least one channel. The terminal compresses the quantized features of the corresponding channel through a target value range of each channel and a corresponding discrete cumulative probability interval to obtain hidden layer features corresponding to each channel respectively. The terminal can encode the hidden layer features corresponding to each channel into a binary file, and upload the binary file to a server corresponding to the terminal.

[0218] The server receives the binary file to decode to obtain the hidden layer features corresponding to each channel. The server decompresses the hidden layer features of the corresponding channel through the target value range of each channel and the corresponding discrete cumulative probability interval to obtain decompressed features of the corresponding channel. Feature recognition is performed based on the decompressed features corresponding to each channel respectively to obtain an identity recognition result corresponding to the face image, and the identity recognition result is fed back to the terminal.

[0219] The terminal receives the identity recognition result, when the identity recognition result is a successful identity recognition, performs a resource transfer operation to transfer the resource amount from a resource account of an operation initiator to a resource account of a receiver. When the identity recognition result is a failed identity recognition, the resource transfer operation is not performed, and an identity recognition error is prompted.

[0220] In this embodiment, the image recognition method is applied to resource transfer. In response to a resource transfer operation on a resource amount, a face image is collected. The face image is quantized, encoded and compressed by the terminal to obtain compressed hidden layer features. The server uploads the compressed hidden layer features, which need to be decompressed to obtain accurate image features. This avoids data leakage when the face image is directly uploaded to the server, and prevents the user's face image from being directly leaked. The server decompresses the hidden layer features to obtain accurate decompressed features for identity recognition. When the identity recognition result of the face image is identity recognition success, the resource transfer operation is executed. If the identity recognition result is not identity recognition success, the resource transfer operation is not executed. Therefore, the security of resource transfer can be improved.

[0221] As shown in Figure 4 , it is a flowchart of face recognition in an embodiment.

[0222] In step S402, the encoder, quantizer, target value range of each channel and corresponding discrete cumulative probability interval are deployed in the terminal. The target value range of each channel and corresponding discrete cumulative probability interval, and the feature recognition network are deployed in the server.

[0223] In step S404, the terminal collects the face image a of user A through the camera, and obtains the hidden layer features f through the encoding, quantization and compression of the encoder, quantizer, target value range of each channel and corresponding discrete cumulative probability.

[0224] In step S406, the hidden layer features f are uploaded to the server. The server decompresses and recognizes the hidden layer features through the target value range of each channel and corresponding discrete cumulative probability interval, and the feature recognition network to obtain the face features e.

[0225] In step S408, user B in the registration library is selected. The face features e of user A and the face features of user B are compared to obtain the similarity j.

[0226] In step S410, it is judged whether the similarity j is higher than the preset threshold t. If yes, step S412 is executed, i.e. it is determined that user A and user B are the same person. Otherwise, step S414 is executed, i.e. user A and user B are not the same person, and then step S416 is executed.

[0227] In step S416, it is judged whether there are other face features of users in the registration feature library. If yes, another user B is selected from the registration feature library, and the process returns to step S408 and continues. If no, the recognition process is ended.

[0228] In an embodiment, the image recognition method can be applied to a face payment scenario. A payment application is installed on a mobile phone, a user enters the payment application, and a QR code collection function is called in the payment application to collect a QR code of a receiving party to enter a payment interface. A payment amount is input in the payment interface, or the payment interface is entered by collecting the QR code of the receiving party, and the payment amount already exists in the payment interface. The user can confirm the payment amount to make the payment application call a camera to collect a current face image.

[0229] The mobile phone obtains the face image, encodes the face image through an encoder to obtain encoded features corresponding to each channel, and inputs the encoded features corresponding to each channel into a quantizer to obtain quantized features corresponding to each channel.

[0230] The mobile phone determines a matching character in a target value range corresponding to the respective channel and matching the current character in the quantized features of the respective channel, and takes an interval corresponding to the matching character in the respective discrete cumulative probability interval as a probability interval corresponding to the current character.

[0231] The mobile phone determines an encoding interval corresponding to the current character according to the probability interval corresponding to the current character and an encoding interval corresponding to an adjacent previous character, continues to process a next character in the quantized features of the respective channel, and determines an encoding interval corresponding to each character in the quantized features.

[0232] For each channel, the mobile phone randomly selects a value from an encoding interval corresponding to a last character in the quantized features corresponding to the respective channel, and takes the randomly selected value as a hidden layer feature corresponding to the respective channel until hidden layer features corresponding to each channel are obtained.

[0233] The mobile phone uploads the hidden layer features corresponding to each channel to a server, and the server receives the hidden layer features corresponding to each channel.

[0234] The server determines a character probability interval corresponding to the hidden layer feature in the discrete cumulative probability interval of the respective channel for each channel, and determines a first character in the hidden layer feature from a target value range based on the character probability interval.

[0235] The server takes the first character as a current character, and updates the discrete cumulative probability interval based on a character probability interval of the current character and an initial probability interval.

[0236] The server determines a next character of the current character from the target value range based on a character probability interval corresponding to the hidden layer feature in the updated discrete cumulative probability interval.

[0237] The server takes the next character as the current character, and returns the probability interval based on the current character and the initial probability interval, updates the step of the discrete cumulative probability interval, and continues to execute until the last character in the hidden layer feature is obtained.

[0238] The server takes each character in the hidden layer feature as the decompression feature of the corresponding channel.

[0239] The server inputs the decompression features of each channel into the feature recognition network to perform feature recognition based on the decompression features corresponding to each channel, obtains an identity recognition result corresponding to the face image, and feeds back the identity recognition result to the mobile phone.

[0240] The mobile phone receives the identity recognition result, and when the identity recognition result is identity recognition success, performs a payment amount transfer operation to transfer the payment amount from the payment account of the operation initiator to the payment account of the receiver. When the identity recognition result is identity recognition failure, the payment operation is not performed, and an identity recognition error is prompted on the mobile phone.

[0241] In this embodiment, the image recognition method is applied to mobile phone face payment. The current face image of the user using the mobile phone is collected before the payment amount, and the face image is quantized, encoded, and compressed by the encoder and quantizer of the terminal to obtain the compressed hidden layer feature. The server uploads is the hidden layer feature after compression processing, and the corresponding decompression processing is required to obtain accurate image features, avoiding data leakage in the process of directly uploading the face image to the server, which may cause the user's face image to be directly leaked. The server performs corresponding decompression processing on the hidden layer feature to accurately obtain the decompression feature for identity recognition. When the identity recognition result corresponding to the face image is identity recognition success, the payment operation is performed, and the identity recognition result is not executed. The payment operation, thereby improving the security of the mobile phone face payment. And can effectively protect the privacy data of the user in the process of face payment.

[0242] In one embodiment, the image to be recognized is a face image; obtaining the image to be recognized includes: in response to a trigger operation of access control, collecting a face image;

[0243] After receiving the identity recognition result corresponding to the image to be recognized feedback by the server, the method further comprises: when the identity recognition result corresponding to the face image is recognition success, controlling the access control terminal to perform an access control starting operation.

[0244] Specifically, the image recognition method can be applied to an access control scene, and the image to be recognized can be a face image. When the user needs to open the access control, the access control process of the terminal can be triggered.

[0245] The terminal collects a current face image through a camera in response to a trigger operation of a user on the access control. The terminal encodes and quantizes the face image to obtain quantized features corresponding to at least one channel. The terminal compresses the quantized features of the corresponding channel through a target value range and a corresponding discrete cumulative probability interval of each channel to obtain hidden layer features corresponding to each channel respectively. The terminal encodes the hidden layer features corresponding to each channel into a binary file and uploads the binary file to a server corresponding to the terminal.

[0246] The server decodes the binary file to obtain the hidden layer features corresponding to each channel. The server decompresses the hidden layer features of the corresponding channel through the target value range and the corresponding discrete cumulative probability interval of each channel to obtain decompressed features of the corresponding channel. Feature recognition is performed based on the decompressed features corresponding to each channel respectively to obtain an identity recognition result corresponding to the face image, and the identity recognition result is fed back to the terminal.

[0247] The terminal receives the identity recognition result, and when the identity recognition result is an identity recognition success, the terminal controls the access control terminal to perform an access control starting operation. When the identity recognition result is an identity recognition failure, the access control starting operation is not performed, and an identity recognition error is prompted.

[0248] It can be understood that the terminal can be an access control terminal or a mobile phone with an access control function, but is not limited thereto. When the terminal is an access control terminal, the access control terminal receives the identity recognition result fed back by the server, and when the identity recognition result is an identity recognition success, the access control terminal performs an access control starting operation.

[0249] In this embodiment, the image recognition method is applied to the access control, a face image is collected in response to a trigger operation on the access control, and the face image is quantized, encoded and compressed by the terminal to obtain compressed hidden layer features. The server uploads the compressed hidden layer features, and the corresponding decompression processing is required to obtain accurate image features, thereby avoiding data leakage in the process of directly uploading the face image to the server, and preventing the user's face image from being directly leaked. The server performs corresponding decompression processing on the hidden layer features to accurately obtain decompressed features for identity recognition. When the identity recognition result corresponding to the face image is a recognition success, the access control terminal performs an access control starting operation, thereby improving the security of the access control and the security of the identity verification when the access control is started.

[0250] In one embodiment, as shown in Figure 5 , an image recognition method is provided, which is applied to a server in Figure 1 for example, and includes the following steps:

[0251] Step S502, receiving the hidden layer features corresponding to at least one channel. The hidden layer features corresponding to at least one channel are obtained by encoding and quantizing the to-be-identified image, obtaining quantized features corresponding to each channel, and compressing the quantized features corresponding to each channel through the target value range of each channel and the corresponding discrete cumulative probability interval.

[0252] Specifically, the terminal obtains a to-be-identified image, encodes and quantizes the to-be-identified image, and obtains quantized features corresponding to at least one channel. The quantized features corresponding to each channel are compressed through the target value range of each channel and the corresponding discrete cumulative probability interval to obtain hidden layer features corresponding to each channel respectively, and the hidden layer features corresponding to each channel are uploaded to the server. The server receives the hidden layer features uploaded by the terminal.

[0253] In one embodiment, the terminal encodes the hidden layer features into a binary file, and uploads the binary file to the server. The server receives the binary file, decodes the binary file to obtain the hidden layer features of each channel.

[0254] Step S504, decompressing the hidden layer features corresponding to each channel through the target value range of each channel and the corresponding discrete cumulative probability interval to obtain decompressed features corresponding to each channel.

[0255] The target value range of each channel and the corresponding discrete cumulative probability interval are pre-stored in the server. For the hidden layer features of each channel, the server can decompress the hidden layer features of each channel through the target value range of each channel and the corresponding discrete cumulative probability interval to obtain the decompressed features corresponding to each channel.

[0256] Step S506, performing feature recognition based on the decompressed features corresponding to each channel respectively to obtain an identity recognition result corresponding to the to-be-identified image, and feeding back the identity recognition result to the terminal.

[0257] The identity recognition results include successful identity recognition and failed identity recognition. The real image of the user and the corresponding image features are pre-stored in the server. The server performs feature recognition based on the decompressed features corresponding to each channel to obtain the recognition feature. The similarity between the recognition feature and the pre-stored image feature is calculated, and the identity recognition result is determined based on the similarity. Furthermore, when the similarity between the recognition feature and the pre-stored image feature is greater than the similarity threshold, it is determined that the image to be recognized and the pre-stored image correspond to the same user, indicating that the identity recognition is successful. When the similarity between the recognition feature and the pre-stored image feature is less than or equal to the similarity threshold, it is determined that the image to be recognized and the pre-stored image are not the same user, indicating that the identity recognition has failed. After obtaining the identity recognition result corresponding to the image to be recognized, the server feeds back the identity recognition result to the terminal.

[0258] In this embodiment, the terminal encodes and quantizes the image to be identified, obtaining quantized features corresponding to at least one channel. The quantized features of the corresponding channel are then compressed using the target value range and corresponding discrete cumulative probability interval for each channel. The resulting compressed hidden features corresponding to each channel are then uploaded to the server. This effectively protects user privacy while reducing the amount of transmitted data and bandwidth. The compressed hidden features uploaded to the server require corresponding decompression to obtain accurate image features, avoiding data leakage during direct upload of the image to be identified to the server, which could lead to the direct leakage of the image to be identified. The server decompresses the hidden features based on the pre-stored target value range and corresponding discrete cumulative probability interval for each channel, accurately obtaining the decompressed features for identity recognition, thereby effectively improving the accuracy of user identification and the security of the identification process. This also reduces the amount of storage required on the server.

[0259] In one embodiment, Figure 6 As shown in the figure, the hidden layer features of the corresponding channel are decompressed through the target value range of each channel and the corresponding discrete cumulative probability interval to obtain the decompressed features of the corresponding channel, including:

[0260] Step S602: for each hidden feature corresponding to each channel, determine the character probability interval corresponding to the hidden feature in the discrete cumulative probability interval of the corresponding channel, and determine the first character in the hidden feature from the corresponding target value range based on the character probability interval.

[0261] Specifically, for a hidden layer feature of a channel, the server determines a discrete cumulative probability interval corresponding to the channel, determines a range to which the hidden layer feature belongs in the discrete cumulative probability interval, takes the range as a character probability interval corresponding to the first character, determines a value corresponding to the character probability interval in the target value range, and takes the value as the first character in the hidden layer feature. The first character in each hidden layer feature can be obtained in the same manner.

[0262] In step S604, the first character is taken as a current character, and the discrete cumulative probability interval is updated based on the character probability interval of the current character and the initial probability interval.

[0263] Specifically, the server takes the first character as a current character, determines an initial probability interval corresponding to the current character in the discrete cumulative probability interval, and thus updates a value corresponding to the current character in the discrete cumulative probability interval according to the character probability interval of the current character and the initial probability interval. For each character in the target value range, an initial probability interval corresponding to each character in the discrete cumulative probability interval is determined, and thus intervals corresponding to each character in the discrete cumulative probability interval are updated according to the character probability interval of the current character and the initial probability intervals corresponding to each character, to obtain an updated discrete cumulative probability interval.

[0264] In step S606, the next character of the current character is determined from the target value range based on the character probability interval corresponding to the hidden layer feature in the updated discrete cumulative probability interval.

[0265] Specifically, the range to which the hidden layer feature belongs in the updated discrete cumulative probability interval is taken as a character probability interval corresponding to the next character of the current character. A value corresponding to the character probability interval in the target value range is determined, and the value is taken as the next character of the current character. The next character of each current character can be obtained in the same manner.

[0266] In step S608, the next character is taken as a current character, and the step of updating the discrete cumulative probability interval based on the probability interval of the current character and the initial probability interval is returned and continued to be executed until the last character in the hidden layer feature is obtained. Each character in the hidden layer feature is taken as a decompression feature of a corresponding channel.

[0267] Specifically, the next character is taken as a current character, and the step of updating the discrete cumulative probability interval based on the probability interval of the current character and the initial probability interval is returned and continued to be executed until the last character in the hidden layer feature is obtained. Each character in the hidden layer feature corresponding to each channel can be obtained in the same manner, and each character in the hidden layer feature is taken as a decompression feature of a corresponding channel, to obtain a decompression feature corresponding to each channel respectively.

[0268] In this embodiment, for each channel corresponding to the hidden layer feature, the corresponding character probability interval of the hidden layer feature in the discrete cumulative probability interval of the corresponding channel is determined, and the first character in the hidden layer feature is determined from the corresponding target value range based on the character probability interval, the first character is taken as the current character, and the discrete cumulative probability interval is updated based on the character probability interval of the current character and the initial probability interval. The next character of the current character is determined from the target value range based on the corresponding character probability interval of the hidden layer feature in the updated discrete cumulative probability interval, the next character is taken as the current character, and the probability interval based on the current character is returned. The step of updating the discrete cumulative probability interval is continued to be executed until the last character in the hidden layer feature is obtained, and each character in the hidden layer feature is taken as the decompression feature of the corresponding channel, so that the decompression feature corresponding to each channel can be accurately decompressed based on the decompression corresponding to the compression processing, so as to accurately identify the identity on the server.

[0269] For example, the quantization feature of a channel is [1, 3], the target value range corresponding to the channel is [-1, 0, 1, 2, 3, 4], and the discrete cumulative probability interval corresponding to the target value range is [0, 0.2, 0.3, 0.5, 0.8, 1].

[0270] Compression processing:

[0271] For the first character 1 in the quantization feature, the matching interval corresponding to the target value range is [0, 1], the corresponding probability interval is [0.2, 0.3], and the initial encoding interval is taken as [0, 1], then the probability interval corresponding to the first character 1 is [0.2, 0.3] and the initial encoding interval [0, 1] are substituted into the compression formula, that is: low i = 0 + (1-0) * 0.2; high i = 0 + (1-0) * 0.3, the encoding interval corresponding to the first character 1 is obtained as [0.2, 0.3].

[0272] The second character in the quantization feature is 3, then the matching interval corresponding to the character 3 in the target value range is [3, 4], and the corresponding probability interval in the discrete cumulative probability interval is [0.5, 0.8].

[0273] 0.2 and 0.3 in the encoding interval [0.2, 0.3] of the previous character are taken as low i-1 and high i-1 in the compression formula, that is, low i = 0.2 + (0.3-0.2) * 0.5; high i= 0.2 + (0.3 - 0.2) * 0.8, the encoding interval corresponding to the character 3 is [0.25, 0.28], and the value 0.25 is selected from the encoding interval [0.25, 0.28] as the hidden layer feature and uploaded to the server.

[0274] Decompression processing:

[0275] The server deploys the target value range [-1, 0, 1, 2, 3, 4] corresponding to the channel, and the discrete cumulative probability interval [0, 0.2, 0.3, 0.5, 0.8, 1] corresponding to the target value range. After receiving the hidden layer feature 0.25, it can be determined that 0.25 is in the character probability interval (0.2, 0.3] in the discrete cumulative probability interval, and the value corresponding to the character probability interval (0.2, 0.3] in the list is (0, 1], so the first character is 1.

[0276] Taking 0.2 and 0.3 in the character probability interval (0.2, 0.3] as the lower limit value and the upper limit value in the new discrete cumulative probability interval respectively, then for [-1, 0] in the target value range, the initial probability interval in the original discrete cumulative probability interval is [0, 0.2], and the new character probability interval corresponding to [-1, 0] is:

[0277] low + (high - low) * L = 0.2 + (0.3 - 0.2) * 0 = 0.2

[0278] low + (high - low) * H = 0.2 + (0.3 - 0.2) * 0.2 = 0.22

[0279] For [0, 1], the initial probability interval in the discrete cumulative probability interval is [0.2, 0.3], and the corresponding new character probability interval is:

[0280] low + (high - low) * L = 0.2 + (0.3 - 0.2) * 0.2 = 0.22

[0281] low + (high - low) * H = 0.2 + (0.3 - 0.2) * 0.3 = 0.23

[0282] For [1, 2], the initial probability interval is [0.3, 0.5], and the corresponding new character probability interval is:

[0283] low + (high - low) * L = 0.2 + (0.3 - 0.2) * 0.3 = 0.23

[0284] low + (high - low) * H = 0.2 + (0.3 - 0.2) * 0.5 = 0.25

[0285] For [2, 3], the initial probability interval is [0.5, 0.8], then the corresponding new character probability interval is:

[0286] low+(high-low)*L=0.2+(0.3-0.2)*0.5=0.25

[0287] low+(high-low)*H=0.2+(0.3-0.2)*0.8=0.28

[0288] For [3, 4], the initial probability interval is [0.8, 1], then the corresponding new character probability interval is:

[0289] low+(high-low)*L=0.2+(0.3-0.2)*0.8=0.28

[0290] low+(high-low)*H=0.2+(0.3-0.2)*1=0.30

[0291] Therefore, the updated discrete cumulative probability interval becomes (0.2, 0.22, 0.23, 0.25, 0.28, 0.3). The character probability interval corresponding to the hidden feature 0.25 in the updated discrete cumulative probability interval is (0.25, 0.28]. The corresponding value of the probability interval (0.25, 0.28) in the list is (2, 3). It can be seen that the second character is 3, and the decompressed feature can be obtained as 13.

[0292] like Figure 7 FIG. 1 is a schematic diagram of an architecture for testing using a target recognition model in one embodiment.

[0293] The image to be identified is input into the encoder to obtain the encoding feature y, and the encoding feature y is quantized by the quantizer to obtain the quantized features corresponding to each channel The quantitative characteristics of each channel Input entropy network, entropy network quantizes the corresponding features through the target value range of the corresponding channel and the corresponding discrete cumulative probability interval Compression processing is performed to obtain the shallow features corresponding to each channel. Then, based on the target value range of the corresponding channel and the corresponding discrete cumulative probability interval, the corresponding shallow features are decompressed to obtain the quantized features corresponding to each channel. The quantized features corresponding to each channel output by the entropy network As the input of the feature recognition model, the identity recognition result corresponding to the image to be recognized output by the feature recognition model is obtained.

[0294] In one embodiment, Figure 8As shown, a recognition model training method is provided, which can be applied to, for example Figure 1 implemented on a terminal or a server. For example, taking the terminal in Figure 1 as an example, the method includes the following steps:

[0295] Step S802, determining a to-be-trained recognition model, the to-be-trained recognition model including an image encoder, a quantizer, an entropy network, and a feature recognition network.

[0296] Specifically, the to-be-trained recognition model can be determined, which includes an image encoder, a quantizer, an entropy network, and a feature recognition network.

[0297] The to-be-trained recognition model can be deployed on a terminal for training on the terminal. The to-be-trained recognition model can also be deployed on a server for training on the server.

[0298] Step S804, obtaining a sample image and a corresponding identity label, and sequentially performing encoding and quantization processing on the sample image by the encoder and the quantizer in the to-be-trained recognition model to obtain sample quantization features.

[0299] Specifically, the terminal obtains a sample image and an identity label corresponding to the sample image, and inputs the sample image and the corresponding identity label into the to-be-trained recognition model.

[0300] The to-be-trained recognition model performs encoding processing on the sample image by the encoder to output sample encoding features corresponding to each channel. The sample encoding features corresponding to each channel output by the encoder are used as input features corresponding to each channel of the quantizer, that is, the sample encoding features of each channel output by the encoder are input into the corresponding channel of the quantizer to perform quantization processing on the encoding features to obtain sample quantization features corresponding to each channel output by the quantizer.

[0301] In an embodiment, the encoder is a VAE (Variational Auto-Encoder)-based encoder, which mainly stacks convolutional layers with a step size of 2 and a convolution kernel size of 5 and GDN alternately to downsample the sample image by 16 times. The GDN is similar to the BN (Batch Normalization) and will constrain the input and output within a certain range by using learnable parameters, but the parameters of the BN at each position in the space are the same, while the constraint term of the GDN at each position in the space is calculated according to all channels at the position, thereby being more conducive to learning the statistical characteristics of the data and not being degraded into a linear function in the test stage like the BN. Therefore, the GDN has the characteristics of spatial adaptability and high nonlinearity. For example, the processing of the encoder is as follows:

[0302]

[0303] The formula is as follows, where represents the feature value at (m, n) on the i-th channel in the k-th stage, and β and γ are learnable parameters. represents the feature value at (m, n) on the i-th channel in the k+1-th stage. i is the current channel in the current stage, and j is the other channel in the current stage. represents the feature value at (m, n) on the j-th channel in the k-th stage. The output of the previous layer in the encoder is taken as the input of the next layer until the output of the last layer of the encoder is obtained, that is, the latent representation y is obtained.

[0304] In one embodiment, the quantizer adds a uniform noise to the latent representation y to approximate the quantization in the form of round, so that the entire training process is derivable.

[0305]

[0306] wherein, is the quantized feature corresponding to the encoded feature y, and Δy is a random noise value added, with a value range of (0, 1), i.e., μ(0, 1).

[0307] In step S806, the sample probability distribution corresponding to each pixel in the sample image is determined based on the sample quantized feature through the entropy network, and the sample image entropy corresponding to the sample image is determined according to the sample probability distribution.

[0308] Specifically, the sample quantized feature corresponding to each channel output by the quantizer is input into the corresponding channel of the entropy network. The sample probability distribution corresponding to each pixel in the corresponding sample quantized feature is calculated through each channel of the entropy network to obtain the sample probability distribution corresponding to each pixel output by each channel. After obtaining the sample probability distribution corresponding to each pixel in the sample image, the sample image entropy corresponding to the sample image is calculated according to the sample probability distribution corresponding to each pixel.

[0309] In one embodiment, determining the sample image entropy corresponding to the sample image according to the sample probability distribution comprises: averaging the sample probability distribution corresponding to each pixel in the sample image, and taking the average as the sample image entropy corresponding to the sample image.

[0310] In one embodiment, determining the sample image entropy corresponding to the sample image according to the sample probability distribution comprises: weighting and summing the sample probability distribution corresponding to each pixel in the sample image, and averaging to obtain the sample image entropy corresponding to the sample image.

[0311] In one embodiment, the entropy network processes as follows:

[0312]

[0313] p=f K ′·f K ' -1 …f1′

[0314] Among them, c is the cumulative distribution function, which refers to the combination of various functions in the entropy network, and p is the probability density function, which refers to the cumulative multiplication of multiple function derivatives.

[0315] The relationship between the functions in the entropy network is expressed as follows:

[0316] f k (x) = g k (H (k) x+b (k) )

[0317] f K (x) = sigmoid(H (K) x+b (K) )

[0318] g k (x) = x + a (k) ⊙tanh(x)

[0319]

[0320]

[0321] Among them, K is the last layer, k is the middle layer; f k (x) is the characteristic value output by the middle layer, f k (x) is the g calculated by each intermediate layer k (x). b (K) , represents the learnable parameters.

[0322] First layer: H is calculated based on the sample quantization feature x output by the quantization model (k) x+b (k) , then (H (k) x+b (k) ) is represented by x; then calculate g k (x) = x + a (k) ⊙tanh(x);

[0323] The second layer: g output from the previous layer k (x) is represented by x, and then H is calculated first (k) x+b (k) , then (H (k) x+b (k) ) is expressed as x, and g is calculated k (x) = x + a (k)tanh(x); this g k (x) is f k (x)

[0324] For each layer of processing, the output of the previous layer is f k (x) is calculated, and then H (k) x+b (k) is calculated, and then g (k) (x) = x+a (k) tanh(x) is calculated, i.e. g k (x) of the layer output is obtained. g (k) (x) is f k (x) k (x) is f k (x)

[0325] The last layer: g k (x) of the output of the previous layer is expressed as x, H (K) x+b (K) is calculated, and then f K (x) = sigmoid(H (K) x+b (K) ) is calculated. f K (x) is the feature value of the last layer output, and the value range of f K (x) is [0, 1].

[0326] In an embodiment, in order to ensure that the derivative (i.e. p = f' K · f' K-1 … f'1) is non-negative, it can be ensured that c is increasing. Through such a design of the cumulative function, the following condition can be met:

[0327]

[0328] Then the probability distribution of the final sample quantization feature y can be obtained by the following formula, where represents the density function of the random noise added in the quantization step: is the probability distribution of y.

[0329]

[0330] The difference between and the feature value f of the last layer output is calculated by the above-mentioned x, through the processing process of the above-mentioned first layer to the last layer, to obtain the feature value f of the last layer output is calculated by the above-mentioned x, through the processing process of the above-mentioned first layer to the third layer, to obtain the feature value f The difference between the two feature values is taken as the probability distribution of the pixel

[0331] At step S808, the value range corresponding to each channel in the to-be-trained recognition model is determined based on the sample quantized features through the entropy network, and the channel probability distribution corresponding to each value range is calculated.

[0332] Specifically, the value range corresponding to each channel is set in the entropy network. For each value range, the lower limit value and the upper limit value in the value range are respectively taken as the input of the entropy network, and the channel probability distribution corresponding to the lower limit value and the upper limit value in each value range is obtained.

[0333] At step S810, the channel probability loss is determined based on the channel probability distribution corresponding to each value range.

[0334] Specifically, the channel probability loss is calculated according to the channel probability distribution corresponding to the lower limit value and the upper limit value in each value range.

[0335] At step S812, the sample recognition result is obtained by performing recognition processing on the sample quantized features through the feature recognition network.

[0336] Specifically, the sample quantized features output by each channel of the quantizer are respectively taken as the input corresponding to the corresponding channel in the feature recognition network, and the feature recognition network performs feature extraction, pooling, full connection and other processing on each sample quantized feature to obtain a recognition feature. The feature recognition network outputs a sample recognition result based on the recognition feature.

[0337] At step S814, the image recognition loss is determined based on the sample recognition result and the identity label, and the target loss function is constructed according to the image recognition loss, the channel probability loss and the sample image entropy.

[0338] Specifically, the image recognition loss is calculated according to the sample image recognition result and the corresponding identity label, and the image recognition loss, the channel probability loss and the sample image entropy are summed as the target loss function.

[0339] In one embodiment, the image recognition loss, the channel probability loss and the sample image entropy are weighted and summed as the target loss function.

[0340] For example, the target loss function is as follows:

[0341]

[0342] Wherein, L is the target loss function, is the image recognition loss, is the sample image entropy, N is the number of pixels in the sample image, p(i) is the probability distribution of pixel i, L aux is the channel probability loss, and λ is the weight corresponding to the sample image entropy.

[0343] Step S816, training the to-be-trained recognition model by the target loss function until a training stop condition is reached to stop, obtaining a trained target recognition model; the target recognition model is used for identity recognition on the to-be-recognized image.

[0344] The training stop condition can be at least one of that the loss error of the recognition model is less than or equal to a loss threshold, the number of iterations of the recognition model reaches a preset number of iterations, and the iteration time reaches a preset iteration time.

[0345] Specifically, the terminal can train the to-be-trained recognition model by the target loss function, adjust the parameters of the recognition model in the training process and continue training, until the recognition model meets the target training stop condition to stop training, and obtain a trained target recognition model. The trained target recognition model is used for identity recognition on the to-be-recognized image to output the identity recognition result corresponding to the to-be-recognized image.

[0346] In an embodiment, the parameters of the recognition model, the encoder, the quantizer, the entropy network and the feature recognition network are adjusted in the training process and continue to be trained, until the recognition model meets the target training stop condition to stop training, and obtain a trained target recognition model. The trained target recognition network includes a trained encoder, a trained quantizer, a trained entropy network and a trained feature recognition network.

[0347] Further, the trained entropy network includes not only the processing parameters of each layer, but also the target value range corresponding to each channel respectively.

[0348] In this embodiment, the sample quantization features of the sample image are processed by the entropy network to obtain the sample probability distribution corresponding to each pixel in the sample image, to determine the sample image entropy corresponding to the sample image. The sample image entropy is used as part of the target loss function to determine the loss degree of the key information of the sample image. At the same time, according to the channel probability distribution corresponding to the value range of each channel of the entropy network, the channel probability loss is calculated, which can be used as part of the target loss function to optimize the value range of each channel in the training process, thereby realizing the constraint on the output features of the entropy network. Moreover, the loss between the prediction result and the true result of the sample quantization features in the feature recognition network is used as part of the target loss function to realize the training of the feature recognition network. Through a series of constraints, the overall training of the recognition model is realized, so that the trained target recognition model has higher prediction accuracy and accuracy.

[0349] The feature recognition network in the embodiment can be modified in a traditional IR18 network structure. In order to meet the changes in the number of input channels and the size of features, the input layer convolution of the traditional IR18 network is changed to deconvolution, and the input channel parameter is changed from 3 to 192. As shown in the following table, the feature recognition network in the embodiment removes the first stage module, and the parameters of each layer are changed as shown in the following table:

[0350]

[0351]

[0352] The residual structure based on deconvolution in the feature recognition network of the embodiment is as follows: Figure 9 The residual structure performs batch normalization processing on the input features, and performs 3x3 deconvolution processing with a step size of 2 on the processed features. The features processed by deconvolution are batch normalized, and the processed features are 3x3 convolved with a step size of 1. Batch normalization is continued. And the input features are down-sampled by 2, the down-sampled features and the batch normalized features are fused to obtain the output features of the residual structure.

[0353] In one embodiment, the channel probability distribution corresponding to each value range is calculated, including: calculating the channel probability distribution corresponding to the upper limit value and the lower limit value in each value range;

[0354] Based on the channel probability distribution corresponding to each value range, the channel probability loss is determined, including: determining the channel probability loss according to the channel probability distribution corresponding to the upper limit value and the lower limit value of each value range.

[0355] Specifically, the entropy network is provided with a value range corresponding to each channel. For each value range, the lower limit value and the upper limit value in the value range are respectively input into the entropy network to obtain the channel probability distribution corresponding to the lower limit value and the upper limit value in each value range.

[0356] The difference between each upper limit value and a preset value is calculated to obtain a difference corresponding to each upper limit value. The sum of the differences corresponding to each upper limit value is calculated, and the sum of each lower limit value is calculated. The sum of the lower limit values and the sum of the differences are used as the channel probability loss of the entropy network.

[0357] For example, the channel probability loss is:

[0358] L aux =∑(cumulative(lower)-0)+∑(cumulative(upper)-1)

[0359] Wherein, L auxis the channel probability loss, (cumulative(lower) is a lower limit of the channel probability distribution, and cumulative(upper) is an upper limit of the channel probability distribution.

[0360] In this embodiment, for the value range of each channel in the entropy network, only the channel probability distribution corresponding to the upper and lower limits of each value range is calculated, so that the channel probability loss is calculated according to the channel probability distribution corresponding to the upper and lower limits, so that the amount of calculation can be reduced and the processing speed can be improved.

[0361] like Figure 10 The figure shows a structural framework diagram of a recognition model to be trained in an embodiment. Sample images A, B, C, D, etc. are input into an encoder to obtain encoding features corresponding to each sample image. Each encoding feature is quantized by a quantizer to obtain corresponding quantized features.

[0362] Each quantitative feature is input into the entropy network and the feature recognition network respectively. Through the entropy network, the sample probability distribution corresponding to each pixel in the sample image is determined based on the sample quantitative feature, and the sample image entropy corresponding to the sample image is determined according to the sample probability distribution.

[0363] Through the entropy network, based on the sample quantization characteristics, the value range corresponding to each channel in the recognition model to be trained is determined, and the channel probability distribution corresponding to each value range is calculated. Based on the channel probability distribution corresponding to each value range, the channel probability loss is determined.

[0364] The feature recognition network is used to identify and process the quantitative features of each sample, and the sample recognition results corresponding to each sample image are obtained. The image loss is determined based on each sample recognition result and the corresponding identity label, and the target loss function is constructed based on the image recognition loss, channel probability loss, and sample image entropy.

[0365] The recognition model to be trained is trained using the target loss function until the training stop condition is reached, thereby obtaining a trained target recognition model; the target recognition model is used to perform identity recognition on the image to be recognized.

[0366] In one embodiment, the trained target recognition model includes target value ranges corresponding to each channel; the method further includes:

[0367] Through the entropy network in the target recognition model, based on the target value range corresponding to each channel, the channel probability distribution corresponding to each value in each target value range is determined; for the target value range corresponding to each channel, according to the channel probability distribution corresponding to each value in the corresponding target value range, the discrete cumulative probability interval corresponding to the corresponding target value range is calculated;

[0368] The target value range and the corresponding discrete cumulative probability interval are used to compress the quantized feature corresponding to the to-be-identified image into the hidden layer feature, and are used to decompress the hidden layer feature corresponding to the to-be-identified image, so as to obtain an identity recognition result corresponding to the to-be-identified image based on the decompression result.

[0369] The trained target recognition network includes a trained entropy network. The trained entropy network includes not only the processing parameters of each layer, but also the target value range corresponding to each channel. Each value in the target value range is an integer. After obtaining the target value range corresponding to each channel, for each target value range, each value in the target value range is taken as an input of the trained entropy network, and a channel probability distribution corresponding to each value is obtained. According to the channel probability distribution corresponding to each value in the target value range, a discrete cumulative probability interval is formed. For each target value range, the discrete cumulative probability interval corresponding to each target value range can be obtained according to the above processing.

[0370] In one embodiment, the discrete cumulative probability interval corresponding to the corresponding target value range is calculated according to the channel probability distribution corresponding to each value in the corresponding target value range, comprising:

[0371] For each target value range, the discrete cumulative probability corresponding to the current value is calculated according to the channel probability distribution corresponding to the current value and the channel probability distribution corresponding to each value before the current value in the target value range. The discrete cumulative probability interval is formed according to the discrete cumulative probability corresponding to each value in the target value range. Each discrete cumulative probability in the discrete cumulative probability interval corresponds to each value in the target value range one by one.

[0372] Further, the channel probability distribution corresponding to the current value in the target value range is determined, and the channel probability distribution corresponding to each value before the current value is determined. The channel probability distribution corresponding to the current value and the channel probability distribution corresponding to each value before the current value are summed to obtain the discrete cumulative probability corresponding to the current value.

[0373] That is

[0374] For example:

[0375]

[0376] Wherein, CDF(i) is the discrete cumulative probability of the current value i, and p(j) is the channel probability distribution of the jth value in the target value range.

[0377] For example, the target value range is [6, 7, 8, 9, 10], and the corresponding channel probability distribution set is [0, 0.2, 0.2, 0.2, 0.4, 1], and the corresponding discrete cumulative probability interval is [0, 0.2, 0.4, 0.6, 1]. Each value in the target value range, the channel probability distribution set and the discrete cumulative probability interval corresponds one by one, that is, the value 6 in the target value range corresponds to the channel probability distribution 0, and the corresponding discrete cumulative probability is 0; the value 7 in the target value range corresponds to the channel probability distribution 0.2, and the corresponding discrete cumulative probability is 0.2.

[0378] The trained target recognition model includes the target value range corresponding to each channel. The discrete cumulative probability interval corresponding to each target value range can be obtained through the entropy network. After obtaining the discrete cumulative probability interval corresponding to each target value range, the discrete cumulative probability interval corresponding to each target value range can be deployed in the terminal and the server, so that the terminal can accurately compress the quantized features corresponding to the to-be-identified image into the hidden layer features by obtaining the discrete cumulative probability interval corresponding to each target value range, so as to upload the hidden layer features to the server. The target value range and the corresponding discrete cumulative probability interval in the server are used to decompress the hidden layer features to accurately restore the compressed data, and the identity recognition result corresponding to the to-be-identified image is obtained based on the decompression result.

[0379] In one embodiment, the target recognition model includes a first sub-model and a second sub-model, the first sub-model is deployed in the terminal, and the second sub-model is deployed in the server.

[0380] The first sub-model includes an encoder, a quantizer, a target value range of each channel and a corresponding discrete cumulative probability interval. The target value range of each channel and the corresponding discrete cumulative probability interval in the first sub-model are used to compress the quantized features corresponding to the to-be-identified image into the hidden layer features. The second sub-model includes a target value range of each channel and a corresponding discrete cumulative probability interval, and a feature recognition network. The target value range of each channel and the corresponding discrete cumulative probability interval in the second sub-model are used to decompress the hidden layer features corresponding to the to-be-identified image.

[0381] The trained target recognition model includes a first sub-model and a second sub-model. The first sub-model is deployed in the terminal, and the second sub-model is deployed in the server. The terminal inputs the to-be-identified image into the first sub-model to obtain the hidden layer features corresponding to each channel output by the first sub-model. The terminal uploads the hidden layer features corresponding to each channel to the server, and the server inputs the hidden layer features corresponding to each channel into the corresponding channel in the second sub-model for processing to obtain the identity recognition result output by the second sub-model.

[0382] Further, the first sub-model comprises an encoder, a quantizer, a target value range of each channel and a corresponding discrete cumulative probability interval. The terminal inputs the image to be identified into the encoder for feature encoding, and outputs the encoded features corresponding to each channel. The encoded features corresponding to each channel output by the encoder are used as the input features corresponding to each channel of the quantizer, i.e., the encoded features of each channel output by the encoder are input into the corresponding channel of the quantizer to quantize the encoded features, so as to obtain the quantized features corresponding to each channel output by the quantizer. The quantized features corresponding to each channel output by the quantizer are compressed using the target value range and the discrete cumulative probability interval of the corresponding channel, so as to obtain the hidden layer features corresponding to each channel output.

[0383] The terminal uploads the hidden layer features corresponding to each channel to the server, and the server inputs the hidden layer features corresponding to each channel into the second sub-model. The second sub-model decompresses the hidden layer features corresponding to each channel using the target value range and the discrete cumulative probability interval of each channel, so as to obtain the decompressed features corresponding to each channel. The decompressed features corresponding to each channel are used as the input of the corresponding channel in the feature recognition network, and the feature recognition network performs feature recognition on each decompressed feature to obtain a recognition feature. The feature recognition network outputs an identity recognition result based on the similarity between the recognition feature and a pre-stored image feature. The server feeds back the identity recognition result input by the feature recognition network to the terminal.

[0384] In this embodiment, the target recognition model comprises a first sub-model and a second sub-model, and the first sub-model and the second sub-model of the target recognition model are respectively deployed on the terminal and the server, so that the terminal processes the image to be processed into hidden layer features through the first sub-model. The data uploaded to the server is the hidden layer features, and the uploaded hidden layer features are compressed by the target value range and the discrete cumulative probability interval of each channel in the first sub-model. The target value range of each channel and the corresponding discrete cumulative probability are pre-deployed in the first sub-model and the second sub-model, so that even if the hidden layer features are leaked during data transmission, the data before compression cannot be accurately restored without decompression of the target value range of each channel and the corresponding discrete cumulative probability, thereby effectively protecting the privacy information of the user.

[0385] In one embodiment, an image recognition method is provided, comprising:

[0386] The terminal obtains an image to be identified, and encodes the image to be identified through an encoder to obtain encoded features corresponding to each channel.

[0387] The terminal inputs the encoded features corresponding to each channel into a quantizer for quantization processing to obtain quantized features corresponding to each channel.

[0388] The terminal determines a matching character in a target value range corresponding to the respective channel that matches the current character in the quantization feature of the respective channel.

[0389] The terminal takes an interval corresponding to the matching character in a respective discrete cumulative probability interval as a probability interval corresponding to the current character.

[0390] The terminal determines an encoding interval corresponding to the current character according to the probability interval corresponding to the current character and an encoding interval corresponding to an adjacent previous character, continues to process a next character in the quantization feature of the respective channel, and obtains an encoding interval corresponding to each character in the quantization feature.

[0391] For each channel, the terminal randomly selects a value from an encoding interval corresponding to a last character in the quantization feature corresponding to the respective channel.

[0392] The terminal takes the randomly selected value as a hidden layer feature corresponding to the respective channel, and obtains a hidden layer feature corresponding to each channel.

[0393] The terminal uploads the hidden layer feature corresponding to each channel to the server, and the server receives the hidden layer feature corresponding to each channel.

[0394] The server determines a character probability interval corresponding to the hidden layer feature in a discrete cumulative probability interval of the respective channel for each channel, and determines a first character in the hidden layer feature from a target value range corresponding to the character probability interval.

[0395] The server takes the first character as a current character, and updates the discrete cumulative probability interval based on a character probability interval of the current character and an initial probability interval.

[0396] The server determines a next character of the current character from the target value range based on a character probability interval corresponding to the hidden layer feature in the updated discrete cumulative probability interval.

[0397] The server takes the next character as the current character, returns to the step of updating the discrete cumulative probability interval based on a probability interval of the current character and the initial probability interval, and continues to execute until a last character in the hidden layer feature is obtained.

[0398] The server takes each character in the hidden layer feature as a decompression feature of the respective channel.

[0399] The server inputs the decompression feature of each channel into a feature recognition network to perform feature recognition based on the decompression feature corresponding to each channel, obtains an identity recognition result corresponding to the image to be recognized, and feeds back the identity recognition result to the terminal.

[0400] In this embodiment, the to-be-identified image is encoded and quantized by the encoder and the quantizer to obtain quantized features corresponding to each channel. The quantized features of the corresponding channels are compressed by the target value range of each channel and the corresponding discrete cumulative probability interval. The hidden layer features corresponding to each channel obtained after compression are uploaded to the server, which can effectively protect user privacy and reduce the amount of data and bandwidth transmitted. The hidden layer features uploaded to the server are compressed, and the accurate image features can be obtained only after decompression, thereby avoiding the problem of data leakage in the process of directly uploading the to-be-identified image to the server. The server performs corresponding decompression on the hidden layer features based on the pre-stored target value range of each channel and the corresponding discrete cumulative probability interval to accurately obtain the decompressed features corresponding to each channel. The feature recognition network performs identity recognition based on the decompressed features of each channel and returns the identity recognition result to the terminal, thereby effectively protecting the accuracy of user identity recognition and the security of the recognition process.

[0401] It should be understood that, although Figures 2-10 the steps in the flowchart of the method are shown in sequence according to the arrows, these steps are not necessarily executed in sequence according to the arrows. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, Figures 2-10 at least part of the steps in the method can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least part of other steps or steps or stages in other steps.

[0402] In one embodiment, as shown in Figure 11 , an image recognition device 1100 is provided, which can be a part of a computer device in the form of a software module or a hardware module, and specifically includes an acquisition module 1102, a compression module 1104, an upload module 1106, and a result receiving module 1108, wherein:

[0403] The acquisition module 1102 is configured to acquire a to-be-identified image, encode and quantize the to-be-identified image, and obtain quantized features corresponding to at least one channel.

[0404] The compression module 1104 is configured to compress the quantized features of the corresponding channels by the target value range of each channel and the corresponding discrete cumulative probability interval, and obtain hidden layer features corresponding to each channel.

[0405] The uploading module 1106 is configured to upload the hidden layer features corresponding to each channel to a server, and the uploaded hidden layer features are used to instruct the server to perform decompression processing on the hidden layer features based on the target value range and the corresponding discrete cumulative probability interval of each channel pre-stored in the server, and perform identity recognition based on the decompression result.

[0406] The result receiving module 1108 is configured to receive an identity recognition result corresponding to the image to be recognized and fed back by the server.

[0407] The image to be recognized is encoded and quantized to obtain quantized features corresponding to at least one channel, the quantized features of the corresponding channel are compressed through the target value range and the corresponding discrete cumulative probability interval of each channel, the hidden layer features corresponding to each channel obtained after the compression are uploaded to the server, the data amount and bandwidth in transmission can be effectively reduced while the user privacy is protected. The hidden layer features obtained after the compression are uploaded to the server, and the accurate image features can be obtained through corresponding decompression processing, thereby avoiding data leakage in the process of directly uploading the image to be recognized to the server, and the problem that the image to be recognized is directly leaked. The server performs corresponding decompression processing on the hidden layer features based on the target value range and the corresponding discrete cumulative probability interval of each channel pre-stored in the server, accurately obtains the decompression features to perform identity recognition, and returns the identity recognition result to the terminal, thereby effectively protecting the accuracy of user identity recognition and the security of the recognition process.

[0408] In an embodiment, the compression module 1104 is further configured to, for the quantized features corresponding to each channel, determine a probability interval corresponding to each character in the quantized features corresponding to the corresponding channel through the target value range and the discrete cumulative probability interval corresponding to the corresponding channel; determine an encoding interval corresponding to each character based on the probability interval corresponding to each character; and for each channel, determine the hidden layer features corresponding to the corresponding channel according to the encoding intervals corresponding to the characters corresponding to the corresponding channel.

[0409] In the embodiment, for the quantized features corresponding to each channel, the probability interval corresponding to each character in the quantized features corresponding to the corresponding channel is determined through the target value range and the discrete cumulative probability interval corresponding to the corresponding channel, the encoding interval corresponding to each character is determined based on the probability interval corresponding to each character, and for each channel, the hidden layer features corresponding to the corresponding channel are determined according to the encoding intervals corresponding to the characters corresponding to the corresponding channel, so that the quantized features corresponding to each channel can be compressed to reduce the data amount of the quantized features, the quantized features can be uploaded to the server in the form of compressed features, and the leakage of the quantized features in the transmission process can be avoided.

[0410] In an embodiment, the compression module 1104 is further configured to, for a current character in the quantized feature of the corresponding channel, determine a matching character in the target value range corresponding to the corresponding channel that matches the current character, take an interval corresponding to the matching character in the corresponding discrete cumulative probability interval as a probability interval corresponding to the current character, and determine an encoding interval corresponding to the current character according to the probability interval corresponding to the current character and an encoding interval corresponding to a neighboring previous character, and continue processing a next character in the quantized feature of the corresponding channel until an encoding interval corresponding to each character in the quantized feature is obtained.

[0411] In an embodiment, for a current character in the quantized feature of the corresponding channel, a matching character in the target value range corresponding to the corresponding channel that matches the current character is determined, an interval corresponding to the matching character in the corresponding discrete cumulative probability interval is taken as a probability interval corresponding to the current character, and an encoding interval corresponding to the current character is determined according to the probability interval corresponding to the current character and an encoding interval corresponding to a neighboring previous character. The same processing is continued to process a next character in the quantized feature of the corresponding channel until an encoding interval corresponding to each character in the quantized feature is obtained, which can compress the quantized feature corresponding to each channel to reduce the data amount of the quantized feature, facilitate uploading the quantized feature in the form of the compressed feature to the server, reduce the bandwidth used, and improve the security in the data transmission process.

[0412] In an embodiment, the compression module 1104 is further configured to, for each channel, randomly select a value from an encoding interval corresponding to a last character in the quantized feature corresponding to the corresponding channel, and take the randomly selected value as a hidden layer feature corresponding to the corresponding channel until a hidden layer feature corresponding to each channel is obtained.

[0413] In an embodiment, a value is randomly selected from an encoding interval corresponding to a last character in the quantized feature, and the randomly selected value is taken as a hidden layer feature corresponding to the channel, which can increase the randomness of data selection within a certain constraint range. Moreover, the randomly selected value in the encoding interval corresponding to the last character does not affect subsequent decompression processing, that is, any value in the encoding interval corresponding to the last character is taken as a hidden layer feature, and the same hidden layer feature can be obtained after subsequent decompression processing, which ensures the accuracy of decompression.

[0414] In an embodiment, the image recognition apparatus is implemented through a target recognition model including a first sub-model and a second sub-model; the first sub-model is deployed on a terminal, and the second sub-model is deployed on a server; the first sub-model includes an encoder, a quantizer, a target value range of each channel, and a corresponding discrete cumulative probability interval; and the second sub-model includes a target value range of each channel, a corresponding discrete cumulative probability interval, and a feature recognition network.

[0415] In this embodiment, the image recognition method is implemented through a target recognition model including a first sub-model and a second sub-model, the first sub-model and the second sub-model of the target recognition model are respectively deployed on a terminal and a server, so that the terminal processes a to-be-processed image into a hidden layer feature through the first sub-model. The data uploaded to the server is a hidden layer feature, and the uploaded hidden layer feature is compressed through the target value range and the discrete cumulative probability interval of each channel in the first sub-model, that is, even if the hidden layer feature is leaked in the data transmission process, it cannot be accurately restored without the corresponding decompression method for decompression, thereby effectively protecting the privacy information of the user.

[0416] In one embodiment, the apparatus further comprises:

[0417] a model determination module configured to determine a to-be-trained recognition model, the to-be-trained recognition model including an image encoder, a quantizer, an entropy network, and a feature recognition network;

[0418] a processing module configured to obtain a sample image and a corresponding identity label, and sequentially perform encoding and quantization processing on the sample image through the encoder and the quantizer in the to-be-trained recognition model to obtain a sample quantization feature;

[0419] a probability distribution determination module configured to determine a sample probability distribution corresponding to each pixel in the sample image based on the sample quantization feature through the entropy network, and determine a sample image entropy corresponding to the sample image according to the sample probability distribution;

[0420] a calculation module configured to determine a value range corresponding to each channel in the to-be-trained recognition model based on the sample quantization feature through the entropy network, and calculate a channel probability distribution corresponding to each value range;

[0421] a probability loss determination module configured to determine a channel probability loss based on the channel probability distribution corresponding to each value range;

[0422] a recognition module configured to perform recognition processing on the sample quantization feature through the feature recognition network to obtain a sample recognition result;

[0423] a construction module configured to determine an image recognition loss based on the sample recognition result and the identity label, and construct a target loss function according to the image recognition loss, the channel probability loss, and the sample image entropy;

[0424] a training module configured to train the to-be-trained recognition model through the target loss function until a training stop condition is reached to stop, and obtain a trained target recognition model.

[0425] The target recognition model includes the target value range corresponding to each channel, and the discrete cumulative probability interval corresponding to the target value range of each channel is determined by the entropy network in the trained target recognition model based on the target value range of the corresponding channel.

[0426] In this embodiment, the sample quantization features of the sample image are processed by the entropy network to obtain the sample probability distribution corresponding to each pixel in the sample image, so as to determine the sample image entropy corresponding to the sample image. The loss degree of the key information of the sample image is determined by taking the sample image entropy as part of the target loss function. At the same time, the channel probability loss is calculated according to the channel probability distribution corresponding to the value range of each channel of the entropy network. The channel probability loss can be taken as part of the target loss function to optimize the value range of each channel in the training process, thereby realizing the constraint on the output features of the entropy network. Moreover, the loss between the prediction result and the real result of the sample quantization features in the feature recognition network is taken as part of the target loss function to realize the training of the feature recognition network. Through a series of constraints, the overall training of the recognition model is realized, so that the trained target recognition model has higher prediction accuracy and precision.

[0427] In one embodiment, the image to be recognized is a face image; the acquisition module 1102 is further configured to collect the face image in response to a resource transfer trigger operation on the resource amount; and the face image is encoded and quantized to obtain quantized features corresponding to at least one channel.

[0428] The device further includes a resource transfer module; the resource transfer module is configured to perform a resource transfer operation when the identity recognition result is successful; and the resource transfer operation is configured to transfer the resource amount from the resource account of the operation initiator to the resource account of the receiver.

[0429] In this embodiment, the image recognition method is applied to resource transfer. In response to a resource transfer trigger operation on the resource amount, a face image is collected, and the face image is quantized, encoded, and compressed by the terminal to obtain compressed hidden layer features. The server uploads the compressed hidden layer features, and corresponding decompression processing is required to obtain accurate image features, thereby avoiding data leakage during the process of directly uploading the face image to the server, and preventing the user's face image from being directly leaked. The server performs corresponding decompression processing on the hidden layer features to accurately obtain decompressed features for identity recognition. When the identity recognition result corresponding to the face image is identity recognition success, the resource transfer operation is performed, and the identity recognition does not perform the resource transfer operation, thereby improving the security of resource transfer.

[0430] In an embodiment, the image to be identified is a human face image; the acquisition module 1102 is further configured to, in response to a triggering operation of the access control, acquire the human face image;

[0431] The device further includes an access control module; the access control module is configured to, when the identity recognition result corresponding to the human face image is a successful recognition, control the access terminal to perform an access starting operation.

[0432] In this embodiment, the image recognition method is applied to the access control; in response to a triggering operation of the access control, a human face image is acquired, and the human face image is quantized, encoded, and compressed by the terminal to obtain compressed hidden layer features. The server uploads the compressed hidden layer features, and corresponding decompression processing is required to obtain accurate image features, thereby avoiding data leakage in the process of directly uploading the human face image to the server, and preventing the user's human face image from being directly leaked. The server performs corresponding decompression processing on the hidden layer features to accurately obtain decompressed features for identity recognition; when the identity recognition result corresponding to the human face image is a successful recognition, the access terminal performs an access starting operation, thereby improving the security of the access control and the security of the identity verification when the access is started.

[0433] In an embodiment, as shown in Figure 12 An image recognition device 1200 is provided, which can be a part of a computer device in the form of a software module or a hardware module, or a combination of both. The device specifically includes a feature receiving module 1202, a decompression module 1204, and a feedback module 1206, wherein:

[0434] The feature receiving module 1202 is configured to receive hidden layer features corresponding to at least one channel, which are obtained by encoding and quantizing a to-be-identified image to obtain quantized features corresponding to each channel, and compressing the quantized features of the corresponding channel through a target value range of each channel and a corresponding discrete cumulative probability interval.

[0435] The decompression module 1204 is configured to decompress the hidden layer features of the corresponding channel through the target value range of each channel and the corresponding discrete cumulative probability interval to obtain decompressed features of the corresponding channel.

[0436] The feedback module 1206 is configured to perform feature recognition based on the decompressed features of each channel to obtain an identity recognition result corresponding to the to-be-identified image, and feed back the identity recognition result to the terminal.

[0437] In this embodiment, the terminal encodes and quantizes the to-be-identified image, obtains quantized features corresponding to at least one channel, and compresses the quantized features of the corresponding channel by using the target value range of each channel and the corresponding discrete cumulative probability interval, and then uploads the compressed features corresponding to each channel to the server, which can effectively protect the user privacy and reduce the data volume and bandwidth of transmission. The uploaded features are compressed features, and the accurate image features can be obtained only after decompression, thereby avoiding data leakage in the process of directly uploading the to-be-identified image to the server and the problem of directly leaking the to-be-identified image. The server performs corresponding decompression on the hidden layer features based on the pre-stored target value range of each channel and the corresponding discrete cumulative probability interval, accurately obtains the decompressed features for identity recognition, thereby effectively improving the accuracy of user identity recognition and the security of the recognition process.

[0438] In one embodiment, the decompression module 1204 is further configured to, for the hidden layer feature corresponding to each channel respectively, determine a character probability interval corresponding to the hidden layer feature in the discrete cumulative probability interval of the corresponding channel, and determine a first character in the hidden layer feature from the target value range based on the character probability interval; take the first character as a current character, and update the discrete cumulative probability interval based on the character probability interval of the current character and the initial probability interval; determine a next character of the current character from the target value range based on the character probability interval corresponding to the hidden layer feature in the updated discrete cumulative probability interval; take the next character as the current character, and return to update the discrete cumulative probability interval based on the probability interval of the current character and the initial probability interval, and continue to execute until the last character in the hidden layer feature is obtained; and take each character in the hidden layer feature as the decompressed feature of the corresponding channel.

[0439] In this embodiment, for the hidden layer feature corresponding to each channel respectively, a character probability interval corresponding to the hidden layer feature in the discrete cumulative probability interval of the corresponding channel is determined, and a first character in the hidden layer feature is determined from the target value range based on the character probability interval, the first character is taken as a current character, and the discrete cumulative probability interval is updated based on the character probability interval of the current character and the initial probability interval, a next character of the current character is determined from the target value range based on the character probability interval corresponding to the hidden layer feature in the updated discrete cumulative probability interval, the next character is taken as the current character, and the step of updating the discrete cumulative probability interval based on the probability interval of the current character and the initial probability interval is returned and continued to be executed until the last character in the hidden layer feature is obtained, and each character in the hidden layer feature is taken as the decompressed feature of the corresponding channel, so that the decompressed feature corresponding to each channel can be accurately decompressed based on the compression processing, so as to accurately perform identity recognition on the server.

[0440] In one embodiment, as shown in FIG. 13, Figure 13 An identification model training apparatus 1300 is provided, which can be a part of a computer device in the form of a software module or a hardware module, or a combination of both, and specifically includes a model determination module 1302, a processing module 1304, a probability distribution determination module 1306, a calculation module 1308, a probability loss determination module 1310, an identification module 1312, a construction module 1314, and a training module 1316, wherein:

[0441] The model determination module 1302 is configured to determine an identification model to be trained, which includes an image encoder, a quantizer, an entropy network, and a feature identification network.

[0442] The processing module 1304 is configured to obtain a sample image and a corresponding identity label, and sequentially perform encoding and quantization processing on the sample image through the encoder and the quantizer in the identification model to be trained to obtain sample quantization features.

[0443] The probability distribution determination module 1306 is configured to determine a sample probability distribution corresponding to each pixel in the sample image based on the sample quantization features through the entropy network, and determine a sample image entropy corresponding to the sample image based on the sample probability distribution.

[0444] The calculation module 1308 is configured to determine a value range corresponding to each channel in the identification model to be trained based on the sample quantization features through the entropy network, and calculate a channel probability distribution corresponding to each value range.

[0445] The probability loss determination module 1310 is configured to determine a channel probability loss based on the channel probability distribution corresponding to each value range.

[0446] The identification module 1312 is configured to perform identification processing on the sample quantization features through the feature identification network to obtain a sample identification result.

[0447] The construction module 1314 is configured to determine an image identification loss based on the sample identification result and the identity label, and construct a target loss function based on the image identification loss, the channel probability loss, and the sample image entropy.

[0448] The training module 1316 is configured to train the identification model to be trained through the target loss function until a training stop condition is reached to stop, and obtain a trained target identification model; the target identification model is configured to perform identity recognition on a to-be-identified image.

[0449] In this embodiment, the sample quantization features of the sample image are processed by the entropy network to obtain the sample probability distribution corresponding to each pixel in the sample image, so as to determine the sample image entropy corresponding to the sample image, and the sample image entropy is used as part of the target loss function to determine the degree of loss of key information of the sample image. At the same time, according to the channel probability distribution corresponding to the value range of each channel of the entropy network, the channel probability loss is calculated, and the channel probability loss can be used as part of the target loss function to optimize the value range of each channel during the training process, thereby realizing the constraint on the output features of the entropy network. In addition, the loss between the predicted result and the actual result of the sample quantization feature in the feature recognition network is used as part of the target loss function to realize the training of the feature recognition network. The overall training of the recognition model is realized through a series of constraints, so that the trained target recognition model has higher prediction accuracy and precision.

[0450] In one embodiment, the calculation module 1308 is further configured to calculate the channel probability distribution corresponding to the upper limit and the lower limit in each value range;

[0451] The probability loss determination module 1310 is further configured to determine the channel probability loss according to the channel probability distributions corresponding to the upper limit and lower limit of each value range.

[0452] In this embodiment, for the value range of each channel in the entropy network, only the channel probability distribution corresponding to the upper and lower limits of each value range is calculated, so that the channel probability loss is calculated according to the channel probability distribution corresponding to the upper and lower limits, so that the amount of calculation can be reduced and the processing speed can be improved.

[0453] In one embodiment, the trained target recognition model includes target value ranges corresponding to each channel; the probability distribution determination module 1306 is also used to determine the channel probability distribution corresponding to each value in each target value range based on the target value range corresponding to each channel through the entropy network in the target recognition model; for the target value range corresponding to each channel, the discrete cumulative probability interval corresponding to the corresponding target value range is calculated according to the channel probability distribution corresponding to each value in the corresponding target value range; wherein, the target value range and the corresponding discrete cumulative probability interval are used to compress the quantitative features corresponding to the image to be identified into hidden layer features, and to decompress the hidden layer features corresponding to the image to be identified, so as to obtain the identity recognition result corresponding to the image to be identified based on the decompression result.

[0454] The trained target recognition model includes target value ranges corresponding to each channel, and the discrete cumulative probability intervals corresponding to each target value range can be obtained by an entropy network. The discrete cumulative probability intervals corresponding to each target value range are deployed on the terminal and the server, so that the terminal can accurately compress the quantized features corresponding to the to-be-identified image into hidden layer features by obtaining the discrete cumulative probability intervals corresponding to each target value range, and upload the hidden layer features to the server. The target value ranges and the corresponding discrete cumulative probability intervals on the server are used to decompress the hidden layer features to accurately restore the compressed data, and obtain the identity recognition result corresponding to the to-be-identified image based on the decompression result.

[0455] In one embodiment, the target recognition model includes a first sub-model and a second sub-model, the first sub-model is deployed on the terminal, and the second sub-model is deployed on the server; the first sub-model includes an encoder, a quantizer, target value ranges of each channel, and corresponding discrete cumulative probability intervals, the target value ranges of each channel and the corresponding discrete cumulative probability intervals in the first sub-model are used to compress the quantized features corresponding to the to-be-identified image into hidden layer features; the second sub-model includes target value ranges of each channel and corresponding discrete cumulative probability intervals, and a feature recognition network; the target value ranges of each channel and the corresponding discrete cumulative probability intervals in the second sub-model are used to decompress the hidden layer features corresponding to the to-be-identified image.

[0456] In this embodiment, the target recognition model includes a first sub-model and a second sub-model, and the first sub-model and the second sub-model of the target recognition model are respectively deployed on the terminal and the server, so that the terminal processes the to-be-processed image into hidden layer features through the first sub-model. The data uploaded to the server is the hidden layer features, and the uploaded hidden layer features are compressed by the target value ranges and the discrete cumulative probability intervals of each channel in the first sub-model. The target value ranges of each channel and the corresponding discrete cumulative probability are pre-deployed in the first sub-model and the second sub-model, so that even if the hidden layer features are leaked during data transmission, the data before compression cannot be accurately restored without decompression of the target value ranges and the corresponding discrete cumulative probability of each channel, thereby effectively protecting the privacy information of the user.

[0457] The specific limitations of the image recognition device and the recognition model training device can be referred to the limitations of the image recognition method and the recognition model training method in the above, which will not be repeated here. Each module in the above image recognition device and recognition model training device can be realized by software, hardware, and combinations thereof, in whole or in part. Each module can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0458] In an embodiment, a computer device is provided, which can be a server, and an internal structure diagram of the computer device can be as shown in FIG. 1. Figure 14 The computer device includes a processor, a memory and a network interface connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store image recognition data and recognition model training data. The network interface of the computer device is configured to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement an image recognition method and a recognition model training method.

[0459] In an embodiment, a computer device is provided, which can be a terminal, and an internal structure diagram of the computer device can be as shown in FIG. 2. Figure 15 The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is configured to communicate with an external terminal in a wired or wireless manner. The wireless manner can be achieved through WIFI, an operator network, NFC (Near Field Communication) or other technologies. The computer program is executed by the processor to implement an image recognition method and a recognition model training method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.

[0460] Those skilled in the art can understand that the structure shown in Figure 14 , Figure 15 the above embodiments is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the diagram, or combine certain components, or have a different arrangement of components.

[0461] In an embodiment, a computer device is provided, which includes a memory and a processor. The memory stores a computer program. The processor executes the computer program to implement the steps in the above method embodiments.

[0462] In an embodiment, a computer readable storage medium storing a computer program is provided. The computer program, when executed by a processor, implements the steps of any of the above method embodiments.

[0463] In an embodiment, a computer program product or computer program including computer instructions stored in a computer readable storage medium is provided. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the steps of any of the above method embodiments.

[0464] A person of ordinary skill in the art can understand that all or part of the processes in the above method embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above method embodiments. Any reference to memory, storage, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0465] Any combination of the technical features of the above embodiments can be made. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.

[0466] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of the patent of the present application should be subject to the appended claims.

Claims

1. An image recognition method, characterized in that: The method is applied to a terminal that deploys a first sub-model, where the first sub-model includes an encoder, a quantizer, a target value range for each channel, and a corresponding discrete cumulative probability interval. The method includes: Acquire an image to be recognized, and encode and quantize the image to be recognized using an encoder and a quantizer in the first sub-model to obtain a quantized feature corresponding to at least one channel; Compressing the quantized features of the corresponding channels using the target value range and the corresponding discrete cumulative probability interval of each channel in the first sub-model to obtain hidden layer features corresponding to each channel; the target value range is an integer value range and is a constraint term on the output value of the channel; The hidden layer features corresponding to each channel are uploaded to a server, and the server deploys a second sub-model, which includes a target value range for each channel, a corresponding discrete cumulative probability interval, and a feature recognition network. The uploaded hidden layer features are used to instruct the server to decompress the hidden layer features based on the target value range and the corresponding discrete cumulative probability interval of each channel in the second sub-model, and perform identity recognition based on the decompression results through the feature recognition network; the target value range is determined based on the sample quantization feature of the sample image, and the discrete cumulative probability interval is determined based on the target value range and the sample probability distribution corresponding to each pixel in the sample image; Receive the identity recognition result corresponding to the image to be recognized fed back by the server.

2. The method according to claim 1, characterized in that The method compresses the quantized features of the corresponding channels by using the target value range and the corresponding discrete cumulative probability interval of each channel in the first sub-model to obtain the hidden layer features corresponding to each channel, including: For the quantitative features corresponding to each channel in the first sub-model, determining the probability interval corresponding to each character in the quantitative features corresponding to the corresponding channel by using the target value range and discrete cumulative probability interval corresponding to the corresponding channel; Determine the encoding interval corresponding to each character based on the probability interval corresponding to each character; For each channel, the hidden layer features corresponding to the corresponding channel are determined according to the coding intervals corresponding to the characters corresponding to the corresponding channel.

3. The method according to claim 2, characterized in that The step of determining the probability interval corresponding to each character in the quantitative feature corresponding to the corresponding channel by using the target value range and the discrete cumulative probability interval corresponding to the corresponding channel includes: For a current character in the quantitative features of a corresponding channel, determining a matching character that matches the current character in a target value range corresponding to the corresponding channel; The interval corresponding to the matching character in the corresponding discrete cumulative probability interval is used as the probability interval corresponding to the current character; The determining, based on the probability interval corresponding to each character, the encoding interval corresponding to each character, includes: According to the probability interval corresponding to the current character and the coding interval corresponding to the adjacent previous character, the coding interval corresponding to the current character is determined, and the next character in the quantitative feature of the corresponding channel is processed continuously until the coding interval corresponding to each character in the quantitative feature is obtained.

4. The method according to claim 2, characterized in that For each channel, the hidden layer features corresponding to the corresponding channel are determined according to the coding intervals corresponding to the characters corresponding to the corresponding channel, including: For each channel, a value is randomly selected from the coding interval corresponding to the last character of the quantitative feature corresponding to the corresponding channel; The randomly selected values ​​are used as the hidden layer features corresponding to the corresponding channels until the hidden layer features corresponding to each channel are obtained.

5. The method according to claim 1, wherein The image recognition method is implemented by an object recognition model including a first sub-model and a second sub-model.

6. The method according to claim 5, characterized in that The target recognition model is determined by a training step; the training step comprises: Determining a recognition model to be trained, wherein the recognition model to be trained includes an image encoder, a quantizer, an entropy network, and a feature recognition network; Obtaining a sample image and a corresponding identity tag, and sequentially encoding and quantizing the sample image through an encoder and a quantizer in the recognition model to be trained to obtain a sample quantization feature; Determining, through the entropy network and based on the sample quantization feature, a sample probability distribution corresponding to each pixel in the sample image, and determining a sample image entropy corresponding to the sample image according to the sample probability distribution; Determining, through the entropy network and based on the sample quantization features, the value ranges corresponding to the respective channels in the recognition model to be trained, and calculating the channel probability distributions corresponding to the respective value ranges; Determine the channel probability loss based on the channel probability distribution corresponding to each value range; The sample quantitative features are identified and processed by the feature recognition network to obtain a sample recognition result; Determining an image recognition loss based on the sample recognition result and the identity label, and constructing a target loss function according to the image recognition loss, the channel probability loss, and the sample image entropy; The recognition model to be trained is trained by the target loss function until a training stop condition is reached, thereby obtaining a trained target recognition model; Among them, the trained target recognition model includes the target value range corresponding to each channel, and the discrete cumulative probability intervals corresponding to the target value range of each channel are determined by the entropy network in the trained target recognition model based on the target value range of the corresponding channel.

7. The method according to any one of claims 1 to 6, characterized in that The image to be recognized is a face image; and obtaining the image to be recognized, encoding and quantizing the image to be recognized by the encoder and quantizer in the first sub-model to obtain a quantized feature corresponding to at least one channel, includes: In response to a resource transfer triggering operation on the resource amount, capturing a facial image; Encoding and quantizing the facial image using the encoder and quantizer in the first sub-model to obtain a quantized feature corresponding to at least one channel; After receiving the identity recognition result corresponding to the image to be recognized fed back by the server, the method further includes: When the identity recognition result is successful, a resource transfer operation is performed; the resource transfer operation is used to transfer the resource amount from the resource account of the operation initiator to the resource account of the recipient.

8. The method according to any one of claims 1 to 6, characterized in that The image to be identified is a face image; and obtaining the image to be identified includes: In response to a triggering operation on access control, collecting a facial image; After receiving the identity recognition result corresponding to the image to be recognized fed back by the server, the method further includes: When the identity recognition result corresponding to the face image is successful, the access control terminal is controlled to execute the access control opening action.

9. An image recognition method, characterized in that: The method is applied to a server that deploys a second sub-model, where the second sub-model includes a target value range for each channel, a corresponding discrete cumulative probability interval, and a feature recognition network. The method includes: receiving hidden layer features corresponding to at least one channel, wherein the hidden layer features corresponding to the at least one channel are obtained by encoding and quantizing an image to be recognized by the terminal through an encoder and a quantizer in a first sub-model, thereby obtaining quantized features corresponding to each channel, and compressing the quantized features of the corresponding channel using a target value range and a corresponding discrete cumulative probability interval for each channel in the first sub-model; the target value range is an integer value range and is a constraint on the output value of the channel; Decompressing the hidden layer features of the corresponding channel using the target value range and the corresponding discrete cumulative probability interval of each channel in the second sub-model to obtain the decompressed features of the corresponding channel; The feature recognition network performs feature recognition based on the decompressed features corresponding to each channel to obtain an identity recognition result corresponding to the image to be recognized, and the identity recognition result is fed back to the terminal; the target value range is determined based on the sample quantization features of the sample image, and the discrete cumulative probability interval is determined based on the target value range and the sample probability distribution corresponding to each pixel in the sample image.

10. The method according to claim 9, characterized in that The decompression processing is performed on the hidden layer features of the corresponding channel by using the target value range and the corresponding discrete cumulative probability interval of each channel in the second sub-model to obtain the decompressed features of the corresponding channel, including: For each hidden feature corresponding to each channel in the second sub-model, determining a character probability interval corresponding to the hidden feature in a discrete cumulative probability interval of the corresponding channel, and determining the first character in the hidden feature from a corresponding target value range based on the character probability interval; Taking the first character as the current character, and updating the discrete cumulative probability interval based on the character probability interval of the current character and the initial probability interval; Determining the next character of the current character from the target value range based on the character probability interval corresponding to the hidden layer feature in the updated discrete cumulative probability interval; Taking the next character as the current character, returning the probability interval based on the current character and the initial probability interval, and continuing the steps of updating the discrete cumulative probability interval until the last character in the hidden layer feature is obtained; Each character in the hidden layer features is used as the decompression feature of the corresponding channel.

11. A recognition model training method, characterized in that: The method comprises: Determining a recognition model to be trained, wherein the recognition model to be trained includes an image encoder, a quantizer, an entropy network, and a feature recognition network; Obtaining a sample image and a corresponding identity tag, and sequentially encoding and quantizing the sample image through an encoder and a quantizer in the recognition model to be trained to obtain a sample quantization feature; Determining, through the entropy network and based on the sample quantization feature, a sample probability distribution corresponding to each pixel in the sample image, and determining a sample image entropy corresponding to the sample image according to the sample probability distribution; Determining, through the entropy network and based on the sample quantization features, the value ranges corresponding to the respective channels in the recognition model to be trained, and calculating the channel probability distributions corresponding to the respective value ranges; Determine the channel probability loss based on the channel probability distribution corresponding to each value range; The sample quantitative features are identified and processed by the feature recognition network to obtain a sample recognition result; Determining an image recognition loss based on the sample recognition result and the identity label, and constructing a target loss function according to the image recognition loss, the channel probability loss, and the sample image entropy; The recognition model to be trained is trained using the target loss function until a training stop condition is reached, thereby obtaining a trained target recognition model; the target recognition model is used to perform identity recognition on the image to be recognized.

12. The method according to claim 11, characterized in that Calculating the channel probability distribution corresponding to each value range includes: Calculate the channel probability distribution corresponding to the upper and lower limits of each value range; The determining of the channel probability loss based on the channel probability distribution corresponding to each value range includes: The channel probability loss is determined based on the channel probability distribution corresponding to the upper and lower limits of each value range.

13. The method according to claim 11, characterized in that The trained target recognition model includes target value ranges corresponding to the channels; the method further includes: Determining, by the entropy network in the target recognition model, a channel probability distribution corresponding to each value in each target value range based on the target value range corresponding to each channel; For the target value range corresponding to each channel, the discrete cumulative probability interval corresponding to the corresponding target value range is calculated according to the channel probability distribution corresponding to each value in the corresponding target value range; Among them, the target value range and the corresponding discrete cumulative probability interval are used to compress the quantitative features corresponding to the image to be identified into hidden layer features, and to decompress the hidden layer features corresponding to the image to be identified, so as to obtain the identity recognition result corresponding to the image to be identified based on the decompression result.

14. The method according to claim 13, characterized in that The determining, according to the sample probability distribution, the sample image entropy corresponding to the sample image comprises: The sample probability distribution corresponding to each pixel in the sample image is weightedly summed and averaged, and the obtained average is used as the sample image entropy corresponding to the sample image.

15. An image recognition device, characterized in that: The device is applied to a terminal in which a first sub-model is deployed, where the first sub-model includes an encoder, a quantizer, a target value range for each channel, and a corresponding discrete cumulative probability interval. The device includes: an acquisition module, configured to acquire an image to be identified, and perform encoding and quantization processing on the image to be identified using the encoder and quantizer in the first sub-model to obtain a quantized feature corresponding to at least one channel; a compression module, configured to compress the quantized features of the corresponding channels using the target value range and the corresponding discrete cumulative probability interval of each channel in the first sub-model to obtain hidden layer features corresponding to each channel; the target value range is an integer value range and is a constraint term on the output value of the channel; an uploading module for uploading the hidden layer features corresponding to each channel to a server, wherein the server deploys a second sub-model, wherein the second sub-model includes a target value range for each channel, a corresponding discrete cumulative probability interval, and a feature recognition network; the uploaded hidden layer features are used to instruct the server to decompress the hidden layer features based on the target value range and the corresponding discrete cumulative probability interval for each channel in the second sub-model, and to perform identity recognition based on the decompression results through the feature recognition network; the target value range is determined based on the sample quantization features of the sample image, and the discrete cumulative probability interval is determined based on the target value range and the sample probability distribution corresponding to each pixel in the sample image; The result receiving module is used to receive the identity recognition result corresponding to the image to be recognized fed back by the server.

16. The device according to claim 15, characterized in that The compression module is further configured to determine, for the quantitative features corresponding to each channel in the first sub-model, a probability interval corresponding to each character in the quantitative features corresponding to the corresponding channel by using the target value range and the discrete cumulative probability interval corresponding to the corresponding channel; Determine the encoding interval corresponding to each character based on the probability interval corresponding to each character; For each channel, the hidden layer features corresponding to the corresponding channel are determined according to the coding intervals corresponding to the characters corresponding to the corresponding channel.

17. The device according to claim 16, characterized in that The compression module is further used to determine, for a current character in the quantitative feature of the corresponding channel, a matching character that matches the current character in the target value range corresponding to the corresponding channel; use the interval corresponding to the matching character in the corresponding discrete cumulative probability interval as the probability interval corresponding to the current character; determine the encoding interval corresponding to the current character based on the probability interval corresponding to the current character and the encoding interval corresponding to the adjacent previous character, and continue processing the next character in the quantitative feature of the corresponding channel until obtaining the encoding interval corresponding to each character in the quantitative feature.

18. The device according to claim 16, characterized in that The compression module is also used to randomly select a value from the coding interval corresponding to the last character of the quantitative feature corresponding to the corresponding channel for each channel; and use the randomly selected value as the hidden layer feature corresponding to the corresponding channel until the hidden layer feature corresponding to each channel is obtained.

19. The device according to claim 15, characterized in that The image recognition device is implemented by an object recognition model including a first sub-model and a second sub-model.

20. The device according to claim 19, characterized in that The target recognition model is determined by a training step; the device further comprises: A model determination module, configured to determine a recognition model to be trained, wherein the recognition model to be trained includes an image encoder, a quantizer, an entropy network, and a feature recognition network; A processing module is used to obtain a sample image and a corresponding identity tag, and sequentially encode and quantize the sample image through an encoder and a quantizer in the recognition model to be trained to obtain a sample quantization feature; a probability distribution determination module, configured to determine, through the entropy network and based on the sample quantization feature, a sample probability distribution corresponding to each pixel in the sample image, and determine a sample image entropy corresponding to the sample image according to the sample probability distribution; a calculation module, configured to determine, through the entropy network and based on the sample quantization features, a value range corresponding to each channel in the recognition model to be trained, and calculate a channel probability distribution corresponding to each value range; A probability loss determination module, configured to determine a channel probability loss based on the channel probability distribution corresponding to each value range; An identification module is used to identify and process the quantitative features of the sample through the feature recognition network to obtain a sample identification result; A construction module, configured to determine an image recognition loss based on the sample recognition result and the identity label, and construct a target loss function according to the image recognition loss, the channel probability loss, and the sample image entropy; A training module is used to train the recognition model to be trained using the target loss function until a training stop condition is reached, thereby obtaining a trained target recognition model; Among them, the trained target recognition model includes the target value range corresponding to each channel, and the discrete cumulative probability intervals corresponding to the target value range of each channel are determined by the entropy network in the trained target recognition model based on the target value range of the corresponding channel.

21. The device according to any one of claims 15 to 20, characterized in that The image to be recognized is a face image; The acquisition module is further configured to, in response to a resource transfer triggering operation on a resource amount, collect a facial image; encode and quantize the facial image using an encoder and a quantizer in the first sub-model to obtain a quantized feature corresponding to at least one channel; The resource transfer module is used to perform a resource transfer operation when the identity recognition result is successful; the resource transfer operation is used to transfer the resource amount from the resource account of the operation initiator to the resource account of the recipient.

22. The device according to any one of claims 15 to 20, characterized in that The device further comprises: The acquisition module is further configured to acquire a facial image in response to a triggering operation on the access control; The access control module is used to control the access control terminal to execute an access opening action when the identity recognition result corresponding to the face image is successful.

23. An image recognition device, characterized in that: The device is applied to a server on which a second sub-model is deployed, wherein the second sub-model includes a target value range for each channel, a corresponding discrete cumulative probability interval, and a feature recognition network, and the device includes: a feature receiving module, configured to receive hidden layer features corresponding to at least one channel, wherein the hidden layer features corresponding to the at least one channel are obtained by encoding and quantizing the image to be identified by the terminal through the encoder and quantizer in the first sub-model, thereby obtaining quantized features corresponding to each channel, and compressing the quantized features of the corresponding channel using the target value range and the corresponding discrete cumulative probability interval of each channel in the first sub-model; the target value range is an integer value range and is a constraint on the output value of the channel; a decompression module, configured to decompress the hidden layer features of the corresponding channel using the target value range and the corresponding discrete cumulative probability interval of each channel in the second sub-model to obtain the decompressed features of the corresponding channel; A feedback module is used to perform feature recognition based on the decompressed features corresponding to each channel through the feature recognition network, obtain an identity recognition result corresponding to the image to be recognized, and feed back the identity recognition result to the terminal; the target value range is determined based on the sample quantization features of the sample image, and the discrete cumulative probability interval is determined based on the target value range and the sample probability distribution corresponding to each pixel in the sample image.

24. The device according to claim 23, characterized in that The decompression module is also used to determine the character probability interval corresponding to the hidden layer feature in the discrete cumulative probability interval of the corresponding channel for the hidden layer feature corresponding to each channel in the second sub-model, and determine the first character in the hidden layer feature from the corresponding target value range based on the character probability interval; take the first character as the current character, and update the discrete cumulative probability interval based on the character probability interval and the initial probability interval of the current character; determine the next character of the current character from the target value range based on the character probability interval corresponding to the hidden layer feature in the updated discrete cumulative probability interval; take the next character as the current character, and return the probability interval based on the current character and the initial probability interval, and continue to execute the step of updating the discrete cumulative probability interval until the last character in the hidden layer feature is obtained; and take each character in the hidden layer feature as the decompression feature of the corresponding channel.

25. A recognition model training device, characterized in that: The device comprises: A model determination module, configured to determine a recognition model to be trained, wherein the recognition model to be trained includes an image encoder, a quantizer, an entropy network, and a feature recognition network; A processing module is used to obtain a sample image and a corresponding identity tag, and sequentially encode and quantize the sample image through an encoder and a quantizer in the recognition model to be trained to obtain a sample quantization feature; a probability distribution determination module, configured to determine, through the entropy network and based on the sample quantization feature, a sample probability distribution corresponding to each pixel in the sample image, and determine a sample image entropy corresponding to the sample image according to the sample probability distribution; a calculation module, configured to determine, through the entropy network and based on the sample quantization features, a value range corresponding to each channel in the recognition model to be trained, and calculate a channel probability distribution corresponding to each value range; A probability loss determination module, configured to determine a channel probability loss based on the channel probability distribution corresponding to each value range; An identification module is used to identify and process the quantitative features of the sample through the feature recognition network to obtain a sample identification result; A construction module, configured to determine an image recognition loss based on the sample recognition result and the identity label, and construct a target loss function according to the image recognition loss, the channel probability loss, and the sample image entropy; The training module is used to train the recognition model to be trained by the target loss function until the training stop condition is reached, thereby obtaining a trained target recognition model; the target recognition model is used to perform identity recognition on the image to be recognized.

26. The device according to claim 25, characterized in that The calculation module is further used to calculate the channel probability distribution corresponding to the upper limit value and the lower limit value in each value range; The probability loss determination module is further configured to determine the channel probability loss according to the channel probability distributions corresponding to the upper limit and the lower limit of each value range.

27. The device according to claim 25, characterized in that The trained target recognition model includes target value ranges corresponding to each of the channels; The probability distribution determination module is further configured to determine, through the entropy network in the target recognition model, the channel probability distribution corresponding to each value in each target value range based on the target value range corresponding to each channel; For the target value range corresponding to each channel, the discrete cumulative probability interval corresponding to the corresponding target value range is calculated according to the channel probability distribution corresponding to each value in the corresponding target value range; wherein the target value range and the corresponding discrete cumulative probability interval are used to compress the quantitative features corresponding to the image to be identified into hidden layer features, and to decompress the hidden layer features corresponding to the image to be identified, so as to obtain the identity recognition result corresponding to the image to be identified based on the decompression result.

28. The device according to claim 27, characterized in that The probability distribution determination module is further configured to perform weighted summing and averaging of the sample probability distributions corresponding to the pixels in the sample image, and use the obtained average as the sample image entropy corresponding to the sample image.

29. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 14 are implemented.

30. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.

31. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.

Citation Information

Patent Citations

  • Video image processing method and device, and system

    CN111970509A