Knowledge-guided apple fine-grained classification model self-supervised training method under channel perception
Through the knowledge-guided self-supervised training method under channel perception, the visual representation ability of the apple fine-grained classification model is improved, the problem of poor fine-grained target detection accuracy is solved, and a higher-precision fine-grained classification of apples is achieved, which is suitable for for mechanized harvesting.
Patent Information
- Application Number
- CN202310316998.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2024-10-01
AI Technical Summary
The fine-grained target detection task has poor accuracy in mechanized apple picking, mainly due to the small differences in fine-grained categories and the high cost of annotation, resulting in the inability to effectively identify subtle subordinate category differences.
A self-supervised training method for Apple's fine-grained classification model guided by knowledge under channel awareness is adopted. The teacher model and channel weights are obtained through fully supervised training. Self-supervised learning is performed based on unlabeled data sets, and the backbone network is initialized and fine-tuned to improve vision. Representation ability.
It improves the accuracy of fine-grained target detection, solves the problems of small differences in fine-grained categories and expensive labeling, and provides a higher-precision apple fine-grained classification model, which is suitable for mechanized intelligent picking.
Smart Images

Figure CN118736342A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of visual perception technology, and in particular to a knowledge-guided self-supervised training method for an apple fine-grained classification model under channel perception. Background Art
[0002] During the mechanized apple picking process, it is very common for the target to be blocked by various types of occlusions. Relying solely on a single category of fruit recognition technology can no longer meet the needs of mechanized intelligent picking. Fine-grained target detection is a further subdivision of base class target detection. Its main task is to distinguish the subordinate categories under the base class and provide a scientific basis for the robot arm to execute picking instructions. There are very subtle inter-class differences between subordinate categories. Compared with the base class target detection task, fine-grained target detection is more sophisticated, so more labeled samples are needed to accurately locate the difference area and improve the detection accuracy. However, due to the expensive labeling cost, it is greatly limited in real scenes.
[0003] Therefore, how to provide a knowledge-guided self-supervised training method for apple fine-grained classification model under channel perception to solve the problems existing in the existing technology is of great significance for its application. Summary of the invention
[0004] In view of this, the purpose of this application is to provide a knowledge-guided self-supervised training method for apple fine-grained classification model under channel perception, so as to solve the problem of poor accuracy of fine-grained object detection tasks due to factors such as small differences between fine-grained categories and expensive labeling.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] A knowledge-guided self-supervised training method for fine-grained apple classification model under channel awareness.
[0007] S1. Perform full-supervision training on the base class object detection model on the target dataset. When the evaluation index is optimal, obtain the model parameters and regard it as the teacher model.
[0008] S2. Obtain channel weights through supervised learning to focus more on feature channels with stronger discriminative capabilities;
[0009] The channel weight acquisition method uses the forward reasoning loss change method to measure the corresponding channel weight using the loss change value when these features are removed;
[0010] S3. Based on massive unlabeled data sets, combined with knowledge guidance under channel perception, self-supervised learning of the backbone network is performed, and the backbone network parameters are obtained when the loss value is minimized;
[0011] S4. Use the backbone network parameters obtained in S3 to initialize the backbone network parameters for the downstream fine-grained object detection task and perform fine-tuning training.
[0012] Preferably, the specific steps of S1 are as follows:
[0013] S11. Obtain an apple object detection dataset with the labeled class being apple;
[0014] S12. In this embodiment, select YoloV5s as the object detection model and perform iterative training in the above dataset. When the evaluation index is optimal, obtain the model parameters;
[0015] S13. Obtain the above model parameters and extract the backbone network of the YoloV5s model as the teacher model in this embodiment.
[0016] Preferably, the specific steps of S2 are as follows:
[0017] S21. Set the parameter value of the convolution kernel c i (0 < i < N, where n is the number of convolution kernels) to 0, and set the network model parameters at this time as ω * ;
[0018] S22. Traverse all the images in the dataset, set the model to the eval mode, obtain the loss value loss0 of the model parameters ω on the labeled data, obtain the loss value loss1 of the model parameters ω * on the labeled data, and calculate the difference between the two losses as the weight corresponding to the convolution kernel c i ;
[0019] S23. Traverse the convolution kernels in the target network layer, repeat S21 and S22, and obtain the initialization weight list of all convolution kernels;
[0020] S24. Perform a normalization operation on the above weight list to make its value range satisfy 0 - 1, and obtain the final channel weight W.
[0021] Preferably, the calculation formula in S24 is:
[0022]
[0023] Preferably, the specific steps of S3 are as follows:
[0024] S31. Obtain all relevant pictures of the target class without labels to form a self-supervised learning dataset;
[0025] S32. According to the YoloV5s configuration file, intercept part of the model as the backbone network;
[0026] S33. In the embodiment of the present application, the BYOL self-supervised learning method is selected to perform self-supervised training on the backbone network obtained in S32 on the data set obtained in S31, and the teacher model obtained in S1 and the channel weight w obtained in S2 are used to perform knowledge guidance under channel perception;
[0027] S34, saving the backbone model parameters in the self-supervised method when the loss value is optimal;
[0028] Preferably, the formula in S33 is as follows:
[0029]
[0030] In the above formula, loss is the loss value generated by guided training;
[0031] ω student It is the student model (the backbone network in the self-supervised method);
[0032] ω teacher Model for teachers;
[0033] x i is the i-th image;
[0034] FM j is the jth feature map;
[0035] ||·||2 is the Euclidean distance.
[0036] Preferably, the specific steps of S4 are as follows:
[0037] S41, backbone network and other parameter initialization. Use the backbone parameters learned by BYOL to initialize the Yolov5s backbone network and set the category;
[0038] S42, YoloV5s model pre-training, freeze the backbone network gradient, perform 100 epochs of model full supervision pre-training, and save the model parameters when the indicators are optimal;
[0039] S43, YoloV5s model training, the model parameters obtained in S42 are used to initialize the model parameters of this training, and fully supervised training is performed on the data set. When the indicators are optimal, the model parameters are saved.
[0040] S44, fine-grained object detection model training is completed.
[0041] Preferably, the number of categories set in S41 is eight, and the specific categories are as follows:
[0042] There is no obstruction on apple 0, apple 1 is obstructed by leaves, apple 2 is obstructed by branches, apple 3 is obstructed by apple, apple 4 is obstructed by leaves and branches, apple 5 is obstructed by leaves and apples, apple 6 is obstructed by branches, leaves and apples, apple 7 is obstructed by branches, leaves and apples.
[0043] Compared with the prior art, the present invention has the following beneficial effects:
[0044] The present invention firstly utilizes a self-supervised training method to improve the visual representation ability of the backbone network, then uses it as the initialization parameter of the downstream task backbone and performs fine-tuning training. The present invention improves the visual representation ability of the backbone network, provides an effective reference for fine-grained classification tasks, and solves the problem of poor accuracy of fine-grained target detection tasks due to factors such as small differences between fine-grained categories and expensive labeling.
[0045] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application so that it can be implemented in accordance with the contents of the specification, and to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the following is a detailed description of the preferred embodiments of the present application in conjunction with the accompanying drawings as follows.
[0046] Based on the detailed description of the specific embodiments of the present application in combination with the accompanying drawings below, those skilled in the art will become more aware of the above and other objects, advantages and features of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings without creative work. In all drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, each element or part is not necessarily drawn according to the actual scale.
[0048] Figure 1 It is the overall flow chart of the present invention;
[0049] Figure 2 It is a specific flow chart of the present invention. DETAILED DESCRIPTION
[0050] To make the purpose, technical scheme and advantages of the embodiment of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiment of the present application. Obviously, the described embodiment is a part of the embodiment of the present application, rather than all of the embodiments. In the following description, specific details such as specific configuration and components are provided only to help fully understand the embodiments of the present application. Therefore, it should be clear to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. In addition, for clarity and brevity, the description of known functions and structures is omitted in the embodiment.
[0051] In addition, the present application may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplicity and clarity, and does not in itself indicate the relationship between the various embodiments and / or settings discussed.
[0052] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, B exists alone, and A and B exist at the same time. The term " / and" in this article describes another type of association object relationship, indicating that there can be two relationships. For example, A / and B can mean: A exists alone, and A and B exist alone. In addition, the character " / " in this article generally indicates that the previous and next associated objects are in an "or" relationship.
[0053] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusions.
[0054] See also Figure 1-2 The present invention provides a knowledge-guided self-supervised training method for an apple fine-grained classification model under channel perception:
[0055] S1. Perform full supervision training on the base class object detection model on the target dataset. When the evaluation index is optimal, obtain the model parameters and regard it as the teacher model. The specific steps are as follows:
[0056] S11, obtain an apple-type object detection dataset, and label the category as apple;
[0057] S12. Select YoloV5s as the target detection model, perform iterative training in the above data set, and obtain the model parameters when the evaluation index is optimal;
[0058] S13. Obtain the above model parameters, extract the backbone network of the YoloV5s model as the teacher model;
[0059] S2. Through supervised learning, obtain channel weights to pay more attention to those feature channels with stronger discrimination ability;
[0060] The way to obtain channel weights is to measure the corresponding channel weights by using the loss change value when removing these features, by means of the change of the forward inference loss.
[0061] The specific steps of S2 are as follows:
[0062] S21. Set the parameter value of the convolution kernel c i (0 < i < N, where n is the number of convolution kernels) to 0, and set the network model parameters at this time as ω * ;
[0063] S22. Traverse all images in the dataset, put the model into the eval mode, obtain the loss value loss0 of the model parameters ω on the labeled data, obtain the loss value loss1 of the model parameters ω * on the labeled data, and calculate the difference between the two losses as the weight of the corresponding convolution kernel c i ;
[0064] S23. Traverse the convolution kernels in the target network layer, and repeat S21 and S22 to obtain the initialization weight list of all convolution kernels;
[0065] S24. Perform a normalization operation on the above weight list to make its value range satisfy 0 - 1, and obtain the final channel weight W. The calculation formula is:
[0066]
[0067] S3. On a large amount of unlabeled datasets, combined with knowledge guidance under channel perception, perform self-supervised learning on the backbone network. When the loss value is the smallest, obtain the backbone network parameters.
[0068] The specific steps of S3 are as follows:
[0069] S31. Obtain all relevant pictures of the target class without labels to form a self-supervised learning dataset;
[0070] S32. According to the YoloV5s configuration file, intercept part of the model as the backbone network;
[0071] S33. Select the BYOL self-supervised learning method to perform self-supervised training on the backbone network obtained in S32 on the dataset obtained in S31, and use the teacher model obtained in S1 and the channel weight w obtained in S2 for knowledge guidance under channel perception;
[0072] The formula in S33 is as follows:
[0073]
[0074] In the above formula, loss is the loss value generated by the guided training; ω student is the student model (the backbone network in the self-supervised method); ω teacher is the teacher model; x i is the i-th image; FM j is the jth feature map; ||·||2 is the Euclidean distance S34, and the backbone model parameters in the self-supervised method when the loss value is optimal.
[0075] S4: Use the backbone network parameters obtained in S3 to initialize the backbone network parameters of the downstream fine-grained object detection task, and perform fine-tuning training. The specific steps are as follows:
[0076] S41, backbone network and other parameter initialization. Use the backbone parameters learned by BYOL to initialize the Yolov5s backbone network and set the categories. S41 sets the number of categories to eight. The specific categories are as follows:
[0077] Unobstructed apple 0, apple obscured by leaves 1, apple obscured by branches 2, apple obscured by apple 3, apple obscured by leaves and branches 4, apple obscured by leaves and apples 5, apple obscured by branches and apples 6, apple obscured by branches, leaves and apples 7;
[0078] S42, YoloV5s model pre-training, freeze the backbone network gradient, perform 100 epochs of model full supervision pre-training, and save the model parameters when the indicators are optimal;
[0079] S43, YoloV5s model training, the model parameters obtained in S42 are used to initialize the model parameters of this training, and fully supervised training is performed on the data set. When the indicators are optimal, the model parameters are saved.
[0080] S44, fine-grained object detection model training is completed.
[0081] The above description is only the preferred embodiment of the present invention, which does not limit the protection scope of the present invention. For those skilled in the art, the present invention can be modified and varied in various ways. Within the spirit and principle of the present invention, any change, modification, replacement, integration and parameter change of these embodiments by conventional substitution or capable of achieving the same function without departing from the principle and spirit of the present invention shall fall within the protection scope of the present invention.
Claims
1. A knowledge-guided self-supervised training method for fine-grained apple classification model under channel perception, characterized by: S1. Perform full-supervision training on the base class object detection model on the target dataset. When the evaluation index is optimal, obtain the model parameters and regard it as the teacher model. S2. Obtain channel weights through supervised learning to focus more on feature channels with stronger discriminative capabilities; The channel weight acquisition method uses the forward reasoning loss change method to measure the corresponding channel weight using the loss change value when these features are removed; S3. Based on massive unlabeled data sets, combined with knowledge guidance under channel perception, self-supervised learning of the backbone network is performed, and the backbone network parameters are obtained when the loss value is minimized; S4: Use the backbone network parameters obtained in S3 to initialize the backbone network parameters of the downstream fine-grained target detection task, and perform fine-tuning training.
2. The method for self-supervised training of a fine-grained apple classification model under channel perception and knowledge guidance according to claim 1, characterized in that: The specific steps of S1 are as follows: S11, obtain an apple-type object detection dataset, and label the category as apple; S12. Select YoloV5s as the target detection model, perform iterative training in the above data set, and obtain the model parameters when the evaluation index is optimal; S13. Obtain the above model parameters and extract the backbone network of the YoloV5s model as the teacher model.
3. The method for self-supervised training of a fine-grained apple classification model under channel perception and knowledge guidance according to claim 2, characterized in that: The specific steps of S2 are as follows: S21. Set the parameter value of the convolution kernel c in the target network layer i (where \(0 < i < N\) and \(N\) is the number of convolution kernels) to 0, and set the network model parameters at this time as \(\omega\) * ; S22, traverse all images in the data set, the model enters the eval mode, obtains the model parameter ω at the loss value loss0 of the labeled data, and obtains the model parameter ω * In the loss value loss1 of the labeled data, calculate the difference between the two losses as the corresponding convolution kernel c i The weight of S23, traverse the convolution kernels in the target network layer, repeat S21 and S22, and obtain the initialization weight list of all convolution kernels; S24, normalize the above weight list so that its value range satisfies 0-1, and obtain the final channel weight W.
4. The method for self-supervised training of a fine-grained apple classification model under channel perception and knowledge guidance as claimed in claim 3, characterized in that: The calculation formula in S24 is:
5. The method for self-supervised training of a fine-grained apple classification model under channel perception and knowledge guidance as claimed in claim 4, characterized in that: The specific steps of S3 are as follows: S31, obtain all relevant images of the target class without labels to form a self-supervised learning dataset; S32. According to the YoloV5s configuration file, extract part of the model as the backbone network; S33, using the BYOL self-supervised learning method, performs self-supervised training on the backbone network obtained in S32 on the data set obtained in S31, and uses the teacher model obtained in S1 and the channel weight w obtained in S2 to perform knowledge guidance under channel perception; S34. Save the backbone model parameters in the self-supervised method when the loss value is optimal.
6. The method for self-supervised training of a fine-grained apple classification model under channel perception and knowledge guidance as claimed in claim 5, characterized in that: The formula in S33 is as follows: In the above formula, loss is the loss value generated by the guided training; ω student is the student model (the backbone network in the self-supervised method); ω teacher is the teacher model; x i is the i-th image; FM j is the j-th feature map; ||·||2 is the Euclidean distance.
7. The method for self-supervised training of a fine-grained apple classification model under channel perception and knowledge guidance according to claim 6, characterized in that: The specific steps of S4 are as follows: S41, backbone network and other parameter initialization, use the backbone parameters learned by BYOL to initialize the Yolov5s backbone network and set the category; S42, YoloV5s model pre-training, freeze the backbone network gradient, perform 100 epochs of model full supervision pre-training, and save the model parameters when the indicators are optimal; S43, YoloV5s model training, the model parameters obtained in S42 are used to initialize the model parameters of this training, and full supervision training is performed on the data set. When the indicators are optimal, the model parameters are saved; S44, fine-grained object detection model training is completed.
8. The method for self-supervised training of a fine-grained apple classification model under channel perception and knowledge guidance according to claim 7, characterized in that: The number of S41 settings is eight, and the specific categories are as follows: There is no obstruction on apple 0, apple 1 is obstructed by leaves, apple 2 is obstructed by branches, apple 3 is obstructed by apple, apple 4 is obstructed by leaves and branches, apple 5 is obstructed by leaves and apples, apple 6 is obstructed by branches, leaves and apples, apple 7 is obstructed by branches, leaves and apples.
