Live pig weight estimation method, device, and storage medium

By collecting optical images and scene feature data of pigs, and performing structured quantification and correction processing, the problem of inaccurate weight estimation in multi-dimensional scenarios of pig weight estimation models was solved, and the accuracy and uniformity of pig weight estimation results were achieved.

CN122049576BActive Publication Date: 2026-07-10SHENZHEN XIWEI SMART TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN XIWEI SMART TECH CO LTD
Filing Date
2026-04-15
Publication Date
2026-07-10

Smart Images

  • Figure CN122049576B_ABST
    Figure CN122049576B_ABST
Patent Text Reader

Abstract

This application discloses a method, device, and storage medium for estimating the weight of pigs, relating to the field of animal weight estimation technology. The method includes: acquiring optical images of the pig to be weighted and current multidimensional scene feature data; inputting the optical images into a pig weight estimation model, predicting the weight of the pig to be weighted using the model, and obtaining an initial weight estimate; performing structured quantization on the current multidimensional scene feature data to obtain a corresponding current multidimensional scene feature vector; matching at least one first target correction template from candidate correction templates associated with each reference scene based on the current multidimensional scene feature vector; determining a target correction template based on at least one first target correction template, and correcting the initial weight estimate using the correction function of the target correction template to obtain the corrected weight estimate of the pig to be weighted. This solves the technical problem of inaccurate weight estimation results caused by differences in multidimensional scenes in existing pig weight estimation models, and improves the accuracy of the weight estimation results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of animal weight estimation technology, and in particular to a method, device and storage medium for estimating the weight of pigs. Background Technology

[0002] In the slaughtering stage of pig farming management, non-contact pig weight estimation technology based on optical images is commonly used. This involves deploying a unified image recognition and weight estimation model to analyze collected pig images and directly predict pig weight, thus bridging the gap in pig weight data management between farmers and asset managers. However, in this type of non-contact pig weight estimation technology, the uniformly deployed weight estimation model is easily affected by various scenario factors in practical applications. These multi-dimensional scenario factors, strongly correlated with specific situations, can interfere with image acquisition quality and the visual presentation of pig morphology. This can lead to inconsistent, inaccurate, and unpredictable weight estimation deviations for the same weight of pigs in different specific scenarios. Consequently, it is difficult to guarantee the accuracy of weight estimation results across different farming locations, time points, and farming conditions in practical applications, and it is also difficult to ensure the consistency of pig weight data between farmers and asset managers.

[0003] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0004] The main purpose of this application is to provide a method, device and storage medium for estimating the weight of pigs, which aims to solve the technical problem of inaccurate weight estimation results caused by systematic biases in pig weight estimation models due to differences in multi-dimensional scenarios.

[0005] To achieve the above objectives, this application proposes a method for estimating the weight of live pigs, the method comprising:

[0006] Optical images of the newborn pigs to be estimated are acquired using an image acquisition device, and the current multidimensional scene feature data at the time of optical image acquisition is obtained.

[0007] The optical image is input into the pig weight estimation model, and the weight of the pig to be estimated is predicted by the pig weight estimation model to obtain an initial weight estimate.

[0008] The current multidimensional scene feature data is structured and quantized to obtain the corresponding current multidimensional scene feature vector;

[0009] Based on the current multidimensional scene feature vector, at least one first target correction template is matched from the candidate correction templates associated with each reference scene respectively;

[0010] A target correction template is determined based on the at least one first target correction template, and the initial weight estimate is corrected using the correction function of the target correction template to obtain the corrected weight estimate of the pig to be estimated.

[0011] In one embodiment, before the step of matching at least one first target correction template from candidate correction templates associated with each reference scene based on the current multidimensional scene feature vector, the method further includes:

[0012] Optical images of multiple reference pigs under each of the aforementioned reference scenarios, multidimensional reference scenario feature data under each of the aforementioned reference scenarios, and actual weight values ​​of each of the aforementioned reference pigs under each of the aforementioned reference scenarios are collected.

[0013] The optical image of the reference pig is input into the pig weight estimation model to obtain the reference initial weight estimate of the reference pig.

[0014] The multidimensional reference scene feature data corresponding to each of the reference scenes are subjected to structured quantization processing to obtain the multidimensional reference scene feature vector corresponding to each of the reference scenes.

[0015] The deviation between the reference initial estimated weight value and the actual weighing value corresponding to each reference scenario is calculated and fitted to obtain the correction function corresponding to each reference scenario.

[0016] The correction function corresponding to each reference scene is bound to the multidimensional reference scene feature vector and multidimensional reference scene feature data corresponding to the reference scene to form the candidate correction template associated with each reference scene.

[0017] In one embodiment, the multidimensional scene feature data includes device configuration parameters, environmental parameters, and attribute parameters of the pig to be estimated for rebirth. The step of performing structured quantization on the current multidimensional scene feature data to obtain the corresponding current multidimensional scene feature vector includes:

[0018] Linear normalization is performed on the installation height and pitch angle in the equipment configuration parameters, the temperature, humidity, light intensity, latitude, longitude and altitude in the environmental parameters, and the age in the attribute parameters to obtain continuous numerical feature components.

[0019] The breed identifier in the attribute parameters of the newborn pig to be estimated is digitally encoded to obtain the category feature component;

[0020] The image acquisition timestamp in the environmental parameters is parsed into a seasonal identifier, and the seasonal identifier is digitally encoded to obtain seasonal feature components.

[0021] The continuous numerical feature components, the category feature components, and the seasonal feature components are concatenated in a preset order to generate the current multidimensional scene feature vector corresponding to the current multidimensional scene feature data.

[0022] In one embodiment, the step of matching at least one first target correction template from the candidate correction templates associated with each reference scene based on the current multidimensional scene feature vector includes:

[0023] Obtain the multidimensional reference scene feature vector in each of the candidate correction templates, as well as the weights of each feature dimension in the multidimensional reference scene feature vector and the current multidimensional scene feature vector;

[0024] Based on the weights of each feature dimension, the weighted similarity between the current multi-dimensional scene feature vector and the multi-dimensional reference scene feature vector in each candidate correction template is calculated, and the weighted similarity is used as the first scene matching degree between the corresponding candidate correction template and the current acquisition scene.

[0025] If the first scene matching degree is greater than or equal to the preset matching degree threshold, the candidate correction template corresponding to the first scene matching degree with the largest value is used as the first target correction template.

[0026] If the matching degree of the first scene is less than the preset matching degree threshold, all the candidate correction templates are sorted from high to low according to the matching degree of the first scene.

[0027] A predetermined number of candidate correction templates that rank highly are selected as the first target correction template.

[0028] In one embodiment, the step of determining the target correction template based on the at least one first target correction template includes:

[0029] If the number of the first target correction templates is one, then the first target correction template is used as the target correction template;

[0030] If the number of the first target correction templates is greater than one, obtain the template confidence of each first target correction template, and calculate the first fusion weight corresponding to each first target correction template based on the first scene matching degree corresponding to each first target correction template and the template confidence of each first target correction template.

[0031] The correction parameters of the correction functions in each of the first target correction templates are weighted and summed according to the first fusion weight to generate the first fusion correction parameters, and the target correction template is constructed based on the first fusion correction parameters.

[0032] In one embodiment, prior to the step of determining the target correction template based on the at least one first target correction template, the method further includes:

[0033] Receive a template selection instruction, parse the template selection instruction, and determine at least one second target correction template from the candidate correction templates associated with each of the reference scenarios based on the parsing results;

[0034] If the number of the second target correction templates is one, then the second target correction template is used as the target correction template;

[0035] If the number of the second target correction templates is greater than one, obtain the template confidence of each second target correction template;

[0036] Determine the second scene matching degree between each second target correction template and the current acquisition scene;

[0037] Based on the second scene matching degree corresponding to each second target correction template and the template confidence degree corresponding to each second target correction template, calculate the second fusion weight corresponding to each second target correction template;

[0038] The correction parameters of the correction functions in each of the second target correction templates are weighted and summed according to the second fusion weight to generate second fusion correction parameters, and the target correction template is constructed based on the second fusion correction parameters;

[0039] The process proceeds to the step of executing the correction function based on the target correction template to correct the initial weight estimate, thereby obtaining the corrected weight estimate of the pig to be estimated.

[0040] In one embodiment, the step of acquiring optical images of the newborn pig to be estimated using an image acquisition device includes:

[0041] The image acquisition device is used to photograph the newborn pig to be estimated, thereby obtaining the initial image of the newborn pig to be estimated.

[0042] The posture recognition of the newborn pig to be estimated in the initial captured image is performed to obtain the posture recognition result corresponding to the initial captured image. The posture recognition result is used to indicate whether the posture category of the newborn pig to be estimated is a preset posture category.

[0043] If the posture recognition result corresponding to the pig to be estimated is yes, the initial captured image is determined as the optical image.

[0044] In one embodiment, the method for estimating the weight of pigs further includes:

[0045] Foreground segmentation is performed on the optical image to extract the complete outline region of the newborn pig to be estimated in the optical image;

[0046] Feature point detection and extraction are performed on the complete contour region to obtain the image pixel feature parameters corresponding to the body length, body height, chest circumference, abdominal circumference, and hip width of the pig to be estimated.

[0047] Based on the pixel size calibration algorithm, the image pixel feature parameters are converted into physical size parameters to obtain the body shape feature parameters of the newborn pig to be estimated.

[0048] The body shape feature parameters are mapped by rules to determine the target body shape category corresponding to the newborn pig to be estimated;

[0049] Based on the target body shape category and the pre-set correspondence between body shape category and weight correction factor, the target weight correction factor corresponding to the newborn pig to be estimated is determined;

[0050] The initial estimated weight is corrected based on the target weight correction factor to obtain the corrected estimated weight of the pig to be weighed.

[0051] Furthermore, to achieve the above objectives, this application also proposes a pig weight estimation device, which includes:

[0052] The data acquisition module is used to acquire optical images of the newborn pigs to be estimated through an image acquisition device, and to obtain the current multi-dimensional scene feature data at the time of optical image acquisition.

[0053] The initial weight estimation module is used to input the optical image into the pig weight estimation model, predict the weight of the pig to be estimated through the pig weight estimation model, and obtain the initial weight estimation value.

[0054] The feature extraction module is used to perform structured quantization on the current multidimensional scene feature data to obtain the corresponding current multidimensional scene feature vector;

[0055] The correction template determination module is used to match at least one first target correction template from the candidate correction templates associated with each reference scene based on the current multi-dimensional scene feature vector.

[0056] The correction module is used to determine a target correction template based on the at least one first target correction template, and to correct the initial weight estimate by means of the correction function of the target correction template, so as to obtain the corrected weight estimate of the pig to be estimated.

[0057] In addition, to achieve the above objectives, this application also proposes a pig weight estimation device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the pig weight estimation method described above.

[0058] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the pig weight estimation method described above.

[0059] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the pig weight estimation method described above.

[0060] The one or more technical solutions proposed in this application have at least the following technical effects: Optical images of the pig to be estimated for weight gain are acquired using an image acquisition device, and the current multi-dimensional scene feature data at the time of optical image acquisition is obtained, providing a basis for deviation tracing for subsequent targeted correction. The optical images are input into a pig weight estimation model, which predicts the weight of the pig to be estimated, obtaining an initial estimated weight value. Simultaneously, the current multi-dimensional scene feature data is structured and quantized to obtain the corresponding current multi-dimensional scene feature vector, transforming scattered scene feature data into standardized, digitized feature vectors, achieving a unified quantitative description of scene differences. Based on the current multi-dimensional scene feature vector, a correction template suitable for the current acquisition scene is selected from the candidate correction templates associated with each reference scene, i.e., at least one first target correction template. The optimal target correction template is determined based on at least one first target correction template, and the initial weight estimate is corrected by the correction function of the target correction template. This numerically offsets the systematic bias of the pig weight estimation model under the current acquisition scenario, and outputs an accurate weight estimate that fits the actual situation, i.e., the corrected weight estimate. This improves the accuracy of pig weight estimation in optical images, solves the technical problem of inaccurate weight estimation results caused by multi-dimensional scene differences in existing pig weight estimation models, and upgrades the weight estimation model from indiscriminate output in different scenarios to scene-adaptive output, thereby achieving more accurate pig weight estimation results. Attached Figure Description

[0061] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0062] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0063] Figure 1 This is a flowchart illustrating the pig weight estimation method of this application (Example 1).

[0064] Figure 2 This is a schematic diagram of the module structure of the pig weight estimation device according to an embodiment of this application;

[0065] Figure 3 This is a schematic diagram of the equipment structure of the hardware operating environment involved in the pig weight estimation method in the embodiments of this application. Detailed Implementation

[0066] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0067] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0068] The main solution of this application embodiment is as follows: Optical images of the pig to be estimated are acquired using an image acquisition device, and current multi-dimensional scene feature data is obtained at the time of optical image acquisition; the optical images are input into a pig weight estimation model, and the weight of the pig to be estimated is predicted by the pig weight estimation model to obtain an initial weight estimate; the current multi-dimensional scene feature data is structured and quantized to obtain the corresponding current multi-dimensional scene feature vector; based on the current multi-dimensional scene feature vector, at least one first target correction template is matched from the candidate correction templates associated with each reference scene; a target correction template is determined based on at least one first target correction template, and the initial weight estimate is corrected using the correction function of the target correction template to obtain the corrected weight estimate of the pig to be estimated.

[0069] In this embodiment, for ease of description, the following description uses a pig weight estimation system as the executing entity.

[0070] Current technologies for pig farming management, particularly in the slaughter stage, often employ non-contact pig weight estimation techniques based on optical images. These techniques utilize a unified image recognition and weight estimation model to analyze collected pig images and directly predict pig weight, thus bridging the gap between farmers and asset managers in pig weight data management. However, in practical applications, this unified weight estimation model is susceptible to various scenario-related factors. These multi-dimensional factors, strongly correlated with specific scenarios, can interfere with image acquisition quality and the visual representation of pig morphology. Consequently, the same weight estimation model may produce inconsistent, inaccurate, and unpredictable weight estimation deviations for the same weight pig in different specific scenarios. This makes it difficult to guarantee the accuracy of weight estimation results across different farming locations, time points, and farming conditions, and consequently, to ensure the consistency of pig weight data between farmers and asset managers.

[0071] This application provides a solution that acquires optical images of pigs to be estimated and current multi-dimensional scene feature data. This not only obtains the necessary visual information for weight estimation but also accurately captures the scene factors causing estimation deviations due to the current scene, thus pinpointing the source of deviation for subsequent targeted correction. The optical images are input into a pig weight estimation model to obtain an initial weight estimate. Subsequently, the multi-dimensional scene feature data is structured and quantified, transforming scattered scene factors into standardized feature vectors. This achieves a digital and computable description of scene differences, resulting in a current multi-dimensional scene feature vector. Based on this current multi-dimensional scene feature vector, a suitable first target correction template is matched from candidate correction templates associated with various reference scenes. Finally, the optimal target correction template is determined using the first target correction template. The correction function of the target correction template is used to perform targeted numerical correction on the biased initial weight estimate, offsetting the systematic deviation of the model under the current scene at the result level. The final output is a corrected weight estimate that closely matches reality, achieving accurate source tracing, quantitative matching, and targeted correction of scene deviations, thus solving the problem of inaccurate weight estimation caused by multi-dimensional scene differences.

[0072] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or a pig weight estimation device capable of performing the above functions. The following description uses a pig weight estimation system as an example to illustrate this embodiment and the subsequent embodiments.

[0073] Based on this, the embodiments of this application provide a method for estimating the weight of pigs, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the pig weight estimation method of this application.

[0074] In this embodiment, the method for estimating the weight of live pigs includes steps 101-105:

[0075] Step 101: Acquire optical images of the newborn pig to be estimated using an image acquisition device, and obtain the current multi-dimensional scene feature data at the time of optical image acquisition.

[0076] Specifically, image acquisition equipment refers to optical acquisition devices fixedly installed in the slaughter passage, weighing platform, or dedicated weight estimation area of ​​the farm, such as industrial cameras, high-definition vision terminals, and infrared imaging cameras. These devices must be capable of clearly capturing the outline of the pig's body shape to provide raw visual data for weight estimation. The pigs to be weighted are the individual pigs / groups whose weight needs to be predicted using optical imaging methods in the breeding management process; these are the target objects of this weight estimation correction. Optical images refer to visual images captured by the image acquisition equipment that contain the complete outline and body shape characteristics of the pig to be weighted. These are the core visual basis for the pig weight estimation model to extract body shape features and predict weight. Current multi-dimensional scene feature data refers to all multi-dimensional scene-related data that will affect the results of the pig weight estimation model under the same time and location of optical image acquisition. The core data includes equipment configuration parameters (such as installation height and angle), pig attribute parameters (such as breed and age), and environmental parameters (such as temperature, light intensity, and timestamps), which are the core basis for subsequent scene quantification and template matching.

[0077] In some embodiments, high-definition industrial cameras and other image acquisition devices are deployed in the pig slaughtering area for weight estimation, and the focal length and field of view are adjusted. Simultaneously, light, temperature, and humidity sensors are deployed, and a device parameter reading module and a pig attribute input port are established to construct a multi-dimensional data acquisition link. When a pig to be estimated enters the effective field of view of the image acquisition device, a shooting command is triggered to acquire an optical image containing the complete outline of the pig's body without significant obstruction. Under the same trigger signal, environmental parameters such as ambient light intensity, temperature, and humidity are simultaneously acquired through sensors, as well as the latitude, longitude, and altitude of the current acquisition scene. Device configuration parameters such as installation height and angle are read from the image acquisition device's backend, and attribute parameters such as pig breed and age are acquired through the input port, integrating them to form the current multi-dimensional scene feature data. The acquired optical image and scene feature data are assigned the same unique identifier and stored together to ensure a one-to-one correspondence. The spatiotemporal synchronous acquisition of visual image data of the pig to be estimated and scene feature data of the weight estimation site provides dual-core raw input data for subsequent weight estimation model prediction, scene feature quantification, and template matching, accurately capturing scene influencing factors that cause weight estimation deviations.

[0078] Optionally, the step of acquiring optical images of the newborn pigs to be evaluated using an image acquisition device includes:

[0079] The initial images of the pigs to be valued are obtained by taking pictures of them using an image acquisition device.

[0080] The pose recognition of the newborn pig to be estimated in the initial captured image is performed to obtain the pose recognition result corresponding to the initial captured image. The pose recognition result is used to indicate whether the pose category of the newborn pig to be estimated is a preset pose category.

[0081] If the posture recognition result of the pig to be estimated is positive, the initial captured image is determined as an optical image.

[0082] Specifically, the posture recognition result refers to the judgment conclusion output after posture recognition. It is only used to indicate whether the actual posture of the pig to be estimated belongs to the preset posture category, and is the core basis for image screening. The preset posture category refers to the standard pig posture that is set in advance for pig weight estimation and is suitable for the model to extract body features such as body length / height / chest circumference, such as the pig standing sideways, standing front / back, body facing the camera sideways, and postures without limb obstruction / curling. The optical image refers to the valid initial captured image that has passed posture verification and meets the requirements of the preset posture category. It is the visual data that is finally input into the pig weight estimation model.

[0083] For example, a preset posture category for body feature extraction is pre-defined for the pig to be valued. This preset posture category is the standard posture of the pig standing naturally with its body sideways to the image acquisition device, without any limb obstruction. When the pig enters the effective field of view of the image acquisition device, the device automatically triggers a shooting action to capture the pig in real time, obtaining an initial image containing the overall outline of the pig. This initial image is input into a preset pig posture recognition model. Through the contour extraction and limb key point localization algorithms built into the pig posture recognition model, the actual posture features of the pig in the initial image are identified and matched with the preset posture category to generate a posture recognition result that indicates whether the pig's actual posture conforms to the preset posture category. The posture recognition result is then evaluated. If the result indicates that the posture category of the pig to be valued is the preset posture category, the initial image is directly determined as the optical image input to the subsequent pig weight estimation model. If the posture recognition result is negative, the initial image is discarded, and the image acquisition device is triggered to re-capture the pig and repeat the above posture recognition process until an image that meets the preset posture requirements is obtained. By employing a dual process of first capturing images and then verifying their posture, images of pigs that meet the preset posture requirements are selected as valid optical images. Invalid images caused by irregular pig postures are eliminated from the source of image acquisition, ensuring that the optical images input into the pig weight estimation model have standardized features. This avoids deviations in subsequent body feature extraction caused by image posture issues, laying a high-quality visual data foundation for improving the accuracy of the initial weight estimation value.

[0084] Step 102: Input the optical image into the pig weight estimation model, predict the weight of the pig to be estimated through the pig weight estimation model, and obtain the initial weight estimate.

[0085] Specifically, the optical images are photographs of pigs that have undergone pose recognition and conform to preset standard postures. These images have complete outlines and standardized postures, making them suitable for the model to extract body features. The pig weight estimation model is a machine learning / deep learning model pre-trained using a large amount of pig images and actual weight data. It is used to predict pig weight based on image features. The initial weight estimate is the raw predicted weight directly output by the pig weight estimation model, without scene correction, and may contain systematic biases due to differences in equipment, environment, and pig breed.

[0086] In some embodiments, optical images that meet the requirements after pose screening are preprocessed according to a preset format, such as size normalization and pixel value standardization, to ensure that the image data is adapted to the input specifications of the pig weight estimation model. The preprocessed optical images are then input into the pig weight estimation model, which can be a deep learning-based convolutional neural network (such as ResNet or EfficientNet architecture). This model has been trained under supervision on a large number of labeled datasets (containing pig images and their corresponding real weight values) and can automatically extract visual features that are highly correlated with weight (such as body length, body height, and trunk fullness). After performing forward inference, the pig weight estimation model outputs a continuous value, which is the initial weight estimate of the pig to be estimated. This initial weight estimate reflects the original prediction result of the general pig weight estimation model under the current image (optical image) and has not yet considered the systematic biases introduced by scene factors such as differences in equipment installation, changes in ambient lighting, or pig breed characteristics. By feeding posture-selected optical images into a trained pig weight estimation model, the model automatically identifies the pig's body shape and calculates its weight to obtain an initial weight estimate. This transforms visual image data into quantified weight reference values, providing basic target data for subsequent correction stages. Furthermore, since the initial weight estimate relies solely on optical image features and does not consider the influence of differences in equipment, environment, pig breed, and other scenarios, it carries systematic biases. This provides a correction target for subsequent targeted correction based on multi-dimensional scenario features, a crucial prerequisite for achieving a prediction-correction closed loop and improving the final weight estimation accuracy.

[0087] Step 103: Perform structured quantization on the current multidimensional scene feature data to obtain the corresponding current multidimensional scene feature vector.

[0088] Specifically, structured quantization refers to the normalization, encoding, and format unification of scene data of different types, units, and formats, transforming unstructured / semi-structured data into standardized digital forms. The current multidimensional scene feature vector is the output of structured quantization, a fixed-length numerical array (one-dimensional vector), where each position (feature dimension) corresponds to a specific scene feature, and its value represents the processed standard value of that feature.

[0089] In some embodiments, the numerical features in the current multidimensional scene feature data are normalized, the categorical features are digitally encoded, and then all processed features are ordered and combined in a predetermined feature dimension order to form a current multidimensional scene feature vector with fixed length and uniform format. This transforms heterogeneous and incomputable scene information into standardized data that can be recognized by computers and used for similarity calculation, eliminating the differences in dimensions and types between different features and providing a foundation for subsequent correction templates based on scene feature matching.

[0090] Optionally, the multidimensional scene feature data includes equipment configuration parameters, environmental parameters, and attribute parameters of the pigs to be valued. The steps for structured quantization of the current multidimensional scene feature data to obtain the corresponding current multidimensional scene feature vector include:

[0091] Linear normalization is performed on the installation height and pitch angle in the equipment configuration parameters, the temperature, humidity, light intensity, latitude, longitude and altitude in the environmental parameters, and the age in the attribute parameters to obtain continuous numerical feature components.

[0092] The variety identifier in the attribute parameters is digitally encoded to obtain the category feature components;

[0093] The image acquisition timestamp in the environmental parameters is parsed into a seasonal identifier, and the seasonal identifier is digitally encoded to obtain seasonal feature components.

[0094] The continuous numerical feature components, category feature components, and seasonal feature components are concatenated in a preset order to generate the current multidimensional scene feature vector corresponding to the current multidimensional scene feature data.

[0095] Specifically, digital encoding involves converting non-numerical category information (such as variety identifiers and seasonal identifiers) into computer-recognizable digital forms, such as unique thermal encoding and serial number encoding. Continuous numerical feature components may include installation height feature vectors, pitch angle feature vectors, temperature feature vectors, humidity feature vectors, light intensity feature vectors, and age feature vectors. Category feature components are digital feature fragments that characterize category attributes after digital encoding, such as variety A being encoded as [1,0,0]. Seasonal identifiers are identifiers corresponding to seasonal information (such as spring, summer, autumn, and winter) obtained by parsing the image acquisition timestamp.

[0096] For example, firstly, from the current multi-dimensional scene feature data, the installation height and pitch angle from the equipment configuration parameters, the temperature, humidity, light intensity, latitude and longitude, and altitude from the environmental parameters, and the age from the pig attribute parameters are extracted. For these numerical features, the max-min linear normalization method is used to map their original values ​​to a continuous interval of [0,1], thereby obtaining continuous numerical feature components, including installation height feature vector, pitch angle feature vector, temperature feature vector, humidity feature vector, light intensity feature vector, latitude and longitude feature vector, altitude feature vector, and age feature vector, effectively eliminating the dimensional differences between different features. Secondly, the breed identifier from the pig attribute parameters is extracted. One-hot encoding can be used to digitally encode the breed identifier in the attribute parameters, corresponding each unique breed to a binary bit sequence, thereby generating categorical feature components. Next, the image acquisition timestamps in the environmental parameters are analyzed to extract month information. Based on month division rules (e.g., March-May for spring, June-August for summer), these timestamps are mapped to corresponding seasonal identifiers. The seasonal identifiers are then digitally encoded using one-hot encoding to generate seasonal feature components. Finally, following a preset feature concatenation order—continuous numerical feature components (installation height, pitch angle, temperature, humidity, light intensity, latitude and longitude, altitude, and age in days), category feature components (variety identifier), and seasonal feature components (seasonal identifier)—all the processed feature components are sequentially concatenated to generate a fixed-dimensional, uniformly formatted multidimensional scene feature vector that perfectly corresponds to the current multidimensional scene feature data. Through categorized and targeted standardization, complex and heterogeneous scene data is transformed into a unified digital vector, fully preserving the influence information of various scene factors. This provides a solid data foundation for subsequent high-precision correction template matching based on feature vectors, ensuring the accuracy and effectiveness of scene-based correction.

[0097] Step 104: Based on the current multi-dimensional scene feature vector, match at least one first target correction template from the candidate correction templates associated with each reference scene.

[0098] Specifically, the reference scenarios are pre-constructed typical weight estimation scenarios corresponding to different combinations of equipment, environments, and pig breeds. The candidate calibration template corresponds to a set of calibration functions / parameters for each reference scenario, used to correct the weight estimation deviation under that reference scenario, and is a calibration unit that can be used directly.

[0099] In some embodiments, the quantized current multidimensional scene feature vector is compared with the multidimensional reference scene feature vectors corresponding to the candidate correction templates associated with each reference scene in a pre-established database. Based on the calculation results, at least one candidate correction template whose similarity meets preset conditions is selected as the first target correction template. Accurate matching is achieved based on digital scene features, quickly locating the correction template closest to the current equipment, environment, and pig attributes from the candidate template library. This provides suitable candidate objects for determining the final target correction template, thereby specifically eliminating weight estimation bias caused by scene differences.

[0100] Optionally, before the step of matching at least one first target correction template from the candidate correction templates associated with each reference scene based on the current multi-dimensional scene feature vector, the method further includes:

[0101] The system collects optical images of multiple reference pigs under various reference scenarios, multidimensional reference scenario feature data under various reference scenarios, and actual weight values ​​of each reference pig under various reference scenarios.

[0102] The optical image of the reference pig is input into the pig weight estimation model to obtain the reference initial weight estimate of the reference pig;

[0103] The multidimensional reference scene feature data corresponding to each reference scene are subjected to structured quantization processing to obtain the multidimensional reference scene feature vector corresponding to each reference scene.

[0104] The deviation between the reference initial estimated weight value and the actual weighing value corresponding to each reference scenario is calculated and fitted to obtain the correction function corresponding to each reference scenario.

[0105] The correction function corresponding to each reference scenario is bound to the multidimensional reference scenario feature vector and multidimensional reference scenario feature data to form a candidate correction template associated with each reference scenario.

[0106] Specifically, the reference scenario is a pre-selected, representative environment for pig weight estimation, corresponding to different combinations of equipment, pig breeds, lighting, temperature, latitude, longitude, and altitude. The reference pigs are the pigs used for sample collection in each reference scenario. The optical image of the reference pig is an image of a pig with a suitable posture, taken under the reference scenario. The multidimensional reference scenario feature data includes characteristic data affecting weight estimation, such as equipment parameters, environmental parameters, and pig attributes under the reference scenario. The actual weighing value is the true weight of the pig measured by standard equipment such as a weighbridge, serving as the calibration benchmark. The initial reference weight estimation value is the uncorrected predicted value obtained by inputting the reference pig image into the weight estimation model. Binding to form a candidate calibration template refers to associating and storing the calibration function, the multidimensional reference scenario feature vector corresponding to the reference scenario, and the multidimensional reference scenario feature data corresponding to the reference scenario into a structured data unit. The multidimensional reference scenario feature vector can be used for matching, the multidimensional reference scenario feature data is the original data information, and the calibration function is used for correction.

[0107] For example, firstly, multiple typical reference scenarios are pre-defined, encompassing different combinations of equipment configuration parameters (installation height, pitch angle), environmental parameters (temperature, humidity, light intensity, season, latitude and longitude, altitude), and pig attribute parameters (breed, age). Within each reference scenario, several representative reference pigs are selected, and optical images (selected based on posture to meet preset requirements) and multi-dimensional reference scenario feature data (including equipment, environment, and pig attribute-related data) are collected for each pig. The actual weight of each reference pig is then measured using standard weighing equipment (such as a high-precision weighbridge) to ensure the integrity and authenticity of the sample data. Next, the optical images of all reference pigs in each reference scenario are sequentially input into the pig weight estimation model, which outputs an initial reference weight estimate for each pig, simulating the basic prediction process for online weight estimation. Subsequently, following the same structured quantization rules as the online scenario data, the multidimensional reference scenario feature data corresponding to each reference scenario were subjected to structured quantization processing. This involved linearly normalizing numerical features (installation height, temperature, etc.) and digitally encoding categorical features (breed, season), then concatenating them in a preset order to obtain the multidimensional reference scenario feature vector for each scenario. Next, for each reference scenario, the initial estimated weight and actual weight of all reference pigs in that scenario were summarized, and the deviation value for each data set (actual weight minus the initial estimated weight) was calculated. Based on a large amount of deviation data, linear regression, polynomial fitting, and other algorithms were used to fit a function, resulting in a correction function that accurately characterizes the weight estimation deviation pattern under that reference scenario. This correction function can achieve targeted correction of the initial estimated weight under similar scenarios. Finally, the correction function corresponding to each reference scenario was associated and bound one-to-one with the multidimensional reference scenario feature vector and the original multidimensional reference scenario feature data, forming a complete correction unit containing scenario feature identifiers and deviation correction rules—that is, the candidate correction template associated with that reference scenario. Repeat the above steps to complete the construction of candidate correction templates for all reference scenarios, ultimately forming a candidate correction template library covering multiple scenarios. By collecting sample data from multiple scenarios, calculating deviations, and fitting correction functions, a standardized correction template library covering different combinations of equipment, environments, and pig attributes is established in advance. This allows subsequent online scenarios to quickly match suitable correction templates, ensuring the accuracy and efficiency of correction, avoiding weight estimation deviations caused by a lack of scenario-based correction rules, and fundamentally guaranteeing the accuracy and consistency of weight estimation results across different scenarios.

[0108] Optionally, the step of matching at least one first target correction template from the candidate correction templates associated with each reference scene based on the current multi-dimensional scene feature vector includes:

[0109] Obtain the multidimensional reference scene feature vector in each candidate correction template, as well as the weights of each feature dimension in the multidimensional reference scene feature vector and the current multidimensional scene feature vector;

[0110] Based on the weights of each feature dimension, the weighted similarity between the current multi-dimensional scene feature vector and the multi-dimensional reference scene feature vector in each candidate correction template is calculated, and the weighted similarity is used as the first scene matching degree between the corresponding candidate correction template and the current collection scene.

[0111] If there is a first scene matching degree greater than or equal to the preset matching degree threshold, the candidate correction template corresponding to the first scene matching degree with the largest value will be used as the first target correction template.

[0112] If the matching degree of the first scene is less than the preset matching degree threshold, sort all candidate correction templates according to the matching degree of the first scene from high to low;

[0113] Select a preset number of candidate correction templates that are ranked first as the first target correction template.

[0114] Specifically, the multidimensional reference scene feature vector is a standardized vector obtained by quantifying data such as equipment, environment, and pig attributes of the reference scene, such as the multidimensional reference scene feature vector. The current multidimensional scene feature vector is a standardized vector obtained by quantizing the actual scene data for this weighting, such as the current multidimensional scene feature vector. The weights of the feature dimensions can be assigned to each feature dimension based on the importance gained during data training. This is used to highlight features that have a greater impact on weighting bias. The feature dimension sequence composed of the weights of each feature dimension can be... Weights of feature dimensions The importance of the i-th dimension feature (such as installation height, variety, season, etc.) can be obtained through offline learning via historical residual regression analysis.

[0115] For example, firstly, all candidate correction templates are retrieved from the candidate correction template library, and the multi-dimensional reference scene feature vector bound to each correction template is extracted, i.e. Simultaneously, it obtains the pre-defined weights for each feature dimension, i.e. Furthermore, the sum of the weights of all feature dimensions is 1. Next, based on the weights of each feature dimension, a weighted cosine similarity algorithm is used to calculate the weighted similarity between the current multi-dimensional scene feature vector and the multi-dimensional reference scene feature vector in each candidate correction template. The calculation formula is as follows:

[0116]

[0117] in, The current multidimensional scene feature vector With multidimensional reference scene feature vector Weighted similarity, The current multidimensional scene feature vector The eigenvalues ​​of the i-th dimension in the equation. For multidimensional reference scene feature vectors The eigenvalues ​​of the i-th dimension in the equation. is the weight of the i-th feature dimension.

[0118] By assigning higher matching priority to key features through weighting, the resulting weighted similarity is directly used as the first scene matching degree between the corresponding candidate correction template and the current acquisition scene. Subsequently, all first scene matching degrees are compared with a preset matching degree threshold. If at least one first scene matching degree is greater than or equal to the preset matching degree threshold, it indicates that there is a candidate correction template that is highly adapted to the current scene. In this case, the candidate correction template corresponding to the first scene matching degree with the largest value is selected and determined as the first target correction template to ensure the accuracy of the correction rule. If the first scene matching degree of all candidate correction templates is less than the preset matching degree threshold, it indicates that there is no typical scene template that is fully adapted. In this case, all candidate correction templates are sorted in descending order of first scene matching degree, and then a preset number of candidate correction templates (such as the first 3) are selected as the first target correction template according to the actual application requirements to ensure that effective correction can still be achieved through template fusion in the future. By combining weighted matching with hierarchical screening, the impact of key scenario features is highlighted while avoiding the limitations of a single matching strategy. This ensures that a suitable first target correction template can be selected under different scenario conditions, providing reliable support for subsequent template-based weight estimation deviation correction and effectively improving the accuracy and stability of the overall weight estimation results.

[0119] Step 105: Determine a target correction template based on at least one first target correction template, and correct the initial weight estimate using the correction function of the target correction template to obtain the corrected weight estimate of the pig to be estimated.

[0120] Specifically, the corrected weight estimate is the final weight result after correction by the correction function, which is an accurate weight estimate that is close to the actual weight.

[0121] In some embodiments, a target correction template is determined based on the number of at least one first target correction template obtained through matching. If only one first target correction template exists, it is directly used as the target correction template. If multiple first target correction templates exist, they are weighted and fused according to the first scene matching degree corresponding to each first target correction template to generate a fused target correction template, ensuring that the correction function of the target correction template conforms to the deviation pattern of the current scene. Subsequently, the correction function built into the target correction template is extracted, and the initial estimated weight of the pig to be estimated is substituted into the correction function to perform correction calculation. The inherent systematic deviation of the weight estimation model under the current scene is offset by function operation. After the correction calculation is completed, the final output value is the corrected estimated weight of the pig to be estimated. By using the dedicated correction function of the optimal scene correction template, the initial estimated weight with scene deviation is accurately corrected, solving the problem of inaccurate weight estimation caused by multi-dimensional scene differences, and ensuring that the final output corrected estimated weight has high accuracy and scene universality.

[0122] Optionally, the step of determining the target correction template based on at least one first target correction template includes:

[0123] If the number of first target correction templates is one, the first target correction template is used as the target correction template;

[0124] If the number of first target correction templates is greater than one, obtain the template confidence of each first target correction template, and calculate the first fusion weight corresponding to each first target correction template based on the first scene matching degree and the template confidence of each first target correction template.

[0125] The correction parameters of the correction functions in each first target correction template are weighted and summed according to the first fusion weight to generate the first fusion correction parameters, and the target correction template is constructed based on the first fusion correction parameters.

[0126] Specifically, template confidence is a numerical value that reflects the reliability of the calibration template itself in the reference scenario. It can be determined by factors such as sample size and fitting accuracy. The higher the confidence, the more reliable the template is.

[0127] For example, firstly, the number of first target correction templates is determined. If the number is one, then the first target correction template is directly identified as the target correction template. If the number is greater than one, then the template confidence level corresponding to each first target correction template is obtained. Matching degree with the first scene Based on the first scene matching degree Template confidence Calculate the first fusion weight The calculation formula is:

[0128]

[0129] Where m is the number of first target correction templates, and j is the sequence number of the first target correction template. This formula achieves normalization calculation, giving higher weights to templates with both high scene matching degree and template confidence. Next, the correction parameters of each template correction function (such as the linear function y= x+ In , The first fusion correction parameters are generated by weighting the parameters according to the first fusion weight. , , and These are the first fusion correction parameters. Finally, based on the fused correction parameters ( and A new correction function is constructed to form a target correction template. By combining the advantages of multiple approximate templates through two-dimensional weight allocation and parameter fusion, the optimal correction rule adapted to the current scenario is generated, effectively reducing the correction deviation caused by insufficient adaptation of a single template and ensuring the accuracy of the final weight estimation result.

[0130] Based on the pig weight estimation method provided in this application, optical images of the pig to be estimated are acquired using an image acquisition device, along with current multidimensional scene feature data (of the current acquisition scene) at the time of optical image acquisition, providing a basis for error tracing for subsequent targeted correction. The optical images are input into the pig weight estimation model, which predicts the weight of the pig to be estimated, yielding an initial estimated weight value. Simultaneously, the current multidimensional scene feature data is structured and quantized to obtain corresponding current multidimensional scene feature vectors, transforming fragmented scene feature data into standardized, digitized feature vectors, achieving a unified quantitative description of scene differences. Based on the current multidimensional scene feature vectors, correction templates suitable for the current acquisition scene are selected from candidate correction templates associated with each reference scene, i.e., at least one first target correction template. The optimal target correction template is determined based on at least one first target correction template, and the initial weight estimate is corrected by the correction function of the target correction template. This numerically offsets the systematic bias of the pig weight estimation model under the current acquisition scenario, and outputs an accurate weight estimate that fits the actual situation, i.e., the corrected weight estimate. This improves the accuracy of pig weight estimation in optical images, solves the technical problem of inaccurate weight estimation results caused by multi-dimensional scene differences in existing pig weight estimation models, and upgrades the weight estimation model from indiscriminate output in different scenarios to scene-adaptive output, thereby achieving more accurate pig weight estimation results.

[0131] In some embodiments, prior to the step of determining the target correction template based on at least one first target correction template, the method further includes:

[0132] Receive template selection instructions, parse the template selection instructions, and determine at least one second target correction template from the candidate correction templates associated with each reference scene based on the parsing results;

[0133] If the number of second target correction templates is one, the second target correction template will be used as the target correction template.

[0134] If the number of second target correction templates is greater than one, obtain the template confidence of each second target correction template;

[0135] Determine the second scene matching degree between each second target correction template and the current acquisition scene;

[0136] Based on the second scene matching degree and template confidence degree corresponding to each second target correction template, calculate the second fusion weight corresponding to each second target correction template.

[0137] The correction parameters of the correction functions in each second target correction template are weighted and summed according to the second fusion weight to generate the second fusion correction parameters, and the target correction template is constructed based on the second fusion correction parameters.

[0138] The next step is to execute the correction function of the target correction template to correct the initial weight estimate, and obtain the corrected weight estimate of the pig to be estimated.

[0139] Optionally, the step of determining the second scene matching degree between each second target correction template and the current acquisition scene includes:

[0140] Obtain the multidimensional reference scene feature vector in each second target correction template, as well as the weights of each feature dimension in the multidimensional reference scene feature vector and the current multidimensional scene feature vector;

[0141] Based on the weights of each feature dimension, calculate the second weighted similarity between the current multidimensional scene feature vector and the multidimensional reference scene feature vector in each second target correction template;

[0142] The second weighted similarity is used as the second scene matching degree between the corresponding candidate correction template and the current collection scene.

[0143] Specifically, the template selection instruction is an external (manual, host computer, configuration interface) instruction used to specify which candidate calibration templates to use. The second target calibration template is one or more calibration templates manually / externally specified from the candidate calibration templates according to the template selection instruction.

[0144] As an example, when a farm manager, technician, or farmer issues a template selection instruction (e.g., clicking "Use the 2025 Spring Duroc-specific calibration template" or selecting multiple historical templates) through a terminal interface (such as a mobile app or web management platform), the system receives and parses the instruction, extracting the specified template identification information. Subsequently, based on the parsing results, it retrieves at least one corresponding second target calibration template from multiple candidate calibration templates in a pre-built candidate calibration template library. If the user specifies only one candidate calibration template, the system directly uses it as the target calibration template for subsequent calibration. If the user specifies multiple candidate calibration templates (e.g., simultaneously selecting "High-mounted camera template" and "Cloudy environment template"), the system further obtains the template confidence of each second target calibration template and calculates the second scene matching degree between each template and the current acquisition scene. The second scene matching degree uses the same weighted similarity algorithm as the automatic matching stage, quantitatively evaluating it based on the current multi-dimensional scene feature vector and the template reference vector. Based on this, combining the second scene matching degree and template confidence, the second fusion weight of each template is calculated through normalized multiplication. The correction parameters in the correction functions of each template are then weighted and summed to generate the second fusion correction parameters, thereby constructing a fusion-type target correction template. Finally, the correction function of this target correction template is called to process the initial weight estimate and output the corrected weight estimate. By introducing a mechanism for manually / externally specifying templates, a flexible manual intervention method is provided in addition to automatic matching. This can meet the needs of special scenarios, debugging and verification, and precise control, enabling the system to support both fully automatic weight estimation and manually specified correction rules, improving the overall applicability, controllability, and flexibility of the solution.

[0145] In some embodiments, foreground segmentation is performed on the optical image to extract the complete outline region of the newborn pig to be estimated in the optical image;

[0146] Feature point detection and extraction are performed on the complete contour region to obtain the image pixel feature parameters corresponding to the body length, body height, chest circumference, abdominal circumference and hip width of the newborn pig to be estimated;

[0147] Based on the pixel size calibration algorithm, the image pixel feature parameters are converted into physical size parameters to obtain the body shape feature parameters of the newborn pig to be estimated.

[0148] Rule mapping is performed on the body shape feature parameters to determine the target body shape category corresponding to the newborn pig to be estimated;

[0149] Based on the correspondence between the target body type and the pre-set body type and weight correction factor, the target weight correction factor for the newborn pig to be estimated is determined;

[0150] The initial weight estimate is corrected based on the target weight correction factor to obtain the corrected weight estimate of the pig to be estimated.

[0151] Specifically, foreground segmentation involves separating the pigs (foreground) from the background (ground, fences, pens) in the image, retaining only the pig area. Rule mapping refers to classifying pigs into a specific body type based on predefined rules using body shape feature parameters, such as lean, standard, fat, robust, high-rumped, etc. The correspondence between body type and weight correction factor is a pre-established mapping relationship, meaning different body types correspond to different correction coefficients (e.g., standard body type = 1.0, fat = 1.08, lean = 0.92).

[0152] As an example, foreground segmentation is performed on the optical image to filter out background interference such as the ground and fences, extracting a complete and continuous contour region of the pig to be estimated. Key point detection is then performed on this complete contour region to locate key feature points such as the pig's head, shoulders, abdomen, and rump, based on which image pixel feature parameters corresponding to body length, height, chest circumference, abdominal circumference, and rump width are calculated. Based on camera intrinsic parameters, installation height, pitch angle, and other parameters, a pixel size calibration algorithm is used to convert the pixel feature parameters into real physical dimensions, obtaining body shape feature parameters in centimeters. Subsequently, according to preset body shape determination rules, the body shape feature parameters are compared with standard body shape ranges to determine the target body shape category of the pig to be estimated, such as standard, lean, fat, high-hipped, etc. Based on the target body shape category, the corresponding target weight correction factor is found from a pre-established body shape category-weight correction factor mapping table. Finally, the initial estimated weight value is multiplied by the target weight correction factor to complete the body shape adaptive correction of the initial estimated weight value, obtaining a corrected estimated weight value that more closely matches the actual body shape of the pig. By using image segmentation, body shape measurement, size calibration, body type classification and coefficient correction, the initial weight estimation results can be finely calibrated, making up for the shortcomings of predicting weight solely based on global image features, and significantly improving the weight estimation accuracy of pigs of different body types and fatness levels.

[0153] This application also provides a pig weighing device; please refer to... Figure 2 The pig weighing device includes:

[0154] The data acquisition module 201 is used to acquire optical images of the newborn pig to be estimated through an image acquisition device, and to obtain the current multi-dimensional scene feature data at the time of optical image acquisition.

[0155] The initial weight estimation module 202 is used to input the optical image into the pig weight estimation model, predict the weight of the pig to be estimated through the pig weight estimation model, and obtain the initial weight estimation value.

[0156] Feature extraction module 203 is used to perform structured quantization on the current multidimensional scene feature data to obtain the corresponding current multidimensional scene feature vector;

[0157] The correction template determination module 204 is used to match at least one first target correction template from the candidate correction templates associated with each reference scene based on the current multi-dimensional scene feature vector.

[0158] The correction module 205 is used to determine a target correction template based on at least one first target correction template, and to correct the initial weight estimate by using the correction function of the target correction template to obtain the corrected weight estimate of the pig to be estimated.

[0159] The pig weight estimation device provided in this application, employing the pig weight estimation method described in the above embodiments, can solve the technical problem of inaccurate weight estimation results caused by systematic biases in the pig weight estimation model due to differences in multi-dimensional scenarios. Compared with the prior art, the beneficial effects of the pig weight estimation device provided in this application are the same as those of the pig weight estimation method provided in the above embodiments, and other technical features in the pig weight estimation device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0160] This application provides a pig weight estimation device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the pig weight estimation method in the above embodiment 1.

[0161] The following is for reference. Figure 3 The diagram illustrates a structural schematic suitable for implementing the pig weighing device in the embodiments of this application. The pig weighing device in the embodiments of this application may include, but is not limited to, mobile terminals such as laptops, tablets (Portable Application Description, PADs), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 3 The illustrated pig weight estimation device is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0162] like Figure 3As shown, the pig weighing device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1002 or a program loaded from storage device 1003 into random access memory (RAM) 1004. The random access memory 1004 also stores various programs and data required for the operation of the pig weighing device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the pig weighing device to communicate wirelessly or wiredly with other devices to exchange data. Although pig weighing devices with various systems are shown in the figure, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems can be implemented alternatively.

[0163] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0164] The pig weight estimation device provided in this application, employing the pig weight estimation method described in the above embodiments, can solve the technical problem of inaccurate weight estimation results caused by systematic biases in the pig weight estimation model due to differences in multi-dimensional scenarios. Compared with the prior art, the beneficial effects of the pig weight estimation device provided in this application are the same as those of the pig weight estimation method provided in the above embodiments, and other technical features of this pig weight estimation device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0165] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0166] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0167] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the pig weight estimation method in the above embodiments.

[0168] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0169] The aforementioned computer-readable storage medium may be included in the pig weighing device; or it may exist independently and not assembled into the pig weighing device.

[0170] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by the pig weight estimation device, the pig weight estimation device performs the following actions: acquires an optical image of the pig to be estimated using an image acquisition device, and obtains current multidimensional scene feature data at the time of optical image acquisition; inputs the optical image into a pig weight estimation model, predicts the weight of the pig to be estimated using the pig weight estimation model, and obtains an initial weight estimate; performs structured quantization on the current multidimensional scene feature data to obtain a corresponding current multidimensional scene feature vector; based on the current multidimensional scene feature vector, matches at least one first target correction template from candidate correction templates associated with each reference scene; determines a target correction template based on at least one first target correction template, and corrects the initial weight estimate using the correction function of the target correction template to obtain a corrected weight estimate of the pig to be estimated.

[0171] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0172] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation that may be implemented in systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0173] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0174] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described pig weight estimation method. This solves the technical problem of inaccurate weight estimation results caused by systematic biases in pig weight estimation models due to multi-dimensional scenario differences. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the pig weight estimation method provided in the above embodiments, and will not be repeated here.

[0175] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method for estimating the weight of pigs.

[0176] The computer program product provided in this application can solve the technical problem of inaccurate weight estimation results caused by systematic biases in pig weight estimation models due to differences in multi-dimensional scenarios. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the pig weight estimation method provided in the above embodiments, and will not be repeated here.

[0177] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for estimating the weight of live pigs, characterized in that, The methods for estimating the weight of live pigs include: Optical images of the newborn pigs to be estimated are acquired using an image acquisition device, and the current multidimensional scene feature data at the time of optical image acquisition is obtained. The optical image is input into the pig weight estimation model, and the weight of the pig to be estimated is predicted by the pig weight estimation model to obtain an initial weight estimate. The current multidimensional scene feature data is structured and quantized to obtain the corresponding current multidimensional scene feature vector; Based on the current multidimensional scene feature vector, at least one first target correction template is matched from the candidate correction templates associated with each reference scene respectively; A target correction template is determined based on the at least one first target correction template, and the initial weight estimate is corrected using the correction function of the target correction template to obtain the corrected weight estimate of the pig to be estimated. The step of matching at least one first target correction template from the candidate correction templates associated with each reference scene based on the current multidimensional scene feature vector includes: Obtain the multidimensional reference scene feature vector in each of the candidate correction templates, as well as the weights of each feature dimension in the multidimensional reference scene feature vector and the current multidimensional scene feature vector. The weights of the feature dimensions reflect the importance of the corresponding feature dimensions. Based on the weights of each feature dimension, the weighted similarity between the current multi-dimensional scene feature vector and the multi-dimensional reference scene feature vector in each candidate correction template is calculated, and the weighted similarity is used as the first scene matching degree between the corresponding candidate correction template and the current acquisition scene. If the first scene matching degree is greater than or equal to the preset matching degree threshold, the candidate correction template corresponding to the first scene matching degree with the largest value is used as the first target correction template. If the matching degree of the first scene is less than the preset matching degree threshold, all the candidate correction templates are sorted from high to low according to the matching degree of the first scene. A predetermined number of candidate correction templates with the highest ranking are selected as the first target correction template; The step of determining the target correction template based on the at least one first target correction template includes: If the number of the first target correction templates is greater than one, obtain the template confidence of each first target correction template, and calculate the first fusion weight corresponding to each first target correction template based on the first scene matching degree corresponding to each first target correction template and the template confidence of each first target correction template. The correction parameters of the correction functions in each of the first target correction templates are weighted and summed according to the first fusion weight to generate the first fusion correction parameters, and the target correction template is constructed based on the first fusion correction parameters.

2. The method for estimating the weight of pigs as described in claim 1, characterized in that, Before the step of matching at least one first target correction template from the candidate correction templates associated with each reference scene based on the current multidimensional scene feature vector, the method further includes: Optical images of multiple reference pigs under each of the aforementioned reference scenarios, multidimensional reference scenario feature data under each of the aforementioned reference scenarios, and actual weight values ​​of each of the aforementioned reference pigs under each of the aforementioned reference scenarios are collected. The optical image of the reference pig is input into the pig weight estimation model to obtain the reference initial weight estimate of the reference pig. The multidimensional reference scene feature data corresponding to each of the reference scenes are subjected to structured quantization processing to obtain the multidimensional reference scene feature vector corresponding to each of the reference scenes. The deviation between the reference initial estimated weight value and the actual weighing value corresponding to each reference scenario is calculated and fitted to obtain the correction function corresponding to each reference scenario. The correction function corresponding to each reference scene is bound to the multidimensional reference scene feature vector and multidimensional reference scene feature data corresponding to the reference scene to form the candidate correction template associated with each reference scene.

3. The method for estimating the weight of pigs as described in claim 1, characterized in that, The multidimensional scene feature data includes equipment configuration parameters, environmental parameters, and attribute parameters of the pigs to be valued for rebirth. The step of performing structured quantization on the current multidimensional scene feature data to obtain the corresponding current multidimensional scene feature vector includes: Linear normalization is performed on the installation height and pitch angle in the equipment configuration parameters, the temperature, humidity, light intensity, latitude, longitude and altitude in the environmental parameters, and the age in the attribute parameters to obtain continuous numerical feature components. The breed identifier in the attribute parameters of the newborn pig to be estimated is digitally encoded to obtain the category feature component; The image acquisition timestamp in the environmental parameters is parsed into a seasonal identifier, and the seasonal identifier is digitally encoded to obtain seasonal feature components. The continuous numerical feature components, the category feature components, and the seasonal feature components are concatenated in a preset order to generate the current multidimensional scene feature vector corresponding to the current multidimensional scene feature data.

4. The method for estimating the weight of pigs as described in claim 1, characterized in that, The step of determining the target correction template based on the at least one first target correction template includes: If the number of the first target correction templates is one, the first target correction template is used as the target correction template.

5. The method for estimating the weight of pigs as described in claim 1, characterized in that, Before the step of determining the target correction template based on the at least one first target correction template, the method further includes: Receive a template selection instruction, parse the template selection instruction, and determine at least one second target correction template from the candidate correction templates associated with each of the reference scenarios based on the parsing results; If the number of the second target correction templates is one, then the second target correction template is used as the target correction template; If the number of the second target correction templates is greater than one, obtain the template confidence of each second target correction template; Determine the second scene matching degree between each second target correction template and the current acquisition scene; Based on the second scene matching degree corresponding to each second target correction template and the template confidence degree corresponding to each second target correction template, calculate the second fusion weight corresponding to each second target correction template; The correction parameters of the correction functions in each of the second target correction templates are weighted and summed according to the second fusion weight to generate second fusion correction parameters, and the target correction template is constructed based on the second fusion correction parameters; The process proceeds to the step of executing the correction function based on the target correction template to correct the initial weight estimate, thereby obtaining the corrected weight estimate of the pig to be estimated.

6. The method for estimating the weight of pigs as described in claim 1, characterized in that, The step of acquiring optical images of the newborn pig to be evaluated using an image acquisition device includes: The image acquisition device is used to photograph the newborn pig to be estimated, thereby obtaining the initial image of the newborn pig to be estimated. The posture recognition of the newborn pig to be estimated in the initial captured image is performed to obtain the posture recognition result corresponding to the initial captured image. The posture recognition result is used to indicate whether the posture category of the newborn pig to be estimated is a preset posture category. If the posture recognition result corresponding to the pig to be estimated is yes, the initial captured image is determined as the optical image.

7. The method for estimating the weight of pigs as described in claim 1, characterized in that, The method for estimating the weight of live pigs also includes: Foreground segmentation is performed on the optical image to extract the complete outline region of the newborn pig to be estimated in the optical image; Feature point detection and extraction are performed on the complete contour region to obtain the image pixel feature parameters corresponding to the body length, body height, chest circumference, abdominal circumference, and hip width of the pig to be estimated. Based on the pixel size calibration algorithm, the image pixel feature parameters are converted into physical size parameters to obtain the body shape feature parameters of the newborn pig to be estimated. The body shape feature parameters are mapped by rules to determine the target body shape category corresponding to the newborn pig to be estimated; Based on the target body shape category and the pre-set correspondence between body shape category and weight correction factor, the target weight correction factor corresponding to the newborn pig to be estimated is determined; The initial estimated weight is corrected based on the target weight correction factor to obtain the corrected estimated weight of the pig to be weighed.

8. A pig weighing device, characterized in that, The pig weight estimation device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the pig weight estimation method as described in any one of claims 1 to 7.

9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the pig weight estimation method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Living body weight estimation method, device and equipment and storage medium

    CN113344001A

  • Animal growth identification method and system

    CN117173733A