Image recognition-based body weight evaluation method and device, equipment and storage medium
The body curve was obtained through target segmentation and contour trimming, body length data was measured, and weight estimates were used to use preset models, which solved the problem of image stains affecting weight assessment and improved the accuracy of weight assessment.
Patent Information
- Application Number
- CN202411195939.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-08-28
AI Technical Summary
The existing weight evaluation method based on image recognition is prone to errors in the estimation of key points when there are stains in the insured object images, resulting in errors in weight estimation and reducing the estimated accuracy.
By obtaining the current image data of the target identification object, performing target segmentation and limb curve extraction, performing outline trimming to obtain body curves, measuring body length data, and using the preset weight estimate model to estimate weight to avoid stain occlusion Assessment of the impact.
The accuracy of weight evaluation based on image recognition is improved, ensuring the accuracy of weight estimates, especially when there are stains in the insured subject's image.
Smart Images

Figure CN119090937A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing and artificial intelligence technology, and in particular to a weight assessment method and device based on image recognition, an electronic device and a storage medium. Background Art
[0002] Weight assessment refers to estimating the weight of an individual through a series of indicators and methods. For example, the weight of farmed animals can be estimated by judging their size. In the insurance and claims settlement scenarios of farmed animals in the field of agricultural insurance, when the insured object is in a pending claim status, it is usually necessary to estimate the current status information of the insured object (such as weight, etc.), and then make corresponding compensation based on the current status information of the insured object.
[0003] At present, the weight assessment method based on image recognition is usually that the insurance agency estimates the weight of the insured person based on the photo of the insured person by using the key point extraction method. However, when there are stains on the image of the insured person, key point estimation errors are likely to occur when extracting key points of the insured person, resulting in errors in the insured person's weight estimation, thereby reducing the estimated accuracy of the insured person's weight. Therefore, how to improve the estimated accuracy of the insured person's weight has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a weight assessment method and device based on image recognition, an electronic device and a storage medium, aiming to improve the accuracy of the estimated weight of the insured person.
[0005] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application proposes a weight assessment method based on image recognition, the method comprising:
[0006] Obtain current image data containing the target recognition object;
[0007] Performing target segmentation on the current image data to obtain a main segmentation curve of the target recognition object;
[0008] Extracting the limb curve of the target recognition object from the subject segmentation curve;
[0009] Based on the limb curve, contour trimming is performed on the main body segmentation curve to obtain a body curve of the object;
[0010] Based on the body curve of the object, measuring the body length of the target identification object to obtain the body length data of the object;
[0011] The weight of the target identified object is estimated based on the object's body length data and a preset weight estimation model.
[0012] In some embodiments, the subject segmentation curve includes curve pixel points, and extracting the limb curve of the target recognition object from the subject segmentation curve includes:
[0013] Obtaining pixel coordinates of pixel points of the curve;
[0014] Based on a preset interval, selecting discrete pixel points from the pixel points of the curve;
[0015] Determining a discrete point curvature of the discrete pixel point based on the pixel point coordinates of the discrete pixel point;
[0016] Based on the discrete point curvature, a target discrete point is screened out from the pixel discrete points, wherein the discrete point curvature of the target discrete point is greater than a preset multiple of the maximum value of the discrete point curvature;
[0017] Based on the target discrete points, the main body segmentation curve is subjected to curve classification to obtain the limb curve.
[0018] In some embodiments, the performing curve classification on the main body segmentation curve based on the target discrete points to obtain the limb curve includes:
[0019] Filter out two adjacent discrete points adjacent to the target discrete point from the pixel discrete points;
[0020] Performing curve interception on the main segmentation curve between two adjacent discrete points to obtain candidate curve segments;
[0021] Connecting two adjacent discrete points to obtain a discrete point connection line;
[0022] Based on the candidate curve segments, curve selection is performed on the discrete point connection line to obtain the limb curve.
[0023] In some embodiments, the step of trimming the body segmentation curve based on the limb curve to obtain the subject body curve includes:
[0024] Based on the limb curve, determining the limb area, tail area and ear area of the target recognition object;
[0025] Based on the subject segmentation curve, determining the object subject area of the target recognition object;
[0026] Based on the limb regions, the tail region and the ear region, performing region deletion on the subject's main body region to obtain the subject's body region;
[0027] The object body curve is drawn based on the object body region and the main body segmentation curve.
[0028] In some embodiments, drawing the subject body curve based on the subject body region and the subject segmentation curve includes:
[0029] Based on the subject segmentation curve, determining an initial body curve of the subject's body region, wherein the initial body curve contains a curve disconnection region, and the curve disconnection region is used to represent an area where the initial body curve is not connected;
[0030] Based on the disconnected area of the curve, a linear interpolation calculation is performed to obtain an interpolation pixel point;
[0031] Based on the interpolated pixel points, the initial body curves are connected by curves to obtain the object body curve.
[0032] In some embodiments, the measuring the body length of the target identification object based on the body curve of the object to obtain the body length data of the object includes:
[0033] Determine a weight measurement reference area of the target identification object based on the object body curve, wherein the weight measurement reference area is an inner area surrounded by the object body curve, and the weight measurement reference area includes body pixels;
[0034] Calculating the center of gravity of the weight measurement reference area to obtain the center of gravity of the area;
[0035] Calculating the covariance matrix of the weight measurement reference area based on the body pixels and the center of gravity of the area;
[0036] Calculating the eigenvalues and eigenvectors of the covariance matrix;
[0037] Based on the feature vector, the feature value and the center of gravity of the region, determine the body length line segment and the body width line segment of the target identification object, wherein the body length line segment is the feature vector with the largest feature value passing through the center of gravity of the region, and the body width line segment is the feature vector with the smallest feature value passing through the center of gravity of the region;
[0038] Based on a preset reference object, the body length line segment and the body width line segment are calculated to obtain the body length data of the object.
[0039] In some embodiments, the method further includes training the weight estimation model, specifically including:
[0040] Acquire sample data of the test subject, wherein the sample data includes sample data of the body length and sample data of the body width of the test subject;
[0041] Based on the body width sample data, segment the sample data to obtain at least two first sample data sets;
[0042] Based on the body length sample data, segmenting the at least two first sample data sets to obtain at least two second sample data sets;
[0043] Performing linear fitting based on each of the second classification data sets to obtain a piecewise linear regression fitting function;
[0044] A linear regression model is constructed based on the piecewise linear regression fitting function to obtain the weight estimation model.
[0045] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application proposes a weight assessment device based on image recognition, the device comprising:
[0046] An image acquisition module, used to acquire current image data containing a target recognition object;
[0047] A target segmentation module, used to perform target segmentation on the current image data to obtain a main segmentation curve of the target recognition object;
[0048] A curve recognition module, used to extract the limb curve of the target recognition object from the main body segmentation curve;
[0049] A contour trimming module, used for trimming the contour of the main body segmentation curve based on the limb curve to obtain a body curve of the object;
[0050] A feature extraction module, used for measuring the body length of the target identification object based on the body curve of the object to obtain the body length data of the object;
[0051] The weight estimation module is used to estimate the weight of the target identification object based on the body length data of the object and a preset weight estimation model.
[0052] To achieve the above objectives, a third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0053] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0054] The weight assessment method and device based on image recognition, electronic device and storage medium proposed in the present application obtain current image data containing a target recognition object, and perform target segmentation on the current image data to obtain a main body segmentation curve of the target recognition object, thereby realizing the division of the main body parts of the target recognition object. Furthermore, the limb curve of the target recognition object is extracted from the main body segmentation curve, and the contour of the main body segmentation curve is trimmed according to the limb curve to obtain the object body curve, thereby realizing the elimination of the limb parts of the target recognition object and the extraction of the body parts, thereby avoiding the influence of the limb parts of the target recognition object on the weight assessment of the target based on image recognition, thereby improving the accuracy of the weight assessment based on image recognition. Finally, according to the object body curve, the body length of the target recognition object is measured to obtain the object body length data, and then the weight of the target recognition object is estimated according to the object body length data and a preset weight estimation model, thereby realizing the weight estimation using the body parts of the insured object, avoiding the influence of stains blocking the key points of the insured object on the weight estimation, and improving the accuracy of the weight assessment based on image recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 is a flow chart of a weight assessment method based on image recognition provided in an embodiment of the present application;
[0056] Figure 2 yes Figure 1 Flow chart of step S103 in FIG.
[0057] Figure 3 yes Figure 2 Flow chart of step S205 in FIG.
[0058] Figure 4 yes Figure 1 Flow chart of step S104 in FIG.
[0059] Figure 5 yes Figure 4 Flow chart of step S404 in FIG.
[0060] Figure 6 yes Figure 1 Flow chart of step S105 in FIG.
[0061] Figure 7 is a flow chart of weight estimation model training provided by another embodiment of the present application;
[0062] Figure 8 is a structural schematic diagram of a weight assessment device based on image recognition provided in an embodiment of the present application;
[0063] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0065] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0066] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0067] First, some nouns involved in this application are analyzed:
[0068] Linear regression model: A linear regression model is a statistical method used to model the relationship between two or more variables, especially the linear relationship between a dependent variable (also called response variable or target variable) and one or more independent variables (predictor variables or feature variables).
[0069] In insurance claims scenarios in the financial field, when the insured is in a pending claim status, it is usually necessary to estimate the insured's current status information (such as weight, etc.), and then make corresponding compensation based on the insured's current status information.
[0070] At present, the weight assessment method based on image recognition is usually that the insurance agency estimates the weight of the insured person based on the photo of the insured person by using the key point extraction method. However, when there are stains on the image of the insured person, key point estimation errors are likely to occur when extracting key points of the insured person, resulting in errors in the insured person's weight estimation, thereby reducing the estimated accuracy of the insured person's weight. Therefore, how to improve the estimated accuracy of the insured person's weight has become a technical problem that needs to be solved urgently.
[0071] Based on this, the embodiments of the present application provide a weight assessment method and device based on image recognition, an electronic device and a storage medium, aiming to improve the accuracy of the estimated weight of the insured person.
[0072] The image recognition-based weight assessment method and device, electronic device and storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the image recognition-based weight assessment method in the embodiments of the present application is described.
[0073] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0074] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0075] The weight assessment method based on image recognition provided in the embodiment of the present application relates to the field of image processing and artificial intelligence technology. The weight assessment method based on image recognition provided in the embodiment of the present application can be applied to a terminal, can also be applied to a server side, and can also be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements a weight assessment method based on image recognition, etc., but is not limited to the above forms.
[0076] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0077] Figure 1 is an optional flow chart of a weight assessment method based on image recognition provided in an embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S106.
[0078] Step S101, obtaining current image data containing a target recognition object;
[0079] Step S102, performing target segmentation on the current image data to obtain a main segmentation curve of the target recognition object;
[0080] Step S103, extracting the limb curve of the target recognition object from the main body segmentation curve;
[0081] Step S104, based on the limb curve, contour trimming is performed on the main body segmentation curve to obtain the object body curve;
[0082] Step S105, measuring the body length of the target identified object based on the object's body curve to obtain the object's body length data;
[0083] Step S106, estimating the weight of the target object based on the object's body length data and a preset weight estimation model.
[0084] Steps S101 to S106 shown in the embodiment of the present application perform target segmentation on the current image data containing the target recognition object to obtain a main body segmentation curve that segments the limbs, tail, ears and body parts of the target recognition object. Furthermore, the limb curve of the target recognition object is extracted from the main body segmentation curve. Secondly, based on the extracted limb curve, the main body segmentation curve is contour trimmed to obtain the object body curve of the target recognition object. Then, based on the trimmed object body curve, the body length of the target recognition object is measured to obtain the object body length data. Finally, based on the object body length data of the target recognition object and a pre-trained weight estimation model, the weight of the target recognition object is estimated. Therefore, the present application obtains current image data containing the target recognition object, and performs target segmentation on the current image data to obtain the main body segmentation curve of the target recognition object, thereby realizing the division of the main body parts of the target recognition object. Furthermore, the limb curve of the target recognition object is extracted from the main body segmentation curve, and the main body segmentation curve is contour-trimmed according to the limb curve to obtain the object body curve, thereby realizing the elimination of the limb parts of the target recognition object and the extraction of the body parts, thereby avoiding the influence of the limb parts of the target recognition object on the target weight assessment based on image recognition, thereby improving the accuracy of the weight assessment based on image recognition. Finally, according to the object body curve, the body length of the target recognition object is measured to obtain the object body length data, and then the weight of the target recognition object is estimated according to the object body length data and a preset weight estimation model, thereby realizing the estimation of weight using the body parts of the insured object, avoiding the influence of stains occluding the key points of the insured object on the weight estimation, and improving the accuracy of the weight assessment based on image recognition.
[0085] In step S101 of some embodiments, the target identification object may be an insured object specified in a farming insurance claim contract, for example, the target identification object may be livestock, wherein livestock include pigs, cattle, sheep, etc. The current image data may be image data when the target identification object is in a pending claim state, wherein the pending claim state refers to the state of the target identification object in a claim scenario specified in the insurance contract.
[0086] The present application can photograph the target identification object when the target identification object is in a pending claim status to obtain a target photo containing the target identification object. Furthermore, the current image data of the target photo can be obtained by using an image processing tool.
[0087] It is important to know that by photographing the side of the target identification object at a close distance, the area ratio of the target identification object in the target photo can be increased, which facilitates target detection of the target identification object, thereby improving the accuracy of the target's weight assessment based on image recognition.
[0088] In one application scenario, when the target identification object is a pig, the pig owner can take a photo of the pig that is in a claim status to obtain a target photo containing the pig, and then input the target photo containing the pig into an insurance claim APP or claim website, etc., to obtain the current image data of the pig.
[0089] In step S102 of some embodiments, the subject segmentation curve refers to a curve for segmenting the subject of the target identification object. For example, when the target identification object is a pig, the subject segmentation curve may be a curve for dividing the pig's body, limbs, ears and tail.
[0090] The present application can use the YOLOv8 (You Only Look Once) algorithm to segment the target recognition object in the current image data to obtain the main segmentation curve of the target recognition object. Specifically, based on the target segmentation purpose of the image data, the target detection model using the YOLOv8 (You Only Look Once) algorithm is trained to obtain the trained target detection model, and then the trained target detection model is used to perform target detection and target segmentation on the current image data to obtain the main segmentation curve of the target recognition object.
[0091] In one application scenario, when the target recognition object is a pig, the target detection model calculated using the YOLOv8 (You Only LookOnce) algorithm is used to perform target detection on the current image data of the pig, determine the position of the pig in the current image data, and then perform target segmentation on the image data at that position to obtain the main segmentation curve of the pig.
[0092] In step S103 of some embodiments, after obtaining the main segmentation curve of the target object for recognition, in order to avoid the influence of some interference areas in the target object for recognition on weight estimation, it is also necessary to extract the curve surrounding the above-mentioned interference area in the main segmentation curve to obtain the limb curve of the target object for recognition. It should be noted that the current image data is composed of pixel points, and therefore, the main segmentation curve is also composed of multiple curve pixel points.
[0093] See also Figure 2 In some embodiments, step S103 may include but is not limited to steps S201 to S205:
[0094] Step S201, obtaining pixel coordinates of the curve pixel points;
[0095] Step S202, selecting discrete pixel points from the curve pixel points based on a preset interval;
[0096] Step S203, determining the discrete point curvature of the discrete pixel point based on the pixel point coordinates of the discrete pixel point;
[0097] Step S204, based on the discrete point curvature, selecting a target discrete point from the pixel discrete points, wherein the discrete point curvature of the target discrete point is greater than a preset multiple of the maximum value of the discrete point curvature;
[0098] Step S205 , based on the target discrete points, classify the main body segmentation curve to obtain the limb curve.
[0099] In step S201 of some embodiments, a two-dimensional rectangular coordinate axis is constructed with any pixel point in the current image data as the origin, and then the spatial coordinates of the remaining pixel points in the current image data are extracted clockwise in an eight-field manner based on the two-dimensional rectangular coordinate axis, and the spatial coordinates of the curve pixel point are selected as the pixel point coordinates.
[0100] In step S202 of some embodiments, the preset interval may be a preset number of pixel points between discrete pixel points.
[0101] The present application can select pixel points of the curve according to a preset interval to obtain discrete pixel points.
[0102] In step S203 of some embodiments, the tangent vector of the discrete pixel point on the main segmentation curve is calculated based on the pixel coordinates of the discrete pixel point, and the curvature of the discrete pixel point on the main segmentation curve is calculated based on the tangent vector to obtain the curvature of the discrete point.
[0103] In step S204 of some embodiments, the preset multiple may be a pre-set multiple. After determining the discrete point curvature of each discrete point of a pixel, the maximum curvature of the discrete point with the largest value is selected from all the discrete point curvatures, and then the target curvature is determined according to the preset multiple and the maximum curvature of the discrete point, and the discrete point of the pixel whose discrete point curvature is greater than the target curvature is taken as the target discrete point.
[0104] In step S205 of some embodiments, the limb curve of the target recognition object can be determined by performing curve classification on the main body segmentation curve where the target discrete point is located.
[0105] For details, see Figure 3 In some embodiments, step S205 may include but is not limited to steps S301 to S304:
[0106] Step S301, selecting two adjacent discrete points adjacent to the target discrete point from the pixel discrete points;
[0107] Step S302, performing curve interception on the main segmentation curve between two adjacent discrete points to obtain candidate curve segments;
[0108] Step S303, connecting two adjacent discrete points to obtain a discrete point connection line;
[0109] Step S304: based on the candidate curve segments, curve selection is performed on the discrete point connection lines to obtain the limb curve.
[0110] In steps S301 to S303 of some embodiments, two pixel discrete points adjacent to the target discrete point among the pixel discrete points are taken as neighboring discrete points of the target discrete point, and then the main segmentation curve between the two neighboring discrete points is intercepted as a candidate curve segment, and then the two neighboring discrete points of the target discrete point are connected to obtain a discrete point connection line.
[0111] In step S304 of some embodiments, the length of the candidate curve segment can be measured according to the pixel coordinates to obtain the curve length, and then the length distance from the target discrete point to the midpoint of the discrete point line is calculated to obtain the target length. Secondly, the curve length is divided by the target length to obtain the ratio of the curve length to the target length, that is, the length ratio. Finally, according to the length ratio, the curve category of the candidate curve segment where the target discrete point is located is determined. Specifically, if the length ratio of the candidate curve segment is greater than a preset first ratio, the candidate curve segment is regarded as a limb curve or a tail curve of the target identification object; if the length ratio of the candidate curve segment is greater than a preset second ratio but less than the above-mentioned first ratio, the candidate curve segment is regarded as an ear curve of the target identification object. It should be noted that the first ratio and the second ratio can be preset ratio thresholds, and the second ratio is less than the first ratio. For example, when the target identification object is a pig, the first ratio can be 5 and the second ratio can be 2.
[0112] In steps S301 to S304 shown in this embodiment, the curve length is obtained by determining the adjacent discrete points of the target discrete point among the pixel discrete points and calculating the length of the alternative curve segment between the adjacent discrete points. The target length is then obtained by calculating the length from the target discrete point to the center of the discrete point line between the two adjacent discrete points. Secondly, the length ratio is obtained by calculating the ratio of the curve length to the target length. Finally, according to the length ratio, the curve category of the alternative curve segment where the target discrete point is located is determined, so that the curve classification of the alternative curve segment conforms to the general situation in reality, thereby improving the recognition accuracy of the limb curve.
[0113] In steps S201 to S205 shown in this embodiment, pixel points of the curve are selected at intervals to obtain pixel discrete points, and the curvature of the pixel discrete points is calculated based on the pixel point coordinates of the pixel discrete points. This can reduce the amount of curvature calculation, thereby improving the efficiency of weight assessment based on image recognition. Furthermore, based on the curvature, target discrete points are screened out from the pixel discrete points, and the main body segmentation curve is classified according to the target discrete points, so that the limb curve of the target recognition object can be obtained, which can improve the accuracy of limb curve extraction.
[0114] In step S104 of some embodiments, after the limb curve of the target object is determined, the main body segmentation curve of the target object is trimmed according to the limb curve to obtain the object body curve of the body part used for weight estimation.
[0115] See also Figure 4 In some embodiments, step S104 may include but is not limited to steps S401 to S404:
[0116] Step S401, determining the limbs area, tail area and ear area of the target recognition object based on the limb curve;
[0117] Step S402, determining the object body region of the target recognition object based on the body segmentation curve;
[0118] Step S403, based on the limbs region, the tail region and the ear region, the subject's main body region is region-reduced to obtain the subject's body region;
[0119] Step S404: drawing a body curve of the object based on the body region of the object and the main body segmentation curve.
[0120] In step S401 of some embodiments, the areas of the target identification object that interfere with weight estimation are determined based on the obtained limb curves, namely, the limb areas, tail areas and ear areas. Specifically, the areas of the target identification object surrounded by the limb curves are the limb areas, tail areas and ear areas.
[0121] In step S402 of some embodiments, the largest area enclosed by the subject segmentation curve is used as the object subject area of the target recognition object.
[0122] In step S403 of some embodiments, the limbs region, the tail region and the ear region in the main body region of the object are masked, and the unmasked region in the main body region of the object is the torso region of the object.
[0123] In step S404 of some embodiments, after the object body region of the target recognition object is determined, an object body curve of the object body region is drawn according to the object body region and the main body segmentation curve surrounding the object body region.
[0124] See also Figure 5 In some embodiments, step S404 may include but is not limited to steps S501 to S503:
[0125] Step S501, determining an initial body curve of a body region of a subject based on the subject segmentation curve, wherein the initial body curve contains a curve disconnection region, and the curve disconnection region is used to represent a region that is not connected to the initial body curve;
[0126] Step S502, performing linear interpolation calculation based on the disconnected area of the curve to obtain interpolated pixel points;
[0127] Step S503: Connect the disconnected curves based on the interpolated pixel points to obtain the object body curve.
[0128] In step S501 of some embodiments, the initial body curve of the body area of the object can be obtained by deleting or masking the limb curves in the main body segmentation curve. It should be noted that the limb curves include the initial body curve and together with the main body segmentation curve, so when the limb curves in the main body segmentation curve are deleted or masked, the initial body curve will be disconnected or incoherent, wherein the area where the initial body curve is disconnected or incoherent is the curve disconnection area.
[0129] In step S502 of some embodiments, the curve disconnection area is an area where the initial body curve is disconnected or incoherent. Therefore, the endpoints of the initial body curve exist at the edge of the curve disconnection area. According to the pixel point coordinates of the endpoints of the initial body curve, linear interpolation calculation is performed to obtain the interpolation pixel points filled in the curve disconnection area.
[0130] In step S503 of some embodiments, the endpoints of the initial body curve are connected to the interpolated pixel points in the curve disconnection area, so as to achieve curve supplementation of the initial body curve, thereby obtaining the object body curve surrounding the object body area of the target recognition object.
[0131] In steps S501 to S503 shown in the present embodiment, an initial body curve of the object's body region including a curve disconnection region is determined based on the main body segmentation curve, and then a linear interpolation calculation is performed based on the curve disconnection region to obtain interpolation pixel points of the supplementary curve disconnection region. Finally, based on the interpolation pixel points, the initial body curve is curve-connected to obtain the object body curve of the target identification object, so as to ensure that the area surrounded by the object body curve can be as close to the object body region as possible, thereby improving the accuracy of weight estimation.
[0132] In steps S401 to S404 shown in the present embodiment, the limb regions, tail region and ear regions of the target identification object are determined according to the limb curves, and then the object body region of the target identification object is determined according to the body segmentation curve. Furthermore, the object body region is region-reduced according to the limb regions, tail region and ear regions to obtain the object body region. Finally, the object body curve is drawn according to the object body region and the body segmentation curve, which can ensure that the object body curve does not include the limbs, tail and ears of the target identification object, thereby avoiding the influence of the limbs, tail and ears of the target identification object on the weight estimation, thereby improving the accuracy of the weight estimation.
[0133] In step S105 of some embodiments, the body length data of the target identification object within the area surrounded by the body curve of the object is measured to obtain the body length data of the object.
[0134] For details, see Figure 6 In some embodiments, step S105 may include but is not limited to steps S601 to S606:
[0135] Step S601, determining a weight measurement reference area of a target identification object based on a body curve of the object, wherein the weight measurement reference area is an inner area surrounded by the body curve of the object, and the weight measurement reference area includes body pixels;
[0136] Step S602, calculating the centroid of the weight measurement reference area to obtain the area centroid;
[0137] Step S603, calculating the covariance matrix of the weight measurement reference area based on the body pixels and the area centroid;
[0138] Step S604, calculating the eigenvalues and eigenvectors of the covariance matrix;
[0139] Step S605, based on the eigenvector, the eigenvalue and the center of gravity of the region, determining the body length line segment and the body width line segment of the target object for recognition, wherein the body length line segment is the eigenvector with the largest eigenvalue passing through the center of gravity of the region, and the body width line segment is the eigenvector with the smallest eigenvalue passing through the center of gravity of the region;
[0140] Step S606, based on the preset reference object, the body length line segment and the body width line segment are calculated to obtain the object's body length data.
[0141] In step S601 of some embodiments, the area enclosed by the body curve of the object is used as a weight measurement reference area of the target identification object in the current image data, and the pixel points in the weight measurement reference area are used as body pixel points.
[0142] In step S602 of some embodiments, the center of gravity of the weight measurement reference area is calculated using a regional center of gravity calculation formula to obtain the regional center of gravity.
[0143] In detail, the regional centroid can be calculated using the following formula:
[0144]
[0145]
[0146] Among them, G x Indicates the x-axis coordinate value of the center of gravity of the region, G y represents the y-axis coordinate value of the center of the region, i represents the index number of the body pixel point, N represents the number of body pixel points, and x i Indicates the x-axis coordinate value of the body pixel with index number i, i represents the y-axis coordinate value of the body pixel with index number i, i+1 The x-axis coordinate value of the pixel point of the body with index number i+1, i+1 Indicates the y-axis coordinate value of the body pixel with index number i+1.
[0147] In step S603 of some embodiments, after the center of gravity of the weight measurement reference area is determined, a covariance matrix of the weight measurement reference area is constructed according to the body pixels and the center of gravity.
[0148] Specifically, the covariance matrix of the weight measurement reference area can be calculated using the following formula:
[0149]
[0150] Where C represents the covariance matrix of the weight measurement reference area, i represents the index number of the body pixel point, N represents the number of body pixel points, G x Indicates the x-axis coordinate value of the center of gravity of the region, G y Indicates the y-axis coordinate value of the center of the area, x i Indicates the x-axis coordinate value of the body pixel with index number i, i represents the y-axis coordinate value of the body pixel with index number i, and T represents the transposed matrix.
[0151] In step S604 of some embodiments, the eigenvalues and eigenvectors of the covariance matrix are calculated using the calculation formulas for matrix eigenvalues and eigenvectors.
[0152] In step S605 of some embodiments, the feature vector with the largest feature value passing through the center of gravity of the region is used as the body length line segment of the target identification object, and the feature vector with the smallest feature value passing through the center of gravity of the region is used as the body width line segment of the target identification object.
[0153] In step S606 of some embodiments, the preset reference object refers to an object of known length that appears in the current image data, such as a square chessboard of fixed size, A4 paper, a standard ruler, etc.
[0154] The present application measures the size of the reference object in the current image data to clarify the scaling ratio of the current image data, and then determines the actual lengths of the torso length line segment and the torso width line segment based on the scaling ratio and the lengths of the torso length line segment and the torso width line segment in the current image data, and uses the actual lengths of the torso length line segment and the torso width line segment as the object body length data of the target identification object.
[0155] In steps S601 to S606 shown in the present embodiment, a weight measurement reference area of the target object is determined according to the object's body curve, and then the center of gravity of the weight measurement reference area is calculated according to the pixel coordinates of the body pixels in the weight measurement reference area to obtain the center of gravity of the area, and a covariance matrix of the weight measurement reference area is constructed according to the body pixels and the center of gravity of the area. Further, the eigenvalues and eigenvectors of the covariance matrix are calculated, and the body length line segment and body width line segment of the target object are determined according to the eigenvectors, eigenvalues and the center of gravity of the area. Finally, the body length line segment and the body width line segment are calculated according to a pre-set reference object to obtain the object's body length data, which can ensure the accuracy of the object's body length data, avoid manual measurement of the target object's body length data, and improve the measurement efficiency of the body length data.
[0156] In step S106 of some embodiments, the subject's body length data is input into a pre-trained weight estimation model, so that weight assessment of the target based on image recognition can be achieved.
[0157] It is important to know that experiments have shown that the mapping relationship between the body length data and the weight data of the target object has a segmented trend. Therefore, when training the weight estimation model, it is necessary to perform multiple training segments based on the sample data to obtain multiple segments of functions that characterize the mapping relationship between the body length data and the weight data.
[0158] Specifically, see Figure 7In some embodiments, before step S106, the weight assessment method based on image recognition may also include but is not limited to steps S701 to S705:
[0159] Step S701, obtaining sample data of the test subject, wherein the sample data includes body length sample data and body width sample data of the test subject;
[0160] Step S702, based on the body width sample data, segment the sample data to obtain at least two first sample data sets;
[0161] Step S703, based on the body length sample data, segmenting at least two first sample data sets to obtain at least two second sample data sets;
[0162] Step S704, performing linear fitting based on each second classification data set to obtain a piecewise linear regression fitting function;
[0163] Step S705, constructing a linear regression model based on the piecewise linear regression fitting function to obtain a weight estimation model.
[0164] In step S701 of some embodiments, the test object may be the same species as the target identification object, for example, when the target identification object is a pig, the test object is also a pig. The sample data may be data used to train a weight estimation model, and the sample data includes body length sample data, body width sample data, and weight sample data of the test object, wherein the body length sample data represents the length of the body of the test object, the body width sample data represents the width of the body of the test object, and the weight sample data represents the weight of the test object.
[0165] The present application can obtain the sample data of the test subject by searching the test subject's body length sample data, body width sample data and weight sample data through the Internet, or obtain the sample data of the test subject by manually measuring the test subject's body length, body width and weight.
[0166] In steps S702 and S703 of some embodiments, the sample data of the test subject can be segmented according to the experience of the professional and the body width sample data of the test subject to obtain at least two first sample data sets, and then the above-mentioned first sample data sets can be segmented according to the experience of the professional and the body length sample data of the test subject to obtain at least two second sample data sets.
[0167] In step S704 of some embodiments, multiple linear fittings are performed according to each second classification data set to obtain a piecewise fitting function, that is, a piecewise linear regression fitting function.
[0168] In step S705 of some embodiments, the piecewise linear regression fitting function is used as a weight estimation method in the linear regression model, so that a weight estimation model for estimating the species of the test subject can be obtained.
[0169] In steps S701 to S705 shown in the present embodiment, at least two second sample data sets are obtained by segmenting the acquired sample data of the test subject to improve the mapping accuracy between the body length sample data and the body width sample data of the test subject and the weight sample data of the test subject. Furthermore, linear fitting is performed on each second classification data set to obtain a piecewise linear regression fitting function, and then a linear regression model is constructed based on the piecewise linear regression fitting function to obtain a weight estimation model, thereby improving the accuracy of the weight estimation model and thus improving the accuracy of the estimated weight of the insured subject.
[0170] The present application obtains current image data containing a target recognition object, and performs target segmentation on the current image data to obtain a main body segmentation curve of the target recognition object, thereby achieving division of the main body parts of the target recognition object. Furthermore, the limb curve of the target recognition object is extracted from the main body segmentation curve, and the main body segmentation curve is contour-trimmed according to the limb curve to obtain the object body curve, thereby achieving elimination of the limb parts of the target recognition object and extraction of the body parts, thereby avoiding the influence of the limb parts of the target recognition object on the weight assessment of the target based on image recognition, thereby improving the accuracy of weight assessment based on image recognition. Finally, according to the object body curve, the body length of the target recognition object is measured to obtain the object body length data, and then the weight of the target recognition object is estimated according to the object body length data and a preset weight estimation model, thereby achieving weight estimation using the body parts of the insured object, avoiding the influence of stains occluding the key points of the insured object on the weight estimation, and improving the accuracy of weight assessment based on image recognition.
[0171] See also Figure 8 The embodiment of the present application further provides a weight assessment device based on image recognition, which can implement the above-mentioned weight assessment method based on image recognition, and the device includes:
[0172] An image acquisition module 801 is used to acquire current image data containing a target recognition object;
[0173] The target segmentation module 802 is used to perform target segmentation on the current image data to obtain a main segmentation curve of the target recognition object;
[0174] The curve recognition module 803 is used to extract the limb curve of the target recognition object from the main body segmentation curve;
[0175] A contour trimming module 804 is used to trim the contour of the main body segmentation curve based on the limb curve to obtain the object body curve;
[0176] The feature extraction module 805 is used to measure the body length of the target identified object based on the body curve of the object to obtain the body length data of the object;
[0177] The weight estimation module 806 is used to estimate the weight of the target identification object based on the object's body length data and a preset weight estimation model.
[0178] The specific implementation of the weight assessment device based on image recognition is basically the same as the specific implementation of the weight assessment method based on image recognition described above, and will not be described in detail herein.
[0179] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned weight assessment method based on image recognition when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0180] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0181] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0182] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solution provided in the embodiments of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the weight assessment method based on image recognition in the embodiments of this application;
[0183] Input / output interface 903, used to implement information input and output;
[0184] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0185] A bus 905 that transmits information between the various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0186] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0187] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned weight assessment method based on image recognition is implemented.
[0188] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0189] The weight assessment method based on image recognition, the weight assessment device based on image recognition, the electronic device and the storage medium provided in the embodiments of the present application perform target segmentation on the current image data containing the target recognition object to obtain the main body segmentation curve that segments the limbs, tail, ears and body parts of the target recognition object. Furthermore, the limb curve of the target recognition object is extracted from the main body segmentation curve. Secondly, according to the extracted limb curve, the main body segmentation curve is contour trimmed to obtain the object body curve of the target recognition object. Then, according to the trimmed object body curve, the body length of the target recognition object is measured to obtain the object body length data. Finally, according to the object body length data of the target recognition object and a pre-trained weight estimation model, the weight of the target recognition object is estimated.
[0190] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0191] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0192] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0193] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0194] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0195] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0196] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0197] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0198] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0199] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0200] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A weight assessment method based on image recognition, characterized in that: The method comprises: Obtain current image data containing the target recognition object; Performing target segmentation on the current image data to obtain a main segmentation curve of the target recognition object; Extracting the limb curve of the target recognition object from the subject segmentation curve; Based on the limb curve, contour trimming is performed on the main body segmentation curve to obtain a body curve of the object; Based on the body curve of the object, measuring the body length of the target identification object to obtain the body length data of the object; The weight of the target identified object is estimated based on the object's body length data and a preset weight estimation model.
2. The method according to claim 1, characterized in that The subject segmentation curve includes curve pixel points, and extracting the limb curve of the target recognition object from the subject segmentation curve includes: Obtaining pixel coordinates of pixel points of the curve; Based on a preset interval, selecting discrete pixel points from the pixel points of the curve; Determining a discrete point curvature of the discrete pixel point based on the pixel point coordinates of the discrete pixel point; Based on the discrete point curvature, a target discrete point is screened out from the pixel discrete points, wherein the discrete point curvature of the target discrete point is greater than a preset multiple of the maximum value of the discrete point curvature; Based on the target discrete points, the main body segmentation curve is subjected to curve classification to obtain the limb curve.
3. The method according to claim 2, characterized in that The method of performing curve classification on the main body segmentation curve based on the target discrete points to obtain the limb curve includes: Filter out two adjacent discrete points adjacent to the target discrete point from the pixel discrete points; Performing curve interception on the main segmentation curve between two adjacent discrete points to obtain candidate curve segments; Connecting two adjacent discrete points to obtain a discrete point connection line; Based on the candidate curve segments, curve selection is performed on the discrete point connection line to obtain the limb curve.
4. The method according to claim 1, characterized in that: The step of trimming the main body segmentation curve based on the limb curve to obtain the object body curve includes: Based on the limb curve, determining the limb area, tail area and ear area of the target recognition object; Based on the subject segmentation curve, determining the object subject area of the target recognition object; Based on the limb regions, the tail region and the ear region, performing region deletion on the subject's main body region to obtain the subject's body region; The object body curve is drawn based on the object body region and the main body segmentation curve.
5. The method according to claim 4, characterized in that Drawing the object body curve based on the object body region and the main body segmentation curve includes: Based on the subject segmentation curve, determining an initial body curve of the subject's body region, wherein the initial body curve contains a curve disconnection region, and the curve disconnection region is used to represent an area where the initial body curve is not connected; Based on the disconnected area of the curve, a linear interpolation calculation is performed to obtain an interpolation pixel point; Based on the interpolated pixel points, the initial body curves are connected by curves to obtain the object body curve.
6. The method according to any one of claims 1 to 5, characterized in that: The step of measuring the body length of the target identification object based on the body curve of the object to obtain the body length data of the object includes: Determine a weight measurement reference area of the target identification object based on the object body curve, wherein the weight measurement reference area is an inner area surrounded by the object body curve, and the weight measurement reference area includes body pixels; Calculating the center of gravity of the weight measurement reference area to obtain the center of gravity of the area; Calculating the covariance matrix of the weight measurement reference area based on the body pixels and the center of gravity of the area; Calculating the eigenvalues and eigenvectors of the covariance matrix; Based on the feature vector, the feature value and the center of gravity of the region, determine the body length line segment and the body width line segment of the target identification object, wherein the body length line segment is the feature vector with the largest feature value passing through the center of gravity of the region, and the body width line segment is the feature vector with the smallest feature value passing through the center of gravity of the region; Based on a preset reference object, the body length line segment and the body width line segment are calculated to obtain the body length data of the object.
7. The method according to any one of claims 1 to 5, characterized in that: The method further includes training the weight estimation model, specifically including: Acquire sample data of the test subject, wherein the sample data includes sample data of the body length and sample data of the body width of the test subject; Based on the body width sample data, segment the sample data to obtain at least two first sample data sets; Based on the body length sample data, segmenting the at least two first sample data sets to obtain at least two second sample data sets; Performing linear fitting based on each of the second classification data sets to obtain a piecewise linear regression fitting function; A linear regression model is constructed based on the piecewise linear regression fitting function to obtain the weight estimation model.
8. A weight assessment device based on image recognition, characterized in that: The device comprises: An image acquisition module, used to acquire current image data containing a target recognition object; A target segmentation module, used to perform target segmentation on the current image data to obtain a main segmentation curve of the target recognition object; A curve recognition module, used to extract the limb curve of the target recognition object from the main body segmentation curve; A contour trimming module, used for trimming the contour of the main body segmentation curve based on the limb curve to obtain a body curve of the object; A feature extraction module, used for measuring the body length of the target identification object based on the body curve of the object to obtain the body length data of the object; The weight estimation module is used to estimate the weight of the target identification object based on the body length data of the object and a preset weight estimation model.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the weight assessment method based on image recognition according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the weight assessment method based on image recognition according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Photographing stature measuring method based on image recognition algorithm
CN112800899A
Pig weight intelligent estimation method based on three-dimensional point cloud data
CN118052768A
Size calculation method, size calculation device and program
JP2023141683A
Machine learning based activity detection utilizing reconstructed 3D arm postures
US20220051145A1
