Image recognition-based weight assessment methods, devices, equipment, and storage media
By segmenting and contour trimming the image data of the target object, extracting the body curve for body length measurement, and combining it with a weight prediction model, the problem of image blemishes affecting the accuracy of weight prediction is solved, achieving a more accurate weight assessment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN TECH (SHENZHEN) CO LTD
- Filing Date
- 2024-08-28
- Publication Date
- 2026-05-26
AI Technical Summary
Existing image recognition-based weight assessment methods are prone to errors in key point prediction when there are blemishes in the insured's image, leading to inaccurate weight estimates.
By acquiring the current image data of the target object, the target is segmented to obtain the main body segmentation curve. The limb curves are extracted and the contours are trimmed to obtain the object's body curve. The body length is measured based on the object's body curve, and the weight is estimated using a preset weight estimation model.
It improves the accuracy of weight assessment, avoids the impact of blemishes on key points, and ensures the precision of weight prediction.
Smart Images

Figure CN119090937B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of image processing and artificial intelligence technology, and in particular to a weight assessment method and apparatus, electronic device and storage medium based on image recognition. Background Technology
[0002] Weight assessment refers to the estimation of an individual's weight through a series of indicators and methods. For example, by judging the size of farmed animals, the weight of farmed animals can be estimated. In the agricultural insurance field, when the insured is in a pending claim state, it is usually necessary to estimate the current status information of the insured (such as weight) and then make corresponding compensation based on the current status information of the insured.
[0003] Currently, image recognition-based weight assessment methods typically involve insurance companies estimating the insured's weight based on their photographs using key point extraction. However, when the insured's image contains blemishes, key point extraction can easily lead to errors in key point estimation, resulting in inaccurate weight estimates and reducing the accuracy of weight prediction. Therefore, improving the accuracy of insured weight prediction has become an urgent technical problem to be solved. Summary of the Invention
[0004] The main objective of this application is to propose a weight assessment method, device, electronic device, and storage medium based on image recognition, which aims to improve the accuracy of weight prediction for insured individuals.
[0005] To achieve the above objectives, a first aspect of this application proposes a weight assessment method based on image recognition, the method comprising:
[0006] Obtain the current image data containing the target object;
[0007] The current image data is segmented to obtain the main body segmentation curve of the target object.
[0008] Extract the limb curve of the target object from the main body segmentation curve;
[0009] Based on the limb curve, the main body segmentation curve is trimmed to obtain the object's body curve;
[0010] Based on the object's body curve, the body length of the target object is measured to obtain the object's body length data;
[0011] Based on the object's body length data and a preset weight prediction model, the weight of the target object is predicted.
[0012] In some embodiments, the subject segmentation curve includes curve pixels, and extracting the limb curve of the target recognition object from the subject segmentation curve includes:
[0013] Obtain the pixel coordinates of the curve pixels;
[0014] Based on a preset interval, discrete pixel points are selected from the curve pixels;
[0015] Based on the pixel coordinates of the discrete pixel, determine the discrete point curvature of the discrete pixel;
[0016] Based on the discrete point curvature, target discrete points are selected from the pixel discrete points, wherein the discrete point curvature of the target discrete points 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 classified to obtain the limb curve.
[0018] In some embodiments, the step of performing curve classification on the body segmentation curve based on the target discrete points to obtain the limb curve includes:
[0019] Select two neighboring discrete points that are adjacent to the target discrete point from the discrete pixel points;
[0020] The main segmentation curve between two adjacent discrete points is truncated to obtain candidate curve segments;
[0021] Connect two of the adjacent discrete points to obtain a line connecting the discrete points;
[0022] Based on the candidate curve segments, the curves are selected by connecting the discrete points to obtain the limb curves.
[0023] In some embodiments, the step of contour trimming the main body segmentation curve based on the limb curve to obtain the object's body curve includes:
[0024] Based on the limb curves, the limb regions, tail region, and ear region of the target object are determined;
[0025] Based on the subject segmentation curve, the object subject region of the target recognition object is determined;
[0026] Based on the limb region, the tail region, and the ear region, the main body region of the object is reduced to obtain the object's torso region;
[0027] Based on the object's body region and the main body segmentation curve, the object's body curve is drawn.
[0028] In some embodiments, drawing the object's body curve based on the object's body region and the body segmentation curve includes:
[0029] Based on the main body segmentation curve, an initial body curve for the object's body region is determined, wherein there are curve disconnection regions in the initial body curve, and the curve disconnection regions are used to characterize the unconnected areas of the initial body curve.
[0030] Based on the disconnected area of the curve, linear interpolation calculation is performed to obtain the interpolated pixels;
[0031] Based on the interpolated pixels, the initial body curve is connected to obtain the object's body curve.
[0032] In some embodiments, the step of measuring the body length of the target object based on the object's body curve to obtain object body length data includes:
[0033] Based on the object's body curve, a weight measurement reference region for the target recognition object is determined, wherein the weight measurement reference region is the internal region enclosed by the object's body curve, and the weight measurement reference region includes body pixels;
[0034] The center of gravity of the weight measurement reference area is calculated to obtain the center of gravity of the area;
[0035] Based on the body pixels and the centroid of the region, calculate the covariance matrix of the weight measurement reference region;
[0036] Calculate the eigenvalues and eigenvectors of the covariance matrix;
[0037] Based on the feature vector, the feature value, and the centroid of the region, the body length segment and body width segment of the target object are determined, wherein the body length segment is the feature vector with the largest feature value passing through the centroid of the region, and the body width segment is the feature vector with the smallest feature value passing through the centroid of the region.
[0038] Based on a preset reference object, the length segment and width segment of the body are calculated to obtain the body length data of the object.
[0039] In some embodiments, the method further includes training the weight prediction model, specifically including:
[0040] Obtain sample data of the test object, wherein the sample data includes sample data of the test object's body length and sample data of its body width;
[0041] Based on the body width sample data, the sample data is segmented to obtain at least two first sample datasets;
[0042] Based on the body length sample data, the at least two first sample datasets are segmented to obtain at least two second sample datasets.
[0043] A piecewise linear regression fitting function is obtained by performing linear fitting on each of the second classification datasets.
[0044] A linear regression model is constructed based on the piecewise linear regression fitting function to obtain the weight prediction model.
[0045] To achieve the above objectives, a second aspect of this application provides a weight assessment device based on image recognition, the device comprising:
[0046] The image acquisition module is used to acquire current image data containing the target object for recognition;
[0047] The target segmentation module is used to segment the current image data to obtain the main segmentation curve of the target object.
[0048] The curve recognition module is used to extract the limb curve of the target object from the main body segmentation curve;
[0049] The contour trimming module is used to trim the contour of the main body segmentation curve based on the limb curve to obtain the object's body curve;
[0050] The feature extraction module is used to measure the body length of the target object based on the object's body curve to obtain the object's body length data;
[0051] The weight prediction module is used to predict the weight of the target object based on the object's body length data and a preset weight prediction model.
[0052] To achieve the above objectives, a third aspect of the present application provides an electronic device, the electronic device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method described in the first aspect.
[0053] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect.
[0054] The image recognition-based weight assessment method, apparatus, electronic device, and storage medium proposed in this application acquire current image data containing the target object, segment the current image data to obtain the main body segmentation curve of the target object, thereby dividing the main body of the target object. Further, the limb curves of the target object are extracted from the main body segmentation curves, and the main body segmentation curves are trimmed according to the limb curves to obtain the object's body curve. This achieves the removal of limb parts and the extraction of body parts, avoiding the influence of the target object's limb parts on the image recognition-based weight assessment, thus improving the accuracy of the image recognition-based weight assessment. Finally, the body length of the target object is measured according to the object's body curve to obtain the object's body length data. Then, based on the object's body length data and a preset weight prediction model, the weight of the target object is predicted. This realizes the prediction of weight using the insured object's body parts, avoiding the influence of blemishes obscuring key points of the insured object on the weight prediction, and improving the accuracy of the image recognition-based weight assessment. Attached Figure Description
[0055] Figure 1 This is a flowchart of the image recognition-based weight assessment method provided in the embodiments of this application;
[0056] Figure 2 yes Figure 1 The flowchart of step S103 in the process;
[0057] Figure 3 yes Figure 2 The flowchart of step S205 in the document;
[0058] Figure 4 yes Figure 1 The flowchart of step S104 in the process;
[0059] Figure 5 yes Figure 4 The flowchart of step S404 in the document;
[0060] Figure 6 yes Figure 1 The flowchart of step S105 in the process;
[0061] Figure 7 This is a flowchart of the training of a weight prediction model provided in another embodiment of this application;
[0062] Figure 8 This is a schematic diagram of the image recognition-based weight assessment device provided in the embodiments of this application;
[0063] Figure 9 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0064] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0065] It should be noted that although functional modules are divided in the device schematic diagram and a 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 aforementioned 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 commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0067] First, let's analyze some of the terms used in this application:
[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 known as a response variable or target variable) and one or more independent variables (predictors or characteristic variables).
[0069] In the context of insurance claims in the financial sector, when an insured person is in a pending claim state, it is usually necessary to estimate the current status information of the insured person (such as weight) and then make corresponding compensation based on the current status information of the insured person.
[0070] Currently, image recognition-based weight assessment methods typically involve insurance companies estimating the insured's weight based on their photographs using key point extraction. However, when the insured's image contains blemishes, key point extraction can easily lead to errors in key point estimation, resulting in inaccurate weight estimates and reducing the accuracy of weight prediction. Therefore, improving the accuracy of insured weight prediction has become an urgent technical problem to be solved.
[0071] Based on this, embodiments of this application provide a weight assessment method and apparatus, electronic device and storage medium based on image recognition, which aim to improve the accuracy of weight prediction for insured individuals.
[0072] The image recognition-based weight assessment method, apparatus, electronic device, and storage medium provided in this application are specifically described through the following embodiments. First, the image recognition-based weight assessment method in this application is described.
[0073] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0074] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0075] The image recognition-based weight assessment method provided in this application relates to the fields of image processing and artificial intelligence. This image recognition-based weight assessment method can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the image recognition-based weight assessment method, but is not limited to the above forms.
[0076] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: 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, and distributed computing environments including any of the above systems or devices. This 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. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0077] Figure 1 This is an optional flowchart of the image recognition-based weight assessment method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S101 to S106.
[0078] Step S101: Obtain the current image data containing the target object;
[0079] Step S102: Perform target segmentation on the current image data to obtain the main segmentation curve of the target object;
[0080] Step S103: Extract the limb curve of the target object from the main body segmentation curve;
[0081] Step S104: Based on the limb curve, the outline of the main body segmentation curve is trimmed to obtain the object's body curve;
[0082] Step S105: Based on the object's body curve, measure the body length of the target object to obtain the object's body length data;
[0083] Step S106: Based on the object's body length data and the preset weight prediction model, the weight of the target object is predicted.
[0084] Steps S101 to S106 as shown in the embodiments of this application involve target segmentation of the current image data containing the target object to obtain the main segmentation curves that segment the limbs, tail, ears, and torso of the target object. Further, the limb curves of the target object are extracted from the main segmentation curves. Then, the main segmentation curves are trimmed according to the extracted limb curves to obtain the object body curves of the target object. The body length of the target object is measured according to the trimmed object body curves to obtain the object body length data. Finally, the weight of the target object is estimated according to the object body length data and the pre-trained weight prediction model. Therefore, this application obtains current image data containing the target object and performs target segmentation on the current image data to obtain the main body segmentation curve of the target object, thereby dividing the main body of the target object. Further, it extracts the limb curve of the target object from the main body segmentation curve and trims the contour of the main body segmentation curve based on the limb curve to obtain the object's body curve, thus eliminating the limb parts of the target object and extracting the body parts. This avoids the influence of the limb parts of the target object on the image-based weight assessment, thereby improving the accuracy of the image-based weight assessment. Finally, based on the object's body curve, it measures the body length of the target object to obtain the object's body length data. Then, based on the object's body length data and a preset weight prediction model, it predicts the weight of the target object. This achieves weight prediction using the body parts of the insured object, avoiding the influence of blemishes obscuring key points of the insured object on weight prediction, and improving the accuracy of the image-based weight assessment.
[0085] In step S101 of some embodiments, the target identification object can be the insured object specified in the livestock insurance claim contract. For example, the target identification object can be livestock, including pigs, cattle, sheep, etc. The current image data can be image data of the target identification object in a pending claim state, where the pending claim state refers to the state of the target identification object under the claim scenario specified in the insurance contract.
[0086] This application can take a picture of the target object when the target object is in a pending claim state, and obtain a target photo containing the target object. Furthermore, the current image data of the target photo can be obtained by using image processing tools.
[0087] It is important to know that by taking close-up photos of the side of the target object, the area ratio of the target object in the target image can be increased, which facilitates the target detection of the target object and thus improves the accuracy of the target's weight assessment based on image recognition.
[0088] In one application scenario, when the target object is a pig, the pig owner can take a picture of the pig that is in the pending claim state to obtain a target photo containing the pig. Then, the target photo containing the pig can be entered into an insurance claim APP or claim website to obtain the current image data of the pig.
[0089] In step S102 of some embodiments, the subject segmentation curve refers to the curve that segments the subject of the target object. For example, when the target object is a pig, the subject segmentation curve can be the curve that divides the pig's body, limbs, ears and tail.
[0090] This application can use the YOLOv8 (You Only Look Once) algorithm to segment target recognition objects in the current image data and 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. 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 object is a pig, the target detection model using the YOLOv8 (You Only LookOnce) algorithm is used to detect the pig in the current image data, determine the pig's position in the current image data, and then perform target segmentation on the image data at that position to obtain the main body segmentation curve of the pig.
[0092] In step S103 of some embodiments, after obtaining the main body segmentation curve of the target object, in order to avoid the influence of some interference areas in the target object on the weight prediction, it is also necessary to extract the curves surrounding the interference areas in the main body segmentation curve to obtain the limb curves of the target object. It should be noted that the current image data is composed of pixels, therefore, the main body segmentation curve is also composed of multiple curve pixels.
[0093] Please see Figure 2 In some embodiments, step S103 may include, but is not limited to, steps S201 to S205:
[0094] Step S201: Obtain the pixel coordinates of the curve pixels;
[0095] Step S202: Select discrete pixel points from the curve pixels based on a preset interval;
[0096] Step S203: Determine the curvature of the discrete points of the pixel based on the pixel coordinates.
[0097] Step S204: Based on the discrete point curvature, select target discrete points from the pixel discrete points, wherein the discrete point curvature of the target discrete points is greater than a preset multiple of the maximum value of the discrete point curvature.
[0098] Step S205: Based on the target discrete points, perform curve classification on 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 in the current image data as the origin. Then, based on the two-dimensional rectangular coordinate axis, the spatial coordinates of the remaining pixels in the current image data are extracted clockwise in an eight-neighborhood manner, and the spatial coordinates of the curved pixel are selected as the pixel coordinates.
[0100] In step S202 of some embodiments, the preset interval may be the number of pixels between discrete pixel points that are set in advance.
[0101] This application can select pixels from curve pixels at preset intervals to obtain discrete pixel points.
[0102] In step S203 of some embodiments, the tangent vector of the pixel discrete point on the main body segmentation curve is calculated based on the pixel coordinates of the pixel discrete point, and then the curvature of the pixel discrete point on the main body 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 multiplier can be a pre-set multiplier. After determining the discrete curvature of each pixel discrete point, the maximum discrete curvature with the largest value is selected from all discrete curvatures. Then, based on the preset multiplier and the maximum discrete curvature, the target curvature is determined, and the pixel discrete points with a discrete curvature greater than the target curvature are taken as target discrete points.
[0104] In step S205 of some embodiments, the limb curve of the target object can be determined by performing curve classification on the subject segmentation curve where the target discrete point is located.
[0105] For details, please refer to Figure 3 In some embodiments, step S205 may include, but is not limited to, steps S301 to S304:
[0106] Step S301: Select two neighboring discrete points that are adjacent to the target discrete point from the discrete pixel points;
[0107] Step S302: Extract the main segmentation curve between two adjacent discrete points to obtain candidate curve segments;
[0108] Step S303: Connect two adjacent discrete points to obtain a line connecting the discrete points;
[0109] Step S304: Based on the candidate curve segments, select the curves by connecting the discrete points to obtain the limb curves.
[0110] In steps S301 to S303 of some embodiments, two pixel discrete points adjacent to the target discrete point are taken as neighboring discrete points of the target discrete point, and the main segmentation curve between the two neighboring discrete points is taken as the candidate curve segment. Then, the two neighboring discrete points of the target discrete point are connected to obtain the 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. Then, the distance from the target discrete point to the midpoint of the line connecting the discrete points can be calculated to obtain the target length. Next, the curve length and the target length are divided to obtain the ratio of the curve length to the target length, i.e., the length ratio. Finally, the curve category of the candidate curve segment where the target discrete point is located is determined according to the length ratio. Specifically, if the length ratio of the candidate curve segment is greater than a preset first ratio, the candidate curve segment is regarded as the limb curve or tail curve of the target object. If the length ratio of the candidate curve segment is greater than a preset second ratio but less than the first ratio, the candidate curve segment is regarded as the ear curve of the target 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 object is a pig, the first ratio can be 5 and the second ratio can be 2.
[0112] In steps S301 to S304 of this embodiment, the neighboring discrete points of the target discrete point are determined among the pixel discrete points, and the length of the candidate curve segment between the neighboring discrete points is calculated to obtain the curve length. Then, the length of the line connecting the target discrete point to the center of the line between the two neighboring discrete points is calculated to obtain the target length. Next, the length ratio is obtained by calculating the ratio of the curve length to the target length. Finally, the curve category of the candidate curve segment where the target discrete point is located is determined according to the length ratio, so that the curve classification of the candidate curve segment conforms to the general situation in reality and improves the recognition accuracy of limb curves.
[0113] In steps S201 to S205 of this embodiment, discrete pixel points are obtained by selecting curve pixels at intervals. Then, the curvature of the discrete pixel points is calculated based on the pixel coordinates, which reduces the amount of curvature calculation and improves the efficiency of image recognition-based weight assessment. Furthermore, target discrete points are selected from the discrete pixel points based on the curvature, and the subject segmentation curve is classified based on the target discrete points to obtain the limb curve of the target object, thereby improving the accuracy of limb curve extraction.
[0114] In step S104 of some embodiments, after determining the limb curve of the target recognition object, the main body segmentation curve of the target recognition object is trimmed according to the limb curve to obtain the object body curve of the body part used for weight estimation.
[0115] Please see Figure 4 In some embodiments, step S104 may include, but is not limited to, steps S401 to S404:
[0116] Step S401: Based on limb curves, determine the limb region, tail region, and ear region of the target object;
[0117] Step S402: Based on the main body segmentation curve, determine the main body region of the target recognition object;
[0118] Step S403: Based on the limb region, tail region and ear region, perform region reduction on the main body region of the object to obtain the body region of the object.
[0119] Step S404: Draw the object's body curve based on the object's body region and main body segmentation curve.
[0120] In step S401 of some embodiments, the regions where the parts of the target object that interfere with weight prediction are located are determined based on the obtained limb curves, namely the limb region, tail region and ear region. Specifically, the parts of the target object enclosed by the limb curves are the limb region, tail region and ear region.
[0121] In step S402 of some embodiments, the largest region enclosed by the main body segmentation curve is taken as the object main body region of the target recognition object.
[0122] In step S403 of some embodiments, the limbs, tail, and ear regions in the main body region of the object are masked, and the unmasked areas in the main body region of the object are the body regions of the object.
[0123] In step S404 of some embodiments, after determining the object body region of the target recognition object, the object body curve of the object body region is drawn based on the object body region and the main body segmentation curve surrounding the object body region.
[0124] Please see Figure 5 In some embodiments, step S404 may include, but is not limited to, steps S501 to S503:
[0125] Step S501: Based on the main body segmentation curve, determine the initial body curve of the object's body region. The initial body curve contains curve disconnection regions, which are used to characterize the unconnected areas of the initial body curve.
[0126] Step S502: Based on the curve disconnection area, perform linear interpolation calculation to obtain interpolated pixels;
[0127] Step S503: Based on the interpolated pixels, connect the disconnected curves to obtain the object's body curve.
[0128] In step S501 of some embodiments, by deleting or masking the limb curves in the main body segmentation curve, the initial body curve of the object's body region can be obtained. It should be noted that the limb curves together with the initial body curves form the main body segmentation curve. Therefore, when deleting or masking the limb curves in the main body segmentation curve, the initial body curve will be broken or discontinuous. The area where the initial body curve is broken or discontinuous is the curve disconnection area.
[0129] In step S502 of some embodiments, the curve disconnection region is the region where the initial body curve is broken or discontinuous. Therefore, the edge of the curve disconnection region has the endpoint of the initial body curve. Based on the pixel coordinates of the endpoint of the initial body curve, linear interpolation calculation is performed to obtain the interpolated pixels filled in the curve disconnection region.
[0130] In step S503 of some embodiments, connecting the endpoints of the initial body curve with the interpolated pixels in the curve disconnection region can achieve curve supplementation of the initial body curve, thereby obtaining the object body curve surrounding the object body region of the target recognition object.
[0131] In steps S501 to S503 of this embodiment, the initial body curve of the object's body region, including the curve disconnection area, is determined according to the main body segmentation curve. Then, linear interpolation calculation is performed based on the curve disconnection area to obtain the interpolated pixel points of the supplementary curve disconnection area. Finally, the initial body curve is connected according to the interpolated pixel points to obtain the object body curve of the target recognition object, so as to ensure that the area surrounded by the object body curve can be as close as possible to the object body region, thereby improving the accuracy of weight prediction.
[0132] In steps S401 to S404 of this embodiment, the limb region, tail region, and ear region of the target object are determined based on the limb curve. Then, the main body region of the target object is determined based on the main body segmentation curve. Further, the main body region of the target object is reduced based on the limb region, tail region, and ear region to obtain the torso region. Finally, the torso curve of the target object is drawn based on the torso region and the main body segmentation curve. This ensures that the torso curve does not include the limbs, tail, and ears of the target object, thus avoiding the influence of the limbs, tail, and ears of the target object on the weight prediction and improving the accuracy of the weight prediction.
[0133] In step S105 of some embodiments, the body length data of the target object is obtained by measuring the body length data of the target object within the area surrounded by the body curve of the object.
[0134] For details, please refer to Figure 6 In some embodiments, step S105 may include, but is not limited to, steps S601 to S606:
[0135] Step S601: Based on the object's body curve, determine the weight measurement reference area of the target recognition object, wherein the weight measurement reference area is the internal area enclosed by the object's body curve, and the weight measurement reference area includes body pixels.
[0136] Step S602: Calculate the center of gravity of the weight measurement reference area to obtain the center of gravity of the area;
[0137] Step S603: Calculate the covariance matrix of the weight measurement reference region based on body pixels and region centroid.
[0138] Step S604: Calculate the eigenvalues and eigenvectors of the covariance matrix;
[0139] Step S605: Based on the feature vector, feature value and region centroid, determine the body length line segment and body width line segment of the target object. The body length line segment is the feature vector with the largest feature value passing through the region centroid, and the body width line segment is the feature vector with the smallest feature value passing through the region centroid.
[0140] Step S606: Based on a preset reference object, calculate the body length segment and body width segment to obtain the object's body length data.
[0141] In step S601 of some embodiments, the region enclosed by the curve of the object's body is used as a weight measurement reference region for the target object in the current image data, and the pixels in the weight measurement reference region are used as body pixels.
[0142] In step S602 of some embodiments, the location of the center of gravity of the weight measurement reference area is calculated using the regional center of gravity calculation formula to obtain the regional center of gravity.
[0143] In detail, the centroid of the region can be calculated using the following formula:
[0144]
[0145]
[0146] Among them, G x G represents the x-axis coordinate of the centroid of the region. y The x-axis coordinate of the region center is represented by i, the index number of the body pixel is represented by N, and the x-axis coordinate of the body pixel is represented by x. i This represents the x-axis coordinate of the body pixel with index number i, and the y-axis coordinate of the body pixel with index number i. i This represents the y-axis coordinate of the body pixel with index number i. i+1 This represents the x-axis coordinate of the body pixel with index number i+1, and the y-axis coordinate of the body pixel with index number i+1. i+1 This represents the y-axis coordinate of the body pixel with index number i+1.
[0147] In step S603 of some embodiments, after determining the centroid of the weight measurement reference area, a covariance matrix of the weight measurement reference area is constructed based on the body pixels and the centroid of the area.
[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, N represents the number of body pixels, and G... x G represents the x-axis coordinate of the centroid of the region. y The x-axis coordinate represents the center of the region. i This represents the x-axis coordinate of the body pixel with index number i, and the y-axis coordinate of the body pixel with index number i. i This represents the y-axis coordinate of the body pixel with index number i, and T represents the transpose matrix.
[0151] In step S604 of some embodiments, the eigenvalues and eigenvectors of the covariance matrix are calculated using the formulas for calculating matrix eigenvalues and eigenvectors.
[0152] In step S605 of some embodiments, the feature vector with the largest feature value passing through the centroid of the region is taken as the body length line segment of the target object, and the feature vector with the smallest feature value passing through the centroid of the region is taken as the body width line segment of the target 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 checkerboard of fixed size, A4 paper, a standard ruler, etc.
[0154] This application determines the scaling ratio of the current image data by measuring the size of the reference object in the current image data, and then determines the actual length of the body length segment and body width segment based on the scaling ratio and the length of the body length segment and body width segment in the current image data, and uses the actual length of the body length segment and body width segment as the object length data of the target recognition object.
[0155] In steps S601 to S606 of this embodiment, a weight measurement reference area for the target object is determined based on the object's body curve. Then, the centroid of the weight measurement reference area is calculated based on the pixel coordinates of the body pixels in the weight measurement reference area. The covariance matrix of the weight measurement reference area is constructed based on the body pixels and the centroid. Furthermore, the eigenvalues and eigenvectors of the covariance matrix are calculated. Based on the eigenvectors, eigenvalues, and the centroid, the length and width segments of the target object's body are determined. Finally, the length and width segments of the body are calculated based on a pre-set reference object to obtain the object's body length data. This ensures the accuracy of the object's body length data, avoids manual measurement of the target object's body length data, and improves the efficiency of body length data measurement.
[0156] In step S106 of some embodiments, the object's body length data is input into a pre-trained weight prediction model, which enables image recognition-based weight assessment of the target.
[0157] It is important to know that, based on experiments, the mapping relationship between the body length data and weight data of the target object exhibits a segmented trend. Therefore, when training the weight prediction model, it is necessary to perform multi-segment training based on sample data to obtain multiple functions that represent the mapping relationship between body length data and weight data.
[0158] Specifically, please refer to Figure 7In some embodiments, prior to step S106, the image recognition-based weight assessment method may include, but is not limited to, steps S701 to S705:
[0159] Step S701: Obtain sample data of the test object, wherein the sample data includes sample data of the body length and sample data of the body width of the test object;
[0160] Step S702: Based on the body width sample data, the sample data is segmented to obtain at least two first sample datasets;
[0161] Step S703: Based on the body length sample data, at least two first sample datasets are segmented to obtain at least two second sample datasets;
[0162] Step S704: Perform linear fitting based on each second-class dataset to obtain a piecewise linear regression fitting function;
[0163] Step S705: Construct a linear regression model based on the piecewise linear regression fitting function to obtain the weight prediction model.
[0164] In step S701 of some embodiments, the test object can be the same species as the target object; for example, when the target object is a pig, the test object is also a pig. The sample data can be data used to train the weight prediction model. 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 test object's body, the body width sample data represents the width of the test object's body, and the weight sample data represents the weight of the test object.
[0165] This application can obtain sample data of test subjects by searching for sample data of body length, body width, and weight of test subjects online, or by manually measuring the body length, body width, and weight of test subjects.
[0166] In steps S702 and S703 of some embodiments, the sample data of the test subject can be segmented based on the experience of professionals and the body width sample data of the test subject to obtain at least two first sample datasets. Then, based on the experience of professionals and the body length sample data of the test subject, the first sample datasets can be segmented to obtain at least two second sample datasets.
[0167] In step S704 of some embodiments, multiple linear fittings are performed based on each second classification dataset to obtain a piecewise fitting function, i.e., a piecewise linear regression fitting function.
[0168] In step S705 of some embodiments, the piecewise linear regression fitting function is used as the weight prediction method in the linear regression model, which can obtain a weight prediction model for the species of the test subject.
[0169] In steps S701 to S705 of this embodiment, the obtained sample data of the test subjects are segmented to obtain at least two second sample datasets, thereby improving the mapping accuracy between the body length sample data and body width sample data of the test subjects and the weight sample data of the test subjects. Furthermore, linear fitting is performed on each second classification dataset 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 prediction model, thereby improving the accuracy of the weight prediction model and thus improving the prediction accuracy of the insured's weight.
[0170] This application acquires current image data containing the target object and performs target segmentation on the current image data to obtain the main body segmentation curve of the target object, thereby dividing the main body of the target object. Further, it extracts the limb curves of the target object from the main body segmentation curves and trims the contours of the main body segmentation curves based on the limb curves to obtain the object's body curves. This achieves the removal of limb parts and the extraction of body parts, avoiding the influence of the target object's limb parts on the image-based weight assessment, thus improving the accuracy of the image-based weight assessment. Finally, based on the object's body curves, it measures the length of the target object to obtain the object's length data. Then, based on the object's length data and a preset weight prediction model, it predicts the weight of the target object. This achieves weight prediction using the insured object's body parts, avoiding the influence of blemishes obscuring key points of the insured object on weight prediction, and improving the accuracy of the image-based weight assessment.
[0171] Please see Figure 8 This application also provides an image recognition-based weight assessment device that can implement the above-described image recognition-based weight assessment method. The device includes:
[0172] Image acquisition module 801 is used to acquire current image data containing the target recognition object;
[0173] The target segmentation module 802 is used to segment the current image data to obtain the main segmentation curve of the target object.
[0174] The curve recognition module 803 is used to extract the limb curve of the target object from the main body segmentation curve.
[0175] The 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's body curve.
[0176] The feature extraction module 805 is used to measure the body length of the target object based on the object's body curve to obtain the object's body length data.
[0177] The weight prediction module 806 is used to predict the weight of the target object based on the object's body length data and a preset weight prediction model.
[0178] The specific implementation of this image recognition-based weight assessment device is basically the same as the specific implementation of the image recognition-based weight assessment method described above, and will not be repeated here.
[0179] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned image recognition-based weight assessment method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0180] Please see Figure 9 , Figure 9 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:
[0181] The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, 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 this application.
[0182] The memory 902 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 902 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called and executed by the processor 901 to implement the image recognition-based weight assessment method of the embodiments of this application.
[0183] The input / output interface 903 is used to implement information input and output;
[0184] The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0185] Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904);
[0186] The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.
[0187] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described image recognition-based weight assessment method.
[0188] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0189] The image recognition-based weight assessment method, device, electronic device, and storage medium provided in this application embodiment segment the current image data containing the target object to obtain the main segmentation curves that segment the limbs, tail, ears, and torso of the target object. Further, the limb curves of the target object are extracted from the main segmentation curves. Then, the contours of the main segmentation curves are trimmed according to the extracted limb curves to obtain the object body curves of the target object. The body length of the target object is measured according to the trimmed object body curves to obtain the object body length data. Finally, the weight of the target object is estimated according to the object body length data and a pre-trained weight prediction model.
[0190] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0191] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0192] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0193] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0194] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0195] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0196] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. The coupling or direct coupling or communication connection between the shown or discussed units may be through some interfaces, or indirect coupling or communication connection between the apparatus or units, and may be electrical, mechanical, or other forms.
[0197] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0198] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0199] If the integrated unit is implemented as 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 this application, in essence, 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. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0200] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A weight assessment method based on image recognition, characterized in that, The method includes: Obtain the current image data containing the target object; The current image data is segmented to obtain the main body segmentation curve of the target object. Extract the limb curve of the target object from the main body segmentation curve; Based on the limb curve, the main body segmentation curve is trimmed to obtain the object's body curve; Based on the object's body curve, the body length of the target object is measured to obtain the object's body length data; Based on the object's body length data and a preset weight estimation model, the weight of the target object is estimated. The method further includes training the weight prediction model, specifically including: Obtain sample data of the test object, wherein the sample data includes sample data of the test object's body length and sample data of its body width; Based on the body width sample data, the sample data is segmented to obtain at least two first sample datasets; Based on the body length sample data, the at least two first sample datasets are segmented to obtain at least two second sample datasets. A piecewise linear regression fitting function is obtained by performing linear fitting on each of the second sample datasets. A linear regression model is constructed based on the piecewise linear regression fitting function to obtain the weight prediction model.
2. The method according to claim 1, characterized in that, The main body segmentation curve includes curve pixels, and the extraction of the limb curve of the target recognition object from the main body segmentation curve includes: Obtain the pixel coordinates of the curve pixels; Based on a preset interval, discrete pixel points are selected from the curve pixels; Based on the pixel coordinates of the discrete pixel, determine the discrete point curvature of the discrete pixel; Based on the discrete point curvature, target discrete points are selected from the pixel discrete points, wherein the discrete point curvature of the target discrete points is greater than a preset multiple of the maximum value among the discrete point curvatures; Based on the target discrete points, the main body segmentation curve is classified to obtain the limb curve.
3. The method according to claim 2, characterized in that, The step of classifying the body segmentation curve based on the target discrete points to obtain the limb curve includes: Select two neighboring discrete points that are adjacent to the target discrete point from the discrete pixel points; The main segmentation curve between two adjacent discrete points is truncated to obtain candidate curve segments; Connect two of the adjacent discrete points to obtain a line connecting the discrete points; Based on the candidate curve segments, the curves are selected by connecting the discrete points to obtain the limb curves.
4. The method according to claim 1, characterized in that, The process of trimming the contour of the main body segmentation curve based on the limb curve to obtain the object's body curve includes: Based on the limb curves, the limb regions, tail region, and ear region of the target object are determined; Based on the subject segmentation curve, the object subject region of the target recognition object is determined; Based on the limb region, the tail region, and the ear region, the main body region of the object is reduced to obtain the object's torso region; Based on the object's body region and the main body segmentation curve, the object's body curve is drawn.
5. The method according to claim 4, characterized in that, The step of drawing the object's body curve based on the object's body region and the main body segmentation curve includes: Based on the main body segmentation curve, an initial body curve for the object's body region is determined, wherein there are curve disconnection regions in the initial body curve, and the curve disconnection regions are used to characterize the unconnected areas of the initial body curve. Based on the disconnected area of the curve, linear interpolation calculation is performed to obtain the interpolated pixels; Based on the interpolated pixels, the initial body curve is connected to obtain the object's body curve.
6. The method according to any one of claims 1-5, characterized in that, The step of measuring the body length of the target object based on the object's body curve to obtain object body length data includes: Based on the object's body curve, a weight measurement reference region for the target recognition object is determined, wherein the weight measurement reference region is the internal region enclosed by the object's body curve, and the weight measurement reference region includes body pixels; The center of gravity of the weight measurement reference area is calculated to obtain the center of gravity of the area; Based on the body pixels and the centroid of the region, calculate the covariance matrix of the weight measurement reference region; Calculate the eigenvalues and eigenvectors of the covariance matrix; Based on the feature vector, the feature value, and the centroid of the region, the body length segment and body width segment of the target object are determined, wherein the body length segment is the feature vector with the largest feature value passing through the centroid of the region, and the body width segment is the feature vector with the smallest feature value passing through the centroid of the region. Based on a preset reference object, the length segment and width segment of the body are calculated to obtain the body length data of the object.
7. A weight assessment device based on image recognition, used to implement the weight assessment method based on image recognition as described in any one of claims 1-6, characterized in that, The device includes: The image acquisition module is used to acquire current image data containing the target object for recognition; The target segmentation module is used to segment the current image data to obtain the main segmentation curve of the target object. The curve recognition module is used to extract the limb curve of the target object from the main body segmentation curve; The contour trimming module is used to trim the contour of the main body segmentation curve based on the limb curve to obtain the object's body curve; The feature extraction module is used to measure the body length of the target object based on the object's body curve to obtain the object's body length data; The weight prediction module is used to predict the weight of the target object based on the object's body length data and a preset weight prediction model.
8. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the image recognition-based weight assessment method according to any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the image recognition-based weight assessment method according to any one of claims 1 to 6.