| With the improvement of living standards,people put forward higher requirements for medical standards and services.Automated pharmacies can provide better medical services and medication safety.As the key equipment of automated pharmacies,automatic sorting of pill boxes has attracted the attention of many experts and scholars in recent years.The rapid development of computer technology and deep learning has provided new ideas and methods for the development of automatic sorting equipment for pill boxes.In order to promote the development of automatic sorting equipment for pill boxes,this paper studies the detection method of pill boxes based on YOLOv4 network.First,the problems existing in the YOLOv4 network are analyzed through the medicine box detection experiment,and then the YOLOv4 network is improved for different problems.The specific methods are as follows:(1)In view of the complex structure and high computational cost of YOLOv4 network,it is difficult to directly deploy on embedded devices.This paper studies a lightweight method for YOLOv4 network.Under the premise of not deleting the network structure,the method of replacing ordinary convolution with depthwise separable convolution reduces the amount of parameters and calculation of convolution in its feature extraction network,and achieves the purpose of simplifying the network and improving the detection speed;In YOLOv4’s candidate frame generation method,by improving the Anchor Base into an Anchor Free structure,the generation of redundant candidate frames is reduced,and the purpose of reducing network inference time and improving detection speed is achieved.The experimental analysis shows that the improved YOLOv4 network sacrifices a small amount of detection accuracy,reduces the network complexity,and greatly improves the detection speed,so that the network can meet the needs of being directly deployed on embedded devices.(2)In the medicine box detection task of the YOLOv4 network,the different shooting angles of view make the size of the medicine box image change,which leads to the reduction of detection accuracy.This paper studies an improvement method for the multi-view scale change of the YOLOv4 network.On the basis of its feature fusion network,by introducing an adaptive feature fusion(ASFF)method,a path aggregation network based on adaptive feature fusion(PASFF)is constructed to perform feature fusion,so that the feature information of the feature map is hierarchical.Solve the problem of internal inconsistency in the image pyramid,and achieve the purpose of improving the accuracy of network detection;by increasing the position confidence in the network output and adjusting the network loss function,the generation of false positive candidate frame samples is reduced,and the problem of imbalance between positive and negative samples is alleviated.The purpose of improving the detection accuracy of the network;by decoupling the coupled detection head in the original YOLOv4,the problem of spatial imbalance of the detection head due to different tasks is solved,and the detection accuracy of the network is improved.The experimental results show that the improved YOLOv4 network improves the network’s ability to detect large changes in the target image scale,and improves the overall accuracy of the network in the task of medicine box detection.Finally,the improved YOLOv4 network is deployed in the medicine box sorting platform and related experiments are carried out.The experimental results show that compared with other mainstream and lightweight target detection networks,the improved YOLOv4 network has certain advantages in detection accuracy and detection speed,and it can be applied to the situation where the size of the medicine box image changes greatly.It is an effective medicine box detection network,which is conducive to promoting the development of medicine box automatic sorting equipment. |