ROI Image Encryption using YOLO and Chaotic Systems

In this paper, we design a cellular automata (CA)based ROI (region of interest) image encryption system that can effectively reduce computational cost and maintain an appropriate level of security. The proposed image encryption system obtains a cryptographic image through three steps. First, a region of interest with high importance is extracted from the entire image using deep learning. We use the YOLO (You Only Look Once) algorithm to extract the ROI from a given original image. Next, the detected ROI is encrypted using the Chen system, a chaotic-based function with high security. Finally, the execution time is effectively reduced by encrypting the entire image using a hardware-friendly CA. The safety of the proposed encryption system is verified through various statistical experiment results and analyses. Keywords—Image encryption; cellular automata; YOLO algorithm; deep learning; Chen system; region of interest


I. INTRODUCTION
The development of information and communication technology has brought many changes in our society. Recently, with the emergence of new communication technologies such as the IoT (Internet of Things) and big data, various types of information are efficiently and conveniently transmitted and applied in various ways. The factory automation system improves productivity. It is possible to quickly and conveniently collect and utilize information using computers and mobile devices, and expand opportunities for social participation through SNS (social networking services). In addition, the demand for real-time data transmission has increased in applications such as medical service, the military, finance and education. And problems related to personal information protection such as personal information leakage and cyber terrorism are also frequently occurring. In particular, image security is an essential part of today's communication technology, and very important for safe transmission.
Due to the recent epidemic such as COVID-19, many changes have occurred in the daily life of our society [1]. Changes in daily life such as real-time non-face-to-face online meetings, education, telemedicine, and online collaboration have increased traffic to the network and increased demand for real-time security of multimedia. Multimedia traffic, including video, audio and image content, is very large and has a very high correlation between pixels. Unfortunately, traditional cryptographic algorithms such as DES (Data Encryption Standard), AES (Advanced Encryption Standard), IDEA (International Data Encryption Algorithm) are suitable for text data, but not for images or video in real-time applications. Many techniques have been developed to protect images [2].
Among these technologies, image encryption is the most intuitive and effective method of converting an image into an unrecognizable image. Through this method, it is possible to prevent theft and illegal reading of personal images, and to prevent leakage of personal information when sending images.
Chaos theory is a dynamic system that is very sensitive to time changes and initial conditions. Chaos theory can effectively generate a random sequence because a logical law exists even in a chaotic state that seems disorderly. The chaosbased encryption system is the most used technology for image encryption due to its many advantages such as high randomness, complexity, sensitivity to initial conditions, and system parameters. The chaos-based image encryption algorithm was introduced by Fridrich [3], and many research results have been proposed over the past 20 years [2][3][4][5][6][7][8][9][10][11][12][13][14][15][16]. The chaos-based cryptographic algorithm is processed through two steps. The first step is a diffusion process that randomly changes pixel values using a random sequence generated based on a chaotic function. At this time, in order to obtain high security and reliable encryption image, an encryption system that is very sensitive to the key must be used. Another process is the confusion process, which effectively change the position of the pixels. This step is a necessary process to protect the image against unexpected noise generation or deletion attacks in the process of transmitting the encrypted image.
X. Zhang et al. [7] designed an encryption system by introducing a bi-direction diffusion technique to compensate for the weaknesses of the image encryption method. In order to effectively perform permutations in the encryption stage, they proposed a method of wholly constructing permutations by combining small permutations. W. Zhang et al. [8] proposed a chaotic-based image cryptographic algorithm using both a chaotic cat map and a logistic map. They changed pixel planes to each other at the stage of changing the pixel position of the image. Tang et al. [9] proposed a method of an image encryption by dividing it into small blocks and encrypting the image using a chaos function. Zahmoul et al. [10] proposed an effective cryptosystem by designing a new chaos map based on the beta function frequently used in statistics and probability theory. They showed that the proposed beta chaotic function has higher sensitivity and security than other chaotic functions. Wang et al. [16] proposed the logistic-dynamic Arnold coupled logistic map lattice model. They used the proposed model as *Corresponding Author (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 12, No. 7, 2021 467 | P a g e www.ijacsa.thesai.org the key sequence generator of the image encryption system. Their proposed encryption system uses a dynamic coupling method based on a logistic map, and then applies the Arnold coupled logistic map lattice based on the Arnold map proposed in [6].
Although the cryptographic algorithm based on the chaos function has a high level of security, it is based on mathematical calculations, which increases the calculation cost.
In this paper, we design a CA-based ROI image encryption system that can effectively reduce computational cost and maintain an appropriate level of security. The proposed cryptographic system obtains a cryptographic image through three steps. First, an ROI with high importance is extracted from the entire image using deep learning. Next, the detected ROI is encrypted using a chaotic-based function with high security. Finally, the execution time is effectively reduced by encrypting the entire image using a hardware-friendly cellular automata. The safety of the proposed encryption system is verified through various statistical experiment results and analyses.

A. YOLO
YOLO (You Only Look Once) proposed by Redmon et al. [17] is a 1-stage detector suitable for real-time detection. YOLO is composed of one neural network, so it predicts the bounding box surrounding the object and the class probability of which class the object belongs to with one calculation for the entire image. YOLO has superior performance compared to the existing object detection model based on R-CNN. The advantages of YOLO are as follows: 1) Because it is a single neural network structure, the configuration is simple and fast. 2) Because it learns surrounding information and processes the entire image, the background error is small. 3) Detection accuracy is high even for new images not seen in the training stage. Although it is less accurate than the state-of-the-art object detection model. But speed and accuracy are in a tradeoff relationship. In this paper we use YOLO to extract the ROI of the original image in this paper.

B. Cellular Automata
CA is a system for analyzing dynamic systems in discrete time and finite discrete space. Cells, the basic unit for storing states of 0 and 1, are connected in a certain shape, and the states of each cell are updated simultaneously by local interaction of cells by a given state transition function [18]. CAs are classified according to the shape in which each cell is arranged. If they are arranged linearly, they are called onedimensional CAs, if they are arranged in a plane, they are called two-dimensional CAs, and CAs arranged in a cubic shape are classified as three-dimensional CAs. Cells participating in the state transition of each cell are called neighbors. The most basic form is a 1-dimensional 3-neighbor CA with a radius of 1 relative to itself, and a CA with a radius of 2 including itself is called a 1-dimensional 5-neighbor CA. CA can effectively generate a random pattern with good randomness because it is connected to its neighbors by associative logic and its shape is composed of a regular arrangement.
For this reason, CA is applied to cryptographic systems [19][20][21][22]. In CA, where the state transition rule applied to each cell of the CA is expressed by XOR logic, the state transition function can be expressed as a matrix. If the characteristic polynomial of the state transition matrix of a given CA is a primitive polynomial, the sequence generated by the CA becomes the maximum periodic sequence [23]. This CA is referred to as a one-dimensional 5-neighbor maximum length CA (FNMLCA). Eq. (1) is a state transition function of a onedimensional 5-neighbor CA.
where is the state of the ith cell at time t, and { }, { }. In this paper. we use a onedimensional symmetric FNMLCA in which in Eq. (1) are all 1. One-dimensional symmetric FNMLCA can generate high-quality random sequences than 1-D 3-neighbor 90/150 MLCA [23], and the diffusion rate is twice as fast. Fig.  1 shows the structure of an 8-cell one-dimensional symmetric FNMLCA with the state transition rule <00111010>. Each element of the state transition rule is each in (1). The characteristic polynomial for the state transition matrix in Fig. 1 is , and is primitive.

C. Chen System
Chen system is a structure applied in chaotic dynamic control, synchronization, turbulence modeling and controlled weather model [24]. One of the chaotic dynamic system models, the Chen system, has similar properties to the Lorenz system. The Chen system can generate chaotic sequences sensitive to initial values.
Since the sequence generated by the Chen system has very high randomness, the system is used in key generation of the OTP (one time password) cryptosystem and key image generation in the image encryption process. The Chen system is expressed as a system of third-order nonlinear differential equations as shown in (2).

III. PROPOSED ALGORITHM
In this section, we propose a 1-D FNMLCA-based ROI image encryption algorithm. The proposed algorithm consists of three steps. The first step is ROI detection for the original image, and the second step is the encryption of the ROI.
The encryption of the ROI consists of shuffling the pixels of the ROI image and changing the pixel values using a sequence generated by the Chen system. Finally, the third step consists of encrypting the entire image.

A. Detecting of the ROI
YOLO divides the original image into grids, and if there is an object in a grid cell, the grid cell detects the object. Assume that L bounding boxes are detected in the image [17]. The coordinates of the four vertices of the ith bounding box can be expressed as , , and , where and . The smallest rectangular area including all L boxes becomes the ROI. The four vertices , , and of the ROI are calculated as follows. Fig. 3 shows the process of detecting the ROI by detecting the bounding box using YOLO for the original image.

B. Encryption of the ROI
ROI encryption consists of shuffling pixel positions and randomly changing pixel values. First, pixel positions are shuffled using one-dimensional symmetric FNMLCA for ROI, which is the minimum area including all bounding boxes detected using YOLO. Unlike mathematical operation-based chaotic functions, one-dimensional symmetric FNMLCA is very efficient because it is easy to implement in hardware and can be implemented in hardware-friendly even when implemented in software. The one-dimensional symmetric FNMLCA having as the characteristic polynomial is synthesized by selecting the primitive polynomial of degree n corresponding to the selected n. For effective synthesis, is synthesized using the state transition function of the one-dimensional 3-neighbor MLCA corresponding to . A sequence generated using and the initial state is arranged according to the size of the ROI, and row positions of the ROI are rearranged using the arranged sequence. Reorder the column positions in the same way for the shuffled ROI image in the row positions. In the same way, the row-column pixel shuffling process is repeated k times. To increase the security level, different and initial values are selected for each round of color component and row-column shuffling of the ROI. The next step is to change the value of each pixel of the shuffled ROI image to an arbitrary value. Let the size of the ROI detected from the original image be , where and are and from (3)-(6). Using the selected initial value and Chen chaotic system, a sequence of size is generated. In order to generate an efficient chaotic sequence in which the correlation with the initial value is removed, the values generated from the first to the 2000th are discarded and the values generated from the 2001th are used. The ith value ) of the generated sequence is calculated using (7) to obtain an integer value ) between 0 and 255.
By rearranging the generated integer sequence , a color key image with the same size as the ROI is created and XORed with the shuffled ROI image.

C. Encryption of the Entire Image
After performing ROI encryption, the entire image is encrypted. Like the ROI image encryption process, the final encrypted image is obtained through a shuffling step that changes the pixel position and a diffusion step that randomly changes pixel values.
In the entire image, areas excluding the ROI are generally less important than the ROI. Therefore, in the ROI image encryption process, since encryption was first performed using a function with high security strength, the entire image is encrypted with priority over performance speed rather than security strength. In the proposed system, the hardwarefriendly one-dimensional symmetric FNMLCA is used to speed up the shuffling process of pixel positions. And it is used to change pixel values for the entire image in the diffusion process.
In the pixel shuffling step, the pixel shuffling process in row-column units is appropriately repeated in the same way as the shuffling process in the ROI encryption process.
To generate a key image for changing pixel values, generate a sequence using FNMLCA and initial values that are appropriately large as much as the entire image size, and adjust the values to fit the range of image pixel values. For example, www.ijacsa.thesai.org if the color value of one pixel has values ranging from 0 to 255 for each R, G, and B, the value generated through the state transition of one-dimensional symmetric FNMLCA is processed as mod 256 and XORed with the pixel value. Repeat for the R, G, and B color planes.

D. Proposed FNMLCA-based ROI encryption Algorithm
The FNMLCA-based ROI encryption algorithm proposed in this paper is performed through the following five steps. Among the main algorithms below, FNMLCA is used for the pixel shuffling step and the pixel value change step of the entire image. Algorithm 1 is a sequence generation function using FNMLCA, and Algorithm 2 is a pixel shuffling function using a sequence generated from FNMLCA. Algorithm 3 is the proposed main encryption algorithm. Algorithm 4 is a decoding algorithm. After performing ROI encryption, the entire image is encrypted. Like the ROI image encryption Fig. 4 shows the block diagram of the proposed ROI image encryption system in this paper. Table I shows the proposed ROI image encryption algorithm.
In order to perform the ROI decryption algorithm, the sender needs to transmit the coordinates of the ROI together with the key to the receiver. And the ROI decoding algorithm performs the following processes:

IV. EXPERIMENT RESULTS AND SECURITY ANALYSIS
In this section, the results of statistical analysis are presented. Photographs of people in various forms were used as original images for simulation. Fig. 5 shows some of the original image samples of various sizes used in the experiment. For each original image, the serial number is subsequently referenced in the data representing the experimental results. The number in (•) next to each image number is the width height of the image.

A. Histogram Analysis
In order to defend against statistical attacks, the encryption technique must uniformly spread the pixel values of a given image. Fig. 6 is an image encrypted by the proposed algorithm for each original image in Fig. 5. According to Fig. 6, the encrypted image cannot recognize the original image with the naked eye. Fig. 7 shows the histograms for the original image in Fig. 5 and the encrypted image in Fig. 6. Comparing the histograms for each original image and the encrypted image in Fig. 7, it can be seen that the histogram of the original image has a non-uniform color distribution that reflects the feature of the image. On the other hand, the histogram of the encrypted image shows all pixel values uniformly. www.ijacsa.thesai.org   Therefore, it can be seen that the statistical characteristics of the original image are removed in the encrypted image through the histogram result.

B. Correlation Analysis
The image has a characteristic that the values of adjacent pixels are almost the same. Since a statistical attack can also use this characteristic, the encryption technique must ensure that the values of adjacent pixels vary. The correlation coefficient is used as a measure of the degree of relation between adjacent pixels in image encryption. The degree of correlation is between -1 and +1, and the closer to ±1, the higher the correlation, and the closer to 0, the lower the correlation.
The correlation coefficient is calculated using (8) to show that the correlation between adjacent pixels has disappeared with respect to the image encrypted by the proposed method.
̅ ∑ ⁄ , X and Y are the values of two adjacent pixels in (8). Table II shows the correlation coefficients of pixels adjacent to each other in the horizontal, vertical, and diagonal directions of the original image and the encrypted image. The correlation coefficient was calculated from 2500 samples randomly extracted from the image, and a more accurate correlation coefficient was calculated by calculating the average of the results of 300 repetitions. Also, correlation analysis can be expressed using a scatter plot. In Fig. 8, the scatter plots of pixels adjacent to each other in the horizontal, vertical and diagonal directions for the original image (image 1) in Fig. 5 and the encrypted image for the original image are shown. It can be confirmed that the scatter of the original image has a high positive correlation, and it can be confirmed that the scatter of the encrypted image has a very low correlation. From the results of Table II and Fig. 8, it can be seen that the strong correlation between pixels of the original image has disappeared in the encrypted image by the proposed algorithm. Table III is a comparison of the correlation coefficients of images encrypted by the proposed method and other methods.

C. Entropy Analysis
The uncertainty of the information should be increased by the encryption technology. In information theory, entropy is used as a measure of information uncertainty. Information entropy means the minimum average bit required to represent a given data. Entropy can be obtained from the distribution of pixel values of a given image. Calculate entropy using (9).
, where is a probability distribution of a pixel value . In a general 8(=n) bit format image, the maximum value of entropy is 8, and the maximum entropy means that the given information is uncertain. Table IV shows the entropies of the given original and encrypted images in Fig. 5 and Fig. 6. The encrypted images by the proposed encryption method have the entropies very close to 8. And Table V shows the comparison of entropy of images encrypted by the proposed algorithm and other methods.

D. Difference Analysis
A differential attack is achieved through a selective plaintext attack. This is a way for malicious users to find vulnerabilities in cryptographic systems by using encryption and decryption using different keys.
To be safe from this differential attack, the cryptographic system must be sensitive to even small changes in keys. PSNR, NPCR, and UACI are representative measures to analyze the sensitivity of cryptographic systems. The peak signal-to-noise ratio (PSNR) is the ratio between the original image and the encrypted image. The higher the PSNR, the smaller the difference between the two images. PSNR is calculated by (10). (10) where the mean square error (MSE) is the mean squared difference between the original input image and the encrypted image. It is calculated in pixels by squaring the difference of all pixels and dividing by the total number of pixels. MSE is calculated by (11).
where and are the width and height of the given image, and and are the pixel values of the cryptographic image encrypted with another key.
Other metrics used to evaluate the cryptographic strength of image encryption algorithms with respect to differential attacks are NPCR and UACI. NPCR is a measure of the absolute pixel change rate between two images, and UACI is the average color intensity difference between the two images. For two cryptographic images and generated by different keys with only a 1-bit change, NPCR and UACI are calculated by (12) and (13).
where is 0 for and 1 for . Also, and are the pixel values for each position of , , and and are the width and the height of and . Table VI shows the difference analysis results for the two images encrypted by the proposed method using different keys for the original images in Fig. 5. Here, the two keys used to encrypt each original image differ only by one bit. The results in Table VI are within the reference value range [32]. Therefore, the proposed image encryption system can sufficiently withstand differential attacks. Table VII shows the comparison of NPCR and UACI of images encrypted by the proposed method and several methods.

E. Robustness Analysis against Data Corruption and Deletion Attacks
Malicious attackers attempt several illegal activities when images are transmitted. In this process, abnormal noise data may be inserted and the image may be damaged. Therefore, cryptographic systems must be robust against variety of data corruption and deletion attacks. Fig. 9 is the result of decrypting the encrypted image with data corruption due to various reasons by the proposed algorithm. It can be seen that the original image is decoded without serious damage when the image in which one part is intensively lost is decoded in the proposed system.  Therefore, the proposed encryption system can be said to be robust against data corruption and deletion attacks.

F. Analysis of Keyspace
In cryptosystems, the keyspace must be large enough to resist brute force attacks. The number of available keys in a cryptographic system determines the size of the keyspace. In the proposed encryption system, the initial value of the Chen system used to generate the key image in ROI image encryption is used as the key. And the cell size, transition rule, and initial vector of FNMLCAs used in the shuffling process of the ROI image and the whole image and the pixel value change process of the whole image are used as keys.
The size n of the cell of FNMLCA is sufficiently large than 8 which is the number of pixel bits of the image. At this time, the number of transition rules is for each cell, so the total number of transition rules is and the number of initial vectors is . In this FNMLCA shuffling step, different FNMLCA and different initial vectors are selected in each color plane and in the row and column shuffling step, so the number of keys in one shuffling encryption process is . Therefore, the number of keys used in the ROI image shuffling, whole image shuffling, and entire image pixel value change steps is when n=18. The initial number of Chen system used to generate a key image for changing the pixel value of the ROI image is . Therefore, the size of the keyspace is large enough to be about when the size of FNMLCA is 18. Therefore, the proposed cryptosystem can sufficiently resist brute force attacks.

G. Performance Speed Analysis
The proposed encryption system can detect ROI faster than other deep learning models by adopting the YOLO model in the ROI detection process. Most of the chaotic map-based image encryption algorithms encrypt the entire original image using the chaotic map. However, the proposed method minimizes the algebraic operation by using the chaotic map only in the process of changing the pixel value of the ROI with high importance among the original image. This effectively reduced execution time while maintaining security over key areas of the image. And by adopting the FNMLCA system for both the shuffling of the encryption system and the diffusion process for the entire image, the proposed system can be implemented in a hardware-friendly manner. The FNMLCAbased encryption system uses only logical and shift operations. In particular, in the process of changing the position of the pixel during the shuffling process, it is very effective in terms of execution speed because it relocates the pixel position by row and column units rather than by pixel unit. For this experiment, we used Python 3.8 and Intel(R) Core(Tm) i7-4770 CPU 3.40GHz on Windows 10 OS. The proposed algorithm is very fast enough to perform real-time image encryption. Table VII shows the execution time for each partial process in the process of encrypting the original images in Fig. 5 by the proposed algorithm. ROI detection time, ROI shuffling time, ROI diffusion process time, entire image shuffling time, and entire image diffusion process time are shown separately and the encryption execution time of the entire process is shown. In Table VIII, it can be seen that the ROI detection time for image 1 takes more than average time, the ROI detection time is very effective in most images, and it is very effective to perform the diffusion process using only the ROI using the Chen system.

V. CONCLUSION
In this paper, we designed a new ROI image encryption system based on FNMLCA. The proposed algorithm can encrypt quickly in terms of speed, and at the same time, it can also increase security for high-value areas. The proposed algorithm detects ROI quickly by using YOLO among deep learning models, and because only the ROI image uses a chaotic map, it is effective in speed compared to other chaoticbased encryption algorithms. In particular, the key sequence was effectively generated through the hardware-friendly FNMLCA. In the pixel shuffling process, the overall encryption speed is improved by performing shuffling in row/column units rather than pixels. In addition, to enhance security, the ROI image is shuffled twice at pixel positions and pixel values by the proposed encryption system. The security strength is strengthened because the replacement process is performed. We plan to apply it to video encryption in the future.