Image detection system and method based on agricultural privacy protection

By combining lightweight encryption based on a four-dimensional chaotic system with the YOLOv12n-SR-TTA detection model, the problems of sensitive information leakage and unstable detection accuracy in agricultural image detection systems are solved, achieving efficient and secure disease detection on resource-constrained equipment and adapting to complex environmental changes.

CN122335781APending Publication Date: 2026-07-03WEIFANG UNIV OF SCI & TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WEIFANG UNIV OF SCI & TECH
Filing Date
2026-04-08
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing agricultural image detection systems suffer from sensitive information leakage and unstable detection accuracy during transmission and storage. Especially in complex field environments, robust detection technology fails to effectively protect crop growth, yield prediction, and pest and disease information. Furthermore, traditional encryption schemes have excessive computational overhead and are difficult to deploy on resource-constrained devices.

Method used

A lightweight encryption mechanism based on a four-dimensional chaotic system is adopted. Driving parameters are generated by binding image hash values ​​with user keys. Chaotic sequences are generated iteratively and multi-level encryption operations such as row/column permutation shift, XOR diffusion, bit plane scrambling, and DNA-encoded dynamic S-box replacement are performed. Combined with the YOLOv12n-SR-TTA detection model, disease detection is performed in the cloud. An adaptive mechanism is introduced during testing to adapt to environmental changes.

Benefits of technology

It enables efficient and secure disease detection on resource-constrained devices, ensures privacy protection and detection accuracy during image transmission, adapts to disease identification in complex environments, reduces computational overhead, and maintains the integrity of image features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122335781A_ABST
    Figure CN122335781A_ABST
Patent Text Reader

Abstract

This invention belongs to the field of secure communication technology, specifically an image detection system and method based on agricultural privacy protection. The client acquires a crop image, calculates its hash value, XORs it with a user key, and then hashes it again to generate an encryption key. This key is then split into driving parameters and input into a four-dimensional chaotic system to generate a chaotic sequence. Using the chaotic sequence and driving parameters, the image is sequentially subjected to row / column permutation shifts, XOR diffusion, bit plane scrambling, and DNA-encoded dynamic S-box replacement to generate an encrypted image, which is then uploaded to the cloud. The cloud service platform decrypts and restores the image using the same user key, performs disease detection using a target detection model, and returns the detection results to the client. This invention achieves high-precision disease detection in complex field environments while ensuring the privacy and security of agricultural images, making it suitable for resource-constrained smart agriculture scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of secure communication technology, specifically an image detection system and method based on agricultural privacy protection. Background Technology

[0002] The statements in this section merely refer to the background art related to this invention and do not necessarily constitute prior art.

[0003] Modern agriculture is undergoing a shift from "experience-driven" to "data-driven." To address the shortage of agricultural technicians, an increasing number of agricultural service platforms are adopting a "front-end data collection + cloud-based diagnostics" model: farmers take pictures of plants and upload them to the cloud; cloud models analyze the images and return diagnostic results to guide farmers' operations, while the platform accumulates massive amounts of agricultural image data. While this model improves efficiency, the agricultural images it transmits and stores contain sensitive information, making them potential targets for attacks.

[0004] To address the aforementioned scenarios, existing technologies employ robust detection techniques for complex environments, using methods such as data augmentation and domain adaptation to enhance the model's generalization ability under conditions of varying lighting, occlusion, and cluttered backgrounds. Furthermore, encryption algorithms or chaotic encryption schemes are employed to ensure the confidentiality of data during transmission and storage.

[0005] However, robust detection technology focuses only on model accuracy, neglecting the protection of sensitive information contained in agricultural images, such as crop growth, yield prediction, and pest and disease spread trends. This makes the data vulnerable to eavesdropping and malicious tampering, leading to misjudgments in decision-making systems and inappropriate agricultural interventions. On the other hand, while image encryption technology can ensure data security, simply stacking encryption and detection modules introduces high computational overhead, making it difficult to deploy on resource-constrained field edge devices. Furthermore, some encryption schemes may damage image features, affecting subsequent detection accuracy. Summary of the Invention

[0006] This solution provides an image detection system and method based on agricultural privacy protection. While ensuring the security of agricultural image data, it solves the problem of unstable detection performance caused by complex field environments, and achieves the unity of privacy protection and high-precision disease detection.

[0007] The first aspect of this invention discloses an image detection system based on agricultural privacy protection, including a client and a cloud service platform; The client acquires an image of the crop to be detected, calculates the hash value of the image, performs an XOR operation with the user key, performs another hash operation, generates the final encryption key, and breaks it down into multiple sub-parameters as driving parameters of the four-dimensional chaotic system; the four-dimensional chaotic system generates the initial chaotic sequence through iteration; Using the initial chaotic sequence and driving parameters, row-level and column-level permutation and shift operations, row-by-row and column-by-column XOR diffusion operations, bit-plane level scrambling operations, and DNA-encoded dynamic S-box replacement operations are sequentially performed on crop images to generate encrypted images and upload them to the cloud service platform. The cloud service platform receives encrypted images uploaded by the client, decrypts them using the same user key as the client, obtains the original crop images, performs disease detection using a pre-trained target detection model, obtains the detection results, and returns them to the client.

[0008] Furthermore, the four-dimensional chaotic system generates an initial chaotic sequence through iteration, specifically as shown in the following iterative formula: ; in, and For control parameters, Indicates the first During the nth iteration There are several state variables; the initial values ​​are set to preset constants, and a chaotic sequence is generated iteratively. , , and This serves as the key stream that drives the subsequent encryption process.

[0009] Further, row-level and column-level permutation and shift operations are as follows: Using chaotic sequences , The driving parameters generate row permutation indices and row cyclic shift bits, and perform inter-row permutations and intra-row cyclic shifts on the image matrix; Using chaotic sequences , The driving parameters generate column permutation indexes and column cyclic shift bits, and perform inter-column permutations and intra-column cyclic shifts on the image matrix after row operations.

[0010] Furthermore, the row-by-row and column-by-column XOR diffusion operation is as follows: Using chaotic sequences The driving parameters are used to generate a row diffusion mask, and the permuted image matrix is ​​XORed row by row. Using chaotic sequences The driving parameters generate a column diffusion mask, and the XOR operation is performed column by column on the image matrix after row XOR.

[0011] Furthermore, bit-plane level scrambling operations include in-bit-plane row / column scrambling and cross-bit-plane swapping; In the bit plane, row / column scrambling is performed by generating row and column indices using chaotic sequences and driving parameters, and then performing inter-row and inter-column permutations on each bit plane. Cross-bit plane swapping using chaotic sequences The driving parameters generate the bit plane pair indexes to be swapped, and the swap operation is performed on the selected bit planes.

[0012] Furthermore, in-bit-plane row / column scrambling introduces a content-adaptive offset, which is calculated based on the sum of the image pixel values, thus binding the scrambling operation to the image content.

[0013] Furthermore, the DNA-encoded dynamic S-box substitution operation is specifically as follows: Using chaotic sequences, coding rules are selected from multiple predefined DNA coding rules. Each byte value from 0 to 255 is sequentially encoded with DNA, complemented with bases, and decoded with DNA to generate an initial S-box sequence and reshape it into an S-box matrix. Using chaotic sequences The number of rows and columns to be cyclically shifted is generated by the driving parameters, and the S-box matrix is ​​cyclically shifted by the rows and columns to obtain the final S-box matrix; The final S-box matrix is ​​mapped to each pixel in the bit-plane scrambled image matrix, and the pixel values ​​are replaced.

[0014] Furthermore, disease detection is performed using a pre-trained target detection model to obtain detection results, including the following steps: Obtain the decrypted original crop image and generate several slightly perturbated views according to the preset degradation configuration; use the statistical characteristics of the slightly perturbated views to perform batch normalization adaptive processing during testing, and update the mean and variance of the batch normalization layer online to make the model adapt to the current environmental conditions. Perform multi-view batch inference on several slightly perturbed views to obtain candidate boxes for each view; sort the candidate boxes obtained from each view in descending order of confidence, retain the top K high-confidence candidate boxes, and map their coordinates back to the original image coordinate system; Based on the intersection-union ratio threshold, candidate boxes across views are clustered, and candidate boxes belonging to the same target are formed into candidate clusters. The candidate boxes within each candidate cluster are fused by confidence weighting, and the coordinates of the fused target box and the fusion confidence are calculated to obtain the fused candidate box. An early termination mechanism is introduced to monitor the average confidence gain after each round of fusion. When the gain is lower than a preset threshold or the inference time exceeds a set value, the enhancement process is stopped. A dual-threshold decision strategy is adopted, using a lower inference threshold to ensure recall and a higher evaluation threshold to filter fused candidate boxes, thus obtaining the final detection results.

[0015] Furthermore, the object detection model also has a rollback mechanism, which restores the model to its pre-adjustment state when adaptive adjustments during testing cause a decline in model performance.

[0016] A second aspect of the present invention discloses an image detection method based on agricultural privacy protection, comprising: The client acquires images of the crops to be detected, encrypts them to obtain encrypted images, and sends them to the cloud service platform. The cloud service platform receives encrypted images, decrypts them to obtain the original crop images, performs disease detection using a pre-trained target detection model, and returns the detection results to the client.

[0017] Compared with existing technologies, one or more of the above technical solutions have the following beneficial effects: 1. A lightweight encryption mechanism based on a four-dimensional chaotic system was designed on the client side. By binding image hash values ​​with user keys to generate driving parameters, a chaotic sequence is iteratively generated. This sequence then performs multi-level encryption operations, including row / column permutation shifts, XOR diffusion, bit-plane scrambling, and DNA-encoded dynamic S-box replacement, achieving sufficient obfuscation at both the pixel and bit levels. This encryption part employs low-level fast operations such as permutation, XOR, and table lookup, avoiding the complex key distribution and computational overhead of traditional encryption algorithms, making it suitable for resource-constrained field data collection equipment. Furthermore, the encryption process is completely reversible, and the decrypted image is losslessly restored, ensuring that subsequent detection can obtain complete disease features, laying the foundation for accurate identification.

[0018] 2. The encryption and detection components are deeply integrated to form an integrated "encryption-detection" system, leveraging the synergistic advantage of 1+1>2. At the data flow level, the encryption component ensures that images remain in encrypted form throughout transmission and cloud storage, while the detection component analyzes only the decrypted, lossless images. The two are seamlessly connected and do not interfere with each other. At the lightweight level, the low-level fast computation of the encryption component and the early termination mechanism of the detection component jointly control the overall computational overhead, making the system adaptable to resource-constrained field edge devices. At the functional synergy level, the reversibility of the encryption component ensures that the detection component can acquire complete disease characteristics, while the high robustness of the detection component ensures accurate disease identification even after encrypted transmission in complex environments. Attached Figure Description

[0019] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0020] Figure 1 A schematic diagram of an image detection system architecture based on agricultural privacy protection provided for one or more embodiments of the present invention; Figure 2 A schematic diagram illustrating the privacy protection process during image detection provided in one or more embodiments of the present invention; Figure 3 A schematic diagram of the YOLOv12n-SR-TTA model provided for one or more embodiments of the present invention; Figure 4 A schematic diagram illustrating secure transmission of example images provided in one or more embodiments of the present invention; Figure 5 Histogram of an encrypted image provided in one or more embodiments of the present invention; Figure 6 Histogram of the image before encryption provided for one or more embodiments of the present invention. Detailed Implementation

[0021] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0022] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0023] In the "front-end acquisition + cloud diagnosis" model, due to the rapid spread of pests and diseases, agricultural image diagnostic results need to be returned to farmers as soon as possible to guide intervention. Meanwhile, agricultural image acquisition terminals may include various devices such as mobile phones, drones, and field cameras, with significant differences in computing power; furthermore, the complex shooting environment in agricultural scenarios leads to varied appearances of lesions, requiring cloud-based detection models to have environmental adaptability and to preserve diagnostic features such as lesion texture and color as completely as possible. Additionally, agricultural images contain commercial secrets such as yield predictions, pest and disease trends, and planting structures, necessitating privacy protection.

[0024] In the "front-end data acquisition + cloud-based diagnostics" model, cloud-based models are typically trained on standard laboratory datasets. However, the differences in lighting, angles, and backgrounds encountered during actual deployment lead to inconsistencies in the distribution of training and testing data (domain shift), resulting in a significant decrease in detection accuracy. Regarding privacy protection, if traditional encryption schemes are used, the encryption / decryption process may introduce latency or image distortion, affecting the accuracy of subsequent image detection. Conversely, if encryption is sacrificed in pursuit of detection accuracy, data security cannot be guaranteed. Simply combining these two factors causes a surge in computational overhead, exceeding the capacity of field equipment.

[0025] Therefore, this solution provides an image detection system and method based on agricultural privacy protection, and constructs an integrated "encryption-detection" system: the front end uses chaotic encryption to protect image privacy, and the back end introduces an adaptive mechanism during SR-TTA testing to dynamically adjust the model to cope with environmental changes such as lighting and occlusion, balancing security and detection robustness.

[0026] The terms used in this plan are explained as follows: SR-TTA (Test-Time Adaptive) is a technique that dynamically adjusts parameters during the model inference phase. When the distribution of test data (such as field photos) differs from that of training data (such as standard laboratory images), the model does not need to be retrained. Instead, it adaptively adjusts parameters such as batch normalization statistics through a small amount of computation during testing, improving its adaptability to complex environments such as changes in lighting and occlusion.

[0027] YOLOv12n is a lightweight target detection model, the 12th generation of the YOLO (You Only Look Once) series. The suffix "n" indicates the nano version. It is designed for resource-constrained devices (such as field edge terminals) and significantly reduces computational overhead while maintaining detection accuracy.

[0028] TT-BN (Test-Time Batch Normalization Adaptive) is a specific implementation of test-time adaptive programming. During inference, the model uses the statistical characteristics of the current test data to update the mean and variance of the batch normalization layer online, allowing the model to better adapt to the current environment, while freezing other network parameters to control computational load.

[0029] Chaotic image encryption leverages the high sensitivity of chaotic systems to initial values. It iteratively generates seemingly random but actually deterministic sequences to control the scrambling (disrupting pixel positions) and diffusion (changing pixel values) of the image, thus achieving image encryption. This scheme employs a four-dimensional chaotic system to enhance randomness.

[0030] A bit plane is a binary image composed of identical bits extracted from each pixel (8 bits) of a grayscale image. For example, the 7th bit (most significant bit) of all pixels forms one bit plane, and the 0th bit (least significant bit) forms another bit plane, for a total of 8 bit planes. This scheme enhances the encryption effect through scrambling within and across bit planes.

[0031] DNA encoding, a mathematical mapping rule borrowing the concept of biological DNA, maps a 2-bit binary number to one of four symbols: A, T, C, and G, and achieves non-linear transformation through base complementarity (AT, CG). This scheme is used to dynamically construct S-boxes, enhancing the non-linearity and attack resistance of encryption.

[0032] The S-Box (or S-box) is a core component in encryption algorithms that enables a non-linear mapping from input to output values. It receives an input value and replaces it with another output value by looking up a table, thus achieving a non-linear transformation and obfuscating the mathematical relationship between the input and output.

[0033] XOR, a binary bitwise operation, uses the sign... Specifically, the result is 0 if the two bits are the same, and 1 if they are different.

[0034] Example 1: An image detection system based on agricultural privacy protection includes: The client is configured as follows: The process involves acquiring an image of the crop to be detected, calculating the image's hash value, performing an XOR operation with the user key, and then performing another hash operation to generate the final encryption key. The final encryption key is then split into multiple sub-parameters, which serve as driving parameters for the four-dimensional chaotic system. The initial values ​​of the four-dimensional chaotic system are set, and an initial chaotic sequence is generated iteratively. Using the initial chaotic sequence and driving parameters, the crop image is sequentially subjected to row-level and column-level permutation and shift operations, row-by-row and column-by-column XOR diffusion operations, bit-plane level scrambling operations, and DNA-encoded dynamic S-box replacement operations to generate an encrypted image. Upload encrypted images to the cloud service platform; The cloud service platform is configured as follows: Receive the encrypted image uploaded by the client, and use the same user key and the same initial value as the client to generate the same final encryption key, driving parameters and initial chaotic sequence in the same way as the encryption process; Following the reverse order of the encryption process, the encrypted image is sequentially subjected to reverse S-box replacement, bit-plane reverse scrambling, reverse XOR diffusion, and reverse permutation shift operations to restore the original crop image. The restored crop images are input into a pre-trained target detection model to detect diseases and obtain the detection results. The test results are returned to the client.

[0035] like Figure 1 and Figure 4 As shown, the client in this solution can be mounted on devices such as cameras, smartphones, or drones used by farmers. Farmers take field images of plants, and the client acquires the images and encrypts them before storage and transmission. The cloud service platform (a trusted third party) receives the encrypted images, decrypts them, performs subsequent identification, and returns the identification results to the client.

[0036] The image encryption process of this scheme includes the following steps: S1, the key generation algorithm, generates an encryption key based on the input image and the user key, and breaks it down into multiple sub-parameters as driving parameters for subsequent encryption. S2, a chaotic sequence generation algorithm, generates a chaotic sequence through an iterative four-dimensional chaotic system under given initial conditions and control parameters, which serves as the main key stream driving the subsequent encryption process; S3, the scrambling and diffusion algorithm, reduces the spatial correlation of the original image by performing pixel-level row / column scrambling and row / column XOR diffusion on each color channel; S4, a bit-plane level scrambling algorithm, further reduces the residual correlation in the image after scrambling by decomposing each color channel into multiple bit planes and scrambling within and across bit planes. S5, a dynamic S-Box construction and replacement algorithm, utilizes DNA encoding, chaotic sequences, and key parameters to construct a key-related dynamic S-Box, which is then used for pixel replacement to enhance nonlinearity and anti-attack capabilities.

[0037] Combination Figure 2 This section describes the specific process of this plan.

[0038] S1, the key generation algorithm, generates an encryption key based on the input image and the user key.

[0039] The image is converted into a matrix, and its byte sequence is hashed using SHA-256 to obtain a 256-bit digest. Subsequently, on With 256-bit user key Perform a byte-by-byte XOR operation to obtain the mixed value. And then Perform a hash (SHA-256) to derive the key. . the key Divided into 8 32-bit words: ; To avoid low-level bias caused by simple modulo operation, each Linear mapping to the target interval: ; ; in, and These represent the lower and upper bounds of the target interval for each parameter, respectively. This represents the floor function. The mapped parameters will be used as indices and strength factors in subsequent encryption stages.

[0040] S2 is a chaotic sequence generation algorithm that generates chaotic sequences through an iterative four-dimensional chaotic system given initial conditions and control parameters. Its iterative update is defined as follows: ; in, and For control parameters, Indicates the first During the nth iteration There are several state variables.

[0041] The initial conditions and control parameters are set based on the following: (1) A key system for image encryption. The control parameters , and initial conditions , , , Together, they constitute the initial key space. Due to the extreme sensitivity of four-dimensional chaotic systems to initial states and parameters (i.e., the butterfly effect), even a small change in the key will cause an avalanche-like change in the generated chaotic pseudo-random sequence, thus ensuring that the encrypted image can effectively resist brute-force attacks and known-plaintext attacks.

[0042] (2) Specific values ​​and technical basis of the preferred embodiment. To ensure that this embodiment is fully disclosed and feasible, this embodiment provides a set of preferred key parameter configurations, namely, setting control parameters. , , , , and initial conditions , , , The numerical values ​​are set based on the following: Through phase diagram analysis and Lyapunov exponent calculations, the system can maintain a stable hyperchaotic state under these parameter configurations. The resulting chaotic sequence possesses excellent pseudo-random characteristics, capable of sufficiently and unpredictably perturbing the pixel positions (scrambling operation) and pixel values ​​(diffusion operation) of the image, thereby achieving an ideal image encryption effect.

[0043] Iterating over the above system can generate four chaotic sequences. , , and These serve as the main key stream that drives the subsequent encryption process.

[0044] S3, the scrambling and diffusing algorithm, reduces the spatial correlation of the original image by performing pixel-level scrambling and diffusing on each color channel. Its detailed steps are as follows: (1) Randomize rows and columns. Utilize chaotic sequences. and and in combination with parameters Generate row index and circular shift length: ; ; in, Indicates the index of the target row during the scrambling process. Used to determine the cyclic shift length of the row. and These represent the height and width of the image, respectively. Indicates the row index of the currently processed pixel, parameter The dynamic control parameters, calculated by the key generation algorithm in step S1, are closely related to the features of the plaintext image and the user-input key. The constants 1000 and 2000 represent the pre-iteration discard length. Due to the transient effects in the initial iteration phase of chaotic systems, the initial values ​​of the chaotic sequence are discarded in this embodiment to ensure that the sequence used for encryption has sufficiently developed pseudo-randomness and uniform distribution characteristics. Using different discard lengths for chaotic sequences of different dimensions can effectively destroy potential correlations between sequences, further enhancing the system's security.

[0045] Similarly, using and The target column index and downshift amount for generating column scrambling: ; ; in, This indicates the index of the target column during the scrambling process. Controls the amount of downward circular shift for this column. This indicates the column index of the currently processed pixel. and These represent the height and width of the image, respectively. The dynamic control parameters are calculated by the key generation algorithm in step S1, and the constants 1500 and 2500 are the pre-iteration discard lengths as described above.

[0046] (2) Row and column diffusion. After scrambling, row and column diffusion are performed to enhance the randomness of pixel values. First, based on... and parameters Calculate the diffusion control value: ; ; in, and Represented as the first line and number The generated diffusion control values, These are the row and column indices for the current processing, respectively, and the parameters. The parameters are the dynamic control parameters generated by step S1 as described above, with constant 1000 being the pre-iteration discard length and constant 256 being the modulus threshold of the image pixels.

[0047] Then, a bitwise XOR operation is performed on each pixel in the row and column directions: ; in, Represents the scrambled image matrix. All pixels in the row, Represents the scrambled image matrix. List all pixels, symbol This indicates a bitwise XOR operation. This means that the calculation result will be reassigned to the pixel at the corresponding position.

[0048] S4, a bit-plane level scrambling algorithm, reduces residual correlations in the image after scrambling by decomposing each color channel into multiple bit planes and scrambling within and across bit planes. Its detailed steps are as follows: (1) Row and column scrambling within the bit plane. For each bit plane, multiple rounds of row and column scrambling are performed under the guidance of the index generated by the chaotic sequence and key parameters. The row scrambling process within the bit plane is as follows: ; ; in, and For the row indexes that participate in the scrambling. Indicates the line number currently being processed. The dynamic control parameters generated by step S1 above, This represents the height of the original image; the constants 2000 and 2001 are from a chaotic sequence. Misaligned sampling offset The content-adaptive offset is calculated as follows: ; in, Indicates position Pixel value at that location, It is the sum of all pixel values ​​in the original image. These are the dynamic control parameters generated by step S1 above. Next, the column scrambling in the bit plane is as follows: ; ; in, and For the column indexes that participate in the scrambling, Indicates the line number currently being processed. Indicates the width of the original image. The dynamic control parameters are generated by step S1 above, with constants 2000 and 2001 representing the chaotic sequence. Misaligned sampling offset.

[0049] (2) Bit-plane swapping. After completing the row and column swaps within each bit-plane, cross-bit-plane swapping is further performed. The swapping rules are derived from the chaotic sequence and key parameters as follows: ; ; in, Represents an 8-bit plane. and These represent the indices of the two target bit planes participating in the cross-plane swap operation. The constant 8 in the formula is the modulo constant, and the constants 4000 and 4001 are the misalignment sampling offsets. The parameters... These are the dynamic control parameters calculated in step S1 as described above.

[0050] S5, a dynamic S-Box construction and replacement algorithm, utilizes DNA encoding, chaotic sequences, and key parameters to construct a key-related dynamic S-Box, which is then used for pixel replacement to enhance nonlinearity and attack resistance. Its detailed steps are as follows: (1) S-Box generation. First, generate all pixel values. The sequence is converted to an 8-bit binary sequence and divided into four 2-bit substrings. Then, each 2-bit substring is mapped to a key-related DNA encoding rule selected from eight predefined rules. One of the DNA bases.

[0051] The eight DNA coding mapping rules (in the order of rule index 0 to 7) are: Rule 0 (00-A, 01-T, 10-C, 11-G); Rule 1 (00-A, 01-C, 10-T, 11-G); Rule 2 (00-A, 01-G, 10-C, 11-T); Rule 3 (00-T, 01-A, 10-G, 11-C); Rule 4 (00-T, 01-C, 10-A, 11-G); Rule 5 (00-C, 01-A, 10-G, 11-T); Rule 6 (00-G, 01-A, 10-T, 11-C); and Rule 7 (00-G, 01-T, 10-C, 11-A).

[0052] The rule index is calculated as follows: Next, the base complementarity relationship is applied. , Generate a complementary sequence and then reverse-map it back to a binary sequence. Finally, reassemble the resulting mappings into a single binary sequence. The matrix is ​​used to form the initial S-Box. Then, a chaotic sequence and key parameters are used to control the cyclic shifting of the matrix rows and columns: ; No. The column shifting process is represented as follows: ; in Indicates the first The number of steps to shift the column downwards in a circular fashion. Indicates the first The number of steps for the row to be cyclically shifted to the right, parameter These are control parameters dynamically generated from the key. The constant 2000 is the misalignment sampling offset, and the constant 16 is the modulo constant. The operation can strictly limit the shift step size to within the legal size range of the matrix.

[0053] (2) Pixel Replacement. After the dynamic S-Box is generated, each pixel value is used as an index to obtain its replacement value. The replacement step is represented as follows: ; in This represents a dynamic S-Box mapping function constructed from DNA coding and chaotic sequences. This represents the pixel value after the replacement.

[0054] At this point, the encrypted image was obtained.

[0055] To address the privacy risks associated with eavesdropping and tampering during the transmission and storage of agricultural images, this solution employs a lightweight encryption mechanism based on a four-dimensional chaotic system on the client side. By binding the image hash value with the user key to generate driving parameters, a chaotic sequence is iteratively generated. This sequence then performs multi-level encryption operations, including row / column permutation shifts, XOR diffusion, bit-plane scrambling, and DNA-encoded dynamic S-box replacement, achieving sufficient obfuscation at both the pixel and bit levels. This encryption utilizes low-level, fast computations such as permutation, XOR, and table lookups, avoiding the complex key distribution and computational overhead of traditional encryption algorithms, making it suitable for resource-constrained field acquisition equipment. Furthermore, the encryption process is completely reversible, resulting in lossless image restoration after decryption, ensuring that subsequent detection can acquire complete disease characteristics and laying the foundation for accurate identification.

[0056] In this embodiment, the cloud service platform is a trusted third party (TTP). The TTP receives encrypted images, decrypts them, and uses the YOLOv12n-SR-TTA disease detection model (such as...) Figure 3 (As shown) Disease detection is performed.

[0057] Combination Figure 3 The testing process includes the following steps: Step 1: Obtain the decrypted original crop image and input it into the YOLOv12n-SR-TTA detection model; Step 2: Based on the characteristics of the current image, the model is "fine-tuned" to adapt to the environmental conditions of the current image without changing the model's core ability to identify diseases. Specifically, during testing, batch normalization adaptive (TT-BN) is performed. Several slightly perturbed views are generated for the current image. The statistical characteristics of these views are used to update the mean and variance of the batch normalization layer online, so that the model adapts to the current environmental conditions such as lighting and angle. At the same time, the remaining network parameters are frozen to control computational overhead. Step 3: For the same image, the model observes the same lesion from different angles and distances to avoid missed detections due to imperfect shooting angles; specifically, it generates several slightly perturbed views. Step 4: Identify potential disease areas in each "slightly disturbed view" and obtain the disease type and accuracy (confidence score); specifically: enter the multi-view batch inference stage, run basic detection independently for each slightly disturbed view, and obtain a set of candidate boxes. Each candidate box contains location coordinates, disease category and confidence score. Step 5: Align the detection results from different viewpoints to the original image. Since each "slightly perturbed view" has been rotated or scaled, the identified disease areas need to be converted back to the coordinates of the original image, and it is ensured that all "disease areas" can be mapped to the correct positions in the original image; specifically: for the detection results of each view, sort them in descending order of confidence and retain only the top K high-confidence candidate boxes, and map their coordinates back to the original image coordinate system; Step 6: If the candidate boxes overlap significantly, they are considered to point to the same lesion and are grouped together. Specifically, candidate boxes across views are clustered based on the intersection-over-union (IoU) threshold, and candidate boxes belonging to the same target are formed into candidate clusters. Step 7: For multiple bounding boxes pointing to the same lesion, perform a weighted average based on the confidence level of each box. Boxes with higher confidence levels have higher weights, and boxes with lower confidence levels have lower weights. The final result is a fused bounding box, which is more accurate and has a more stable confidence level than any single box. Specifically, perform confidence-weighted fusion on the candidate boxes within each candidate cluster, and calculate the coordinates and fusion confidence level of the fused bounding box. Step 8: Dynamically decide whether to continue adding new perspectives; specifically: introduce an early termination mechanism, monitor the average confidence gain after each round of fusion, and stop subsequent enhancement processing when the gain is lower than a preset threshold or the inference time exceeds a set value; Step 9: Filter reliable detection results; specifically: adopt a dual-threshold decision strategy, using a lower inference threshold. Ensure recall rate, with a high evaluation threshold. Filter the final output results, retaining only those with a confidence level greater than [value missing]. The fusion frame; Step 10: If performance degradation occurs during the adaptive process during testing, trigger the rollback mechanism to restore the model to its state before adjustment, thus preventing adaptive failure. Step 11: Output the final disease detection results, including disease type, location coordinates, and confidence level information.

[0058] The detection results are used to generate diagnostic images with disease markers, and then dynamically encrypted using the aforementioned four-dimensional chaotic mapping system before being returned. After receiving the encrypted packet, the farmer's client uses the same initial key and reverse algorithm to decrypt it, intuitively obtaining disease diagnosis information for subsequent agricultural decision-making and treatment.

[0059] The detection model in this scheme does not perform direct single-pass inference on the input image, but introduces an adaptive mechanism during SR-TTA testing in the inference stage: First, based on the preset degradation configuration, several slightly perturbed views are generated by introducing spatial geometric perturbations such as preset angle rotation and flipping, adding noise injection degradation such as adding Gaussian noise with specific variance, or applying blur degradation operations such as different size blur kernels and downsampling. Then, the model parameters are adjusted online through batch normalization adaptation (TT-BN, adaptively updating batch normalization statistics) during testing, and only the batch normalization statistics are updated while the other network parameters are frozen. ; in, and The mean and variance are estimated from the slightly perturbed view. The model then switches to evaluation mode to perform basic inference: candidate boxes are extracted from the original image at the main scale, and the confidence and number of candidate boxes are used as fusion criteria; when the number of candidates is insufficient or the confidence is low, lightweight local enhancement processing is triggered to enhance the expression of lesion features.

[0060] Then, the multi-view batch inference process begins. For each view, only the top views, sorted by confidence level, are retained. Candidate boxes: ; in, For the candidate box set, Candidate boxes Score based on confidence level The order after descending sorting. After mapping the selected candidate boxes back to the original image coordinate system, weighted fusion is performed based on the intersection-over-union (IoU); when When selecting candidate boxes, determine that they belong to the same candidate cluster (cluster set). And obtain the fusion box by weighting according to confidence level: ; in, Indicates candidate clusters The Middle The coordinate parameters of each candidate box are used. Each candidate cluster outputs a merged candidate box.

[0061] To control inference latency and computational overhead, this scheme employs an early termination mechanism based on confidence gain. Let Indicates the first The average confidence level after round fusion is defined as follows: ; when (in If the inference time exceeds the preset minimum confidence gain threshold, the process will terminate early; otherwise, lightweight enhancements will continue to complete the supplementary fusion.

[0062] In addition, this solution also includes a rollback mechanism to prevent adaptive failure and adopts a dual threshold determination strategy: inference threshold. Less than the evaluation threshold The final output satisfies: ; During the detection phase, disease detection is completed, and the detection results are encrypted and transmitted back to the farmer's client for subsequent treatment and decision-making.

[0063] To address the issue of unstable detection performance caused by changes in field lighting, occlusion, and cluttered backgrounds, this solution designs a YOLOv12n-SR-TTA detection model on a cloud service platform. This model introduces a test-time adaptive mechanism during the inference phase: online adjustment of model parameters via test-time batch normalization adaptation (TT-BN) to adapt the model to the current lighting and angle; multi-view batch inference and confidence-weighted fusion are employed to extract stable features from multiple slightly perturbed perspectives, enhancing the resistance to interference from occlusion and viewpoint changes; an early termination mechanism is introduced to dynamically control the inference computation load, ensuring both accuracy and real-time performance; a dual-threshold decision strategy balances recall and output reliability, and a rollback mechanism prevents adaptive failure.

[0064] experiment.

[0065] To verify the actual effectiveness of this solution, verification experiments were conducted in the same hardware and software environment. The security and processing efficiency of image encryption, as well as the performance of the target detection model in the face of clean images and complex perturbation scenarios such as superimposed Gaussian noise and JPEG compression, were comprehensively evaluated.

[0066] Experimental results are as follows Figures 5-6 And as shown in Tables 1-5, from Figure 5 and Figure 6 The plaintext image can be seen in the histogram. Figure 6 The RGB three-channel pixel distribution of the image shows obvious fluctuations and statistical patterns, while the encrypted image ( Figure 5 The pixel distribution becomes extremely uniform and flat, successfully masking the statistical characteristics of the original image and giving it a strong ability to resist statistical analysis attacks.

[0067] Table 1 shows the correlation coefficients of adjacent pixels in the encrypted images grouped by direction; Table 2 shows the information entropy, UACI, NPCR, and PSNR results of the six test images; Table 3 shows the efficiency comparison of the six test images; the detection performance of different YOLO variants under common perturbations was obtained through detection performance and ablation experiments, and the experimental results are shown in Table 4; under the same settings as in Table 4, an ablation experiment was conducted on SR-TTA using YOLOv12n, and the experimental results are shown in Table 5.

[0068] Table 1. Correlation coefficients (RGB) of adjacent pixels in encrypted images grouped by direction

[0069] Table 2. Analysis of Information Entropy, UACI, NPCR, and PSNR Results for Six Test Images

[0070] Table 3 Efficiency Comparison of Six Images

[0071] Table 4. Detection performance of different YOLO variants under common perturbations.

[0072] Table 4 shows the COCO style mAP@0.5:0.95 (a strict evaluation metric, calculating the average accuracy from IoU 0.5 to 0.95) and mAP@0.5 (a lenient evaluation metric, where IoU ≥ 0.5 is considered correct) under Clean and common perturbation conditions. G15 and G30 represent performance tests with Gaussian noise of 15% and 30% standard deviation added to the image, respectively. J60 and J30 represent compression of JPEG with compression quality factors Q=60 and Q=30, respectively.

[0073] Table 5. Ablation experiments of SR-TTA using YOLOv12n under the same settings as in Table 4.

[0074] As shown in Tables 1 and 2, the correlation coefficient between adjacent pixels in the encrypted image is extremely close to 0, and the information entropy stably approaches the ideal value of 8. Simultaneously, the average values ​​of the non-volatile Pixel Change Rate (NPCR) and Unified Average Change Intensity (UACI) reach the theoretical security standards of 99.61% and 33.45%, respectively, while the peak signal-to-noise ratio (PSNR) remains at an extremely low level of 7.89 dB. This fully demonstrates that the proposed scheme completely breaks down the original visual information of the image and possesses extremely high sensitivity to minute changes in plaintext, effectively resisting differential attacks. Furthermore, Table 3 shows that the average encryption time of this scheme is only 0.1105 seconds, exhibiting high processing efficiency while ensuring security. Finally, as shown in Tables 4 and 5, in terms of target detection, the YOLOv12n model combined with the SR-TTA module achieves a stable improvement in detection accuracy (mAP) under various perturbation conditions, and its overall robustness and performance are significantly better than other variant models.

[0075] Therefore, experimental verification shows that this scheme has high processing efficiency while ensuring safety, and the detection scheme has higher detection accuracy than the baseline model in a variety of complex scenarios.

[0076] Example 2: This embodiment provides an image detection method based on agricultural privacy protection, which is based on the system implementation of Embodiment 1 and includes the following steps: The client acquires images of the crops to be detected, encrypts them to obtain encrypted images, and sends them to the cloud service platform. The cloud service platform receives encrypted images, decrypts them to obtain the original crop images, performs disease detection using a pre-trained target detection model, and returns the detection results to the client.

[0077] By deeply integrating encryption and detection, an integrated "encryption-detection" system is formed, leveraging the synergistic advantage of 1+1>2. At the data flow level, the encryption component ensures that images remain in encrypted form throughout transmission and cloud storage, while the detection component analyzes only the decrypted, lossless images. The two are seamlessly connected and do not interfere with each other. At the lightweight level, the low-level fast computation of the encryption component and the early termination mechanism of the detection component jointly control the overall computational overhead, making the system adaptable to resource-constrained field edge devices. At the functional synergy level, the reversibility of the encryption component ensures that the detection component can acquire complete disease characteristics, while the high robustness of the detection component ensures accurate disease identification even after encrypted transmission in complex environments. This overcomes the limitation of existing technologies that require a choice between security and accuracy, providing a unified solution for smart agriculture scenarios that balances privacy protection and detection performance.

[0078] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An image detection system based on agricultural privacy protection, characterized in that, Including client-side and cloud service platforms; The client acquires an image of the crop to be detected, calculates the hash value of the image, performs an XOR operation with the user key, performs another hash operation, generates the final encryption key, and breaks it down into multiple sub-parameters as driving parameters of the four-dimensional chaotic system; the four-dimensional chaotic system generates the initial chaotic sequence through iteration; Using the initial chaotic sequence and driving parameters, row-level and column-level permutation and shift operations, row-by-row and column-by-column XOR diffusion operations, bit-plane level scrambling operations, and DNA-encoded dynamic S-box replacement operations are sequentially performed on crop images to generate encrypted images and upload them to the cloud service platform. The cloud service platform receives encrypted images uploaded by the client, decrypts them using the same user key as the client, obtains the original crop images, performs disease detection using a pre-trained target detection model, obtains the detection results, and returns them to the client.

2. The image detection system based on agricultural privacy protection as described in claim 1, characterized in that, The four-dimensional chaotic system generates an initial chaotic sequence through iteration, specifically as shown in the following iterative formula: ; in, and For control parameters, Indicates the first During the nth iteration There are several state variables; the initial values ​​are set to preset constants, and a chaotic sequence is generated iteratively. , , and This serves as the key stream that drives the subsequent encryption process.

3. The image detection system based on agricultural privacy protection as described in claim 1, characterized in that, Row-level and column-level permutation and shift operations are as follows: Using chaotic sequences , The driving parameters generate row permutation indices and row cyclic shift bits, and perform inter-row permutations and intra-row cyclic shifts on the image matrix; Using chaotic sequences , The driving parameters generate column permutation indexes and column cyclic shift bits, and perform inter-column permutations and intra-column cyclic shifts on the image matrix after row operations.

4. The image detection system based on agricultural privacy protection as described in claim 1, characterized in that, The row-by-row and column-by-column XOR spread operation is as follows: Using chaotic sequences The driving parameters are used to generate a row diffusion mask, and the permuted image matrix is ​​XORed row by row. Using chaotic sequences The driving parameters generate a column diffusion mask, and the XOR operation is performed column by column on the image matrix after row XOR.

5. The image detection system based on agricultural privacy protection as described in claim 1, characterized in that, Bit-plane level scrambling operations include in-bit-plane row / column scrambling and cross-bit-plane swapping; In the bit plane, row / column scrambling is performed by generating row and column indices using chaotic sequences and driving parameters, and then performing inter-row and inter-column permutations on each bit plane. Cross-bit plane swapping using chaotic sequences The driving parameters generate the bit plane pair indexes to be swapped, and the swap operation is performed on the selected bit planes.

6. The image detection system based on agricultural privacy protection as described in claim 1, characterized in that, In-bit plane row / column scrambling introduces content-adaptive offsets, which are calculated based on the sum of the image pixel values, thus binding the scrambling operation to the image content.

7. The image detection system based on agricultural privacy protection as described in claim 1, characterized in that, The DNA-encoded dynamic S-box substitution operation is as follows: Using chaotic sequences, coding rules are selected from multiple predefined DNA coding rules. Each byte value from 0 to 255 is sequentially encoded with DNA, complemented with bases, and decoded with DNA to generate an initial S-box sequence and reshape it into an S-box matrix. Using chaotic sequences The number of rows and columns to be cyclically shifted is generated by the driving parameters, and the S-box matrix is ​​cyclically shifted by the rows and columns to obtain the final S-box matrix; The final S-box matrix is ​​mapped to each pixel in the bit-plane scrambled image matrix, and the pixel values ​​are replaced.

8. The image detection system based on agricultural privacy protection as described in claim 1, characterized in that, Disease detection is performed using a pre-trained target detection model to obtain detection results, including the following steps: Obtain the decrypted original crop image and generate several slightly perturbated views according to the preset degradation configuration; use the statistical characteristics of the slightly perturbated views to perform batch normalization adaptive processing during testing, and update the mean and variance of the batch normalization layer online to make the model adapt to the current environmental conditions. Perform multi-view batch inference on several slightly perturbed views to obtain candidate boxes for each view; sort the candidate boxes obtained from each view in descending order of confidence, retain the top K high-confidence candidate boxes, and map their coordinates back to the original image coordinate system; Based on the intersection-union ratio threshold, candidate boxes across views are clustered, and candidate boxes belonging to the same target are formed into candidate clusters. The candidate boxes within each candidate cluster are fused by confidence weighting, and the coordinates of the fused target box and the fusion confidence are calculated to obtain the fused candidate box. An early termination mechanism is introduced to monitor the average confidence gain after each round of fusion. When the gain is lower than a preset threshold or the inference time exceeds a set value, the enhancement process is stopped. A dual-threshold decision strategy is adopted, using a lower inference threshold to ensure recall and a higher evaluation threshold to filter fused candidate boxes, thus obtaining the final detection results.

9. The image detection system based on agricultural privacy protection as described in claim 1, characterized in that, The object detection model also has a rollback mechanism, which restores the model to its pre-adjustment state when adaptive adjustments during testing cause a decline in model performance.

10. A method for image detection based on the system according to any one of claims 1-9, characterized in that, Includes the following steps; The client acquires images of the crops to be detected, encrypts them to obtain encrypted images, and sends them to the cloud service platform. The cloud service platform receives encrypted images, decrypts them to obtain the original crop images, performs disease detection using a pre-trained target detection model, and returns the detection results to the client.