China has become the world’s largest pear planting region,accounting for about 80 percent of the world’s pear planting area,according to "the China Statistical Yearbook 2018"issued by the National Bureau of Statistics of the People’s Republic of China.But at present,most pears are picked by hand in China,which requires a lot of labor and the picking speed is slow.At the same time,there is a certain risk for workers to climb and pick.The limitations of manual picking and the development of intelligent agriculture make it urgent for us to study a fast and accurate pear picking system,and pear detection based on computer vision is an important part of pear automatic picking system,the research on it is of far-reaching significance.In this paper,the target detection algorithm based on deep learning is studied.Firstly,the evaluation index and loss function of prediction box of the YOLOv4 are developed and the detection accuracy is improved.Then the optimized pear detection algorithm is lightened to improve its detection speed.Finally,the lightweight pear detection algorithm is transplanted to the embedded platform,and the lightweight pear detection system based on mobile platform is realized.The main work of this paper has the following aspects:(1)In order to solve the problem that the loss function of the YOLOv4 algorithm does not fully consider the distance between the center point of the prediction box and the real box in the horizontal and vertical directions,the prediction box evaluation index is improved,and a new loss function is designed based on it.The loss function takes the ratio of the rectangular area that can reflect the distance between two center in the horizontal and vertical directions to the area of the smallest closure area of the two boxes as the position penalty,and uses the penalty of IOU(Intersection over Union)and Complete-IOU as the penalty for the overlap area and aspect ratio of the two boxes,respectively.Finally,the experimental results on pear data set show that the improved loss function make the model of the YOLOv4 algorithm get a better convergence effect,and comparing to the original algorithm,the average accuracy has increased by 1.85%,the recall rate has increased by 3%,and it has a good detection performance for pears with different sparsity.(2)In order to solve the problem that YOLOv4 has a large amount of network parameters and high computational complexity,and it is difficult to apply it to embedded systems to achieve real-time detection,a lightweight pear detection algorithm is improved.Firstly,the improved YOLOv4 algorithm is lightweighted,and a lightweight feature extraction network is introduced to replace CSPDarkNet53.Then,the spatial pyramid pooling and path aggregation network of feature enhancement module are optimized to obtain the lightweight pear detection algorithm.Finally,the training and evaluation of the algorithm are completed on the PC,and the experimental results show that the lightweight feature extraction module and the feature enhancement module optimized in this paper can effectively simplify the improved YOLOv4 algorithm.The FPS value is increased from 19.8 to 38.4,while the detection accuracy is similar.(3)A pear detection system based on mobile platform is designed and implemented by combining two-dimensional steering gear and smart car,and taking raspberry pie development board as the main body and neural network computing stick(ncs2)as the coprocessor.Then the lightweight pear detection model is transplanted to the system,and the experimental results show that the real-time detection speed of the system reaches 13.2 f·s-1,which can meet the actual needs of pear detection. |