WO2020125057A1 - 牲畜个数的识别方法及装置 - Google Patents

牲畜个数的识别方法及装置 Download PDF

Info

Publication number
WO2020125057A1
WO2020125057A1 PCT/CN2019/103328 CN2019103328W WO2020125057A1 WO 2020125057 A1 WO2020125057 A1 WO 2020125057A1 CN 2019103328 W CN2019103328 W CN 2019103328W WO 2020125057 A1 WO2020125057 A1 WO 2020125057A1
Authority
WO
WIPO (PCT)
Prior art keywords
contour
family
contours
abnormal
images
Prior art date
Application number
PCT/CN2019/103328
Other languages
English (en)
French (fr)
Inventor
苏睿
Original Assignee
北京海益同展信息科技有限公司
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 北京海益同展信息科技有限公司 filed Critical 北京海益同展信息科技有限公司
Publication of WO2020125057A1 publication Critical patent/WO2020125057A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • 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/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume

Definitions

  • the invention relates to the field of computer technology, in particular to a method and device for identifying the number of livestock.
  • the related algorithms are mainly used to estimate the population density, and there are not many scenes to identify the number of livestock.
  • the crowd counting algorithm in surveillance video usually has two methods of visual feature trajectory clustering and feature-based regression.
  • Visual feature trajectory clustering is generally aimed at video image sequences, KLT tracker clustering method is used, and the number of people is estimated by the number of trajectory clustering.
  • the feature-based regression is generally divided into the following three steps: 1 Foreground segmentation: The purpose of foreground segmentation is to segment the crowd from the image to facilitate subsequent feature extraction. The quality of segmentation directly affects the final counting accuracy, so this is a limitation of traditional An important factor in algorithm performance. 2Feature extraction: extract various low-level features from the segmented foreground. 3Regression of the number of people: return the extracted features to the number of people in the image.
  • Convolutional neural networks implement end-to-end training without foreground segmentation and manual design and feature extraction. After multiple layers of convolution, high-level semantic features are obtained.
  • CVPR2015's Cross-sceneCrowdCountingviaDeepConvolutionalNeuralNetworks proposed a deep convolutional neural network model suitable for crowd counting as shown in Figure 1. For better expression ability, the population density and total population of the image block are alternately returned to realize the number estimation.
  • a data-driven method is proposed to select samples from the training data to fine-tune the pre-trained CNN model to adapt to unknown application scenarios.
  • an embodiment of the present invention provides a method and apparatus for identifying the number of livestock. After the semantic segmentation of the first image is performed to obtain the foreground probability density map of the first image, the machine learning model post-processing logic is used to determine Counting the number of animals in the original image improves the robustness of the multi-scenario application for identifying the number of animals. At the same time, the foreground probability density map is binarized by different thresholds, and post-processing logic judgment is performed among multiple second images, which improves the recall rate and accuracy rate of the livestock number identification method.
  • a method for identifying the number of animals which includes: acquiring an original image, and marking the animals in the original image to obtain a first image; based on a convolutional neural network, the first Image semantic segmentation of an image to obtain the foreground probability density map of the first image; based on different thresholds, the foreground probability density map is binarized to obtain multiple second images; and based on the machine learning model, the Post-processing logic judgment is performed on the multiple second images to obtain the number of animals in the original image.
  • the method before performing post-processing logic judgment on the plurality of second images based on the machine learning model to obtain the number of animals in the original image, the method includes: based on The family contour feature information optimizes the abnormal contours of the multiple second images.
  • the optimizing the abnormal contours of the plurality of second images based on the multi-family contour feature information corresponding to the plurality of second images respectively includes: extracting the plurality of second images using a contour extraction function The outline of the multi-family contour set corresponding to the plurality of second images and the number of animals in the a priori original image; extracting features of the multi-family contour set corresponding to the plurality of second images, A multi-family first feature data set corresponding to the multiple second images is obtained.
  • the optimizing the abnormal contours of the plurality of second images based on the multi-family contour feature information corresponding to the plurality of second images further includes: based on a random forest model, the multi-family first Sort the features of the feature data set to obtain the importance order of the features of the multi-family first feature data set; based on the importance order of the features of the multi-family first feature data set, the features that are not important Removal to obtain the multi-family second feature data set
  • the optimizing the abnormal contours of the plurality of second images based on the multi-family contour feature information corresponding to the plurality of second images further includes: based on the multi-family second feature data set, An adaptive lifting algorithm model is used to filter and classify the multi-family contour set corresponding to the plurality of second images; wherein, the screening classification result includes: the size of each contour of the multi-family contour set.
  • the optimizing the abnormal contours of the plurality of second images based on the multi-family contour feature information corresponding to the plurality of second images further includes: if corresponding to the plurality of second images If there is no abnormal contour in the multi-ethnic contour set, the contour in the multi-ethnic contour set is marked as a normal contour.
  • the optimizing the abnormal contours of the plurality of second images based on the multi-family contour feature information corresponding to the plurality of second images further includes: if corresponding to the plurality of second images If there is an abnormal contour in the multi-family contour set, the qualified contour in the multi-family contour set is marked as a normal contour, and the unqualified contour in the multi-family contour set is marked as an abnormal contour; based on the multi-family The mutual verification of contour sets corrects the abnormal contour.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set includes: acquiring the contour set to which the abnormal contour belongs to obtain the first family contour set; acquiring the abnormal contour is not Belonging to a contour set to obtain a second family contour set; and comparing the size of the area of the abnormal contour and the contour of the second family contour set.
  • the correcting the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the area of the abnormal contour is larger than the contour of the second-family contour set, determining In the screening classification result, whether the area of the abnormal contour is larger than the contour of the second family contour set.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: in the screening classification result, if the area of the abnormal contour is larger than the second-family contour For the contours of the set, the number of contours included in the second family contour set is calculated; and it is determined whether the number of contours included in the second family contour set is greater than or equal to 3.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the number of contours contained in the second-family contour set is greater than or equal to 3, In the second-group contour set, three contours closest to the abnormal contour are found.
  • the correcting the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the number of contours contained in the second-family contour set is less than 3, then in the All contours except the abnormal contour are found in the first-group contour set.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: determining whether the number of contours belonging to the second-family contour set included in the abnormal contour is Greater than 1.
  • the correcting the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the number of contours belonging to the second family contour set included in the abnormal contour is equal to 1, the abnormal contour is cut into two.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the number of contours belonging to the second family contour set included in the abnormal contour is greater than If it is equal to 2, it is determined whether the number of contours belonging to the second family contour set included in the abnormal contour is greater than or equal to 3.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the number of contours belonging to the second family contour set included in the abnormal contour is less than 3, the abnormal contour is replaced by a contour belonging to the second family contour set included in the abnormal contour.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the number of contours belonging to the second family contour set included in the abnormal contour is greater than If it is equal to 3, it is judged whether the contours belonging to the second family contour set included in the abnormal contour belong to the first family contour set.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the contours included in the abnormal contour that belong to the second-family contour set all belong to the For the first family contour set, the abnormal contour is replaced by the contour belonging to the second family contour set included in the abnormal contour.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the contours belonging to the second-family contour set included in the abnormal contour do not all belong to all The first family contour set, then delete the contours that belong to the second family contour set and do not belong to the first family contour set in the abnormal contour; and the remaining contained in the abnormal contour belong to the first The outline of the two-group outline set replaces the abnormal outline.
  • the correcting the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the area of the abnormal contour is smaller than the contour in the second-family contour set, calculating The number of outlines included in the first family outline set and determine whether the number of outlines included in the first family outline set is greater than or equal to 5.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: in the screening classification result, if the area of the abnormal contour is smaller than the second-family contour For the contours in the set, the number of contours included in the first family contour set is calculated and it is determined whether the number of contours included in the first family contour set is greater than or equal to 5.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the number of contours contained in the first-family contour set is greater than or equal to 5, then Find the four contours closest to the abnormal contour in the first-group contour set.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: if the number of contours included in the first family contour set is less than 5, then All contours except the abnormal contour are selected from the first-group contour set.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: among the four contours closest to the abnormal contour or in the step of dividing the abnormal Among all the outlines except the outline, it is judged whether every two outlines can be merged.
  • the correction of the abnormal contour based on the mutual verification of the multi-family contour set further includes: if every two contours can be merged, the four closest to the abnormal contour Two contours or every two contours except the abnormal contour are merged.
  • the correcting the abnormal contour based on the mutual verification of the multi-family contour set further includes: deleting the abnormal contour if every two contours cannot be merged.
  • the post-processing logic judgment on the plurality of second images based on the machine learning model to obtain the number of animals in the original image includes: calculating the number of contours of the plurality of second images respectively ;
  • the post-processing logic judgment is performed on the plurality of second images based on the machine learning model to obtain the number of animals in the original image, further including: if none of the outlines of the plurality of second images After correction, it is determined whether the number of contours included in the plurality of second images is the same.
  • the post-processing logic judgment is performed on the plurality of second images based on the machine learning model to obtain the number of animals in the original image, further including: if the outlines included in the plurality of second images If the number is the same, the number of animals in the original image is the number of outlines contained in the plurality of second images.
  • the post-processing logic judgment is performed on the plurality of second images based on the machine learning model to obtain the number of animals in the original image, further including: if the outlines included in the plurality of second images If the number is not the same, it is judged whether the number of animals in the a priori original image is less than or equal to 9.
  • the post-processing logic judgment is performed on the multiple second images based on the machine learning model to obtain the number of animals in the original image, further including: if the outlines included in the multiple second images are all After correction, it is determined whether the number of animals in the a priori original image is 9 or less.
  • the post-processing logic judgment is performed on the plurality of second images based on the machine learning model to obtain the number of animals in the original image, further including: if the animals in the a priori original image The number of is less than or equal to 9, then the number of contours in the second image corresponding to the low threshold is output.
  • the post-processing logic judgment is performed on the plurality of second images based on the machine learning model to obtain the number of animals in the original image, further including: if the animals in the a priori original image If the number is greater than 9, the number of contours in the second image corresponding to the high threshold is output.
  • the marking of the livestock in the original image includes: drawing dots on the head and tail of the livestock; connecting the head and tail dots end to end with an elliptical long axis; and Draw circles with the dots of the head and tail as the center of the circle, so that both circles are on the torso of the livestock.
  • the plurality of second feature data sets include features of at least one of the following features: contour area/minimum circumscribed rectangular area, principal component analysis major axis length/principal component analysis minor axis length, principal component analysis major axis length /Length of minimum outline circumscribed rectangle and length of principal component analysis minor axis/Width of minimum outline circumscribed rectangle.
  • a device for identifying the number of livestock including: a data acquisition unit for acquiring an original image, and marking the animals in the original image to obtain a first image; image semantic segmentation A unit for semantically segmenting the first image based on a convolutional neural network to obtain a foreground probability density map of the first image; a binarization unit for segmenting the foreground probability based on different thresholds The density map is binarized to obtain multiple second images; and a logic judgment unit is used to perform post-processing logic judgment on the multiple second images based on the machine learning model to obtain the number of animals in the original image .
  • the apparatus for recognizing the number of livestock further includes: an optimizing unit configured to perform abnormal contours of the plurality of second images based on the multi-family contour feature information corresponding to the plurality of second images respectively optimization.
  • a livestock number identification control device including: a processor; a memory for storing processor executable instructions; wherein, the processor is configured to execute the aforementioned livestock number Identification method.
  • a computer-readable storage medium characterized in that the computer-readable storage medium stores computer instructions, and when the computer instructions are executed, the identification of the number of livestock as described above is realized method.
  • An embodiment of the present invention has the following advantages or beneficial effects: after semantically segmenting the first image obtained after the original image is annotated, using machine learning classification to perform post-processing logic judgment on multiple second images, which improves Robustness of multi-scenario applications to identify the number of animals.
  • a plurality of second images are obtained based on different thresholds, and post-processing logic judgment is performed between the plurality of second images, which improves the recall rate and accuracy rate of the livestock number identification method.
  • FIG. 1 shows a schematic structural diagram of a deep convolutional neural network model for crowd counting according to an embodiment of the prior art.
  • FIG. 2 shows a schematic flowchart of a method for identifying the number of livestock according to an embodiment of the present invention.
  • FIG. 3a shows an annotation image of the original image according to an embodiment of the present invention.
  • Fig. 3b shows a binary image of the original image according to an embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of a method for identifying the number of livestock according to an embodiment of the present invention.
  • FIG. 5 shows a schematic flowchart of a method for identifying the number of livestock according to an embodiment of the present invention.
  • FIG. 6 shows a profile description diagram of an embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of a device for identifying the number of livestock according to an embodiment of the present invention.
  • FIG. 8 shows a schematic structural diagram of a device for identifying and controlling the number of livestock according to an embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of a method for identifying the number of livestock according to an embodiment of the present invention, and specifically includes the following steps:
  • step S201 an original image is obtained, and the animals in the original image are marked to obtain a first image.
  • FIG. 3a is a label diagram of an original image according to an embodiment of the present invention. As shown in FIG. 3a, after acquiring the original image collected by the camera, draw dots on the head and tail of the visible part of each animal in the original image. Connect the dots of the head and tail of the animal with the long axis of the ellipse to ensure that the ellipse covers the whole body of the animal. The long axis of the ellipse of larger animals is longer than the long axis of the ellipse of ordinary animals.
  • step S202 based on the convolutional neural network, image semantic segmentation is performed on the first image to obtain a foreground probability density map of the first image.
  • the U-net algorithm model is used to semantically segment the first image to obtain a foreground probability density map of the first image.
  • the probability value of each pixel in the foreground probability density map is between 0 and 1.
  • step S203 based on different thresholds, the foreground probability density map is binarized to obtain multiple second images.
  • Figure 3b is a binary image of the original image according to an embodiment of the invention.
  • step S204 post-processing logic judgment is performed on the plurality of second images based on the machine learning model to obtain the number of animals in the original image.
  • a post-processing logic judgment is performed between the plurality of second images after the semantic segmentation of the image using a machine learning classification method to obtain the number of animals in the original image.
  • a post-processing logic judgment is performed on multiple second images using a machine learning classification method, which improves the recognition of the number of livestock in multiple scenes Robustness of the application.
  • a plurality of second images are obtained based on different thresholds, and post-processing logic judgment is performed between the plurality of second images, which improves the recall rate and accuracy rate of the livestock number identification method.
  • FIG. 4 is a schematic flowchart of a method for identifying the number of livestock according to an embodiment of the present invention. It includes the following steps:
  • step S401 an original image is obtained, and the animals in the original image are marked to obtain a first image.
  • step S402 based on the convolutional neural network, image semantic segmentation is performed on the first image to obtain a foreground probability density map of the first image.
  • step S403 the foreground probability density map is binarized based on different thresholds to obtain multiple second images.
  • step S404 based on the multi-family contour feature information corresponding to the multiple second images, the abnormal contours of the multiple second images are optimized.
  • step S405 based on the machine learning model, post-processing logic judgment is performed on the plurality of second images to obtain the number of animals in the original image.
  • Steps S401 to S402 are the same as S201 to S202 of FIG. 2 and will not be repeated here.
  • a foreground probability density map obtained by image semantic segmentation is obtained.
  • Two thresholds of 0.1 and 0.7 are used to binarize the foreground probability density map, respectively, to obtain two binary maps. Use the two binary maps as two second images. In practical engineering applications, different thresholds can be selected as needed to binarize the foreground probability density map.
  • a contour extraction function (FindContours) is used to extract the contours of the two second images, respectively, to obtain a two-group contour set corresponding to the two second images and a priori the number of animals in the original image. Since the area of each contour is different and the features are not universal, feature extraction is performed on the obtained two-family contour set. Characterize each contour, and perform principal component analysis on the position of each point in the second image to obtain the direction of the main axis. Calculate the minimum circumscribed rectangle (minbox) of the contour, the area of the contour, the length of the main axis, etc. to construct the features used in the machine learning model, and use these features to represent each contour.
  • minbox minimum circumscribed rectangle
  • the feature set obtained by performing feature extraction on the two-family contour set is used as the first two-family feature data set corresponding to the two second images.
  • Based on the random forest model sort the features of the two family first feature data sets to obtain the importance order of the features of the two family first feature data sets; based on the features of the two family first feature data sets In order of importance, the unimportant features are eliminated to obtain the second feature data set of the two families.
  • an adaptive lifting algorithm (Adaboost) model is used to filter and classify the two family contour sets corresponding to the two second images; wherein, the filtering classification results include: The size of the area of each profile.
  • the contours in the two family contour sets are marked as normal contours. If there are abnormal contours in the two family contour sets corresponding to the two second images, the qualified contours in the two family contour sets are marked as normal contours, and the unqualified contours in the two family contour sets are marked as abnormal contours; Based on the mutual verification of the two family contour sets, the abnormal contour is corrected.
  • the area of the outlines contained in the outline set corresponding to the high threshold is relatively small, there are few cases of outline adhesion, and the recall rate is low. The recall rate of the contours contained in the contour set corresponding to the low threshold will be higher, but there will be contour sticking, so after detecting abnormal contours, another set of contour sets is combined to correct the abnormal contours to ensure the accurate number.
  • step S405 in the machine learning model, the number of contours contained in the two second images are respectively calculated; it is determined whether the contours contained in the two second images have been corrected. If the contours included in the two second images have not been corrected, it is determined whether the number of contours included in the two second images is the same. If the number of outlines contained in the two second images is the same, the number of animals in the original image is the number of outlines contained in the two second images and the level of identification of the number of animals is A, that is, the number of animals The accuracy of the number identification method is 99%. If the number of contours contained in the two second images is not the same, it is determined whether the number of animals in the a priori original image is less than or equal to 9.
  • the contours contained in the two second images are both corrected, it is determined whether the number of animals in the a priori original image is less than or equal to 9. If the number of animals in the prior image in the original image is less than or equal to 9, the number of contours in the second image corresponding to the low threshold (0.1) is output and the level of identification of the number of animals is B, that is, the number of animals The accuracy of the identification method is 95%. If the number of animals in the prior image in the original image is greater than 9, the number of contours in the second image corresponding to the high threshold (0.7) is output and the level of number identification of the animal is B, that is, the number identification of the animal The accuracy of the method is 95%.
  • an adaptive lifting algorithm (Adaboost) model is used to classify the results of image semantic segmentation to improve the recall rate and accuracy of the livestock number identification method rate.
  • Adaboost adaptive lifting algorithm
  • the features of the first feature data set of the two families are sorted separately, and the unimportant features are eliminated to obtain the second feature data set of the two families, which improves the accuracy of describing the contour features and further improves the livestock.
  • the recall rate and accuracy rate of the number identification method is used to classify the results of image semantic segmentation to improve the recall rate and accuracy of the livestock number identification method rate.
  • FIG. 5 is a schematic flowchart of a method for identifying the number of livestock according to an embodiment of the present invention. Specifically, in step S404 in FIG. 4, the process of correcting the abnormal contour based on mutual verification of the multi-family contour set. It includes the following steps:
  • step S501 a contour set to which the abnormal contour belongs is obtained to obtain a first family contour set; a contour set to which the abnormal contour does not belong is obtained to obtain a second family contour set; and the abnormal contour is compared with the The size of the area of the outline of the second-group outline collection. If the area of the abnormal contour is larger than the contour of the second family contour set, S502 is executed. If the area of the abnormal contour is smaller than the contour in the second family contour set, S512 is executed.
  • step S502 it is determined whether the area of the abnormal contour is larger than the contour of the second family contour set in the screening classification result.
  • S503 if the area of the abnormal contour is larger than the contour of the second family contour set, S503 is executed.
  • S512 is executed.
  • step S503 the number of contours included in the second family contour set is calculated, and it is determined whether the number of contours included in the second family contour set is greater than or equal to 3. If the number of contours included in the second family contour set is greater than or equal to 3, S504 is executed. If the number of contours included in the second family contour set is less than 3, S505 is executed.
  • step S504 3 contours closest to the abnormal contour are found in the second family contour set.
  • step S505 all contours except the abnormal contour are found in the first-group contour set.
  • step S506 it is determined whether the number of contours belonging to the second family contour set included in the abnormal contour is greater than 1. If the number of contours belonging to the second family contour set included in the abnormal contour is equal to 1, S507 is executed. If the number of contours belonging to the second family contour set included in the abnormal contour is greater than or equal to 2, S508 is executed.
  • step S507 the abnormal contour is cut into two.
  • step S508 it is determined whether the number of contours belonging to the second family contour set included in the abnormal contour is greater than or equal to 3. If the number of contours included in the abnormal contour belonging to the second family contour set is less than 3, S509 is executed. If the number of contours belonging to the second family contour set included in the abnormal contour is greater than or equal to 3, S510 is executed.
  • step S509 the abnormal contour is replaced with the contour belonging to the second family contour set included in the abnormal contour.
  • step S510 it is determined whether the contours belonging to the second family contour set included in the abnormal contour belong to the first family contour set. If all the contours included in the abnormal contour belonging to the second family contour set belong to the first family contour set, S509 is executed. If not all the contours included in the abnormal contour belonging to the second family contour set belong to the first family contour set, S511 is executed.
  • step S511 after deleting contours belonging to the second family contour set and not belonging to the first family contour set among the abnormal contours, S509 is executed.
  • step S512 the number of contours included in the first family contour set is calculated and it is determined whether the number of contours included in the first family contour set is greater than or equal to 5. If the number of outlines contained in the first-group outline set is greater than or equal to 5, then S513 is executed. If the number of silhouettes included in the first family silhouette set is less than 5, then S514.
  • step S513 four contours closest to the abnormal contour are found in the first family contour set.
  • step S51 all contours except the abnormal contour are selected from the first-group contour set.
  • step S515 it is determined whether every two contours can be merged among the four contours closest to the abnormal contour or among all contours except the abnormal contour. If every two contours can be merged, S516 is executed. If it is impossible to merge between every two contours, S517 is executed.
  • step S5166 the four contours closest to the abnormal contour or every two contours other than the abnormal contour are merged.
  • step S517 the abnormal contour is deleted.
  • the abnormal contour belongs to Obtain the contour set to which the abnormal contour (A contour) belongs to obtain the first family contour set (A contours); obtain another contour set to which the abnormal contour (A contour) does not belong to obtain the second family contour set (B contours) ; And compare the size of the area of the contours contained in the abnormal contour (A contour) and the second family contour set (B contours). If the area of the abnormal contour (A contour) is larger than the contour contained in the second family contour set (B contours), it is judged whether the area of the abnormal contour (A contour) is larger than the second family in the screening classification result Contours (B contours) contours.
  • the number of contours contained in the second family contour set (B contours) is calculated And determine whether the number of contours contained in the second family contour set (B contours) is greater than or equal to 3. If the number of contours contained in the second family contour set (B contours) is greater than or equal to 3, then the three contours closest to the abnormal contour are found in the second family contour set (B contours). If the number of contours contained in the second family contour set (B contours) is less than 3, then all contours except the abnormal contour (A contour) are found in the first family contour set (A contours). Determine whether the number of contours included in the abnormal contour (A contour) belonging to the second family contour set (B contours) is greater than 1.
  • the abnormal contour (A contour) belonging to the second family contour set (B contours) is cut into two. If the number of contours included in the abnormal contour (A contour) belonging to the second family contour set (B contours) is greater than or equal to 2, then it is determined that the contours included in the abnormal contour (A contour) belong to the second family contour set (B contours) whether the number of contours is greater than or equal to 3. If the number of contours included in the abnormal contour (A contour) belonging to the second family contour set (B contours) is less than 3, then the contour contours included in the abnormal contour (A contour) belonging to the second family contour set ( B contours replace the abnormal contours (A contours).
  • the abnormal contour (A contour) belonging to the second family contour set (B contours) is greater than or equal to 3 If the number of contours included in the abnormal contour (A contour) belonging to the second family contour set (B contours) is greater than or equal to 3, it is determined that the contours included in the abnormal contour (A contour) belong to the second family Whether the outline of the contour set (B contours) belongs to the first set of contour sets (A contours). If the contours contained in the abnormal contour (A contour) belonging to the second family contour set (B contours) all belong to the first family contour set (A contours), then the abnormal contour (A contour) contains The contours of the second set of contours (B contours) replace the abnormal contours (A contours).
  • the abnormal contour (A contour) belonging to the second family contour set (B contours) do not all belong to the first family contour set (A contours)
  • the abnormal contour (A contour) belongs to the The second family contour set (B contours) and the contours that do not belong to the first family contour set (A contours) are deleted; and the remaining contained in the abnormal contour (A contours) belonging to the second family contour set (B contours)
  • the contour of A replaces the abnormal contour (A contour).
  • the number of contours contained in the first family contour set (A contours) is calculated and the first Whether the number of contours contained in a family of contour sets (A contours) is greater than or equal to 5.
  • the screening classification result if the area of the abnormal contour (A contour) is smaller than the contour in the second family contour set (B contours), then the number of contours contained in the first family contour set (A contours) is calculated. Count and determine whether the number of contours contained in the first set of contours (A contours) is greater than or equal to 5.
  • the four contours closest to the abnormal contour (A contour) are found in the first family contour set (A contours). If the number of contours contained in the first family contour set (A contours) is less than 5, then all contours except the abnormal contour (A contour) are selected in the first family contour set (A contours). Among the four contours closest to the abnormal contour (A contours) in the first set of contours (A contours) or other than the abnormal contour (A contours) in the first contour set (A contours) Among all contours, judge whether every two contours can be merged.
  • Every two contours can be merged, the four contours closest to the abnormal contour (A contour) or every two contours in all contours except the abnormal contour (A contour) are merged. If it is not possible to merge between every two contours, delete the abnormal contour (A contour).
  • the two abnormal contours are merged.
  • the abnormal contour has a head-to-tail connection
  • the abnormal contour is segmented.
  • the mutually independent contours are marked as abnormal, and the independent contour is not associated with other contours, the independent contour is deleted. Based on the mutual verification of the two family contour sets, the abnormal contour is corrected, which further improves the accuracy of livestock number identification.
  • the plurality of second feature data sets include features of at least one of the following features: contour area/minimum circumscribed rectangular area, principal component analysis spindle length/principal component analysis Length of minor axis, principal component analysis, length of main axis/minimum circumscribed rectangle length, and principal component analysis of minor axis length/minimum width of circumscribed rectangle.
  • FIG. 6 is a description diagram of outline features of an embodiment of the present invention. As shown in Fig. 6, the dotted lines are all the features of the two sets of contour sets, and the third row of features is the non-linear combination of the second row of features.
  • contour is an area contour composed of many point coordinates, the data structure of the contour is [x1, y1], [x2, y2], [x3, y3], ...] .
  • the center of gravity of the contour is within the contour (feature 1), the area of the contour (feature 2), and the average area of all the contours returned by the image semantic segmentation of a picture (feature 3) through the function in opencv
  • Divide the standard deviation of all contour areas returned (feature 4) use the coordinate data as a two-dimensional variable to do the principal component analysis to obtain the contribution rate of the principal component (feature 5), a straight line passing through the center of the contour along the principal component direction and two contours
  • the third row of features from left to right is: the ratio of the second row of features 2 to 9 (feature 12), the ratio of the second row of features 6 to feature 7 (feature 13), the second row of features 6 and feature 10 Ratio (feature 14), ratio of feature 7 to feature 11 in the second row (feature 15).
  • extracting features for each contour to obtain a universal feature set improves the accuracy of screening classification of multi-family contour sets corresponding to multiple second images using an adaptive lifting algorithm model.
  • the device for identifying the number of livestock includes a data acquisition unit 701, an image semantic segmentation unit 702, a binarization unit 703, a logic judgment unit 704, and an optimization unit 705.
  • the data obtaining unit 701 is used to obtain an original image, and mark the livestock in the original image to obtain a first image.
  • the image semantic segmentation unit 702 is used to perform image semantic segmentation on the first image based on the convolutional neural network to obtain a foreground probability density map of the first image.
  • the binarization unit 703 is configured to binarize the foreground probability density map based on different thresholds to obtain multiple second images.
  • the logic judgment unit 704 is configured to perform post-processing logic judgment on the plurality of second images based on the machine learning model to obtain the number of animals in the original image.
  • the optimization unit 705 is configured to optimize the abnormal contours of the multiple second images based on the multi-family contour feature information corresponding to the multiple second images, respectively.
  • the data acquisition unit 701 is used to acquire the original image, and mark the livestock in the original image to obtain the first image.
  • the image semantic segmentation unit 702 is used to perform image semantic segmentation on the first image based on the convolutional neural network to obtain a foreground probability density map of the first image.
  • the binarization unit 703 is used to binarize the foreground probability density map based on different thresholds to obtain multiple second images.
  • the logic judgment unit 704 is configured to perform post-processing logic judgment on multiple second images based on the machine learning model to obtain the number of animals in the original image.
  • the optimization unit 705 is configured to optimize the abnormal contours of the multiple second images based on the multi-family contour feature information corresponding to the multiple second images, respectively.
  • FIG. 8 is a structural diagram of a device for identifying the number of livestock according to an embodiment of the present invention.
  • the device shown in FIG. 8 is only an example, and should not constitute any limitation on the functions and use scope of the embodiments of the present invention.
  • the apparatus includes a processor 801, a memory 802, and an input-output device 803 connected through a bus.
  • the memory 802 includes a read-only memory (ROM) and a random access memory (RAM).
  • the memory 802 stores various computer instructions and data required to perform system functions.
  • the processor 801 reads various computer instructions from the memory 802 to execute Various appropriate actions and treatments.
  • Input and output devices include input sections such as keyboards, mice, etc.; include output sections such as cathode ray tubes (CRT), liquid crystal displays (LCD), etc., and speakers; storage sections including hard disks; and include such as LAN cards, modems, etc.
  • the communication part of the network interface card includes a processor 801, a memory 802, and an input-output device 803 connected through a bus.
  • the memory 802 includes a read-only memory (ROM) and a random access memory (RAM).
  • the memory 802 stores various computer instructions and data required to perform system functions.
  • the processor 801 reads various
  • the memory 802 also stores the following computer instructions to complete the operations specified by the method for identifying the number of animals in the embodiment of the present invention: acquiring the original image, and marking the animals in the original image to obtain the first image; based on the convolution A neural network performs image semantic segmentation on the first image to obtain a foreground probability density map of the first image; based on different thresholds, binarizes the foreground probability density map to obtain multiple second images; And based on the post-processing logic judgment of the plurality of second images, the number of animals in the original image is obtained.
  • an embodiment of the present invention provides a computer-readable storage medium that stores computer instructions that, when executed, implement the operations specified by the above-mentioned livestock number identification method.
  • the flowcharts and block diagrams in the drawings illustrate possible system frameworks, functions, and operations of the system, method, and apparatus of the embodiments of the present invention.
  • the blocks on the flowcharts and block diagrams may represent a module, a program segment, or just a segment
  • the code, the module, the program segment, and the code are all executable instructions used to implement prescribed logic functions. It should also be noted that the executable instructions implementing the prescribed logical functions can be recombined to generate new modules and program segments. Therefore, the blocks and the order of the blocks in the drawings are only used to better illustrate the processes and steps of the embodiments, and should not be taken as limitations to the invention itself.

Landscapes

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

Abstract

本发明实施例公开了一种牲畜个数的识别方法及装置,涉及计算机技术领域。其中方法包括:获取原始图像,并对所述原始图像中的牲畜进行标记,得到第一图像;基于卷积神经网络,对所述第一图像进行图像语义分割,得到所述第一图像的前景概率密度图;基于不同的阈值,对所述前景概率密度图进行二值化,得到多个第二图像;以及基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数。根据本发明实施例的牲畜个数的识别方法,对第一图像进行图像语义分割,得到第一图像的前景概率密度图之后,通过机器学习模型的后处理逻辑判断来统计原始图像中牲畜的个数,提高了识别牲畜个数的多场景应用的鲁棒性。

Description

牲畜个数的识别方法及装置
本申请要求了2018年12月20日提交的、申请号为201811562574.2、发明名称为“牲畜个数的识别方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机技术领域,具体涉及一种牲畜个数的识别方法及装置。
背景技术
牲畜的售卖场景很多,通常需对牲畜的个数做记录。在售卖牲畜的过程中,地秤的空间构造通常比较狭小,常常造成牲畜群密度增加和牲畜重叠的现象,这给养殖户记录牲畜个数造成很大困难。因此,通过人工智能方式,对摄像头返回的图片和视频进行运算,通过识别结果来记录牲畜个数能够有效的节省人力成本、规范流程同时方便管理。
目前,相关算法主要是做人群密度估计的,而识别牲畜个数的场景并不多。相关技术中,监控视频中人群计数算法通常有视觉特征轨迹类聚和基于特征的回归两种方法。视觉特征轨迹类聚一般是针对视频图像序列,用KLT跟踪器聚类的方法,通过轨迹聚类得到的数目来估计人数。基于特征的回归一般分为以下3个步骤:①前景分割:前景分割的目的是将人群从图像中分割出来便于后面的特征提取,分割性能的好坏直接关系最终计数精度,因此这是限制传统算法性能的一个重要因素。②特征提取:从分割得到的前景提取各种不同的底层特征。③人数回归:将提取到的特征回归到图像中的人数。
在监控视频的人群计数算法中,前景分割是不可或缺的步骤,然而前景分割本身就是一个比较困难的任务,算法性能很大程度地受其影响。卷积神经网络实现了端对端训练,无需进行前景分割以及人工设计和提取特征,经过多层卷积之后得到高层的语义特征。CVPR2015的Cross-scene Crowd Counting via Deep Convolutional Neural Networks提出了一个适用人群计数的深度卷积神经网络模型如图1所示,经过多层卷积之后得到高层的语义特征相比于人工特征对人群有更好的表述能力,交替回归该图像块的人群密度和人群总数来实现人数估计。此外,提出了一种数据驱动的方法从训练数据中选择样本来微调预训练好的CNN模型,以适应未知的应用场景。然而,开发高效的特征来描述人群和人群场景需要新的特定描述信息。场景之间存在不同的透视扭曲、人群分布以及光照条件,因此在没有另外的训练数据的情况下,场景之间的计数模型很难互相使用。现存的人群计数数据集不足以支持跨场景人群计数。
发明内容
有鉴于此,本发明实施例提供了一种牲畜个数的识别方法和装置,对第一图像进行图像语义分割,得到第一图像的前景概率密度图之后,通过机器学习模型后处理逻辑判断来统计原始图像中牲畜的个数,提高了识别牲畜个数的多场景应用的鲁棒性。同时,通过不同阈值来对该前景概率密度图进行二值化,并在多个第二图像之间进行后处理逻辑判断,提高了牲畜个数的识别方法的召回率和准确率。
根据本发明的一方面,提供一种牲畜个数的识别方法,包括:获取原始图像,并对所述原始图像中的牲畜进行标记,得到第一图像;基于卷积神经网络,对所述第一图像进行图像语义分割,得到所述第一图像的前景概率密度图;基于不同的阈值,对所述前景概率密度图进行二值化,得到多个第二图像;以及基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数。
优选地,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数之前,包括:基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化。
优选地,所述基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化,包括:采用轮廓提取函数提取所述多个第二图像的轮廓,得到所述多个第二图像对应的多族轮廓集合和先验的所述原始图像中牲畜的个数;提取所述多个第二图像对应的所述多族轮廓集合的特征,得到所述多个第二图像对应的多族第一特征数据集。
优选地,所述基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化,还包括:基于随机森林模型对所述多族第一特征数据集的各个特征进行排序,得到所述多族第一特征数据集的各个特征的重要性次序;基于所述多族第一特征数据集的各个特征的重要性次序,将不重要的特征剔除,得到多族第二特征数据集。
优选地,所述基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化,还包括:基于所述多族第二特征数据集,采用自适应提升算法模型对所述多个第二图像对应的所述多族轮廓集合进行筛选分类;其中,所述筛选分类结果中包括:所述多族轮廓集合的各个轮廓的面积的大小。
优选地,所述基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化,还包括:如果在所述多个第二图像对应的所述多族轮廓集合中不存在异常轮廓,则将所述多族轮廓集合中的轮廓标记为正常轮廓。
优选地,所述基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化,还包括:如果在所述多个第二图像对应的所述多族轮廓集合中存在异常轮廓,则将所述多族轮廓集合中合格的轮廓标记为正常轮廓,将所述多族轮廓集合中不合格的轮廓标记为异常轮廓;基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,包括:获取所述异常轮廓所属的轮廓集合,得到第一族轮廓集合;获取所述异常轮廓不属于的一个轮廓集合,得到第二族轮廓集合;以及比较所述异常轮廓和所述第二族轮廓集合的轮廓的面积的大小。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓的面积大于所述第二族轮廓集合的轮廓,则判断在所述筛选分类结果中,所述异常轮廓的面积是否大于所述第二族轮廓集合的轮廓。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:在所述筛选分类结果中,如果所述异常轮廓的面积大于所述第二族轮廓集合的轮廓,则计算所述第二族轮廓集合中包含的轮廓的个数;并且判断所述第二族轮廓集合中包含的轮廓的个数是否大于等于3。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述第二族轮廓集合中包含的轮廓的个数大于等于3,则在所述第二族轮廓集合中找到距离所述异常轮廓最近的3个轮廓。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述第二族轮廓集合中包含的轮廓的个数小于3,则在所述第一族轮廓集合中找到除所述异常轮廓之外的所有轮廓。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:判断所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数是否大于1。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数等于1,则将所述异常轮廓切割为两个。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数大于等于2,则判断所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数是否大于等于3。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数小于3,则将所述异常轮廓中包含 的属于所述第二族轮廓集合的轮廓代替所述异常轮廓。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数大于等于3,则判断所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓是否属于所述第一族轮廓集合。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓都属于所述第一族轮廓集合,则将所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓代替所述异常轮廓。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓并非都属于所述第一族轮廓集合,则将所述异常轮廓中属于所述第二族轮廓集合并且不属于所述第一族轮廓集合的轮廓删除;并且将所述异常轮廓中剩余包含的属于所述第二族轮廓集合的轮廓代替所述异常轮廓。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓的面积小于所述第二族轮廓集合中的轮廓,则计算所述第一族轮廓集合中包含的轮廓的个数并且判断所述第一族轮廓集合中包含的轮廓的个数是否大于等于5。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:在所述筛选分类结果中,如果所述异常轮廓的面积小于所述第二族轮廓集合中的轮廓,则计算所述第一族轮廓集合中包含的轮廓的个数并且判断所述第一族轮廓集合中包含的轮廓的个数是否大于等于5。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述第一族轮廓集合中包含的轮廓的个数大于等于5,则在所述第一族轮廓集合中找到距离所述异常轮廓最近的四个轮廓。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述第一族轮廓集合中包含的轮廓的个数小于5,则在所述第一族轮廓集合中选出除所述异常轮廓之外的所有轮廓。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:在所述距离所述异常轮廓最近的四个轮廓中或者在所述除所述异常轮廓之外的所有轮廓中,判断每两个轮廓之间是否可以合并。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果每两个轮廓之间可以合并,则将所述距离所述异常轮廓最近的四个轮廓或者所述除所述异常轮廓之外的所有轮廓中每两个轮廓合并。
优选地,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果每两个轮廓之间不可以合并,则将所述异常轮廓删除。
优选地,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,包括:分别计算所述多个第二图像的轮廓个数;
分别判断所述多个第二图像的轮廓是否经过修正。
优选地,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:如果所述多个第二图像的轮廓都没有经过修正,则判断所述多个第二图像包含的轮廓的个数是否相同。
优选地,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:如果所述多个第二图像包含的轮廓的个数相同,则所述原始图像中牲畜的个数为所述多个第二图像包含的轮廓的个数。
优选地,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:如果所述多个第二图像包含的轮廓的个数不相同,则判断所述先验的所述原始图像中牲畜的个数是否小于等于9。
优选地,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:如果所述多个第二图像包含的轮廓都经过修正,则判断所述先验的所述原始图像中牲畜的个数是否小于等于9。
优选地,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:如果所述先验的所述原始图像中牲畜的个数小于等于9,则输出低阈值对应的所述第二图像中轮廓的个数。
优选地,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:如果所述先验的所述原始图像中牲畜的个数大于9,则输出高阈值对应的所述第二图像中轮廓的个数。
优选地,所述对所述原始图像中的牲畜进行标记,包括:在所述牲畜的头部和尾部画圆点;用椭圆长轴首尾连接所述头部和所述尾部的圆点;以及以所述头部和所述尾部的圆点为圆心分别画圆,使两个圆都在所述牲畜的躯干上。
优选地,所述多个第二特征数据集中包括以下特征中的至少之一的特征:轮廓面积/轮廓最小外接矩形面积、主成分分析主轴长度/主成分分析次轴长度、主成分分析主轴长度/轮廓最小外接矩形的长和主成分分析次轴长度/轮廓最小外接矩形的宽。
根据本发明的另一方面,提供一种牲畜个数的识别装置,包括:数据获取单元,用于获取原 始图像,并对所述原始图像中的牲畜进行标记,得到第一图像;图像语义分割单元,用于基于卷积神经网络,对所述第一图像进行图像语义分割,得到所述第一图像的前景概率密度图;二值化单元,用于基于不同的阈值,对所述前景概率密度图进行二值化,得到多个第二图像;以及逻辑判断单元,用于基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数。
优选地,所述的牲畜个数的识别装置,还包括:优化单元,用于基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化。
根据本发明的又一方面,提供一种牲畜个数的识别控制装置,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为执行上述的牲畜个数的识别方法。
根据本发明的再一方面,提供一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机指令,所述计算机指令被执行时实现如上所述的牲畜个数的识别方法。
本发明的一个实施例具有以下优点或有益效果:对原始图像经标注后得到的第一图像做图像语义分割后,使用机器学习分类的方式对多个第二图像做后处理逻辑判断,提高了识别牲畜个数的多场景应用的鲁棒性。基于不同阈值得到多个第二图像,并在多个第二图像之间进行后处理逻辑判断,提高了牲畜个数的识别方法的召回率和准确率。
附图说明
通过以下参照附图对本发明实施例的描述,本发明的上述以及其他目的、特征和优点将更为清楚,在附图中:
图1示出现有技术中一个实施例的用于人群计数的深度卷积神经网络模型的结构示意图。
图2示出本发明的一个实施例的牲畜个数的识别方法的流程示意图。
图3a示出本发明的一个实施例的原始图像的标注图。
图3b示出本发明的一个实施例的原始图像的二值图。
图4示出本发明的一个实施例的牲畜个数的识别方法的流程示意图。
图5示出本发明的一个实施例的牲畜个数的识别方法的流程示意图。
图6示出本发明的一个实施例的轮廓特征描述图。
图7示出本发明的一个实施例的牲畜个数的识别装置的结构示意图。
图8示出本发明的一个实施例的牲畜个数的识别控制装置的结构示意图。
具体实施方式
以下基于实施例对本发明进行描述,但是本发明并不仅仅限于这些实施例。在下文对本发明的细节描述中,详尽描述了一些特定的细节部分。对本领域技术人员来说没有这些细节部分的描述也可以完全理解本发明。为了避免混淆本发明的实质,公知的方法、过程、流程没有详细叙述。另外附图不一定是按比例绘制的。
图2是本发明的一个实施例的牲畜个数的识别方法的流程示意图,具体包括以下步骤:
在步骤S201中,获取原始图像,并对所述原始图像中的牲畜进行标记,得到第一图像。
在本步骤中,获取原始图像,并对该原始图像中的牲畜进行标记,得到第一图像。图3a是本发明的一个实施例的原始图像的标注图。如图3a所示,获取摄像头采集的原始图像后,将原始图像中每头牲畜的可见部分的头部和尾部画圆点。用椭圆长轴首尾连接牲畜的头部和尾部的圆点,保证椭圆覆盖牲畜的全身。体型较大的牲畜的椭圆长轴比普通体型的牲畜的椭圆长轴长。以牲畜的头部和尾部的圆点为圆心分别画圆,使两个圆都在牲畜的躯干上。这样使首尾的权重更大。如果有牲畜相互挤压遮挡的情况,只标注露出部分。
在步骤S202中,基于卷积神经网络,对所述第一图像进行图像语义分割,得到所述第一图像的前景概率密度图。
在该步骤中,使用U-net算法模型,对该第一图像进行图像语义分割,得到该第一图像的前景概率密度图。该前景概率密度图中每一个像素的概率值在0至1之间。
在步骤S203中,基于不同的阈值,对所述前景概率密度图进行二值化,得到多个第二图像。
在该步骤中,使用不同的阈值对该前景概率密度图进行二值化,得到多个二值图。并将该二值图作为多个第二图像。图3b是本发明的一个实施例的原始图像的二值图。
在步骤S204中,基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数。
在该步骤中,基于机器学习模型,使用机器学习分类的方式对图像语义分割后的多个第二图像之间做后处理逻辑判断,得到该原始图像中牲畜的个数。
根据本发明实施例,对原始图像经标注后得到的第一图像做图像语义分割后,使用机器学习分类的方式对多个第二图像做后处理逻辑判断,提高了识别牲畜个数的多场景应用的鲁棒性。基于不同阈值得到多个第二图像,并在多个第二图像之间进行后处理逻辑判断,提高了牲畜个数的识别方法的召回率和准确率。
图4是本发明的一个实施例的牲畜个数的识别方法的流程示意图。具体包括以下步骤:
在步骤S401中,获取原始图像,并对所述原始图像中的牲畜进行标记,得到第一图像。
在步骤S402中,基于卷积神经网络,对所述第一图像进行图像语义分割,得到所述第一图 像的前景概率密度图。
在步骤S403中,基于不同的阈值,对所述前景概率密度图进行二值化,得到多个第二图像。
在步骤S404中,基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化。
在步骤S405中,基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数。
本实施例是比前述实施例更加完善的牲畜个数的识别方法。步骤S401至S402与图2的S201至S202相同,这里就不再赘述。
在本步骤S403中,获取经过图像语义分割得到的前景概率密度图。使用0.1和0.7的两个阈值分别对该前景概率密度图进行二值化,得到两张二值图。将得到的两张二值图作为两个第二图像。实际工程应用中,可以根据需要选择不同的阈值来对该前景概率密度图进行二值化。
在步骤S404中,采用轮廓提取函数(FindContours)分别提取两个第二图像的轮廓,得到两个第二图像对应的两族轮廓集合和先验的该原始图像中牲畜的个数。由于每个轮廓的面积的大小不一而且特征不具有普适性,所以对得到的两族轮廓集合进行特征提取。对每个轮廓进行特征描述,对第二图像中每个点的位置进行主成分分析,得到主轴的方向。计算轮廓的最小外接矩形(minbox)、轮廓的面积、主轴长度等来构建机器学习模型所用的特征,用这些特征来代表每个轮廓。将对两族轮廓集合进行特征提取得到的特征集合作为两个第二图像对应的两族第一特征数据集。基于随机森林模型分别对该两族第一特征数据集的各个特征进行排序,得到该两族第一特征数据集的各个特征的重要性次序;基于该两族第一特征数据集的各个特征的重要性次序,将不重要的特征剔除,得到两族第二特征数据集。基于该两族第二特征数据集,采用自适应提升算法(Adaboost)模型对两个第二图像对应的该两族轮廓集合进行筛选分类;其中,筛选分类结果中包括:该两族轮廓集合的各个轮廓的面积的大小。如果在两个第二图像对应的该两族轮廓集合中不存在异常轮廓,则将该两族轮廓集合中的轮廓标记为正常轮廓。如果在两个第二图像对应的两族轮廓集合中存在异常轮廓,则将该两族轮廓集合中合格的轮廓标记为正常轮廓,将该两族轮廓集合中不合格的轮廓标记为异常轮廓;基于该两族轮廓集合的相互校验,对异常轮廓进行修正。高阈值对应的轮廓集合中包含的轮廓的面积相对比较小,很少有轮廓粘连的情况,召回率低。而低阈值对应的轮廓集合包含的轮廓的召回率会高一些,但是会有轮廓粘连的情况,所以检查到异常轮廓后结合另外一族轮廓集合来对异常轮廓进行修正,保证数目准确。
在步骤S405中,在机器学习模型中,分别计算两个第二图像中包含的轮廓的个数;分别判断两个第二图像中包含的轮廓是否经过修正。如果两个第二图像中包含的轮廓都没有经过修正, 则判断两个第二图像包含的轮廓的个数是否相同。如果两个第二图像包含的轮廓的个数相同,则该原始图像中牲畜的个数为该两个第二图像包含的轮廓的个数并且牲畜个数识别的等级为A,即该牲畜的个数识别方法的准确率为99%。如果两个第二图像包含的轮廓的个数不相同,则判断该先验的该原始图像中牲畜的个数是否小于等于9。如果两个第二图像包含的轮廓都经过修正,则判断该先验的该原始图像中牲畜的个数是否小于等于9。如果该先验的该原始图像中牲畜的个数小于等于9,则输出低阈值(0.1)对应的第二图像中轮廓的个数并且牲畜个数识别的等级为B,即该牲畜的个数识别方法的准确率为95%。如果该先验的该原始图像中牲畜的个数大于9,则输出高阈值(0.7)对应的第二图像中轮廓的个数并且牲畜个数识别的等级为B,即该牲畜的个数识别方法的准确率为95%。
根据本发明的实施例,由于图像语义分割在多场景下的泛化能力有限,使用自适应提升算法(Adaboost)模型对图像语义分割的结果进行分类,提高牲畜个数识别方法的召回率和准确率。基于随机森林模型分别对该两族第一特征数据集的各个特征进行排序,将不重要的特征剔除,得到两族第二特征数据集,提高了描述轮廓特征的准确性,进一步提高了牲畜个数识别方法的召回率和准确率。
图5是本发明的一个实施例的牲畜个数的识别方法的流程示意图。具体是图4中步骤S404中,基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正的过程。具体包括以下步骤:
在步骤S501中,获取所述异常轮廓所属的轮廓集合,得到第一族轮廓集合;获取所述异常轮廓不属于的一个轮廓集合,得到第二族轮廓集合;以及比较所述异常轮廓和所述第二族轮廓集合的轮廓的面积的大小。如果所述异常轮廓的面积大于所述第二族轮廓集合的轮廓,则执行S502。如果所述异常轮廓的面积小于所述第二族轮廓集合中的轮廓,则执行S512。
在步骤S502中,判断在所述筛选分类结果中,所述异常轮廓的面积是否大于所述第二族轮廓集合的轮廓。在所述筛选分类结果中,如果所述异常轮廓的面积大于所述第二族轮廓集合的轮廓,则执行S503。在所述筛选分类结果中,如果所述异常轮廓的面积小于所述第二族轮廓集合中的轮廓,则执行S512。
在步骤S503中,计算所述第二族轮廓集合中包含的轮廓的个数,并且判断所述第二族轮廓集合中包含的轮廓的个数是否大于等于3。如果所述第二族轮廓集合中包含的轮廓的个数大于等于3,则执行S504。如果所述第二族轮廓集合中包含的轮廓的个数小于3,则执行S505。
在步骤S504中,在所述第二族轮廓集合中找到距离所述异常轮廓最近的3个轮廓。
在步骤S505中,在所述第一族轮廓集合中找到除所述异常轮廓之外的所有轮廓。
在步骤S506中,判断所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数是否大于1。 如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数等于1,则执行S507。如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数大于等于2,则执行S508。
在步骤S507中,将所述异常轮廓切割为两个。
在步骤S508中,判断所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数是否大于等于3。如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数小于3,则执行S509。如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数大于等于3,则执行S510。
在步骤S509中,将所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓代替所述异常轮廓。
在步骤S510中,判断所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓是否属于所述第一族轮廓集合。如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓都属于所述第一族轮廓集合,则执行S509。如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓并非都属于所述第一族轮廓集合,则执行S511。
在步骤S511中,将所述异常轮廓中属于所述第二族轮廓集合并且不属于所述第一族轮廓集合的轮廓删除之后,执行S509。
在步骤S512中,计算所述第一族轮廓集合中包含的轮廓的个数并且判断所述第一族轮廓集合中包含的轮廓的个数是否大于等于5。如果所述第一族轮廓集合中包含的轮廓的个数大于等于5,则执行S513。如果所述第一族轮廓集合中包含的轮廓的个数小于5,则S514。
在步骤S513中,在所述第一族轮廓集合中找到距离所述异常轮廓最近的四个轮廓。
在步骤S514中,在所述第一族轮廓集合中选出除所述异常轮廓之外的所有轮廓。
在步骤S515中,在所述距离所述异常轮廓最近的四个轮廓中或者在所述除所述异常轮廓之外的所有轮廓中,判断每两个轮廓之间是否可以合并。如果每两个轮廓之间可以合并,则执行S516。如果每两个轮廓之间不可以合并,则执行S517。
在步骤S516中,将所述距离所述异常轮廓最近的四个轮廓或者所述除所述异常轮廓之外的所有轮廓中每两个轮廓合并。
在步骤S517中,将所述异常轮廓删除。
在本申请的实施例中,判断该异常轮廓属于两个第二图像对应的两族轮廓集合中的哪个轮廓集合。获取该异常轮廓(A contour)所属的轮廓集合,得到第一族轮廓集合(A contours);获取该异常轮廓(A contour)不属于的另一个轮廓集合,得到第二族轮廓集合(B contours);以及比较该异常轮廓(A contour)和该第二族轮廓集合(B contours)中包含的轮廓的面积的大小。如果该异常轮廓(A contour)的面积大于该第二族轮廓集合(B contours)中包含的轮廓,则判断在该筛选分类结果中,该异常轮廓(A contour)的面积是否大于该第二族轮廓集合(B contours)的轮廓。在该筛选分类结果中, 如果该异常轮廓(A contour)的面积大于该第二族轮廓集合(B contours)的轮廓,则计算该第二族轮廓集合(B contours)中包含的轮廓的个数并且判断所述第二族轮廓集合(B contours)中包含的轮廓的个数是否大于等于3。如果所述第二族轮廓集合(B contours)中包含的轮廓的个数大于等于3,则在该第二族轮廓集合(B contours)中找到距离该异常轮廓最近的3个轮廓。如果所述第二族轮廓集合(B contours)中包含的轮廓的个数小于3,则在该第一族轮廓集合(A contours)中找到除该异常轮廓(A contour)之外的所有轮廓。判断该异常轮廓(A contour)中包含的属于该第二族轮廓集合(B contours)的轮廓的个数是否大于1。
如果该异常轮廓(A contour)中包含的属于该第二族轮廓集合(B contours)的轮廓的个数等于1,则将该异常轮廓(A contour)切割为两个。如果该异常轮廓(A contour)中包含的属于该第二族轮廓集合(B contours)的轮廓的个数大于等于2,则判断该异常轮廓(A contour)中包含的属于该第二族轮廓集合(B contours)的轮廓的个数是否大于等于3。如果该异常轮廓(A contour)中包含的属于该第二族轮廓集合(B contours)的轮廓的个数小于3,则将该异常轮廓(A contour)中包含的属于该第二族轮廓集合(B contours)的轮廓代替该异常轮廓(A contour)。如果所述异常轮廓(A contour)中包含的属于所述第二族轮廓集合(B contours)的轮廓的个数大于等于3,则判断该异常轮廓(A contour)中包含的属于该第二族轮廓集合(B contours)的轮廓是否属于该第一族轮廓集合(A contours)。如果该异常轮廓(A contour)中包含的属于该第二族轮廓集合(B contours)的轮廓都属于该第一族轮廓集合(A contours),则将该异常轮廓(A contour)中包含的属于该第二族轮廓集合(B contours)的轮廓代替该异常轮廓(A contour)。如果该异常轮廓(A contour)中包含的属于该第二族轮廓集合(B contours)的轮廓并非都属于该第一族轮廓集合(A contours),则将该异常轮廓(A contour)中属于该第二族轮廓集合(B contours)并且不属于该第一族轮廓集合(A contours)的轮廓删除;并且将该异常轮廓(A contour)中剩余包含的属于该第二族轮廓集合(B contours)的轮廓代替所述异常轮廓(A contour)。
如果所述异常轮廓(A contour)的面积小于所述第二族轮廓集合(B contours)中的轮廓,则计算该第一族轮廓集合(A contours)中包含的轮廓的个数并且判断该第一族轮廓集合(A contours)中包含的轮廓的个数是否大于等于5。在该筛选分类结果中,如果该异常轮廓(A contour)的面积小于该第二族轮廓集合(B contours)中的轮廓,则计算该第一族轮廓集合(A contours)中包含的轮廓的个数并且判断该第一族轮廓集合(A contours)中包含的轮廓的个数是否大于等于5。如果该第一族轮廓集合(A contours)中包含的轮廓的个数大于等于5,则在该第一族轮廓集合(A contours)中找到距离该异常轮廓(A contour)最近的四个轮廓。如果该第一族轮廓集合(A contours)中包含的轮廓的个数小于5,则在该第一族轮廓集合(A contours)中选出除该异常轮廓(A contour)之外的所有轮廓。在该第一族轮廓集合(A contours)中距离该异常轮廓(A contour)最近的四个轮廓中或者在该第一族轮廓 集合(A contours)中除该异常轮廓(A contour)之外的所有轮廓中,判断每两个轮廓之间是否可以合并。如果每两个轮廓之间可以合并,则将距离该异常轮廓(A contour)最近的该四个轮廓或者除该异常轮廓(A contour)之外的该所有轮廓中的每两个轮廓合并。如果每两个轮廓之间不可以合并,则将该异常轮廓(A contour)删除。
根据本发明的实施例,当该异常轮廓与附近异常轮廓存在分离情况且主分量分析的主轴方向相同时,对两个异常轮廓进行合并。当异常轮廓存在首尾连接情况时将该异常轮廓进行分割处理。当相互独立的轮廓被标记为异常时,且该独立的轮廓与其他轮廓无关联时,将该独立轮廓删除。基于两族轮廓集合的相互校验,对该异常轮廓进行修正,进一步提高了牲畜个数识别的准确率。
在本发明的一个可选的实施例中,所述多个第二特征数据集中包括以下特征中的至少之一的特征:轮廓面积/轮廓最小外接矩形面积、主成分分析主轴长度/主成分分析次轴长度、主成分分析主轴长度/轮廓最小外接矩形的长和主成分分析次轴长度/轮廓最小外接矩形的宽。图6为本发明的一个实施例的轮廓特征描述图。如图6所示,虚线内是两族轮廓集合的所有特征,第三排特征是第二排特征的非线性组合。
第二排特征从左到右依次为:轮廓(contour)是由很多点坐标组成的区域轮廓,轮廓的数据结构是[x1,y1],[x2,y2],[x3,y3],…]。通过opencv里面的函数得到轮廓的重心是否在轮廓内(特征1),轮廓的面积(特征2),某张图片通过图像语义分割返回的所有轮廓的面积均值(特征3),该图片通过图像语义分割返回的所有轮廓面积的标准差(特征4),以坐标数据为二维变量做主成分分析得到主成分的贡献率(特征5),过轮廓中心沿着主成分方向的直线和轮廓的两个交点间的线段长度(特征6),与主成分方向垂直方向的次轴方向的直线和轮廓两个交点间线段的长度(特征7),特征6与特征7的比值(特征8),轮廓的最小外接矩形的面积(特征9),轮廓的最小外接矩形的长(特征10),轮廓的最小外接矩形的宽(特征11)。
第三排特征从左到右依次为:第二排特征2与特征9的比值(特征12),第二排特征6与特征7的比值(特征13),第二排特征6与特征特征10的比值(特征14),第二排特征7与特征11的比值(特征15)。
根据本申请的实施例,对每个轮廓提取特征,得到具有普适性的特征集合,提高了利用自适应提升算法模型对多个第二图像对应的多族轮廓集合进行筛选分类的准确性。
图7是本发明的一个实施例的牲畜个数的识别装置的结构示意图。如图7所示,该牲畜个数的识别装置包括:数据获取单元701、图像语义分割单元702、二值化单元703、逻辑判断单元704和优化单元705。
数据获取单元701,用于获取原始图像,并对所述原始图像中的牲畜进行标记,得到第一图 像。
图像语义分割单元702,用于基于卷积神经网络,对所述第一图像进行图像语义分割,得到所述第一图像的前景概率密度图。
二值化单元703,用于基于不同的阈值,对所述前景概率密度图进行二值化,得到多个第二图像。
逻辑判断单元704,用于基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数。
优化单元705,用于基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化。
在本申请的实施例中,数据获取单元701,用于获取原始图像,并对该原始图像中的牲畜进行标记,得到第一图像。图像语义分割单元702,用于基于卷积神经网络,对该第一图像进行图像语义分割,得到该第一图像的前景概率密度图。二值化单元703,用于基于不同的阈值,对该前景概率密度图进行二值化,得到多个第二图像。逻辑判断单元704,用于基于机器学习模型,对多个第二图像进行后处理逻辑判断,得到该原始图像中牲畜的个数。优化单元705,用于基于多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化。
图8是根据本发明实施例牲畜个数的识别装置的结构图。图8示出的设备仅仅是一个示例,不应对本发明实施例的功能和使用范围构成任何限制。
参考图8,该装置包括通过总线连接的处理器801、存储器802和输入输出设备803。存储器802包括只读存储器(ROM)和随机访问存储器(RAM),存储器802内存储有执行系统功能所需的各种计算机指令和数据,处理器801从存储器802中读取各种计算机指令以执行各种适当的动作和处理。输入输出设备包括键盘、鼠标等的输入部分;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分;包括硬盘等的存储部分;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分。存储器802还存储有以下的计算机指令以完成本发明实施例的牲畜个数的识别方法规定的操作:获取原始图像,并对所述原始图像中的牲畜进行标记,得到第一图像;基于卷积神经网络,对所述第一图像进行图像语义分割,得到所述第一图像的前景概率密度图;基于不同的阈值,对所述前景概率密度图进行二值化,得到多个第二图像;以及基于所述多个第二图像的后处理逻辑判断,得到所述原始图像中牲畜的个数。
相应地,本发明实施例提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机指令,所述计算机指令被执行时实现上述牲畜个数的识别方法所规定的操作。
附图中的流程图、框图图示了本发明实施例的系统、方法、装置的可能的体系框架、功能和 操作,流程图和框图上的方框可以代表一个模块、程序段或仅仅是一段代码,所述模块、程序段和代码都是用来实现规定逻辑功能的可执行指令。也应当注意,所述实现规定逻辑功能的可执行指令可以重新组合,从而生成新的模块和程序段。因此附图的方框以及方框顺序只是用来更好的图示实施例的过程和步骤,而不应以此作为对发明本身的限制。
以上所述仅为本发明的一些实施例,并不用于限制本发明,对于本领域技术人员而言,本发明可以有各种改动和变化。凡在本发明的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (39)

  1. 一种牲畜个数的识别方法,其特征在于,包括:
    获取原始图像,并对所述原始图像中的牲畜进行标记,得到第一图像;
    基于卷积神经网络,对所述第一图像进行图像语义分割,得到所述第一图像的前景概率密度图;
    基于不同的阈值,对所述前景概率密度图进行二值化,得到多个第二图像;以及
    基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数。
  2. 根据权利要求1所述的牲畜个数的识别方法,其特征在于,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数之前,包括:
    基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化。
  3. 根据权利要求2所述的牲畜个数的识别方法,其特征在于,所述基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化,包括:
    采用轮廓提取函数提取所述多个第二图像的轮廓,得到所述多个第二图像对应的多族轮廓集合和先验的所述原始图像中牲畜的个数;
    提取所述多个第二图像对应的所述多族轮廓集合的特征,得到所述多个第二图像对应的多族第一特征数据集。
  4. 根据权利要求3所述的牲畜个数的识别方法,其特征在于,所述基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化,还包括:
    基于随机森林模型对所述多族第一特征数据集的各个特征进行排序,得到所述多族第一特征数据集的各个特征的重要性次序;
    基于所述多族第一特征数据集的各个特征的重要性次序,将不重要的特征剔除,得到多族第二特征数据集。
  5. 根据权利要求4所述的牲畜个数的识别方法,其特征在于,所述基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化,还包括:
    基于所述多族第二特征数据集,采用自适应提升算法模型对所述多个第二图像对应的所述多族轮廓集合进行筛选分类;
    其中,所述筛选分类结果中包括:所述多族轮廓集合的各个轮廓的面积的大小。
  6. 根据权利要求5所述的牲畜个数的识别方法,其特征在于,所述基于所述多个第二图像分 别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化,还包括:
    如果在所述多个第二图像对应的所述多族轮廓集合中不存在异常轮廓,则将所述多族轮廓集合中的轮廓标记为正常轮廓。
  7. 根据权利要求6所述的牲畜个数的识别方法,其特征在于,所述基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化,还包括:
    如果在所述多个第二图像对应的所述多族轮廓集合中存在异常轮廓,则将所述多族轮廓集合中合格的轮廓标记为正常轮廓,将所述多族轮廓集合中不合格的轮廓标记为异常轮廓;
    基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正。
  8. 根据权利要求7所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,包括:
    获取所述异常轮廓所属的轮廓集合,得到第一族轮廓集合;
    获取所述异常轮廓不属于的一个轮廓集合,得到第二族轮廓集合;以及
    比较所述异常轮廓和所述第二族轮廓集合的轮廓的面积的大小。
  9. 根据权利要求8所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓的面积大于所述第二族轮廓集合的轮廓,则判断在所述筛选分类结果中,所述异常轮廓的面积是否大于所述第二族轮廓集合的轮廓。
  10. 根据权利要求9所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:在所述筛选分类结果中,如果所述异常轮廓的面积大于所述第二族轮廓集合的轮廓,则计算所述第二族轮廓集合中包含的轮廓的个数;
    并且判断所述第二族轮廓集合中包含的轮廓的个数是否大于等于3。
  11. 根据权利要求10所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述第二族轮廓集合中包含的轮廓的个数大于等于3,则在所述第二族轮廓集合中找到距离所述异常轮廓最近的3个轮廓。
  12. 根据权利要求11所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述第二族轮廓集合中包含的轮廓的个数小于3,则在所述第一族轮廓集合中找到除所述异常轮廓之外的所有轮廓。
  13. 根据权利要求12所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:判断所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数是否大于1。
  14. 根据权利要求13所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数等于1,则将所述异常轮廓切割为两个。
  15. 根据权利要求14所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数大于等于2,则判断所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数是否大于等于3。
  16. 根据权利要求15所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数小于3,则将所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓代替所述异常轮廓。
  17. 根据权利要求16所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓的个数大于等于3,则判断所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓是否属于所述第一族轮廓集合。
  18. 根据权利要求17所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓都属于所述第一族轮廓集合,则将所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓代替所述异常轮廓。
  19. 根据权利要求18所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓中包含的属于所述第二族轮廓集合的轮廓并非都属于所述第一族轮廓集合,则将所述异常轮廓中属于所述第二族轮廓集合并且不属于所述第一族轮廓集合的轮廓删除;
    并且将所述异常轮廓中剩余包含的属于所述第二族轮廓集合的轮廓代替所述异常轮廓。
  20. 根据权利要求19所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述异常轮廓的面积小于所述第二族轮廓集合中的轮廓,则计算所述第一族轮廓集合中包含的轮廓的个数并且判断所述第一族轮廓集合中包含的轮廓的个数是否大于等于5。
  21. 根据权利要求20所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:在所述筛选分类结果中,如果所述异常轮廓的 面积小于所述第二族轮廓集合中的轮廓,则计算所述第一族轮廓集合中包含的轮廓的个数并且判断所述第一族轮廓集合中包含的轮廓的个数是否大于等于5。
  22. 根据权利要求21所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述第一族轮廓集合中包含的轮廓的个数大于等于5,则在所述第一族轮廓集合中找到距离所述异常轮廓最近的四个轮廓。
  23. 根据权利要求22所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果所述第一族轮廓集合中包含的轮廓的个数小于5,则在所述第一族轮廓集合中选出除所述异常轮廓之外的所有轮廓。
  24. 根据权利要求23所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:在所述距离所述异常轮廓最近的四个轮廓中或者在所述除所述异常轮廓之外的所有轮廓中,判断每两个轮廓之间是否可以合并。
  25. 根据权利要求24所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果每两个轮廓之间可以合并,则将所述距离所述异常轮廓最近的四个轮廓或者所述除所述异常轮廓之外的所有轮廓中每两个轮廓合并。
  26. 根据权利要求25所述的牲畜个数的识别方法,其特征在于,所述基于所述多族轮廓集合的相互校验,对所述异常轮廓进行修正,还包括:如果每两个轮廓之间不可以合并,则将所述异常轮廓删除。
  27. 根据权利要求26所述的牲畜个数的识别方法,其特征在于,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,包括:
    分别计算所述多个第二图像的轮廓个数;
    分别判断所述多个第二图像的轮廓是否经过修正。
  28. 根据权利要求27所述的牲畜个数的识别方法,其特征在于,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:
    如果所述多个第二图像的轮廓都没有经过修正,则判断所述多个第二图像包含的轮廓的个数是否相同。
  29. 根据权利要求28所述的牲畜个数的识别方法,其特征在于,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:
    如果所述多个第二图像包含的轮廓的个数相同,则所述原始图像中牲畜的个数为所述多个第二图像包含的轮廓的个数。
  30. 根据权利要求29所述的牲畜个数的识别方法,其特征在于,所述基于机器学习模型,对 所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:
    如果所述多个第二图像包含的轮廓的个数不相同,则判断所述先验的所述原始图像中牲畜的个数是否小于等于9。
  31. 根据权利要求30所述的牲畜个数的识别方法,其特征在于,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:
    如果所述多个第二图像包含的轮廓都经过修正,则判断所述先验的所述原始图像中牲畜的个数是否小于等于9。
  32. 根据权利要求31所述的牲畜个数的识别方法,其特征在于,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:
    如果所述先验的所述原始图像中牲畜的个数小于等于9,则输出低阈值对应的所述第二图像中轮廓的个数。
  33. 根据权利要求32所述的牲畜个数的识别方法,其特征在于,所述基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所述原始图像中牲畜的个数,还包括:
    如果所述先验的所述原始图像中牲畜的个数大于9,则输出高阈值对应的所述第二图像中轮廓的个数。
  34. 根据权利要求33所述的牲畜个数的识别方法,其特征在于,所述对所述原始图像中的牲畜进行标记,包括:在所述牲畜的头部和尾部画圆点;
    用椭圆长轴首尾连接所述头部和所述尾部的圆点;以及
    以所述头部和所述尾部的圆点为圆心分别画圆,使两个圆都在所述牲畜的躯干上。
  35. 根据权利要求34所述的牲畜个数的识别方法,其特征在于,所述多个第二特征数据集中包括以下特征中的至少之一的特征:轮廓面积/轮廓最小外接矩形面积、主成分分析主轴长度/主成分分析次轴长度、主成分分析主轴长度/轮廓最小外接矩形的长和主成分分析次轴长度/轮廓最小外接矩形的宽。
  36. 一种牲畜个数的识别装置,其特征在于,包括:
    数据获取单元,用于获取原始图像,并对所述原始图像中的牲畜进行标记,得到第一图像;
    图像语义分割单元,用于基于卷积神经网络,对所述第一图像进行图像语义分割,得到所述第一图像的前景概率密度图;
    二值化单元,用于基于不同的阈值,对所述前景概率密度图进行二值化,得到多个第二图像;以及
    逻辑判断单元,用于基于机器学习模型,对所述多个第二图像进行后处理逻辑判断,得到所 述原始图像中牲畜的个数。
  37. 根据权利要求36所述的牲畜个数的识别装置,其特征在于,还包括:
    优化单元,用于基于所述多个第二图像分别对应的多族轮廓特征信息,对所述多个第二图像的异常轮廓进行优化。
  38. 一种牲畜个数的识别控制装置,其特征在于,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器被配置为执行上述权利要求1至35任意一项所述的牲畜个数的识别方法。
  39. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机指令,所述计算机指令被执行时实现如权利要求1至35中任一项所述的牲畜个数的识别方法。
PCT/CN2019/103328 2018-12-20 2019-08-29 牲畜个数的识别方法及装置 WO2020125057A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811562574.2A CN109801260B (zh) 2018-12-20 2018-12-20 牲畜个数的识别方法、装置、控制装置及可读存储介质
CN201811562574.2 2018-12-20

Publications (1)

Publication Number Publication Date
WO2020125057A1 true WO2020125057A1 (zh) 2020-06-25

Family

ID=66557245

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/103328 WO2020125057A1 (zh) 2018-12-20 2019-08-29 牲畜个数的识别方法及装置

Country Status (2)

Country Link
CN (1) CN109801260B (zh)
WO (1) WO2020125057A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112734730A (zh) * 2021-01-11 2021-04-30 牧原食品股份有限公司 一种牲畜数量识别方法、装置、设备和存储介质
WO2022076443A1 (en) * 2020-10-06 2022-04-14 Spears Logan System and method of counting livestock
US11542149B2 (en) 2020-11-06 2023-01-03 Versabev, Inc. Scalable modular system and method for storing, preserving, managing, and selectively dispensing beverages
CN117894041A (zh) * 2024-03-14 2024-04-16 陕西微牧云信息科技有限公司 一种基于物联网的屠宰场智能管理方法及系统
CN117894041B (zh) * 2024-03-14 2024-06-04 陕西微牧云信息科技有限公司 一种基于物联网的屠宰场智能管理方法及系统

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109801260B (zh) * 2018-12-20 2021-01-26 北京海益同展信息科技有限公司 牲畜个数的识别方法、装置、控制装置及可读存储介质
CN110211134B (zh) * 2019-05-30 2021-11-05 上海商汤智能科技有限公司 一种图像分割方法及装置、电子设备和存储介质
CN110738195A (zh) * 2019-11-06 2020-01-31 北京中农志远电子商务有限公司 一种基于图像识别的家禽养殖场养殖数量识别设备
CN111310664B (zh) * 2020-02-18 2022-11-22 深圳市商汤科技有限公司 图像处理方法及装置、电子设备和存储介质
CN111985357A (zh) * 2020-08-03 2020-11-24 北京海益同展信息科技有限公司 一种目标对象检测方法、装置、电子设备及存储介质
CN112697068A (zh) * 2020-12-11 2021-04-23 中国计量大学 一种管状水准泡气泡长度测量方法

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5699449A (en) * 1994-11-14 1997-12-16 The University Of Connecticut Method and apparatus for implementation of neural networks for face recognition
CN101799987A (zh) * 2010-03-10 2010-08-11 北京航空航天大学 一种自适应式智能交通灯及其控制方法
CN105447458A (zh) * 2015-11-17 2016-03-30 深圳市商汤科技有限公司 一种大规模人群视频分析系统和方法
CN106022460A (zh) * 2016-05-25 2016-10-12 重庆市勘测院 基于激光雷达的人群密度实时监测方法
CN107145821A (zh) * 2017-03-23 2017-09-08 华南农业大学 一种基于深度学习的人群密度检测方法和系统
CN107341480A (zh) * 2017-07-12 2017-11-10 中国电子科技集团公司第二十八研究所 一种改进型pccnn神经网络模型的人群聚集检测方法
CN107742099A (zh) * 2017-09-30 2018-02-27 四川云图睿视科技有限公司 一种基于全卷积网络的人群密度估计、人数统计的方法
CN109801260A (zh) * 2018-12-20 2019-05-24 北京海益同展信息科技有限公司 牲畜个数的识别方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100346728C (zh) * 2005-09-01 2007-11-07 华中科技大学 一种烟支批量计数的方法及装置
CN100578563C (zh) * 2007-12-21 2010-01-06 北京中星微电子有限公司 基于视频图像的车辆计数方法
CN105095957B (zh) * 2014-05-12 2018-01-02 浙江理工大学 一种基于图像分割的蚕茧计数方法
CN106485708B (zh) * 2016-10-11 2018-12-28 南京航空航天大学 一种基于图像识别的圆木计数方法

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5699449A (en) * 1994-11-14 1997-12-16 The University Of Connecticut Method and apparatus for implementation of neural networks for face recognition
CN101799987A (zh) * 2010-03-10 2010-08-11 北京航空航天大学 一种自适应式智能交通灯及其控制方法
CN105447458A (zh) * 2015-11-17 2016-03-30 深圳市商汤科技有限公司 一种大规模人群视频分析系统和方法
CN106022460A (zh) * 2016-05-25 2016-10-12 重庆市勘测院 基于激光雷达的人群密度实时监测方法
CN107145821A (zh) * 2017-03-23 2017-09-08 华南农业大学 一种基于深度学习的人群密度检测方法和系统
CN107341480A (zh) * 2017-07-12 2017-11-10 中国电子科技集团公司第二十八研究所 一种改进型pccnn神经网络模型的人群聚集检测方法
CN107742099A (zh) * 2017-09-30 2018-02-27 四川云图睿视科技有限公司 一种基于全卷积网络的人群密度估计、人数统计的方法
CN109801260A (zh) * 2018-12-20 2019-05-24 北京海益同展信息科技有限公司 牲畜个数的识别方法及装置

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022076443A1 (en) * 2020-10-06 2022-04-14 Spears Logan System and method of counting livestock
US11602132B2 (en) 2020-10-06 2023-03-14 Sixgill, LLC System and method of counting livestock
AU2021358749B2 (en) * 2020-10-06 2023-07-20 Plainsight Corp. System and method of counting livestock
US11542149B2 (en) 2020-11-06 2023-01-03 Versabev, Inc. Scalable modular system and method for storing, preserving, managing, and selectively dispensing beverages
CN112734730A (zh) * 2021-01-11 2021-04-30 牧原食品股份有限公司 一种牲畜数量识别方法、装置、设备和存储介质
CN112734730B (zh) * 2021-01-11 2023-07-28 牧原食品股份有限公司 一种牲畜数量识别方法、装置、设备和存储介质
CN117894041A (zh) * 2024-03-14 2024-04-16 陕西微牧云信息科技有限公司 一种基于物联网的屠宰场智能管理方法及系统
CN117894041B (zh) * 2024-03-14 2024-06-04 陕西微牧云信息科技有限公司 一种基于物联网的屠宰场智能管理方法及系统

Also Published As

Publication number Publication date
CN109801260B (zh) 2021-01-26
CN109801260A (zh) 2019-05-24

Similar Documents

Publication Publication Date Title
WO2020125057A1 (zh) 牲畜个数的识别方法及装置
WO2019232853A1 (zh) 中文模型训练、中文图像识别方法、装置、设备及介质
CN107833213B (zh) 一种基于伪真值自适应法的弱监督物体检测方法
US9367766B2 (en) Text line detection in images
US10262214B1 (en) Learning method, learning device for detecting lane by using CNN and testing method, testing device using the same
CN110909618B (zh) 一种宠物身份的识别方法及装置
CN106991370B (zh) 基于颜色和深度的行人检索方法
CN111310662B (zh) 一种基于集成深度网络的火焰检测识别方法及系统
CN109800817B (zh) 基于融合语义神经网络的图像分类方法
CN107730553B (zh) 一种基于伪真值搜寻法的弱监督物体检测方法
CN111046886A (zh) 号码牌自动识别方法、装置、设备及计算机可读存储介质
CN110691202A (zh) 视频剪辑方法、装置及计算机存储介质
CN110942456B (zh) 篡改图像检测方法、装置、设备及存储介质
CN109685045A (zh) 一种运动目标视频跟踪方法及系统
CN110827432B (zh) 一种基于人脸识别的课堂考勤方法及系统
CN111161265A (zh) 一种动物计数、图像处理方法和装置
CN111460927A (zh) 对房产证图像进行结构化信息提取的方法
CN112836625A (zh) 人脸活体检测方法、装置、电子设备
CN113673607A (zh) 图像标注模型的训练及图像标注的方法及装置
CN112101300A (zh) 药材识别方法、装置及电子设备
CN110443184A (zh) 身份证信息提取方法、装置及计算机存储介质
CN111325181A (zh) 一种状态监测方法、装置、电子设备及存储介质
CN109615610B (zh) 一种基于YOLO v2-tiny的医用创可贴瑕疵检测方法
CN111461143A (zh) 一种图片翻拍识别方法和装置及电子设备
CN112132892A (zh) 目标位置标注方法、装置及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19901020

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01/10/2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19901020

Country of ref document: EP

Kind code of ref document: A1