CN107527351B - Lactating sow image segmentation method fusing FCN and threshold segmentation - Google Patents

Lactating sow image segmentation method fusing FCN and threshold segmentation Download PDF

Info

Publication number
CN107527351B
CN107527351B CN201710772176.2A CN201710772176A CN107527351B CN 107527351 B CN107527351 B CN 107527351B CN 201710772176 A CN201710772176 A CN 201710772176A CN 107527351 B CN107527351 B CN 107527351B
Authority
CN
China
Prior art keywords
segmentation
sow
fcn
image
threshold
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710772176.2A
Other languages
Chinese (zh)
Other versions
CN107527351A (en
Inventor
薛月菊
杨阿庆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
South China Agricultural University
Original Assignee
South China Agricultural University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by South China Agricultural University filed Critical South China Agricultural University
Priority to CN201710772176.2A priority Critical patent/CN107527351B/en
Publication of CN107527351A publication Critical patent/CN107527351A/en
Application granted granted Critical
Publication of CN107527351B publication Critical patent/CN107527351B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a lactating sow image segmentation method fusing FCN and threshold segmentation. Collecting a video image of a sow, and establishing a sow segmentation video image library; establishing an FCN sow segmentation model, and segmenting the test image by using the model to obtain an FCN sow image segmentation result; connecting the FCN segmentation result with a minimum area rectangular frame externally, and performing Otsu threshold segmentation on the gray-scale image and the H component of the region to obtain a threshold segmentation result; and fusing the FCN segmentation result and the threshold segmentation result to obtain a final segmentation result of the sow image. On the basis of the FCN, the multi-channel Otsu threshold segmentation technology is fused, so that the defect of a local area can be effectively filled without reducing the FCN segmentation effect, and the segmentation accuracy is improved.

Description

Lactating sow image segmentation method fusing FCN and threshold segmentation
Technical Field
The invention relates to the technical field of image segmentation, in particular to a lactating sow image segmentation method fusing a Full Convolution Network (FCN) network and multichannel threshold segmentation.
Background
The health and the maternal behavior of the lactating sows are related to the economic benefit of the whole pig farm, and the monitoring of the lactating sow behavior is particularly important. The traditional sow condition monitoring mode is that daily behaviors such as sow movement, feeding, lactation and the like are observed for a long time through manual work, and the physical condition and the maternal behavior of the sow are judged according to experience, so that relevant measures are further taken. The method is time-consuming and labor-consuming, and is easy to cause misjudgment. Automatic monitoring of sow behaviour using computer vision techniques is a good alternative to manual means.
The first step of automatically identifying the behavior of the lactating sow by using a computer vision technology is to completely segment the sow from a complex background image, namely to segment the sow image. The sow image segmentation is a complex and challenging problem, and the main difficulties are two aspects, one is caused by the change of the sow body: sows have quite complex detail changes, such as different behavioral attitudes like sitting, lying on their side, body twisting, etc.; another aspect is caused by external environmental factors: the environment of the pigsty is complex, such as light change, shielding of pigs, low contrast of the environment background and the colors of the pigs and the like. The existence of the problems brings great challenges to the image segmentation of the sows.
In recent years, some researchers have extracted the prospect of pig targets using computer vision techniques. The background model is updated by Zhuweixing et al, Nanjing agriculture university in 2014, by using Gaussian mixture, and the maximum entropy threshold is combined, but the method is not suitable for the target foreground which is immobile for a long time or moves slowly. In 2015, the group carries out secondary segmentation on the group-fed piglets by using the maximum information entropy threshold to obtain the target foreground of the pigs, but the method has poor effect when the target foreground is not greatly different from the background. The patent publication No. CN106204537A discloses a live pig image segmentation method in a complex scene, which obtains an image obtained by segmenting a live pig image by performing background difference and threshold segmentation to obtain a primary segmentation image and then performing shadow compensation by using the centroid and image light source information of the primary segmentation image, thereby obtaining the segmented image of the live pig. And for the adhered pigs in the pig group, high clouds and the like of China agriculture university in 2017, on the basis of threshold segmentation, a watershed segmentation algorithm based on distance transformation is adopted to segment individual adhered pigs. However, most studies have been directed to plain pigs, replacement gilts or piglets, and less to lactating sows with uneven suits. In addition, the pig target extraction based on the convolutional network is not involved in the pig segmentation method.
Convolutional neural network technology has been widely used in the field of industrial production. In 2015, Long et al proposed an image semantic segmentation algorithm of a Full Convolution Network (FCN), and improved the existing neural network model to obtain end-to-end pixel level prediction, thereby reducing the training complexity and accurately extracting deep semantic information in the image. The FCN well avoids the problems of uneven illumination, random noise, image distortion and the like through operations such as multilayer convolution, pooling and the like, and a great breakthrough is obtained in the field of image segmentation, however, the application research of the method in the segmentation of livestock and poultry breeding objects is almost blank. Since the FCN uses simple bilinear interpolation for upsampling, local information of the image is easily lost, and voids are generated. In addition, in the case of insufficient samples or single samples, FCN exhibits poor generalization ability and is liable to cause an under-segmentation phenomenon. The multi-channel threshold segmentation method extracts an object target by utilizing the characteristic of similarity of the object, and compensates the phenomena of void generation and under-segmentation of the FCN to a certain extent. According to the method, the ROI area is extracted on the basis of FCN segmentation, and the multichannel threshold segmentation method is fused in the area, so that the defect of a local area can be effectively filled up while the FCN segmentation effect is not reduced, the FCN segmentation effect is improved, and the generalization performance is enhanced.
Disclosure of Invention
The invention aims to overcome the technical problems in the background art and provide a lactating sow image segmentation method integrating FCN and multichannel threshold segmentation, which can accurately segment individual sows under the complex conditions of sow deformation, shielding, uneven color, low contrast with background color, light change and the like.
In order to achieve the purpose, the technical scheme of the invention is as follows:
a lactating sow image segmentation method fusing FCN and multichannel threshold segmentation comprises the following steps:
s1, collecting video images of sows, and establishing a sow segmentation video image library;
s2, establishing an FCN sow segmentation model, and segmenting the test image by using the model to obtain an FCN sow image segmentation result;
s3, externally connecting a minimum area rectangular frame to the FCN segmentation result, and carrying out Otsu threshold segmentation on the gray-scale image and the H component of the region to obtain a threshold segmentation result;
and S4, fusing the FCN segmentation result and the threshold segmentation result to obtain a final segmentation result of the sow image.
The FCN utilizes convolution and pooling to extract high-quality image characteristics, so that the problems of illumination change, uneven sow body surface color, sow and piglet adhesion and the like in a piggery scene are well solved, and in addition, under the condition of strong light, and the FCN easily loses detailed information in the convolution process, so that the local area of the sow is lost. On the basis of the FCN, the method integrates a multi-channel Otsu threshold segmentation technology, can effectively fill up the loss of a local area without reducing the FCN segmentation effect, and improves the segmentation accuracy.
Preferably, the specific process of step S1 is as follows:
s11, data acquisition: acquiring overlooking sow video images in real time;
s12, constructing a database: removing the motion-blurred video frames which are missing from the sow body and are above 1/2, and constructing a training set, a verification set and a test set;
s13, manually labeling the sow image: and manually marking all pixel points of the sow in the image.
Preferably, the specific process of step S2 is as follows:
s21, designing an FCN sow segmentation model structure;
s211, selecting a convolutional neural network;
s212, removing a classification layer of the convolutional neural network;
s213, designing a convolution kernel with the same size as the input data of the full-connection layer, performing convolution operation on the convolution kernel and the input data of the full-connection layer, and converting all the full-connection layers of the convolution neural network into convolution layers in the mode;
s214, adding convolution layers, performing 1 × 1 convolution operation on the highest pooling layer n, outputting dimensions of the numbers of classes to obtain a prediction result score (n) of the pooling layer n, and performing deconvolution on the result to obtain a deconvolution prediction result score _ up (n) of the pooling layer n;
s215, performing 1 × 1 convolution operation on the previous pooling layer n-1 of the pooling layer n, and outputting the number of classes of dimensionality to obtain a prediction result score (n-1) of the pooling layer n-1;
s216, adding the two results score (n-1) and score _ up (n), and performing deconvolution to obtain a deconvolution prediction result score _ up (n-1) of the pooling layer n-1;
s217, performing 1 multiplied by 1 convolution operation on the previous pooling layer n-2 of the pooling layer n-1, and outputting the number of classes of dimensionality to obtain a prediction result score (n-2) of the pooling layer n-2;
s218, adding the two results score (n-2) and score _ up (n-1), and performing deconvolution to obtain a deconvolution prediction result score _ up (n-2) of the pooling layer n-2;
s219, finally adding a Loss layer for Loss calculation;
s22, training an FCN sow segmentation model;
s221, carrying out histogram equalization on the training set;
s222, training a segmentation model on a training set, taking a classification convolutional neural network model which is trained on ImageNet as a pre-training model, and finely adjusting a sow segmentation network in the mode to accelerate convergence speed and prevent overfitting; when the first forward propagation is carried out, if the first forward propagation is the same as the name of a certain layer in the training model and the segmentation network structure, the layer parameter of the pre-training model is directly called, otherwise, the layer parameter is initialized by adopting random Gaussian distribution; data are transmitted to the last layer, loss is calculated according to the actual marking result of the sow, a random gradient descent method is adopted, network parameters are continuously optimized, and supervised learning is carried out on the sow image so as to obtain the connection weight and the offset value of the optimal full convolution network;
s23, segmenting the test set image by using the FCN sow segmentation model;
s231, carrying out histogram equalization on the test image;
s232, segmenting the preprocessed test image by using the trained FCN model, and extracting a sow region;
s233, post-processing the FCN segmentation results, filling the holes with morphology and area thresholds, and removing small area regions.
Preferably, the specific process of step S3 is as follows:
s31: externally connecting a sow segmentation result of the FCN with a small-area rectangular frame, and extracting a rectangular frame area where an original image is located;
s32: respectively converting the extracted rectangular frame area image into a gray space and an HSV space, and obtaining the average gray value of the piglet as a gray threshold value by counting the sow images of different columns under M different light rays to eliminate the piglet area; calculating a hue threshold of the H component on the H component by using an Otsu method; sow pixels are extracted according to the following formula, wherein STH(i, j) represents a binary image after division, H (i, j) represents an H component, G (i, j) represents a grayscale image, thhIs the hue threshold value, thgIs a gray scale threshold;
Figure GDA0002761945230000041
and if the hue value of the H component is greater than the hue threshold value and the gray value on the gray level image I is greater than the gray level threshold value, marking the pixel point as 1, otherwise, marking the pixel point as 0, obtaining a threshold segmentation result, and performing post-processing.
Preferably, the step S3 fusing is to fuse the FCN segmentation result and the threshold segmentation according to the following formula, wherein SFCN(i, j) is the FCN partitioning result, STH(i,j)Performing post-processing after fusion of the multi-channel threshold segmentation results to obtain final segmentation results I (I, j);
Figure GDA0002761945230000042
preferably, the deconvolution refers to upsampling the output data, and the upsampling is implemented by bilinear interpolation.
Preferably, the predicted result of step S2 is a two-dimensional graph, and the value of each coordinate point position represents the probability of each category.
Preferably, the training set refers to a data set used for training a segmentation model; the verification set is a data set used for optimizing network structure parameters in the training process and selecting an optimal network model; the test set is used for testing the performance of the model and evaluating the performance.
Compared with the prior art, the technical scheme of the invention has the beneficial effects that:
(1) the method comprises the steps of establishing a lactating sow video image database, wherein the database comprises various behavior postures overlooking images in daily life of a sow in a pigsty scene, all the images have different aspects in light, background, scale and the like, and the database provides data support for later sow behavior analysis, algorithm design and the like;
(2) based on a convolution network, the method adopts part of sow video images to train a segmentation model, adopts the rest of sow images as a verification set, improves the generalization performance of the network, and solves the problem that the sows are difficult to segment under the complex environment, such as light, piglet shielding, the sow body surface shows flower colors, the color difference with the environment is not large, and the like;
(3) according to the method, multichannel threshold segmentation is fused on the basis of FCN segmentation, the FCN segmentation result is repaired, particularly under the condition of strong light, the sow segmentation result is well improved, the segmentation accuracy and generalization capability are further improved, and more accurate information is provided for further sow behavior analysis;
(4) the sow monitoring system is suitable for monitoring sows continuously for a long time, and is favorable for further carrying out automatic detection and identification on sow behaviors.
Drawings
FIG. 1 is a flow chart of the method of the present invention.
Fig. 2 is a diagram of an FCN network architecture employed by the present invention.
Fig. 3 (a) is a video image of a sow captured; fig. 3 (b) is a preprocessed image; fig. 3 (c) shows the FCN partitioning result; FIG. 3 (d) is an outer rectangular box on the result of the FCN segmentation; fig. 3 (e) is a rectangular frame region where the grayscale image is located; fig. 3 (f) is a rectangular frame region where the H component is located; fig. 3 (g) is a grayscale map and a division result of the H component; FIG. 3 (h) is a segmentation binary map after fusing a full convolution network and multi-channel threshold segmentation; in fig. 3, (i) is the extracted individual region of the sow.
Fig. 4 is a comparison of segmentation results.
Detailed Description
The drawings are for illustrative purposes only and are not to be construed as limiting the patent; for the purpose of better illustrating the embodiments, certain features of the drawings may be omitted, enlarged or reduced, and do not represent the size of an actual product;
it will be understood by those skilled in the art that certain well-known structures in the drawings and descriptions thereof may be omitted. The technical solution of the present invention is further described below with reference to the accompanying drawings and examples.
The invention provides a lactating sow image segmentation method fusing FCN and multichannel threshold segmentation, which realizes sow object extraction in a pigsty scene and provides basic guarantee for further processing and intelligent analysis of maternal behaviors.
Part 1 of fig. 1 is database establishment, including data acquisition, experimental data screening, and data set tagging, to provide data support for subsequent experiments. Part 2 is to design a sow image segmentation model of the FCN, firstly train an optimal segmentation model on a training set, and then segment images of a test set by using the optimal segmentation model. And the 3 rd part performs adaptive threshold segmentation on the H component and the gray level image on the basis of the FCN initial segmentation to obtain a segmentation result. And part 4, fusing the results of the former two methods to obtain a final segmentation result. According to the method, under an Ubuntu14.04 operating system, a Caffe deep learning framework is built on a GPU hardware platform based on Nvidia GTX 980, FCN model training and testing of sow image segmentation are carried out, and multi-channel threshold segmentation and fusion are completed under Matlab.
The concrete implementation is as follows:
firstly, acquiring a video image and establishing a database;
designing and training an FCN sow image segmentation model, and carrying out primary image segmentation by using the model;
thirdly, segmenting the sow image by using a multichannel threshold segmentation method;
step four, fusing the segmentation results of the step two and the step three to obtain a final segmentation result;
the database establishing method of the first step specifically comprises the following steps:
1) and fixing the camera right above the solid pigsty, and adjusting the camera to a proper height to obtain a complete pigsty area. The system is connected to a computer image acquisition system through a USB (universal serial bus), overlooking sow video images are acquired in real time and stored in a local hard disk, 28-column sow overlooking color video images are acquired in total, and the size of the images is 960 multiplied by 540 pixels, namely the acquired sow video images are shown in (a) in figure 3.
2) And establishing a training set, a verification set and a test set. 3811 sow video images with different postures (standing, sitting, lying on side and the like) and different times (from 8 am to 6 pm) are respectively extracted from 7 sow video images to serve as training samples, 672 sow video images are extracted from the remaining 21 sows in the same way to serve as a verification set, 1366 images are extracted from all the shot 28 sow video images to serve as a test set, and images which are repeated with the verification set and the training set do not appear in the test set. And manually marking the training set, the verification set and the test set, and manually marking all pixel points of the sow in the image. The background area pixel value is 0, the sow area pixel value is 1, and the sow edge pixel value is 255, which means that no loss calculation is performed on the edge portion.
And step two, constructing a sow image segmentation model of the FCN, and performing initial segmentation by using the model, wherein the method specifically comprises the following steps:
1) the VGG16 is selected as the underlying network structure and this network is modified to accommodate the pixel level prediction task implemented by the FCN, the FCN partitioning network of the present invention is shown in FIG. 2. The specific operation is as follows:
(a) removing the VGG16 classification layer;
(b) replacing the fully-connected layers F6 and F7 of the VGG16 with convolution layers with convolution kernels of 7 × 7 and 1 × 1 and a dimension of 4096 respectively, wherein the converted convolution layers are C6 and C7 in the graph 2, a convolution layer C8 is added, the convolution kernels are 1 × 1, the output dimension is 2 (a sow object and a background), the output result is score (5), and each pixel value corresponds to the class probability of a pixel point;
(c) adding a deconvolution layer D1 behind C8, wherein the convolution kernel of deconvolution is 2 x 2, namely 2 times of upsampling is carried out, and a deconvolution prediction result score _ up (5) of C8 is obtained;
(d) adding a convolution layer C9, wherein the convolution kernel is 1 multiplied by 1, the output dimension is 2, and the convolution operation is carried out on the convolution layer C9 and the pooling layer P4, and the output result is score (4);
(e) adding a fusion layer F1 to fuse the output results of D1 and C9, and adding the two results score (4) and score _ up (5);
(f) adding a deconvolution layer D2, and performing 2-time upsampling on the output result of the F2 to obtain a score _ up (4);
(g) adding convolution layer C10 with convolution kernel of 1 × 1 and output dimension of 2, performing convolution operation with pooling layer P3 to obtain score (3);
(h) adding a fusion layer F2 the two results score (3) and score _ up (4) are added;
(i) adding an deconvolution layer D3 with a convolution kernel of 8 x 8, namely performing 8 times of upsampling on the fusion result of F2 to output a score _ up (3), and finally cutting the fusion result into an image with the same size as the input image, namely a prediction segmentation result;
(j) and adding a Loss layer for comparing with the manually marked image to perform Loss calculation.
2) And histogram equalization is carried out on the training set, so that the influence caused by uneven light is reduced.
3) And sending the preprocessed training set into a segmentation network to learn the optimal network parameters. The training process is specifically realized as follows:
and taking VGG16. coffee model as a pre-training model, wherein the model is a model trained on an ImageNet database, directly calling parameters of the pre-training model without a modified layer during first forward propagation, and otherwise initializing the parameters of the layer by adopting random Gaussian distribution. The data is propagated to the last layer, the loss is calculated according to the actual marking result of the sow, the loss is calculated according to the following formula, c represents the square sum of the cost loss, m represents the number of samples sent into the network each time, in the embodiment, m is set to be 1 due to the limitation of video memory, t is set to be tiIndicating the correct classification (annotated image) for the ith image, ziThe detection result of the ith image is output after network operation.
Figure GDA0002761945230000081
After calculating the loss, performing back propagation according to the error loss to optimize network parameters, and adjusting the convolution kernel W and the bias b according to the following formula when performing back propagation, wherein eta is1,η2To the learning rate, Wold,WnewRepresenting the weight parameters before and after updating.
Figure GDA0002761945230000082
Figure GDA0002761945230000083
Let eta be1=10-12,η1=2×10-12And calculating error loss once after each iteration and updating the parameters. When the error of the verification set is gradually increased from gradual reduction, the whole network is considered to have already started to be over-fitted, training is terminated, the model is stored, the model is considered to be the optimal model, the iteration is performed for 3 ten thousand times at the moment, the time is 5 hours, 37 minutes and 53 seconds, and the cost function is converged to 0.02;
4) histogram equalization is performed on the test set, and the result after preprocessing is shown in fig. 3 (b).
5) And (4) sending the preprocessed training set into a trained FCN model to segment the sow image, wherein the segmentation process only carries out forward propagation once and does not carry out back feedback. Then, a 5 multiplied by 5 morphological operation structure element disk is adopted to carry out a closed operation on the prediction result, then a connected domain with the area smaller than an area threshold value 30000 is removed, and a final segmentation result S of the FCN is obtainedFCNThe division result is shown in fig. 3 (c).
The specific implementation of the sow image segmentation by using the multichannel threshold in the third step comprises the following steps:
1) final segmentation image S for FCNFCNAn external minimum area rectangular frame, as shown in (d) of fig. 3, and extracting a rectangular frame region where the original image is located;
2) respectively converting the extracted rectangular frame area image into a gray space and an HSV space, selecting 200 sow images with different light rays and different columns from the verification set, and counting the average gray 43 of the piglets as a gray threshold thg(ii) a The hue threshold th of the H component is calculated by the Otsu methodhThe target pixel is extracted according to the following formula if the hue value of the H component ((f) in fig. 3) is larger than the hue threshold thhAnd the gradation value on the gradation image G ((e) in fig. 3) is larger than the gradation threshold thg Pixel point mark 1 ofMarking the residual pixel point as 0 to obtain a threshold segmentation initial segmentation result STHAs in (g) of fig. 3;
Figure GDA0002761945230000091
the concrete implementation of fusing the FCN segmentation result and the threshold segmentation result in the fourth step is as follows:
1) according to the following formula, SFCNAnd STHAll target pixel points in the image are marked as 1, and other pixel points are marked as 0. And holes and noise exist in the fusion result I.
Figure GDA0002761945230000092
2) And (3) performing a closed operation on the fusion result by using a 5 × 5 morphological operation structure element "disk", filling a cavity, and removing a connected domain with an area smaller than an area threshold value 30000 to obtain a final segmentation image Bw, as shown in (h) of fig. 3, wherein (i) of fig. 3 is an extracted RGB sow object result.
The experimental results of this experiment are detailed below:
the invention adopts 4 evaluation indexes acknowledged in the industry to carry out statistics on the segmentation result of the test set, and the performance of the test sow image segmentation method is specifically realized as follows:
the pixel point accuracy (pixel acc), the mean accuracy (mean acc), the mean area overlap (mean IU), and the frequency weighted area overlap (f.w IU) are calculated using the following formulas, where n isijIndicates the number of pixels belonging to the i class and judged as the j class, nclRepresenting the total number of semantic classes, ti=∑jnijAnd the total number of the i-type pixel points is represented.
pixel acc=∑inii/∑iti
mean acc=(1/ncl)∑inii/ti
mean IU=(1/ncl)∑inii/(ti+∑jnji-nii)
f.w IU=(∑Ktk)-1itinii/(ti+∑jnji-nii)
The above formula was used to calculate the segmentation effect of the test set (1366 images of 28 sows) and the statistical results are shown in table 1. In table 1, the FCN method is a skip full convolution network (FCN-8s) improved by Long et al on the VGG16 network, the threshold segmentation is a rectangular frame circumscribed on the result of FCN segmentation, and the threshold segmentation is performed on the grayscale image and the H component in the rectangular frame region, and the fusion is a segmentation method for fusing the segmentation results of the former two.
The comparison result of the FCN, the threshold segmentation and the fusion proposed by the present invention is shown in fig. 4, where the threshold segmentation refers to performing multi-channel threshold segmentation in the ROI region extracted from the FCN segmentation result, and the effect is much improved compared to the segmentation result directly on the whole image. There were 5 groups of images, each from 5 different bars and different from the selected swinery of the training set. As can be seen from fig. 4, in the pigsty scenario addressed by the present invention, FCN and threshold segmentation have complementary effects, and the effect is significantly improved after combining the two, even if the partial segmentation of fig. 4 (e) occurs, the segmentation effect of the method of the present invention is improved compared with FCN.
TABLE 1 segmentation results
Figure GDA0002761945230000101
It should be understood that the above-described embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the claims of the present invention.

Claims (6)

1. A lactating sow image segmentation method fusing FCN and multichannel threshold segmentation is characterized by comprising the following steps:
s1, collecting video images of sows, and establishing a sow segmentation video image library;
s2, establishing an FCN sow segmentation model, and segmenting the test image by using the model to obtain an FCN sow image segmentation result;
s3, externally connecting a rectangular frame with a minimum area to the FCN sow image segmentation result, and performing Otsu threshold segmentation on the gray-scale image and the H component of the rectangular frame area to obtain a threshold segmentation result;
s4, fusing the FCN sow image segmentation result and the threshold segmentation result to obtain a final segmentation result of the sow image;
the specific process of step S1 is as follows:
s11, data acquisition: acquiring overlooking sow video images in real time;
s12, constructing a database: removing the motion-blurred video frames which are missing from the sow body and are above 1/2, and constructing a training set, a verification set and a test set;
s13, manually labeling the sow image: manually marking out all pixel points of the sow in the image;
the specific process of step S2 is as follows:
s21, designing an FCN sow segmentation model structure;
s211, selecting a convolutional neural network;
s212, removing a classification layer of the convolutional neural network;
s213, designing a convolution kernel with the same size as the input data of the full-connection layer, performing convolution operation on the convolution kernel and the input data of the convolution kernel, and converting all the full-connection layers of the convolution neural network into convolution layers;
s214, adding convolution layers, performing 1 × 1 convolution operation on the highest pooling layer n, outputting dimensions of the numbers of classes to obtain a prediction result score (n) of the pooling layer n, and performing deconvolution on the prediction result score (n) to obtain a deconvolution prediction result score _ up (n) of the pooling layer n;
s215, performing 1 × 1 convolution operation on the previous pooling layer n-1 of the pooling layer n, and outputting the number of classes of dimensionality to obtain a prediction result score (n-1) of the pooling layer n-1;
s216, adding the two results score (n-1) and score _ up (n), and performing deconvolution to obtain a deconvolution prediction result score _ up (n-1) of the pooling layer n-1;
s217, performing 1 multiplied by 1 convolution operation on the previous pooling layer n-2 of the pooling layer n-1, and outputting the number of classes of dimensionality to obtain a prediction result score (n-2) of the pooling layer n-2;
s218, adding the two results score (n-2) and score _ up (n-1), and performing deconvolution to obtain a deconvolution prediction result score _ up (n-2) of the pooling layer n-2;
s219, finally adding a Loss layer for Loss calculation;
s22, training an FCN sow segmentation model;
s221, carrying out histogram equalization on the training set;
s222, training an FCN sow segmentation model on a training set, taking a classification convolutional neural network model trained on ImageNet as a pre-training model, and finely adjusting a sow segmentation network to accelerate convergence speed and prevent overfitting; when the first forward propagation is carried out, if the names of a certain layer in the pre-training model and the segmentation network structure are the same, the layer parameter of the pre-training model is directly called, otherwise, the layer parameter is initialized by adopting random Gaussian distribution; data are transmitted to the last layer, loss is calculated according to the actual marking result of the sow, a random gradient descent method is adopted, network parameters are continuously optimized, and supervised learning is carried out on the sow image so as to obtain the connection weight and the offset value of the optimal full convolution network;
s23, segmenting the test set image by using the FCN sow segmentation model;
s231, carrying out histogram equalization on the test image;
s232, segmenting the preprocessed test image by using the trained FCN sow segmentation model, and extracting a sow region;
s233, post-processing the FCN segmentation results, filling the holes with morphology and area thresholds, and removing small area regions.
2. The method for image segmentation of lactating sows fusing FCN and multichannel threshold segmentation as claimed in claim 1, wherein the specific process of step S3 is as follows:
s31: externally connecting a sow segmentation result of the FCN with a small-area rectangular frame, and extracting a rectangular frame area where an original image is located;
s32: respectively converting the extracted rectangular frame area image into a gray space and an HSV space, and obtaining the average gray value of the piglet as a gray threshold value by counting the sow images of different columns under M different light rays to eliminate the piglet area; calculating a hue threshold of the H component on the H component by using an Otsu method; sow pixels are extracted according to the following formula, wherein STH(i, j) represents a binary image after division, H (i, j) represents an H component, G (i, j) represents a grayscale image, thhIs the hue threshold value, thgIs a gray scale threshold;
Figure FDA0002761945220000021
and if the hue value of the H component is greater than the hue threshold value and the gray value on the gray level image I is greater than the gray level threshold value, marking the pixel point as 1, otherwise marking the pixel point as 0, obtaining a threshold segmentation result, and performing post-processing.
3. The method of claim 2 wherein said step S4 is fusing the result of FCN segmentation and threshold segmentation according to the formula where S isFCN(i, j) is the FCN partitioning result, STH(i,j)Performing post-processing after fusion of the multi-channel threshold segmentation results to obtain final segmentation results I (I, j);
Figure FDA0002761945220000031
4. the method of image segmentation of lactating sows with fusion of the FCN and multichannel threshold segmentation as claimed in claim 1, wherein said deconvolution is an upsampling of the output data, the upsampling being performed by bilinear interpolation.
5. The method of fused FCN and threshold multi-pass segmentation of lactating sows of claim 1, wherein the predictor score (n) of the pooling layer n is a two-dimensional map, the value of each coordinate point position representing the probability of each category.
6. The method of image segmentation of lactating sows with fusion of the FCN and multichannel threshold segmentation as claimed in claim 1, wherein said training set is a data set used to train a segmentation model; the verification set is a data set used for optimizing network structure parameters in the training process and selecting an optimal network model; the test set is used for testing the performance of the model and evaluating the performance.
CN201710772176.2A 2017-08-31 2017-08-31 Lactating sow image segmentation method fusing FCN and threshold segmentation Active CN107527351B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710772176.2A CN107527351B (en) 2017-08-31 2017-08-31 Lactating sow image segmentation method fusing FCN and threshold segmentation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710772176.2A CN107527351B (en) 2017-08-31 2017-08-31 Lactating sow image segmentation method fusing FCN and threshold segmentation

Publications (2)

Publication Number Publication Date
CN107527351A CN107527351A (en) 2017-12-29
CN107527351B true CN107527351B (en) 2020-12-29

Family

ID=60683020

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710772176.2A Active CN107527351B (en) 2017-08-31 2017-08-31 Lactating sow image segmentation method fusing FCN and threshold segmentation

Country Status (1)

Country Link
CN (1) CN107527351B (en)

Families Citing this family (29)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108198192A (en) * 2018-01-15 2018-06-22 任俊芬 A kind of quick human body segmentation's method of high-precision based on deep learning
CN108288388A (en) * 2018-01-30 2018-07-17 深圳源广安智能科技有限公司 A kind of intelligent traffic monitoring system
CN108388877A (en) * 2018-03-14 2018-08-10 广州影子控股股份有限公司 The recognition methods of one boar face
CN108830854A (en) * 2018-03-22 2018-11-16 广州多维魔镜高新科技有限公司 A kind of image partition method and storage medium
CN108830144B (en) * 2018-05-03 2022-02-22 华南农业大学 Lactating sow posture identification method based on improved Faster-R-CNN
CN108734211B (en) * 2018-05-17 2019-12-24 腾讯科技(深圳)有限公司 Image processing method and device
CN108921938B (en) * 2018-06-28 2020-06-19 西安交通大学 Hierarchical structure construction method based on minimum cost and maximum flow in 3D scene
CN109145769A (en) * 2018-08-01 2019-01-04 辽宁工业大学 The target detection network design method of blending image segmentation feature
CN109492535B (en) * 2018-10-12 2021-09-24 华南农业大学 Computer vision sow lactation behavior identification method
CN109754440A (en) * 2018-12-24 2019-05-14 西北工业大学 A kind of shadow region detection method based on full convolutional network and average drifting
CN109785337B (en) * 2018-12-25 2021-07-06 哈尔滨工程大学 In-column mammal counting method based on example segmentation algorithm
CN109815991B (en) * 2018-12-29 2021-02-19 北京城市网邻信息技术有限公司 Training method and device of machine learning model, electronic equipment and storage medium
CN109766856B (en) * 2019-01-16 2022-11-15 华南农业大学 Method for recognizing postures of lactating sows through double-current RGB-D Faster R-CNN
CN109886985B (en) * 2019-01-22 2021-02-12 浙江大学 Image accurate segmentation method fusing deep learning network and watershed algorithm
CN109886271B (en) * 2019-01-22 2021-01-26 浙江大学 Image accurate segmentation method integrating deep learning network and improving edge detection
CN110222664B (en) * 2019-06-13 2021-07-02 河南牧业经济学院 Intelligent pig housing monitoring system based on video activity analysis
CN110544258B (en) * 2019-08-30 2021-05-25 北京海益同展信息科技有限公司 Image segmentation method and device, electronic equipment and storage medium
CN110992301A (en) * 2019-10-14 2020-04-10 数量级(上海)信息技术有限公司 Gas contour identification method
CN110889418A (en) * 2019-11-04 2020-03-17 数量级(上海)信息技术有限公司 Gas contour identification method
CN111161292B (en) * 2019-11-21 2023-09-05 合肥合工安驰智能科技有限公司 Ore scale measurement method and application system
CN111489387B (en) * 2020-04-09 2023-10-20 湖南盛鼎科技发展有限责任公司 Remote sensing image building area calculation method
CN111709333B (en) * 2020-06-04 2022-05-20 南京农业大学 Tracing early warning system based on abnormal excrement of cage-raised chickens and health monitoring method
CN111915636B (en) * 2020-07-03 2023-10-24 闽江学院 Method and device for positioning and dividing waste targets
CN112085696B (en) * 2020-07-24 2024-02-23 中国科学院深圳先进技术研究院 Training method and segmentation method for medical image segmentation network model and related equipment
CN111932447B (en) * 2020-08-04 2024-03-22 中国建设银行股份有限公司 Picture processing method, device, equipment and storage medium
CN112508910A (en) * 2020-12-02 2021-03-16 创新奇智(深圳)技术有限公司 Defect extraction method and device for multi-classification defect detection
CN113516084B (en) * 2021-07-20 2023-04-25 海南长光卫星信息技术有限公司 Semi-supervised classification method, device, equipment and medium for high-resolution remote sensing image
CN113947617B (en) * 2021-10-19 2024-04-16 华南农业大学 Multi-target tracking method for suckling piglets based on long and short memories
CN117436452B (en) * 2023-12-15 2024-02-23 西南石油大学 Financial entity identification method integrating context awareness and multi-level features

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106920243A (en) * 2017-03-09 2017-07-04 桂林电子科技大学 The ceramic material part method for sequence image segmentation of improved full convolutional neural networks
CN107016415A (en) * 2017-04-12 2017-08-04 合肥工业大学 A kind of coloured image Color Semantic sorting technique based on full convolutional network
CN107025440A (en) * 2017-03-27 2017-08-08 北京航空航天大学 A kind of remote sensing images method for extracting roads based on new convolutional neural networks

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106920243A (en) * 2017-03-09 2017-07-04 桂林电子科技大学 The ceramic material part method for sequence image segmentation of improved full convolutional neural networks
CN107025440A (en) * 2017-03-27 2017-08-08 北京航空航天大学 A kind of remote sensing images method for extracting roads based on new convolutional neural networks
CN107016415A (en) * 2017-04-12 2017-08-04 合肥工业大学 A kind of coloured image Color Semantic sorting technique based on full convolutional network

Also Published As

Publication number Publication date
CN107527351A (en) 2017-12-29

Similar Documents

Publication Publication Date Title
CN107527351B (en) Lactating sow image segmentation method fusing FCN and threshold segmentation
CN111178197B (en) Mass R-CNN and Soft-NMS fusion based group-fed adherent pig example segmentation method
CN104992223B (en) Intensive Population size estimation method based on deep learning
CN106778902B (en) Dairy cow individual identification method based on deep convolutional neural network
Zhang et al. Automatic fish counting method using image density grading and local regression
CN111652317B (en) Super-parameter image segmentation method based on Bayes deep learning
CN112750106B (en) Nuclear staining cell counting method based on incomplete marker deep learning, computer equipment and storage medium
CN113408584B (en) RGB-D multi-modal feature fusion 3D target detection method
CN106340016A (en) DNA quantitative analysis method based on cell microscope image
CN111968081B (en) Automatic fish shoal counting method and device, electronic equipment and storage medium
Yang et al. High-accuracy image segmentation for lactating sows using a fully convolutional network
CN107506792B (en) Semi-supervised salient object detection method
CN113591671B (en) Fish growth identification detection method based on Mask-Rcnn
CN110853070A (en) Underwater sea cucumber image segmentation method based on significance and Grabcut
Gleason et al. A fusion approach for tree crown delineation from lidar data.
CN112464983A (en) Small sample learning method for apple tree leaf disease image classification
CN112183448B (en) Method for dividing pod-removed soybean image based on three-level classification and multi-scale FCN
CN113111716B (en) Remote sensing image semiautomatic labeling method and device based on deep learning
Gonçalves et al. Carcass image segmentation using CNN-based methods
CN110751191A (en) Image classification method and system
CN112258525A (en) Image abundance statistics and population recognition algorithm based on bird high frame frequency sequence
CN115731282A (en) Underwater fish weight estimation method and system based on deep learning and electronic equipment
CN115471871A (en) Sheldrake gender classification and identification method based on target detection and classification network
Muñoz-Benavent et al. Impact evaluation of deep learning on image segmentation for automatic bluefin tuna sizing
CN113077438B (en) Cell nucleus region extraction method and imaging method for multi-cell nucleus color image

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant