Pig body image processing method in complex scene and related equipment thereof

By dispersing the closed contour curve of the pig body image and optimizing shape, combining clustering and shape probability algorithms, the problem of low segmentation accuracy of the pig body segmentation model in complex scenarios is solved, and the pig body size and weight estimation is improved accuracy.

CN119251247APending Publication Date: 2025-01-03PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411364443.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

The existing pig body segmentation model has low segmentation accuracy in complex scenarios, resulting in inaccurate estimates of pig body size and weight.

Method used

By acquiring historical pig body images, identifying and labeling closed contour curves, performing discretization processing and curvature calculations, coarse and fine particle optimization are used to optimize coarse and fine particle size, adjusting pig body closed contour curves, and training the image processing model to improve segmentation accuracy.

Benefits of technology

It effectively improves the accuracy of the pig body segmentation area, solves the problem of low segmentation accuracy of the traditional deep learning segmentation model in complex scenarios, and ultimately improves the accuracy of pig body size and weight estimation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119251247A_ABST
    Figure CN119251247A_ABST
Patent Text Reader

Abstract

The invention discloses a pig body image processing method in a complex scene and related equipment thereof, and belongs to the technical field of artificial intelligence. The method comprises the following steps: firstly, acquiring a historical pig body image, identifying a pig body closed contour curve in the historical pig body image, and marking to obtain a curve marking point; secondly, discretizing the marking points to generate discrete points, and calculating unit tangent vectors and curvatures of the discrete points; then, determining the curvature center of the curve by adopting a clustering algorithm; and then, based on a curvature center and a shape probability algorithm, carrying out coarse-grained optimization, and then carrying out finer shape optimization on the curve through a region competition algorithm. And the closed profile curve of the pig body is adjusted by combining the coarse and fine optimization results. And then, the adjusted historical image is used as a training data set, a pig body image processing model is trained, and the model is used for processing a new to-be-processed pig body image. The invention also relates to the technical field of block chains, and the pig body image is stored in a block chain network. According to the invention, the precision of pig body image processing in a complex scene is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of artificial intelligence technology, and specifically relates to a pig body image processing method in complex scenes and related equipment. Background Art

[0002] In the pig farm insurance claims scenario, pig image processing technology plays a vital role. It is mainly used to confirm the identity of the pigs, measure their body length and weight, and assess the cause of their death, thereby ensuring the fairness and accuracy of the claims process.

[0003] At present, all products on the market use pig body segmentation models based on deep learning. However, in many practical application scenarios, various unexpected situations may occur, such as mutual occlusion between pig bodies, reference objects used for measurement (such as A4 paper) covering the pig bodies, and the background where the pig bodies are placed is very close to the color of the pig bodies themselves. In these cases, the pig body recognition through deep learning segmentation models will obtain pig body image segmentation results with low accuracy, which will have a great impact on the subsequent estimation of pig body size and weight. Summary of the invention

[0004] The purpose of the embodiments of the present application is to propose a method, device, computer equipment and storage medium for pig image processing in complex scenarios, so as to solve the technical problem that the pig image segmentation accuracy of the existing pig segmentation model is low, resulting in inaccurate estimation of the subsequent pig size and weight.

[0005] In order to solve the above technical problems, the embodiment of the present application provides a pig image processing method in a complex scene, which adopts the following technical solution:

[0006] A pig body image processing method in a complex scene, comprising:

[0007] Acquire historical pig body images, identify pig body closed contour curves in the historical pig body images, and mark the pig body closed contour curves to obtain curve marking points;

[0008] Discretize the curve annotation points to obtain the discrete points of the curve, and calculate the unit tangent vector and curvature of the discrete points of the curve;

[0009] Perform clustering operation on discrete points of the curve based on the unit tangent vector and curvature of the discrete points of the curve to determine the curvature center of the discrete points of the curve;

[0010] Performing coarse-grained optimization on discrete points of the curve according to the center of curvature and a preset shape probability algorithm to obtain a first curve optimization result;

[0011] Perform fine-grained shape optimization on discrete points of the curve according to a preset regional competition algorithm to obtain a second curve optimization result;

[0012] Adjusting the pig body closed contour curve based on the first curve optimization result and the second curve optimization result;

[0013] The historical pig images after the adjustment of the pig closed contour curve are used as training data sets to train the pig image processing model;

[0014] The pig body image to be processed is obtained, and the pig body image to be processed is input into the pig body image processing model to obtain the pig body image processing result.

[0015] In order to solve the above technical problems, the embodiment of the present application also provides a pig body image processing device in a complex scene, which adopts the following technical solution:

[0016] A pig body image processing device in complex scenes, comprising:

[0017] A curve annotation module is used to obtain historical pig body images, identify pig body closed contour curves in the historical pig body images, and annotate the pig body closed contour curves to obtain curve annotation points;

[0018] A discretization processing module is used to discretize the curve annotation points to obtain the discrete points of the curve and calculate the unit tangent vector and curvature of the discrete points of the curve;

[0019] A clustering operation module, used for performing clustering operation on discrete points of the curve based on the unit tangent vector and curvature of the discrete points of the curve, and determining the curvature center of the discrete points of the curve;

[0020] A first optimization module, used for performing coarse-grained optimization on discrete points of the curve according to the center of curvature and a preset shape probability algorithm to obtain a first curve optimization result;

[0021] The second optimization module is used to perform fine-grained shape optimization on discrete points of the curve according to a preset regional competition algorithm to obtain a second curve optimization result;

[0022] A curve adjustment module, used for adjusting the pig body closed contour curve based on the first curve optimization result and the second curve optimization result;

[0023] A model training module is used to train a pig image processing model by using historical pig images after adjustment of the pig closed contour curve as a training data set;

[0024] The image processing module is used to obtain the pig body image to be processed, input the pig body image to be processed into the pig body image processing model, and obtain the pig body image processing result.

[0025] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0026] A computer device comprises a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the method for processing pig body images in complex scenes as described in any one of the above are implemented.

[0027] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0028] A computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the method for processing pig body images in complex scenes as described in any one of the above.

[0029] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0030] The present application discloses a method for processing pig images in complex scenes and related equipment, and belongs to the field of artificial intelligence technology. First, historical pig images are obtained, the closed contour curves of the pig bodies therein are identified, and the curve annotation points are obtained by annotation. Then, the annotation points are discretized to generate discrete points and calculate their unit tangent vectors and curvatures. Then, a clustering algorithm is used to determine the center of curvature of the curve. After that, coarse-grained optimization is performed based on the center of curvature and the shape probability algorithm, and then the curve is more finely optimized by the regional competition algorithm. Combining the coarse and fine optimization results, the closed contour curve of the pig body is adjusted to improve the accuracy of the curve. Subsequently, the adjusted historical images are used as training data sets to train the pig image processing model, and finally the model is used to process new pig images to be processed to generate corresponding image processing results. This application calculates the unit tangent vector and curvature of the discrete points of the curve, uses a clustering algorithm to determine the key curvature center, and then combines the shape probability and regional competition algorithm to optimize the coarse and fine granularity of the pig body contour shape prior knowledge. After this shape prior knowledge optimization, the pig body segmentation area can be pulled back to the correct position, and the closed contour curve is effectively adjusted, which solves the problem of low segmentation accuracy of traditional deep learning segmentation models in these complex scenarios, and ultimately improves the accuracy of pig body size and weight estimation. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0032] Figure 1 An exemplary system architecture diagram is shown in which the present application can be applied;

[0033] Figure 2 A flowchart of an embodiment of a method for processing pig body images in complex scenes according to the present application is shown;

[0034] Figure 3 A schematic structural diagram of an embodiment of a pig body image processing device in a complex scene according to the present application is shown;

[0035] Figure 4 A schematic structural diagram of an embodiment of a computer device according to the present application is shown. DETAILED DESCRIPTION

[0036] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0037] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0038] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0039] like Figure 1As shown, the system architecture 100 may include a terminal device 101, a network 102 and a server 103. The terminal device 101 may be a laptop 1011, a tablet computer 1012 or a mobile phone 1013. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links or optical fiber cables.

[0040] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0041] The terminal device 101 can be various electronic devices with a display screen and supporting web browsing. In addition to the laptop computer 1011, the tablet computer 1012 or the mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop computer and a desktop computer, etc.

[0042] The server 103 may be a server that provides various services, such as a background server that provides support for a web page displayed on the terminal device 101 .

[0043] It should be noted that the pig body image processing method in complex scenes provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the pig body image processing device in complex scenes is generally set in the server / terminal device.

[0044] It should be understood that Figure 1 The numbers of terminal devices, networks and servers in the embodiment are merely illustrative. The above system may have any number of terminal devices, networks and servers according to implementation requirements.

[0045] Continue to refer Figure 2 , shows a flow chart of an embodiment of a method for processing pig body images in complex scenes according to the present application. The method for processing pig body images in complex scenes comprises the following steps:

[0046] S201, obtaining a historical pig body image, identifying a pig body closed contour curve in the historical pig body image, and marking the pig body closed contour curve to obtain curve marking points.

[0047] Specifically, in this step, a large number of historical pig images are first collected and loaded as the initial data set. The closed contour of the pig in each image is automatically identified through image segmentation algorithms (such as edge detection, image segmentation model, etc.). The closed contour curve refers to the outer boundary of the pig, which can clearly distinguish the pig from the background. Based on the contour recognition, the system will annotate the closed contour curve, that is, digitize the curve and mark the key points on the curve, that is, the curve annotation points.

[0048] In addition, after collecting and loading historical pig images as the initial data set, we can use commonly used image flipping, rotation, grayscale stretching, Gaussian noise, etc. as sample augmentation methods for the initial training set. Through these sample augmentation techniques, the diversity and robustness of the initial data set can be significantly enhanced. Image flipping and rotation ensure that the model has a higher generalization ability when dealing with targets at different angles and directions; grayscale stretching helps the model better identify pig body features under different lighting conditions; and Gaussian noise simulates image quality problems that may be encountered in actual environments, further improving the model's anti-interference ability.

[0049] S202, discretizing the curve annotation points to obtain discrete points of the curve, and calculating the unit tangent vector and curvature of the discrete points of the curve.

[0050] Specifically, after the annotation is completed, the curve annotation points will be discretized into discrete points of the curve. The discretization process usually samples the continuous curve at equal distances or according to a certain strategy, thereby converting it into a discrete representation composed of a finite number of points. These discrete points represent the important geometric information of each position on the curve. Next, for each discrete point of the curve, calculate its unit tangent vector, that is, the direction vector of the curve at this point, which represents the direction of the curve near this point. The unit tangent vector is calculated by the difference of adjacent points and normalized. In addition, the curvature of each discrete point needs to be calculated. The curvature reflects the degree of curvature of the curve at a certain point. The calculation of curvature is usually approximated by the geometric relationship between adjacent points, and the second-order difference is used to simulate the curvature of the curve.

[0051] S203, performing a clustering operation on the discrete points of the curve based on the unit tangent vectors and curvatures of the discrete points of the curve, and determining the curvature centers of the discrete points of the curve.

[0052] Specifically, this step uses the calculated unit tangent vector and curvature information to perform cluster analysis on the discrete points of the curve, with the aim of identifying the key feature points of the curve, especially the areas where the curvature changes significantly. Clustering algorithms such as K-means, DBSCAN, etc. can be used to group similar discrete points of the curve together based on the differences in tangent vectors and curvature between adjacent points. In this way, areas on the curve with similar characteristics can be distinguished. For example, smoother parts of the curve and parts with sudden changes in curvature will be divided into different categories. Ultimately, the center of curvature will be determined as the representative point in these clustering results, that is, those locations where the curvature changes significantly or the local shape changes significantly. These centers of curvature will serve as key areas for subsequent curve optimization because they have a greater impact on the overall shape of the pig's body contour.

[0053] S204, performing coarse-grained optimization on discrete points of the curve according to the center of curvature and a preset shape probability algorithm to obtain a first curve optimization result.

[0054] Specifically, based on the center of curvature determined by the previous clustering operation, the preset shape probability algorithm is used to perform coarse-grained optimization on the curve. The shape probability algorithm is based on statistical models or prior knowledge, and can assign a probability to each curve segment to indicate the rationality of the curve segment in the overall shape. In this way, the system can perform large-scale optimization on discrete points of the curve, that is, correct areas that significantly deviate from the true contour of the pig body. The goal of coarse-grained optimization is to first solve the main errors in the contour, such as large curve deviations, local excessive bending, etc. The optimization results of this stage can significantly improve the overall shape of the curve, ensuring that subsequent fine-grained optimization can be carried out on a more reasonable basis.

[0055] S205, performing fine-grained shape optimization on discrete points of the curve according to a preset regional competition algorithm to obtain a second curve optimization result.

[0056] Specifically, on the basis of coarse-grained optimization, a regional competition algorithm is used for finer-grained shape optimization. The regional competition algorithm is an optimization method based on the interaction between local regions. It is usually used for image segmentation and contour optimization. By letting adjacent regions compete, the winner will get a higher evaluation by occupying a more reasonable curve shape. In this step, the local details of the curve will be further optimized. The system will gradually adjust the slight changes in the curve according to the local characteristics of the curve and the information of the neighboring points, so that the curve is more in line with the actual shape of the pig body. Compared with coarse-grained optimization, fine-grained optimization focuses on local details and corrects those slight deviations that may be ignored by coarse optimization. Through this step, the shape of the curve will be more precise and more consistent with the actual situation.

[0057] S206, adjusting the pig body closed contour curve based on the first curve optimization result and the second curve optimization result.

[0058] Specifically, after obtaining the coarse-grained optimization results of the first stage and the fine-grained optimization results of the second stage, the system will combine the two to make an overall adjustment to the closed contour curve of the pig. Coarse-grained optimization solves large-scale errors and provides a more reasonable curve basis, while fine-grained optimization handles the local details of the curve. By combining the advantages of the two, the system can adjust the closed contour curve so that it has both overall rationality and local refinement. In this process, weighted average or multiple resolution methods may be used to merge optimization results at different levels. After adjustment, the final contour curve will be more in line with the actual shape of the pig.

[0059] S207, using the historical pig body images after the pig body closed contour curve adjustment as a training data set to train the pig body image processing model.

[0060] Specifically, after completing the adjustment of the closed contour curves in the historical pig images, the processed images will be used as a new training data set to train the pig image processing model. This model can be based on deep learning frameworks such as convolutional neural networks (CNN), residual network structures (ResUNet), etc., and supervised training is performed through these optimized high-quality data. The training process involves inputting a large number of optimized images into the model, and the model gradually learns how to automatically identify the pig contours and adjust the closed curves, and finally outputs high-precision segmentation results. By using an optimized data set, the model can perform better when dealing with complex scenes (such as occlusion, uneven lighting, complex background, etc.), and generate more accurate image segmentation results. After training, the model can be applied to actual scenes to achieve automated pig recognition.

[0061] S208, obtaining the pig body image to be processed, inputting the pig body image to be processed into the pig body image processing model, and obtaining the pig body image processing result.

[0062] Specifically, after the model training is completed, the system will obtain new pig images to be processed and input these images into the trained pig image processing model. The model will automatically identify the pigs in the image and extract their closed contours. Through previous learning, the model can accurately process complex pig image scenes, including occlusion between pigs, similar background and pig colors, etc. The output of the model will include the segmentation contours of the pig, which will eventually be used for subsequent analysis steps such as pig size and weight estimation. Since the model has been fully learned through high-quality training data sets, the processing results will have a high degree of accuracy.

[0063] In the above embodiment, the present application calculates the unit tangent vector and curvature of the discrete points of the curve, uses a clustering algorithm to determine the key curvature center, and then combines the shape probability and regional competition algorithm to perform coarse and fine granularity shape prior knowledge optimization of the pig body contour. After this shape prior knowledge optimization, the pig body segmentation area can be pulled back to the correct position, and the closed contour curve is effectively adjusted, which solves the problem of low segmentation accuracy of traditional deep learning segmentation models in these complex scenarios, and ultimately improves the accuracy of pig body size and weight estimation.

[0064] Furthermore, the steps of discretizing the curve annotation points to obtain discrete points of the curve and calculating the unit tangent vector and curvature of the discrete points of the curve specifically include:

[0065] Traverse the curve annotation points and select the corresponding curve annotation points as the curve discrete points according to the preset fixed point distance;

[0066] Determine the position coordinates of the discrete points of the curve, identify the adjacent points of the discrete points of the curve, and obtain the position coordinates of the adjacent points;

[0067] The unit tangent vector and curvature of the discrete point of the curve are calculated according to the position coordinates of the discrete point of the curve and the position coordinates of the adjacent points.

[0068] In this embodiment, when traversing the curve annotation points, firstly, according to the preset rules, a annotation point is selected from the annotation point sequence at a fixed point distance (such as every 3 annotation points) as a curve discrete point. For example, 100 discrete points are selected on the closed contour curve of the pig body to obtain the curve discrete point set C = (p1, p2, ..., p 100 ) T , p i is the discrete point of the curve, and T is the closed contour curve of the body. The choice of this preset distance can ensure that the discrete points are evenly distributed on the curve, avoid too dense or too sparse points, and maintain the representativeness of the curve shape. After selecting the discrete points of the curve, the system will automatically determine the specific position coordinates of these discrete points, and identify their adjacent points by calculating the spatial relationship between the adjacent points and the discrete points. Next, based on the position coordinates of the discrete points and the adjacent points of the curve, the system will calculate the unit tangent vector and curvature at the discrete points. The unit tangent vector reflects the direction of the curve at that point, and the curvature indicates the degree of curvature of the curve at that point. By calculating these geometric features, the local morphology of the curve can be clearly described.

[0069] Mathematical methods can be used to calculate the unit tangent vector and curvature based on the discrete points of the curve. Suppose there is a curve with discrete points P i (x i ,y i ), P i represents a point on the curve, P iThe previous point is P i-1 (x i-1 ,y i-1 ), P i The next point is P i+1 (x i+1 ,y i+1 ), then the discrete point P i The unit tangent vector of is:

[0070]

[0071] Discrete point P i The curvature is:

[0072]

[0073] Among them, the larger the curvature, the more sharply curved the curve is; conversely, the smaller the curvature means that the curve is smoother or closer to a straight line.

[0074] Through the above steps, it is ensured that in the process of curve discretization, the discrete points are selected reasonably and evenly distributed. At the same time, the calculated unit tangent vector and curvature can accurately reflect the morphological characteristics of the curve, which ultimately improves the efficiency of curve optimization and adjustment.

[0075] Furthermore, the step of performing clustering operation on the discrete points of the curve based on the unit tangent vector and the curvature of the discrete points of the curve to determine the center of curvature of the discrete points of the curve specifically includes:

[0076] Based on the curvature of the discrete points of the curve, the initial cluster center points are configured;

[0077] Calculate the geodesic distance of discrete points of the curve according to the unit tangent vector of the discrete points of the curve;

[0078] Based on the initial cluster center point and the geodesic distance, the discrete points of the curve are clustered to obtain the discrete point clustering result;

[0079] The initial cluster center points are screened according to the discrete point clustering results to obtain the curvature center of the curve discrete points.

[0080] In this embodiment, the initial cluster center points are first configured based on the curvature of the discrete points of the curve. The curvature reflects the degree of bending of the discrete points of the curve. Therefore, selecting points with higher curvature as the initial cluster center can ensure that the clustering process focuses on the area where the curve changes significantly. Next, the geodesic distance between each discrete point of the curve is calculated. The geodesic distance is a measurement method that reflects the shortest path between two points on the curve. This method can more accurately measure the geometric relationship between points on the curve, rather than simply using the Euclidean distance to approximate. Based on the geodesic distance, the system uses the initially configured cluster center points to execute a clustering algorithm (such as K-means or DBSCAN, etc.) to cluster the discrete points of the curve. This process aggregates similar discrete points together to form different cluster clusters. Each cluster cluster represents a part of the curve, and the part with a larger curvature change will be divided into a separate cluster. Afterwards, the initial cluster center points are screened according to the discrete point clustering results to ensure that the final curvature center can more accurately represent the key geometric change area on the curve. The screening criteria can be based on the internal consistency of each cluster and the geometric position of the cluster center. The final curvature center will be the focus of subsequent shape optimization.

[0081] Through the above steps, the key feature points of the curve can be effectively identified, especially the areas where the curvature changes significantly, which ensures the accuracy of the clustering center. The clustering operation is performed based on the geodesic distance of the curve, which improves the geometric rationality of the clustering results and enhances the adaptability to complex curves.

[0082] Further, the step of performing coarse-grained optimization on the discrete points of the curve according to the center of curvature and a preset shape probability algorithm to obtain a first curve optimization result specifically includes:

[0083] Identify the maximum curvature of discrete points of the curve, and set the curvature threshold based on the maximum curvature;

[0084] Screen the discrete points of the curve according to the curvature threshold to obtain the discrete points of the target curve;

[0085] Identify the left adjacent point and the right adjacent point of the discrete point of the target curve, and construct a two-point line segment based on the left adjacent point and the right adjacent point;

[0086] and constructing a three-point line segment based on the target adjacent point, the left adjacent point, and the right adjacent point;

[0087] Calculate the distance from the two-point line segment to the center of curvature to obtain the first curvature distance, and calculate the distance from the three-point line segment to the center of curvature to obtain the second curvature distance;

[0088] The discrete points of the target curve are coarse-grained optimized according to the first curvature distance and the second curvature distance to obtain a first curve optimization result.

[0089] In this embodiment, the curvature of the discrete points of the curve is first traversed, the maximum curvature value is identified, and this maximum curvature value is set as the curvature threshold. The curvature threshold is used to screen the key points in the discrete points of the curve, that is, those discrete points whose curvature is greater than or close to the threshold, that is, the discrete points of the target curve. These points usually represent areas where the curve changes significantly, which may be inflection points or places with large bends. Next, the system will further analyze these screened target curve discrete points, first identifying their left adjacent points and right adjacent points. Based on these two adjacent points, the system constructs a simple two-point line segment. This line segment represents the basic position and direction of the target discrete point on the local curve. At the same time, the system also uses the target point, the left adjacent point and the right adjacent point to construct a three-point line segment. This combination of three points can capture the bending changes of the curve in this local area.

[0090] Next, the distance from the two-point line segment to the center of curvature is calculated, that is, the first curvature distance. This distance reflects the degree of deviation of the local straight line segment of the curve relative to the center of curvature. Similarly, the system calculates the distance from the three-point line segment to the center of curvature, that is, the second curvature distance. This distance can better reflect the bending characteristics of the local curve. By comparing these two distances, it can be determined whether there is a large geometric deviation of the target discrete point on the curve, especially whether the point needs further adjustment. Then, based on the comparison results of the first curvature distance and the second curvature distance, the system performs coarse-grained optimization on the discrete points of the target curve. The goal of coarse-grained optimization is to correct a large range of deviations so that the discrete points and line segments are closer to the center of curvature, thereby making the entire curve more consistent with the true shape of the pig's body contour.

[0091] Through the above steps, by calculating the distance from different line segments to the center of curvature, the areas with large shape deviations in the curve can be effectively identified, and these areas can be corrected through coarse-grained optimization to improve the general shape of the curve. Finally, the optimized curve contour is more reasonable, ensuring the accuracy and reliability of pig image processing.

[0092] Furthermore, the step of performing coarse-grained optimization on the discrete points of the target curve according to the first curvature distance and the second curvature distance to obtain the optimization result of the first curve specifically includes:

[0093] Determining whether to retain the target curve discrete points according to the first curvature distance and the second curvature distance;

[0094] If the second curvature distance is greater than or equal to the first curvature distance, the target curve discrete point is retained, otherwise, the target curve discrete point is deleted;

[0095] The retained discrete points of the target curve are obtained to obtain the first curve optimization result.

[0096] In this embodiment, first, the first curvature distance is the distance from the two-point line segment to the center of curvature, which reflects the linear approximation of the target discrete point; the second curvature distance is the distance from the three-point line segment to the center of curvature, which can capture the local bending characteristics of the curve. When the second curvature distance is greater than or equal to the first curvature distance, that is, the position of the target discrete point in the curve of the region is reasonable, because the more complex three-point line segment is closer to the center of curvature than the simple two-point line segment, so the target curve discrete point is retained. On the contrary, if the second curvature distance is less than the first curvature distance, it means that the target discrete point does not significantly improve the overall shape of the curve, and may generate unnecessary redundancy or errors, so the point can be selected to be deleted. In this way, the system screens the discrete points of the target curve, deletes those points that do not meet the geometric characteristics, and thus simplifies the curve shape. After screening and retaining reasonable discrete points of the target curve, the system finally outputs the first curve optimization result.

[0097] Through the above steps, redundant or discrete points that do not conform to the curve shape are effectively removed, and those points that have an important impact on the overall shape of the curve are retained. The final optimized curve is more concise and reasonable, providing a better foundation for subsequent shape refinement and accurate recognition of the pig's body contour, and improving the efficiency and accuracy of pig image processing.

[0098] Furthermore, the step of performing fine-grained shape optimization on discrete points of the curve according to a preset regional competition algorithm to obtain a second curve optimization result specifically includes:

[0099] Determine the local texture area where the discrete points of the target curve are located based on the regional competition algorithm;

[0100] In the local texture area, the inner area range and the outer area range of the closed contour curve of the pig body are identified;

[0101] Calculate the probability distribution of grayscale and texture features in the area within the curve and the area outside the curve respectively;

[0102] Based on the curvature of the discrete points of the target curve, the grayscale and texture feature probability distribution of the area within the curve and the area outside the curve, the comprehensive probability of the discrete points of the target curve is calculated;

[0103] Fine-grained shape optimization is performed on the discrete points of the curve according to the comprehensive probability to obtain the second curve optimization result.

[0104] In this embodiment, the local texture area where the discrete points of the target curve are located is first determined by the regional competition algorithm. The regional competition algorithm is an optimization algorithm based on local features, which can effectively distinguish different areas in complex images. Specifically, the regional competition algorithm first delineates the local area where the target discrete points are located, and determines its position and distribution characteristics in the image by analyzing the texture features of the area. Next, within the determined local texture area, the system will further identify the inner area and the outer area of ​​the closed contour curve of the pig body. The inner area of ​​the curve is usually the surface of the pig body, while the outer area of ​​the curve is the background part. Then, the probability distribution of the grayscale and texture features of the inner area and the outer area of ​​the curve are calculated respectively. The grayscale feature reflects the brightness change of the local area, while the texture feature describes the details of the image surface, such as surface roughness or repetitive patterns. By calculating these probability distributions, the visual features of different areas of the image can be quantified.

[0105] Next, the system calculates the comprehensive probability of the point based on the curvature of the discrete point of the target curve and the probability distribution of the grayscale and texture features of the area inside and outside the curve. This comprehensive probability takes into account the geometric shape of the curve and the visual features of the image, allowing the system to comprehensively evaluate whether the point conforms to the closed contour of the pig body. For example, if the comprehensive probability is greater than 0, the discrete point of the target curve is discarded, otherwise the discrete point of the target curve is retained. Based on this comprehensive probability, the system performs fine-grained shape optimization on the discrete points of the curve. The purpose of fine-grained optimization is to adjust the local curve shape so that the curve is more consistent with the true contour of the pig body, while avoiding overfitting the noise or background texture in the image, so as to obtain a more accurate second curve optimization result.

[0106] Through the above steps, the system not only optimizes the shape of the curve through geometric features, but also combines grayscale and texture information to improve the ability to recognize the pig's contour in complex scenes. The final optimized curve is more accurate and can better adapt to different complex scenes, effectively improving the accuracy and robustness of pig image processing.

[0107] Further, the step of adjusting the pig body closed contour curve based on the first curve optimization result and the second curve optimization result specifically includes:

[0108] Obtaining discrete points of the target curve in the first curve optimization result to obtain discrete points of the first target curve;

[0109] Obtaining discrete points of the target curve in the second curve optimization result to obtain discrete points of the second target curve;

[0110] Based on the first target curve discrete points and the second target curve discrete points, a high-order polynomial curve is fitted to the pig body closed contour curve to obtain the pig body closed contour curve.

[0111] In this embodiment, the target curve discrete points are first extracted from the optimization result of the first curve to obtain the first target curve discrete points. After the coarse-grained optimization, the first target curve discrete points represent the general shape and overall contour of the curve. Then, the target curve discrete points are extracted from the optimization result of the second curve to obtain the second target curve discrete points. After the fine-grained optimization, the second target curve discrete points can more accurately capture the local shape features and details, especially the local contours in complex scenes. Next, the system will generate a closed contour curve of the pig body based on the first target curve discrete points and the second target curve discrete points by high-order polynomial curve fitting. High-order polynomial curve fitting is a common mathematical method that can better fit complex nonlinear curves by adjusting the order of the polynomial. By taking the comprehensive information of the first target point and the second target point as the fitting basis, it can ensure that the generated contour curve has both overall morphological rationality and high accuracy and curve smoothness in the local area. In addition, high-order polynomial fitting also has good adjustment flexibility and can handle curve requirements of different complexities.

[0112] Through the above steps, the target discrete points that have been optimized in coarse-grained and fine-grained ways are combined, and a more accurate closed contour curve of the pig body is generated through high-order polynomial fitting. This not only ensures that the overall shape of the curve and local details are taken into account, but also improves the fitting accuracy.

[0113] In the above embodiment, the present application discloses a method for processing pig images in complex scenes, which belongs to the field of artificial intelligence technology. First, historical pig images are obtained, the closed contour curves of the pig bodies therein are identified, and the curve annotation points are obtained by annotation. Then, the annotation points are discretized to generate discrete points and their unit tangent vectors and curvatures are calculated. Then, a clustering algorithm is used to determine the center of curvature of the curve. After that, coarse-grained optimization is performed based on the center of curvature and the shape probability algorithm, and then the curve is more finely optimized by the regional competition algorithm. Combining the coarse and fine optimization results, the closed contour curve of the pig body is adjusted to improve the accuracy of the curve. Subsequently, the adjusted historical images are used as training data sets to train the pig image processing model, and finally the model is used to process new pig images to be processed to generate corresponding image processing results. This application calculates the unit tangent vector and curvature of the discrete points of the curve, uses a clustering algorithm to determine the key curvature center, and then combines the shape probability and regional competition algorithm to optimize the coarse and fine granularity of the pig body contour shape prior knowledge. After this shape prior knowledge optimization, the pig body segmentation area can be pulled back to the correct position, and the closed contour curve is effectively adjusted, which solves the problem of low segmentation accuracy of traditional deep learning segmentation models in these complex scenarios, and ultimately improves the accuracy of pig body size and weight estimation.

[0114] In this embodiment, the pig body image processing method in complex scenes is executed on an electronic device (eg Figure 1 The server shown in the figure can receive instructions or obtain data through a wired connection or a wireless connection. It should be noted that the above wireless connection method may include but is not limited to 3G / 4G connection, Wi-Fi connection, Bluetooth connection, Wi MAX connection, Zigbee connection, UWB (Ultra Wi-Fi Band) connection, and other wireless connection methods currently known or to be developed in the future.

[0115] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned pig image information, the above-mentioned pig image information can also be stored in a node of a blockchain.

[0116] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0117] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0118] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0119] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0120] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0121] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a pig body image processing device in a complex scene. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0122] like Figure 3 As shown, the pig body image processing device 300 in a complex scene described in this embodiment includes:

[0123] The curve marking module 301 is used to obtain historical pig body images, identify pig body closed contour curves in the historical pig body images, and mark the pig body closed contour curves to obtain curve marking points;

[0124] The discretization processing module 302 is used to discretize the curve annotation points to obtain the curve discrete points, and calculate the unit tangent vector and curvature of the curve discrete points;

[0125] A clustering operation module 303 is used to perform clustering operation on the discrete points of the curve based on the unit tangent vector and curvature of the discrete points of the curve to determine the curvature center of the discrete points of the curve;

[0126] A first optimization module 304 is used to perform coarse-grained optimization on discrete points of the curve according to the center of curvature and a preset shape probability algorithm to obtain a first curve optimization result;

[0127] The second optimization module 305 is used to perform fine-grained shape optimization on discrete points of the curve according to a preset regional competition algorithm to obtain a second curve optimization result;

[0128] A curve adjustment module 306, configured to adjust the pig body closed contour curve based on the first curve optimization result and the second curve optimization result;

[0129] A model training module 307 is used to train a pig image processing model by using the historical pig images after the pig closed contour curve adjustment as a training data set;

[0130] The image processing module 308 is used to obtain the pig body image to be processed, input the pig body image to be processed into the pig body image processing model, and obtain the pig body image processing result.

[0131] Furthermore, the discretization processing module 302 is specifically used for:

[0132] Traverse the curve annotation points and select the corresponding curve annotation points as the curve discrete points according to the preset fixed point distance; determine the position coordinates of the curve discrete points, identify the adjacent points of the curve discrete points, and obtain the position coordinates of the adjacent points; calculate the unit tangent vector and curvature of the curve discrete points according to the position coordinates of the curve discrete points and the position coordinates of the adjacent points.

[0133] Furthermore, the clustering operation module 303 is specifically used for:

[0134] Based on the curvature of the discrete points of the curve, the initial cluster center points are configured; the geodesic distance of the discrete points of the curve is calculated according to the unit tangent vector of the discrete points of the curve; the discrete points of the curve are clustered based on the initial cluster center points and the geodesic distance to obtain the discrete point clustering results; the initial cluster center points are screened according to the discrete point clustering results to obtain the curvature center of the discrete points of the curve.

[0135] Furthermore, the first optimization module 304 is specifically used for:

[0136] Identify the maximum curvature of the discrete points of the curve, and set the curvature threshold according to the maximum curvature; screen the discrete points of the curve according to the curvature threshold to obtain the discrete points of the target curve; identify the left adjacent points and the right adjacent points of the discrete points of the target curve, and construct a two-point line segment based on the left adjacent points and the right adjacent points; and construct a three-point line segment based on the target adjacent points, the left adjacent points and the right adjacent points; calculate the distance from the two-point line segment to the center of curvature to obtain the first curvature distance, and calculate the distance from the three-point line segment to the center of curvature to obtain the second curvature distance; perform coarse-grained optimization on the discrete points of the target curve according to the first curvature distance and the second curvature distance to obtain the first curve optimization result.

[0137] Furthermore, the first optimization module 304 is further used to:

[0138] Determining whether to retain the target curve discrete points according to the first curvature distance and the second curvature distance;

[0139] If the second curvature distance is greater than or equal to the first curvature distance, the target curve discrete point is retained, otherwise, the target curve discrete point is deleted;

[0140] The retained discrete points of the target curve are obtained to obtain the first curve optimization result.

[0141] Furthermore, the second optimization module 305 is specifically used for:

[0142] Based on the regional competition algorithm, the local texture area where the discrete points of the target curve are located is determined; in the local texture area, the inner area range and the outer area range of the pig body closed contour curve are identified; the grayscale and texture feature probability distribution of the inner area range and the outer area range are calculated respectively; based on the curvature of the discrete points of the target curve, the grayscale and texture feature probability distribution of the inner area range and the outer area range, the comprehensive probability of the discrete points of the target curve is calculated; according to the comprehensive probability, fine-grained shape optimization is performed on the discrete points of the curve to obtain the second curve optimization result.

[0143] Furthermore, the curve adjustment module 306 is specifically used for:

[0144] Obtain the discrete points of the target curve in the first curve optimization result to obtain the first target curve discrete points; obtain the discrete points of the target curve in the second curve optimization result to obtain the second target curve discrete points; perform high-order polynomial curve fitting on the pig body closed contour curve based on the first target curve discrete points and the second target curve discrete points to obtain the pig body closed contour curve.

[0145] In the above embodiment, the present application discloses a pig image processing device in a complex scene, which belongs to the field of artificial intelligence technology. First, a historical pig image is obtained, the closed contour curve of the pig therein is identified, and the curve annotation points are obtained by annotation. Then, the annotation points are discretized to generate discrete points and calculate their unit tangent vectors and curvatures. Then, a clustering algorithm is used to determine the center of curvature of the curve. After that, a coarse-grained optimization is performed based on the center of curvature and the shape probability algorithm, and then a more refined shape optimization is performed on the curve through the regional competition algorithm. Combining the coarse and fine optimization results, the closed contour curve of the pig is adjusted to improve the accuracy of the curve. Subsequently, the adjusted historical image is used as a training data set to train a pig image processing model, and finally the model is used to process new pig images to be processed to generate corresponding image processing results. This application calculates the unit tangent vector and curvature of the discrete points of the curve, uses a clustering algorithm to determine the key curvature center, and then combines the shape probability and regional competition algorithm to optimize the coarse and fine granularity of the pig body contour shape prior knowledge. After this shape prior knowledge optimization, the pig body segmentation area can be pulled back to the correct position, and the closed contour curve is effectively adjusted, which solves the problem of low segmentation accuracy of traditional deep learning segmentation models in these complex scenarios, and ultimately improves the accuracy of pig body size and weight estimation.

[0146] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.

[0147] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 4 having a memory 41, a processor 42, and a network interface 43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital processor (DSP), an embedded device, etc.

[0148] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0149] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart memory card (Smart Med ia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of the pig body image processing method under complex scenes, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.

[0150] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run the computer-readable instructions stored in the memory 41 or process data, such as running the computer-readable instructions of the pig body image processing method in the complex scene.

[0151] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0152] In the above embodiment, the present application discloses a computer device, which belongs to the field of artificial intelligence technology. First, a historical pig body image is obtained, the closed contour curve of the pig body therein is identified, and the curve annotation points are obtained by annotation. Then, the annotation points are discretized to generate discrete points and their unit tangent vectors and curvatures are calculated. Then, a clustering algorithm is used to determine the center of curvature of the curve. After that, a coarse-grained optimization is performed based on the center of curvature and the shape probability algorithm, and then a more refined shape optimization is performed on the curve through a regional competition algorithm. Combining the coarse and fine optimization results, the closed contour curve of the pig body is adjusted to improve the accuracy of the curve. Subsequently, the adjusted historical image is used as a training data set to train a pig body image processing model, and finally the model is used to process new pig body images to be processed to generate corresponding image processing results. This application calculates the unit tangent vector and curvature of the discrete points of the curve, uses a clustering algorithm to determine the key curvature center, and then combines the shape probability and regional competition algorithm to optimize the coarse and fine granularity of the pig body contour shape prior knowledge. After this shape prior knowledge optimization, the pig body segmentation area can be pulled back to the correct position, and the closed contour curve is effectively adjusted, which solves the problem of low segmentation accuracy of traditional deep learning segmentation models in these complex scenarios, and ultimately improves the accuracy of pig body size and weight estimation.

[0153] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the pig body image processing method in the complex scene as described above.

[0154] In the above embodiment, the present application discloses a computer-readable storage medium, which belongs to the field of artificial intelligence technology. First, a historical pig body image is obtained, the closed contour curve of the pig body therein is identified, and the curve annotation points are obtained by annotation. Then, the annotation points are discretized to generate discrete points and their unit tangent vectors and curvatures are calculated. Then, a clustering algorithm is used to determine the center of curvature of the curve. After that, a coarse-grained optimization is performed based on the center of curvature and the shape probability algorithm, and then a more refined shape optimization is performed on the curve through the regional competition algorithm. Combining the coarse and fine optimization results, the closed contour curve of the pig body is adjusted to improve the accuracy of the curve. Subsequently, the adjusted historical image is used as a training data set to train a pig body image processing model, and finally the model is used to process new pig body images to be processed to generate corresponding image processing results. This application calculates the unit tangent vector and curvature of the discrete points of the curve, uses a clustering algorithm to determine the key curvature center, and then combines the shape probability and regional competition algorithm to optimize the coarse and fine granularity of the pig body contour shape prior knowledge. After this shape prior knowledge optimization, the pig body segmentation area can be pulled back to the correct position, and the closed contour curve is effectively adjusted, which solves the problem of low segmentation accuracy of traditional deep learning segmentation models in these complex scenarios, and ultimately improves the accuracy of pig body size and weight estimation.

[0155] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0156] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0157] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A pig image processing method in complex scenes, characterized in that: include: Acquire a historical pig body image, identify a pig body closed contour curve in the historical pig body image, and mark the pig body closed contour curve to obtain the curve marking points; Discretizing the curve marked points to obtain discrete points of the curve, and calculating the unit tangent vector and curvature of the discrete points of the curve; Performing a clustering operation on the discrete points of the curve based on the unit tangent vectors and curvatures of the discrete points of the curve to determine the curvature centers of the discrete points of the curve; Performing coarse-grained optimization on the discrete points of the curve according to the curvature center and a preset shape probability algorithm to obtain a first curve optimization result; Performing fine-grained shape optimization on discrete points of the curve according to a preset regional competition algorithm to obtain a second curve optimization result; Adjusting the pig body closed contour curve based on the first curve optimization result and the second curve optimization result; The historical pig body images after the adjustment of the pig body closed contour curve are used as a training data set to train a pig body image processing model; A pig body image to be processed is obtained, and the pig body image to be processed is input into the pig body image processing model to obtain a pig body image processing result.

2. The pig body image processing method in complex scenes according to claim 1, characterized in that: The step of discretizing the curve annotation points to obtain discrete points of the curve, and calculating the unit tangent vector and curvature of the discrete points of the curve specifically includes: Traversing the curve marking points, and selecting corresponding curve marking points as the curve discrete points according to a preset fixed point number distance; Determine the position coordinates of the discrete points of the curve, identify the adjacent points of the discrete points of the curve, and obtain the position coordinates of the adjacent points; The unit tangent vector and the curvature of the discrete point of the curve are calculated according to the position coordinates of the discrete point of the curve and the position coordinates of the adjacent points.

3. The pig body image processing method in complex scenes according to claim 1, characterized in that: The step of performing clustering operation on the discrete points of the curve based on the unit tangent vector and the curvature of the discrete points of the curve to determine the center of curvature of the discrete points of the curve specifically includes: Based on the curvature of the discrete points of the curve, configuring the initial cluster center point; Calculating the geodesic distance of the discrete points of the curve according to the unit tangent vector of the discrete points of the curve; Performing clustering operation on the discrete points of the curve based on the initial cluster center point and the geodesic distance to obtain a discrete point clustering result; The initial cluster center point is screened according to the discrete point clustering result to obtain the curvature center of the curve discrete points.

4. The pig body image processing method in complex scenes according to claim 1, characterized in that: The step of performing coarse-grained optimization on the discrete points of the curve according to the curvature center and a preset shape probability algorithm to obtain a first curve optimization result specifically includes: Identifying the maximum curvature of the discrete points of the curve, and setting the curvature threshold according to the maximum curvature; Screening the discrete points of the curve according to the curvature threshold to obtain discrete points of the target curve; Identify a left adjacent point and a right adjacent point of a discrete point of the target curve, and construct a two-point line segment based on the left adjacent point and the right adjacent point; and constructing a three-point line segment based on the target adjacent point, the left adjacent point and the right adjacent point; Calculating the distance from the two-point line segment to the center of curvature to obtain a first curvature distance, and calculating the distance from the three-point line segment to the center of curvature to obtain a second curvature distance; The discrete points of the target curve are coarse-grained optimized according to the first curvature distance and the second curvature distance to obtain the first curve optimization result.

5. The pig body image processing method in complex scenes as claimed in claim 4, characterized in that: The step of performing coarse-grained optimization on the discrete points of the target curve according to the first curvature distance and the second curvature distance to obtain a first curve optimization result specifically includes: Determining whether to retain the target curve discrete point according to the first curvature distance and the second curvature distance; If the second curvature distance is greater than or equal to the first curvature distance, retain the target curve discrete point; otherwise, delete the target curve discrete point; The retained discrete points of the target curve are obtained to obtain the first curve optimization result.

6. The pig body image processing method in complex scenes as claimed in claim 4, characterized in that: The step of performing fine-grained shape optimization on the discrete points of the curve according to a preset regional competition algorithm to obtain a second curve optimization result specifically includes: Determine the local texture area where the discrete points of the target curve are located based on the regional competition algorithm; In the local texture area, identifying the inner area range and the outer area range of the closed contour curve of the pig body; Calculating the grayscale and texture feature probability distribution of the area within the curve and the area outside the curve respectively; Calculate the comprehensive probability of the discrete points of the target curve based on the curvature of the discrete points of the target curve, the grayscale and texture feature probability distribution of the area within the curve and the area outside the curve; Fine-grained shape optimization is performed on the discrete points of the curve according to the comprehensive probability to obtain a second curve optimization result.

7. The pig body image processing method in complex scenes according to claim 6, characterized in that: The step of adjusting the pig body closed contour curve based on the first curve optimization result and the second curve optimization result specifically includes: Obtaining discrete points of a target curve in the first curve optimization result to obtain discrete points of a first target curve; Obtaining discrete points of the target curve in the second curve optimization result to obtain discrete points of the second target curve; A high-order polynomial curve fitting is performed on the pig body closed contour curve based on the first target curve discrete points and the second target curve discrete points to obtain the pig body closed contour curve.

8. A pig image processing device in complex scenes, characterized in that: include: A curve marking module is used to obtain historical pig body images, identify pig body closed contour curves in the historical pig body images, and mark the pig body closed contour curves to obtain the curve marking points; A discretization processing module is used to discretize the curve annotation points to obtain the curve discrete points, and calculate the unit tangent vector and curvature of the curve discrete points; A clustering operation module, used for performing clustering operation on the discrete points of the curve based on the unit tangent vector and the curvature of the discrete points of the curve, and determining the curvature center of the discrete points of the curve; A first optimization module, used for performing coarse-grained optimization on the discrete points of the curve according to the curvature center and a preset shape probability algorithm to obtain a first curve optimization result; A second optimization module is used to perform fine-grained shape optimization on discrete points of the curve according to a preset regional competition algorithm to obtain a second curve optimization result; A curve adjustment module, used for adjusting the pig body closed contour curve based on the first curve optimization result and the second curve optimization result; A model training module, used to train a pig image processing model by using the historical pig images after the pig closed contour curve adjustment as a training data set; The image processing module is used to obtain the pig body image to be processed, input the pig body image to be processed into the pig body image processing model, and obtain the pig body image processing result.

9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the method for processing pig body images in complex scenes according to any one of claims 1 to 7 when executing the computer-readable instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the pig body image processing method in a complex scene according to any one of claims 1 to 7 are implemented.