Image positioning encryption method for protecting license plate privacy
By improving the YOLOV8 model and combined attention mechanism module, the detection accuracy and stability of the model under certain circumstances are solved, and the security of image information is protected by novel image plus algorithm to protect the security of the image information. Image transmission.
Patent Information
- Application Number
- CN202411312458.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-24
AI Technical Summary
The existing YOLOv8 model lacks accuracy and stability in object detection under specific circumstances. At the same time, information leakage and loss of images are prone to information leakage during transmission, resulting in the inability to transmit image information safely and completely.
The improved YOLOV8 model is adopted, combined with the attention mechanism module of the channel and sensitive position, and the efficient multi -scale attention mechanism module to enhance the accuracy and stability of the target detection. At the same time, a novel image encryption algorithm is proposed to use cross -coupling mapping grid chaos system, rabbit competition algorithm and nuclear diffusion algorithm to encrypt and decrypt the images.
Improve the accuracy and stability of the target detection, and effectively protect the confidentiality and integrity of the image information through the encryption algorithm to ensure the security of the information during the transmission process.
Smart Images

Figure CN119359515A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of information processing and data encryption, and in particular relates to an image positioning encryption method for protecting the privacy of license plates. Background Art
[0002] With the rapid development of green smart cities, urban intelligence has also brought many challenges. In particular, the risk of vehicle privacy information leakage in cities is increasing. To meet this challenge, our idea is to collect vehicle information on the road through roadside cameras and use the YOLOv8 model for real-time detection to capture sensitive information in the image. However, the existing YOLOv8 model lacks accuracy and stability in detecting certain objects in certain situations. In addition, information leakage is likely to occur during the transmission of the detected image, resulting in information loss. In order to meet these challenges, image encryption technology has become an important means to protect the secure transmission and storage of images. Encryption technology encrypts images so that only authorized users can decrypt and access the content, thereby effectively protecting the confidentiality and integrity of the image. In recent years, image encryption methods based on chaotic systems have gradually become the mainstream trend. Some of these methods use chaotic sequences to scramble or encrypt image pixels to achieve an efficient encryption process. These methods combine the randomness of chaotic systems and the security requirements of image encryption, bringing new development opportunities for image encryption. However, due to the differences between different chaotic systems and the defects of encryption algorithms, image information cannot be transmitted to the receiver safely and completely. Summary of the invention
[0003] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a new image encryption algorithm based on improved YOLOv8 model target detection.
[0004] The technical solution of the present invention is as follows:
[0005] An image positioning encryption method for protecting license plate privacy, the method comprising:
[0006] S1 obtains a pre-encrypted image;
[0007] S2 uses an improved YOLOv8 model to identify the pre-encrypted image to generate a key, where the key is used to generate a cross-coupled mapping lattice chaotic system;
[0008] S3 iterates the cross-coupling mapping lattice chaotic system to generate a chaotic sequence, and uses the chaotic sequence to generate encryption rules for image encryption;
[0009] S4 performs a rabbit race scrambling algorithm on the pre-encrypted image based on the chaotic sequence to obtain a scrambled image;
[0010] S5 generates a cyclic group and a diffusion core based on the chaotic sequence;
[0011] S6 performs a diffusion operation on the scrambled image based on the diffusion kernel to obtain an encrypted image;
[0012] S7 performs image decryption according to the inverse process of image encryption, and finally obtains the decrypted image.
[0013] Furthermore, the improved YOLOv8 model is specifically:
[0014] In the original YOLOv8 model, an attention mechanism module based on channel and sensitive position context aggregation and an efficient multi-scale attention mechanism module are introduced and added to the early feature extraction stage and feature aggregation part of the model respectively to enhance its feature extraction and aggregation capabilities.
[0015] Furthermore, the S2 is specifically:
[0016] S21: Input the pre-encrypted image into SHA-512 to generate a 512-bit value as the master key;
[0017] S22: Divide the 512-bit master key into 16 subkeys, each subkey has a size of 32 bits;
[0018] S23: Generate a cross-coupled mapping lattice chaotic system according to the divided 16 sub-keys.
[0019] Furthermore, the S3 is specifically:
[0020] S31 iterates the chaotic system multiple times, removes the first several results, and retains the remaining results, where the number of iterations is obtained by the length and width of the pre-encrypted image;
[0021] S32 selects a specific number of values of different grids as chaotic sequences A, B, and C.
[0022] The three chaotic sequences S33 are used to perform scrambling and diffusion operations on the pre-encrypted image respectively, among which sequence A is used to scramble the plaintext image, and sequence B and C are used to perform nuclear diffusion operations on the scrambled pre-encrypted image.
[0023] Furthermore, the S4 is specifically:
[0024] S41 Assume that the matrix P is a pre-encrypted image with a size of M×N. The carrots come from the chaotic sequence A. Each rabbit extracts three values corresponding to three carrots from the chaotic sequence A. The Euclidean distance from the rabbit to the carrot is calculated. The nearest carrot is determined and swapped. The distance is recorded. This process is repeated until all carrots are found. The distance is accumulated to obtain the total distance traveled by the rabbit.
[0025] After all the rabbits in S42 are completed, they are sorted from small to large according to the total distance, and the overall pixels are rearranged according to the ranking index to generate a scrambled image.
[0026] Furthermore, the S5 is specifically:
[0027] Take an element from chaotic sequence B. If it is not a prime number, find the closest prime number and construct a cyclic group. Limit each element to the range of 0-255. Stop when the group contains 49 elements. Add the elements in chaotic sequence B and take the modulus to get the diffusion kernel.
[0028] Furthermore, the S6 is specifically:
[0029] A chaotic sequence C with a value of 1 or 2 is introduced to control the operation applied to the scan area. When the value is 1, an addition modulo operation is performed, and when the value is 2, an XOR operation is performed to achieve a diffusion effect of pixel values and obtain an encrypted image.
[0030] Furthermore, the formula for performing the addition modulo operation is:
[0031]
[0032] Where img(i) represents the i-th pixel value in the image, the mod function performs a modulus operation, and kernel(i) represents the i-th value in the diffusion kernel;
[0033] The XOR operation is specifically performed as follows:
[0034]
[0035] Among them, the bitxor function performs a bit-by-bit XOR operation.
[0036] Further, the S7 is specifically:
[0037] S71: Generate 16 subkeys from the master key, input them into the chaotic system, and iterate the same number of times as encryption to obtain chaotic sequences A, B and C;
[0038] S72: Generate a cyclic group according to the chaotic sequence B and combine it into a diffusion kernel, and then use the sequence C to perform an inverse diffusion operation to obtain a scrambled result of the rabbit race algorithm;
[0039] S73 performs the inverse bunny race algorithm using sequence A to restore the original image.
[0040] Compared with the prior art, the present invention has the following advantages:
[0041] (1) This paper introduces the YOLOv8 model and makes corresponding improvements to it to improve the accuracy and stability of target detection.
[0042] (2) This paper proposes a novel image scrambling algorithm, the Rabbit Race Algorithm, which effectively scrambles pixel values to enhance encryption. It also introduces a new diffusion algorithm, the Kernel Diffusion Algorithm, which combines the cyclic group to generate the diffusion kernel and uses two different operation methods to diffuse the pixel values in the image, greatly improving the security of information transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings generally illustrate various embodiments by way of example and not limitation, and together with the description and claims, serve to illustrate the embodiments of the invention. Where appropriate, the same reference numerals are used throughout the drawings to refer to the same or similar parts. Such embodiments are illustrative and are not intended to be exhaustive or exclusive embodiments of the present apparatus or method.
[0044] Figure 1 It is a flow chart of the present invention;
[0045] Figure 2 Schematic diagram of the improved YOLOv8 model of the present invention;
[0046] Figure 3 Schematic diagram of the rabbit competition scrambling algorithm of the present invention;
[0047] Figure 4 Generate a schematic diagram of a cyclic group algorithm for the present invention;
[0048] Figure 5 It is a schematic diagram of the diffusion kernel diffusion algorithm of the present invention;
[0049] Figure 6 A schematic diagram of a license plate recognized by the improved YOLOv8 in the present invention;
[0050] Figure 7 This is an image in which the recognized license plate portion is encrypted in the present invention. DETAILED DESCRIPTION
[0051] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0052] The embodiment of the present invention provides an image positioning encryption method for protecting the privacy of a license plate, comprising:
[0053] Constructing an improved YOLOv8 model
[0054] In the original YOLOv8 model, the attention mechanism module based on channel and sensitive position context aggregation and the efficient multi-scale attention mechanism module are introduced to enhance its feature extraction and aggregation capabilities. Specifically, the attention mechanism module based on channel and sensitive position context aggregation is added to the feature extraction stage of the model in the early stage; the efficient multi-scale attention mechanism module is added to the feature aggregation part. This improvement can effectively improve the accuracy and stability of target detection.
[0055] Specifically, the improved network structure is as follows:
[0056] In the backbone part, based on the traditional YOLOv8 network structure, an attention mechanism module based on channel and sensitive position context aggregation is introduced. This module is added to the key position of each feature extraction layer, aiming to enhance the expression of features through the channel attention mechanism, especially in capturing deep semantic information. Using this module multiple times can ensure that features at different levels are strengthened, thereby improving the recognition ability of the model.
[0057] In the neck part, an efficient multi-scale attention mechanism module is used to replace the traditional feature fusion operation. This module improves the efficiency of feature fusion through a multi-head attention mechanism, ensuring that features of different scales can be effectively combined and fully expressed on the feature map. This improvement helps retain more key information, especially when processing images with complex backgrounds or occlusions.
[0058] The head part is still the traditional YOLO detection head, which is used to predict multi-scale features. The head part can receive higher quality feature input, thereby improving the detection accuracy.
[0059] The improvement of the model can achieve the following advantages:
[0060] 1. Enhance feature representation capabilities
[0061] The attention mechanism module based on channel and sensitive position context aggregation strengthens the important information in the feature map through the channel attention mechanism, so that the model can better separate and identify key information when facing complex backgrounds or small targets.
[0062] 2. Improve feature fusion efficiency
[0063] The introduction of the efficient multi-scale attention mechanism module enhances the effectiveness of feature fusion. Compared with the traditional feature concatenation operation, the efficient multi-scale attention mechanism module can better handle multi-scale features and ensure that information at different levels is fully expressed.
[0064] 3. Improve detection accuracy
[0065] Thanks to the introduction of these attention mechanisms, the improved YOLOv8 model can more accurately locate and identify target objects when dealing with challenging detection tasks, especially performing well in the detection of small and medium-sized objects.
[0066] Generation of keys and chaotic sequences
[0067] Step 1: Input the pre-encrypted image into SHA-512 to generate a 512-bit value as the master key;
[0068] Step 2: Divide the 512-bit master key into 16 subkeys, each of which is 32 bits long and is denoted as key1, key2, …, key 16 ;
[0069] Step 3: Generate the initial value and parameters of the chaotic system according to the divided 16 sub-keys;
[0070]
[0071] Step 4: Substitute the parameters and initial values obtained from formula (1) into the chaotic system. Wherein, μ and ε represent two parameters of the chaotic system. The μ parameter is in a chaotic state between [3.58, 4], so we use the first of the 16 subkeys to generate the parameter; similarly, we use the second of the 16 subkeys to generate the parameter ε. Finally, L i (0) represents the initial value of the ith grid. We use the remaining subkeys to generate the initial values of 14 grids. Substitute the above generated values into the chaotic system and iterate the chaotic system M×N+1000 times, remove the first 1000 times, and keep the remaining results, where M and N are the length and width of the original plaintext image respectively.
[0072] Step 5: Select the last M×N values of the first grid as chaotic sequence A; take the last 49 values of the second grid as the second chaotic sequence B; take the last (M-5)×(N-5) values of the third grid as chaotic sequence C.
[0073] Step 6: The three chaotic sequences generated in step 5 are used to perform scrambling and diffusion operations on the original plaintext image respectively. Sequence A is used to scramble the plaintext image; sequence B and sequence C are used to perform nuclear diffusion operations on the scrambled plaintext image.
[0074] Image encryption
[0075] Assume that the matrix P is the original image, with a size of M×N.
[0076] Step 1: The carrots come from a chaotic sequence A, which is the same size as the original image, that is, M×N carrots, corresponding to M×N rabbits, and the values in the chaotic sequence A range from 1 to M×N. During the game, each rabbit will look for three carrots, all of which come from the chaotic sequence A, which means that the positions of the carrots cycle between 1 and M×N.
[0077] Step 2: Taking rabbit number 1 as an example, extract three values from the chaotic sequence A that correspond to the three carrots and map them to the grid. Next, calculate the Euclidean distance from the rabbit to the three carrots, as shown in formula (2), where (x1, y1) represents the index of the rabbit on the grid and (x2, y2) represents the index value of the carrot on the grid. Determine the nearest carrot, swap the positions of the rabbit and the carrot, and record the distance. Repeat this process until all carrots are found, and accumulate these distances to obtain the total distance traveled by the rabbit in the process of searching for carrots.
[0078] In this process, all four pixel values change.
[0079]
[0080] Step 3: After all the rabbits have completed step 2, they are sorted from smallest to largest according to the total distance they traveled to find carrots. The sorting result determines the ranking of the rabbits in the competition. According to these ranking indexes, the overall pixels are rearranged. Finally, the scrambled image G is generated.
[0081] The specific scrambling algorithm is as follows. Since the length and width of the plaintext image may not be equal, it is necessary to use the proposed algorithm for scrambling (as shown in Table 1);
[0082] In Table 1, assuming that the original image is P, the length and width of the image are obtained by the size function, recorded as h and w. Then, each pixel in the image is traversed, and the numel function returns the total number of all pixels in the image P. Then, the row and column indexes of the current pixel are calculated, and the ind2sub function converts the linear index i into the row and column index of the matrix, and then the point is used as the starting point. Then, the three target points are processed in a loop, recorded as three carrot positions respectively, and the values in the chaotic sequence A are accessed through modular operations. Three values are taken each time and converted into row and column indexes and stored in the points array. Then, the distance calculation function is called to calculate the Euclidean distance from the i-th index to these three values. Finally, the positions of the four pixel values are exchanged according to the calculated path order, and the total distance of each movement is recorded and stored in the total_distances array. When all i are traversed, they are sorted according to the stored distance, and then the overall pixel value order is exchanged. The sort function is used for sorting. Finally, the scrambled image is obtained.
[0083] Table 1
[0084]
[0085]
[0086] Step 4: After scrambling the image P, the scrambled image G is generated. By taking an element from the chaotic sequence B, assume that the first element of B is 145. We check if it is a prime number; if not, we find the closest prime number, which is 149. Next, we construct the cyclic group, restricting each element to the range of 0-255, and stop when the group contains 49 elements. After creating the cyclic group, we add the elements in the chaotic sequence B and take the modulus to keep the value in the range of 0-255 to obtain the final diffusion kernel sequence.
[0087] Step 5: To scan the rows and columns of the image using the constructed diffusion kernel, we start from the left edge of the image. The diffusion kernel scans the image with a step size of 1. Here, we introduce a chaotic sequence C, whose value is 1 or 2, to control the operation applied to the scanned area. Specifically, as shown in formula (3), when the value is 1, an addition modulo operation is performed. In formula (3), the img variable represents the image, img(i) represents the i-th pixel value in the image, and the mod function is the remainder operation. When i=1, the current pixel value and the diffusion kernel pixel value are added, and then modulo 256 is taken to ensure that the pixel value is in the range of 0-255. When i is not 1, that is, the current pixel value is added to the previous pixel value and the pixel value of the current diffusion kernel, and then modulo 256 is taken; as shown in formula (4), when the value is 2, an XOR operation is performed. In formula (4), the bitxor function represents the bitwise XOR operation of the pixel value, and the rest of the principles are similar to formula (3). If the pixel value being processed is not the first one, each operation involves the current pixel value, the previous pixel value, and the corresponding value in the diffusion kernel to achieve a diffusion effect of the pixel value.
[0088]
[0089] Step 6: After completing the above operations, the encrypted image D is obtained.
[0090] As attached Figure 6 As shown in the figure, the present invention selects a real vehicle image (the license plate shown in the figure has been blurred), and the encryption algorithm of the present invention can be used to obtain an encrypted image, as shown in the figure. Figure 7 It is obvious from the figure that no useful information can be obtained at all, and the image information can be well protected.
[0091] Histograms can represent the distribution of pixel values. Figure 7 The attached Figure 6 Histograms of images, where 6(a) is the histogram of the plaintext image, and 6(b) is the histogram of the corresponding ciphertext image, where the horizontal axis is the pixel value, fixed between 0 and 255, and the vertical axis is the number of pixel values. Obviously, the distribution of plaintext pixel values is extremely irregular. If an attacker knows this pattern, it is likely that he will brute force the plaintext image; but after being processed by the encryption algorithm of the present invention, it is obvious that the distribution of each pixel value is relatively uniform, indicating that the ciphertext image covers the pixel distribution pattern of the plaintext image very well.
[0092] Image Decryption
[0093] Step 1: Generate 16 subkeys from the master key, input them into the chaotic system, and iterate M×N+1000 times to obtain chaotic sequences A, B, and C.
[0094] Step 2: Generate a cyclic group based on the chaotic sequence B and combine it into a diffusion kernel. Then, use sequence C to perform the inverse diffusion operation to obtain the scrambled result of the rabbit race algorithm. The inverse diffusion operation is performed using formulas (5) and (6). The principle operation is similar to formulas (3) and (4), except that addition is changed to subtraction, and the XOR operation remains unchanged.
[0095]
[0096] Step 3: Perform the inverse bunny race algorithm using sequence A to recover the original image.
[0097] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. An image positioning encryption method for protecting license plate privacy, characterized in that: The method comprises: S1 obtains a pre-encrypted image; S2 uses an improved YOLOv8 model to identify the pre-encrypted image to generate a key, where the key is used to generate a cross-coupled mapping lattice chaotic system; S3 iterates the cross-coupling mapping lattice chaotic system to generate a chaotic sequence, and uses the chaotic sequence to generate encryption rules for image encryption; S4 performs a rabbit race scrambling algorithm on the pre-encrypted image based on the chaotic sequence to obtain a scrambled image; S5 generates a cyclic group and a diffusion core based on the chaotic sequence; S6 performs a diffusion operation on the scrambled image based on the diffusion kernel to obtain an encrypted image; S7 performs image decryption according to the inverse process of image encryption, and finally obtains the decrypted image.
2. The image positioning encryption method for protecting license plate privacy according to claim 1 is characterized in that: The improved YOLOv8 model is specifically: In the original YOLOv8 model, an attention mechanism module based on channel and sensitive position context aggregation and an efficient multi-scale attention mechanism module are introduced and added to the early feature extraction stage and feature aggregation part of the model respectively to enhance its feature extraction and aggregation capabilities.
3. The image positioning encryption method for protecting license plate privacy according to claim 1 is characterized in that: The S2 is specifically: S21: Input the pre-encrypted image into SHA-512 to generate a 512-bit value as the master key; S22: Divide the 512-bit master key into 16 subkeys, each subkey has a size of 32 bits; S23: Generate a cross-coupled mapping lattice chaotic system according to the divided 16 sub-keys.
4. The image positioning encryption method for protecting license plate privacy according to claim 1 is characterized in that: The S3 is specifically: S31 iterates the chaotic system multiple times, removes the first several results, and retains the remaining results, where the number of iterations is obtained by the length and width of the pre-encrypted image; S32 selects a specific number of values of different grids as chaotic sequences A, B, and C. The three chaotic sequences S33 are used to perform scrambling and diffusion operations on the pre-encrypted image respectively, among which sequence A is used to scramble the plaintext image, and sequence B and C are used to perform nuclear diffusion operations on the scrambled pre-encrypted image.
5. The image positioning encryption method for protecting license plate privacy according to claim 1 is characterized in that: The S4 is specifically: S41 Assume that the matrix P is a pre-encrypted image with a size of M×N. The carrots come from the chaotic sequence A. Each rabbit extracts three values corresponding to three carrots from the chaotic sequence A. The Euclidean distance from the rabbit to the carrot is calculated. The nearest carrot is determined and swapped. The distance is recorded. This process is repeated until all carrots are found. The distance is accumulated to obtain the total distance traveled by the rabbit. After all the rabbits in S42 are completed, they are sorted from small to large according to the total distance, and the overall pixels are rearranged according to the ranking index to generate a scrambled image.
6. The image positioning encryption method for protecting license plate privacy according to claim 1 is characterized in that: The S5 is specifically: Take an element from chaotic sequence B. If it is not a prime number, find the closest prime number and construct a cyclic group. Limit each element to the range of 0-255. Stop when the group contains 49 elements. Add the elements in chaotic sequence B and take the modulus to get the diffusion kernel.
7. The image positioning encryption method for protecting license plate privacy according to claim 1 is characterized in that: The S6 is specifically: A chaotic sequence C with a value of 1 or 2 is introduced to control the operation applied to the scan area. When the value is 1, an addition modulo operation is performed, and when the value is 2, an XOR operation is performed to achieve a diffusion effect of pixel values and obtain an encrypted image.
8. The image positioning encryption method for protecting license plate privacy according to claim 7 is characterized in that: The formula for performing the addition modulo operation is: Where img(i) represents the i-th pixel value in the image, the mod function performs a modulus operation, and kernel(i) represents the i-th value in the diffusion kernel; The XOR operation is specifically performed as follows: The bitxor function performs a bit-wise exclusive-or operation. The image positioning encryption method for protecting license plate privacy according to claim 1 is characterized in that: The S7 is specifically: S71: Generate 16 subkeys from the master key, input them into the chaotic system, and iterate the same number of times as encryption to obtain chaotic sequences A, B and C; S72: Generate a cyclic group according to the chaotic sequence B and combine it into a diffusion kernel, and then use the sequence C to perform an inverse diffusion operation to obtain a scrambled result of the rabbit race algorithm; S73 performs the inverse bunny race algorithm using sequence A to restore the original image.