Abstract:With the development of intelligence and automation technology, people pay more attention to use it to monitor pig welfare and health in modern pig industry. Since the behaviors of group pigs present their healthy status, it is necessary to detect and monitor behaviors of group pigs. At present, machine vision technology with advantages of low price, easy installation, noninvasion and mature algorithm has been preferentially utilized to monitor pigs’ behaviors, such as drinking, eating, farrowing behavior of sow, and detect some of pigs’ physiological indices, such as lean yield rate. Feeding pigs at group level was used the most in intensive pig farms. Owing to normally happened huddled pigs showing in grouppig images, it was challenging to utilize traditional machine vision technique to monitor the behaviors of group pigs through separating adhesive pig areas. Thus a new segmentation method was introduced based on deep convolution neural network to separate adhesive pig areas in grouppig images. A PigNet network was built to solute the problem of separating adhesive pig areas in grouppig images. Main part of the PigNet network was established on the structure of the Mask R-CNN network. The Mask R-CNN network was a deep convolution neural network, which had a backbone network with a branch of FCN from classification layer and regression layer to mask the region of interest. The PigNet network used 44 convolutional layers of backbone network of Mask R-CNN network as its main network. After the main network, the output feature image was fed to the next four convolutional layers with different convolution kernels, which was the resting part of the main network and produced binary mask for each pig area. As well, the output feature image was fed into two branches, one was the region proposal networks (RPN), the other was region of interest align (ROIAlign) processing. The first branch outputted the regions of interest, and then the second one aligned each pig area and produced class of the whole pig area and the background area and bounding boxes of each pig regions. A binary cross entropy loss function was utilized to calculate the loss of each mask to correct the class layer and the location of ROIs. Here, the ROIAlign was used to align the candidate region and convolution characteristics through the bilinear difference, and which would not lose information by quantization, making the segmentation more accurate, and FCN of the mask branch used average binary cross entropy as the loss function to process each mask, which avoided the competition among pig masks. After all, the ROI was labeled with different colors. Totally 2000 images captured from previous five days of a 28day experiments were taken as the training set, and 500 images from the next 6th to 7th day were validation set. The results showed that the accuracy of the PigNet on training set was 86.15% and on validation set was 85.40%. The accuracies on each data set were very close, which showed that the model had effective generalization performance and high precision. The cooperation between the PigNet, Mask R-CNN (ResNet101-FPN) and its improvement showed the PigNet surpassed the other two algorithms in accuracy. Meanwhile, the PigNet run faster than the Mask R-CNN. However, the times of three algorithms spent on 500 samples of the validation set were similar. The algorithm can be used to separate individual pig from grouppig images with different behaviors and severe adhesion situation. The PigNet network model adopted the GPU operation mode, and used the three branches of class, regression box and mask to compute parallel processing time, which made the processing time of single image quick, only 2.12s. To a certain degree, the PigNet could reduce convolution parameters and simplify the network structure. The research provided a new segmentation method for adhesive grouppig images, which would increase the possibility of grouppig tracing and monitoring.