Agricultural material packaging label segmentation method and device based on YOLO11-seg and morphological mask reconstruction

By using a method based on YOLO11-seg and morphological mask reconstruction, the segmentation stability problem of agricultural material packaging labels in complex scenarios was solved, achieving high-precision label reading and large-scale application, and reducing labor costs.

CN121661089APending Publication Date: 2026-03-13CHINA TOWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-11
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing technologies struggle to reliably segment agricultural input packaging labels under various conditions, including multi-view scenarios, strong reflections, curved bottle surfaces, dense small text, and mixed multilingual text. This results in incomplete mask boundaries, text adhesion, and missed detection of small targets, leading to insufficient reading accuracy and hindering large-scale application.

Method used

We employ a method based on YOLO11-seg and morphological mask reconstruction. We train the YOLO11-seg model using multi-mixed data augmentation, combine buffer neighborhood constraints and multi-view parallel inference, use image rotation and confidence fusion to perform text-sensitive segmentation, and perform polygon coordinate and morphological mask reconstruction to crop out the complete label region.

Benefits of technology

It significantly improves the accuracy of reading agricultural input packaging labels and the efficiency of sampling inspection, reduces labor costs, adapts to large-scale deployment in multiple product categories, and ensures the stability and integrity of segmentation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121661089A_ABST
    Figure CN121661089A_ABST
Patent Text Reader

Abstract

The invention discloses an agricultural material packaging label segmentation method and device based on YOLO11-seg and morphological mask reconstruction, and belongs to the technical field of computer vision and image processing, and the method comprises the steps: obtaining an agricultural material product packaging original image sample and label polygon labeling information; performing multi-mixed data enhancement on the original image sample, and generating a three-category segmentation label based on label polygon labeling information; carrying out segmentation reasoning through a YOLO-seg model to obtain segmentation results of three dimensions; carrying out confidence coefficient comparison and fusion on the segmentation results of the three dimensions to form a fused segmentation result; reconstructing a real mask in the original image space according to the fused segmentation result, and performing morphological expansion operation; cutting a label area from the original image according to the reconstructed mask to obtain a cutting result and a label segmentation map; reading accuracy and sampling inspection efficiency are remarkably improved, labor cost and compliance risks are reduced, and large-scale deployment and data asset precipitation are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer vision and image processing technology, and specifically relates to a method and apparatus for segmenting agricultural material packaging labels based on YOLO11-seg and morphological mask reconstruction. Background Technology

[0002] With the continuous emergence of numerous labels of various specifications, formats, and materials in agricultural input packaging, accurate segmentation is crucial for converting multi-interference images into low-noise inputs for OCR and rule-based comparison, forming auditable evidence and data assets. Existing common methods include manual sampling / photo archiving, barcode / QR code reading, general OCR, rule / threshold segmentation, and detection-segmentation combinations: manual methods are accurate but time-consuming and difficult to scale; barcode scanning relies on standard coding and printing quality, and has insufficient coverage for scenarios with no codes, damaged or counterfeit labels; general OCR lacks robustness under oblique shooting, strong reflection, bending, obstruction, and mixed text and image layouts, and is prone to boundary adhesion and text breakage; traditional segmentation is sensitive to changes in lighting and layout, and has poor cross-category transferability; detection-segmentation combinations still have problems such as incomplete mask boundaries and missed detection of small targets in scenarios with curved bottles, dense small text, and mixed multilingual layouts, making it difficult to stably support large-scale applications.

[0003] Deep learning-based detection and instance segmentation methods (such as YOLO and Mask) can locate and segment labeled regions to a certain extent, but they are still prone to incomplete mask boundaries, text adhesion, and missed detection of small targets in scenarios with multiple views, strong reflections, curved bottles, dense small text, and mixed multilingual text. Single-view inference stability and generalization are also insufficient. General-purpose cameras have the advantages of being non-contact, easy to operate, and low-cost, but they are limited by ambient lighting and angle conditions, with reduced recognition accuracy in high-light and low-light environments, and limited edge computing power. Summary of the Invention

[0004] To address the aforementioned issues, this application provides a method for segmenting agricultural input packaging labels based on YOLO11-seg and morphological mask reconstruction. This method utilizes multi-mixed data to augment the training of YOLO11. The SEG model, combined with buffer neighborhood constraints, enhances text-sensitive segmentation. During the inference stage, it incorporates multi-view parallel image rotation, confidence fusion, and mask reconstruction based on polygon coordinates and morphology to mitigate boundary gaps and adhesion caused by oblique shots, strong reflections, bending, and occlusion. The system outputs cropped small images and structured fields, providing low-noise input and auditable evidence for OCR and rule verification. It is compatible with general cameras and edge computing power, adapting to various scenarios such as pesticides, seeds, and veterinary drugs, significantly improving recognition accuracy and sampling efficiency, reducing labor costs and compliance risks, and enabling large-scale deployment and data asset accumulation.

[0005] The technical solution includes: Obtain original image samples of agricultural input product packaging and polygon annotation information of labels; The original image samples are processed clockwise and counterclockwise by 90 degrees to obtain a three-dimensional image. Three-category segmentation labels are generated based on the label polygon annotation information. The three-dimensional image and the three-category segmentation labels are input into the trained YOLO-seg model for segmentation inference to obtain the segmentation results in three dimensions; the segmentation results include the segmentation mask and polygon coordinates; The segmentation results from the three dimensions are compared and fused based on their confidence levels to form a fused segmentation result. Based on the coordinates of the fused polygons, a real mask is reconstructed in the original image space, and a morphological dilation operation is performed in combination with the fused segmentation mask. The label region is cropped from the original image based on the reconstructed mask, resulting in the cropping result and the label segmentation map.

[0006] Optionally, the training process of the YOLO-seg model includes: Perform multiple combined enhancement operations on the original image samples; Based on the labeled polygon annotation information, a buffer is generated through a polygon dilation algorithm, which expands the labeled polygons into three-category segmentation labels containing background, text, and buffer. A buffer branch is added to the head region of the YOLO11-seg model, and the output of the neck region passes through the original segmentation head and the buffer segmentation head. The buffer branch adopts a three-channel output and is combined with pixel-level weighted cross-entropy or weighted regression loss. Pixel-level weighted cross-entropy or weighted loss is used for optimization, and the final loss is the weighted sum of the YOLO11-seg model's built-in loss and the buffer pixel-level loss. Training stops when the final loss reaches a preset threshold.

[0007] Optionally, the step of generating a buffer based on the label polygon annotation information using a polygon dilation algorithm includes: A polygon dilation algorithm based on the centerline is adopted. The centerline is constructed by interpolating the midpoint of the long side of the polygon in the polygon annotation information. The dilated buffer area is generated by expanding outward at a set distance based on the direction of the centerline and the vertex normal. Optionally, the confidence comparison and fusion of the segmentation results across the three dimensions to form a fused segmentation result includes: For each segmentation result, compare the confidence of the segmentation results across the three dimensions, and retain the segmentation result with the highest confidence as the high-confidence target segmentation result; For different segmentation results, the segmentation results are merged with the retained high-confidence target segmentation results to form a fused segmentation result.

[0008] Optionally, the step of reconstructing the real mask in the original image space based on the fused polygon coordinates and performing morphological dilation operation in conjunction with the fused segmentation mask includes: Obtain the coordinates of the fused polygon, map the fused polygon coordinates to the original image space, and reconstruct the mask in the original image space using the mapped polygon coordinates to generate a preliminary segmentation mask. Define the dilation core, apply morphological dilation operation to the reconstructed mask, and obtain the morphologically processed mask; The morphologically processed mask was compared with the fused segmentation mask to verify the accuracy and integrity of the mask.

[0009] Optionally, the categories in the three-category segmentation labels include background, text, and buffer.

[0010] Optionally, the multiple enhancement operations include, but are not limited to: horizontal flipping and brightness contrast, affine shearing transformation and brightness contrast, 90-degree clockwise or counterclockwise rotation, rotation, scaling, translation, and various blurring and grayscale processing.

[0011] Based on the same inventive concept, this application also provides an agricultural input packaging label segmentation device based on YOLO11-seg and morphological mask reconstruction, comprising: The data acquisition unit is used to acquire original image samples of agricultural product packaging and polygon annotation information of labels; The data processing unit is used to perform clockwise and counterclockwise 90-degree processing on the original image samples to obtain a three-dimensional image, and generate three-category segmentation labels based on the label polygon annotation information. The segmentation inference unit is used to input a three-dimensional image and three-category segmentation labels into a trained YOLO-seg model for segmentation inference, and to obtain a three-dimensional segmentation result; the segmentation result includes a segmentation mask and polygon coordinates; The fusion unit is used to compare and fuse the segmentation results of the three dimensions with confidence, and form a fused segmentation result; The mask reconstruction unit is used to reconstruct the real mask in the original image space based on the fused polygon coordinates, and to perform morphological dilation operation in combination with the fused segmented mask. The image segmentation unit is used to crop the label region from the original image based on the reconstructed mask, and obtain the cropping result and the label segmentation map.

[0012] Optionally, the training process of the YOLO-seg model includes: Perform multiple combined enhancement operations on the original image samples; Based on the labeled polygon annotation information, a buffer is generated through a polygon dilation algorithm, which expands the labeled polygons into three-category segmentation labels containing background, text, and buffer. A buffer branch is added to the head region of the YOLO11-seg model, and the output of the neck region passes through the original segmentation head and the buffer segmentation head. The buffer branch adopts a three-channel output and is combined with pixel-level weighted cross-entropy or weighted regression loss. Pixel-level weighted cross-entropy or weighted loss is used for optimization, and the final loss is the weighted sum of the YOLO11-seg model's built-in loss and the buffer pixel-level loss. Training stops when the final loss reaches a preset threshold.

[0013] Optionally, the step of generating a buffer based on the label polygon annotation information using a polygon dilation algorithm includes: A polygon dilation algorithm based on the centerline is adopted. The centerline is constructed by interpolating the midpoint of the long side of the polygon in the polygon annotation information. The dilated buffer area is generated by expanding outward at a set distance based on the direction of the centerline and the vertex normal. Optionally, the confidence comparison and fusion of the segmentation results across the three dimensions to form a fused segmentation result includes: For each segmentation result, compare the confidence of the segmentation results across the three dimensions, and retain the segmentation result with the highest confidence as the high-confidence target segmentation result; For different segmentation results, the segmentation results are merged with the retained high-confidence target segmentation results to form a fused segmentation result.

[0014] Optionally, the step of reconstructing the real mask in the original image space based on the fused polygon coordinates and performing morphological dilation operation in conjunction with the fused segmentation mask includes: Obtain the coordinates of the fused polygon, map the fused polygon coordinates to the original image space, and reconstruct the mask in the original image space using the mapped polygon coordinates to generate a preliminary segmentation mask. Define the dilation core, apply morphological dilation operation to the reconstructed mask, and obtain the morphologically processed mask; The morphologically processed mask was compared with the fused segmentation mask to verify the accuracy and integrity of the mask.

[0015] Optionally, the categories in the three-category segmentation labels include background, text, and buffer.

[0016] Optionally, the multiple enhancement operations include, but are not limited to: horizontal flipping and brightness contrast, affine shearing transformation and brightness contrast, 90-degree clockwise or counterclockwise rotation, rotation, scaling, translation, and various blurring and grayscale processing.

[0017] Furthermore, this application also provides a computing device, comprising: at least one processor and a memory; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, a method for segmenting agricultural material packaging labels based on YOLO11-seg and morphological mask reconstruction, as described above, is implemented.

[0018] Furthermore, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the above-described method for segmenting agricultural material packaging labels based on YOLO11-seg and morphological mask reconstruction.

[0019] Compared with the prior art, this application has the following advantages: This application provides a method and apparatus for segmenting agricultural input packaging labels based on YOLO11-seg and morphological mask reconstruction, comprising: acquiring original image samples of agricultural input product packaging and label polygon annotation information; performing clockwise and counterclockwise 90-degree processing on the original image samples to obtain a three-dimensional image, and generating three-category segmentation labels based on the label polygon annotation information; inputting the three-dimensional image and the three-category segmentation labels into a trained YOLO-seg model for segmentation inference to obtain segmentation results in three dimensions; the segmentation results include a segmentation mask and polygon coordinates; comparing and fusing the confidence of the three-dimensional segmentation results to form a fused segmentation result; reconstructing a real mask in the original image space based on the fused polygon coordinates, and performing morphological dilation operation in conjunction with the fused segmentation mask; cropping the label region from the original image based on the reconstructed mask to obtain the cropping result and the label segmentation map; Multi-mix data augmentation is used to address the issue of insufficient generalization of multi-specification and multi-material labels in scenarios with few samples; By using buffer image neighborhood constraints, the segmentation boundaries of text-sensitive regions are made clearer, and background crosstalk and field adhesion are suppressed, thereby improving the localization and segmentation accuracy of neighboring text. By employing multi-view integrated reasoning and high-confidence retention fusion, the cross-angle output remains consistent and stable, effectively mitigating the fluctuations in results caused by multi-angle shooting; Morphological masking is used for reconstruction, which makes the text more enclosed and the cropped area more complete and clean, thereby improving the accuracy of subsequent OCR reading and the reliability of rule verification.

[0020] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures pointed out in the description, claims and drawings. Attached Figure Description

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

[0022] Figure 1 This paper presents a flowchart of a method for segmenting agricultural input packaging labels based on YOLO11-seg and morphological mask reconstruction, as provided in this application. Figure 2 This paper presents a flowchart illustrating the buffer construction process in a method for segmenting agricultural input packaging labels based on YOLO11-seg and morphological mask reconstruction provided in this application. Figure 3 This paper presents a flowchart of the mask reconstruction process in an agricultural input packaging label segmentation method based on YOLO11-seg and morphological mask reconstruction provided in this application. Figure 4 The diagram shows the system configuration of an agricultural input packaging label segmentation device based on YOLO11-seg and morphological mask reconstruction provided in this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0024] Example 1 This application provides a method for segmenting agricultural input packaging labels based on YOLO11-seg and morphological mask reconstruction, such as... Figure 1 ,include: Obtain original image samples of agricultural input product packaging and polygon annotation information of labels; The original image samples are processed clockwise and counterclockwise by 90 degrees to obtain a three-dimensional image. Three-category segmentation labels are generated based on the label polygon annotation information. The three-dimensional image and the three-category segmentation labels are input into the trained YOLO-seg model for segmentation inference to obtain the segmentation results in three dimensions; the segmentation results include the segmentation mask and polygon coordinates; The segmentation results from the three dimensions are compared and fused based on their confidence levels to form a fused segmentation result. Based on the coordinates of the fused polygons, a real mask is reconstructed in the original image space, and a morphological dilation operation is performed in combination with the fused segmentation mask. The label region is cropped from the original image based on the reconstructed mask, resulting in the cropping result and the label segmentation map.

[0025] Optionally, the training process of the YOLO-seg model includes: Perform multiple combined enhancement operations on the original image samples; Based on the labeled polygon annotation information, a buffer is generated through a polygon dilation algorithm, which expands the labeled polygons into three-category segmentation labels containing background, text, and buffer. A buffer branch is added to the head region of the YOLO11-seg model, and the output of the neck region passes through the original segmentation head and the buffer segmentation head. The buffer branch adopts a three-channel output and is combined with pixel-level weighted cross-entropy or weighted regression loss. Pixel-level weighted cross-entropy or weighted loss is used for optimization, and the final loss is the weighted sum of the YOLO11-seg model's built-in loss and the buffer pixel-level loss. Training stops when the final loss reaches a preset threshold.

[0026] Optionally, the buffer is generated based on the label polygon annotation information using a polygon dilation algorithm, such as... Figure 2 ,include: A polygon dilation algorithm based on the centerline is adopted. The centerline is constructed by interpolating the midpoint of the long side of the polygon in the polygon annotation information. The dilated buffer area is generated by expanding outward at a set distance based on the direction of the centerline and the vertex normal. Optionally, the confidence comparison and fusion of the segmentation results across the three dimensions to form a fused segmentation result includes: For each segmentation result, compare the confidence of the segmentation results across the three dimensions, and retain the segmentation result with the highest confidence as the high-confidence target segmentation result; For different segmentation results, the segmentation results are merged with the retained high-confidence target segmentation results to form a fused segmentation result.

[0027] Optionally, the real mask is reconstructed in the original image space based on the fused polygon coordinates, and a morphological dilation operation is performed in conjunction with the fused segmentation mask, such as... Figure 3 ,include: Obtain the coordinates of the fused polygon, map the fused polygon coordinates to the original image space, and reconstruct the mask in the original image space using the mapped polygon coordinates to generate a preliminary segmentation mask. Define the dilation core, apply morphological dilation operation to the reconstructed mask, and obtain the morphologically processed mask; The morphologically processed mask is compared with the fused segmentation mask to verify the accuracy and integrity of the mask, so as to ensure that the entire label is continuous and that key fields are not missing. Optionally, the categories in the three-category segmentation labels include background, text, and buffer.

[0028] Optionally, the multiple enhancement operations include, but are not limited to: horizontal flipping and brightness contrast, affine shearing transformation and brightness contrast, 90-degree clockwise or counterclockwise rotation, rotation, scaling, translation, and various blurring and grayscale processing.

[0029] The advantages of this technical solution are as follows: 1. This algorithm can accurately segment key labels on the packaging of various agricultural products using only a simple, general-purpose camera. The system is simple and low-cost.

[0030] 2. This algorithm employs multi-mixed data augmentation and multi-view confidence fusion to ensure stable and consistent segmentation under complex lighting and multi-view shooting conditions, thereby addressing the problem of insufficient robustness in traditional methods.

[0031] 3. This algorithm uses buffer image neighborhood constraints, which makes the boundaries of text-sensitive regions clearer and significantly reduces crosstalk between fields, in order to solve the problems of over-segmentation / under-segmentation and field adhesion.

[0032] 4. This algorithm uses polygon coordinate mask restoration and morphological mask reconstruction to ensure that the segmented output is complete, unfragmented, and with continuous text lines, providing complete and clean input for OCR and improving recognition accuracy.

[0033] 6. This algorithm can run stably on general cameras and edge devices, automatically complete tag segmentation and field positioning, significantly improve sampling efficiency and recognition accuracy, reduce manual verification and maintenance costs, and is suitable for rapid deployment and large-scale application in multiple product categories such as pesticides, seeds, and veterinary drugs.

[0034] Example 2 Based on the same inventive concept, this application also provides an agricultural input packaging label segmentation device based on YOLO11-seg and morphological mask reconstruction, such as... Figure 4 ,include: The data acquisition unit is used to acquire original image samples of agricultural product packaging and polygon annotation information of labels; The data processing unit is used to perform clockwise and counterclockwise 90-degree processing on the original image samples to obtain a three-dimensional image, and generate three-category segmentation labels based on the label polygon annotation information. The segmentation inference unit is used to input a three-dimensional image and three-category segmentation labels into a trained YOLO-seg model for segmentation inference, and to obtain a three-dimensional segmentation result; the segmentation result includes a segmentation mask and polygon coordinates; The fusion unit is used to compare and fuse the segmentation results of the three dimensions with confidence, and form a fused segmentation result; The mask reconstruction unit is used to reconstruct the real mask in the original image space based on the fused polygon coordinates, and to perform morphological dilation operation in combination with the fused segmented mask. The image segmentation unit is used to crop the label region from the original image based on the reconstructed mask, and obtain the cropping result and the label segmentation map.

[0035] Optionally, the training process of the YOLO-seg model includes: Perform multiple combined enhancement operations on the original image samples; Based on the labeled polygon annotation information, a buffer is generated through a polygon dilation algorithm, which expands the labeled polygons into three-category segmentation labels containing background, text, and buffer. A buffer branch is added to the head region of the YOLO11-seg model, and the output of the neck region passes through the original segmentation head and the buffer segmentation head. The buffer branch adopts a three-channel output and is combined with pixel-level weighted cross-entropy or weighted regression loss. Pixel-level weighted cross-entropy or weighted loss is used for optimization, and the final loss is the weighted sum of the YOLO11-seg model's built-in loss and the buffer pixel-level loss. Training stops when the final loss reaches a preset threshold.

[0036] Optionally, the step of generating a buffer based on the label polygon annotation information using a polygon dilation algorithm includes: A polygon dilation algorithm based on the centerline is adopted. The centerline is constructed by interpolating the midpoint of the long side of the polygon in the polygon annotation information. The dilated buffer area is generated by expanding outward at a set distance based on the direction of the centerline and the vertex normal. Optionally, the confidence comparison and fusion of the segmentation results across the three dimensions to form a fused segmentation result includes: For each segmentation result, compare the confidence of the segmentation results across the three dimensions, and retain the segmentation result with the highest confidence as the high-confidence target segmentation result; For different segmentation results, the segmentation results are merged with the retained high-confidence target segmentation results to form a fused segmentation result.

[0037] Optionally, the step of reconstructing the real mask in the original image space based on the fused polygon coordinates and performing morphological dilation operation in conjunction with the fused segmentation mask includes: Obtain the coordinates of the fused polygon, map the fused polygon coordinates to the original image space, and reconstruct the mask in the original image space using the mapped polygon coordinates to generate a preliminary segmentation mask. Define the dilation core, apply morphological dilation operation to the reconstructed mask, and obtain the morphologically processed mask; The morphologically processed mask was compared with the fused segmentation mask to verify the accuracy and integrity of the mask.

[0038] Optionally, the categories in the three-category segmentation labels include background, text, and buffer.

[0039] Optionally, the multiple enhancement operations include, but are not limited to: horizontal flipping and brightness contrast, affine shearing transformation and brightness contrast, 90-degree clockwise or counterclockwise rotation, rotation, scaling, translation, and various blurring and grayscale processing.

[0040] Example 3 Based on the same inventive concept, this application also provides an electronic device. The electronic device of this application includes at least one processor and at least one storage medium electrically connected to the processor. The storage medium is electrically connected to the processor, wherein the storage medium stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method described above.

[0041] Example 4 Based on the same inventive concept, this application also provides a storage medium storing instructions executable by at least one processor, the instructions being executed by at least one processor to enable at least one processor to perform the method described above.

[0042] Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for segmenting agricultural input packaging labels based on YOLO11-seg and morphological mask reconstruction, characterized in that, include: Obtain original image samples of agricultural input product packaging and polygon annotation information of labels; The original image samples are processed clockwise and counterclockwise by 90 degrees to obtain a three-dimensional image. Three-category segmentation labels are generated based on the label polygon annotation information. The three-dimensional image and the three-category segmentation labels are input into the trained YOLO-seg model for segmentation inference to obtain the segmentation results in three dimensions; the segmentation results include the segmentation mask and polygon coordinates; The segmentation results from the three dimensions are compared and fused based on their confidence levels to form a fused segmentation result. Based on the coordinates of the fused polygons, a real mask is reconstructed in the original image space, and a morphological dilation operation is performed in combination with the fused segmentation mask. The label region is cropped from the original image based on the reconstructed mask, resulting in the cropping result and the label segmentation map.

2. The method as described in claim 1, characterized in that, The training process of the YOLO-seg model includes: Perform multiple combined enhancement operations on the original image samples; Based on the labeled polygon annotation information, a buffer is generated through a polygon dilation algorithm, which expands the labeled polygons into three-category segmentation labels containing background, text, and buffer. A buffer branch is added to the head region of the YOLO11-seg model, and the output of the neck region passes through the original segmentation head and the buffer segmentation head. The buffer branch adopts a three-channel output and is combined with pixel-level weighted cross-entropy or weighted regression loss. Pixel-level weighted cross-entropy or weighted loss is used for optimization, and the final loss is the weighted sum of the YOLO11-seg model's built-in loss and the buffer pixel-level loss. Training stops when the final loss reaches a preset threshold.

3. The method as described in claim 2, characterized in that, The buffer generated by the label-based polygon annotation information using a polygon dilation algorithm includes: A polygon dilation algorithm based on the centerline is adopted. The centerline is constructed by interpolating the midpoint of the long side of the polygon in the polygon annotation information. The dilated buffer area is generated by expanding outward at a set distance based on the direction of the centerline and the vertex normal.

4. The method according to claim 2, characterized in that, The multiple enhancement operations include, but are not limited to: horizontal flipping and brightness contrast, affine shearing transformation and brightness contrast, 90-degree clockwise or counterclockwise rotation, rotation, scaling, translation, and various blurring and grayscale processing.

5. A method as described in claim 1, characterized in that, The confidence comparison and fusion of the segmentation results across the three dimensions to form the fused segmentation result includes: For each segmentation result, compare the confidence of the segmentation results across the three dimensions, and retain the segmentation result with the highest confidence as the high-confidence target segmentation result; For different segmentation results, the segmentation results are merged with the retained high-confidence target segmentation results to form a fused segmentation result.

6. A method according to claim 5, characterized in that, The process of reconstructing a real mask in the original image space based on the fused polygon coordinates, and performing a morphological dilation operation in conjunction with the fused segmentation mask, includes: Obtain the coordinates of the fused polygon, map the fused polygon coordinates to the original image space, and reconstruct the mask in the original image space using the mapped polygon coordinates to generate a preliminary segmentation mask. Define the dilation core, apply morphological dilation operation to the reconstructed mask, and obtain the morphologically processed mask; The morphologically processed mask was compared with the fused segmentation mask to verify the accuracy and integrity of the mask.

7. The method according to claim 1, characterized in that, The categories in the three-category segmentation labels include background, text, and buffer.

8. A device for segmenting agricultural input packaging labels based on YOLO11-seg and morphological mask reconstruction, characterized in that, include: The data acquisition unit is used to acquire original image samples of agricultural product packaging and polygon annotation information of labels; The data processing unit is used to perform clockwise and counterclockwise 90-degree processing on the original image samples to obtain a three-dimensional image, and generate three-category segmentation labels based on the label polygon annotation information. The segmentation inference unit is used to input a three-dimensional image and three-category segmentation labels into a trained YOLO-seg model for segmentation inference, and to obtain a three-dimensional segmentation result; the segmentation result includes a segmentation mask and polygon coordinates; The fusion unit is used to compare and fuse the segmentation results of the three dimensions with confidence, and form a fused segmentation result; The mask reconstruction unit is used to reconstruct the real mask in the original image space based on the fused polygon coordinates, and to perform morphological dilation operation in combination with the fused segmented mask. The image segmentation unit is used to crop the label region from the original image based on the reconstructed mask, and obtain the cropping result and the label segmentation map.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method for segmenting agricultural material packaging labels based on YOLO11-seg and morphological mask reconstruction as described in any one of claims 1-7.

10. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; When executing a program stored in memory, the processor implements the steps of the method for segmenting agricultural material packaging labels based on YOLO11-seg and morphological mask reconstruction as described in any one of claims 1-7.