Portable sow vulva phenotype intelligent measuring system

By combining a portable sow vulvar phenotypic image acquisition device with a deep learning model, the problems of low efficiency and large error in sow vulvar phenotypic determination are solved, enabling rapid, accurate measurement and objective evaluation of sow vulvar morphological parameters, which is suitable for breeding pig selection and disease early warning.

CN121329910APending Publication Date: 2026-01-13NANJING AGRICULTURAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511460021.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-13
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

Existing methods for determining the vulva phenotype of sows rely on manual measurement, which is inefficient, prone to measurement errors, and easily induces stress in animals. Furthermore, they lack unified quantitative standards, making it difficult to achieve objective comparison of data across batches.

Method used

A portable vulvar phenotypic image acquisition device for sows is designed. It adopts a biomimetic design and a sealed thin-walled structure, combined with an embedded mobile phone holder and high-quality image acquisition technology. It achieves accurate measurement of vulvar morphological parameters through threshold segmentation and deep learning models, and is equipped with a mobile APP for real-time processing.

Benefits of technology

It enables rapid and accurate measurement of vulvar phenotypic parameters in sows, improving the measurement rate and accuracy, avoiding the subjectivity of manual measurement and animal stress response, and providing objective data support, which is suitable for breeding pig selection and disease early warning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121329910A_ABST
    Figure CN121329910A_ABST
Patent Text Reader

Abstract

The invention discloses a portable sow vulva phenotype intelligent measuring system. The system is composed of an image acquisition device in a bionic form and an intelligent measurement system based on a mobile terminal APP. According to the method, a traditional image processing algorithm (such as MSRCR and Lab threshold segmentation) and a Deeplabv3 + deep learning model are fused, accurate extraction of the vulva contour and automatic calculation of the length and width of the vulva, the area of the vulva, the angle of the vulva and the grading parameters of the vulva are achieved, and the pixel size is converted into the actual length in combination with a physical scale. The sow vulva phenotype determination algorithm disclosed by the invention has remarkable technical advantages and practical value, the algorithm has good performance in the aspect of vulva morphological parameter segmentation precision, the vulva width segmentation precision R2 is greater than 0.90, the vulva length segmentation precision R2 is greater than 0.85, and the vulva area segmentation precision R2 is greater than 0.90. According to the developed vulva angle score prediction model, the proportion that the absolute error between a predicted value and a real value is smaller than 1 score can reach 95% or above.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a portable sow vulva image acquisition and vulva phenotypic intelligent measurement system, specifically a high-quality vulva image acquisition device based on biomimetic design of sow vulva morphology and a vulva phenotypic intelligent measurement system based on a mobile APP, belonging to the technical field of intelligent measurement equipment for pig breeding phenotypic analysis. Background Technology

[0002] With the large-scale and intensive development of my country's pig farming industry, production efficiency is key to improving the core competitiveness of pig farming enterprises, and improving the reproductive performance of sows is a core link in improving production efficiency. Vulvar morphological characteristics (such as vulvar length, width, angle, and area) are key indicators for assessing sow reproductive potential, judging estrus status, reproductive health, and selection criteria. Currently, the industry generally relies on manual visual inspection or contact measurement methods to obtain these indicators. Manual visual inspection is highly subjective, lacks unified quantitative standards, and makes it difficult to achieve objective comparison of cross-batch data; contact measurement methods suffer from low operational efficiency and are prone to causing stress reactions in sows. Machine vision-based methods have become the main method for intelligent measurement of livestock phenotypes in recent years and are now being applied in many phenotyping applications, such as intelligent body size measurement, weight estimation, and individual identification in pigs. Currently, there is no research or application of machine vision-based methods in the intelligent measurement of sow vulvar phenotypes.

[0003] To address the shortcomings of traditional methods for measuring sow vulvar phenotypes, there is an urgent need to develop a portable vulvar image acquisition device and an intelligent vulvar phenotype measurement system for rapid, accurate, and intelligent measurement of sow vulvar phenotypes. This application relates to a portable sow vulvar phenotype image acquisition and intelligent vulvar phenotype measurement system. The portable sow vulvar phenotype image acquisition device adopts a biomimetic design of the sow vulva, consisting of two arcs of the same radius joined tangent at their endpoints to form an axisymmetric closed curve stretched into a closed thin-walled structure. This vulvar image acquisition device can effectively separate background noise and ensure uniform image illumination. This device provides high-quality images for the development of frontal and side image segmentation algorithms for sow vulvas. Using threshold segmentation and a Deeplabv3+ deep learning model, the system can achieve accurate measurement without complex hardware support. By calibrating parameters, pixel coordinates are converted into actual physical dimensions, and key parameters such as vulvar angle, length, width, and area are calculated. A supporting mobile APP integrates lightweight algorithms, supports real-time processing, and provides traceable digital evidence for breeding pig selection, genetic defect identification, and disease early warning. Summary of the Invention

[0004] To address the problems of low efficiency, large measurement errors, and stress response in animals caused by the current reliance on manual measurement of sow vulvar morphological parameters, the purpose of this invention is to provide a high-quality image acquisition device and intelligent measurement system for sow vulvar phenotypes. Through standardized image acquisition and intelligent analysis technology, this system enables rapid and accurate measurement of sow vulvar phenotypes, including length, width, area, and angle, providing objective data support for sow reproductive performance evaluation and selection of high-fertility sows.

[0005] To achieve the above objectives, the present invention provides the following technical solution: a biomimetic device design, wherein the device adopts a thin-walled cavity structure formed by stretching a circular arc biaxial symmetrical section (major axis 80mm, minor axis 22.85mm) 120mm in the vertical direction, which is made of milky white resin material. Through the sealed thin-wall design, it fits tightly against the sow's buttocks, stretching the vulva area into a closed and standardized imaging area, effectively separating background interference.

[0006] The built-in embedded phone holder (163mm × 77mm × 9mm) has a 52mm × 38mm rectangular window in the center to accommodate the camera, and rounded corners with R = 10mm. The side has reserved operation openings for quick installation and adjustment of the device, while maintaining overall sealing to avoid interference from external light.

[0007] This invention first discloses a rapid method for constructing the length, width, area, and angle of the vulva based on high-quality images of the sow vulva, specifically including the following steps: (1) Image acquisition of sow vulva The front end of the device is placed close to the vulva of the sow, and the mobile phone flash is always on to provide a light source to ensure uniform image illumination, capturing front and side images of the vulva of the gilt sow.

[0008] (2) Standardized high-quality image screening Low-quality images of sow vulva, such as sow's buttocks not being in close contact with the auxiliary device, uneven lighting, camera lens axis being at an angle to the sow's pelvic plane, and stains on the sow's vulva, are removed to obtain standardized high-quality images.

[0009] (3) Development of an automatic measurement algorithm for the angle of the vulva side image of sows 1) Image processing of the lateral aspect of the sow's vulva First, the MSRCR algorithm is applied to preprocess and enhance the acquired images, improving image quality. Lab thresholding segmentation is used to effectively separate the region of interest (ROI) from the background. Based on the OTSU adaptive thresholding algorithm, the extracted ROI is further segmented to identify and separate the sow vulva target region. Finally, morphological operations are used to post-process and optimize the binary image, eliminating noise interference and obtaining the target contour.

[0010] 2) Extraction of angular feature parameters from lateral images of sow vulva Based on the binarized segmented image, the leftmost endpoint (marked as point A) and the topmost endpoint (marked as point B) of the contour are identified, and a reference straight line is formed by connecting points A and B. Using the midpoint of the line connecting A and B as reference point D, the perpendicular distance from each point of the curve contour from A to B to the straight line AD is calculated, and the point with the smallest distance is selected as feature point C. The angle value of ∠ACB is calculated, and the angle is scored according to the vaginal angle scoring standard.

[0011] (4) Training and optimization of the length, width and area measurement model of the vulva frontal image 1) Preprocessing of vulvar frontal image data Effective segmentation of the background region and the region of interest (ROI) is achieved using Lab thresholding and OTSU adaptive thresholding algorithms. A bounding rectangle is constructed from the segmented binary image. An arc contour is drawn using the top, bottom, and leftmost points of the tangent between the rectangle's boundary and the binary image as references. This arc is then symmetrically copied along its upper and lower endpoints to construct a complete elliptical region. The unit pixel length is calculated based on the proportional relationship that the pixel length between the upper and lower endpoints corresponds to an actual length of 8 cm. The elliptical region formed by the double arcs is used as a mask to extract the target analysis region from the original color image.

[0012] 2) Data labeling and partitioning For the sow frontal image dataset, the Labelme annotation tool was used to annotate the boundaries of the vulva region of each image, and the dataset was divided according to the standard ratio of 80% for training set, 10% for validation set, and 10% for test set.

[0013] 3) Model training and optimization DeepLabv3+ was selected as the core semantic segmentation network architecture. To address the resource constraints of mobile devices, EfficientNet-B0 was adopted as the backbone feature extraction network. This network provides good feature extraction capabilities while maintaining lightweight design through a composite scaling strategy, making it suitable for mobile inference scenarios. A pre-training strategy was used to initialize the EfficientNet-B0 backbone network, utilizing pre-trained weights from the ImageNet dataset as the initial parameters for the sow vulva region segmentation task, to accelerate convergence and improve model generalization. After configuring the appropriate hyperparameters (including learning rate, batch size, optimizer, etc.) and setting up a GPU training environment, model training began. The detection results were statistically analyzed, and evaluation metrics (mIoU, f-score, loss value) were checked to see if they reached a threshold. If the threshold was not reached, the attributes of images with frequent false positives were analyzed, and similar images were collected as the training set for iterative training. Each optimization used the latest model weights for network initialization. If the threshold was reached, the iteration terminated, and the model was obtained.

[0014] Preferred options also include: (5) Development of intelligent measurement software 1) Android application architecture design It adopts a modular software architecture design, which separates the core functional modules such as image acquisition, algorithm processing, and data management through multiple functional Activities. It uses the Adapter pattern to decouple data display from business logic, integrates the Camera2 API to achieve high-precision image acquisition control, and supports manual focus and exposure compensation.

[0015] 2) Deep learning model ensemble The deeplabv3+ deep learning model trained using the PyTorch framework is converted into a mobile-deployable binary model file using TorchScript technology, enabling cross-platform deployment of the model. The conversion process includes accuracy verification and consistency checks to ensure that the inference accuracy of the converted model on Android devices is consistent with that of the model trained on the server. The model inference calculation is performed based on the CPU, and the computational complexity is reduced through model quantization and optimization techniques.

[0016] 3) Image processing algorithm implementation Based on the OpenCV4Android library, we implement MSRCR image enhancement, Lab color space conversion, and OTSU threshold segmentation algorithms. We use NDK (Native Development Kit) to compile the core image processing algorithms into native C++ code to improve computational efficiency. We use an asynchronous task processing mechanism to avoid blocking the main thread and ensure a smooth user interface response.

[0017] 4) Local data storage management The Room database framework is used to achieve local persistent storage of measurement results, including key information such as individual sow information, measurement data, image paths and timestamps. SharedPreferences is used to store user configuration parameters, and a local file management system is integrated to realize the classification storage of image files and an automatic cleaning mechanism.

[0018] 5) User Interface Development The modular interface design is implemented using Fragment and ViewPager2, and a custom Camera Preview component is integrated to implement viewfinder guide lines, focus indicators and shooting assistance functions. The responsive layout is implemented using Material Design and ConstraintLayout to adapt to different Android device screen sizes, and provides intuitive visualization of measurement results and historical data query functions. Beneficial effects:

[0019] (1) The image acquisition device adopts a biomimetic structure and sealed design, is equipped with an integrated mobile phone holder, and adopts a side opening design to adapt to a variety of mobile terminals. The device can quickly complete image acquisition and significantly reduce background noise; combined with the calibration algorithm, it achieves millimeter-level precision measurement, and its measurement accuracy and efficiency are significantly improved compared with manual measurement. (2) The image acquisition device is made of lightweight white resin material. The mobile APP does not require special hardware, which meets the real-time operation needs of pig farms. (3) The developed sow vulvar phenotyping algorithm is integrated with a mobile APP to build an intelligent phenotyping application system. This system can replace manual visual inspection and contact physical measurement methods to realize automatic measurement of vulvar length, width, area and angle, improve the accuracy of sow vulvar phenotypic characteristic parameter measurement, increase the measurement speed, and achieve objective evaluation; various information and data indicators collected during the measurement process can be stored and transmitted in real time. (4) The sow vulva phenotype determination algorithm developed in this invention has significant technical advantages and practical value. The algorithm performs well in terms of vulva morphological parameter segmentation accuracy, among which the vulva width segmentation accuracy R 2 >0.90, vulvar length segmentation accuracy R 2 >0.85, vulvar area segmentation accuracy R 2 The developed vulvar angle scoring prediction model achieves an absolute error of less than 1 point between predicted and actual values ​​in over 95% of cases, demonstrating high accuracy in vulvar angle scoring. The successful application of this technology has standardized the determination of sow vulvar phenotypes, significantly improving the objectivity and accuracy of sow vulvar phenotype assessment and effectively avoiding the subjectivity and experience-dependent problems of traditional manual assessment. Attached Figure Description

[0020] Appendix Figure 1 Schematic diagram and 3D structural model of the data acquisition device. In the diagram: 1. Front end of the data acquisition device; 2. Mobile phone mounting bracket. Appendix Figure 2 Images of the sow's vulva taken at the scene.

[0021] Appendix Figure 3 Standard images of the front and side views of the vulva of a sow.

[0022] Appendix Figure 4 Flowchart of automatic measurement and image processing of sow vulvar angle and scoring.

[0023] Appendix Figure 5 Image showing the accuracy verification results of the automatic segmentation algorithm for the lateral image of the sow's vulva phenotype.

[0024] Appendix Figure 6 Flowchart of automatic measurement and image processing of sow vulva length, width and area.

[0025] Appendix Figure 7 Image showing the accuracy verification results of the automatic segmentation algorithm for frontal images of sow vulva phenotype.

[0026] Appendix Figure 8 Screenshot of the APP interface of the sow vulvar phenotypic image acquisition and intelligent measurement system.

[0027] Appendix Figure 9 The APP measures the image segmentation results in real time.

[0028] Appendix Figure 10 Image showing the accuracy verification results of real-time measurement of vulvar parameters by the APP. Detailed Implementation

[0029] The present invention will be further described below with reference to embodiments, but the scope of protection of the present invention is not limited thereto: Combined with appendix Figure 1 ( Figure 1 (a) shows a frontal projection view of the sow vulva collection device. Figure 1 (b) A side projection view of the sow vulva collection device is given. Figure 1 (c) A three-dimensional rendering of the sow vulva acquisition device is given. The sow vulva acquisition device adopts a biomimetic design. The main body is made of milky white resin material. The front end of the device adopts an elliptical structure (maximum size 80mm × 60mm × 120mm) that matches the shape of the sow vulva to conform to the shape of the sow vulva. The built-in thin-walled structure is used to stretch the vulva contour to form a closed imaging area. Figure 1 In (c), the front end 1 of the acquisition device uses light-shielding material to ensure low light leakage rate, and the mobile phone holder 2 facilitates the installation of the mobile phone and maintains the seal. The mobile phone used for image acquisition is placed in the mobile phone holder 2.

[0030] When acquiring images of the sow's vulva, the top of the vulva should be aligned with the upper apex of the device, and the bottom of the vulva with the lower apex of the device, ensuring the vulva area is completely covered within the marked area of ​​the auxiliary device to guarantee accurate image acquisition. When acquiring frontal images, ensure the auxiliary device is perpendicular to the pig's rump to minimize interference from other elements (such as dirt). Use the phone's flash during shooting to ensure even lighting and avoid shadows and overexposure.

[0031] When acquiring lateral images, ensure the auxiliary device is parallel to the pig's rump plane and remains firmly against it. Use a flash during shooting to ensure even lighting. Throughout the acquisition process, ensure the vulva area remains centered in the image to avoid stretching, compression, or distortion due to improper angle or distance. Immediately after shooting, check the image quality to ensure it is clear, unblurred, and the vulva area is fully visible. If the image quality is unsatisfactory, re-acquire the image. After each acquisition, clean and disinfect the auxiliary device and phone holder to prevent cross-contamination. Regularly check the stability of the device and the adjustment function of the phone holder to ensure they are in good working order.

[0032] Based on the technical solution proposed in this application, a corresponding APP can be developed to achieve intelligent determination of sow vulvar phenotype. (Combined with the appendix...) Figure 4 After logging into the system via a mobile app, users can access the measurement template interface to complete the measurement information, including pre-setting the pig breed, measurement personnel information, company name, and pen information. The image acquisition module offers both manual and automatic measurement modes. In manual mode, users input ear number and batch information, then take an image. The vulvar angle is calculated using the three-point marking method (clicking the lower corner of the vulva, the lower corner of the vulvar cleft, and the vulvar cleft in sequence), and the vulvar length is measured using the two-point marking method (marking the upper and lower corners of the vulva), or the vulvar width is measured using the two-point marking method (marking the labial width at the midpoint of the vulvar cleft). Data is stored locally. In automatic mode, the system calls the image processing algorithm and outputs the vulvar length, width, angle, and vulvar score (1-5 points).

[0033] The image processing algorithm is integrated through a mobile app, and the measurement data supports batch filtering and Excel export. Through hardware and algorithm co-design, the system transforms vulvar morphological characteristics from subjective experience into standardized data, providing a low-cost, high-precision digital tool for selecting superior breeding pigs, suitable for the intelligent upgrade needs of large-scale pig farms.

[0034] The portable intelligent measurement system for sow vulvar phenotype proposed in this application obtains predicted values ​​for vulvar width, length, and area from the original frontal image of the vulva; and calculates the vulvar angle and score from the lateral image of the vulva. The accuracy of the prediction algorithm is verified below through two embodiments.

[0035] Example 1: Accuracy Verification of Segmentation Algorithm Based on Standard Images of Vulva Side View of Replacement Sows

[0036] S1. Data Acquisition: Using the rear camera of a Huawei nova11 phone with a data acquisition device ( Figure 1 Images of the vulva were collected from 208 gilts. Figure 2 A total of 527 standard side profile images ( Figure 3b), with a resolution of 3072 pixels × 4096 pixels; S2. Image Preprocessing: First, the MSRCR algorithm is applied to preprocess and enhance the acquired image, effectively improving the loss of detail caused by uneven lighting and enhancing image quality. The frequency distribution histogram of the enhanced sow vulva lateral image in the Lab color space is statistically analyzed. Color features are analyzed and an appropriate Lab threshold is set to achieve effective segmentation of the region of interest (ROI) and background region. Based on the OTSU adaptive threshold segmentation algorithm, the extracted ROI is further segmented to identify and separate the target region of the sow vulva. Finally, morphological operations are used to post-process and optimize the binary image, eliminating noise interference and obtaining the target contour. Lateral image processing is as follows: Figure 4 As shown.

[0037] S3. Extraction of vulvar angle and scoring features in gilts: Based on the binarized segmented image, identify the leftmost endpoint (marked as point A) and the topmost endpoint (marked as point B) of the contour, and connect points A and B to form a baseline straight line. Using the midpoint of the line connecting A and B as reference point D, calculate the perpendicular distance from each point of the curve contour from A to B to the straight line AD, select the point with the smallest distance as feature point C, calculate the angle value of ∠ACB, and score the angle according to the vulvar angle scoring standard.

[0038] S4. Accuracy Evaluation of Standard Image Segmentation Algorithm for Vulva Side View of Replacement Sows: Using Photoshop software, the vulvar angles of all experimental sows were manually measured and scored. The automatically developed algorithm was then used to measure the vulvar angles and score the vulva again. The accuracy of the automatically measured algorithm was evaluated based on the correlation between the manually measured and automatically measured angles. Results showed that the accuracy of the automatically measured algorithm developed in this invention reached 0.89 (…). Figure 5 The developed automatic measurement algorithm achieves an absolute error of less than 1 point between the vulvar angle score and the manually measured vulvar angle score in over 99% of cases (Table 1), demonstrating its high accuracy in vulvar angle scoring.

[0039] Table 1. Accuracy of Angle Scoring Algorithm Based on Standard Image Segmentation of Vulva Side of Replacement Sows

[0040] Example 2: Accuracy Verification of Segmentation Algorithm Based on Standard Frontal Image of Reproductive Sow Vulva S1. Data Acquisition: Using the rear camera of a Huawei nova11 phone with a data acquisition device ( Figure 1 Images of the vulva of 392 gilts were collected from the front. Figure 2 A total of 1092 standard frontal images ( Figure 3 a) The resolution is 3072 pixels × 4096 pixels; S2. Data Preprocessing: Images containing stains, uneven lighting, overexposure, or shooting angles not perpendicular to the sow's rump are removed. OpenCV is used to preprocess the standard dataset. The OpenCV image preprocessing method used in this patent includes: A frequency distribution histogram of frontal images of sow vulvas in the Lab color space was statistically analyzed. Color features were analyzed, and an appropriate Lab threshold was set. Based on the OTSU adaptive thresholding segmentation algorithm, effective segmentation of the background region and the region of interest was achieved. A bounding rectangle was constructed from the segmented binary image. An arc contour was drawn using the top, bottom, and leftmost points of the tangent between the rectangle's boundary and the binary image as references. This arc was symmetrically copied along its upper and lower endpoints to construct a complete elliptical region. The unit pixel length was calculated based on the proportional relationship that the pixel length between the upper and lower endpoints corresponds to an actual length of 8 cm. Using the elliptical region formed by the double arcs as a mask, the target analysis region was extracted from the original color image. The frontal image processing flow is as follows: Figure 6 As shown; S3. Data annotation: Use labelme software to annotate the image data in VOC format; S4. Data partitioning: Randomly divide the training set, validation set, and test set according to a ratio of 8:1:1. S5. Network Design: To balance detection accuracy and detection speed, Deeplabv3+ is used as the detection network model. S6. Backbone Network Pre-training: The backbone network is pre-trained on the ImageNet dataset. Iteration stops when the validation set loss is reduced to below 0.1. The pre-trained weight model is used as the initial network weights for frontal image segmentation of sow vulva. S7. Network Model Training: During training, the learning rate is first scaled by batch_size / 16 and clamped to a safe range to obtain the actual initial learning rate. Then, in each epoch, cosine annealing is used to smoothly reduce the learning rate from this value to one percent of it. The code automatically updates the optimizer without manual intervention. The batch_size is 4, the learning rate is initialized to 0.0005, a step-by-step learning strategy is used, and the number of epochs is 150.

[0041] S8. Network Model Testing and Optimization: Statistically analyze the detection results in the test set to evaluate whether the segmentation accuracy meets the requirements. If it does not meet the requirements, analyze the image attributes with poor segmentation results, collect similar images as the training set for iterative training, and initialize network training with the latest model weights for each optimization. If the segmentation accuracy meets the requirements, the iteration stops, the optimal model weight file is obtained, and the accuracy of the model prediction is judged based on the correlation between the model's predicted values ​​and manually measured values ​​in the test set. The test results show that the accuracy of the vulvar width, length, and area predictions of the model developed in this invention reached 0.97, 0.94, and 0.96, respectively. Figure 7 ).

[0042] This application also proposes the software development of a system for acquiring and intelligently measuring images of sow vulvar phenotypes.

[0043] Example 3: Application of a system for acquiring and intelligently measuring vulvar phenotype images in sows

[0044] S1. Login Interface: After the application starts, it first enters the login interface, which provides username and password input boxes. Users need to enter the correct account information for identity verification to ensure the security and traceability of the measurement data. A login button is located at the bottom of the interface for submitting verification information. Figure 8 a).

[0045] S2. Registration Interface: New users can create an account through the registration interface. This interface provides complete user information entry functions, including username setting, password creation, and filling in basic personal information, ensuring that each measurement operator has a unique account identifier. Figure 8 b).

[0046] S3. Password Retrieval Interface: When a user forgets their login password, they can reset it through this local password retrieval interface. The user needs to enter their registered account information and correctly answer the preset security questions. After the system verifies the correct answers, the user can set a new password. Figure 8 c).

[0047] S4. Main Interface: The core operating interface of the application, providing a complete function navigation menu, including quick access to major functional modules such as personal information management, measurement information settings, image acquisition, and data viewing. It adopts an intuitive button layout design for easy user access to various functions. Figure 8 d).

[0048] S5. Measurement Template Information Interface: On this page, enter the information of each measurement personnel, company name, farm, building, house, pen, and breed of the measured pigs, and also enter the pig's sex, date of birth, and measurement date. The APP automatically calculates and displays the measurement age based on the date of birth and measurement date. Figure 8 e).

[0049] S6. Personal Information Interface: On this page, you can enter and manage basic information such as username, gender, date of birth, assigned role, and mobile phone number. Figure 8 f).

[0050] S7. Angle Measurement: After clicking the image acquisition button, select the automatic measurement mode, enter the pig ID and batch information, and set the measurement mode to "Angle Measurement". Simultaneously, enter the filename for storing the measurement results for that pig. Figure 8 g).

[0051] S8. Side data acquisition: Using the rear camera of the Huawei nova11 phone with a data acquisition device, standard images of the vulva side of 68 gilts were acquired, with one standard side image for each pig and a resolution of 3072 pixels × 4096 pixels. S9. Angle Feature Extraction: The captured side image is automatically transmitted to the C++ layer of the APP, processed by the OpenCV algorithm, and automatically calculates and returns relevant parameters such as vulvar score and vulvar angle, as well as the segmented vulvar side image. Figure 9 a).

[0052] S10, Frontal Data Acquisition: Using the rear camera of the nova11 phone with a data acquisition device, standard frontal images of the vulva of 68 gilts were acquired, with one standard frontal image for each pig and a resolution of 3072 pixels × 4096 pixels. S11, Model Inference: The captured frontal image data is transmitted to a deep learning model embedded in the APP. The model performs model inference on the frontal image, automatically calculating and returning relevant parameters such as vulvar length and vulvar width, as well as the segmented frontal vulvar image. Figure 9 b).

[0053] S12. Measurement Accuracy Verification: Based on the correlation between the APP's automatic measurement values ​​and the manual measurement values, the accuracy of the APP's automatic measurement was judged. The results showed that the accuracy of the APP's automatic measurement of the vulva length, width, area, and angle were 0.98, 0.98, 0.95, and 0.90, respectively. Figure 10 ).

[0054] While the present invention has been described in detail, those skilled in the art will understand that modifications within the spirit and scope of the invention will be readily apparent. For example, various changes can be made to the subject, spirit, and scope of the invention to suit specific circumstances, materials, material compositions, or method steps. All such changes are included within the scope of the claims of this application. Furthermore, any minor variations or modifications made to the disclosed technical content are equivalent to equivalent embodiments and fall within the scope of the technical solution.

Claims

1. A portable intelligent detection system for sow vulvar phenotype, characterized in that... The system is deployed on a mobile terminal, which includes a data acquisition module, a data processing module, and a data storage module. The data acquisition module is used to capture standard images of the sow's vulva from the front and side. The acquired images are transmitted to the data processing module, which performs the following steps: S1. Preprocess the acquired raw frontal images of the vulva; S2. Input the preprocessed image obtained in S1 into the trained model for deep learning model inference to obtain predicted values ​​of vulvar width, length and area. S3. Extract feature parameters from the collected vulvar images and calculate the vulvar angle and score; The predicted values ​​of vulvar width, length, and area, as well as vulvar angle and scoring information, are stored in the data storage module for users to export and display.

2. The system according to claim 1, characterized in that... The mobile terminal is a smartphone, and the data acquisition module includes a built-in camera, a phone holder, and a bionic device. The phone holder wraps around the phone and fixes the bionic device to the front of the camera.

3. The system according to claim 2, characterized in that... The biomimetic device has an irregular oval barrel-shaped structure that matches the shape of a sow's vulva and features a sealed thin-walled design.

4. The system according to claim 2, characterized in that... The biomimetic device is made of resin.

5. The system according to claim 2, characterized in that... The mobile phone holder has a rectangular window in the center to accommodate the camera, and an operation opening on the side to facilitate quick installation and adjustment of the device, while maintaining overall sealing to avoid interference from external light.

6. The system according to claim 1, characterized in that... In S1, the specific steps of image preprocessing are as follows: 1) Based on the Lab threshold segmentation algorithm, the foreground region in the image is initially segmented. The original image is color space converted and initially segmented by setting the threshold parameter, which effectively distinguishes the target region from the background environment and obtains the initially segmented image. 2) Based on the OTSU algorithm, the initially segmented image is subjected to adaptive threshold calculation using the OTSU maximum inter-class variance algorithm, and then binarization is performed. 3) For the largest connected region after binarization, calculate the geometric parameters of its smallest bounding rectangle, and construct an elliptical region based on the length-to-width ratio of the rectangle; 4) Using the constructed elliptical region as a binary mask, perform masking operations on the original input image to obtain the foreground region from the original image; 5) Convert the foreground area of ​​the image to grayscale and perform grayscale histogram equalization to improve the overall contrast of the image.

7. The system according to claim 1, characterized in that... In S2, the deep learning model adopts the Deeplabv3+ semantic segmentation network architecture and uses EfficientNet as the backbone feature extraction network. The model inferences to obtain the geometric feature parameters of the target region, including length, width, and area feature parameters. Finally, the length, width, and area pixel dimensions are converted into actual length, width, and area by combining physical scales.

8. The system according to claim 1, characterized in that... In S3, the specific steps for extracting feature parameters from the side view image are as follows: 1) Image enhancement processing: The multi-scale Retinex color restoration algorithm (MSRCR) is applied to the input side image. Three Gaussian kernel scale parameters with sigma values ​​of 15, 80, and 250 are used to perform Gaussian blur and logarithmic operations on the three RGB color channels respectively. The dynamic range is adjusted by the color restoration parameter alpha=125 and the gain offset parameter beta=46. The original image is then color corrected based on the grayscale scaling factor to obtain the enhanced color image. 2) Lab thresholding: The enhanced color image is converted from the RGB color space to the Lab color space. Pixels with a channel value less than -1 or b channel value less than 2 are set to L=0, a=0, b=0. At the same time, pixels with a channel value in the range of -1 to 5 and b channel value in the range of 2 to 6 are also set to zero. After color filtering, the processing result is converted back to the RGB color space. 3) Binarization and Connected Component Analysis: The filtered color image is converted into a grayscale image, and binarization is performed using the OTSU adaptive thresholding method. The largest connected component is extracted using the connected component analysis algorithm to obtain image C. After performing a negation operation on image C, connected component analysis is performed again to retain the largest connected component to obtain image D. Finally, a negation operation is performed on image D to obtain the binary image E. 4) Morphological processing: Perform a closing operation on the binary image E, filter foreground segments whose length is less than 1 / 28 of the image width by scanning line by line, and retain the largest connected region through connected component analysis after filtering. 5) Key point detection and automatic angle calculation: Contour extraction is performed on the final binarized image, and the outer contour with the largest area is selected as the target contour. Key control points are determined sequentially on this contour: First, the leftmost point of the contour is detected as point A, and the lowest point of the contour is detected as point B. The proportional point D is calculated between point A and point B according to a scaling factor of 0.

4. Search along the path from point B to point A along the contour, calculate the perpendicular distance from each point on the path to line segment AD, and select the contour point with the largest distance and whose projection point is within the range of line segment AD as the key point C; based on the angle formed by the three points A, C, and B, automatically calculate the angle using the vector dot product formula. In the formula, CA and CB are the vectors from point C to point A and from point C to point B, respectively, and |·| represents the magnitude of the vector; 6) Grade and score according to the calculated angle value: when the angle is greater than 150°, the score is 5; when the angle is in the range of 120°-150°, the score is 4; when the angle is in the range of 90°-120°, the score is 3; when the angle is in the range of 60°-90°, the score is 2; when the angle is less than 60°, the score is 1. Finally, the angle measurement value and the corresponding score result are output as feature parameters of the side image.

9. The system according to claim 1, characterized in that... The mobile terminal also includes a data export module, which can export the predicted values ​​of vulvar width, length and area, vulvar angle and scoring information as data in Excel format.

10. The system according to claim 1, characterized in that, The system also supports manual measurement. In manual mode, users can measure the vulvar angle, length, and width using a three-point or two-point marking method and store the data.