Video encryption method based on artificial intelligence

Through the video encryption method based on artificial intelligence, the feature extraction and encryption processing of video data is used to use the generative adversarial network to solve the problem of insufficient security in the face of complex attack methods, and efficient video data protection and finesse Transform permission control.

CN118972644APending Publication Date: 2024-11-15NANJING XIAOCANCAN NETWORK TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411062697.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

Traditional video encryption methods are difficult to ensure the efficient and security of video data when facing complex attack methods, and cannot effectively prevent data leakage.

Method used

Using the video encryption method based on artificial intelligence, the video data is extracted through convolutional neural network, the encryption model of the generated adversarial network is constructed, and the realistic encrypted feature vectors are generated, and the video data is encrypted and decrypted using these feature vectors. Ensure that only authorized users can access video content.

Benefits of technology

Effectively prevent unauthorized users from viewing or parsing encrypted video data, ensuring the security of video data, and reducing errors by optimizing the decryption model, improving the quality of decrypted videos, realizing refined permission control without significantly increasing system computing and Storage burden.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972644A_ABST
    Figure CN118972644A_ABST
Patent Text Reader

Abstract

The invention relates to the related field of video encryption, in particular to a video encryption method based on artificial intelligence, which realizes efficient and safe video data protection by utilizing a generative adversarial network (GAN) and a feature sequence conversion technology. Specifically, the method constructs a decryption model, decrypts encrypted video data by using a generator inverse process in the generative adversarial network, recovers an original video feature sequence, and reconstructs the original video data according to the recovered feature sequence. According to the method, the security of the video data is remarkably enhanced, illegal access and tampering are prevented, user privacy is protected, and digital rights management (DRM) is effectively supported. Besides, the technical scheme is efficient in implementation and easy to integrate, can be widely applied to the fields of safety communication, medical imaging, financial monitoring and the like, and provides comprehensive guarantee for safety transmission and storage of video data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field related to video encryption, and in particular to a video encryption method based on artificial intelligence. Background Art

[0002] With the development of the Internet and the advancement of multimedia technology, video, as an important medium for information dissemination, has been widely used in various fields. However, the confidentiality and security of video content has become an important issue. Traditional video encryption methods mainly rely on encrypting video data, but these methods are powerless in the face of increasingly complex attack methods. Therefore, a more intelligent and efficient encryption method is urgently needed to ensure the security of video data. Summary of the invention

[0003] The purpose of the present invention is to provide a video encryption method based on artificial intelligence to solve the problems raised in the above background technology.

[0004] 1. To achieve the above object, the present invention provides the following technical solution: a video encryption method based on artificial intelligence, comprising the following steps:

[0005] Step 1: Preprocessing video data: obtaining the video data to be encrypted, and performing frame processing on the video data to obtain several frames of video images; performing image processing operations on each frame of the video image, including but not limited to grayscale and denoising, to obtain preprocessed image data;

[0006] Step 2, feature extraction: Use convolutional neural network to extract features from the preprocessed image data to obtain feature vectors for each frame of image; splice the feature vectors of each frame of image to form a complete video feature sequence;

[0007] Step 3: Encryption model training: Build an encryption model based on a generative adversarial network, including a generator and a discriminator. Through adversarial training, optimize the generator and the discriminator so that the generator can generate realistic encrypted feature vectors and the discriminator can distinguish between encrypted feature vectors and original feature vectors.

[0008] Step 4, video encryption: input the video feature sequence into the trained generator to generate the corresponding encrypted feature sequence; use the encrypted feature sequence to encrypt the original video data to obtain the encrypted video data;

[0009] Step 5, video decryption: input the encrypted video data into the decryption model to restore the original video feature sequence; reconstruct the original video data based on the restored feature sequence to complete the decryption operation.

[0010] Preferably, the specific steps of obtaining the video data to be encrypted and performing frame processing on the video data in step 1 to obtain several frames of video images are as follows:

[0011] Step 11, video data acquisition: obtain the video file to be encrypted through a camera device, network download, or reading from local storage, and ensure that the format and encoding method of the video file are suitable for subsequent processing;

[0012] Step 12: Video data loading: Use the video processing library, specifically OpenCV, to load the video file to ensure that the video can be successfully read and subsequently processed;

[0013] Step 13, frame processing: Initialize a frame counter to record and control the reading and processing of each frame, loop through each frame of the video loaded in step 12 until the end of the video, store each frame in memory, or save as an image file for subsequent processing;

[0014] Step 14, frame image storage: store the extracted frame images into a specified directory or data structure to ensure that each frame has a unique identifier;

[0015] Step 15, frame data verification: verify the integrity and quality of the extracted frame images to ensure that no frame loss or damage occurs; randomly select several frames to display or save, and manually check the image quality.

[0016] Preferably, the specific steps of feature extraction in step 2 are as follows:

[0017] Step 21, prepare image data: adjust the preprocessed frame image to the input size required by the CNN model, and normalize the image data to adapt it to the input requirements of the model;

[0018] Step 22, feature extraction: Use the pre-trained CNN model to forward propagate each frame of the image and extract the feature vector. The feature vector is regarded as a point in a high-dimensional space, representing the high-level features of the image. Specifically: Given an input image I i , whose eigenvector F i Extracted through CNN model M, the formula is as follows: [F i =M(I i )], where I i represents the i-th frame image, M represents the CNN model, F i represents the extracted feature vector;

[0019] Step 23, feature vector flattening: The extracted feature vector is a high-dimensional tensor, specifically: For the feature vector F i The flattening operation is denoted as flattlen(F i), the formula is as follows: [f i = flattlen(F i )], where f i represents the flattened eigenvector;

[0020] Step 24, feature vector concatenation: concatenate the feature vectors of all frames into a complete video feature sequence in chronological order. Specifically, given a series of feature vectors F1, F2, ..., F n , the splicing operation is recorded as: [\text{VideoFeatureSequence}=[flatten(F1),flatten(F2),…,flatten(Fn))]], where n represents the number of video frames and \text{VideoFeatureSequence} represents the complete video feature sequence;

[0021] Step 25, feature sequence normalization: Normalize the concatenated feature sequence to ensure the uniform scale of the data for subsequent encryption operations. Normalization uses a standardized method to convert the data into a distribution with zero mean and unit variance.

[0022] Preferably, the specific steps of the encryption model training in step 3 are as follows:

[0023] Step 31, generator model: The goal of the generator is to accept an input feature vector and generate an encrypted feature vector similar to the original feature vector. Specifically, given an input feature vector \mathbf{z}, the generator G generates an encrypted feature vector \mathbf{G(z)}, as follows: [\mathbf{G(z)}=G(\mathbf{z})], where \mathbf{z} is a random noise vector;

[0024] Step 32, discriminator model: The goal of the discriminator is to distinguish the real original feature vector from the encrypted feature vector generated by the generator. Specifically, given an input feature vector mathbf{x}, the discriminator D outputs the probability D(\mathbf{x}) that it is a real feature vector, as follows: [D(\mathbf{x})=\text{sigmoid}(f(\mathbf{x}))], where f(\mathbf{x}) is the output of the discriminator, and the \text{sigmoid} function maps it to the interval [0,1];

[0025] Step 33, loss function of the discriminator: The discriminator maximizes its ability to correctly classify the real feature vector and the generated encrypted feature vector. Specifically, the loss function of the discriminator \mathcal{L}D is defined as the following cross entropy loss: [\mathcal{L}D=―\mathbb{E}{\mathbf{x}~p{\text{data}}(\mathbf{x})}[\logD(\mathbf{x})]―\matgbb{E}{\mathbf{z}~p{mathbf(z)}(\mathbf{z})}[\log(1―D(G(\mathbf{z})))]], where p{\text{data}}(\mathbf{x}) is the distribution of the real feature vector, and p{mathbf(z)}(\mathbf{z}) is the distribution of the noise vector;

[0026] Step 34, loss function of the generator: The generator maximizes the probability that the discriminator judges the encrypted feature vector generated by it as a real feature vector. The loss function of the generator \mathcal{L}G is defined as the following cross entropy loss: [\mathcal{L}G=―\mathbb{E}{\mathbf{z}~p{\mathbf{z}}(\mathbf(z))}[\logD(G(\mathbf{z}))]], where the goal of the generator is to make D(G(\mathbf{z}) close to 1, that is, the feature vector generated by the discriminator is from the real distribution;

[0027] Step 35: By alternately optimizing the generator and the discriminator, the generator generates a realistic encrypted feature vector, and the discriminator effectively distinguishes the encrypted feature vector from the original feature vector. The specific steps are as follows:

[0028] a. Sample a batch of real feature vectors \mathbf{x} from the real feature vector distribution p{\text{data}}(\mathbf{x});

[0029] b. Sample a batch of noise vectors mathbf{z} from the noise distribution p{mathbf(z)}(\mathbf{z});

[0030] c. Use the generator to generate a batch of encrypted feature vectors \mathbf{G(z)};

[0031] d. Calculate the loss of the discriminator \mathcal{L}D and update the parameters of the discriminator to minimize the loss;

[0032] e. Calculate the generator’s loss \mathcal{L}G and update the generator’s parameters to minimize the loss.

[0033] Preferably, the specific steps of video encryption in step 4 are as follows:

[0034] Step 41, prepare the video feature sequence: the video feature sequence obtained from step 3 \mathbf{X}=\mathbf{x}1,\mathbf{x}2,…,\mathbf{x} n , where each \mathbf{x} i is the flattened eigenvector;

[0035] Step 42: Input to the trained generator: Each feature vector of the video feature sequence \mathbf{x} i Input into the trained generator G to generate the corresponding encrypted feature vector \mathbf{y} i , where \mathbf{y} i =G(\mathbf(x) i );

[0036] Step 43, generate encrypted feature sequence: concatenate all generated encrypted feature vectors into an encrypted feature sequence \mathbf{Y}=\mathbf{y}1,\mathbf{y}2,…,\mathbf{y} n , that is\mathbf{Y}=G(\matbhf{X}=[G(\mathbf{x}1),G(\matbhf{x}2),…G(\mathbf{x} n ]), where \mathbf{Y} represents the complete encrypted feature sequence;

[0037] Step 44, design encryption operation: define encryption operation, use encryption feature sequence \mathbf{Y} to adjust the pixel value of the original video frame to achieve encryption effect;

[0038] Step 45, encrypt video frame: for each frame of video \mathb{I} i , combined with the corresponding encrypted feature vector \mathbf{y} i To encrypt, specifically, assume that the pixel value of each frame is \mathb{I} i , the encryption operation can be defined as: in is the encrypted image, α is the adjustment factor that controls the encryption strength, and the \mathbf{reshape} operation adjusts the encrypted feature vector to a shape consistent with the image size;

[0039] Step 46: Generate encrypted video: All encrypted frames Reassemble into a complete video.

[0040] Preferably, the specific steps of video decryption in step 5 are as follows:

[0041] Step 51, prepare encrypted video feature sequence: extract the encrypted feature sequence \mathbf{Y}=\mathbf{y}1,\mathbf{y}2,…,\mathbf{y} from the encrypted video data n , where each \mathbf{y} i is the encrypted feature vector;

[0042] Step 52: Input to the decryption model: Each encrypted feature vector of the encrypted feature sequence \mathbf{y} i Input into the preset trained decryptor D to restore the corresponding original feature vector The specific formula is:

[0043] Step 53: Generate a restored feature sequence: concatenate all restored feature vectors into a restored feature sequence The specific formula is: in represents the restored original video feature sequence;

[0044] Step 54: Design decryption operation: Use the recovered feature sequence To reconstruct the original video frame, the feature vector is converted back to an image by inverse operation or using a decoding network;

[0045] Step 55: For each restored feature vector Generate the corresponding original video frame through the decoding network E The specific formula is as follows:

[0046] Step 56: All reconstructed frames Reassembled into a complete video, specifically:

[0047] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention encrypts the video feature sequence through a generator, so that even if an unauthorized user obtains the encrypted video data, he cannot watch or parse the content therein, thereby effectively preventing data leakage; by using the trained generator inverse process to build a decryption model, the high accuracy and reliability of recovering the original video feature sequence from the encrypted feature sequence is guaranteed, and the quality of the decrypted video is ensured; by optimizing the training of the decryption model, the error can be effectively reduced, and the similarity between the decrypted video data and the original video data can be further improved; the scheme of the present invention can fully encrypt the user video data, and the video content can only be restored through a specific decryption model, thereby protecting the user's privacy and preventing the leakage of sensitive information. Through the authorization management of the decryption model, it is ensured that only authorized users can access and decrypt the video data, and refined permission control is realized; the present invention utilizes the characteristics of the generative adversarial network to realize efficient video encryption and decryption processing, and can ensure security without significantly increasing the calculation and storage burden of the system, and the present invention can be seamlessly integrated with the existing video processing system, and through appropriate interface and module design, it is convenient to promote and use in various application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 It is a schematic diagram of the method flow of the present invention. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] See also Figure 1 The present invention provides a technical solution: a video encryption method based on artificial intelligence, comprising the following steps:

[0051] Step 1: Preprocessing video data: obtaining the video data to be encrypted, and performing frame processing on the video data to obtain several frames of video images; performing image processing operations on each frame of the video image, including but not limited to grayscale and denoising, to obtain preprocessed image data;

[0052] Step 2, feature extraction: Use convolutional neural network to extract features from the preprocessed image data to obtain feature vectors for each frame of image; splice the feature vectors of each frame of image to form a complete video feature sequence;

[0053] Step 3: Encryption model training: Build an encryption model based on a generative adversarial network, including a generator and a discriminator. Through adversarial training, optimize the generator and the discriminator so that the generator can generate realistic encrypted feature vectors and the discriminator can distinguish between encrypted feature vectors and original feature vectors.

[0054] Step 4, video encryption: input the video feature sequence into the trained generator to generate the corresponding encrypted feature sequence; use the encrypted feature sequence to encrypt the original video data to obtain the encrypted video data;

[0055] Step 5, video decryption: input the encrypted video data into the decryption model to restore the original video feature sequence; reconstruct the original video data based on the restored feature sequence to complete the decryption operation.

[0056] Furthermore, the specific steps of obtaining the video data to be encrypted in step 1 and performing frame processing on the video data to obtain several frames of video images are as follows:

[0057] Step 11, video data acquisition: obtain the video file to be encrypted through a camera device, network download, or reading from local storage, and ensure that the format and encoding method of the video file are suitable for subsequent processing;

[0058] Step 12: Video data loading: Use the video processing library, specifically OpenCV, to load the video file to ensure that the video can be successfully read and subsequently processed;

[0059] Step 13, frame processing: Initialize a frame counter to record and control the reading and processing of each frame, loop through each frame of the video loaded in step 12 until the end of the video, store each frame in memory, or save as an image file for subsequent processing;

[0060] Step 14, frame image storage: store the extracted frame images into a specified directory or data structure to ensure that each frame has a unique identifier;

[0061] Step 15, frame data verification: verify the integrity and quality of the extracted frame images to ensure that no frame loss or damage occurs; randomly select several frames to display or save, and manually check the image quality.

[0062] Furthermore, the specific steps of feature extraction in step 2 are as follows:

[0063] Step 21, prepare image data: adjust the preprocessed frame image to the input size required by the CNN model, and normalize the image data to adapt it to the input requirements of the model;

[0064] Step 22, feature extraction: Use the pre-trained CNN model to forward propagate each frame of the image and extract the feature vector. The feature vector is regarded as a point in a high-dimensional space, representing the high-level features of the image. Specifically: Given an input image I i , whose eigenvector F i Through the CNN model N extraction, the formula is as follows: [F i =M(I i )], where I i represents the i-th frame image, M represents the CNN model, F i represents the extracted feature vector;

[0065] Step 23, feature vector flattening: The extracted feature vector is a high-dimensional tensor, specifically: For the feature vector F i The flattening operation is denoted as flattlen(F i ), the formula is as follows: [f i = flattlen(F i )], where f i represents the flattened eigenvector;

[0066] Step 24, feature vector concatenation: concatenate the feature vectors of all frames into a complete video feature sequence in chronological order. Specifically, given a series of feature vectors F1, F2, ..., F n , the splicing operation is recorded as: [\text{VideoFeatureSequence}=[flatten(F1),flatten(F2),…,flatten(F n ))]], where n represents the number of video frames, and \text{VideoFeatureSequence} represents the complete video feature sequence;

[0067] Step 25, feature sequence normalization: Normalize the concatenated feature sequence to ensure the uniform scale of the data for subsequent encryption operations. Normalization uses a standardized method to convert the data into a distribution with zero mean and unit variance.

[0068] Furthermore, the specific steps of the encrypted model training in step 3 are as follows:

[0069] Step 31, generator model: The goal of the generator is to accept an input feature vector and generate an encrypted feature vector similar to the original feature vector. Specifically, given an input feature vector \mathbf{z}, the generator G generates an encrypted feature vector \mathbf{G(z)}, as follows: [\mathbf{G(z)}=G(\mathbf{z})], where \mathbf{z} is a random noise vector;

[0070] Step 32, discriminator model: The goal of the discriminator is to distinguish the real original feature vector from the encrypted feature vector generated by the generator. Specifically, given an input feature vector mathbf{x}, the discriminator D outputs the probability D(\mathbf{x}) that it is a real feature vector, as follows: [D(\mathbf{x})=\text{sigmoid}(f(\mathbf{x}))], where f(\mathbf{x}) is the output of the discriminator, and the \text{sigmoid} function maps it to the interval [0,1];

[0071] Step 33, loss function of the discriminator: The discriminator maximizes its ability to correctly classify the real feature vector and the generated encrypted feature vector. Specifically, the loss function of the discriminator \mathcal{L}D is defined as the following cross entropy loss: [\mathcal{L}D=―\mathbb{E}{\mathbf{x}~p{\text{data}}(\mathbf{x})}[\logD(\mathbf{x})]―\mathbb{E}{\mathbf{z}~p{mathbf(z)}(\mathbf{z})}[\log(1―D(G(\mathbf{z})))]], where p{\text{data}}(\mathbf{x}) is the distribution of the real feature vector, and p{mathbf(z)}(\mathbf{z}) is the distribution of the noise vector;

[0072] Step 34, loss function of the generator: The generator maximizes the probability that the discriminator judges the encrypted feature vector generated by it as a real feature vector. The loss function of the generator \mathcal{L}G is defined as the following cross entropy loss: [\mathcal{L}G=―\mathbb{E}{\mathbf{z}~p{\mathbf{z}}(\mathbf(z))}[\logD(G(\mathbf{z}))]], where the goal of the generator is to make D(G(\mathbf{z}) close to 1, that is, the feature vector generated by the discriminator is from the real distribution;

[0073] Step 35: By alternately optimizing the generator and the discriminator, the generator generates a realistic encrypted feature vector, and the discriminator effectively distinguishes the encrypted feature vector from the original feature vector. The specific steps are as follows:

[0074] a. Sample a batch of real feature vectors \mathbf{x} from the real feature vector distribution p{\text{data}}(\mathbf{x});

[0075] b. Sample a batch of noise vectors mathbf{z} from the noise distribution p{mathbf(z)}(\mathbf{z});

[0076] c. Use the generator to generate a batch of encrypted feature vectors \mathbf{G(z)};

[0077] d. Calculate the loss of the discriminator \mathcal{L}D and update the parameters of the discriminator to minimize the loss;

[0078] e. Calculate the generator’s loss \mathcal{L}G and update the generator’s parameters to minimize the loss.

[0079] Furthermore, the specific steps of video encryption in step 4 are as follows:

[0080] Step 41, prepare the video feature sequence: the video feature sequence obtained from step 3 \mathbf{X}=\mathbf{x}1,\mathbf{x}2,…,\mathbf{x} n , where each \mathbf{x} i is the flattened eigenvector;

[0081] Step 42: Input to the trained generator: Each feature vector of the video feature sequence \mathbf{x} i Input into the trained generator G to generate the corresponding encrypted feature vector \mathbf{y} i , where \mathbf{y} i =G(\mathbf(x) i );

[0082] Step 43, generate encrypted feature sequence: concatenate all generated encrypted feature vectors into an encrypted feature sequence \mathbf{Y}=\mathbf{y}1,\mathbf{y}2,…,\mathbf{y} n , that is\mathbf{Y}=G(\mathbf{X}=[G(\mathbf{x}1),G(\mathbf{x}2),…G(\mathbf{x} n ]), where \mathbf{Y} represents the complete encrypted feature sequence;

[0083] Step 44, design encryption operation: define encryption operation, use encryption feature sequence \mathbf{Y} to adjust the pixel value of the original video frame to achieve encryption effect;

[0084] Step 45, encrypt video frame: for each frame of video \mathb{I} i, combined with the corresponding encrypted feature vector \mathbf{y} i To encrypt, specifically, assume that the pixel value of each frame is \mathb{I} i , the encryption operation can be defined as: in is the encrypted image, α is the adjustment factor that controls the encryption strength, and the \mathbf{reshape} operation adjusts the encrypted feature vector to a shape consistent with the image size;

[0085] Step 46: Generate encrypted video: All encrypted frames Reassemble into a complete video.

[0086] Furthermore, the specific steps of step 5 video decryption are as follows:

[0087] Step 51, prepare encrypted video feature sequence: extract the encrypted feature sequence \mathbf{Y}=\mathbf{y}1,\mathbf{y}2,…,\mathbf{y} from the encrypted video data n , where each \mathbf{y} i is the encrypted feature vector;

[0088] Step 52: Input to the decryption model: Each encrypted feature vector of the encrypted feature sequence \mathbf{y} i Input into the preset trained decryptor D to restore the corresponding original feature vector The specific formula is:

[0089] Step 53: Generate a restored feature sequence: concatenate all restored feature vectors into a restored feature sequence The specific formula is: in represents the restored original video feature sequence;

[0090] Step 54: Design decryption operation: Use the recovered feature sequence To reconstruct the original video frame, the feature vector is converted back to an image by inverse operation or using a decoding network;

[0091] Step 55: For each restored feature vector Generate the corresponding original video frame through the decoding network E The specific formula is as follows:

[0092] Step 56: All reconstructed frames Reassembled into a complete video, specifically:

[0093] The present invention encrypts the video feature sequence through a generator, so that even if an unauthorized user obtains the encrypted video data, he cannot watch or parse the content therein, thereby effectively preventing data leakage; by using the trained generator inverse process to build a decryption model, the high accuracy and reliability of recovering the original video feature sequence from the encrypted feature sequence is guaranteed, and the quality of the decrypted video is ensured; by optimizing the training of the decryption model, the error can be effectively reduced, and the similarity between the decrypted video data and the original video data can be further improved; the scheme of the present invention can fully encrypt the user video data, and the video content can only be restored through a specific decryption model, thereby protecting the user's privacy and preventing the leakage of sensitive information. Through the authorization management of the decryption model, it is ensured that only authorized users can access and decrypt the video data, and refined permission control is realized; the present invention utilizes the characteristics of the generative adversarial network to realize efficient video encryption and decryption processing, and can ensure security without significantly increasing the calculation and storage burden of the system, and the present invention can be seamlessly integrated with the existing video processing system, and through appropriate interface and module design, it is convenient to promote and use in various application scenarios.

[0094] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A video encryption method based on artificial intelligence, It is characterized in that The following steps are involved: Step 1: Preprocessing video data: obtaining the video data to be encrypted, and performing frame processing on the video data to obtain several frames of video images; Performing image processing operations on each frame of video image, including but not limited to grayscale and denoising, to obtain pre-processed image data; Step 2, feature extraction: Use convolutional neural network to extract features from the preprocessed image data to obtain feature vectors for each frame of image; splice the feature vectors of each frame of image to form a complete video feature sequence; Step 3: Encryption model training: Build an encryption model based on a generative adversarial network, including a generator and a discriminator. Through adversarial training, optimize the generator and the discriminator so that the generator can generate realistic encrypted feature vectors and the discriminator can distinguish between encrypted feature vectors and original feature vectors. Step 4, video encryption: input the video feature sequence into the trained generator to generate the corresponding encrypted feature sequence; use the encrypted feature sequence to encrypt the original video data to obtain the encrypted video data; Step 5, video decryption: input the encrypted video data into the decryption model to restore the original video feature sequence; According to the recovered feature sequence, the original video data is reconstructed to complete the decryption operation.

2. The video encryption method based on artificial intelligence according to claim 1, Features: The specific steps of obtaining the video data to be encrypted in step 1 and performing frame processing on the video data to obtain several frames of video images are as follows: Step 11, video data acquisition: obtain the video file to be encrypted through a camera device, network download, or reading from local storage, and ensure that the format and encoding method of the video file are suitable for subsequent processing; Step 12: Video data loading: Use the video processing library, specifically OpenCV, to load the video file to ensure that the video can be successfully read and subsequently processed; Step 13, frame processing: Initialize a frame counter to record and control the reading and processing of each frame, loop through each frame of the video loaded in step 12 until the end of the video, store each frame in memory, or save as an image file for subsequent processing; Step 14, frame image storage: store the extracted frame images into a specified directory or data structure to ensure that each frame has a unique identifier; Step 15, frame data verification: verify the integrity and quality of the extracted frame images to ensure that no frame loss or damage occurs; randomly select several frames to display or save, and manually check the image quality.

3. The video encryption method based on artificial intelligence according to claim 1, Features: The specific steps of feature extraction in step 2 are as follows: Step 21, prepare image data: adjust the preprocessed frame image to the input size required by the CNN model, and normalize the image data to adapt it to the input requirements of the model; Step 22, feature extraction: Use the pre-trained CNN model to forward propagate each frame of the image and extract the feature vector. The feature vector is regarded as a point in a high-dimensional space, representing the high-level features of the image. Specifically, for a given input image I i , whose eigenvector F i Extracted through CNN model M, the formula is as follows: [F i= M(I i )], where I i represents the i-th frame image, M represents the CNN model, F i represents the extracted feature vector; Step 23, feature vector flattening: The extracted feature vector is a high-dimensional tensor, specifically: For the feature vector F i The flattening operation is denoted as flattlen(F i ), the formula is as follows: [fi = flattlen (F i )], where f i represents the flattened eigenvector; Step 24: Feature vector concatenation: Concatenate the feature vectors of all frames in chronological order into a complete video feature sequence. Specifically, given a series of feature vectors F 1 , F 2 ,...,F n , the splicing operation is recorded as: [\text{VideoFeatureSequence}=[flatten(F 1 ), flatten(F 2 ), ..., flatten(F n ))]], where n represents the number of video frames, and \text{VideoFeatureSequence} represents the complete video feature sequence; Step 25, feature sequence normalization: Normalize the concatenated feature sequence to ensure the uniform scale of the data for subsequent encryption operations. Normalization uses a standardized method to convert the data into a distribution with zero mean and unit variance.

4. The video encryption method based on artificial intelligence according to claim 1, Features: The specific steps of the encryption model training in step 3 are as follows: Step 31, generator model: The goal of the generator is to accept an input feature vector and generate an encrypted feature vector similar to the original feature vector. Specifically, given an input feature vector \mathbf{z}, the generator G generates an encrypted feature vector \mathbf{G(z)}, as follows: [\mathbf{G(z)}=G(\mathbf{z})], where \mathbf{z} is a random noise vector; Step 32, discriminator model: The goal of the discriminator is to distinguish the real original feature vector from the encrypted feature vector generated by the generator. Specifically, given an input feature vector mathbf{x}, the discriminator D outputs the probability D(\mathbf{x}) that it is a real feature vector, as follows: [D(\mathbf{x})=\text{sigmoid}(f(\mathbf{x}))], where f(\mathbf{x}) is the output of the discriminator, and the \text{sigmoid} function maps it to the interval [0,1]; Step 33, loss function of the discriminator: The discriminator maximizes its ability to correctly classify the real feature vector and the generated encrypted feature vector. Specifically, the loss function of the discriminator \mathcal{L}D is defined as the following cross entropy loss: [\mathcal{L}D=-\mathbb{E}{\mathbf{x}~p{\text{data}}(\mathbf{x})}[\log D(\mathbf{x})]-\mathbb{E}{\mathbf{z}~p{mathbf(z)}(\mathbf{z})}[\log(1-D(G(\mathbf{z})))]], where p{\text{data}}(\mathbf{x}) is the distribution of the real feature vector, and p{mathbf(z)}(\mathbf(z}) is the distribution of the noise vector; Step 34, loss function of the generator: The generator maximizes the probability that the discriminator judges that the encrypted feature vector it generates is a true feature vector. The loss function of the generator \mathcal{L}G is defined as the following cross entropy loss: [\mathcal{L}G=-\mathbb{E}{\mathbf{z}~p{\mathbf{z}}(\mathbf(z))}[\log D(G(\mathbf{z}))]], where the goal of the generator is to make D(G(\mathbf{z}) close to 1, that is, the feature vector generated by the discriminator is from the true distribution. Step 35: By alternately optimizing the generator and the discriminator, the generator generates a realistic encrypted feature vector, and the discriminator effectively distinguishes the encrypted feature vector from the original feature vector. The specific steps are as follows: a. Sample a batch of real feature vectors \mathbf{x} from the real feature vector distribution p{\text{data}}(\mathbf{x}); b. Sample a batch of noise vectors mathbf{z} from the noise distribution p{mathbf(z)}(\mathbf{z}); c. Use the generator to generate a batch of encrypted feature vectors \mathbf{G(z)}; d. Calculate the loss of the discriminator \mathcal{L}D and update the parameters of the discriminator to minimize the loss; e. Calculate the generator’s loss \mathcal{L}G and update the generator’s parameters to minimize the loss.

5. The video encryption method based on artificial intelligence according to claim 1, Features: The specific steps of video encryption in step 4 are as follows: Step 41, prepare the video feature sequence: the video feature sequence obtained from step 3 \mathbf{X}=\mathbf{x} 1 ,\mathbf{x} 2 , ..., \mathbf{x} n , where each \mathbf{x} i is the flattened eigenvector; Step 42: Input to the trained generator: Each feature vector of the video feature sequence \mathbf{x} i Input into the trained generator G to generate the corresponding encrypted feature vector \mathbf{y} i , where \mathbf{y} i =G(\mathbf{x) i ); Step 43, generate encrypted feature sequence: concatenate all generated encrypted feature vectors into an encrypted feature sequence \mathbf{Y}=\mathbf{y} 1 , \mathbf{y} 2 , ..., \mathbf{y} n , that is\mathbf{Y}=G(\mathbf{X}=[G(\mathbf{x} 1 ), G(\mathbf{x} 2 ),...G(\mathbf{x} n ]), where \mathbf{Y} represents the complete encrypted feature sequence; Step 44, design encryption operation: define encryption operation, use encryption feature sequence \mathbf{Y} to adjust the pixel value of the original video frame to achieve encryption effect; Step 45, encrypt video frame: for each frame of video \mathb{I}i, combine the corresponding encrypted feature vector \mathbf{y} i To encrypt, specifically, assuming that the pixel value of each frame is \mathb{I}i, the encryption operation can be defined as: in is the encrypted image, α is the adjustment factor that controls the encryption strength, and the \mathbf{reshape} operation adjusts the encrypted feature vector to a shape consistent with the image size; Step 46: Generate encrypted video: All encrypted frames Reassemble into a complete video.

6. The video encryption method based on artificial intelligence according to claim 1, Features: The specific steps of video decryption in step 5 are as follows: Step 51, prepare encrypted video feature sequence: extract encrypted feature sequence from encrypted video data \mathbf{Y}=\mathbf{y} 1 , \mathbf{y} 2 , ..., \mathbf{y} n , where each \mathbf{y} i is the encrypted feature vector; Step 52: Input to the decryption model: Each encrypted feature vector of the encrypted feature sequence \mathbf{y} i Input into the preset trained decryptor D to restore the corresponding original feature vector The specific formula is: Step 53: Generate a restored feature sequence: concatenate all restored feature vectors into a restored feature sequence The specific formula is: in represents the restored original video feature sequence; Step 54: Design decryption operation: Use the recovered feature sequence To reconstruct the original video frame, the feature vector is converted back to an image by inverse operation or using a decoding network; Step 55: For each restored feature vector Generate the corresponding original video frame through the decoding network E The specific formula is as follows: Step 56: All reconstructed frames Reassembled into a complete video, specifically:

Citation Information

Cited By

  • Video stream encryption and decryption method and system based on artificial intelligence

    CN120915980A

  • An artificial intelligence-based video stream encryption and decryption method and system

    CN120915980B