CN109141248B - Pig weight measuring and calculating method and system based on image - Google Patents
Pig weight measuring and calculating method and system based on image Download PDFInfo
- Publication number
- CN109141248B CN109141248B CN201810835051.4A CN201810835051A CN109141248B CN 109141248 B CN109141248 B CN 109141248B CN 201810835051 A CN201810835051 A CN 201810835051A CN 109141248 B CN109141248 B CN 109141248B
- Authority
- CN
- China
- Prior art keywords
- pig
- ear tag
- image
- contour
- pig body
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 27
- 238000001514 detection method Methods 0.000 claims abstract description 38
- 238000012549 training Methods 0.000 claims abstract description 37
- 238000005259 measurement Methods 0.000 claims description 54
- 238000013527 convolutional neural network Methods 0.000 claims description 26
- 238000004364 calculation method Methods 0.000 claims description 14
- 238000007781 pre-processing Methods 0.000 claims description 11
- 238000000691 measurement method Methods 0.000 claims description 10
- 238000002372 labelling Methods 0.000 claims description 8
- 230000037396 body weight Effects 0.000 claims description 7
- 210000000746 body region Anatomy 0.000 claims description 3
- 230000005764 inhibitory process Effects 0.000 claims description 3
- 238000005457 optimization Methods 0.000 claims description 3
- 238000013179 statistical model Methods 0.000 claims description 3
- 241000282887 Suidae Species 0.000 abstract description 14
- 230000036541 health Effects 0.000 abstract description 4
- 241000282898 Sus scrofa Species 0.000 description 197
- 239000000243 solution Substances 0.000 description 13
- 230000008569 process Effects 0.000 description 8
- 238000013135 deep learning Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 3
- 238000009395 breeding Methods 0.000 description 2
- 230000001488 breeding effect Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 238000010606 normalization Methods 0.000 description 2
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 2
- 244000052616 bacterial pathogen Species 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 201000010099 disease Diseases 0.000 description 1
- 208000037265 diseases, disorders, signs and symptoms Diseases 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 210000002468 fat body Anatomy 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000002347 injection Methods 0.000 description 1
- 239000007924 injection Substances 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000005303 weighing Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01B—MEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
- G01B11/00—Measuring arrangements characterised by the use of optical techniques
- G01B11/02—Measuring arrangements characterised by the use of optical techniques for measuring length, width or thickness
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01B—MEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
- G01B11/00—Measuring arrangements characterised by the use of optical techniques
- G01B11/24—Measuring arrangements characterised by the use of optical techniques for measuring contours or curvatures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/62—Analysis of geometric attributes of area, perimeter, diameter or volume
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- General Engineering & Computer Science (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Geometry (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a pig weight measuring and calculating method and system based on images, wherein the pig weight measuring and calculating method comprises the following steps: marking the pig body position and the ear tag position as well as the pig body contour point and the ear tag contour point in the sample image; training a characteristic detection model according to the position of the pig body and the position of the ear tag; training a contour point regression model according to the pig body contour points and the ear tag contour points; determining the position of the pig body and the position of the ear tag in the body length measuring and calculating image; determining the position of a calibration contour point and the position of an ear tag contour point in the body length measuring and calculating image; calculating the pixel lengths of the pig body and the ear tag; calculating the actual body length of the pig body; establishing a pig weight regression model; and obtaining the weight of the pig by using a pig weight regression model. By adopting the technical scheme, the safety, sanitation and health of measuring personnel are ensured, the efficiency of acquiring the weight data of the pigs is improved, and the cost is greatly reduced.
Description
Technical Field
The invention relates to the technical field of image recognition, in particular to a pig weight measuring and calculating method based on an image and a pig weight measuring and calculating system based on the image.
Background
In the process of breeding pigs, the weight of the pigs is an important index reflecting the growth conditions of the pigs, and the timely monitoring of the weight index of the pigs has important significance for breeding production and disease monitoring of the pigs.
In insurance claims, claims are paid according to dead pig weight, which is a common claim paying mode, but in the claim paying process, the dead pig body is filled with water, and other modes of increasing the pig weight are cheated and protected.
The weight is mainly measured by weighing in the traditional production, the pigs need to be fixed on the scales when the weight of the live pigs is measured, the measuring mode needs to consume a large amount of time and labor, the efficiency is low, and the pigs can be frightened to influence the growth and development of the pigs. In the insurance claim settlement process, the bodies of a plurality of dead pigs are infected with germs or rotten, and the mode of manually carrying the dead pigs to weigh the dead pigs can cause serious sanitary problems.
In the prior art, the research uses a camera placed right above a pigsty to collect images of a pig and a reference object for weight measurement by placing an object with a fixed size on the back of the pig, the process needs human intervention, the safety and sanitation problems cannot be solved, and the reference object cannot be unified and standard and is easy to replace and cannot be used in the insurance claim settlement stage. A weight measuring and calculating system which can be used in a pigsty is arranged, but two image acquisition devices with fixed distances need to be erected, and the use scene is very limited due to the fixed position. In addition, the existing weight measurement and calculation method based on the image has high requirements on the number, the angle and the like of image acquisition equipment, or a reference object needs to be fixedly placed, so that the use scene is limited.
Disclosure of Invention
Aiming at least one of the problems, the invention provides an image-based pig weight measurement method and system, which train a detection model for calibrating a pig body and an ear tag based on deep learning by using a sample image, determine the position and the contour of the pig body and the ear tag in a body length measurement and calculation image according to the detection model, calculate the body length and the body width of the pig body according to the size of the ear tag, establish a pig weight regression model, determine the pig weight according to the pig weight regression model, estimate the weight of the pig body according to the image without contacting with the pig, ensure the safety and the health of measuring personnel, greatly improve the convenience and the efficiency of obtaining pig weight data, and greatly reduce the cost.
In order to achieve the aim, the invention provides an image-based pig weight measuring and calculating method, which comprises the following steps: acquiring a sample image and a weight measurement image, and labeling a pig body position, an ear tag position, a pig body contour point, an ear tag contour point and a body type in the sample image and the weight measurement image; preprocessing and normalizing the sample image and the weight measurement image; training a feature detection model of the pig body and the ear tag according to the pig body position and the ear tag position of the sample image; training a contour point regression model of the pig body and the ear tag according to the pig body contour points and the ear tag contour points of the sample image; determining the pig body position and the ear tag position in the weight measurement image by using the characteristic detection model; determining the position of a calibration contour point and the position of an ear tag contour point in the weight measurement image by using the contour point regression model; calculating the pixel length of the pig body according to the position of the calibration contour point, and calculating the pixel length of the ear tag according to the position of the ear tag contour point; calculating an actual size predicted value of the pig body according to the pixel size of the pig body, the pixel size of the ear tag and the actual size of the ear tag; establishing a pig weight regression model according to the actual size predicted value of the pig body, the position of the calibration contour point and the corresponding pig body; and calculating according to the pig weight regression model to obtain the pig weight corresponding to the weight measurement image.
In the above technical solution, preferably, the training of the feature detection model of the pig body and the ear tag according to the pig body position and the ear tag position of the sample image specifically includes: acquiring candidate regions of the pig body and the ear tag in the sample image; extracting features of the candidate region by using a multilayer convolutional neural network; classifying the candidate regions into pig body candidate regions and ear tag candidate regions according to the extracted features; and respectively combining the pig body candidate region and the ear tag candidate region by using a non-maximum inhibition method to obtain the pig body region and the ear tag region in the sample image.
In the foregoing technical solution, preferably, the training of the contour point regression model of the pig body and the ear tag according to the pig body contour point and the ear tag contour point of the sample image specifically includes: extracting features of the pig body image and the ear tag image by using a convolutional neural network to obtain contour key point information and corresponding contour point information predicted by the convolutional neural network; and performing regression prediction on the pig body contour and the ear tag contour in the image by using a convolutional neural network.
In the foregoing technical solution, preferably, the training of the contour point regression model of the pig body and the ear tag according to the pig body contour point and the ear tag contour point of the sample image specifically includes: extracting features of the pig body image and the ear tag image by using a convolutional neural network to obtain contour key point information and corresponding contour point information predicted by the convolutional neural network; optimization is carried out by an Euclidean distance loss function of an expression (1) with an L2 regularization term,
wherein m is the number of key points on the contour of the pig body or the contour of the ear tag, PiThe i-th corresponding contour coordinate labeled artificially, f (x)iPredicted ith contour coordinate, w, for input image through convolutional neural networktIs the weight parameter of the convolutional neural network; and performing regression prediction on the pig body contour and the ear tag contour in the image by using a convolutional neural network.
In the foregoing technical solution, preferably, the calculating the predicted value of the actual size of the pig body according to the pixel size of the pig body, the pixel size of the ear tag, and the actual size of the ear tag specifically includes: selecting a pig ear root and a pig tail root as calibration contour points in the pig body contour points, calculating Euclidean distance between the calibration contour points according to a formula (2) as the pixel length of the pig body in the weight measurement image,
wherein (x)1,y1),(x2,y2) Coordinate positions of the pig ear root point and the pig tail root point in the weight measurement image are obtained; calculating the pixel length d of the ear tag in the body weight measurement image according to the position of the outline point of the ear tag2(ii) a Calculating the actual body length l of the pig body according to formula (3)pig,
lpig=d1/d2*ltag(3)
Wherein ltagIs the actual length of the ear tag; calculating the actual body width W of the pig body according to the same methodpig(ii) a Establishing a pig chest circumference statistical model C according to the length of the pig chest circumference of the pig bodypig=σ*WpigWherein, CpigThe length of the chest circumference of the pig is shown, and sigma is a coefficient obtained according to statistical information.
In the above technical solution, preferably, the pig weight regression model specifically is: weightpig=f(Cpig,lpig,K1...Ki) Wherein, WeightpigIs the weight of pig, KiAnd obtaining the position of the ith pig body contour point through regression.
In the above technical solution, preferably, the labeling of pig body types includes three body types of "lean", "normal" and "fat".
The invention also provides an image-based pig weight measuring and calculating system, which applies any one of the technical schemes to the image-based pig weight measuring and calculating method, and comprises the following steps: the image acquisition module is used for acquiring a sample image and a weight measurement image and marking the pig body position, the ear tag position, the pig body contour point, the ear tag contour point and the body type in the sample image and the weight measurement image; the preprocessing module is used for preprocessing and normalizing the sample image and the weight measurement image; the characteristic detection model training module is used for training a characteristic detection model of the pig body and the ear tag according to the pig body position and the ear tag position of the sample image; the contour point regression model training module is used for training a contour point regression model of the pig body and the ear tag according to the pig body contour points and the ear tag contour points of the sample image; the characteristic detection module is used for determining the position of the pig body and the position of the ear tag in the weight measurement image by using the characteristic detection model; the contour point detection module is used for determining the position of a calibration contour point and the position of an ear tag contour point in the weight measurement image by using the contour point regression model; the pixel length calculating module is used for calculating the pixel length of the pig body according to the position of the calibrated outline point and calculating the pixel length of the ear tag according to the position of the ear tag outline point; the size prediction module is used for calculating an actual size prediction value of the pig body according to the pixel size of the pig body, the pixel size of the ear tag and the actual size of the ear tag; the pig weight regression model training module is used for reconstructing a pig weight regression model according to the actual size predicted value of the pig body, the position of the calibration contour point and the corresponding pig body; and the weight regression module is used for calculating the pig weight corresponding to the weight measurement image according to the pig weight regression model.
Compared with the prior art, the invention has the beneficial effects that: the method comprises the steps of training a detection model for calibrating a pig body and an ear tag based on deep learning by utilizing a sample image, determining the position and the contour of the pig body and the ear tag in an image according to the body length, calculating the body length and the body width of the pig body according to the size of the ear tag, establishing a pig body weight regression model, and determining the weight of the pig according to the pig body weight regression model, so that the weight of the pig body can be estimated according to the image without contacting the pig, the safety and the health of a measurer are guaranteed, the convenience and the efficiency for acquiring the weight data of the pig are greatly improved, and the cost is greatly reduced.
Drawings
FIG. 1 is a schematic flow chart of a pig weight measurement method based on an image according to an embodiment of the present invention;
FIG. 2 is a schematic view of a process for predicting pig weight using a model according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a position labeling of a sample image according to an embodiment of the disclosure;
FIG. 4 is a schematic diagram of contour point labeling performed on a sample image according to an embodiment of the present disclosure;
FIG. 5 is a schematic block diagram of an image-based pig weight calculation system according to an embodiment of the present invention.
In the drawings, the correspondence between each component and the reference numeral is:
11. the pig body training system comprises a pig body, 12 parts of ear tags, 13 parts of pig body contour points, 14 parts of ear tag contour points, 20 parts of an image-based pig body weight calculation system, 21 parts of an image acquisition module, 22 parts of a preprocessing module, 23 parts of a feature detection model training module, 24 parts of a contour point regression model training module, 25 parts of a feature detection module, 26 parts of a contour point detection module, 27 parts of a pixel length calculation module, 28 parts of a size prediction module, 29 parts of a pig body weight regression model training module and 30 parts of a weight regression module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
The invention is described in further detail below with reference to the attached drawing figures:
as shown in fig. 1 to 4, the method for measuring pig weight based on image provided by the present invention comprises: step S101, collecting a sample image and a weight measurement image, and labeling a pig body position, an ear tag position, a pig body contour point 13, an ear tag contour point 14 and a body type in the sample image and the weight measurement image; step S102, preprocessing and normalizing the sample image and the weight measurement image; step S103, training feature detection models of the pig body 11 and the ear tag 12 according to the pig body position and the ear tag position of the sample image; step S104, training a contour point regression model of the pig body 11 and the ear tag 12 according to the pig body contour points 13 and the ear tag contour points 14 of the sample image; step S105, determining the position of the pig body and the position of the ear tag in the weight measurement image by using the characteristic detection model; step S106, determining the position of a calibration contour point and the position of an ear tag contour point in the weight measurement image by using a contour point regression model; step S107, calculating the pixel length of the pig body 11 according to the position of the calibration contour point, and calculating the pixel length of the ear tag 12 according to the position of the ear tag contour point 14; step S108, calculating the predicted value of the actual size of the pig body 11 according to the pixel size of the pig body 11, the pixel size of the ear tag 12 and the actual size of the ear tag 12; step S109, a pig weight regression model is reconstructed according to the actual size predicted value, the position of the calibration contour point and the corresponding pig body of the pig body 11; and step S110, calculating according to the pig weight regression model to obtain the pig weight corresponding to the weight measurement image.
Specifically, images of pigs in a certain number of farms are collected as sample images, the pig body position 13 and the ear tag position 14 are calibrated for the sample images, the pig body contour points and the ear tag contour points are calibrated for the sample images, and in addition, the marks for the pig body types comprise three body types, namely a thin body type, a normal body type and a fat body type. The line drawing of the pig body image in fig. 3 and 4 is used for clearly explaining the calibration of the pig body 11 and the ear tag 12, and in the actual practice process, both the sample image and the body length measurement image are acquired images containing the pig body 11 and the ear tag 12. After the acquisition and calibration are completed, the original image needs to be preprocessed and normalized. Specifically, the pixel value of each pixel point in the original image is an integer between 0 and 255, and the pixel value of each pixel is normalized to a floating point number between 0 and 1 by a normalization method.
Specifically, the process of training a detection model by using a sample image and measuring and calculating a body length detection image by using the detection model utilizes a deep learning technology. The deep learning method can extract the image features with high discriminability in the image according to the task requirements of the features, makes great progress in the field of computer vision, can be applied to a production environment and has quite high accuracy rate of object detection. Further, in the above-described embodiment, it is preferable that the body length measurement image is subjected to preprocessing and normalization processing before the feature detection model and the contour point regression model are input, in order to ensure the accuracy of prediction of the body length measurement image.
In the above technical solution, preferably, the feature detection model for training the pig body 11 and the ear tag 12 according to the pig body position and the ear tag position of the sample image specifically includes: acquiring candidate regions of a pig body 11 and an ear tag 12 in a sample image, wherein the candidate regions of the pig body 11 and the ear tag 12 are generated by using a selective search (selective search) or a region suggestion network (RPN); extracting the characteristics of the candidate region by using a multilayer convolutional neural network, wherein the characteristics can be extracted by using different network structures such as vgg, resnet and the like; classifying the candidate regions into pig body candidate regions, ear tag candidate regions and background regions in the sample image according to the extracted features; and respectively combining the pig body candidate region and the ear tag candidate region by using a non-maximum inhibition method to obtain the pig body region and the ear tag region in the sample image. For the object detector using deep learning, any detector such as fast-rcnn, ssd, yolo is selected, which is a prior art and will not be described herein.
In the above embodiment, preferably, the pig body position 13 and the ear tag position 14 are represented by rectangular frame position coordinates, the rectangular frame position coordinates include a rectangular upper left corner X coordinate, a rectangular upper left corner Y coordinate, a rectangular lower right corner X coordinate and a rectangular lower right corner Y coordinate, the pig body position 13 and the ear tag position 14 are determined by four coordinate values in the rectangular frame position coordinates, so as to intercept the images of the pig body 11 region and the ear tag 12 region, and then the contour point regression model is used to accurately locate the contour point of the pig body 11 and the contour point of the ear tag 12.
In the above technical solution, preferably, the training of the contour point regression model of the pig body 11 and the ear tag 12 according to the pig body contour points 13 and the ear tag contour points 14 of the sample image specifically includes: extracting features of the pig body image and the ear tag image by using a convolutional neural network to obtain contour key point information and corresponding contour point information predicted by the convolutional neural network; and performing regression prediction on the pig body contour points 13 and the ear tag contour points 14 in the image by using a convolutional neural network. In order to achieve the best prediction effect, optimization can be carried out by using an Euclidean distance loss function of the formula (1) with an L2 regularization term,
wherein m is the number of key points on the contour of the pig body or the contour of the ear tag, PiThe i-th corresponding contour coordinate labeled artificially, f (x)iPredicted ith contour coordinate, w, for input image through convolutional neural networktIs the weight parameter of the convolutional neural network; and performing regression prediction on the pig body contour and the ear tag contour in the image by using a convolutional neural network. In this embodiment, the selection of the convolutional neural network may be selected according to actual needs, such as VGG, ResNet, MobileNet, shufflenet, and the like, and the structure and parameter amount of the network model are appropriately adjusted according to the requirements of performance and accuracy.
In the above technical solution, preferably, the calculating the predicted value of the actual size of the pig body 11 according to the pixel size of the pig body 11, the pixel size of the ear tag 12, and the actual size of the ear tag 12 specifically includes:
1) calculating the pixel length of the pig body in the image, wherein the common calculation method is to calculate the pixel distance d between the pig ear root point and the pig tail root point in the image1The length calculation mode can select different contour key points to calculate according to the requirements of actual conditions, and the invention is not limited. Selecting a pig ear root and a pig tail root as calibration contour points in the pig body contour points 13, calculating Euclidean distance between the calibration contour points according to the formula (2) as the pixel length of the pig body 11 in the weight measurement image,
wherein (x)1,y1),(x2,y2) Coordinate positions of the pig ear root point and the pig tail root point in the weight measurement image are obtained;
2) calculating the pixel length d of the ear tag 12 in the body weight measurement image according to the position of the ear tag contour point 142The calculation of the length of the ear tag can return the elliptical area of the ear tag according to the outline position information of the ear tag by a least square method to obtain the pixel length of the long axis and the short axis of the ear tag:
wherein 1 is the major axis pixel length of the ellipse, and s is the minor axis pixel length of the ellipse;
3) calculating the actual body length l of the pig body 11 according to equation (3)pig,
lpig=d1/d2*ltag(3)
Wherein ltagIs the actual length of the ear tag 12;
4) the actual body width W of the pig body 11 is calculated according to the same methodpig;
5) Establishing a pig chest circumference statistical model C according to the length of the pig chest circumference of a pig body 11pig=σ*WpigWherein, CpigThe length of the chest circumference of the pig is shown, and sigma is a coefficient obtained according to statistical information.
In the above technical solution, preferably, a pig weight regression model is established according to the contour information of the pig and the weight and length information of the pig, and the pig weight regression model specifically includes: weightpig=f(Cpig,lpig,K1...Ki) Wherein, WeightpigIs the weight of pig, KiAnd obtaining the position of the ith pig body contour point through regression.
As shown in fig. 5, the present invention further provides an image-based pig weight measurement and calculation system 20, which applies any one of the above technical solutions to the image-based pig weight measurement and calculation method, including: the image acquisition module 21 is used for acquiring a sample image and a weight measurement image, and labeling the pig body position and the ear tag position, the pig body contour point 13, the ear tag contour point 14 and the body type in the sample image and the weight measurement image; the preprocessing module 22 is used for preprocessing and normalizing the sample image and the weight measurement image; the characteristic detection model training module 23 is used for training the characteristic detection models of the pig body 11 and the ear tag 12 according to the pig body position and the ear tag position of the sample image; the contour point regression model training module 24 is used for training the contour point regression models of the pig body 11 and the ear tag 12 according to the pig body contour points 13 and the ear tag contour points 14 of the sample image; the characteristic detection module 25 is used for determining the position of the pig body and the position of the ear tag in the weight measurement image by using the characteristic detection model; the contour point detection module 26 is used for determining the positions of the calibration contour points and the ear tag contour points 14 in the weight measurement image by using a contour point regression model; the pixel length calculating module 27 is used for calculating the pixel length of the pig body 11 according to the position of the calibration contour point and calculating the pixel length of the ear tag 12 according to the position of the ear tag contour point 14; the size prediction module 28 is used for calculating an actual size prediction value of the pig body 11 according to the pixel size of the pig body 11, the pixel size of the ear tag 12 and the actual size of the ear tag 12; the pig weight regression model training module 29 is used for reconstructing a pig weight regression model according to the actual size predicted value of the pig body 11, the position of the calibration contour point and the corresponding pig body; and the weight regression module 30 is used for calculating the pig weight corresponding to the weight measurement image according to the pig weight regression model.
When the pig weight measurement and calculation system 20 based on the image is used to measure and calculate the pig weight in the weight measurement and calculation image, the specific method refers to the pig weight measurement and calculation method based on the image disclosed in the above embodiment, and details are not repeated here.
The above is an embodiment of the present invention, and according to the method and the system for measuring pig weight based on an image provided by the present invention, a detection model for calibrating a pig body and an ear tag based on deep learning is trained by using a sample image, and positions and contours of the pig body and the ear tag in an image are determined according to the detection model, so that the body length and the body width of the pig body are calculated according to the size of the ear tag, a pig weight regression model is established, and the pig weight is determined according to the pig weight regression model, so that the weight of the pig body is estimated according to the image without contacting with the pig, the safety and health of a measurer are ensured, and the efficiency of obtaining pig weight data is improved. In the fields of insurance claim settlement and the like, the weight is used as a claim settlement index, so that the behavior that farmers cheat premium fees through water injection and other modes is avoided, and the claim settlement process is more fair. In addition, a reference object with a fixed position size does not need to be arranged, image acquisition equipment with complex requirements does not need to be erected, and the use cost is lower.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes will occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (6)
1. An image-based pig weight measurement method is characterized by comprising the following steps:
acquiring a sample image and a weight measurement image, and labeling a pig body position, an ear tag position, a pig body contour point, an ear tag contour point and a body type in the sample image and the weight measurement image;
preprocessing and normalizing the sample image and the weight measurement image;
training a feature detection model of the pig body and the ear tag according to the pig body position and the ear tag position of the sample image;
training a contour point regression model of the pig body and the ear tag according to the pig body contour points and the ear tag contour points of the sample image;
determining the pig body position and the ear tag position in the weight measurement image by using the characteristic detection model;
determining the position of a calibration contour point and the position of an ear tag contour point in the weight measurement image by using the contour point regression model;
calculating the pixel length of the pig body according to the position of the calibration contour point, and calculating the pixel length of the ear tag according to the position of the ear tag contour point;
calculating an actual size predicted value of the pig body according to the pixel size of the pig body, the pixel size of the ear tag and the actual size of the ear tag;
establishing a pig weight regression model according to the actual size predicted value of the pig body, the position of the calibration contour point and the corresponding pig body;
calculating according to the pig weight regression model to obtain the pig weight corresponding to the weight measurement image;
wherein the calculating the predicted value of the actual size of the pig body according to the pixel size of the pig body, the pixel size of the ear tag and the actual size of the ear tag specifically comprises:
selecting a pig ear root and a pig tail root as calibration contour points in the pig body contour points, calculating Euclidean distance between the calibration contour points according to a formula (2) as the pixel length of the pig body in the weight measurement image,
wherein (x)1,y1),(x2,y2) Coordinate positions of the pig ear root point and the pig tail root point in the weight measurement image are obtained;
calculating the pixel length d of the ear tag in the body weight measurement image according to the position of the outline point of the ear tag2;
Calculating the actual body length l of the pig body according to formula (3)pig,
lpig=d1/d2*ltag(3)
Wherein ltagIs the actual length of the ear tag;
calculating the actual body width W of the pig body according to the same methodpig;
Establishing a pig chest circumference statistical model C according to the length of the pig chest circumference of the pig bodypig=σ*WpigWherein, CpigThe length of the chest circumference of the pig is used, and sigma is a coefficient obtained according to statistical information;
the pig weight regression model specifically comprises the following steps: weightpig=f(Cpig,lpig,K1…Ki) Wherein, in the step (A),
Weightpigis the weight of pig, KiAnd obtaining the position of the ith pig body contour point through regression.
2. The image-based pig weight measurement method according to claim 1, wherein the training of the pig body and ear tag feature detection model according to the pig body position and the ear tag position of the sample image specifically comprises:
acquiring candidate regions of the pig body and the ear tag in the sample image;
extracting features of the candidate region by using a multilayer convolutional neural network;
classifying the candidate regions into pig body candidate regions and ear tag candidate regions according to the extracted features;
and respectively combining the pig body candidate region and the ear tag candidate region by using a non-maximum inhibition method to obtain the pig body region and the ear tag region in the sample image.
3. The image-based pig weight measurement method according to claim 1, wherein the training of the pig body and ear tag contour point regression models from the pig body contour points and the ear tag contour points of the sample image specifically comprises:
extracting features of the pig body image and the ear tag image by using a convolutional neural network to obtain contour key point information and corresponding contour point information predicted by the convolutional neural network;
and performing regression prediction on the pig body contour and the ear tag contour in the image by using a convolutional neural network.
4. The image-based pig weight measurement method according to claim 1, wherein the training of the pig body and ear tag contour point regression models from the pig body contour points and the ear tag contour points of the sample image specifically comprises:
extracting features of the pig body image and the ear tag image by using a convolutional neural network to obtain contour key point information and corresponding contour point information predicted by the convolutional neural network;
optimization is carried out by an Euclidean distance loss function of an expression (1) with an L2 regularization term,
wherein m is the number of key points on the contour of the pig body or the contour of the ear tag, PiThe i-th corresponding contour coordinate labeled artificially, f (x)iPredicted ith contour coordinate, w, for input image through convolutional neural networktIs the weight parameter of the convolutional neural network;
and performing regression prediction on the pig body contour and the ear tag contour in the image by using a convolutional neural network.
5. The image-based pig weight calculation method of claim 1, wherein the labeling of the pig's body type comprises three body types, lean, normal and fat.
6. An image-based pig weight measurement system applying the image-based pig weight measurement method of any one of claims 1 to 5, comprising:
the image acquisition module is used for acquiring a sample image and a weight measurement image and marking the pig body position, the ear tag position, the pig body contour point, the ear tag contour point and the body type in the sample image and the weight measurement image;
the preprocessing module is used for preprocessing and normalizing the sample image and the weight measurement image;
the characteristic detection model training module is used for training a characteristic detection model of the pig body and the ear tag according to the pig body position and the ear tag position of the sample image;
the contour point regression model training module is used for training a contour point regression model of the pig body and the ear tag according to the pig body contour points and the ear tag contour points of the sample image;
the characteristic detection module is used for determining the position of the pig body and the position of the ear tag in the weight measurement image by using the characteristic detection model;
the contour point detection module is used for determining the position of a calibration contour point and the position of an ear tag contour point in the weight measurement image by using the contour point regression model;
the pixel length calculating module is used for calculating the pixel length of the pig body according to the position of the calibrated outline point and calculating the pixel length of the ear tag according to the position of the ear tag outline point;
the size prediction module is used for calculating an actual size prediction value of the pig body according to the pixel size of the pig body, the pixel size of the ear tag and the actual size of the ear tag;
the pig weight regression model training module is used for reconstructing a pig weight regression model according to the actual size predicted value of the pig body, the position of the calibration contour point and the corresponding pig body;
and the weight regression module is used for calculating the pig weight corresponding to the weight measurement image according to the pig weight regression model.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810835051.4A CN109141248B (en) | 2018-07-26 | 2018-07-26 | Pig weight measuring and calculating method and system based on image |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810835051.4A CN109141248B (en) | 2018-07-26 | 2018-07-26 | Pig weight measuring and calculating method and system based on image |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109141248A CN109141248A (en) | 2019-01-04 |
CN109141248B true CN109141248B (en) | 2020-09-08 |
Family
ID=64798966
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810835051.4A Active CN109141248B (en) | 2018-07-26 | 2018-07-26 | Pig weight measuring and calculating method and system based on image |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109141248B (en) |
Families Citing this family (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111639777B (en) * | 2019-03-01 | 2023-09-29 | 京东科技信息技术有限公司 | Method and device for estimating target body weight |
CN110288580A (en) * | 2019-06-25 | 2019-09-27 | 深圳德里克设备有限公司 | Measurement method, measuring device and the readable storage medium storing program for executing of livestock weight |
CN110296660B (en) * | 2019-06-26 | 2021-03-02 | 北京海益同展信息科技有限公司 | Method and device for detecting livestock body ruler |
CN110426112B (en) * | 2019-07-04 | 2022-05-13 | 平安科技(深圳)有限公司 | Live pig weight measuring method and device |
CN110378953B (en) * | 2019-07-17 | 2023-05-02 | 重庆市畜牧科学院 | Method for intelligently identifying spatial distribution behaviors in swinery |
CN110672189A (en) * | 2019-09-27 | 2020-01-10 | 北京海益同展信息科技有限公司 | Weight estimation method, device, system and storage medium |
CN111860652B (en) * | 2020-07-22 | 2022-03-29 | 中国平安财产保险股份有限公司 | Method, device, equipment and medium for measuring animal body weight based on image detection |
CN113068657B (en) * | 2021-03-31 | 2022-04-08 | 重庆市畜牧技术推广总站 | Intelligent efficient pig raising method and system |
CN113096178A (en) * | 2021-04-25 | 2021-07-09 | 中国农业大学 | Pig weight estimation method, device, equipment and storage medium |
CN113177564B (en) * | 2021-05-16 | 2023-07-25 | 河南牧原智能科技有限公司 | Computer vision pig key point identification method |
CN113449638B (en) * | 2021-06-29 | 2023-04-21 | 北京新希望六和生物科技产业集团有限公司 | Pig image ideal frame screening method based on machine vision technology |
CN113920453A (en) * | 2021-10-13 | 2022-01-11 | 华南农业大学 | Pig body size weight estimation method based on deep learning |
CN114241523A (en) * | 2021-12-13 | 2022-03-25 | 河南牧原智能科技有限公司 | Method, device and related product for identifying abnormal-body type pigs |
CN114926633A (en) * | 2022-03-25 | 2022-08-19 | 成都爱记科技有限公司 | High-precision pig weight estimation method based on deep learning |
CN116989694A (en) * | 2023-08-04 | 2023-11-03 | 深圳市汇和通传感技术有限公司 | Dimension positioning detection system based on 3D contour scanning |
Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002286421A (en) * | 2001-03-28 | 2002-10-03 | Hideo Minagawa | Apparatus for measuring weight of animal |
CN101144705A (en) * | 2007-07-25 | 2008-03-19 | 中国农业大学 | Method for monitoring pig growth using binocular vision technology |
CN103884280A (en) * | 2014-03-14 | 2014-06-25 | 中国农业大学 | Mobile system for monitoring body sizes and weights of pigs in multiple pigsties |
WO2015050929A1 (en) * | 2013-10-01 | 2015-04-09 | The Children's Hospital Of Philadelphia | Image analysis for predicting body weight in humans |
CN104657717A (en) * | 2015-02-12 | 2015-05-27 | 合肥工业大学 | Pedestrian detection method based on layered kernel sparse representation |
JP2016059300A (en) * | 2014-09-17 | 2016-04-25 | 国立大学法人広島大学 | Cow body diagnostic system and cow body diagnostic method |
CN105651776A (en) * | 2015-12-30 | 2016-06-08 | 中国农业大学 | Device and method for automatically grading beef carcass meat yield based on computer vision |
CN105784083A (en) * | 2016-04-05 | 2016-07-20 | 北京农业信息技术研究中心 | Cow shape measuring method and cow shape measuring system based on stereo vision technology |
CN106296430A (en) * | 2015-05-22 | 2017-01-04 | 中国农业科学院农业信息研究所 | A kind of contactless herding sign information harvester and method |
CN106529006A (en) * | 2016-11-04 | 2017-03-22 | 北京农业信息技术研究中心 | Depth image-based broiler growth model fitting method and apparatus |
CN106529400A (en) * | 2016-09-26 | 2017-03-22 | 深圳奥比中光科技有限公司 | Mobile terminal and human body monitoring method and device |
CN107194987A (en) * | 2017-05-12 | 2017-09-22 | 西安蒜泥电子科技有限责任公司 | The method being predicted to anthropometric data |
CN107680130A (en) * | 2017-09-30 | 2018-02-09 | 深圳市云之梦科技有限公司 | One kind is based on the somatometric method and system of image |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107180438B (en) * | 2017-04-26 | 2020-02-07 | 清华大学 | Method for estimating size and weight of yak and corresponding portable computer device |
-
2018
- 2018-07-26 CN CN201810835051.4A patent/CN109141248B/en active Active
Patent Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002286421A (en) * | 2001-03-28 | 2002-10-03 | Hideo Minagawa | Apparatus for measuring weight of animal |
CN101144705A (en) * | 2007-07-25 | 2008-03-19 | 中国农业大学 | Method for monitoring pig growth using binocular vision technology |
WO2015050929A1 (en) * | 2013-10-01 | 2015-04-09 | The Children's Hospital Of Philadelphia | Image analysis for predicting body weight in humans |
CN103884280A (en) * | 2014-03-14 | 2014-06-25 | 中国农业大学 | Mobile system for monitoring body sizes and weights of pigs in multiple pigsties |
JP2016059300A (en) * | 2014-09-17 | 2016-04-25 | 国立大学法人広島大学 | Cow body diagnostic system and cow body diagnostic method |
CN104657717A (en) * | 2015-02-12 | 2015-05-27 | 合肥工业大学 | Pedestrian detection method based on layered kernel sparse representation |
CN106296430A (en) * | 2015-05-22 | 2017-01-04 | 中国农业科学院农业信息研究所 | A kind of contactless herding sign information harvester and method |
CN105651776A (en) * | 2015-12-30 | 2016-06-08 | 中国农业大学 | Device and method for automatically grading beef carcass meat yield based on computer vision |
CN105784083A (en) * | 2016-04-05 | 2016-07-20 | 北京农业信息技术研究中心 | Cow shape measuring method and cow shape measuring system based on stereo vision technology |
CN106529400A (en) * | 2016-09-26 | 2017-03-22 | 深圳奥比中光科技有限公司 | Mobile terminal and human body monitoring method and device |
CN106529006A (en) * | 2016-11-04 | 2017-03-22 | 北京农业信息技术研究中心 | Depth image-based broiler growth model fitting method and apparatus |
CN107194987A (en) * | 2017-05-12 | 2017-09-22 | 西安蒜泥电子科技有限责任公司 | The method being predicted to anthropometric data |
CN107680130A (en) * | 2017-09-30 | 2018-02-09 | 深圳市云之梦科技有限公司 | One kind is based on the somatometric method and system of image |
Non-Patent Citations (2)
Title |
---|
基于图像处理的杜泊羊体重估算模型研究;郝雪萍;《中国优秀硕士学位论文全文数据库 信息科技辑》;20180115(第01期);第I138-1573页 * |
基于计算机视觉术育肥猪体重分析研究;张凯等;《农机化研究》;20170531(第5期);第32-35页 * |
Also Published As
Publication number | Publication date |
---|---|
CN109141248A (en) | 2019-01-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109141248B (en) | Pig weight measuring and calculating method and system based on image | |
CN108961330B (en) | Pig body length measuring and calculating method and system based on image | |
CN108961269B (en) | Pig weight measuring and calculating method and system based on image | |
Shi et al. | An approach of pig weight estimation using binocular stereo system based on LabVIEW | |
CN109785337B (en) | In-column mammal counting method based on example segmentation algorithm | |
Song et al. | Automated body weight prediction of dairy cows using 3-dimensional vision | |
Xiao et al. | Cow identification in free-stall barns based on an improved Mask R-CNN and an SVM | |
WO2021000423A1 (en) | Pig weight measurement method and apparatus | |
Wongsriworaphon et al. | An approach based on digital image analysis to estimate the live weights of pigs in farm environments | |
Tsai et al. | Assessment of dairy cow heat stress by monitoring drinking behaviour using an embedded imaging system | |
Salau et al. | Feasibility of automated body trait determination using the SR4K time-of-flight camera in cow barns | |
Liu et al. | Automatic estimation of dairy cattle body condition score from depth image using ensemble model | |
Zhang et al. | Development and validation of a visual image analysis for monitoring the body size of sheep | |
He et al. | Automatic weight measurement of pigs based on 3D images and regression network | |
Huang et al. | Cow tail detection method for body condition score using Faster R-CNN | |
CN112288793B (en) | Method and device for detecting backfat of livestock individuals, electronic equipment and storage medium | |
CN112184791A (en) | Yak weight prediction method based on CNN-LSTM neural network | |
CN116295022A (en) | Pig body ruler measurement method based on deep learning multi-parameter fusion | |
Shorten | Computer vision and weigh scale-based prediction of milk yield and udder traits for individual cows | |
CN112907546B (en) | Non-contact measuring device and method for beef scale | |
CN110136192A (en) | A kind of ox body ruler algorithm detected based on deep learning and characteristic portion | |
CN117351404A (en) | Milk cow delivery stress degree judging and recognizing method and system | |
Li et al. | Automated measurement of beef cattle body size via key point detection and monocular depth estimation | |
Zhang et al. | Body weight estimation of yak based on cloud edge computing | |
Yu et al. | Non‐contact detection method of pregnant sows backfat thickness based on two‐dimensional images |
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 | ||
CP03 | Change of name, title or address |
Address after: Room 203, Floor 2, Building 6, Qinghe Xisanqi East Road, Haidian District, Beijing 100,089 Patentee after: Beijing Shenzhi Hengji Technology Co.,Ltd. Address before: 0706-003, 113 Zhichun Road, Haidian District, Beijing 100086 Patentee before: SHENYUAN HENGJI TECHNOLOGY CO.,LTD. |
|
CP03 | Change of name, title or address |