| Pork has always been a necessity on the table.The quality of pork is directly related to the breeding mode of pigs.At present,the existing pig health detection mostly adopts manual inspection,which will not only increase the cost of human and material resources,but also easily endanger the health of human body.Therefore,this paper proposes a pig health detection system based on yolov5 algorithm,which aims to use deep learning to track pigs,calculate the amount of movement of pigs equivalently,and analyze the active status of different pigs through the amount of movement of pigs.The health status of pigs is closely related to their own active state,so as to monitor the health status of pigs.This paper studies the pig health monitoring system based on Yolov5 algorithm.By combining Yolov5 target monitoring algorithm with DeepSort algorithm as the benchmark network,a series of innovations have been made in Yolov5 algorithm.The innovative achievements are as follows:(1)In view of the complex environment of pig houses,pigs are prone to pile up,and it is difficult to distinguish between target and background and between target and target.In this paper,spatial pyramid pooling and convolutional block attention module are fused to generate spatial convolutional block attention module,which is embedded into the residual block in yolov5 network.The attention mechanism proposed in this paper can enhance effective features and inhibit ineffective features,so as to reduce the phenomenon of false detection and missed detection in pig detection.(2)Because the size of the target pigs is different and the distance between different pigs is close,there are higher requirements for the speed and stability of target regression.When the real detection frame and the prediction detection frame completely coincide,GIoU can not accurately obtain the position relationship between them,resulting in the slow regression speed.It is improved on the basis of GIoU,A generalized intersection over union loss based on new boundary regression box is proposed.The regression loss function speeds up the regression of the prediction frame and improves the detection accuracy.(3)Aiming at the non convergence problem of Adam optimizer used in pig detection and training stage,this paper proposes an optimizer algorithm based on high-order exponential smoothing dynamic boundary constraints.The algorithm makes up for the deficiency of one-time exponential smoothing by introducing multiple hyperparameters and multiple exponential smoothing.In addition,the second-order momentum calculation is corrected to prevent the bad fluctuation of the second-order momentum data,so as to smooth the unexpected college learning rate.(4)Due to the large number of pigs in the pictures collected,the picture data set is complex and prone to under fitting.Therefore,a fractional exponential linear unit based on fractional exponential smoothing is proposed in this paper.By adding the function characteristics of the activation function,the interdependence of parameters is increased,which increases the complexity of the network and alleviates the problem of under fitting.(5)This paper records and analyzes the pixel movement of pigs in the surveillance video to calculate the equivalent movement of pigs,so as to judge the activity of pigs.In this paper,all innovations are embedded into the benchmark algorithm Yolov5,and combined with Deepsort to realize the real-time monitoring of pig movement.In addition,Vue and Flask are combined to build a basic platform with front and rear end separation,so as to realize a small pig health monitoring system. |