Green orange detection method based on self-supervised comparative learning and computer device

Through self-supervised comparative learning and improvement of YOLOv11-go network model, combined with SIoU loss function, the identification problem of Qingju detection in a camouflage environment is solved, and the detection accuracy and the model's anti-camouflage ability are significantly improved.

CN119169472AActive Publication Date: 2024-12-20SICHUAN AGRI UNIV

Patent Information

Application Number
CN202411642962.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2024-12-20
Estimated Expiration
2044-11-18

AI Technical Summary

Technical Problem

The prior art is difficult to accurately detect green orange fruits in a camouflage environment, especially because the color of green orange fruits is similar to the background leaves, which increases the difficulty of identifying the model.

Method used

Using a method based on self-supervised contrast learning, the positive and negative sample pairs of green orange fruits and fruit trees are constructed through the SimCLR module, and the feature extractor is updated using the contrast loss function, combined with the YOLOv11-go network model, replace the C3K2 layer with DCCV-C3K2, and join BasicRFB The module uses SIoU loss function for iterative training to enhance the detection ability of the model in a camouflage environment.

Benefits of technology

It significantly improves the accuracy of Qingju detection and the detection ability of the model in a camouflage environment, reduces interference from overfitting and camouflage environment, and enhances the ability of feature extraction and edge contour recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119169472A_ABST
    Figure CN119169472A_ABST
Patent Text Reader

Abstract

The invention relates to the field of green orange detection, in particular to a green orange detection method based on self-supervised contrast learning and a computer device. The feature extraction capability of the model is enhanced by adopting a self-supervised comparative learning method, collected green orange fruit image data without a green orange fruit tree background and green orange fruit tree image data without a fruit background are constructed into a positive and negative sample pair, and through comparative learning of the positive and negative sample pair, redistribution of model weights can be realized, and the accuracy of the model is improved. According to the method, the detection capability of the model in the camouflage environment is enhanced, finally, a loss function, the number of iterations of the model, the batch size and the initial learning rate are set, iterative training is carried out through marked data, finally, green orange detection is carried out through the trained YOLOv11-go network model, and the green orange detection capability in the camouflage environment is greatly improved. The method is suitable for detecting the green orange fruits.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of green tangerine detection, and in particular to a green tangerine detection method and a computer device based on self-supervised contrast learning. Background Art

[0002] In recent years, the development of deep learning has enabled object detection to perform well in many scenarios.

[0003] For example, the prior art CN114998704A discloses a defect target detection method based on YOLOv5, which includes image acquisition: the user uses an image acquisition device to acquire images of the target object, and names the acquired images according to the format of the PascalVOC data set. This solution makes further improvements to the YOLOv5 algorithm to better balance feature information of different scales; for dense, mutually occluded small targets, VarifocalLoss is used to train dense targets, so that the network model can accurately identify targets with large-area clusters and overlaps. It also has good robustness to the current color changes of the object itself, complex natural environmental conditions, etc.

[0004] However, for the detection of certain targets, such as green tangerines, since the color of green tangerine fruits is similar to the background leaves, the camouflage of the fruit trees greatly increases the recognition difficulty of the model. The existing target detection algorithms cannot effectively and accurately detect green tangerine fruits. Summary of the invention

[0005] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a green mandarin detection method and a computer device based on self-supervised comparative learning, which realizes the detection of green mandarin fruits in a camouflaged environment and improves the accuracy of the detection results.

[0006] The present invention adopts the following technical solutions to achieve the above-mentioned purpose. In a first aspect, the present invention provides a green tangerine detection method based on self-supervised contrastive learning, comprising: S1, Qingju dataset collection; The image data of green tangerine fruits at different angles, different distances and different lighting backgrounds are collected as data set A, and the image data of green tangerine fruits without green tangerine fruit trees and the image data of green tangerine fruit trees without green tangerine fruit background are collected as data set B; S2, labeling data set A; S3, data processing; The labeled data is subjected to data enhancement operations such as random angle rotation, brightness adjustment, contrast enhancement, chromaticity sharpness enhancement, and noise addition. During the noise addition process, Gaussian noise and salt and pepper noise are added within the rectangular detection frame, and color noise and motion blur noise are added outside the rectangular detection frame. S4, self-supervised contrastive learning; The SimCLR module is used to construct the green tangerine fruit image data without green tangerine fruit trees in the background and the green tangerine fruit tree image data without fruit background in the dataset B into positive and negative sample pairs. Then the contrast loss function is used to update and optimize the feature extractors of the two branch networks. After optimization, the feature extraction network for the edge contour of green tangerines is used as the feature extractor. The extracted features are processed by the Dense module. The Dense module is used as the projection head of SimCLR to put the extracted features into the low-dimensional space for comparison. Finally, NT-Xent is used to complete the training and save the model weights under the guidance of InfoNCE contrast loss. The feature extraction network adopts the YOLOv11-go network model. During the downsampling process of the YOLOv11-go network model, the C3K2 layers in its backbone network and neck network are replaced with DCCV-C3K2, and the four output channels of the YOLOv11-go network model are compressed to 256. The output of the second feature layer is processed by a convolution block, and then combined with the feature map of the third feature layer processed by the C3K2 module, convolution block and upsampling. Then, a C3K2 module is passed to form the final output of the second feature layer. After the neck network outputs the features, the BasicRFB module is added. The BasicRFB module is based on the Inception mode and combines multi-convolution parallelism and void convolution technology. It contains 3 branches and a residual structure. Each branch is composed of different types of convolution blocks, and finally the features are integrated into the detection head. S5, self-supervised contrastive learning training; Part of the labeled positive and negative sample pairs are trained in the SimCLR module. After the model training is completed, the obtained model weights are loaded into the YOLOv11-go network model. The remaining positive and negative sample pairs are sent to the backbone network of the YOLOv11-go network model for feature extraction, and multiple feature layers are output. After the multiple feature layers capture target information of different scales, they are integrated through the neck network, and the feature representation is enhanced through feature fusion and upsampling operations. Next, the fused feature map generates the bounding box information of the target detection through the detection head, and finally soft-NMS is applied to remove redundant prediction boxes, and only the detection results with confidence greater than the set value are retained. Finally, the bounding box coordinates, category confidence and classification labels are output to form a complete green orange target detection result; The green orange target detection results are judged by the loss function; In the YOLOv11-go network model, the SIoU loss function is used. The SIoU loss function is composed of IoU loss, distance loss, angle loss, and shape loss. The formula is as follows: ; In the formula, is the importance coefficient of balancing the loss terms, is the prediction box and real frame The intersection ratio of Represents the loss between the center point distance of the predicted box and the true box, Used to measure the difference in aspect ratio between the predicted box and the real box. Represents the angle loss between the predicted box and the real box; S6. Set the number of iterations, batch size, and initial learning rate of the YOLOv11-go network model, perform iterative training using labeled data, and finally perform green tangerine detection using the trained YOLOv11-go network model.

[0007] Furthermore, in step S2, when annotating the collected data, all green tangerine fruit images and green tangerine tree images in the image with an occlusion rate less than 95% and more than 10 pixels exposed are annotated with a rectangular detection frame using the Labelme image annotation tool.

[0008] Furthermore, step S3 further includes: The position of the rectangular detection box after the data enhancement operation is adjusted through the Albumentations library, so that the coordinates of the rectangular detection box are enhanced and adjusted synchronously.

[0009] Furthermore, in step S4, before constructing the positive and negative sample pairs based on the collected image data of green tangerine fruits without a background of green tangerine trees and the image data of green tangerine trees without a background of fruits, the method further includes: Different data enhancements are performed on the green tangerine fruit image data and the green tangerine tree image data through Sobel filtering, cropping, shearing and color distortion.

[0010] In a second aspect, the present invention provides a computer device, including a memory, wherein the memory stores program instructions, and when the program instructions are run, the above-mentioned green tangerine detection method based on self-supervised contrast learning is executed.

[0011] The beneficial effects of the present invention are: The present invention adopts a self-supervised contrastive learning method to enhance the feature extraction ability of the model, constructs the collected green tangerine fruit image data under the background of no green tangerine fruit trees and the green tangerine fruit tree image data under the background of no fruit into positive and negative sample pairs, and performs contrastive learning on the positive and negative sample pairs to achieve the redistribution of model weights and enhance the detection ability of the model in a camouflaged environment. Finally, the loss function, the number of iterations of the model, the batch size and the initial learning rate are set, and iterative training is performed through the labeled data. Finally, the green tangerine detection is performed through the trained YOLOv11-go network model, which greatly improves the green tangerine detection ability in the camouflaged environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 It is a flow chart of a green tangerine detection method based on self-supervised contrast learning provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0013] To make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0014] The present invention provides a green orange detection method based on self-supervised contrast learning, such as Figure 1 As shown, specifically including: S1, Qingju dataset collection; The present invention collects two parts of data: collecting image data of green tangerine fruits and green tangerine trees at different angles, different distances and different lighting backgrounds as data set A, and collecting image data of green tangerine fruits without a background of green tangerine trees, and image data of green tangerine trees without a background of fruits as data set B.

[0015] Dataset A is used for detection and training of network models and needs to be labeled. Dataset B is used for self-supervised contrastive learning and does not require labeling.

[0016] S2, data annotation; For data set A, the present invention saves the original RGB color image in JPG format (640 x 640, 24bit, 300dpi). The present invention uses the Labelme image annotation tool of the Anaconda prompt platform to annotate all green oranges in the image with an occlusion rate less than 95% and more than 10 pixels exposed using rectangular detection boxes. After the annotation is completed, the annotation information is stored in a JSON file. In addition to the upper left corner coordinates (x1, y1), width (width), and height (height) information of all rectangular detection boxes, the JSON file is used for image training, verification, and testing.

[0017] S3, data processing; The present invention adopts data enhancement operations including random angle rotation, brightness adjustment, contrast enhancement, chroma sharpness enhancement and noise addition to the annotated data. In the process of adding noise, an appropriate amount of Gaussian noise and salt and pepper noise are added in the rectangular detection frame. This low-intensity noise can well protect the edge and details of the target while enhancing the target features, making the model more robust to changes in the target. We added color noise, motion blur and other high-intensity noise outside the rectangular detection frame. This noise can enrich the background well and help the model better distinguish between the target and the background, thereby enhancing the model's anti-interference ability and generalization ability. In the process of data enhancement, it is very important to ensure the accuracy and integrity of the rectangular detection frame. The present invention uses the Albumentations library to adjust the position of the detection frame after data enhancement, so that the coordinates of the rectangular detection frame can be enhanced and adjusted synchronously, which well protects the annotation information and facilitates subsequent training.

[0018] S4, self-supervised contrastive learning; The color of green mandarin oranges is similar to that of the background leaves, and the camouflage of the fruit trees greatly increases the recognition difficulty of the model. In this regard, the present invention uses SimCLR, a self-supervised comparative learning method, to enhance the feature extraction capability of the model. The SimCLR module can achieve the redistribution of model weights and enhance the detection capability of the model in a camouflaged environment by comparing the fruit in data set B with the fruit tree data.

[0019] Due to the complex background of green orange images, direct data comparison reduces the distinction between fruit and background, affects the feature learning of the encoder, and thus limits the generalization ability of the detection module. Therefore, before calculating the contrast loss, it is necessary to perform selective feature enhancement on the image. The present invention performs different data enhancements on the fruit and fruit tree image data in data set B through Sobel filtering, cropping, shearing and color distortion, so that the module can better distinguish between fruit and background.

[0020] The self-supervised module of multi-feature comparison can effectively alleviate the overfitting caused by the limited annotation of green tangerine images and reduce the interference of the camouflage environment. The SimCLR module first uses the unlabeled green tangerine images and background leaf images to construct positive and negative sample pairs, and then uses the contrast loss function to update and optimize the feature extractors of the two branch networks. After optimization, the feature extraction network for the edge contour of green tangerines is used as the feature extractor. The extracted features are processed by the Dense module. The Dense module, as the projection head of SimCLR, can put the extracted features into a low-dimensional space for comparison. Finally, NT-Xent is used under the guidance of InfoNCE contrast loss to complete the training and save the model weights.

[0021] The feature extraction network of the present invention adopts the YOLOv11-go network model, which is improved based on the YOLOv11 detection model, and improvements are made in the backbone network, the neck network and the head network, so that the network pays more attention to the contour features of the green orange. In the downsampling process of the network, the present invention replaces the C3K2 layer in the backbone network and the neck network with DCCV-C3K2. Compared with the original C3K2 layer, the DCCV layer performs Gaussian convolution and Canny edge detection on the image, and can well extract the edge features of the target while smoothing and reducing noise.

[0022] In order to reduce the amount of parameters brought by the newly added detection layer, the present invention compresses the four output channels of the network model to 256. The output of the second feature layer, that is, the P2 layer, is processed by a convolution block, and then combined with the third feature layer, that is, the P3 layer feature map, which is processed by the C3K2 module, the convolution block and the upsampling, and then passes through a C3K2 module to form the second feature layer, that is, the final output of the P2 layer. In addition, after the neck network outputs the features, the present invention adds a BasicRFB module. The BasicRFB module is based on the Inception mode, combined with multi-convolution parallel and void convolution technology. It includes 3 branches and a residual structure. Each branch is composed of different types of convolution blocks, and finally the features are integrated into the detection head. Such a design can enhance the learning of deep features, make the model pay more attention to edge contours, and maintain a high feature extraction capability in a camouflage environment.

[0023] S5, self-supervised contrastive learning training; Part of the labeled positive and negative sample pairs are trained in the SimCLR module. After the model training is completed, the obtained model weights are loaded into the YOLOv11-go network model, and the remaining positive and negative sample pairs are sent to the backbone network of the YOLOv11-go network model for feature extraction, and multiple feature layers (second feature layer P2, third feature layer P3, fourth feature layer P4, fifth feature layer P5) are output. After the multiple feature layers capture target information of different scales, they are integrated through the neck network, and the feature representation is enhanced through feature fusion and upsampling operations. Next, the fused feature map generates the bounding box information of the target detection through the detection head, and finally soft-NMS is applied to remove redundant prediction boxes, and only the detection results with confidence greater than the set value are retained. Finally, the bounding box coordinates, category confidence and classification labels are output to form a complete green orange target detection result; The green orange target detection results are judged by the loss function; In the YOLOv11-go network model, the SIoU loss function is used. The SIoU loss function is composed of IoU loss, distance loss, angle loss, and shape loss. The formula is as follows: ; In the formula, is the importance coefficient of balancing the loss terms, is the prediction box and real frame The intersection ratio of Represents the loss between the center point distance of the predicted box and the true box, Used to measure the difference in aspect ratio between the predicted box and the real box. Represents the angle loss between the predicted box and the real box; SIoU combines information such as the distance of the geometric center point, aspect ratio, and rotation angle, so that the prediction box not only focuses on the loU value, but also can make more reasonable adjustments based on the geometric features of the object. Therefore, SIoU is particularly suitable for detecting objects with complex geometric shapes, and can better deal with the problems of high occlusion and complex shapes faced by Qingju detection in camouflage environments.

[0024] S6. Set the number of iterations, batch size, and initial learning rate of the YOLOv11-go network model, perform iterative training using labeled data, and finally perform green tangerine detection using the trained YOLOv11-go network model.

[0025] The above is only a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the concept described herein through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art shall not deviate from the spirit and scope of the present invention, and shall be within the scope of protection of the claims attached to the present invention.

Claims

1. A green orange detection method based on self-supervised contrastive learning, characterized in that: include: S1, Qingju dataset collection; The image data of green tangerine fruits at different angles, different distances and different lighting backgrounds are collected as data set A, and the image data of green tangerine fruits without green tangerine fruit trees and the image data of green tangerine fruit trees without green tangerine fruit background are collected as data set B; S2, labeling data set A; S3, data processing; The labeled data is subjected to data enhancement operations such as random angle rotation, brightness adjustment, contrast enhancement, chromaticity sharpness enhancement, and noise addition. During the noise addition process, Gaussian noise and salt and pepper noise are added within the rectangular detection frame, and color noise and motion blur noise are added outside the rectangular detection frame. S4, self-supervised contrastive learning; The SimCLR module is used to construct the green tangerine fruit image data without green tangerine fruit trees in the background and the green tangerine fruit tree image data without fruit background in the dataset B into positive and negative sample pairs. Then the contrast loss function is used to update and optimize the feature extractors of the two branch networks. After optimization, the feature extraction network for the edge contour of green tangerines is used as the feature extractor. The extracted features are processed by the Dense module. The Dense module is used as the projection head of SimCLR to put the extracted features into the low-dimensional space for comparison. Finally, NT-Xent is used to complete the training and save the model weights under the guidance of InfoNCE contrast loss. The feature extraction network adopts the YOLOv11-go network model. During the downsampling process of the YOLOv11-go network model, the C3K2 layers in its backbone network and neck network are replaced with DCCV-C3K2, and the four output channels of the YOLOv11-go network model are compressed to 256. The output of the second feature layer is processed by a convolution block, and then combined with the feature map of the third feature layer processed by the C3K2 module, convolution block and upsampling. Then, a C3K2 module is passed to form the final output of the second feature layer. After the neck network outputs the features, the BasicRFB module is added. The BasicRFB module is based on the Inception mode and combines multi-convolution parallelism and void convolution technology. It contains 3 branches and a residual structure. Each branch is composed of different types of convolution blocks, and finally the features are integrated into the detection head. S5, self-supervised contrastive learning training; The SimCLR module is trained through some positive and negative sample pairs. After the model training is completed, the obtained model weights are loaded into the YOLOv11-go network model, and the remaining positive and negative sample pairs are sent to the backbone network of the YOLOv11-go network model for feature extraction, and multiple feature layers are output. After the multiple feature layers capture target information of different scales, they are integrated through the neck network, and the feature representation is enhanced through feature fusion and upsampling operations. Next, the fused feature map generates the bounding box information of the target detection through the detection head, and finally soft-NMS is applied to remove redundant prediction boxes, and only the detection results with confidence greater than the set value are retained. Finally, the bounding box coordinates, category confidence and classification labels are output to form a complete green orange target detection result; The green orange target detection results are judged by the loss function; In the YOLOv11-go network model, the SIoU loss function is used. The SIoU loss function is composed of IoU loss, distance loss, angle loss, and shape loss. The formula is as follows: ; In the formula, is the importance coefficient of balancing the loss terms, is the prediction box and real frame The intersection ratio of Represents the loss between the center point distance of the predicted box and the true box, Used to measure the difference in aspect ratio between the predicted box and the real box. Represents the angle loss between the predicted box and the real box; S6. Set the number of iterations, batch size, and initial learning rate of the YOLOv11-go network model, perform iterative training using labeled data, and finally perform green tangerine detection using the trained YOLOv11-go network model.

2. The green tangerine detection method based on self-supervised contrastive learning according to claim 1 is characterized in that: In step S2, when labeling the dataset A, all green tangerine fruit images and green tangerine tree images in which the occlusion rate is less than 95% and more than 10 pixels are exposed are labeled with rectangular detection frames using the Labelme image labeling tool.

3. The green tangerine detection method based on self-supervised contrastive learning according to claim 1 is characterized in that: Step S3 also includes: The position of the rectangular detection box after the data enhancement operation is adjusted through the Albumentations library, so that the coordinates of the rectangular detection box are enhanced and adjusted synchronously.

4. The green tangerine detection method based on self-supervised contrastive learning according to claim 1 is characterized in that: In step S4, before constructing the positive and negative sample pairs based on the collected image data of green tangerine fruits without the background of green tangerine trees and the image data of green tangerine trees without the background of fruits, the method further includes: Different data enhancements are performed on the green tangerine fruit image data and the green tangerine tree image data through Sobel filtering, cropping, shearing and color distortion.

5. A computer device, comprising a memory, wherein the memory stores program instructions, characterized in that: When the program instructions are executed, the green tangerine detection method based on self-supervised contrast learning as described in any one of claims 1 to 4 is executed.

Citation Information

Patent Citations

  • Flaw target detection method based on yov5

    CN114998704A

  • Cherry maturity detection method based on improved self-supervised learning

    CN116071587A

  • Efficient teacher-student semi-supervised segmentation method and device based on epistaxis endoscope image

    CN117197472A

  • Under-forest wide-angle individual tree image segmentation method and system based on improved YOLOv8-Seg

    CN118505995A

  • Target detection method for young grape fruit bunches

    CN118710880A

Cited By

  • Textile defect detection method based on improved YOLOv11 model

    CN119904435A

  • A textile fabric defect detection method based on an improved YOLOv11 model

    CN119904435B

  • Photovoltaic panel defect category detection algorithm based on feature pyramid and cascade group attention

    CN119992213A

  • A photovoltaic panel defect category detection method based on feature pyramid and cascaded group attention

    CN119992213B

  • Unmanned aerial vehicle aerial photography small target detection method based on improved YOLOv11s algorithm

    CN120014244A