Embroidery pattern optimization design method and system based on machine learning model
By constructing an embroidery pattern optimization design system based on machine learning models, the problem of lack of quantitative basis in traditional design is solved. It realizes the orderly association between pattern structure and style, improves design accuracy and efficiency, and supports intelligent pattern generation and style classification.
Patent Information
- Application Number
- CN202511510878.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-01-16
AI Technical Summary
Traditional embroidery pattern optimization design relies on the designer's subjective judgment and lacks quantitative basis. It is difficult to achieve standardized expression of pattern composition and pattern structure, resulting in blurred outline details, misidentification of direction, difficulty in achieving style consistency recognition and structure reuse, and lack of automated matching and structural labeling capabilities, which limits the data accumulation of pattern generation and the efficiency of subsequent training and modeling.
By employing a machine learning model-based approach, the grayscale structure of the original embroidery pattern image is obtained, edge pixels are extracted and a direction sequence is constructed, a composition direction node map is generated, a two-dimensional coordinate grid is established, node distribution is recorded, and the nodes are connected to form a skeleton path. Edge symmetric projection windows are constructed for pairing, structural annotation blocks are extracted, and color connected domains are encoded to generate pattern structure label groups, thereby achieving an ordered association between pattern structure and style.
It improves the accuracy and efficiency of pattern design, realizes the controllability of pattern structure and style, has the ability to adjust structure and track style, significantly improves the intelligence level of composition processing and style classification, and the pattern data is trainable, supporting the classification and labeling of style and the generation of samples.
Smart Images

Figure CN121353235A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of pattern design intelligent optimization, in particular to a cross-stitch pattern optimization design method and system based on a machine learning model. BACKGROUND
[0002] The technical field of pattern design intelligent optimization mainly involves related methods and tools for recognizing and analyzing visual patterns and optimizing their structures through computational intelligence means. The core tasks include image recognition, feature extraction, pattern generation, style transfer, optimization design, and automation processing, and are widely used in scenes such as clothing design, art and craft, cross-stitch manufacturing, and product packaging. This technical field emphasizes the combination of machine learning models and traditional pattern design processes to improve design efficiency and pattern quality through data-driven methods, promoting the intelligentization and automation of the design process, especially in pattern composition rule mining, pattern style reconstruction, and personalized pattern generation. Among them, the traditional cross-stitch pattern optimization design method refers to the manual optimization of design elements such as modeling, composition, line direction, and color matching of cross-stitch patterns in the development process of cross-stitch crafts. The technical matter targeted is how to extract composition rules and optimize pattern structures in diversified cross-stitch patterns to meet the design needs of personalization and mass production. Traditional cross-stitch pattern optimization design is completed through experience-based manual drawing, relying on designers to modify or use the layer combination function of graphic design software to adjust the pattern based on traditional pattern samples and style. This process mainly relies on designers to outline, adjust details, and combine patterns based on existing pattern templates.
[0003] The existing technology relies on designers' subjective judgment for pattern outlining and layer splicing operations, lacks quantitative basis in pattern composition and pattern structure recognition, and is difficult to establish standardized expression for edge trends and pattern composition. In the face of complex patterns, it is easy to have problems such as fuzzy outline details and incorrect trend recognition. In the development of batch cross-stitch patterns, it is difficult to quickly achieve consistent style recognition and pattern structure reuse. In patterns with continuous repeating elements, manual recognition based on experience often leads to structure misjudgment and style deviation. Traditional methods lack automatic pairing and structure label annotation capabilities, limiting the accumulation of pattern generation data and the efficiency of subsequent training modeling. SUMMARY
[0004] To solve the technical problems existing in the prior art, the embodiments of the present application provide a cross-stitch pattern optimization design method based on a machine learning model, which includes the following steps: To achieve the above-mentioned purpose, the present application adopts the following technical scheme: a cross-stitch pattern optimization design method based on a machine learning model, comprising the following steps: S1: Obtain the grayscale structure of the original embroidery pattern image, extract edge pixels to form an edge pixel set, establish a set of direction vectors within a nine-square grid around the pixel, construct a direction sequence based on the angle between adjacent direction vectors, and generate a composition direction node map. S2: Based on the spatial distribution of nodes in the pattern area in the node map of the composition direction, establish a two-dimensional coordinate grid and record the concentrated sections of nodes in the horizontal and vertical directions. Take the intersection points where there are densely distributed nodes in both the horizontal and vertical directions as path candidate points and generate a skeleton path vector set. S3: Call the pattern area corresponding to the continuous path segment in the skeleton path vector set, construct edge-symmetric projection windows on both sides of the path segment extension direction, extract the edge point set in the window in sequence, perform pairing screening on the projection results of the edge points in the path direction, and generate pattern structure annotation blocks; S4: Use the pattern structure to mark the position boundary of the structure label area in the block, extract the color connected domain layer, establish the connected domain direction axis, bind the structure label with the color axis sequential encoding structure, and generate the pattern style structure label group.
[0005] As a further embodiment of the present invention, the composition direction node map includes edge continuity segments, direction angle sequence, direction vector nodes, and map space coordinates; the skeleton path vector set includes path candidate intersections, path segment combinations, direction connection relationships, and path geometric features; the pattern structure annotation block includes closed contour boundaries, symmetrical node sets, path segment projection windows, and structure annotation areas; and the pattern style structure label group includes structure label index, color axis sequence encoding, edge morphology sequence code, and pattern registration relationship.
[0006] As a further aspect of the present invention, the specific steps of S1 are as follows: S101: Obtain the original embroidery pattern image, perform brightness detection on the pixels in the image, call the brightness difference between the pixel and the surrounding pixels, identify the position of the pixel with a prominent brightness difference change, and remove the pixels with similar brightness change ranges according to the brightness change ratio between the pixel and the surrounding pixels, and generate the edge pixel distribution value. S102: Call the pixel position in the edge pixel distribution value, identify the position change trend of adjacent pixels in eight directions, calculate the displacement direction value between the real-time pixel and the surrounding multiple points, and obtain the angle value between each two adjacent direction values to generate the edge direction change sequence value. S103: Based on the change of the direction angle sequence in the edge direction change sequence value, extract the direction trend segments that are continuously increasing or continuously decreasing, locate the edge pixel point position combination corresponding to the trend segment, identify the degree of direction switching between adjacent trend segments, and group the trend segments with stable change degree to generate a continuous direction segment group. S104: Call the pixel position points of each group of segments in the continuous directional segment group, connect them according to the arrangement direction, and summarize the combination of the direction switching degree of the beginning and end of the connected segments and the position of the associated edge points. Calculate the arrangement order and number of intersections between the connected paths to generate a composition direction node map.
[0007] As a further aspect of the present invention, the specific steps of S2 are as follows: S201: Based on the image coordinate values of the directional nodes in the composition directional node map, construct a two-dimensional coordinate grid with the horizontal and vertical axes having a unit pixel interval. Record the distribution of the number of directional nodes in each row and each column in the grid structure. Extract the concentrated segment range based on the position range where the statistical value of the number of nodes in each row and each column is greater than the node distribution density benchmark value, and obtain the node concentrated segment position pairs in the horizontal and vertical directions. S202: Based on the intersection coordinates of the nodes in the horizontal and vertical directions, extract the real-time position of the intersection point in the image coordinate system, and determine whether the direction node corresponding to the intersection point is within the boundary of the pattern area. Mark the intersection point coordinates that meet the boundary constraint conditions as path candidate points, and record the corresponding node index to obtain the set of path candidate points within the pattern area. S203: Using the coordinate distance and the angle between any two points in the path candidate point set within the pattern area, calculate whether there is an unobstructed pixel path in the pattern area, and record the connection path index between the two points when there is a connection relationship, filter out point pairs that cannot meet the connection requirements, and obtain the geometric connection relationship index set between path candidate points; S204: Based on the geometric connectivity index set between the candidate path points, construct the path according to the priority order of the starting point in the drawing area, gradually call adjacent connectable points to construct continuous line segments, complete the candidate point traversal, and obtain the skeleton path vector set.
[0008] As a further aspect of the present invention, the node distribution density benchmark value is the average node density value calculated based on the total number of pixels in the image and the total number of directional nodes, and is set to 1.2 times the average node density value; In the process of obtaining the node cluster segment position pairs in the horizontal and vertical directions, the range of consecutive pixel rows or pixel columns whose statistical value of the number of nodes in each row and column exceeds the node distribution density benchmark value must be greater than five unit pixels. The statistics are performed independently in the horizontal and vertical directions, and the horizontal and vertical ranges that form continuous segments are extracted to constitute the node cluster segment position pairs in the horizontal and vertical directions. In the process of determining whether the direction node corresponding to the intersection point is within the boundary of the pattern area, the boundary of the pattern area is defined as the range of the inner boundary after removing ten units of edge extension. Only when the intersection point is within the range of the inner boundary is the corresponding image coordinate marked as a path candidate point and the corresponding direction node index is recorded.
[0009] As a further aspect of the present invention, the specific steps of S3 are as follows: S301: Call the pattern image area corresponding to each continuous path segment in the skeleton path vector set, construct the normal vector direction according to the extension direction of the path segment, generate rectangular edge symmetrical projection windows at equal intervals along the normal vector direction on both sides of the path segment, scan the grayscale pixel value changes line by line and extract the pixel positions where the edge gradient change is greater than the edge extraction threshold, and obtain the set of edge points on both sides of the path. S302: Based on the coordinate positions of each group of left and right edge points in the set of edge points on both sides of the path, calculate the projection distance value in the main direction of the path segment, and compare the projection distance difference between multiple groups of edge points in the same path segment. When the projection distance difference is within the path direction coincidence threshold range and the contour pixel direction sequence of the structure to which the corresponding edge point belongs is consistent, record the edge point as a symmetrical pairing node and obtain the symmetrical node pairing set. S303: Using the coordinate positions of each group of nodes in the pattern image in the symmetrical node pairing set, connect the edge nodes in the same symmetrical pairing to construct a closed path outline, fill the closed structure boundary according to the pixel distribution in the closed path, and integrate the closed area into a layer block according to the path segment index number to obtain the pattern structure annotation block.
[0010] As a further aspect of the present invention, the specific steps of S4 are as follows: S401: Call the boundary coordinates of the structural label area in the pattern structure annotation block to limit the range of layers to be extracted in the pattern image, detect the color value difference of adjacent pixels and gather adjacent areas according to the color similarity threshold, identify color continuous areas and mark them as independent connected domain areas, fit the main direction line according to the pixel centroid coordinates and edge extension trend in the independent connected domain areas, record the main direction line as the direction axis, and obtain the color connected domain direction axis set; S402: According to the extension order of the direction axis of the color connected domain direction axis, traverse the pattern edge pixels within the coverage of the direction axis in sequence, extract the start and end position coordinates of each edge shape structure on the direction axis, and establish continuous encoding values according to the coordinate order to form a sorted index sequence of the pattern shape. Bind the sorted index sequence to the corresponding structure label area to obtain the pattern style structure label group.
[0011] As a further aspect of the present invention, the method further includes step S5: S5: Based on the color axis sequence encoding structure of the pattern style structure label group, extract the repeated paragraphs and arrangement patterns between the encoding sequences, compare the same type of paragraphs of the pattern components, determine whether there are consistent component paragraphs under the same structure label, and if so, classify them into the unified style type category to generate a style training sample label set. The style training sample label set includes style classification labels, arrangement pattern fragments, similar component sequences, and repeating paragraph structures.
[0012] As a further aspect of the present invention, the specific steps of S5 are as follows: S501: Call the color axis sequence encoding sequence bound under the structure label in the pattern style structure label group, detect the position change between adjacent encoding values in each encoding sequence, extract the repeated encoding segments in the sequence, record the position interval of the segments with repeated start and end indexes, and group the same type of segments according to the number of repetitions to obtain the set of repeated segments in the encoding sequence. S502: Based on the set of repeated segments in the encoded sequence, search for the encoded combination that is completely consistent with the arrangement order under the same structural label for each segment, compare the starting position of the directional axis and the angle value of the arrangement direction in the corresponding structural label, determine whether the directional arrangement is consistent, classify the segments with consistent arrangement into the same component segment type, and obtain the set of consistent component segments in the structural label. S503: Using the tag number and sequence content of the component segments in the consistent component segment set within the structure tag, uniformly mark them as the same style category, record the tag index and style code as the classification key value structure, and combine the classified component segments to form training data entries, group them according to their style category and store them in the sample set to obtain the style training sample tag set.
[0013] An embroidery pattern optimization design system based on a machine learning model includes: The edge extraction module acquires the original embroidery pattern image, collects the grayscale change rate parameters of the pixels, calls the pixels to form an edge pixel set, establishes a direction vector set based on the two-dimensional coordinate relationship of the edge pixel set, judges the angular trend of adjacent direction vectors, and generates a composition direction node map. The path construction module calls the distribution coordinates of nodes in the pattern area in the node map of the composition direction, establishes a two-dimensional coordinate grid of the pattern, records the concentrated sections of nodes in the direction, selects the intersection coordinates of nodes that show concentrated distribution in both the horizontal and vertical directions as path candidate points, and generates a continuous skeleton path vector set. The structural annotation module calls the coordinates of the path segment region in the continuous skeleton path vector set, obtains the distribution range of the two edge pixels on both sides in the path extension direction, extracts the corresponding projection value in the edge pixel distribution region, determines whether any pair of symmetrical points can be projected and overlapped in the path direction and meet the corresponding morphological conditions of the edge structure, selects the point pairs that meet the conditions as paired nodes, and obtains the pattern structure annotation block. The layer partitioning module calls the region position boundary in the pattern structure annotation block, collects the continuous region of the color channel inside the layer, divides the range of the color connected domain, obtains the diagonal spatial distribution direction of the region corresponding to the color connected domain, and obtains the pattern style structure label group. The style recognition module calls the edge path corresponding to the direction axis of the pattern style structure label group, extracts the sequential point column of the edge path in the direction of the direction axis extension, establishes a continuous number index, determines whether there are repeated paragraphs in the index sequence and meets the arrangement consistency condition, and obtains the style training sample label set.
[0014] Compared with the prior art, the advantages and positive effects of the present invention are as follows: In this invention, a composition node map is constructed by the directional continuity of edge pixels. The density of node spatial distribution is used to locate candidate intersection points of paths and connect them into skeleton path segments. The closed region of the edge structure is extracted by the symmetrical projection relationship of the path. A mapping code between color axis and pattern shape is established within the continuous structure to realize the orderly association between pattern structure and style. The repeated recognition between coding sequences enables similar components to have a unified classification basis. Combined with the cross-analysis of composition rules and pattern arrangement, the accuracy and efficiency of structure generation in pattern design are improved. The pattern data has trainability after being encoded and associated, realizing the classification and labeling of style and sample generation. This enables the pattern design process to have the ability of controllable structure, adjustable style, and traceable features, significantly improving the intelligence level of composition processing and style induction. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a schematic diagram of the steps of the present invention; Figure 2 This is a detailed schematic diagram of S1 of the present invention; Figure 3 This is a detailed schematic diagram of S2 of the present invention; Figure 4 This is a detailed schematic diagram of S3 of the present invention; Figure 5 This is a detailed schematic diagram of S4 of the present invention; Figure 6 This is a detailed schematic diagram of S5 of the present invention; Figure 7 This is a system module diagram of the present invention. Detailed Implementation
[0017] The technical solution of the present invention will now be described with reference to the accompanying drawings.
[0018] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.
[0019] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning.
[0020] In this embodiment of the invention, sometimes a subscript such as W1 may be written in a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.
[0021] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0022] Please see Figure 1 This invention provides a method for optimizing embroidery patterns based on a machine learning model, comprising the following steps: S1: Obtain the grayscale structure of the original embroidery pattern image, extract edge pixels to form an edge pixel set, establish a set of direction vectors within a nine-grid range around the pixel, construct a direction sequence based on the angle between adjacent direction vectors, associate the direction continuity in the direction sequence constructed by the angle with the edge pixel position, divide continuous direction segments according to the continuity trend, and generate a composition direction node map. S2: Based on the spatial distribution of nodes in the drawing area in the node map of the composition direction, establish a two-dimensional coordinate grid and record the concentrated sections of nodes in the horizontal and vertical directions. Take the intersection points where there are densely distributed nodes in both the horizontal and vertical directions as path candidate points. According to the geometric connectivity between the path candidate points, automatically connect them into a set of continuous path segments according to the drawing layout structure to generate a skeleton path vector set. S3: Call the pattern area corresponding to the continuous path segment in the skeleton path vector set, construct the edge symmetry projection window on both sides of the path segment extension direction, extract the edge point set in the window in turn, and perform pair screening on the projection results of the edge points in the path direction. When any pair of points overlaps in the projection in the path direction and the edge structure outline shape is consistent, it is marked as a symmetric node pair. Draw the boundary of the closed area according to the symmetry relationship of the paired nodes and generate the pattern structure annotation block. S4: Use the pattern structure to mark the position boundary of the structure label area in the block, extract the color connected domain layer, and establish the connected domain direction axis. Call the pattern edge shape corresponding to the connected domain direction axis, establish the coding index sequence for the arrangement order of the pattern edge shape on the direction axis, bind the structure label with the color axis sequence coding structure, and generate the pattern style structure label group. S5: Encode the structure according to the color axis order of the pattern style structure label group, extract the repeated paragraphs and arrangement patterns between the coding sequences, compare the same paragraphs of the pattern components, determine whether there are consistent component paragraphs under the same structure label, if so, classify them into the unified style type category, and generate a style training sample label set. The composition direction node map includes edge continuity segments, direction angle sequences, direction vector nodes, and map space coordinates. The skeleton path vector set includes path candidate intersections, path segment combinations, direction connection relationships, and path geometric features. The pattern structure annotation blocks include closed contour boundaries, symmetrical node sets, path segment projection windows, and structural annotation areas. The pattern style structure label group includes structural label indexes, color axis sequence codes, edge morphology sequence codes, and pattern registration relationships. The style training sample label set includes style classification labels, arrangement pattern segments, similar component sequences, and repeating paragraph structures.
[0023] Please see Figure 2 The specific steps of S1 are as follows: S101: Obtain the original embroidery pattern image, perform brightness detection on the pixels in the image, call the brightness difference between the pixel and the surrounding pixels, identify the position of the pixel with a prominent brightness difference change, and remove the pixels with similar brightness change ranges according to the brightness change ratio between the pixel and the surrounding pixels, and generate the edge pixel distribution value. The acquisition of the original embroidery pattern image can be accomplished using high-precision industrial scanning equipment. This equipment can perform optical imaging on the fabric surface and convert it into a digital image file. After obtaining the digital image, it is first processed to convert the color image into a grayscale image, eliminating color interference and retaining only the brightness information as the basis for analysis. The image is divided into a matrix structure composed of multiple pixels, with each pixel representing the grayscale brightness of the corresponding position in the image. For each pixel, the adjacent pixels in the top, bottom, left, right, and four diagonal directions are acquired. The brightness value difference between the center pixel and its adjacent pixels is compared, and points with significant brightness changes are selected in the global image, i.e., pixels with significant differences from their adjacent pixels. For each candidate pixel, the brightness change range is compared with the surrounding pixels, and pixels with relatively uniform brightness difference distribution and inconspicuous changes are eliminated. If the pattern contains a gold border line, the edge pixels will show a large difference in brightness from the background in the grayscale image, thus standing out in the contrast. Pixels with significant brightness abrupt changes constitute the edge pixel distribution in the image, used to represent the structural outline in the pattern, and generate edge pixel distribution values.
[0024] S102: Call the pixel position in the edge pixel distribution value, identify the position change trend of adjacent pixels in eight directions, calculate the displacement direction value between the real-time pixel and the surrounding multiple points, and obtain the angle value between each two adjacent direction values to generate the edge direction change sequence value. For each pixel, adjacent pixel relationship analysis is performed, that is, the first-order neighboring pixels are explored in eight directions to extract the pixel distribution pattern in each direction. By comparing the offset trend of the center pixel with the pixels in each direction in spatial position, it can be determined whether the point is in the continuous direction of the outline. By analyzing the arrangement change of pixels in each direction in the image plane, it can be determined whether the edge shows regular turning. Set at the outline of the fabric pattern, the edge pixels extend along a certain direction. The distribution of adjacent pixels in this direction has obvious consistency. By observing the relative position change of pixels in every two directions, the specific distribution of feature positions such as corners and turns can be analyzed to determine whether the pattern edge has a curved or sharp corner structure. Taking the embroidered petal pattern as an example, the edge pixels are distributed along the petal outline and show obvious directional offset at the edge abrupt change. The change of directional offset value can be obtained one by one by the arrangement direction of the surrounding pixels, identifying the continuity and turning of the edge trend and generating edge direction change sequence values.
[0025] S103: Based on the changes in the direction angle sequence in the edge direction change sequence value, extract continuously increasing or continuously decreasing direction trend segments, locate the edge pixel position combination corresponding to the trend segment, identify the degree of direction switching between adjacent trend segments, and group the trend segments with stable change degree to generate continuous direction segment groups. Analyzing the trends of directional and angular changes, by sorting and segmenting the angle sequence, trend segments with obvious continuous change characteristics are extracted. Trend segments are parts with continuously increasing or decreasing directions, used to describe the continuous direction of edge movement. By setting recognition rules, at least three consecutive increases in direction are defined as a growth trend, which can avoid misjudgment caused by occasional pixel disturbances. When there is an obvious directional jump between adjacent trend segments, one segment extends along the diagonal while another segment suddenly extends downwards. This can be used to divide them into different trend segments and identify the turning changes between them. If some trend segments do not change much, and belong to the case of consistent direction or only minor adjustment, the segments are grouped into the same group of segments, indicating that they belong to the same contour structure. In an embroidery pattern composed of multiple leaves, the directional changes of the edges of different leaves will show a specific continuity, while the directional differences of the edges of the same leaf are small, so they are effectively grouped to generate a group of continuous direction segments.
[0026] S104: Call the pixel position points of each group of segments in the continuous path segment group, connect them according to the arrangement direction, and summarize the combination of the direction switching degree of the beginning and end of the connected segments and the position of the associated edge points. Calculate the arrangement order and number of intersections between the connected paths to generate a composition direction node map. Each group contains several edge pixels and their arrangement direction. Connection operations are performed based on the arrangement of the segments, following the spatial order of pixel positions. The starting and ending points of each segment are linked point by point to form a continuous edge path chain. During the process, the degree of directional change between each connection segment is recorded, and the changes are combined with the node position information. When there are relatively straight sections on the outline edge of a pattern, the directional changes between connected segments are small, indicating they are continuous segments in the same direction. When the direction of a connected segment changes abruptly, the connection point is recorded as a turning point. This connection and statistical process is repeated throughout the entire pattern, gradually drawing the connection path and intersection positions of each edge segment. The number of intersections and the coordinates of the intersection points are counted to construct a complete directional node map. Taking a complex embroidery border as an example, the edges contain repeating patterns or symmetrical structures, so multiple paths intersect at specific points, forming the core nodes of the pattern composition. This can be used to analyze the overall structure and arrangement order of the pattern and generate a compositional directional node map.
[0027] Please see Figure 3 The specific steps of S2 are as follows: S201: Based on the image coordinate values of the directional nodes in the composition directional node map, construct a two-dimensional coordinate grid with the horizontal and vertical axes having a unit pixel interval. Record the distribution of the number of directional nodes in each row and each column in the grid structure. Extract the concentrated segment range based on the position range where the statistical value of the number of nodes in each row and each column is greater than the node distribution density benchmark value, and obtain the node concentrated segment position pairs in the horizontal and vertical directions. Each node has a defined image coordinate value. Therefore, a two-dimensional grid with unit pixel coordinates can be constructed within the pixel space of the image, dividing the image into multiple equally spaced grid intervals in the horizontal and vertical directions. This ensures that each pixel can be accurately classified into a specific grid cell. Within this grid structure, the number of directional nodes in each row is counted from left to right, and the distribution of directional nodes in each column is counted from top to bottom, forming a two-dimensional node density statistical matrix. To identify areas with highly concentrated directional nodes, a node density benchmark value needs to be set. The node statistics of each row and column are compared. If the number of nodes in a row or column exceeds the benchmark value, the row or column is considered a concentrated segment. After identifying the horizontal and vertical concentrated segments, several segment position pairs are combined using horizontal and vertical intersecting coordinates. These pairs are then set within an embroidery pattern. If the number of directional nodes in a row is much higher than the average, it indicates the presence of a significant pattern boundary direction within that row. The intersection point of the high-density columns perpendicular to it is used to obtain the horizontal and vertical node concentrated segment position pairs.
[0028] S202: Based on the intersection coordinates of the nodes in the horizontal and vertical directions, extract the real-time position of the intersection point in the image coordinate system, determine whether the direction node corresponding to the intersection point is within the boundary of the pattern area, mark the intersection point coordinates that meet the boundary constraints as path candidate points, and record the corresponding node index to obtain the set of path candidate points within the pattern area. By combining the coordinates of the horizontal and vertical concentrated sections, a series of intersection points can be obtained. These intersection points represent key coordinate positions in the pattern image. Each intersection point is detected one by one to determine its specific pixel position in the image coordinate system and whether the pixel is within the boundary range of the embroidery pattern. The determination of the pattern boundary generally depends on the previously extracted edge pixel information and the pattern outline range. If an intersection point falls within this boundary, it is marked as a candidate point for a usable path. Each candidate point that meets the conditions needs to be indexed and registered, recording its corresponding direction node number or position number to ensure that the source of the point in the pattern can be traced later. When there are batches of embroidery edge nodes around a pattern, the intersection points obtained by the intersection of the horizontal and vertical concentrated sections fall in the central area of the pattern petals. If all points are inside the pattern and do not fall in the background area, they can be effectively marked as nodes for path connection, thus obtaining a set of candidate points for the path within the pattern area.
[0029] S203: Using the coordinate distance and the angle between any two points in the path candidate point set within the pattern area, calculate whether there is an unobstructed pixel path in the pattern area, and record the connection path index between the two points when there is a connectivity relationship. Filter out point pairs that cannot meet the connectivity requirements and obtain the geometric connectivity relationship index set between path candidate points. Arbitrarily select two points and perform line analysis to observe whether there is an unobstructed pixel path between them. This process requires checking each pixel connection line to see if it crosses the pattern boundary or is obstructed by non-edge areas. This can be done by simulating straight line connections and checking at the pixel level whether every pixel the connection line passes through is located inside the pattern and is not interfered with by pixels outside the boundary. If the path is completely within the allowed area of the pattern, then a valid geometric connection relationship exists between the two points. For each pair of points that meets the requirements, the start and end point indices of the connection path and the corresponding path number must be recorded. During the process, point pairs that cross the pattern boundary or are obstructed are eliminated to avoid incorrect path connections or the generation of path segments outside the pattern area. In an embroidery pattern with a hollow petal structure, if two candidate points are located at the edge of the petal and the middle is a hollow area, then even though the two points are close in coordinates, they must be excluded because they are obstructed. By screening the connectivity of point pairs one by one, the set of geometric connectivity relationship indices between the candidate points of the path is obtained.
[0030] S204: Based on the geometric connectivity index set between candidate path points, construct the path according to the priority order of the starting point in the drawing area, gradually call adjacent connectable points to construct continuous line segments, complete the candidate point traversal, and obtain the skeleton path vector set; Starting from a preset starting point in the pattern area, adjacent path candidate points connected to it are called one by one according to connection priority to extend into continuous line segment paths. The connection order is sorted according to the spatial layout and the arrangement order of candidate points in the pattern to ensure smooth path extension. In each construction process, the next connectable point is searched from the currently connected point. If there are multiple candidate path directions, the path with the least change from the previous path direction is selected as the priority connection object. The complete path is constructed iteratively according to this rule. During path construction, traversed points are marked to avoid repeated connections and backtracking, thereby improving construction efficiency. After traversing all path candidate points, multiple independent line segment path sets are formed. Each path represents a trajectory in the pattern. The path set is recorded in vector form, which is the skeleton path vector set. In a symmetrical embroidery pattern, multiple similar paths are generated on the left and right sides respectively. The skeleton path of each part of the structure can be extracted one by one to obtain the skeleton path vector set.
[0031] Please see Figure 4 The specific steps of S3 are as follows: S301: Call the pattern image area corresponding to each continuous path segment in the skeleton path vector set, construct the normal vector direction according to the extension direction of the path segment, generate rectangular edge symmetrical projection windows at equal intervals along the normal vector direction on both sides of the path segment, scan the grayscale pixel value changes line by line and extract the pixel positions where the edge gradient change is greater than the edge extraction threshold, and obtain the set of edge points on both sides of the path. The skeleton path vector set contains several path segments composed of multiple consecutive pixels. Each path segment can be located in a specific area within the image. For each path segment, the extension direction in the image coordinate system is analyzed, and a normal vector is constructed in the direction perpendicular to the path, serving as a reference line for the left and right sides of the path. Guided by the normal vector, symmetrical rectangular projection windows are generated at fixed pixel distances to both sides of the path, ensuring that the window length covers the entire path segment. The width is set to a fixed value based on the complexity of the image and the density of the path distribution. Within each rectangular window, the pixel grayscale values of each row are scanned from the center of the path outwards, and the pixels with the most drastic grayscale changes in each row are recorded sequentially. When the pixel grayscale difference of a row exceeds the set edge extraction threshold, the position of the most prominent pixel in that row is marked as an edge pixel, and it is assigned to the edge point set on the left or right side of the path segment based on its location. In an embroidered leaf vein pattern, the skeleton path extends along the direction of the leaf vein. The edges on the left and right sides will form abrupt changes in brightness due to significant color changes. Grayscale scanning can accurately capture the boundary pixels on both sides of the leaf vein, obtaining the edge point set pairs on both sides of the path.
[0032] S302: Based on the coordinate positions of each group of left and right edge points in the set of edge points on both sides of the path, calculate the projection distance value in the main direction of the path segment, and compare the projection distance difference between multiple groups of edge points in the same path segment. When the projection distance difference is within the path direction coincidence threshold and the contour pixel direction sequence of the structure to which the corresponding edge point belongs is consistent, record the edge point as a symmetrical pairing node and obtain the symmetrical node pairing set. Several pairs of left and right edge points are formed under each path segment. For each pair of edge points, the projection position needs to be calculated on the main direction of the path segment to obtain the alignment degree of the left and right edge points in the path direction. By comparing the differences in the projection positions of multiple edge point groups under the same path segment, it is possible to identify whether there are edge point pairs with consistent positions. If the difference in the projection distance between multiple sets of edge points is not large, it indicates that they are structurally symmetrical boundary points. To verify the symmetry, it is also necessary to check the directional change of the contour to which the corresponding edge point belongs. By tracing back the directional sequence of the contour to which the edge point belongs, it is compared whether the directional trends of the two points are consistent. If the directional change of the contour line remains continuous and parallel to each other, it is considered that the set of edge points has structural symmetry characteristics. In pattern analysis, when analyzing the internal direction of a petal structure, the left and right edge points extend outward along the petal contour in the contour direction and maintain balance in shape. They are judged as symmetrical paired nodes. The node pairs that meet the conditions are recorded in sequence to obtain the symmetrical node pairing set.
[0033] S303: Using the coordinates of each group of nodes in the pattern image, connect the edge nodes in the same symmetrical pair to construct a closed path outline, fill the closed structure boundary according to the pixel distribution in the closed path, and integrate the closed area into a layer block according to the path segment index number to obtain the pattern structure annotation block; For each set of symmetrical nodes in the image, line segment connection operations are performed. The connection path extends directly from the left edge point to the corresponding right edge point. After the node pairing and connection are completed, several horizontal closed line segments are formed. Using the original path segment as the central axis, the horizontal lines are gradually connected to construct complete closed contour structures in the image. After the contour closure is completed, the pixels inside each closed area need to be filled. The pixels in the area are traversed and marked as structural areas according to the logic of inside and outside the contour. The original number of the path segment in the skeleton vector set is used as the index to establish a correspondence with the current closed area. Each closed area is abstracted as an independent layer or block unit in the pattern. In a floral embroidery pattern, the leaf edge and the leaf vein path form multiple closed structures. By relying on the edge node pairing, each leaf structure can be accurately closed to obtain the pattern structure annotation block.
[0034] Please see Figure 5 The specific steps of S4 are as follows: S401: Call the boundary coordinates of the structural label area in the pattern structure annotation block, limit the range of layers to be extracted in the pattern image, detect the difference in color values of adjacent pixels and gather adjacent areas according to the color similarity threshold, identify color continuous areas and mark them as independent connected regions, fit the main direction line according to the pixel centroid coordinates and edge extension trend in the independent connected regions, record the main direction line as the direction axis, and obtain the color connected region direction axis set; Each tile corresponds to a specific structural label region, and each region contains a clear boundary coordinate range. Using the boundary information, the layer area to be processed is defined in the original image. Irrelevant image content is removed from the processing range, and only pixel regions with specific structures are retained for subsequent recognition. For each pixel in the retained region, the color difference is compared with the adjacent pixels in the top, bottom, left, right and diagonal directions. The numerical difference in the color channel is used as the judgment standard. By continuously aggregating neighboring pixels with small color differences, they are classified into the same color region. This ensures that pixels with color differences within a set threshold are classified into a unified connected region. Each type of connected region is numbered with an independent label, forming multiple color connected domains. Within each color connected domain, the distribution position of pixels is counted, the centroid coordinates of the region are obtained, and the extension direction of the region's edge is analyzed. Based on the overall trend of the pixels, a directional straight line is fitted as the main axis of the region. Taking an embroidered flower stamen as an example, the yellow pixels are continuous, the centroid is roughly located at the center of the flower stamen, and the edges are distributed around it. After analyzing the trend, a main axis direction line radiating outward from the flower stamen can be obtained, thus obtaining the set of color connected domain direction axes.
[0035] S402: Based on the extension order of the direction axis of the color connected domain, traverse the pattern edge pixels within the coverage of the direction axis in sequence, extract the start and end position coordinates of each edge shape structure on the direction axis, and establish continuous encoding values according to the coordinate order to form a sorted index sequence of the pattern shape. Bind the sorted index sequence to the corresponding structure label area to obtain the pattern style structure label group. It is necessary to process each directional axis in the pattern one by one according to the order of its extension. Within the coverage of each axis, locate the edge pixels that it crosses, especially the pixel boundaries of the outer contour of the pattern. By observing the distribution of edge pixels on the axis, record the starting and ending coordinates of each edge shape in the direction of the axis. Number each edge structure according to its position on the line and generate continuous code values to describe the arrangement order of each edge on the linear coordinate axis. This not only preserves the spatial information of the pattern structure but also provides a basis for pattern sorting. By binding the code sequence on each directional axis to its corresponding structure label area, the corresponding annotation of the pattern style structure and layer block is realized. When processing an embroidered feather pattern, the texture lines of each feather are arranged in a regular pattern, with the axis extending from the feather shaft to the edge. The corresponding texture line edges can be sorted and coded according to the starting and ending order of the intersecting axes and included in the feather block structure label to obtain the pattern style structure label group.
[0036] Please see Figure 6 The specific steps of S5 are as follows: S501: Call the color axis sequence encoding sequence bound under the structure label in the pattern style structure label group, detect the position change between adjacent encoding values in each encoding sequence, extract the repeated encoding segments in the sequence, record the position range of segments with repeated start and end indexes, and group similar segments according to the number of repetitions to obtain the set of repeated segments in the encoding sequence. After extracting the color axis sequence encoding sequence bound to the structural label, each encoding sequence is analyzed segment by segment. The order of the encoding values is traversed, the change between adjacent encoding values is detected, and the encoding pattern that appears repeatedly in position is identified. The encoding segments are compared by continuously sliding windows, and subsequences that appear twice or more are extracted and their start and end indices in the complete encoding sequence are recorded. The repeated subsequences are summarized and clustered according to the number of times the same subsequence appears in the same encoding sequence. Segments with the same number of occurrences and consistent structural forms are grouped into the same group. It is important to exclude sequences that are only single-point repetitions and have no structural significance. Only repeated segments with a length greater than a certain number of pixels are retained. Taking the leaf veins in the embroidery pattern as an example, if multiple leaf vein patterns repeatedly appear in the same start and end encoding segments in the axis encoding and have regular repetition, it indicates that the structure belongs to a local component under a unified form. The encoding segments of the repeated parts are grouped to obtain the set of repeated segments in the encoding sequence.
[0037] S502: Based on the set of repeated segments in the coding sequence, search for coding combinations that are completely consistent with the arrangement order under the same structural label for each segment, compare the starting position of the direction axis and the angle value of the arrangement direction in the corresponding structural label, determine whether the direction arrangement is consistent, classify the segments with consistent arrangement into the same component segment type, and obtain the set of consistent component segment in the structural label. The consistency of component arrangement can be analyzed for the set of repeated segments in the coded sequence. Under the same structural label, the combination that is completely consistent with the remaining repeated segments in terms of coded value arrangement is found, that is, the starting and ending coded values are the same and the intermediate order has not been changed. For each pair of segments that meet the consistency condition, the bound directional axis also needs to be extracted. The starting position and directional extension angle of the axis to which each segment is attached are compared. By observing whether each directional axis maintains the same orientation or extension trend, it is determined whether each segment belongs to a group of components with consistent direction. If the arrangement order is consistent and the directional axis shows the same direction distribution, then the component segment can be classified into the same type of repeated unit. In the embroidery pattern, a certain type of recurring petal inner pattern is set, showing similar arrangement codes and directional distribution. Such petal inner components are distributed in the same way in multiple blocks. After classification in the above way, the set of consistent component segments in the structural label is obtained.
[0038] S503: Using the label number and sequence content of the component paragraphs in the consistent arrangement of structural labels, uniformly mark them as the same style category, record the label index and style code as the classification key value structure, and combine the classified component paragraphs to form training data entries. Group them according to their style category and store them in the sample set to obtain the style training sample label set. Based on the structural label number and coding sequence of each component group, components of the same type are uniformly labeled with the same style category. The label can be generated by preset classification rules or manually defined style system, and is set to be encoded in the form of letters and numbers as style category code. Each type of component is bound to its label number to form a key-value structure of "label number + style code" to establish a classification sample database. Each component segment is uniformly organized according to its style category to form a structured data entry, which is stored in the training dataset in the form of samples. When constructing sample data, the original orientation information, axis position, coding sequence and other elements are retained, and the corresponding category label is clearly recorded in the style label field. Taking the slender leaf-shaped component that appears repeatedly in the embroidery pattern as an example, if the component shows the same coding sequence and extension direction in different blocks, it can be classified as a component under a certain style code, such as "F01". Then, the component sample is uniformly numbered and archived into the "F01" category sample group to obtain the style training sample label set.
[0039] Please see Figure 7 An embroidery pattern optimization design system based on a machine learning model includes: The edge extraction module acquires the original embroidery pattern image, collects the grayscale change rate parameters of the pixels, calls the pixels to form an edge pixel set, establishes a direction vector set based on the two-dimensional coordinate relationship of the edge pixel set, judges the angular trend of adjacent direction vectors, and generates a composition direction node map. The path construction module calls the distribution coordinates of nodes in the map area from the node map of the composition direction, establishes a two-dimensional coordinate grid of the map, records the concentrated sections of nodes in the direction, selects the intersection coordinates of nodes that show concentrated distribution in both the horizontal and vertical directions as path candidate points, and generates a continuous skeleton path vector set. The structural annotation module calls the coordinates of the path segment region in the continuous skeleton path vector set, obtains the distribution range of the two edge pixels on both sides in the path extension direction, extracts the corresponding projection value in the edge pixel distribution region, determines whether any pair of symmetrical points can be projected and overlapped in the path direction and meet the corresponding morphological conditions of the edge structure, selects the point pairs that meet the conditions as paired nodes, and obtains the pattern structure annotation block. The layer partitioning module calls the pattern structure annotation to mark the boundary of the region in the block, collects the continuous region of the color channel inside the layer, divides the range of the color connected domain, obtains the diagonal spatial distribution direction of the corresponding region of the color connected domain, and obtains the pattern style structure label group. The style recognition module calls the edge path corresponding to the direction axis of the pattern style structure label group, extracts the sequential point column of the edge path in the direction of the direction axis extension, establishes a continuous number index, and determines whether there are repeated paragraphs in the index sequence and meets the arrangement consistency condition to obtain the style training sample label set.
[0040] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for optimizing embroidery patterns based on a machine learning model, characterized in that, Includes the following steps: S1: Obtain the grayscale structure of the original embroidery pattern image, extract edge pixels to form an edge pixel set, establish a set of direction vectors within a nine-square grid around the pixel, construct a direction sequence based on the angle between adjacent direction vectors, and generate a composition direction node map. S2: Based on the spatial distribution of nodes in the pattern area in the node map of the composition direction, establish a two-dimensional coordinate grid and record the concentrated sections of nodes in the horizontal and vertical directions. Take the intersection points where there are densely distributed nodes in both the horizontal and vertical directions as path candidate points and generate a skeleton path vector set. S3: Call the pattern area corresponding to the continuous path segment in the skeleton path vector set, construct edge-symmetric projection windows on both sides of the path segment extension direction, extract the edge point set in the window in sequence, perform pairing screening on the projection results of the edge points in the path direction, and generate pattern structure annotation blocks; S4: Use the pattern structure to mark the position boundary of the structure label area in the block, extract the color connected domain layer, establish the connected domain direction axis, bind the structure label with the color axis sequential encoding structure, and generate the pattern style structure label group.
2. The embroidery pattern optimization design method based on a machine learning model according to claim 1, characterized in that, The composition direction node map includes edge continuity segments, direction angle sequence, direction vector nodes, and map space coordinates. The skeleton path vector set includes path candidate intersections, path segment combinations, direction connection relationships, and path geometric features. The pattern structure annotation block includes closed contour boundaries, symmetrical node sets, path segment projection windows, and structure annotation areas. The pattern style structure label group includes structure label index, color axis sequence code, edge morphology sequence code, and pattern registration relationship.
3. The embroidery pattern optimization design method based on a machine learning model according to claim 1, characterized in that, The specific steps of S1 are as follows: S101: Obtain the original embroidery pattern image, perform brightness detection on the pixels in the image, call the brightness difference between the pixel and the surrounding pixels, identify the position of the pixel with a prominent brightness difference change, and remove the pixels with similar brightness change ranges according to the brightness change ratio between the pixel and the surrounding pixels, and generate the edge pixel distribution value. S102: Call the pixel position in the edge pixel distribution value, identify the position change trend of adjacent pixels in eight directions, calculate the displacement direction value between the real-time pixel and the surrounding multiple points, and obtain the angle value between each two adjacent direction values to generate the edge direction change sequence value. S103: Based on the change of the direction angle sequence in the edge direction change sequence value, extract the direction trend segments that are continuously increasing or continuously decreasing, locate the edge pixel point position combination corresponding to the trend segment, identify the degree of direction switching between adjacent trend segments, and group the trend segments with stable change degree to generate a continuous direction segment group. S104: Call the pixel position points of each group of segments in the continuous directional segment group, connect them according to the arrangement direction, and summarize the combination of the direction switching degree of the beginning and end of the connected segments and the position of the associated edge points. Calculate the arrangement order and number of intersections between the connected paths to generate a composition direction node map.
4. The embroidery pattern optimization design method based on a machine learning model according to claim 3, characterized in that, The specific steps of S2 are as follows: S201: Based on the image coordinate values of the directional nodes in the composition directional node map, construct a two-dimensional coordinate grid with the horizontal and vertical axes having a unit pixel interval. Record the distribution of the number of directional nodes in each row and each column in the grid structure. Extract the concentrated segment range based on the position range where the statistical value of the number of nodes in each row and each column is greater than the node distribution density benchmark value, and obtain the node concentrated segment position pairs in the horizontal and vertical directions. S202: Based on the intersection coordinates of the nodes in the horizontal and vertical directions, extract the real-time position of the intersection point in the image coordinate system, and determine whether the direction node corresponding to the intersection point is within the boundary of the pattern area. Mark the intersection point coordinates that meet the boundary constraint conditions as path candidate points, and record the corresponding node index to obtain the set of path candidate points within the pattern area. S203: Using the coordinate distance and the angle between any two points in the path candidate point set within the pattern area, calculate whether there is an unobstructed pixel path in the pattern area, and record the connection path index between the two points when there is a connection relationship, filter out point pairs that cannot meet the connection requirements, and obtain the geometric connection relationship index set between path candidate points; S204: Based on the geometric connectivity index set between the candidate path points, construct the path according to the priority order of the starting point in the drawing area, gradually call adjacent connectable points to construct continuous line segments, complete the candidate point traversal, and obtain the skeleton path vector set.
5. The embroidery pattern optimization design method based on a machine learning model according to claim 4, characterized in that, The node distribution density benchmark value is the average node density value calculated based on the total number of pixels in the image and the total number of nodes in the direction, and is set to 1.2 times the average node density value; In the process of obtaining the node cluster segment position pairs in the horizontal and vertical directions, the range of consecutive pixel rows or pixel columns whose statistical value of the number of nodes in each row and column exceeds the node distribution density benchmark value must be greater than five unit pixels. The statistics are performed independently in the horizontal and vertical directions, and the horizontal and vertical ranges that form continuous segments are extracted to constitute the node cluster segment position pairs in the horizontal and vertical directions. In the process of determining whether the direction node corresponding to the intersection point is within the boundary of the pattern area, the boundary of the pattern area is defined as the range of the inner boundary after removing ten units of edge extension. Only when the intersection point is within the range of the inner boundary is the corresponding image coordinate marked as a path candidate point and the corresponding direction node index is recorded.
6. The embroidery pattern optimization design method based on a machine learning model according to claim 5, characterized in that, The specific steps for S3 are as follows: S301: Call the pattern image area corresponding to each continuous path segment in the skeleton path vector set, construct the normal vector direction according to the extension direction of the path segment, generate rectangular edge symmetrical projection windows at equal intervals along the normal vector direction on both sides of the path segment, scan the grayscale pixel value changes line by line and extract the pixel positions where the edge gradient change is greater than the edge extraction threshold, and obtain the set of edge points on both sides of the path. S302: Based on the coordinate positions of each group of left and right edge points in the set of edge points on both sides of the path, calculate the projection distance value in the main direction of the path segment, and compare the projection distance difference between multiple groups of edge points in the same path segment. When the projection distance difference is within the path direction coincidence threshold range and the contour pixel direction sequence of the structure to which the corresponding edge point belongs is consistent, record the edge point as a symmetrical pairing node and obtain the symmetrical node pairing set. S303: Using the coordinate positions of each group of nodes in the pattern image in the symmetrical node pairing set, connect the edge nodes in the same symmetrical pairing to construct a closed path outline, fill the closed structure boundary according to the pixel distribution in the closed path, and integrate the closed area into a layer block according to the path segment index number to obtain the pattern structure annotation block.
7. The embroidery pattern optimization design method based on a machine learning model according to claim 6, characterized in that, The specific steps of S4 are as follows: S401: Call the boundary coordinates of the structural label area in the pattern structure annotation block to limit the range of layers to be extracted in the pattern image, detect the color value difference of adjacent pixels and gather adjacent areas according to the color similarity threshold, identify color continuous areas and mark them as independent connected domain areas, fit the main direction line according to the pixel centroid coordinates and edge extension trend in the independent connected domain areas, record the main direction line as the direction axis, and obtain the color connected domain direction axis set; S402: According to the extension order of the direction axis of the color connected domain direction axis, traverse the pattern edge pixels within the coverage of the direction axis in sequence, extract the start and end position coordinates of each edge shape structure on the direction axis, and establish continuous encoding values according to the coordinate order to form a sorted index sequence of the pattern shape. Bind the sorted index sequence to the corresponding structure label area to obtain the pattern style structure label group.
8. The embroidery pattern optimization design method based on a machine learning model according to claim 1, characterized in that, The method further includes step S5: S5: Based on the color axis sequence encoding structure of the pattern style structure label group, extract the repeated paragraphs and arrangement patterns between the encoding sequences, compare the same type of paragraphs of the pattern components, determine whether there are consistent component paragraphs under the same structure label, and if so, classify them into the unified style type category to generate a style training sample label set. The style training sample label set includes style classification labels, arrangement pattern fragments, similar component sequences, and repeating paragraph structures.
9. The embroidery pattern optimization design method based on a machine learning model according to claim 8, characterized in that, The specific steps of S5 are as follows: S501: Call the color axis sequence encoding sequence bound under the structure label in the pattern style structure label group, detect the position change between adjacent encoding values in each encoding sequence, extract the repeated encoding segments in the sequence, record the position interval of the segments with repeated start and end indexes, and group the same type of segments according to the number of repetitions to obtain the set of repeated segments in the encoding sequence. S502: Based on the set of repeated segments in the encoded sequence, search for the encoded combination that is completely consistent with the arrangement order under the same structural label for each segment, compare the starting position of the directional axis and the angle value of the arrangement direction in the corresponding structural label, determine whether the directional arrangement is consistent, classify the segments with consistent arrangement into the same component segment type, and obtain the set of consistent component segments in the structural label. S503: Using the tag number and sequence content of the component segments in the consistent component segment set within the structure tag, uniformly mark them as the same style category, record the tag index and style code as the classification key value structure, and combine the classified component segments to form training data entries, group them according to their style category and store them in the sample set to obtain the style training sample tag set.
10. An embroidery pattern optimization design system based on a machine learning model, characterized in that, The system is used to implement the embroidery pattern optimization design method based on a machine learning model as described in any one of claims 1-9, and the system comprises: The edge extraction module acquires the original embroidery pattern image, collects the grayscale change rate parameters of the pixels, calls the pixels to form an edge pixel set, establishes a direction vector set based on the two-dimensional coordinate relationship of the edge pixel set, judges the angular trend of adjacent direction vectors, and generates a composition direction node map. The path construction module calls the distribution coordinates of nodes in the pattern area in the node map of the composition direction, establishes a two-dimensional coordinate grid of the pattern, records the concentrated sections of nodes in the direction, selects the intersection coordinates of nodes that show concentrated distribution in both the horizontal and vertical directions as path candidate points, and generates a continuous skeleton path vector set. The structural annotation module calls the coordinates of the path segment region in the continuous skeleton path vector set, obtains the distribution range of the two edge pixels on both sides in the path extension direction, extracts the corresponding projection value in the edge pixel distribution region, determines whether any pair of symmetrical points can be projected and overlapped in the path direction and meet the corresponding morphological conditions of the edge structure, selects the point pairs that meet the conditions as paired nodes, and obtains the pattern structure annotation block. The layer partitioning module calls the region position boundary in the pattern structure annotation block, collects the continuous region of the color channel inside the layer, divides the range of the color connected domain, obtains the diagonal spatial distribution direction of the region corresponding to the color connected domain, and obtains the pattern style structure label group. The style recognition module calls the edge path corresponding to the direction axis of the pattern style structure label group, extracts the sequential point column of the edge path in the direction of the direction axis extension, establishes a continuous number index, determines whether there are repeated paragraphs in the index sequence and meets the arrangement consistency condition, and obtains the style training sample label set.
Citation Information
Cited By
Classical costume design analysis system based on image recognition
CN121685755A
An image recognition-based classical costume design analysis system
CN121685755B
