| With the increasing scale of animal husbandry in China.RFID identification technology has been unable to meet the needs of modern fine breeding due to the short recognition distance,fragile labels and high labor costs.Face recognition is an effective way to solve this problem.However,most of the current cattle face recognition methods based on deep learning ignore the impact of complex environmental factors such as image dirt,enclosure lighting,camera differences,and lack of relevant public cattle face image databases;At the same time,the current cattle face recognition algorithm based on convolutional neural network often ignores the global context information when extracting the cattle face features,and can only extract the local feature information of the cattle face image.For this reason,this thesis mainly studies the cattle face recognition algorithm under the scenes of the actual ranch environment,such as cattle face image dirt,enclosure lighting,and camera differences,the specific research contents are as follows:1.For the cattle face database in complex environment of the enclosure that is not open at present,the cattle face image was collected in a pasture in Hebei,and the cattle face image database of dirty,posture difference scenes and lighting,camera difference scenes was established.First of all,set up cameras at the entrances and exits of five different cattle farms to capture cattle face videos from multiple angles and capture images by frame;Then,the captured cow face images are selected,classified and numbered to obtain the corresponding labels of the images;Finally,normal images and special images with occlusion,light and camera differences are separated according to the research requirements.Finally,the self-built image library contains 979 kinds of cattle face data.Among them,there are 868 types of normal images,45 for each type,39060 in total;35 categories are special images containing dirt information,10 images for each category,350 images in total;The 29 types are similar cattle face images collected by different cameras,10 for each type,290 in total;The remaining 47 categories are special images of light difference,10 images for each category,470 images in total.2.A cattle face recognition algorithm based on residual and style information constraints is proposed to mitigate the impact of grazing environment lighting and camera differences on the model.First of all,use Instance Normalization(IN)to filter the style information such as color contrast caused by the changes of cattle farm lighting and camera differences in the batch normalization features to obtain the style normalization features;However,IN will lose the content information of cow face image,which will affect the recognition performance of the algorithm.Therefore,this thesis uses the batch normalization feature and style normalization feature to calculate the residual feature,and recovers the class information feature and style information feature lost by instance normalization from the residual feature through the selfattention mechanism;At the same time,a loss function with style information penalty is proposed.The contrast constraint is used to make the contrast distance between features containing only category information less than that between features containing style information.The ability of the model to distinguish between category information features and style information features is enhanced,and the generalization ability of cattle face recognition algorithm in lighting and camera difference scenes is improved.3.On the basis of the Vi T(Vision Transformer)model,a new feature fusion method is designed,and a cattle face recognition algorithm based on the Vi T model is proposed to alleviate the impact of the cattle face image dirt on the model recognition performance.First,using the global receptive field of the Vi T model can effectively improve the local receptive field problem of the convolutional neural networks(CNN),and can obtain the global context information of the cattle face image;Then,the patch shift network layer proposed in this paper is added to the Vi T model.By obtaining the global and local features of the cattle face image,as well as the correlation between local features,the influence of cattle face image dirt on the model is effectively alleviated;Finally,after the patch shift network layer,a learnable mask matrix is added.The mask matrix is used to learn the importance of image blocks,so that the model pays more attention to cow face image blocks and suppresses the interference of background noise.4.Build a cattle face recognition platform based on mobile cloud.First,develop the front display interface of cattle face recognition We Chat official account.Users can transmit the cattle face image to be recognized to the mobile cloud deployed with cattle face recognition applications through We Chat official account for recognition.Secondly,the acceleration framework is used to convert the cattle face recognition model into a reasoning engine and deploy it to the mobile cloud GPU server,so as to improve the speed of the algorithm to extract cattle face features and achieve real-time recognition. |