Image encryption method, network model training method, device and electronic equipment

By performing multi-color channel encryption processing and key generation on images, the problem of information leakage of image encryption algorithms under statistical attacks in the existing technology is solved, and effective protection and security of image information are achieved.

CN115205089BActive Publication Date: 2024-09-03CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210875517.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-22
Publication Date
2024-09-03
Estimated Expiration
2042-07-22

AI Technical Summary

Technical Problem

Existing image encryption algorithms cannot effectively protect image information in the face of statistical attacks, leading to the risk of leakage of original image information.

Method used

By randomly generating a key based on the image attributes of the image to be encrypted, the pixels in the image are encrypted in multiple color channels, and an encrypted target image set is generated to ensure that the key space is large enough to prevent brute force cracking.

Benefits of technology

It achieves pixel-by-pixel encryption of pixels in the image, protects the visual information of the image to be encrypted, avoids information leakage, and prevents third parties from recovering the original image through brute force when the key is unknown.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115205089B
    Figure CN115205089B
Patent Text Reader

Abstract

The present application discloses an image encryption method, a network model training method, a device and an electronic device, the method comprising: obtaining a target image set to be encrypted, the target image set to be encrypted comprising a plurality of target images to be encrypted; randomly generating a key according to the image attributes of the target image to be encrypted; performing multi-color channel encryption processing on the pixels in each target image to be encrypted according to the key to obtain an encrypted target image set. The present application effectively protects the target image information to be encrypted and avoids the problem of information leakage of the encrypted image due to invalid encryption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data security technology, and more specifically, to an image encryption method, a network model training method, a device, an electronic device, and a computer-readable storage medium. Background Art

[0002] In recent years, it has become popular to store images in cloud environments or implement training iterations or tests of deep neural networks in cloud environments. When uploading images to cloud environments, there is a risk of leaking image information to third parties. Therefore, it is important to encrypt images before uploading them to cloud environments.

[0003] At present, pixel scrambling encryption algorithms are usually used to encrypt images, but they do not have the ability to resist statistical attacks, that is, the encryption algorithm cannot be made public. As long as the encryption algorithm is known, the image to be encrypted can be restored in a finite number of iterations by iterating any state in the ciphertext space, which leads to the problem of leakage of original image information. Summary of the invention

[0004] To solve the above technical problems, the embodiments of the present application provide an image encryption method, a network model training method, a device, an electronic device and a computer-readable storage medium.

[0005] According to one aspect of an embodiment of the present application, an image encryption method is provided, the method comprising: obtaining a target image set to be encrypted, the target image set to be encrypted comprising a plurality of target images to be encrypted; randomly generating a key according to image attributes of the target images to be encrypted; and performing multi-color channel encryption processing on pixel points in each target image to be encrypted according to the key to obtain an encrypted target image set.

[0006] According to one aspect of an embodiment of the present application, a method for training a network model is provided, the method comprising: obtaining an encrypted target image set sent by a user terminal, and using the encrypted target image set as an image training sample set, the encrypted target image set being an encrypted target image set calculated by any of the above methods; inputting the encrypted target image set into the network model, the network model outputting a predicted category of each encrypted target image in the encrypted target image set; calculating a loss value of a loss function between the predicted category of each encrypted target image and the corresponding labeled category; training the network model with the goal of reducing the loss value of the loss function, until the loss value of the loss function determined according to the trained network model is less than a preset loss threshold.

[0007] According to one aspect of an embodiment of the present application, an image encryption device is provided, the device comprising: a target image set acquisition module to be encrypted, configured to acquire a target image set to be encrypted, the target image set to be encrypted comprising a plurality of target images to be encrypted; a key generation module, configured to randomly generate a key according to image properties of the target image to be encrypted; an encryption module, configured to perform multi-color channel encryption processing on pixel points in each target image to be encrypted according to the key to obtain an encrypted target image set.

[0008] According to one aspect of an embodiment of the present application, a network model training device is provided, the device comprising: an image training sample set acquisition module, configured to acquire an encrypted target image set sent by a user terminal, and use the encrypted target image set as an image training sample set, wherein the encrypted target image set is an encrypted target image set calculated by any of the above methods; an input module, configured to input the encrypted target image set into the network model, and the network model outputs the predicted category of each encrypted target image in the encrypted target image set; a calculation module, configured to calculate the loss value of the loss function between the predicted category of each encrypted target image and the corresponding labeled category; a training module, configured to train the network model with the loss value of the loss function becoming smaller as the goal, until the loss value of the loss function determined according to the trained network model is less than a preset loss threshold.

[0009] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: a memory storing computer-readable instructions; and a processor reading the computer-readable instructions stored in the memory to execute any one of the above-mentioned image encryption methods and / or network model training methods.

[0010] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the image encryption method and / or the network model training method as described above.

[0011] In the technical solution provided in the embodiments of the present application, a key randomly generated according to the image attributes of the target image to be encrypted is used to perform multi-color channel encryption processing on the pixels in each target image to be encrypted, so as to obtain an encrypted target image set. On the one hand, pixel-by-pixel encryption of the pixels in the image can be achieved, so that the encrypted target image does not include the visual information of the target image to be encrypted, thereby effectively protecting the target image information to be encrypted and avoiding the information leakage problem of the encrypted image caused by invalid encryption; on the other hand, since the key is determined based on the image attributes of the target image to be encrypted, the key space is large enough, and even if the encryption method is known to a third party, it is impossible to restore the visual information of the original image by brute force cracking the key without the key.

[0012] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0014] Figure 1 It is a schematic diagram of an implementation environment involved in this application;

[0015] Figure 2 is a flow chart of an image encryption method shown in an exemplary embodiment of the present application;

[0016] Figure 3 yes Figure 2 A schematic diagram of the effect of the target image to be encrypted and the encrypted target image in the image encryption method shown;

[0017] Figure 4 is a flowchart of an image encryption method shown in another exemplary embodiment of the present application;

[0018] Figure 5 is a flowchart of an image encryption method shown in another exemplary embodiment of the present application;

[0019] Figure 6 is a flowchart of a network model training method shown in an exemplary embodiment of the present application;

[0020] Figure 7 An image encryption system for cloud server network model training is shown in FIG.

[0021] Figure 8 is a block diagram of an image encryption device shown in an exemplary embodiment of the present application;

[0022] Fig. 9 is a block diagram of a network model training device shown in an exemplary embodiment of the present application;

[0023] Fig.10 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0024] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0025] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0026] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0027] It should also be noted that the "multiple" mentioned in this application refers to two or more than two. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship.

[0028] First of all, it should be noted that the popularity of deep learning technology has promoted the development of computer vision, biomedicine and other fields. And with the improvement of computer computing power and the continuous development of deep neural network structures, people use more deep neural networks to extract image features, and the performance in various image tasks has been significantly improved. Furthermore, due to limited computing resources, computing speed and other factors, it has become popular in recent years to use cloud environments to implement the training iteration and testing process of deep neural network models. If the training images or test images on the user side are directly uploaded to the cloud environment for training iteration or testing of the network model, there may be a risk of leaking image information to a third party. Therefore, it is of great significance to encrypt the image before uploading it to the cloud environment.

[0029] At present, the encryption algorithm using pixel scrambling is used for image encryption, which makes it unable to resist statistical attacks. That is, the encryption algorithm cannot be made public. As long as the encryption algorithm is known, the image to be encrypted can be restored in a finite number of iterations by iterating any state in the ciphertext space, which leads to the problem of leakage of original image information.

[0030] Based on this, in order to effectively protect the target image information to be encrypted and avoid the information leakage of the encrypted image caused by invalid encryption, the embodiment of the present application proposes an image encryption method, a network model training method, a device, an electronic device and a computer-readable storage medium.

[0031] An embodiment of the present application relates to: performing multi-color channel encryption processing on pixel points in each target image to be encrypted according to a key randomly generated according to the image attributes of the target image to be encrypted, and obtaining an encrypted target image set, thereby achieving pixel-by-pixel encryption of the pixel points in the image, so that the encrypted target image does not include the visual information of the target image to be encrypted, effectively protecting the target image information to be encrypted, and avoiding the information leakage problem of the encrypted image caused by invalid encryption.

[0032] Figure 1 1 is a schematic diagram of an implementation environment involved in the present application. The implementation environment includes a cloud service end 110 and a user terminal 120, and the cloud service end 110 and the user terminal 120 are pre-established with a wired or wireless network connection.

[0033] like Figure 1As shown, the user terminal 120 obtains the target image set to be encrypted, and randomly generates a key according to the image attributes of the target image to be encrypted, and then uses the key to perform multi-color channel encryption processing on the pixels in each target image to be encrypted to obtain an encrypted target image set, and then uploads the encrypted target image set to the cloud server 110. The cloud server 110 receives the encrypted target image set uploaded by the user terminal 120, and uses the encrypted target image set as an image training sample set to optimize the network model until a network model that meets the requirements is obtained.

[0034] in, Figure 1 The user terminal 120 shown can be any device that supports image encryption, such as a smart phone, a car computer, a tablet computer, a laptop computer, or a wearable device, but is not limited thereto. Figure 1 The cloud service end 110 shown is a server, for example, it can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or it can be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms, which are not limited here. The user terminal 120 can communicate with the cloud service end 110 through wireless networks such as 6G (third generation mobile information technology), 4G (fourth generation mobile information technology), and 5G (fifth generation mobile information technology), which are not limited here.

[0035] See also Figure 2 , Figure 2 is a flowchart of an image encryption method shown in an exemplary embodiment of the present application. The method can be applied to Figure 1 The implementation environment shown is specifically executed by the user terminal 120 in the implementation environment. It should be understood that the method can also be applied to other exemplary implementation environments and be specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable.

[0036] The image encryption method proposed in the embodiment of the present application is described in detail below using the user terminal as the specific execution subject.

[0037] like Figure 2 As shown, in an exemplary embodiment, the image encryption method at least includes steps S210 to S240, which are described in detail as follows:

[0038] Step S210, obtaining a target image set to be encrypted.

[0039] The target image set to be encrypted includes a plurality of target images to be encrypted, that is, plaintext images. Exemplarily, the target image to be encrypted may be a plaintext image stored in a user terminal.

[0040] The user terminal obtains the target image set to be encrypted. Exemplarily, the user terminal determines the target image set to be encrypted in response to the user's selection of images stored in the terminal.

[0041] Step S220: randomly generate a key according to the image attributes of the target image to be encrypted.

[0042] Image attributes include the number of pixels in the image and may also include the number of color channels of each pixel in the image.

[0043] The key refers to the password that can encrypt the pixel values ​​of the pixels in the image.

[0044] The user terminal randomly generates a key according to the image attributes of the target image to be encrypted. Exemplarily, the number of key bits can be determined according to the number of pixels in the target image to be encrypted, and then a key value is randomly generated at each key bit, and the key value of each pixel in the image to be encrypted is obtained, thereby obtaining the key of the image to be encrypted. It should be noted that the key value of each key bit in the key is 0 or 1. It should also be noted that the key used to encrypt each target image to be encrypted is the same.

[0045] Step 230 , performing multi-color channel encryption processing on the pixels in each target image to be encrypted according to the key, to obtain an encrypted target image set.

[0046] The encryption processing of multiple color channels refers to the encryption processing of each pixel on the three color channels of R channel, B channel and G channel respectively.

[0047] The encrypted target image set includes several encrypted target images, each of which corresponds to a target image to be encrypted, that is, the key encrypts the target image to be encrypted to obtain the corresponding encrypted target image. Figure 3 , Figure 3 The target image to be encrypted and the encrypted target image are shown in FIG. Figure 3 As shown, Figure 3 The left side shows the target image to be encrypted. Figure 3The encrypted target image is shown on the right. It can be seen that by using a key to perform pixel-by-pixel encryption processing on the pixels in the target image to be encrypted in multiple color channels, the effect of visual security can be achieved. That is, the encrypted target image does not include the visual information of the target image to be encrypted, and the target image information to be encrypted is effectively protected. Moreover, since the key is determined based on the image attributes of the target image to be encrypted, the key space is large enough. Even if the encryption method is known to a third party, it is impossible to recover the visual information of the target image to be encrypted by brute force without the key. It should be noted that the key space is large enough because the number of key bits in the key determined based on the number of pixels is the same as the number of pixels. For example, if the size of the target image to be encrypted is 224×224, then the key space size is 2 3N , where N = 224×224.

[0048] It can be seen that the image encryption method of this embodiment performs multi-color channel encryption processing on the pixels in each target image to be encrypted according to the key randomly generated according to the image attributes of the target image to be encrypted, and obtains an encrypted target image set. On the one hand, it can realize pixel-by-pixel encryption of the pixels in the image, so that the encrypted target image does not include the visual information of the target image to be encrypted, effectively protects the target image information to be encrypted, and avoids the information leakage of the encrypted image caused by invalid encryption; on the other hand, because the key is determined based on the image attributes of the target image to be encrypted, the key space is large enough, even if the encryption method is known to a third party, it is impossible to restore the visual information of the original image by brute force cracking the key without the key.

[0049] Figure 4 FIG. 1 is a flowchart of an image encryption method shown in another exemplary embodiment of the present application. Figure 4 In the illustrated embodiment, step S230 performs multi-color channel encryption processing on the pixels in each target image to be encrypted according to the key, and the process of obtaining the encrypted target image set at least includes steps S231 to S234, which are described in detail as follows:

[0050] Step S231, using the key value of each key bit in the first subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the R channel, to obtain the encrypted pixel value of each pixel point on the R channel.

[0051] Step S232, using the key value of each key bit in the second subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the G channel, to obtain the encrypted pixel value of each pixel point on the G channel.

[0052] Step S233, using the key value of each key bit in the third subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the B channel, to obtain the encrypted pixel value of each pixel point on the B channel.

[0053] The first subkey refers to a key contained in the key for encrypting the initial pixel value of each pixel point on the R channel.

[0054] The second subkey refers to the key contained in the key for encrypting the initial pixel value of each pixel point on the G channel.

[0055] The third subkey refers to the key contained in the key for encrypting the initial pixel value of each pixel point on the B channel.

[0056] For example, the key may be represented as K, where K={K R ,K G ,K B}, K R represents the first subkey, Where N is the number of pixels in the target image to be encrypted, The key value representing the first key bit in the first subkey is used to encrypt the initial pixel value of the first pixel in the target image to be encrypted on the R channel. The key value representing the second key bit in the first subkey is used to encrypt the initial pixel value of the second pixel point in the target image to be encrypted on the R channel. G represents the second subkey, in, The key value representing the first key bit in the second subkey is used to encrypt the initial pixel value of the first pixel point in the target image to be encrypted on the G channel. The key value of the second key bit in the second subkey is used to encrypt the initial pixel value of the second pixel point in the target image to be encrypted on the G channel. B represents the third subkey, in, The key value of the first key bit in the third subkey is used to encrypt the initial pixel value of the first pixel in the target image to be encrypted on the B channel. The key value representing the second key bit in the third subkey is used to encrypt the initial pixel value of the second pixel point on the B channel in the target image to be encrypted.

[0057] In another exemplary embodiment, if the target image set to be encrypted is represented as Dtrain ={I1,I1…I n}, n represents the number of target images to be encrypted, and the images in the target image set to be encrypted are represented as I j , j∈{1,2…n}, the target image I to be encrypted j Divided into color channels The first subkey K R The target image I to be encrypted j Pixel value on the R channel Encryption is performed, and the second subkey K G The target image I to be encrypted j Pixel value on the G channel Encryption processing, the third subkey K B The target image I to be encrypted j Pixel value on the B channel Encryption processing is performed.

[0058] A key position refers to a key position in a key. For example, the first subkey In The position in the first subkey is a key bit.

[0059] The key value refers to the key value of the corresponding key bit in the key. In The value of is the key value.

[0060] The initial pixel value refers to the pixel value of the corresponding pixel point in the target image to be encrypted. The initial pixel value on a specific channel refers to the pixel value of the corresponding pixel point in the target image to be encrypted on the corresponding color channel.

[0061] The user terminal uses the key value of each key bit in the first subkey to encrypt the initial pixel value of the corresponding pixel point on the R channel to obtain the encrypted pixel value of each pixel point on the R channel; uses the key value of each key bit in the second subkey to encrypt the initial pixel value of the corresponding pixel point on the G channel to obtain the encrypted pixel value of each pixel point on the G channel; uses the key value of each key bit in the third subkey to encrypt the initial pixel value of the corresponding pixel point on the B channel to obtain the encrypted pixel value of each pixel point on the B channel.

[0062] Furthermore, the key value for encrypting the initial pixel value of each pixel on the R channel, G channel, and B channel is a random value of zero or one generated randomly with equal probability. When determining the encrypted pixel value of each pixel on the R channel, G channel, and B channel, the embodiment of the present application can determine the encrypted pixel value of each pixel on the R channel, G channel, and B channel based on the specific key value for encrypting the initial pixel value of each pixel on the R channel, G channel, and B channel.

[0063] Specifically, when the user terminal determines that the key value required to encrypt the initial pixel value of the corresponding pixel point on each channel is zero, the initial pixel value of the corresponding pixel point on the corresponding channel is used as the pixel value of the pixel point after encryption on the corresponding channel. Exemplarily, when the user terminal determines that the key value required to encrypt the initial pixel value of the corresponding pixel point on the R channel is zero, the initial pixel value of the corresponding pixel point on the R channel is used as the pixel value of the pixel point after encryption on the R channel. For example, if the target image to be encrypted I j Any pixel point in is represented as P t , t∈(1,2…N), Represents pixel P t Initial pixel value on the R channel, encrypted The corresponding key value in the first subkey of The pixel value of the encrypted pixel is expressed as The key When it is zero, the pixel value of the encrypted pixel is the pixel point P t Initial pixel value on the R channel

[0064] When the user terminal determines that the key value required to encrypt the initial pixel value of the corresponding pixel point on each channel is one, the complementary color value of the corresponding pixel point on the R channel is used as the pixel value of the pixel point after encryption on the corresponding channel. Exemplarily, when the user terminal determines that the key value required to encrypt the initial pixel value of the corresponding pixel point on the R channel is one, the complementary color value of the corresponding pixel point on the R channel is used as the pixel value of the pixel point after encryption on the R channel. For example, if the target image to be encrypted I j Any pixel point in is represented as P t , t∈(1,2…N), Represents pixel P t Initial pixel value on the R channel, encrypted The corresponding key value in the first subkey of The pixel value of the encrypted pixel is expressed as The key When is 1, the pixel value of the encrypted pixel is the pixel point P tComplementary color value on the R channel.

[0065] It should be noted that the complementary color value of the corresponding pixel point is determined based on the preset bit value and the initial pixel value of the corresponding pixel point on the corresponding channel. Specifically, the user terminal determines the bit number item according to the preset bit value, and then determines the encrypted pixel value of the corresponding pixel point on the corresponding channel according to the difference between the preset bit number item and the initial pixel value of the corresponding pixel point on the corresponding channel. Among them, the preset bit value refers to the number of bits of the pixel point, which is usually 8 bits. The bit number item is determined based on the difference between the preset bit value power of two and the preset value. The preset data can be 1.

[0066] Therefore, the encrypted pixel value of each pixel satisfies the following formula:

[0067]

[0068] Among them, C∈{R,G,B}, Indicates the encrypted pixel value of the pixel point on the corresponding channel. Represents the initial pixel value of the pixel on the corresponding channel, represents the key required to encrypt the initial pixel value of the pixel point on the corresponding channel, and L represents the preset bit value.

[0069] Step S234, determining the encrypted pixel value of the corresponding pixel point based on the encrypted pixel value of each pixel point on the R channel, the G channel and the B channel to obtain an encrypted target image set.

[0070] In order to determine the encrypted pixel value of each pixel in the target image to be encrypted, the user terminal determines the encrypted pixel value of the corresponding pixel based on the encrypted pixel value of each pixel on the R channel, G channel and B channel, and then determines the encrypted target image based on the encrypted pixel value of each pixel.

[0071] It can be seen that the image encryption method of the embodiment of the present application uses the key value of each key bit in the first subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the R channel to obtain the encrypted pixel value of each pixel point on the R channel; uses the key value of each key bit in the second subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the G channel to obtain the encrypted pixel value of each pixel point on the G channel; and uses the key value of each key bit in the third subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the B channel to obtain the encrypted pixel value of each pixel point on the B channel; and then determines the encrypted pixel value of the corresponding pixel point based on the encrypted pixel value of each pixel point on the R channel, the G channel and the B channel to obtain the encrypted target image set, thereby traversing all the pixels in the target image to be encrypted according to the above method, so that the sensitive visual information of the encrypted target image is protected and invisible without authorization, effectively protecting the target image information to be encrypted, and avoiding the information leakage problem of the encrypted image caused by invalid encryption.

[0072] Figure 5 FIG. 1 is a flowchart of an image encryption method shown in another exemplary embodiment of the present application. Figure 5 In the illustrated embodiment, the process of randomly generating a key according to the image attributes of the target image to be encrypted in step S220 at least includes steps S221 to S222, which are described in detail as follows:

[0073] Step S221, determining the number of key bits in the first subkey on the R channel, the number of key bits in the second subkey on the G channel, and the number of key bits in the third subkey on the B channel of the pixels in the target image to be encrypted according to the number of pixels in the target image to be encrypted.

[0074] The number of pixels refers to the number of pixels in the target image to be encrypted.

[0075] In order to encrypt the initial pixel values ​​of the pixels on the R channel, the G channel, and the B channel respectively, the embodiment of the present application determines the first subkey, the second subkey, and the third subkey contained in the key, the first subkey contains a key for encrypting the initial pixel values ​​of the pixels on the R channel, the second subkey contains a key for encrypting the initial pixel values ​​of the pixels on the B channel, and the third subkey contains a key for encrypting the initial pixel values ​​of the pixels on the B channel. And in order for each subkey to have a corresponding key to encrypt the initial pixel values ​​of the pixels in each channel, the embodiment of the present application determines the number of key bits in the first subkey for the pixels contained in the image on the R channel according to the number of pixels in the target image to be encrypted, determines the number of key bits in the second subkey for the pixels contained in the image on the G channel, and determines the number of key bits in the third subkey for the pixels contained in the image on the B channel. Exemplarily, if the number of pixels in the target image to be encrypted is N, then the first subkey

[0076] Step S222, randomly generate the key value of each key bit based on the number of key bits in the first subkey, randomly generate the key value of each key bit based on the number of key bits in the second subkey, and randomly generate the key value of each key bit based on the number of key bits in the third subkey to obtain the key.

[0077] The user terminal randomly generates a random value of zero or one with equal probability at each key bit as the key value of the corresponding key bit according to the determined key bit number of the first subkey, the key bit number of the second subkey and the key position of the third subkey, thereby obtaining the key value of each key bit in the key.

[0078] It can be seen that the image encryption method of the embodiment of the present application determines the number of key bits in the first subkey on the R channel, the number of key bits in the second subkey on the G channel, and the number of key bits in the third subkey on the B channel of the pixel points in the target image to be encrypted according to the number of pixels of the target image to be encrypted; randomly generates the key value of each key bit based on the number of key bits in the first subkey, randomly generates the key value of each key bit based on the number of key bits in the second subkey, and randomly generates the key value of each key bit based on the number of key bits in the third subkey to obtain the key, thereby making the key space large enough. Even if the encryption method is known to a third party, it is impossible to restore the visual information of the target image to be encrypted by brute force cracking the key without the key.

[0079] See also Figure 6 , Figure 6 This is a flowchart of a network model training method shown in an exemplary embodiment of the present application. The network model training method proposed in the embodiment of the present application is described in detail below using the cloud service end as the specific execution subject.

[0080] like Figure 6 As shown, in an exemplary embodiment, the training method of the network model includes at least steps S610 to S640, which are described in detail as follows:

[0081] Step S610: acquiring the encrypted target image set sent by the user terminal, and using the encrypted target image set as an image training sample set.

[0082] The encrypted target image set is the encrypted target image set calculated by the image encryption method shown in the above embodiment.

[0083] The user terminal uploads the encrypted target image set to the cloud server. The cloud server receives the encrypted target image set uploaded by the user terminal and uses the encrypted target image set as an image training sample set.

[0084] Step S620, inputting the encrypted target image set into the network model, and the network model outputs the predicted category of each encrypted target image in the encrypted target image set.

[0085] The network model refers to a deep neural network that recognizes the category to which the encrypted target image uploaded by the user terminal belongs.

[0086] The cloud server inputs the image training sample set uploaded by the user terminal into the network model so that the network model outputs the predicted category to which the image training sample belongs.

[0087] Step S630 , calculating the loss value of the loss function between the predicted category of each encrypted target image and the corresponding labeled category.

[0088] The loss value of the loss function can represent the degree of similarity between the predicted category and the labeled category. The smaller the loss value of the loss function, the more similar the category of the input image training sample is to the labeled category, and vice versa.

[0089] The cloud server calculates the loss value of the loss function between the predicted category of the encrypted target image and the corresponding labeled category.

[0090] Step S640, training the network model with the goal of reducing the loss value of the loss function, until the loss value of the loss function determined according to the trained network model is less than a preset loss threshold.

[0091] The preset loss threshold is a value used to measure the accuracy of network model training. If the preset loss threshold is set to a lower value, the network model will recognize the category to which the image belongs with higher accuracy. If the preset loss threshold is set to a higher value, the network model will recognize the category to which the image belongs with lower accuracy. It should be noted that the preset loss threshold can be set by the staff according to the actual situation and is not limited here.

[0092] The cloud server trains the network model with the goal of reducing the loss value of the loss function until the loss value of the loss function determined by the trained network is less than the preset loss threshold.

[0093] It should be noted that, in order to improve the accuracy of the category recognition of the network model, the embodiment of the present application can also use an image test sample set to test the accuracy of the trained network model to further optimize the network model, wherein the image test sample set is also the encrypted test image. It should be further noted that the encrypted test image can be obtained by encrypting the test image to be encrypted using the image encryption method shown in the above embodiment.

[0094] Furthermore, in order to improve the recognition accuracy of the network model, before the image training sample set is input into the network model for training, the cloud server of the embodiment of the present application performs data enhancement processing on the image training samples in the image training sample set, and then uses the data-enhanced image training samples for network model training. Specifically, the cloud server performs data enhancement operations such as horizontal flipping, vertical flipping, and shifting on the image training samples. Exemplarily, the backbone network in the network model can be ResNet50.

[0095] It can be seen that the network model training method of the embodiment of the present application uses the encrypted target image set calculated by the image encryption method of the above embodiment as the training set of the network model to train the network model, which has the same computational cost as using the target image to be encrypted to train the network model, and the encrypted target image obtained by the image encryption method of the above embodiment is used as a training sample, which can retain the basic spatial information of the original image set, so that the encrypted image can train a practical and usable network model.

[0096] You can continue to read Figure 7 , Figure 7An image encryption system for cloud server network model training is shown in the figure. The image encryption system includes a user terminal and a cloud server. The user terminal includes a training image encryption module, a key generation module and a test image encryption module. The cloud server includes a data enhancement module, a network model training module and a network model test model. It should be noted that the training image encryption module in the user terminal encrypts the training image and uploads the encrypted image to the cloud server. The data encryption module in the cloud server performs data enhancement on the encrypted image uploaded by the user terminal, and then the network model training module in the cloud server uses the data-enhanced encrypted image for network model training; the test image encryption module in the user terminal encrypts the test image with a key and uploads it to the cloud server. The network model testing module in the cloud server uses the received encrypted test image to test the trained network model.

[0097] Figure 8 is a block diagram of an image encryption device shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The device may also be applicable to other exemplary implementation environments and specifically configured in other devices, and this embodiment does not limit the implementation environment to which the device is applicable.

[0098] like Figure 8 As shown, the exemplary image encryption device 800 includes a target image set acquisition module 81 to be encrypted, a key generation module 82 and an encryption module 83. Specifically:

[0099] The target image set acquisition module to be encrypted is configured to acquire the target image set to be encrypted, and the target image set to be encrypted includes a plurality of target images to be encrypted.

[0100] The key generation module is configured to randomly generate a key according to image attributes of a target image to be encrypted.

[0101] The encryption module is configured to perform multi-color channel encryption processing on pixel points in each target image to be encrypted according to the key to obtain an encrypted target image set.

[0102] In another exemplary embodiment, the encryption module 83 further includes an enhancement processing module, a selection module and a voice sample pair determination module. Specifically:

[0103] The encryption module on the R channel is configured to use the key value of each key bit in the first subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the R channel to obtain the encrypted pixel value of each pixel point on the R channel.

[0104] The encryption module on the G channel is configured to use the key value of each key bit in the second subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the G channel to obtain the encrypted pixel value of each pixel point on the G channel.

[0105] The encryption module on the B channel is configured to use the key value of each key bit in the third subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the B channel to obtain the encrypted pixel value of each pixel point on the B channel.

[0106] The encrypted target image set determination module is configured to determine the encrypted pixel values ​​of corresponding pixels based on the encrypted pixel values ​​of each pixel on the R channel, the G channel and the B channel to obtain the encrypted target image set.

[0107] In another exemplary embodiment, the encryption module on the R channel further includes a first judgment module. Specifically:

[0108] The first judgment module is configured to determine that the initial pixel value of the corresponding pixel point on the R channel is the encrypted pixel value of the corresponding pixel point on the R channel if the key value corresponding to the initial pixel value of the corresponding pixel point on the R channel is zero.

[0109] In another exemplary embodiment, the encryption module on the R channel further includes a second judgment module. Specifically:

[0110] The second judgment module is configured to determine that the complementary color value of the corresponding pixel point on the R channel is the encrypted pixel value of the corresponding pixel point on the R channel if the key value corresponding to the initial pixel value of the encrypted corresponding pixel point on the R channel is one.

[0111] In another exemplary embodiment, the key generation module 82 further includes a key bit determination module and a key determination module. Specifically:

[0112] The key bit number determination module is configured to determine the key bit number in the first subkey on the R channel, the key bit number in the second subkey on the G channel, and the key bit number in the third subkey on the B channel of the pixel points in the target image to be encrypted according to the number of pixels of the target image to be encrypted.

[0113] The key determination module is configured to randomly generate a key value for each key bit based on the number of key bits in the first subkey, randomly generate a key value for each key bit based on the number of key bits in the second subkey, and randomly generate a key value for each key bit based on the number of key bits in the third subkey to obtain a key.

[0114] Fig. 9 is a block diagram of a network model training device shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The device may also be applicable to other exemplary implementation environments and specifically configured in other devices, and this embodiment does not limit the implementation environment to which the device is applicable.

[0115] like Fig. 9 As shown, the exemplary network model training device 900 includes an image training sample set acquisition module 91, an input module 92, a calculation module 93 and a training module 94. Specifically:

[0116] The image training sample set acquisition module 91 is configured to acquire the encrypted target image set sent by the user terminal and use the encrypted target image set as the image training sample set. The encrypted target image set is the encrypted target image set calculated by any of the above methods.

[0117] The input module 92 is configured to input the encrypted target image set into the network model, and the network model outputs the predicted category of each encrypted target image in the encrypted target image set.

[0118] The calculation module 93 is configured to calculate the loss value of the loss function between the predicted category of each encrypted target image and the corresponding labeled category.

[0119] The training module 94 is configured to train the network model with the goal of reducing the loss value of the loss function until the loss value of the loss function determined according to the trained network model is less than a preset loss threshold.

[0120] It should be noted that the image encryption device and / or the training device of the network model provided in the above-mentioned embodiment belongs to the same concept as the image encryption method and / or the training method of the network model provided in the above-mentioned embodiment, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here. In actual applications, the image encryption device and / or the training device of the network model provided in the above-mentioned embodiment can distribute the above-mentioned functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0121] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the network model training method and / or the gender recognition method of the voice object provided in the above-mentioned embodiments.

[0122] Fig.10 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.

[0123] It should be noted that Fig.10 The computer system 1000 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0124] like Fig.10 As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1002 or the program loaded from the storage part 1008 to the random access memory (RAM) 1003, such as executing the method described in the above embodiment. In the RAM 1003, various programs and data required for system operation are also stored. The CPU 1001, the ROM 1002 and the RAM 1003 are connected to each other through the bus 1004. The input / output (I / O) interface 1005 is also connected to the bus 1004.

[0125] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.

[0126] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 1010, and / or installed from a removable medium 1011. When the computer program is executed by a central processing unit (CPU) 1001, various functions defined in the system of the present application are executed.

[0127] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0128] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0129] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0130] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0131] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in each of the above embodiments.

[0132] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.

Claims

1. An image encryption method, characterized in that: The method comprises: Acquire a target image set to be encrypted, wherein the target image set to be encrypted includes a plurality of target images to be encrypted; A key is randomly generated according to the image attributes of the target image to be encrypted, and the number of key bits is determined according to the number of pixels in the target image to be encrypted, and the key value of each key bit in the key is 0 or 1, and the key used to encrypt each target image to be encrypted is the same; Performing multi-color channel encryption processing on pixel points in each target image to be encrypted according to the key to obtain an encrypted target image set; When it is determined that the key value required for encrypting the initial pixel value of the corresponding pixel point on each channel is 0, the initial pixel value of the corresponding pixel point on the corresponding channel is used as the pixel value of the pixel point after encryption on the corresponding channel; when it is determined that the key value required for encrypting the initial pixel value of the corresponding pixel point on each channel is 1, the complementary color value of the corresponding pixel point on the corresponding channel is used as the pixel value of the pixel point after encryption on the corresponding channel; The encrypted pixel value of each pixel satisfies the following formula: Among them, C∈{R,G,B}, Indicates the encrypted pixel value of the pixel point on the corresponding channel. Represents the initial pixel value of the pixel on the corresponding channel, represents the key required to encrypt the initial pixel value of the pixel point on the corresponding channel, and L represents the preset bit value.

2. The method according to claim 1, characterized in that The key includes a first subkey, a second subkey and a third subkey, and the step of performing multi-color channel encryption processing on pixel points in each target image to be encrypted according to the key to obtain an encrypted target image set includes: Using the key value of each key bit in the first subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the R channel, to obtain the encrypted pixel value of each pixel point on the R channel; Using the key value of each key bit in the second subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the G channel, to obtain the encrypted pixel value of each pixel point on the G channel; Using the key value of each key bit in the third subkey to encrypt the initial pixel value of the corresponding pixel point in the target image to be encrypted on the B channel, to obtain the encrypted pixel value of each pixel point on the B channel; The encrypted pixel values ​​of the corresponding pixel points are determined based on the encrypted pixel values ​​of each pixel point on the R channel, the G channel, and the B channel to obtain an encrypted target image set.

3. The method according to claim 2, characterized in that The step of encrypting the initial pixel value of the corresponding pixel point in the target image to be encrypted on the R channel by using the key value of each key bit in the first subkey to obtain the encrypted pixel value of each pixel point on the R channel includes: If the key value corresponding to the initial pixel value of the encrypted corresponding pixel point on the R channel is zero, then the initial pixel value of the corresponding pixel point on the R channel is determined to be the pixel value of the corresponding pixel point after encryption on the R channel.

4. The method according to claim 2, characterized in that: The step of encrypting the initial pixel value of the corresponding pixel point in the target image to be encrypted on the R channel by using the key value of each key bit in the first subkey to obtain the encrypted pixel value of each pixel point on the R channel includes: If the key value corresponding to the initial pixel value of the encrypted corresponding pixel point on the R channel is one, the complementary color value of the corresponding pixel point on the R channel is determined to be the encrypted pixel value of the corresponding pixel point on the R channel.

5. The method according to claim 4, characterized in that The step of determining the complementary color value of the corresponding pixel point on the R channel as the encrypted pixel value of the corresponding pixel point on the R channel comprises: Determine a bit number item according to a preset bit value; The difference between the bit number item and the initial pixel value of the corresponding pixel point on the R channel is calculated, and the difference is determined as the complementary color value, so as to use the complementary color value as the encrypted pixel value of the corresponding pixel point on the R channel.

6. The method according to claim 2, characterized in that The image attributes include the number of pixels and the number of channels of the pixel points of the target image. The step of randomly generating a key according to the image attributes of the target image to be encrypted includes: Determine, according to the number of pixels of the target image to be encrypted, the number of key bits in a first subkey on an R channel, the number of key bits in a second subkey on a G channel, and the number of key bits in a third subkey on a B channel for pixels in the target image to be encrypted; The key value of each key bit is randomly generated based on the number of key bits in the first subkey, the key value of each key bit is randomly generated based on the number of key bits in the second subkey, and the key value of each key bit is randomly generated based on the number of key bits in the third subkey to obtain the key.

7. A network model training method, characterized in that: The method comprises: Acquire an encrypted target image set sent by a user terminal, and use the encrypted target image set as an image training sample set, wherein the encrypted target image set is an encrypted target image set calculated by the method described in any one of claims 1 to 6 above; Inputting the encrypted target image set into the network model, the network model outputting the predicted category of each encrypted target image in the encrypted target image set; Calculate the loss value of the loss function between the predicted category and the corresponding labeled category of each encrypted target image; The network model is trained with the goal of reducing the loss value of the loss function until the loss value of the loss function determined according to the trained network model is less than a preset loss threshold.

8. An image encryption device, characterized in that: The device comprises: A target image set acquisition module to be encrypted, configured to acquire a target image set to be encrypted, wherein the target image set to be encrypted includes a plurality of target images to be encrypted; A key generation module is configured to randomly generate a key according to the image attributes of the target image to be encrypted, determine the number of key bits according to the number of pixels in the target image to be encrypted, the key value of each key bit in the key is 0 or 1, and the key used to encrypt each target image to be encrypted is the same; An encryption module is configured to perform multi-color channel encryption processing on pixel points in each target image to be encrypted according to the key to obtain an encrypted target image set; When it is determined that the key value required for encrypting the initial pixel value of the corresponding pixel point on each channel is 0, the initial pixel value of the corresponding pixel point on the corresponding channel is used as the pixel value of the pixel point after encryption on the corresponding channel; when it is determined that the key value required for encrypting the initial pixel value of the corresponding pixel point on each channel is 1, the complementary color value of the corresponding pixel point on the corresponding channel is used as the pixel value of the pixel point after encryption on the corresponding channel; The encrypted pixel value of each pixel satisfies the following formula: Among them, C∈{R,G,B}, Indicates the encrypted pixel value of the pixel point on the corresponding channel. Represents the initial pixel value of the pixel on the corresponding channel, represents the key required to encrypt the initial pixel value of the pixel point on the corresponding channel, and L represents the preset bit value.

9. A network model training device, characterized in that: The device comprises: An image training sample set acquisition module, configured to acquire an encrypted target image set sent by a user terminal, and use the encrypted target image set as an image training sample set, wherein the encrypted target image set is an encrypted target image set calculated by the method described in any one of claims 1 to 6 above; An input module configured to input the encrypted target image set into the network model, and the network model outputs a predicted category of each encrypted target image in the encrypted target image set; A calculation module configured to calculate a loss value of a loss function between a predicted category and a corresponding labeled category of each encrypted target image; The training module is configured to train the network model with the goal of reducing the loss value of the loss function until the loss value of the loss function determined according to the trained network model is less than a preset loss threshold.

10. An electronic device, comprising: a memory storing computer-readable instructions; The processor reads the computer-readable instructions stored in the memory to execute the image encryption method described in claims 1 to 6 and / or the network model training method described in claim 7.