Embroidery path intelligent planning method and system based on deep reinforcement learning

By constructing a disturbance response direction sequence and consistency judgment, the problem of unstable directional connection between line segments in the embroidery path was solved, realizing the continuity and stability of the path and improving the overall organization level of the embroidery path.

CN122222150APending Publication Date: 2026-06-16湖南工商大学
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
湖南工商大学
Filing Date
2026-03-12
Publication Date
2026-06-16

AI Technical Summary

Technical Problem

Existing technologies lack a structural discrimination mechanism for the directional connection between line segments in embroidery path generation, which makes it easy for local connection breaks and misalignment to occur during the path generation process. This makes it difficult to ensure directional uniformity and stability, thus affecting the performance of embroidery equipment.

Method used

By constructing a disturbance response direction sequence, we can determine the direction offset and consistency of line segments, divide the set of line segments with coherent directions, and combine the path sequence by angle connection method. Combine the extraction of angle mutation and direction combination replacement to enhance the smooth connection of directions between line segments and avoid path interruption or unstable direction.

Benefits of technology

Maintaining the continuous accessibility of the trajectory structure during the embroidery process enhances the integrity of the pattern path's connection and the adaptability of its turns, thereby improving the processing ability of the embroidery path and the overall organization level of the needle path.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122222150A_ABST
    Figure CN122222150A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of reinforcement learning, in particular to an embroidery path intelligent planning method and system based on deep reinforcement learning, which comprises the following steps: obtaining a direction of a to-be-connected line segment and fine-tuning an offset, outputting a disturbance response direction sequence, grouping direction consistency and extracting a direction continuation line segment, promoting a connection sequence according to angle connection, comparing angles to separate a direction mutation segment, combining a reference direction to replace and insert, and connecting the whole embroidery path. The application improves the smoothness of direction connection between line segments, reduces path interruption and direction offset, enhances the coherent accessibility of trajectory structure, strengthens the connection integrity and turning adaptability of the pattern path, and improves the organization efficiency of the needle path and the arrangement ability of the complex path by constructing the disturbance response direction sequence and introducing the consistency judgment, dividing the direction coherent line segment, combining the angle connection sequence and the angle mutation replacement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of reinforcement learning technology, and in particular to an intelligent planning method and system for embroidery paths based on deep reinforcement learning. Background Technology

[0002] The field of reinforcement learning encompasses research on agents acquiring decision-making strategies through trial and error in their environment. Its core lies in updating behavior selection methods using reward signals, enabling agents to form a mapping pattern from state to action through continuous interaction. This technical field systematically covers methods for constructing state representations, generating action decisions, setting reward signals, and policy update processes based on interaction data. It emphasizes utilizing environmental feedback to drive policy improvement and form generalizable decision-making patterns.

[0003] The intelligent embroidery path planning method based on deep reinforcement learning refers to establishing embroidery action selection rules by combining deep neural networks with reinforcement learning strategies in the embroidery trajectory generation task. This patent addresses technical aspects such as the arrangement of embroidery line segments, determination of stitch connection paths, and estimation of local turning node sequences. It constructs a state feature encoding network to represent the relationship between fabric position and stitch layout, uses a policy estimation network to generate the next stitch placement action, and guides the iterative update of the path sequence through a reward setting method, thereby completing the intelligent planning process of the embroidery path using deep reinforcement learning.

[0004] Existing technologies lack a structural discrimination mechanism between the direction of line segment connections. During path generation, they lack fine processing of the directional connection status between line segments. When facing complex areas of fabric stitches, local connection breaks and misalignment are prone to occur. The path sequence has the risk of jumping in direction arrangement, making it difficult to ensure directional uniformity. The connection stability of some path segments is poor, and there is a lack of dynamic adjustment mechanism to cope with sudden changes in direction. This affects the continuous needle-dropping effect and poses a potential interference to the execution stability of embroidery equipment. Summary of the Invention

[0005] To address the technical problems existing in the prior art, embodiments of the present invention provide an intelligent embroidery path planning method and system based on deep reinforcement learning. The technical solution is as follows: The intelligent embroidery path planning method based on deep reinforcement learning includes the following steps: S1: Obtain the direction content of the set of line segments to be connected in the embroidery path, slightly offset the direction of each line segment, input the action unit in sequence to generate the path, output the offset path as a graphic trajectory, match the line segment number with the output path one by one, summarize all paths into a direction sequence, and output the disturbance response direction sequence. S2: Call the direction of each path in the disturbance response direction sequence, compare the direction with the original line segment direction, group the numbers with the same direction into the same group, extract the line segments that can be connected to the original direction, complete the collection of connected path line segments, and form a set of direction-continuing line segments. S3: Call the number and direction in the set of line segments that continue the direction, align the direction of the first end of the line segment with the direction of the last end of the previous segment, select the closest line segment and place it at the first position, connect the remaining line segments in sequence, output the number column connected in the natural order of the path, and generate a complete connection order list. S4: Call all path directions in the complete connection sequence list, extract the directional differences between the preceding and following connecting segments, divide the segments with obvious offset angles, cross-reference the front and end directions, group the directional jump areas in the path together, and output a set of directionally discontinuous segments.

[0006] As a further embodiment of the present invention, the disturbance response direction sequence includes the adjusted line segment direction, the offset path set, and the path-direction mapping relationship; the direction continuation line segment set includes direction consistency grouping, connectivity path set, and sustainable directional line segments; the complete connection order list includes continuous connection structure, preferred connection path, and line segment sorting information; and the direction discontinuity segment set includes direction abrupt change segment, angle exceeding limit segment, and path connection abnormal segment.

[0007] As a further aspect of the present invention, the step of obtaining S1 is as follows: S101: Obtain the direction content of the set of line segments to be connected in the embroidery path, and extract the line segment direction vector according to the geometric relationship between the start coordinate and end coordinate of each line segment. Call the line segment direction vector and the end direction vector of the forward connecting line segment, and perform direction adjustment operation according to the angle deviation value between the two vectors. Perform direction offset processing on the direction information of the current line segment to obtain the line segment direction offset vector set. S102: Based on the line segment offset vector set, the offset vectors of each line segment are called in sequence, and each line segment is input into the corresponding action unit to complete the path extension process. The path lines output by each action unit are extracted according to the arrangement order of the line segments in the path. The line content splicing operation is performed according to the original order to obtain the path line splicing dataset. S103: Based on the path line sequence in the path line splicing dataset, retrieve the original line segment direction vector and the path line direction vector in sequence, perform direction-corresponding actions on the two sets of vector information, number the corresponding results sequentially, integrate all direction vector data according to the numbering order, and obtain the disturbance response direction sequence.

[0008] As a further aspect of the present invention, the step of obtaining S2 is as follows: S201: Call the path directions in the disturbance response direction sequence and the original path directions, and perform direction consistency judgment on each group of corresponding vectors in turn. Based on the relationship between the direction angle difference and the direction consistency judgment benchmark value, identify whether the front and back directions are consistent. Record the line segment index identifiers with consistent directions and integrate them in order to obtain the same direction line segment index set. S202: Based on the direction information of each line segment in the same direction line segment index set and the input direction data frame, extract the direction vector of the line segment and the corresponding input direction vector in the order of the index, check the direction continuity state at the vector connection, retain the line segment number in the direction continuity state, and obtain a continuous direction line segment set. S203: Call the index of each line segment in the continuous direction line segment set, retrieve the original line segment data corresponding to it in the embroidery path in sequence, execute the line segment extraction process, and arrange all path line segments that meet the conditions in order to generate a direction continuation line segment set.

[0009] As a further aspect of the present invention, the step of obtaining S3 is as follows: S301: Call the segment number and corresponding direction information in the set of direction continuation segments, extract the direction of the beginning of the segment and the direction of the end of the previous path in sequence, perform direction comparison operation according to the angle difference between the two vector directions and the connection threshold, filter out the segment numbers whose angle difference does not exceed the connection threshold, and record and output them in the order of the numbers to obtain the direction matching segment list. S302: According to the list of line segments with directions, extract the remaining unselected line segment numbers and direction vectors corresponding to each line segment number in sequence, compare the starting direction of the line segment with the ending direction of the line segments, determine whether there is a continuing relationship between the two direction vectors, and record the line segment numbers that have the conditions for directional advancement to obtain the sequence of line segments with directional extension. S303: Call the sequence of line segments continuing in the direction and all line segment numbers in the list of line segments connecting in the direction. Combine all line segment numbers in the order of priority for direction connection and supplementation for direction continuation to construct a numbered sequence of continuous path direction. Output the full sequence of path line segments in the order of structure number to obtain a complete connection order list.

[0010] As a further aspect of the present invention, the step of obtaining S4 is as follows: S401: Call all line segment directions in the complete connection sequence list, extract the front and rear direction vectors of each line segment connection point in sequence, compare the angle value of the direction vector with the continuous deviation reference value, identify the line segment position index whose angle difference exceeds the continuous deviation reference value, and output them in index order to obtain the direction offset segment index set. S402: Based on the start and end position numbers of each segment recorded in the direction offset segment index set, extract the start and end directions of the corresponding line segments, use the direction vector cross detection strategy to check the angle difference between the front and back directions, and mark the segment numbers with prominent angle changes to obtain the direction change line segment sequence. S403: Call the segment numbers of each segment in the directional mutation segment sequence, retrieve their actual segment data in the complete connection path in turn, split the original path structure and remove the marked segment segments from the original sequence, rearrange the remaining path indexes and then perform aggregation processing on the separated segments to obtain a set of directionally discontinuous segments.

[0011] As a further aspect of the present invention, the method further includes: S5: Call the start and end directions in the set of discontinuous segments, combine the transition directions of the connecting segments, insert them into the original path sequence, replace the changing segments with connecting segments, splice them into a continuous structure, complete the output of the entire path connection, and generate the intelligent planning result of the embroidery path. The intelligent planning results of the embroidery path include the full path connectivity structure, optimized connection order, and unified direction sequence.

[0012] As a further aspect of the present invention, the step of obtaining S5 is as follows: S501: Call the start and end direction vectors of each segment in the set of discontinuous segments, extract the end direction of the path before the segment and the start direction of the path after the segment in sequence, combine the two direction vectors into a pair of connecting directions according to the path order, and record the insertion position index number corresponding to each pair of connecting directions to obtain a set of connecting direction references. S502: Based on the insertion position index number in the connection direction reference set, extract the corresponding connection direction pairs, insert each combination direction into the original connection segment path sequence according to the path structure order, replace the direction discontinuity segments at the corresponding positions in the original path, and generate the insertion correction path sequence. S503: Call all path segment numbers in the inserted correction path sequence, perform direction order sorting and structure number unification operations in sequence, output the full path direction information frame according to the line segment arrangement order, integrate and sort the complete path structure information, and obtain the embroidery path intelligent planning result.

[0013] An intelligent embroidery path planning system based on deep reinforcement learning, the system comprising: The disturbance recognition module obtains the set of line segments to be connected in the embroidery pattern, extracts the direction vector of each line segment and the forward direction vector of its connecting path, and makes a slight offset adjustment to the direction of the line segment based on the difference in the direction angle between the two. It constructs an association table with the offset direction and the line segment number, and arranges all the offset direction data in the order of the input path to generate a disturbance response direction sequence. The direction grouping module calls the path direction vectors in the disturbance response direction sequence and makes a consistency judgment with the original path direction. Based on the angular relationship between the direction vectors, the line segments that conform to the continuous direction are grouped into the same path sequence, and all connected directional path segments are integrated to obtain a set of directional continuation line segments. The path reorganization module calls the path numbers and directions of each path in the set of direction-continuing line segments. Based on the angular connection relationship between the starting direction of a line segment and the ending direction of the previous path segment, it selects line segments that can form a continuous connection as priority connection objects, sequentially advances the combination of the remaining line segments, reconstructs the line segment number order, and generates a complete connection order list. The angle detection module calls all path directions in the complete connection sequence list, calculates the change of the angle between the front and back directions of each path connection point, identifies path segments whose angle changes exceed the continuous deviation standard, cross-compares the starting direction and ending direction of the corresponding segment, filters out the path numbers of segments with prominent direction changes, and obtains a set of segments with discontinuous directions. The path correction module calls the start and end direction vectors of each path segment in the set of discontinuous direction segments, extracts the direction combination result as the correction connection direction, inserts the connection direction into the path segment, replaces the order of abrupt fragments in the original path, updates the entire path structure, and generates the embroidery path intelligent planning result.

[0014] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following: In this invention, by constructing a disturbance response direction sequence and introducing a direction consistency judgment, the set of line segments with continuous direction is further divided. The path sequence is combined by angle connection method. Combined with angle change extraction and direction combination replacement, the smooth connection of direction between line segments is enhanced, avoiding path interruption or unstable direction. During the embroidery process, the continuous accessibility of the trajectory structure is maintained, the integrity of the pattern path connection, the ability to adapt to turns and the controllable performance of the connection logic are strengthened, and the ability of the embroidery path to handle complex line segment arrangement and the overall organization level of the needle path are improved. Attached Figure Description

[0015] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a flowchart illustrating the process of obtaining the perturbation response direction sequence of the present invention. Figure 3 The flowchart illustrates the process of obtaining the set of line segments for the direction of this invention. Figure 4 This is a flowchart illustrating the process of obtaining the complete connection order list in this invention. Figure 5 This is a flowchart illustrating the process of obtaining the set of discontinuous segments in the direction of the present invention. Figure 6 This is a flowchart illustrating the process of obtaining the intelligent planning results for the embroidery path according to the present invention. Detailed Implementation

[0016] The technical solution of the present invention will now be described with reference to the accompanying drawings.

[0017] 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.

[0018] 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.

[0019] 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.

[0020] 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.

[0021] Please see Figure 1 This invention provides a technical solution: an intelligent embroidery path planning method based on deep reinforcement learning, comprising the following steps: S1: Obtain the direction content of the set of line segments to be connected in the embroidery path, finely adjust and offset the direction of each line segment with its forward connection direction, input the offset path into the action unit to complete the generation of the entire path, output the path lines generated in the action unit in the input order, associate the line segments with the corresponding path directions one by one, and obtain the disturbance response direction sequence. S2: Call each path direction in the disturbance response direction sequence, and make a consistency judgment between the original path direction and the previous and next directions. Group the line segments whose direction is consistent with the original path into the same group, connect the corresponding line segment direction in each group with the input direction, and extract all the line segments that can connect to the original path direction to form a set of direction continuation line segments. S3: Call the line segment number and corresponding direction in the line segment set, compare the angle connection relationship between the first end direction of the line segment and the last end direction of the previous path, select the line segment that can be directly connected as the first choice, and gradually advance the remaining line segments according to the connection direction to combine a continuous connection path and obtain a complete connection order list. S4: Call all line segment directions in the complete connection order list, compare the direction angles of the front and back directions of the line segment connection points, extract the parts whose angle changes exceed the continuous deviation, cross-check the angles of the front and back directions of each deviation part, separate all segments with abrupt changes in direction, and form a set of discontinuous direction segments. S5: Call the start and end directions in the set of discontinuous path segments, combine the connecting directions of the two paths as reference directions, insert the combined direction into the path sequence of the connecting segments, replace the corresponding segments in the original connection order with the combined direction segments, connect all path segments of the entire pattern, and generate the intelligent planning result of the embroidery path.

[0022] The disturbance response direction sequence includes the adjusted line segment direction, the set of offset paths, and the mapping relationship between paths and directions. The set of line segments with continued direction includes direction consistency grouping, connectivity path set, and sustainable directional line segments. The complete connection order list includes continuous connection structure, preferred connection path, and line segment sorting information. The set of discontinuous direction segments includes direction change segments, angle exceeding limit segments, and abnormal path connection segments. The embroidery path intelligent planning result includes the full path connectivity structure, optimized connection order, and unified direction sequence.

[0023] Please see Figure 2 The steps to obtain S1 are as follows: S101: Obtain the direction content of the set of line segments to be connected in the embroidery path, and extract the line segment direction vector according to the geometric relationship between the start coordinate and end coordinate of each line segment. Call the line segment direction vector and the end direction vector of the forward connecting line segment, and perform direction adjustment operation according to the angle deviation value between the two vectors. Perform direction offset processing on the direction information of the current line segment to obtain the line segment direction offset vector set. To obtain the direction information of the set of line segments to be added in the embroidery path, you should first retrieve the coordinate data of the line segments that have not yet been added from the embroidery path design drawing or path database. This coordinate data includes the starting point of each line segment. and the end point In practical applications, given two sets of two-dimensional coordinate values, if the starting point of the current line segment is (10, 15) and the ending point is (30, 45), then the direction vector of the line segment can be represented as follows: Then, the vector is represented as a unit vector for easy direction determination. The current line segment is associated with the direction of the preceding connecting line segment. The preceding connecting line segment is a processed line segment at the end of the path, and its end direction vector is also calculated from its coordinates. For example, if its vector is (15, 20), then the angle between the current line segment's direction vector and the preceding connecting line segment's end direction vector needs to be calculated. Specifically, the cosine value is obtained by calculating the ratio between the dot product and the product of the magnitudes of the two vectors. This leads to the derivation of the angle deviation value. If the angle deviation is between 0° and 30°, the directions are close to being the same. If the deviation value falls between 30° and 90°, it is considered a medium deviation. If it is greater than 90°, the directions are considered to be opposite. When performing the direction offset operation, the offset intensity should be set according to the deviation level. For example, the offset thresholds of 15°, 45° and 90° are set as three judgment nodes. When the deviation is 70°, the offset should be performed at the 45° level. The current line segment vector is offset by the set angle according to the deviation direction, such as rotating 35° to the left. This offset angle should be obtained through the vector rotation formula or by looking up a table. After performing the above operation on multiple line segments, a line segment direction offset vector set is formed. Each record contains the original vector and the offset angle, as well as the vector value after offset. For example, the original vector is (20,30), the offset angle is 35°, and the vector after rotation is calculated as (3.87,35.49). Finally, the line segment direction offset vector set is output.

[0024] S102: Based on the line segment direction offset vector set, the offset vectors of each line segment are called in sequence, and each line segment is input into the corresponding action unit to complete the path extension process. The path lines output by each action unit are extracted according to the arrangement order of the line segments in the path, and the line content is spliced ​​according to the original order to obtain the path line splicing dataset. Based on the set of line segment offset vectors, the offset vector of each line segment is called sequentially during the path generation process. Let the current line segment sequence in the path be... Then its offset vector is called in sequence. ,For example Given (5,10), we take it as input and combine it with its starting coordinates (0,0) to obtain the ending coordinate (5,10), which is then used as... Extended path, next line segment Starting from this endpoint, towards directional extension, such as The starting point is (4, -6), and the ending point is (5 + 4, 10 - 6) = (9, 4). This process is repeated to construct the complete path. During the extension process, fine-tuning can be performed on each line segment. Specifically, if there is an error exceeding one unit between the current line segment's ending point and its starting point, correction is required to prevent path breakage. After extension is complete, the path is... to The path lines of each line segment are extracted sequentially, that is, the coordinate pairs of each line segment are extracted one by one, such as (0,0)-(5,10), (5,10)-(9,4), and the lines are recorded to form a path line dataset. Then, a splicing operation is performed to connect these line data one by one in the original order. By appending the coordinate points of each line segment to the end of the previous line, a continuous path line splicing dataset is formed. During the process, it is necessary to check whether the coordinate points are repeated. If the starting point of the next line segment is equal to the ending point of the previous line segment, the coordinate is recorded only once to ensure the uniqueness of the coordinates during the path line splicing process. The final path line splicing dataset is a list of the complete connected path coordinate sequence.

[0025] S103: Based on the path line order in the path line splicing dataset, retrieve the original line segment direction vector and the path line direction vector in sequence, perform direction-corresponding actions on the two sets of vector information, and number the corresponding results in sequence. Integrate all direction vector data according to the numbering order to obtain the disturbance response direction sequence. Based on the arrangement order of the lines in the path line splicing dataset, the original line segment direction vectors and the path line direction vectors are retrieved sequentially. When performing the direction-corresponding action, the initial vector of each line segment must first be confirmed. , and splicing line vector After extracting each pair of vectors, a direction comparison is performed to determine the direction and degree of deviation. Quantitative comparison is performed using the included angle value, such as Vorig (10,5) and Vpath (9,6). First, the two vectors are normalized and their included angle is calculated. If the included angle is within the range of 0° to 10°, the direction is considered consistent and assigned a value of 1. If it is between 10° and 45°, it is assigned a value of 2. If it exceeds 45°, it is assigned a value of 3. The direction number is matched for each pair of vectors according to the above rules. For example, the first pair is numbered 1, the second pair is numbered 2, and the third pair is numbered 3. These numbers are recorded in the path order to form a direction sequence [1,2,3,…]. This sequence is used to represent the offset intensity of each path segment relative to the original vector. This action does not involve vector adjustment, but is only used to record the offset level. Finally, all direction number data are integrated to form a complete disturbance response direction sequence.

[0026] Please see Figure 3 The steps to obtain S2 are as follows: S201: Call the path directions in the disturbance response direction sequence and the original path directions, and perform direction consistency judgment on each group of corresponding vectors in turn. Based on the relationship between the direction angle difference and the direction consistency judgment benchmark value, identify whether the front and back directions are consistent. Record the line segment index identifiers with consistent directions and integrate them in order to obtain the same direction line segment index set. The original path direction vector sequence is extracted to ensure that the direction vector of each original line segment maintains a one-to-one correspondence with the disturbance response direction sequence. The extraction process is based on the starting point of the line segment. and the finish line Based on this, calculate the direction vector. The direction of the disturbance response has already been obtained in the previous step. The angle difference between the two extracted vector pairs is calculated, and the angle derivation is performed using the dot product and magnitude calculation results of the two vectors. The angle difference is then compared with a benchmark value for direction consistency judgment, which is set as follows: If the angle between a pair of vectors satisfy If the vectors in this group are considered to have the same direction, then... If the directions are inconsistent, the comparison operation described above needs to be performed separately for each set of vectors during the judgment process, and the index of the line segment with the consistent direction should be recorded. In the actual embroidery path, for example, the original line segment direction vector of the 3rd segment is... The perturbation direction vector is The included angle is calculated as follows Since it meets the consistency judgment condition, its index 3 record is a consistent line segment. The judgment process continues to be executed, and all line segments are judged one by one to see if they meet the direction consistency condition. Finally, all line segment indexes that meet the condition are arranged in the original path order and integrated to form a line segment index set in the same direction.

[0027] S202: Based on the direction information of each line segment in the same direction line segment index set and the input direction data frame, extract the direction vector of the line segment and the corresponding input direction vector in the order of the index, check the direction continuity state at the vector connection, retain the line segment number in the direction continuity state, and obtain the continuous direction line segment set. The line segment direction information is invoked. For each line segment pointed to by an index, its direction vector is extracted from the original path, and the corresponding input direction vector is simultaneously extracted from the input direction data frame, forming a set of line segment vectors and input vector pairs. When performing direction continuity checks, adjacent two line segments are used as judgment units, and their vectors are extracted for direction transition judgment. The judgment content is whether there is a significant angle change between the current line segment's endpoint direction and the subsequent line segment's starting direction. The judgment criterion is a set continuity judgment threshold. The value is If the included angle between two line segments If, then it is considered to be directionally continuous, if If the direction vectors of the 5th and 6th line segments are respectively..., then it is judged as a discontinuity of direction. For example, if the direction vectors of the 5th and 6th line segments are respectively... and The angle difference is calculated as follows: If the 5th line segment number is retained, and the 7th line segment direction vector is... It forms an angle with the previous line segment. If the segment is not continuous, its number is not retained. Following this logic, the index set of segments in the same direction is traversed, and the number records of all segments in continuous directions are retained, ultimately resulting in a set of segments in continuous directions.

[0028] S203: Call the index of each line segment in the continuous direction line segment set, retrieve the original line segment data corresponding to it in the embroidery path in turn, execute the line segment extraction process and arrange all path line segments that meet the conditions in order to generate a direction continuation line segment set. Before extracting the original path data for each line segment from the continuous direction line segment set, it is necessary to confirm that each index points to a valid position in the original path line segment sequence. The extracted content includes the coordinates of the line segment's start and end points. The extracted original line segments are then reconstructed according to the index order, and the line segment number is bound to its corresponding coordinate data for output. For example, if the continuous direction line segment set is... Then, the data of the 2nd, 3rd, 4th, and 6th line segments in the original path are retrieved in sequence. For example, the coordinates of the 2nd line segment are... The third paragraph is Repeat the extraction process to reorganize all line segment data, reorder them according to their numbers, and output them as a set of line segments with continued direction.

[0029] Please see Figure 4 The steps to obtain S3 are as follows: S301: Call the segment number and corresponding direction information in the set of direction continuation segments, extract the direction of the beginning of the segment and the direction of the end of the previous path in sequence, perform direction comparison operation based on the angle difference between the two vector directions and the connection threshold, filter out the segment numbers whose angle difference does not exceed the connection threshold, and record and output them in the order of the numbers to obtain the list of direction matching segments; Retrieve the start and end coordinates of each line segment corresponding to its number, and calculate the direction vector of the current line segment's beginning using these coordinates. Simultaneously, obtain the tail direction vector of the preceding path segment, and calculate the angle between the two vectors using the relationship between the dot product of the vectors and the product of their magnitudes. Then, this angle is aligned with the set threshold. The threshold is set for comparison and judgment. If the angle between the direction of a line segment and the direction of the preceding line segment satisfies If the angle exceeds the threshold, it indicates that the line segment has a directional connection with the preceding segment. In this case, the line segment number is recorded as a valid number. If the angle exceeds the threshold, it is not recorded. In the example, if the direction vector of line segment 5 is (8,2) and the direction vector of line segment 4 is (7.5,2.3), the included angle is... If the direction vector of line segment 6 is (5,6) and the angle between it and the previous vector is... If the condition is not met, no record is made. During the execution process, the above comparison action is repeated for all line segments to filter the directional connection relationship one by one, and finally output a list of directional connection segments arranged by line segment number.

[0030] S302: Based on the list of direction-connected line segments, extract the remaining unselected line segment numbers and direction vectors corresponding to each line segment number in sequence, compare the starting direction of this type of line segment with the ending direction of the already arranged line segments, determine whether there is a continuing relationship between the two direction vectors, and record the line segment numbers that have the conditions for directional advancement to obtain the sequence of direction-continuing line segments. Extract all corresponding line segment numbers and remove them from the original path number set to obtain the remaining unselected line segment number set. Then, extract the direction vectors of these line segments sequentially, calculating them as the difference between the start and end coordinates. Simultaneously, obtain the direction vector of the last line segment in the arranged line segments and perform a direction relationship judgment between the two. The judgment criteria are whether there is a continuing relationship and the included angle threshold. , set as If the included angle This indicates that there is a continuing trend in the direction. If the value is greater than this, there is no continuing trend. During execution, for example, the direction of line segment number 7 is (6,4), and the direction of line segment number 6 is (5.9,3.8), with an included angle of . Therefore, line segment 7 meets the advancement conditions and is added to the advancement continuation list. If line segment 8 has a direction of (-2, 9) and an angle with the previous termination line segment, then... If the condition is not met, it will be discarded without further processing. This process compares each remaining line segment to obtain the line segment numbers that meet the directional advancement conditions, and outputs a sequence of line segments that continue in the direction.

[0031] S303: Call all segment numbers in the direction continuation segment sequence and the direction matching segment list, combine all segment numbers in the order of direction matching priority and direction continuation supplementation, construct a continuous numbering sequence of path directions, and output the full sequence of path segments in the order of structure numbering to obtain a complete connection order list; The process calls all segment numbers from the directional continuation segment sequence and the directional pairing segment list, and integrates these two sets of numbers. The sorting logic prioritizes preserving the original sequence order of the directional pairing segment numbers, and then appends the directional advancement segment numbers to the end to ensure that the numbering connections satisfy the directional logical continuity. For example, if the directional pairing list is [2,3,5] and the directional advancement sequence is [7,8], then the final numbering sequence is [2,3,5,7,8]. After the combination is completed, all numbers are checked again to ensure that there are no overlapping or backtracking numbers. Finally, the complete sequence of the path segments arranged according to the structure numbering order is output to obtain the complete connection order list.

[0032] Please see Figure 5The steps to obtain S4 are as follows: S401: Call all line segment directions in the complete connection sequence list, extract the front and rear direction vectors of each line segment connection point in turn, compare the angle value of the direction vector with the continuous deviation reference value, identify the line segment position index whose angle difference exceeds the continuous deviation reference value, and output them in index order to obtain the direction offset segment index set. Iterate through each pair of consecutive line segments in the connected sequence. For the i-th and (i+1)-th line segments, extract their endpoint and starting point coordinates, respectively. and Calculate the direction vector between the two line segments based on their coordinates, and denot them as follows: and The formula for calculating the angle between two vectors is used to calculate the angle difference between adjacent directions. The value is then calculated, and a continuous deviation reference value is introduced. Perform angle comparison and set this value. ,like Then the direction is considered continuous, if This is then determined to be a directional deviation. During the determination process, the angle between adjacent vectors of all line segments needs to be calculated and compared with a threshold. In the example, if the angle between the directions of the 6th and 7th segments is... Greater than the benchmark value If the 6th segment is marked as the direction offset segment, then all line segment connection positions are processed in the same way, and the line segment index number that meets the angle change condition is output item by item. The numbers are arranged in the order of the connection path, and finally the index set of the direction offset segment is formed.

[0033] S402: Based on the start and end position numbers of each segment recorded in the direction offset segment index set, extract the start and end directions of the corresponding line segments, use the direction vector cross detection strategy to check the angle difference between the front and back directions, and mark the segment numbers with prominent angle changes to obtain the direction change line segment sequence. Determine the range of line segments corresponding to each paragraph, and extract the direction vector of the first line segment within the range. and the direction vector of the last line segment The two vectors are obtained by calculating their start and end coordinates. Then, a cross-checking operation is performed on these two direction vectors. The check method involves calculating... and The angle between the directions And set the reference value for judging the included angle. for ,like If a segment exhibits a sudden change in direction between its beginning and end, it is considered to have abruptly changed direction. This segment will be marked as a segment with this abrupt change. In practice, if a segment numbered [12–15] has a beginning direction of (9,1) and an end direction of (-6,7), the calculated angle is... The value far exceeds the baseline value, so the segment number is recorded as a mutation segment. The above detection operation is repeated to process the entire directional offset segment index set, filter all segment numbers whose included angle mutations exceed the range, and summarize and sort them to obtain the directional mutation segment sequence.

[0034] S403: Call the segment numbers in the direction mutation segment sequence, retrieve the actual segment data in the complete connection path in turn, split the original path structure and remove the marked segment segments from the original sequence, rearrange the remaining path indexes and then perform aggregation processing on the separated segments to obtain the set of directionally discontinuous segments. The algorithm retrieves the segment numbers from the sequence of line segments with directional mutations. For each segment range pointed to by a number, it first locates the start and end number intervals of the corresponding line segment in the complete connection path. Then, it extracts the coordinate data and direction information of all line segments involved in the segment from the path structure. During the splitting operation, the corresponding number of the segment is not retained in the original path number sequence. The algorithm then performs a removal operation. After removal, the remaining numbers of the original path are reordered according to their original arrangement logic to maintain the continuity of the path. After removing the segments, the broken parts of the remaining path are clustered. The clustering operation uses whether the coordinate interval and the angle between the direction vectors between each end of the remaining path are less than the connection reference value as the connection judgment criteria. If the conditions are met, they are merged into the same segment; otherwise, a separate segment index record is set. The algorithm repeats the processing of all mutation segment numbers and finally outputs a set of all the removed and sorted directional discontinuous segments.

[0035] Please see Figure 6 The steps to obtain S5 are as follows: S501: Call the start and end direction vectors of each segment in the set of discontinuous direction segments, extract the end direction of the path before the segment and the start direction of the path after the segment in sequence, combine the two direction vectors into a pair of connecting directions according to the path order, and record the insertion position index number corresponding to each pair of connecting directions to obtain the connection direction reference set. For each segment, extract the ending direction of the preceding path and the starting direction of the following path. The ending direction vector of the preceding path is calculated using the end coordinates of its last line segment and its starting coordinates. The starting direction vector of the following path is calculated using the starting and ending coordinates of its first line segment. These are denoted as follows: and Then, these two vectors are combined in the order of the path structure to form a connection direction pair. For each pair of connection directions, record the starting index of the corresponding discontinuous segment insertion in the original path sequence, and mark it as the insertion position index number. The number and direction are bound together to form a mapping pair. In practice, if segments 21 to 24 are discontinuous segments, with the direction of the first segment being (6,3) and the starting direction of the second segment being (7,2), then they are combined into a connecting direction pair ((6,3),(7,2)), corresponding to an insertion position of 21, and recorded as follows: Repeat the above extraction and numbering process to form a connection direction reference set, which includes the number index of each pair of direction vectors and their corresponding insertion positions.

[0036] S502: Based on the insertion position index number in the connection direction reference set, extract the corresponding connection direction pairs, insert each combination direction into the original connection segment path sequence according to the path structure order, replace the direction discontinuity segments at the corresponding positions in the original path, and generate the insertion correction path sequence. Based on the insertion position index number in the connection direction reference set, retrieve each pair of connection directions and its corresponding number in sequence, and for each insertion position... Based on the path structure index, the index in the original path is... to Remove discontinuous segments between them. The end index for this discontinuous segment is determined by the replacement process, which involves filling the two vectors in the connection direction pair into their original positions in the path according to the path's direction. That is, filling the original path with the vectors at the specified positions. The position is inserted into the first direction vector, at the... Insert a second direction vector at the position. During the insertion process, complete the start and end coordinates of the newly added vector so that it can be used for subsequent path calculations. If the first vector is (6,3) and the start point is (120,150), then the end point is set proportionally to (126,153). If the second vector is (7,2), its start point is inherited from the previous end point, and the end point is (133,155), and so on. After the replacement is completed in the original path, a new path direction order list is generated. The original discontinuous segments in the list are replaced by connected direction pairs. Repeat this process to process all discontinuous segments according to all insertion indices, and finally obtain the inserted and corrected path sequence.

[0037] S503: Call all path segment numbers in the inserted correction path sequence, perform direction order sorting and structure number unification operations in sequence, output the full path direction information frame according to the line segment arrangement order, integrate and sort the complete path structure information, and obtain the embroidery path intelligent planning result. The process involves calling all path segment numbers in the insertion and correction path sequence, traversing them sequentially by number, and performing number alignment and order reconstruction on the start point, end point, and direction vector of each path segment. First, all path segments are re-numbered, with the numbers increasing from 1 according to the connection order to ensure that the numbering format of the newly added line segments after insertion and correction is consistent with the original line segments. Then, for the direction vector corresponding to each segment number, its coordinates, start point, end point, and direction difference angle are output to form a direction sequence table. During the processing, all line segment information is sorted in ascending order by number, and each segment information is integrated into a record. The record content includes the number, start point coordinates, end point coordinates, direction vector representation, and whether it is inserted. If it is a correction segment, the "inserted" flag is added; otherwise, it is marked as "original". For example, the 28th segment is a correction segment, and its information is: number 28, start point (240, 300), end point (247, 302), direction vector (7, 2), and flag "inserted". Finally, all records are output as a full path direction information frame. The information frame completely covers the direction, structure, and position data of the current path, completing the intelligent planning result of the embroidery path.

[0038] An intelligent embroidery path planning system based on deep reinforcement learning, comprising: The disturbance recognition module obtains the set of line segments to be connected in the embroidery pattern, extracts the direction vector of each line segment and the forward direction vector of its connecting path, and makes a slight offset adjustment to the direction of the line segment based on the difference in the direction angle between the two. It constructs an association table with the offset direction and the line segment number, and arranges all the offset direction data in the order of the input path to generate a disturbance response direction sequence. The direction grouping module calls the path direction vectors of each path in the disturbance response direction sequence, performs consistency judgment with the original path direction, and based on the angular relationship between the direction vectors, classifies the line segments that conform to the continuous direction into the same path sequence, integrates all connected directional path line segments, and obtains the set of directional continuation line segments. The path reorganization module calls the path numbers and directions of each path in the direction continuation line segment set. Based on the angular connection relationship between the starting direction of a line segment and the ending direction of the previous path segment, it selects line segments that can form a continuous connection as priority connection objects, sequentially advances the combination of the remaining line segments, reconstructs the line segment number order, and generates a complete connection order list. The angle detection module calls all path directions in the complete connection sequence list, calculates the change of the angle between the front and back directions of each path connection point, identifies path segments whose angle changes exceed the continuous deviation standard, cross-compares the starting and ending directions of the corresponding segments, filters out the path numbers of segments with prominent direction changes, and obtains a set of segments with discontinuous directions. The path correction module calls the start and end direction vectors of each path segment in the set of disjoint direction segments, extracts the direction combination result as the correction connection direction, inserts the connection direction into the path segment, replaces the order of abrupt fragments in the original path, updates the entire path structure, and generates the intelligent planning result of the embroidery path.

[0039] The above description is merely a specific embodiment 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. An intelligent embroidery path planning method based on deep reinforcement learning, characterized in that, Includes the following steps: S1: Obtain the direction content of the set of line segments to be connected in the embroidery path, slightly offset the direction of each line segment, input the action unit in sequence to generate the path, output the offset path as a graphic trajectory, match the line segment number with the output path one by one, summarize all paths into a direction sequence, and output the disturbance response direction sequence. S2: Call the direction of each path in the disturbance response direction sequence, compare the direction with the original line segment direction, group the numbers with the same direction into the same group, extract the line segments that can be connected to the original direction, complete the collection of connected path line segments, and form a set of direction-continuing line segments. S3: Call the number and direction in the set of line segments that continue the direction, align the direction of the first end of the line segment with the direction of the last end of the previous segment, select the closest line segment and place it at the first position, connect the remaining line segments in sequence, output the number column connected in the natural order of the path, and generate a complete connection order list. S4: Call all path directions in the complete connection sequence list, extract the directional differences between the preceding and following connecting segments, divide the segments with obvious offset angles, cross-reference the front and end directions, group the directional jump areas in the path together, and output a set of directionally discontinuous segments.

2. The intelligent embroidery path planning method based on deep reinforcement learning according to claim 1, characterized in that: The disturbance response direction sequence includes the adjusted line segment direction, the offset path set, and the path-direction mapping relationship. The direction continuation line segment set includes direction consistency grouping, connectivity path set, and sustainable directional line segments. The complete connection order list includes continuous connection structure, preferred connection path, and line segment sorting information. The direction discontinuity segment set includes direction abrupt change segment, angle exceeding limit segment, and path connection abnormal segment.

3. The intelligent embroidery path planning method based on deep reinforcement learning according to claim 1, characterized in that, The steps for obtaining S1 are as follows: S101: Obtain the direction content of the set of line segments to be connected in the embroidery path, and extract the line segment direction vector according to the geometric relationship between the start coordinate and end coordinate of each line segment. Call the line segment direction vector and the end direction vector of the forward connecting line segment, and perform direction adjustment operation according to the angle deviation value between the two vectors. Perform direction offset processing on the direction information of the current line segment to obtain the line segment direction offset vector set. S102: Based on the line segment offset vector set, the offset vectors of each line segment are called in sequence, and each line segment is input into the corresponding action unit to complete the path extension process. The path lines output by each action unit are extracted according to the arrangement order of the line segments in the path. The line content splicing operation is performed according to the original order to obtain the path line splicing dataset. S103: Based on the path line sequence in the path line splicing dataset, retrieve the original line segment direction vector and the path line direction vector in sequence, perform direction-corresponding actions on the two sets of vector information, number the corresponding results sequentially, integrate all direction vector data according to the numbering order, and obtain the disturbance response direction sequence.

4. The intelligent embroidery path planning method based on deep reinforcement learning according to claim 1, characterized in that, The steps for obtaining S2 are as follows: S201: Call the path directions in the disturbance response direction sequence and the original path directions, and perform direction consistency judgment on each group of corresponding vectors in turn. Based on the relationship between the direction angle difference and the direction consistency judgment benchmark value, identify whether the front and back directions are consistent. Record the line segment index identifiers with consistent directions and integrate them in order to obtain the same direction line segment index set. S202: Based on the direction information of each line segment in the same direction line segment index set and the input direction data frame, extract the direction vector of the line segment and the corresponding input direction vector in the order of the index, check the direction continuity state at the vector connection, retain the line segment number in the direction continuity state, and obtain a continuous direction line segment set. S203: Call the index of each line segment in the continuous direction line segment set, retrieve the original line segment data corresponding to it in the embroidery path in sequence, execute the line segment extraction process, and arrange all path line segments that meet the conditions in order to generate a direction continuation line segment set.

5. The intelligent embroidery path planning method based on deep reinforcement learning according to claim 1, characterized in that, The steps for obtaining S3 are as follows: S301: Call the segment number and corresponding direction information in the set of direction continuation segments, extract the direction of the beginning of the segment and the direction of the end of the previous path in sequence, perform direction comparison operation according to the angle difference between the two vector directions and the connection threshold, filter out the segment numbers whose angle difference does not exceed the connection threshold, and record and output them in the order of the numbers to obtain the direction matching segment list. S302: According to the list of line segments with directions, extract the remaining unselected line segment numbers and direction vectors corresponding to each line segment number in sequence, compare the starting direction of the line segment with the ending direction of the line segments, determine whether there is a continuing relationship between the two direction vectors, and record the line segment numbers that have the conditions for directional advancement to obtain the sequence of line segments with directional extension. S303: Call the sequence of line segments continuing in the direction and all line segment numbers in the list of line segments connecting in the direction. Combine all line segment numbers in the order of priority for direction connection and supplementation for direction continuation to construct a numbered sequence of continuous path direction. Output the full sequence of path line segments in the order of structure number to obtain a complete connection order list.

6. The intelligent embroidery path planning method based on deep reinforcement learning according to claim 1, characterized in that, The steps for obtaining S4 are as follows: S401: Call all line segment directions in the complete connection sequence list, extract the front and rear direction vectors of each line segment connection point in sequence, compare the angle value of the direction vector with the continuous deviation reference value, identify the line segment position index whose angle difference exceeds the continuous deviation reference value, and output them in index order to obtain the direction offset segment index set. S402: Based on the start and end position numbers of each segment recorded in the direction offset segment index set, extract the start and end directions of the corresponding line segments, use the direction vector cross detection strategy to check the angle difference between the front and back directions, and mark the segment numbers with prominent angle changes to obtain the direction change line segment sequence. S403: Call the segment numbers of each segment in the directional mutation segment sequence, retrieve their actual segment data in the complete connection path in turn, split the original path structure and remove the marked segment segments from the original sequence, rearrange the remaining path indexes and then perform aggregation processing on the separated segments to obtain a set of directionally discontinuous segments.

7. The intelligent embroidery path planning method based on deep reinforcement learning according to claim 1, characterized in that, The method further includes: S5: Call the start and end directions in the set of discontinuous segments, combine the transition directions of the connecting segments, insert them into the original path sequence, replace the changing segments with connecting segments, splice them into a continuous structure, complete the output of the entire path connection, and generate the intelligent planning result of the embroidery path. The intelligent planning results of the embroidery path include the full path connectivity structure, optimized connection order, and unified direction sequence.

8. The intelligent embroidery path planning method based on deep reinforcement learning according to claim 7, characterized in that, The steps for obtaining S5 are as follows: S501: Call the start and end direction vectors of each segment in the set of discontinuous segments, extract the end direction of the path before the segment and the start direction of the path after the segment in sequence, combine the two direction vectors into a pair of connecting directions according to the path order, and record the insertion position index number corresponding to each pair of connecting directions to obtain a set of connecting direction references. S502: Based on the insertion position index number in the connection direction reference set, extract the corresponding connection direction pairs, insert each combination direction into the original connection segment path sequence according to the path structure order, replace the direction discontinuity segments at the corresponding positions in the original path, and generate the insertion correction path sequence. S503: Call all path segment numbers in the inserted correction path sequence, perform direction order sorting and structure number unification operations in sequence, output the full path direction information frame according to the line segment arrangement order, integrate and sort the complete path structure information, and obtain the embroidery path intelligent planning result.

9. An intelligent embroidery path planning system based on deep reinforcement learning, characterized in that, The system is used in the embroidery path intelligent planning method based on deep reinforcement learning as described in any one of claims 1-8, and the system comprises: The disturbance recognition module obtains the set of line segments to be connected in the embroidery pattern, extracts the direction vector of each line segment and the forward direction vector of its connecting path, and makes a slight offset adjustment to the direction of the line segment based on the difference in the direction angle between the two. It constructs an association table with the offset direction and the line segment number, and arranges all the offset direction data in the order of the input path to generate a disturbance response direction sequence. The direction grouping module calls the path direction vectors in the disturbance response direction sequence and makes a consistency judgment with the original path direction. Based on the angular relationship between the direction vectors, the line segments that conform to the continuous direction are grouped into the same path sequence, and all connected directional path segments are integrated to obtain a set of directional continuation line segments. The path reorganization module calls the path numbers and directions of each path in the set of direction-continuing line segments. Based on the angular connection relationship between the starting direction of a line segment and the ending direction of the previous path segment, it selects line segments that can form a continuous connection as priority connection objects, sequentially advances the combination of the remaining line segments, reconstructs the line segment number order, and generates a complete connection order list. The angle detection module calls all path directions in the complete connection sequence list, calculates the change of the angle between the front and back directions of each path connection point, identifies path segments whose angle changes exceed the continuous deviation standard, cross-compares the starting direction and ending direction of the corresponding segment, filters out the path numbers of segments with prominent direction changes, and obtains a set of segments with discontinuous directions. The path correction module calls the start and end direction vectors of each path segment in the set of discontinuous direction segments, extracts the direction combination result as the correction connection direction, inserts the connection direction into the path segment, replaces the order of abrupt fragments in the original path, updates the entire path structure, and generates the embroidery path intelligent planning result.