Motion route generation method and device, computing equipment and computer readable storage medium
Through the graphic instance segmentation model and key point extraction technology, the graph paths are generated and matched, and the accuracy and fun problems of motion route generation in complex hand-drawn graphics are solved, and an integrated motion route generation method with high accuracy and intuitiveness is achieved.
Patent Information
- Application Number
- CN202411985328.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-15
AI Technical Summary
The prior art is difficult to accurately generate intuitive, interesting and highly accurate motion routes from complex hand-drawn graphics, especially when the graphics are more complex, the matching accuracy of the graphic paths with the roads on the map is insufficient.
The graph instance segmentation model is used to segment the graph examples based on the graphic features of the target graph, extract key points and build graph structures, generate graph paths, and match them with the road set on the map to generate the final motion route.
It improves the flexibility and accuracy of motion route generation, ensures that the path representation of complex graphics is fine and reasonable, and improves the accuracy and practicality of path conversion, making the generated motion route both intuitive and interesting, conforms to the user's intentions and can be applied in practice.
Smart Images

Figure CN119832110A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer vision, and the present application relates to a motion route generation method, apparatus, computing device and computer-readable storage medium. Background Art
[0002] With the development of computer vision technology, the way of generating motion routes on smart devices has also evolved significantly. Traditionally, motion routes on smart devices are often generated by inputting starting points, waypoints, and end points, which is not intuitive and lacks fun.
[0003] At present, in order to make the motion route generation process more intuitive and interesting, hand-drawn graphics are introduced into the motion route as a new interactive mode. Users can freely draw graphics on the front end of the smart device to generate the corresponding motion route. When the hand-drawn graphics are relatively simple, they can be realized through operations such as graphic segmentation and graphic smoothing. For example, when the user draws a line graphic with several sharp corners, the line is divided into multiple straight line segments and curve segments by identifying the positions of these sharp corners. For another example, for the broken line path drawn by the user, the corners are made smooth by using Bezier curve fitting technology.
[0004] However, when hand-drawn graphics are relatively complex, simple graphic segmentation and graphic smoothing make it difficult to divide a highly accurate graphic path from the hand-drawn graphics. The matching accuracy between the graphic path and the road on the map is insufficient and cannot be accurately converted into a usable motion route. Therefore, an intuitive, highly interesting, and highly accurate motion route generation method is urgently needed. Summary of the invention
[0005] In view of this, the embodiment of the present application provides a motion route generation method. The present application also relates to a motion route generation device, a computing device, a computer-readable storage medium, and a computer program product to solve the above problems existing in the prior art.
[0006] According to a first aspect of an embodiment of the present application, a method for generating a motion route is provided, comprising:
[0007] Get the target graphics drawn by the user on the front end;
[0008] Using a graphic instance segmentation model, based on graphic features of the target graphic, segment at least one graphic instance from the target graphic;
[0009] Extract key points from at least one graph instance, and generate a graph path of a target graph based on a graph structure with the key points as vertices and connections between the key points as edges;
[0010] Based on matching the graphic path of the target graphic and the road set of the target map, a movement route of the target graphic on the target map is generated.
[0011] According to a second aspect of an embodiment of the present application, a motion route generating device is provided, comprising:
[0012] An acquisition module is configured to acquire a target graphic drawn by a user on the front end;
[0013] A segmentation module is configured to segment at least one graphic instance from the target graphic based on the graphic features of the target graphic using a graphic instance segmentation model;
[0014] a path generation module configured to extract key points from at least one graphic instance, and generate a graphic path of a target graphic based on a graph structure with the key points as vertices and connections between the key points as edges;
[0015] The route generation module is configured to generate a movement route of the target graphic on the target map based on matching the graphic path of the target graphic and the road set of the target map.
[0016] According to a third aspect of an embodiment of the present application, a computing device is provided, including:
[0017] Memory and processor;
[0018] The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above method are implemented.
[0019] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program / instruction, and the steps of the above method are implemented when the computer program / instruction is executed by a processor.
[0020] According to a fifth aspect of the embodiments of the present application,
[0021] The motion route generation method provided in the present application provides a computer program product, including a computer program / instruction, which implements the steps of the above method when executed by a processor.
[0022] In one embodiment of the present application, a target graphic drawn by a user on the front end is obtained; at least one graphic instance is segmented from the target graphic based on the graphic features of the target graphic using a graphic instance segmentation model; key points are extracted from the at least one graphic instance, and a graphic path of the target graphic is generated based on a graph structure with the key points as vertices and connections between the key points as edges; a movement route of the target graphic on the target map is generated based on matching the graphic path of the target graphic with a road set of a target map.
[0023] Using the graphic instance segmentation model, based on the graphic features of the target graphics, the complex hand-drawn graphics drawn by the user on the front end are intelligently parsed, and at least one independent graphic instance is accurately identified and segmented. Key points are extracted from each accurately segmented graphic instance, and a graph structure based on key points is constructed to generate a graphic path, which improves the flexibility and accuracy of path generation and ensures that even for complex graphics, a fine and reasonable path representation can be obtained. The generated graphic path is matched with the road set on the target map to improve the accuracy and practicality of the path conversion, so that the final generated motion route is both in line with the user's intention and can be applied in practice. The motion route is generated through the interactive form of front-end drawing, which not only makes the motion route generation intuitive and highly interesting, but also accurately restores the spatial structure of the hand-drawn graphics at both the instance level and the path level, ensuring that the generated motion route meets the user's drawing intention and improves the accuracy of motion route generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a flow chart of a method for generating a motion route provided by an embodiment of the present application;
[0025] Figure 2 is a schematic diagram of a target graph of a motion route generation method provided by an embodiment of the present application;
[0026] Figure 3 is a schematic diagram of an example segmentation of a motion route generation method provided by an embodiment of the present application;
[0027] Figure 4 It is a schematic diagram of path generation of a motion route generation method provided in an embodiment of the present application;
[0028] Figure 5 is a schematic diagram of a motion route of a motion route generation method provided by an embodiment of the present application;
[0029] Figure 6 is a schematic diagram of an Euler path of a motion route generation method provided by an embodiment of the present application;
[0030] Figure 7 It is a flowchart of a method for generating a motion route provided by an embodiment of the present application;
[0031] Figure 8 is a processing flow chart of a method for generating a motion route for a running route provided by an embodiment of the present application;
[0032] Fig. 9 It is a structural schematic diagram of a motion route generating device provided by an embodiment of the present application;
[0033] Fig.10 It is a structural block diagram of a computing device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0034] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0035] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.
[0036] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0037] First, the terms involved in one or more embodiments of the present application are explained.
[0038] Convolutional Neural Network (CNN): A deep learning architecture designed for processing data with a grid-like structure, such as images. It automatically learns local features through convolutional layers and reduces data dimensions through pooling layers to retain important information. Subsequent fully connected layers are used for classification or regression tasks. CNN performs well in areas such as image recognition and segmentation, and can capture spatial hierarchical features, and is widely used in computer vision tasks.
[0039] U-NET model: A CNN-based encoder-decoder architecture that is particularly suitable for medical image segmentation. The encoder part extracts image features and gradually reduces the resolution; the decoder part gradually restores the resolution and finally outputs a segmentation mask of the same size as the input. The skip connection passes the high-resolution features of the encoder to the decoder, enhancing the ability to capture details, making U-NET perform well in precise segmentation tasks.
[0040] Vision Transformer (ViT model): A model that uses the Transformer architecture to process images. Unlike traditional convolutional networks, ViT divides images into fixed-size patches and linearly embeds them into sequences, and then models global dependencies through a multi-head self-attention mechanism. ViT can achieve excellent performance on less pre-training data, and is particularly good at capturing long-distance dependencies and complex patterns, and is suitable for various image understanding tasks.
[0041] Adaptive Gaussian Filtering (AGF): An image processing technique that adjusts filter parameters based on local image characteristics to remove noise while retaining edge information. AGF applies Gaussian blur of varying strengths after estimating the noise level of each pixel, making the filtering effect more natural and fidelity. This method is particularly suitable for preprocessing hand-drawn graphics and can effectively enhance graphic features.
[0042] Otsu's Method: A statistical method for automatic thresholding of images. The optimal threshold is selected by maximizing the inter-class variance to segment the image into foreground (non-zero pixels) and background (zero pixels). This algorithm is simple and efficient, and is widely used in binarization processing, which helps prepare the image processing steps before image instance segmentation.
[0043] Mathematical Morphology (MM): A set of image analysis theories and techniques based on set theory, including operations such as dilation, erosion, opening and closing. MM can change the structural characteristics of an image, such as removing noise, connecting breakpoints or smoothing boundaries, and is crucial for the normalization of hand-drawn graphics.
[0044] DINO Unsupervised Training: A self-supervised learning framework that aims to enable models to learn to recognize meaningful patterns in images without relying on labeled data. Through contrastive learning mechanisms, models can be pre-trained on large-scale unlabeled datasets to improve their ability to understand complex graphics.
[0045] TokenCut Algorithm: An image segmentation algorithm that treats an image as a collection of multiple image feature units (tokens) and uses graph cutting technology to determine the best segmentation scheme. This method can quickly and accurately separate visual entities, which is of great significance for parsing complex graphics drawn by users.
[0046] Geometric Constraints Rules (GCR): A set of principles used to guide shape construction and modification during graphics processing. GCR ensures that the generated path complies with the physical rules of the real world, such as the minimum turning radius of the road, thereby improving the authenticity and usability of the final motion route.
[0047] Zhang-Suen Thinning Algorithm: A classic skeleton extraction algorithm used to simplify the outline of objects in binary images into single-pixel-wide lines. This process maintains the main topological features of the original graphics and is used to achieve accurate key point extraction and path generation.
[0048] Eulerian Path: A path in a graph that passes through all edges only once. In this application, it is used to describe a continuous path formed after extracting key points from a graph instance, ensuring that the generated motion route is coherent and does not repeatedly cover the same distance, thereby enhancing the rationality of path planning.
[0049] In the present application, a motion route generation method is provided. The present application also relates to a motion route generation device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0050] Figure 1 A flow chart of a method for generating a motion route provided by an embodiment of the present application is shown, which specifically includes the following steps:
[0051] Step 102: Obtain the target graphic drawn by the user on the front end.
[0052] The embodiments of the present application are applied to the server side (backend) of a website, application or system platform with a route generation function, for example, a map website or a map application, for example, a sports and fitness website or application, and for example, a system platform for urban planning and design.
[0053] The user is a user who uses a website, application or system platform with a route generation function. The user draws a graphic on the front end to describe the movement needs and automatically generates a movement route. By drawing a graphic to express the desired path shape, a movement route that meets the user's intention is obtained.
[0054] The front end is the front end of a website, application or system platform with route generation function. The front end is used to receive user input and display the generated movement route. The front end is usually composed of a graphical user interface (GUI), which generally provides drawing tools and interface elements, allowing users to draw hand-drawn graphics through devices such as touch screens, mice and keyboards, and display the generated movement route on the graphical user interface. The front end transmits the user's hand-drawn graphics to the server (back end) for movement route generation.
[0055] The target graphic is a graphic drawn by the user on the front-end interface that needs to be converted into an actual movement route. The target graphic can be any shape, such as a straight line, curve, closed or polygonal, etc. It describes the user's movement needs and is a visual expression of the user's intention.
[0056] For example, in a sports and fitness mobile phone application, a running enthusiast draws a hand-drawn graphic on the front-end graphical user interface through the mobile phone touch screen, hoping to generate a sports route according to the hand-drawn graphic, such as Figure 2 shown. Figure 2 A schematic diagram showing a target graph of a motion route generation method provided by an embodiment of the present application is shown:
[0057] The running enthusiast drew a hand-drawn graphic number "2024" on the front-end interface, indicating that the running enthusiast hopes to generate a commemorative running route according to the specific year "2024".
[0058] Obtaining the target graphics drawn by the user on the front end provides a data basis for subsequent instance segmentation.
[0059] Step 104: using the graphic instance segmentation model, based on the graphic features of the target graphic, segment at least one graphic instance from the target graphic.
[0060] The graphic instance segmentation model is a machine learning model with graphic instance segmentation capabilities, which is used to segment different objects or regions in a graphic into independent graphic instances. Visually, each visual instance corresponds to a set of pixels in a specific area of a visual space in the target graphic. The graphic instance segmentation model is obtained by pre-training the visual processing model, and the training method can be supervised training, unsupervised training or semi-supervised training, which is not limited here. The graphic instance segmentation model can be a CNN model, U-NET model, ViT model and other models and corresponding improved models, which are not limited here.
[0061] The graphic features of the target graphic are the attribute features extracted from the target graphic by the graphic instance segmentation model, which are expressed as feature encoding vectors and are used to characterize the visual attributes of the target graphic and its spatial structure in the visual space, including but not limited to visual attributes such as shape, size, direction, color, texture, and spatial structures such as geometric structures (such as the straightness, angles, and intersections of lines) and topological relationships (such as connectivity and closure). For the graphic instance segmentation model, graphic features are the data basis for understanding the hand-drawn target graphic and are used to achieve accurate graphic instance segmentation.
[0062] A graphic instance is a set of pixels in a specific area of the visual space that the graphic instance segmentation model identifies and segments from the target graphic. In the process of motion path generation, graphic instance segmentation helps to decompose complex hand-drawn graphics into independent parts that are easier to generate paths, avoiding the problem of difficult parsing and inaccurate path generation caused by the overall complexity of the graphics. On this basis, each graphic instance can further extract key points and connections between key points to build a graph structure to generate a graphic path.
[0063] Before step 104, the following steps may be included: based on the sample graphics and the labeled graphic instances on the sample graphics, supervised training of the visual processing model is performed to obtain a graphic instance segmentation model; the following steps may also be included: based on the target graphics and the transformed graphics corresponding to the target graphics, comparative training (unsupervised training) of the visual processing model is performed to obtain a graphic instance segmentation model; the following steps may also be included: based on the sample graphics that are partially labeled with labeled graphic instances and the sample graphics that are partially not labeled with labeled graphic instances, semi-supervised training of the visual processing model is performed to obtain a graphic instance segmentation model, which is not limited here.
[0064] Using a graphic instance segmentation model, based on the graphic features of the target graphic, at least one graphic instance is segmented from the target graphic. An optional method is: using the graphic instance segmentation model, based on the graphic feature units of the graphic features of the target graphic, to segment at least one graphic instance from the target graphic. Another optional method is: using the graphic instance segmentation model, based on the graphic features of the target graphic at multiple scales, to perform feature fusion, to segment at least one graphic instance from the target graphic. Another optional method is: using the graphic instance segmentation model, based on the graphic features of the target graphic, to perform attention weighting, based on the attention weight, to segment at least one graphic instance from the target graphic. This is not limited here.
[0065] For example, 20 transformation graphics corresponding to the hand-drawn graphics drawn by running enthusiasts are constructed by rotation and scaling. Based on the hand-drawn graphics and the transformation graphics corresponding to the hand-drawn graphics, the ViT model is trained by DINO unsupervised training to obtain a graphics instance segmentation model. Using the graphics instance segmentation model, feature aggregation is performed based on the graphics feature unit Tokens of the graphics features of the hand-drawn graphics, and 4 graphics instances are segmented from the hand-drawn graphics, such as Figure 3 shown. Figure 3 A schematic diagram showing an example segmentation of a motion route generation method provided by an embodiment of the present application is shown:
[0066] From the hand-drawn graphics and the number "2024" drawn by a running enthusiast, four instances are segmented, namely:
[0067] Example 1: A set of pixels corresponding to the number "2".
[0068] Example 2: A set of pixels corresponding to the number "0".
[0069] Example 3: A set of pixels corresponding to the number "2".
[0070] Example 4: A set of pixels corresponding to the number "4".
[0071] By using the graphics instance segmentation model and based on the graphic features of the target graphics, the complex hand-drawn graphics drawn by the user on the front end can be intelligently analyzed, and at least one independent graphics instance can be accurately identified and segmented, providing a clear graphics instance data foundation for the subsequent generation of graphics paths.
[0072] Step 106: extract key points from at least one graphic instance, and generate a graphic path of the target graphic based on a graph structure with the key points as vertices and connections between the key points as edges.
[0073] Key points are pixels (or pixel sets) that represent a graphic instance in visual space. Key points are usually located at key locations of a graphic instance, such as corners, intersections, or locations with significant shape features. Key points are used to represent important features of a graphic and serve as the basis for subsequent construction of more complex graph structures.
[0074] The connection between key points is a line segment connecting at least two key points of a graphic instance in visual space, expressed as a set of pixels. The connection between key points constitutes the basic skeleton of a graphic instance, which serves as the basis for building a more complex graph structure. The connection can be a straight line or a curve, which is not limited here.
[0075] Vertex is one of the basic components of graph structure. Vertex represents the key points in the graph instance, including the visual spatial position of the key points. Edge is one of the basic components of graph structure. Edge definition represents the connection between key points in the graph instance, including the length of the connection and the direction of the connection.
[0076] The graph structure is structured data consisting of vertices and edges, which is used to describe the graph skeleton consisting of key points and the connections between key points. The graph structure connects the spatial structure of hand-drawn graphics at the instance level and the path level, and is used to further convert the spatial structure of the graphic instance into a graphic path.
[0077] The graphic path is a key point generated according to the graph structure and at least one combination between the key points, which is used to simulate the motion route corresponding to the target graphic. The key points and edges in each combination represent a coherent path from the starting point to the end point. The graphic path must ensure that each part of the path is coherent without disconnection or jumps. Optionally, the graphic path generated by applying a path generation method such as an Euler path does not repeatedly cover the same edge (that is, the edges in each combination are not repeated), thereby improving the rationality of path planning. Optionally, the graphic path needs to take into account actual physical constraints, such as the edges not crossing, the angle between the two edges meeting a preset threshold, etc. Optionally, the graphic path is smoothed, for example, using Bezier curve fitting technology to smooth corners.
[0078] Extract key points from at least one graphic instance. An optional method is to classify the visual spatial positions of pixels on at least one graphic instance to determine the key points. For each graphic instance, analyze the visual spatial positions of pixels in its boundary and internal areas, classify these pixels by clustering algorithms (such as K-means) or density peak search, and identify those pixels located at shape turning points, intersections or endpoints as key points. Such key points usually have high local feature strength and can effectively characterize the main structural features of the graphic instance. Another optional method is to extract key points from at least one graphic instance based on Harris corner detection. Another optional method is to use a morphological thinning algorithm to extract key points from at least one graphic instance, use morphological gradient operations to enhance the edge information of the graphic instance, and then apply a thinning algorithm (such as Zhang-Suen thinning algorithm) to thin multi-pixel width lines into single-pixel widths, determine the pixels with changes on the thinned lines, such as branch point pixels, endpoint pixels, etc., and mark them as key points, which are not limited here.
[0079] Based on a graph structure with key points as vertices and connections between key points as edges, a graphic path of a target graph is generated. One optional method is to generate a graphic path of a target graph according to an Euler path based on a graph structure with key points as vertices and connections between key points as edges. Another optional method is to generate a graphic path of a target graph using a depth-first search based on a graph structure with key points as vertices and connections between key points as edges. Another optional method is to generate a graphic path of a target graph using a breadth-first search based on a graph structure with key points as vertices and connections between key points as edges. No limitation is made here.
[0080] For example, for the four segmented graph instances, a morphological thinning algorithm is used to extract key points, and based on a graph structure with key points as vertices and connections between key points as edges, a graph path of the target graph is generated according to the Euler path, as shown in FIG. Figure 4 shown. Figure 4 A schematic diagram showing path generation of a motion route generation method provided in an embodiment of the present application is shown:
[0081] Extract key points (dots) and edges (line segments) between key points from instance 1 (the pixel set of number "2"), instance 2 (the pixel set of number "0"), instance 3 (the pixel set of number "2"), and instance 4 (the pixel set of number "4"), and generate a graphic path of the target graphic according to the Euler path, so that the graphic path passes through all edges and only once, and obtains 4 image paths.
[0082] Key points are extracted from each precisely segmented graphic instance, and a graph structure based on the key points is constructed to generate a graphic path. This improves the flexibility and accuracy of path generation, ensures that a detailed and reasonable path representation can be obtained even for complex graphics, and provides an accurate and coherent graphic path data foundation for the subsequent generation of the target graphic's movement route on the target map.
[0083] Step 108: Matching is performed based on the graphic path of the target graphic and the road set of the target map to generate a movement route of the target graphic on the target map.
[0084] The target map is a digital map of the actual geographical area where the user needs to exercise. It can be a map of a city, park, campus or any other area where exercise is allowed. It usually contains detailed geographical information and road networks. The data of the target map can be obtained from a public map service or a specially customized high-precision map, which is not limited here. The target map usually includes geographical information such as roads, terrain, buildings, landmarks, etc.
[0085] The roads of the target map are the accessible paths in the actual geographical area corresponding to the target map. The roads are recorded on the target map as linear elements such as motor vehicle lanes, bicycle lanes, and pedestrian paths, forming specific trajectories on which users can move. Each road can have multiple attributes, such as name, type (highway / non-motor vehicle lane), direction (one-way / two-way), width, number of lanes, speed limit, etc. The road consists of a series of coordinate points, which accurately describe the spatial position and form of the accessible paths in the actual geographical area. Different roads are connected through nodes (intersections or connection points) to form a complete road network.
[0086] The movement route of the target graphic on the target map is a combination of road segments that match the target graphic in the actual geographical area. The movement route matches the target graphic in shape and structure, and complies with the physical rules of the real world to ensure feasibility. The system will optimize and adjust the results of the preliminary matching according to the physical rules of the real world, such as the minimum turning radius and avoiding edge crossings, to ensure that the final generated movement route is both beautiful and practical. This movement route meets the movement needs described by the user through the target graphic. It is an intuitive and highly interesting movement route that allows users to exercise through navigation and other methods, such as running, cycling, sailing, driving, etc.
[0087] Based on matching the graphic path of the target graphic and the road set of the target map, a movement route of the target graphic on the target map is generated. One optional method is: based on the graphic path of the target graphic and the road set of the target map, geometric similarity matching is performed to generate the movement route of the target graphic on the target map. Another optional method is: using a graph theory algorithm, based on the graphic path of the target graphic and the road set of the target map, path planning is performed to generate the movement route of the target graphic on the target map. This is not limited here.
[0088] For example, geometric similarity matching is performed based on the four image paths and the road set of the target map that the running enthusiast needs to run, and a movement route of the hand-drawn graphic (number "2024") on the target map is generated, such as Figure 5 shown. Figure 5 A schematic diagram showing a motion route of a motion route generation method provided by an embodiment of the present application is shown:
[0089] From the starting point, the route first moves upward and to the right along a road, forming the first part of the number "2".
[0090] The route then turns to the left and continues to move upward, forming the shape of the number "0".
[0091] The route then turns right again and moves downward, forming the shape of a second number "2".
[0092] Finally, the route moves to the upper right, forming the shape of the number "4" and reaches the end point.
[0093] The user sets the exercise route as the route to be run on the sports and fitness application and navigates. After the run is completed, the route can be recorded and shared on social software, which is highly interesting.
[0094] In the embodiment of the present application, a graphic instance segmentation model is used to intelligently analyze the complex hand-drawn graphics drawn by the user on the front end based on the graphic features of the target graphics, and accurately identify and segment at least one independent graphic instance. Key points are extracted from each accurately segmented graphic instance, and a graph structure based on the key points is constructed to generate a graphic path, which improves the flexibility and accuracy of path generation and ensures that a fine and reasonable path representation can be obtained even for complex graphics. The generated graphic path is matched with the road set on the target map to improve the accuracy and practicality of the path conversion, so that the final generated motion route is both in line with the user's intention and can be used in practice. The motion route is generated through an interactive form drawn by the front end, which not only makes the motion route generation intuitive and highly interesting, but also accurately restores the spatial structure of the hand-drawn graphics at both the instance level and the path level, ensuring that the generated motion route meets the user's drawing intention and improves the accuracy of motion route generation.
[0095] In an optional embodiment of the present application, step 102 includes the following specific steps:
[0096] Get the original graphics drawn by the user on the front end;
[0097] The original graphics are preprocessed to obtain the target graphics, wherein the preprocessing includes at least one of filtering and noise reduction processing, graphics instance binarization processing, and graphics morphology processing.
[0098] The original graphics are hand-drawn graphics drawn directly by the user on the front-end interface, and the original graphics have not been preprocessed. Due to the influence of factors such as the user's hand-drawing habits or device resolution, the original graphics may contain unnecessary details or errors, and may retain noise, irregular lines and other defects, so further preprocessing is required to improve the accuracy of subsequent analysis.
[0099] Filtering and denoising is an image processing technique that aims to reduce the noise in the original image while keeping the main features of the image as unchanged as possible. For hand-drawn graphics, filtering and denoising can improve the image quality and make subsequent segmentation, recognition and other operations more accurate. Filtering and denoising include but are not limited to: mean filtering, median filtering and adaptive Gaussian filtering.
[0100] Graphic instance binarization is the process of converting a multi-grayscale image into a grayscale image with only two grayscale levels, namely black and white. It is usually used to simplify the image structure for subsequent processing. Binarization can distinguish the foreground (non-zero pixels) from the background (zero pixels) by setting a threshold. Graphic instance binarization includes but is not limited to: OTSU algorithm.
[0101] Graphics morphological processing is an operation based on set theory, which is used to change the shape characteristics of an image, such as dilation, erosion, opening and closing operations, etc. The purpose is to optimize the outline of the image, connect breakpoints or smooth the boundaries. Graphics morphological processing can help clean up small objects in the image, fill holes, connect separated parts, and smooth the image boundaries, thereby enhancing the structure and coherence of the image, and is suitable for the standardization of hand-drawn graphics. For example, applying morphological operations to optimize the outline of the image includes thinning and connecting breakpoints.
[0102] Exemplarily, an adaptive Gaussian filter (AGF) is used, the parameters of which are dynamically adjusted according to the input image quality, and the filter strength is adjusted according to the local characteristics around each pixel, thereby effectively removing noise and retaining edge information, ensuring that the key features of the hand-drawn graphics are preserved.
[0103] Exemplarily, after the OTSU algorithm is applied to binarize the hand-drawn graphics, all pixels belonging to the hand-drawn part are marked as white (foreground), and the remaining background area is marked as black, thereby improving the adaptability to different hand-drawn strengths.
[0104] Exemplarily, a morphological closing operation is used to connect broken line segments in a hand-drawn graphic to make the hand-drawn graphic more complete.
[0105] In the embodiment of the present application, by preprocessing the original graphics, the structure and coherence of the graphics are enhanced, and the accuracy of subsequent graphic instance segmentation and path generation is greatly improved, so that the final generated motion route is more in line with the user's intention, and the accuracy and feasibility of motion route generation are improved.
[0106] In an optional embodiment of the present application, before step 104, the following specific steps are also included:
[0107] Perform multi-view transformation on the target graphic to obtain multiple transformed graphics;
[0108] Using the visual processing model, extracting features from the target graphic to obtain first graphic features, and using the visual processing model, extracting features from the plurality of transformed graphics to obtain a plurality of second graphic features;
[0109] Determining a loss value based on the first graphical feature and the plurality of second graphical features;
[0110] Based on the loss value, the model parameters of the visual processing model are adjusted to obtain a graphic instance segmentation model.
[0111] The transformed graph is a graph obtained by geometrically transforming the target graph. The transformed graph can change the posture or size of the target graph, but does not change its basic shape. The transformed graph and the target graph constitute the sample data for the training model.
[0112] The visual processing model is a machine learning model with visual data processing capabilities. The visual processing model does not yet have the ability to segment graphic instances, and training is required to learn the ability to segment graphic instances. The visual processing model can be a CNN model, a U-NET model, a ViT model, and other models and corresponding improved models, which are not limited here.
[0113] The model parameters of the visual processing model are the adjustable weights, biases and other hyperparameters of the visual processing model, which directly affect the model's ability to learn the input data and the final performance. During training, the model parameters are updated through the back propagation algorithm so that the model can better fit the training data.
[0114] The first graphic feature is a feature coding vector extracted from the target graphic, which characterizes the main visual attributes and spatial structure information of the target graphic. The second graphic feature is a feature coding vector extracted from the transformed graphic, which characterizes the main visual attributes and spatial structure information of the transformed graphic. The first graphic feature and the second graphic feature are the predicted labels (soft labels) of the visual processing model for different inputs and outputs.
[0115] The loss value is a value that measures the difference between the first graphic feature and the plurality of second graphic features.
[0116] Perform multi-perspective transformation on the target graphic to obtain multiple transformed graphics. An optional method is to perform multi-perspective rotation and translation operations on the target graphic to obtain multiple transformed graphics. For example, the target graphic can be rotated at a random angle in the range of 0 to 360 degrees, and random translation can be applied on the x and y axes of the image to ensure that the generated transformed graphics have different visual appearances from the original graphics. Another optional method is to perform multi-perspective scaling and shearing transformation on the target graphic to obtain multiple transformed graphics, for example, applying scale changes and shearing transformations. By randomly scaling the proportions of the target graphic, or applying shear deformation at a certain angle, the diversity of the transformed graphics can be further increased while keeping the basic shape unchanged, which is not limited here.
[0117] Based on the first graphic feature and multiple second graphic features, a loss value is determined. An optional method is: based on the first graphic feature and multiple second graphic features, a contrast loss is calculated to obtain a loss value. For example, the similarity between the feature representation of each transformed graphic (i.e., the second graphic feature) and the feature representation of the original target graphic (i.e., the first graphic feature) is calculated, and the similarity between the positive sample pairs (different transformations of the same graphic) is maximized, and the similarity between the negative sample pairs (different graphics) is minimized. Another optional method is: based on the first graphic feature and multiple second graphic features, an asymmetric loss function is calculated to obtain a loss value. For example, the loss value includes two components, one is the cross entropy loss between the soft labels generated by the teacher model and the prediction results of the student model; the other is the cross entropy loss of the student model's own prediction results after temperature scaling. This prompts the student model to learn the knowledge of the teacher model, and the teacher model is an exponential moving average version of the student model, which is continuously updated to stabilize its output, which is not limited here.
[0118] Based on the loss value, the model parameters of the visual processing model are adjusted. Specifically, based on the loss value, the model parameters of the visual processing model are adjusted by using a gradient descent method.
[0119] For example, for a hand-drawn number "2024", the graphic can be rotated at random angles (such as 30 degrees, 60 degrees, 90 degrees, etc.), and different translations can be applied along the x-axis and y-axis to ensure that the generated transformed graphic has a different visual appearance from the original graphic. Random scaling (such as enlarging or reducing the ratio by 0.8 to 1.2) and shearing transformation (shearing at a certain angle) can also be applied to the graphic to further increase the diversity of the transformed graphic while keeping its basic shape unchanged.
[0120] The pre-trained ViT model is used as the visual processing model. First, the original target image is input into the ViT model as the student model, and the first graphic features representing the main visual attributes and spatial structure information of the image are extracted through modules such as convolutional layers and self-attention mechanisms. Then, all the transformed images created above are input into the same ViT model as the teacher model to obtain the second graphic features corresponding to each transformed image.
[0121] Calculate the cross entropy loss between the first graphic feature output by the student model and the second graphic feature output by the teacher model. According to the calculated loss value, use the gradient descent method to update the parameters of the visual processing model used as the student model until a trained graphic instance segmentation model is obtained.
[0122] In the embodiment of the present application, an effective unsupervised graphic instance segmentation method is implemented by introducing multi-view transformation and contrast learning mechanism, which improves the learning efficiency and stability of the model. This strategy not only reduces the dependence on expensive annotated data, but also improves the generalization ability and accuracy of the model in complex hand-drawn graphic recognition tasks, effectively adapts to the segmentation needs of various graphic instances, and is suitable for personalized hand-drawn graphics that lack a large amount of annotated data. It significantly reduces the cost of model training and improves practicality.
[0123] In an optional embodiment of the present application, step 104 includes the following specific steps:
[0124] Using the graphic instance segmentation model, feature extraction is performed on the target graphic to obtain the graphic features of the target graphic;
[0125] Performing feature aggregation on graphic feature units in the graphic features of the target graphic to obtain multiple visual entities;
[0126] Taking multiple visual entities as vertices, visual space distances between the multiple visual entities as edges, and a target smoothing function as a target, multiple visual entities are instance-divided to obtain at least one graphic instance.
[0127] Graphic feature units are feature encoding vector representations used to characterize visual blocks in target graphics. These vectors can be regarded as local feature descriptors of target graphics. In the graphic instance segmentation model, the target graphics are divided into fixed-size blocks and converted into feature vectors, i.e., graphic feature unit tokens, through linear projection. For example, in a hand-drawn graphic of the number "2024", the entire graphic may be divided into small blocks of 16x16 pixels, each of which is converted into a 512-dimensional feature vector, becoming a graphic feature unit.
[0128] A visual entity is a specific area with a specific meaning extracted from a target graphic. In graphic features, it is usually composed of a group of related graphic feature units. Each visual entity represents a set of pixels composed of a series of continuous and adjacent graphic feature units. They represent significant structures or objects in the image. Visual entities can be obtained by clustering analysis of graphic feature units, or they can be directly identified by a pre-trained segmentation model. For example, for the hand-drawn number "2024", after instance segmentation, multiple visual entities can be obtained: a circle, a hook, and a straight line, which correspond to the top, middle, tail, left arc, and right arc of "2", and the left half and right half of "0", respectively.
[0129] The visual space distance between multiple visual entities is the relative position relationship between visual entities in the visual space, which is usually quantified by Euclidean distance or other geometric metrics. This distance metric can help determine the topological relationship between visual entities, such as adjacency or connectivity, so as to build a more accurate graph structure for path planning. It can also be used to evaluate the similarity and degree of association between visual entities. For example, the visual space distance between the top and the middle of "2" is small, indicating that they are closely connected and may be connected by a short and smooth curve. The distance between the tail of "2" and the left half of "0" is large, indicating that there is a clear separation between the two. The distance between the left and right halves of "0" is moderate and usually maintains a consistent distance, which reflects the characteristics of a circular structure and can be connected by a smooth arc.
[0130] The target smoothing function is an energy function used to measure the instance segmentation result when performing instance segmentation. The target smoothing function is used to ensure that the boundaries between the segmented graphic instances are smooth and natural, thereby improving the quality of the segmentation result. This function usually considers the visual space distance between visual entities and their feature similarity, and is implemented through some form of energy minimization or optimization process. For example, the TokenCut algorithm, the Conditional Random Fields (CRF) algorithm, and the Mean Shift algorithm.
[0131] Feature aggregation is performed on the graphic feature units in the graphic features of the target graphic to obtain multiple visual entities. One optional method is to use a clustering algorithm (such as K-means) to feature aggregate the graphic feature units in the graphic features of the target graphic. Another optional method is to use a graph convolutional network (GCN) to feature aggregate the graphic feature units in the graphic features of the target graphic. Another optional method is to use an attention mechanism (Attention) to feature aggregate the graphic feature units in the graphic features of the target graphic, which is not limited here.
[0132] Exemplarily, the K-means algorithm is used to perform feature aggregation on the graphic feature units in the graphic features of the target graphic to obtain multiple visual entities; a circle, a hook, and a straight line correspond to the top, middle, tail, left arc, and right arc of "2", respectively, corresponding to the left half and right half of "0", respectively; a circle, a hook, and a straight line correspond to the top, middle, and tail of "2", respectively; a hook and a straight line correspond to the left half and right half of "4", respectively. With multiple visual entities as vertices and the visual space distance between multiple visual entities as edges, the optimal cutting scheme is found through the minimum cut / maximum flow algorithm to ensure that the total visual space distance of the cut edges is minimized, and 4 instances are segmented from the hand-drawn graphic and the number "2024", respectively: Instance 1: a set of pixels corresponding to the number "2". Instance 2: a set of pixels corresponding to the number "0". Instance 3: a set of pixels corresponding to the number "2". Instance 4: a set of pixels corresponding to the number "4".
[0133] In the embodiment of the present application, more accurate instance boundary division is achieved from the granularity of the graphic feature unit, and at least one independent graphic instance is more accurately identified and segmented, providing a clearer graphic instance data basis for the subsequent generation of the graphic path.
[0134] In an optional embodiment of the present application, multiple visual entities are used as vertices, visual space distances between multiple visual entities are used as edges, and a target smoothing function is used as a target, and multiple visual entities are instance-divided to obtain at least one graphic instance, including the following specific steps:
[0135] Taking multiple visual entities as vertices, taking visual space distances between the multiple visual entities as edges, and taking a target smoothing function as a target under the constraints of geometric rules, the multiple visual entities are instanced and divided to obtain at least one graphic instance.
[0136] Geometric rules are constraints used to constrain the geometric shapes of the divided graphic instances when performing instance division. Geometric rules ensure that the graphic instances conform to the physical rules of the real world. For example, "0" needs to be closed and have an arc, not an opening, or partly an arc and partly a straight line.
[0137] Exemplarily, taking multiple visual entities as vertices and the visual space distances between multiple visual entities as edges, under the constraints of geometric rules (sealing is prioritized, no partial arcs or partial straight lines appear, but continuous curves should be maintained, sharp corners should be avoided, and smooth transitions should be ensured within each graphic instance and between instances), the optimal cutting scheme is found through the minimum cut / maximum flow algorithm to ensure that the total visual space distance of the cut edges is minimized, and 4 instances are segmented from the hand-drawn graphic and the number "2024", namely: Instance 1: a set of pixels corresponding to the number "2". Instance 2: a set of pixels corresponding to the number "0". Instance 3: a set of pixels corresponding to the number "2". Instance 4: a set of pixels corresponding to the number "4".
[0138] In the embodiment of the present application, geometric constraint rules are introduced to ensure the rationality of the segmentation results, more accurately identify and segment at least one independent graphic instance, and provide a clearer graphic instance data basis for the subsequent generation of graphic paths.
[0139] In an optional embodiment of the present application, extracting key points from at least one graphic instance in step 106 includes the following specific steps:
[0140] For the boundary pixels of any graphic instance, count the number of non-zero pixels in the neighborhood of the boundary pixels;
[0141] When the number of non-zero pixels does not reach a preset threshold, converting the non-zero pixels into zero pixels;
[0142] Update the boundary pixels, return to execute the step of counting the number of non-zero pixels in the neighborhood of the boundary pixels of any graphic instance, until the preset iteration end condition is reached, and determine the key points on at least one graphic instance based on the non-zero pixels.
[0143] Boundary pixels are pixels located at the edge of a graphics instance. Boundary pixels have at least one neighboring pixel that is a zero pixel (background pixel), that is, they are at the junction between the foreground and the background. Boundary pixels identify the outline of an object or area. For hand-drawn graphics, boundary pixels help determine the shape and size of the graphics and are the basis for subsequent refinement and key point extraction. For example, in a binary graphics instance, all black pixels along the edge of the instance (assuming they are represented by 1) are boundary pixels because they are surrounded by white pixels (assuming they are represented by 0 for the background).
[0144] A neighborhood is a set of a fixed number of adjacent pixels surrounding a pixel. Common neighborhood types include 4-neighborhoods (four directions: up, down, left, and right) and 8-neighborhoods (eight directions including the diagonal direction). During the refinement process, the neighborhood is used to evaluate the status of the current pixel and its surrounding pixels to decide whether the pixel should be deleted. By checking the distribution of pixels in the neighborhood, it can be determined whether a pixel belongs to a key point that needs to be retained. For example, a boundary pixel P and the pixels in its 8-neighborhood. If multiple pixels in the neighborhood of boundary pixel P are also boundary pixels, the boundary pixel P will not be deleted (converted to zero pixels).
[0145] Non-zero pixels are pixels with non-zero grayscale values or color intensities, usually representing foreground objects or specific features in the image. For thinning algorithms, non-zero pixels make up the bulk of the image. Zero pixels are pixels with zero grayscale values or color intensities, usually representing background areas in an image. Zero pixels are not changed during thinning operations, but their presence affects the state of other pixels in the neighborhood. For example, in a black and white hand-drawn image, all the lines are made up of non-zero pixels, while the white background is made up of zero pixels.
[0146] The preset iteration end condition is the criterion for ending the iteration of the thinning algorithm. When this condition is met, further operation stops. This condition can be set based on various factors, such as the number of iterations, the number of remaining pixels that can be deleted, etc. For example, when there are no more pixels that can be converted to zero pixels, or when the predetermined maximum number of iterations is reached, the thinning process stops.
[0147] Exemplarily, for the four segmented graphic instances, for the boundary pixels of any graphic instance, the number of non-zero pixels in the neighborhood of the boundary pixels is counted. When the number of non-zero pixels does not reach a preset threshold ([3, 6]), the non-zero pixels are converted to zero pixels, the boundary pixels are updated, and the step of counting the number of non-zero pixels in the neighborhood of the boundary pixels of any graphic instance is returned until no more pixels can be converted to zero pixels. Based on the non-zero pixels, the key points on the four graphic instances are determined, such as Figure 4 As shown by the black dots in .
[0148] In the embodiment of the present application, a refinement algorithm is applied to effectively extract key points from complex graphic instances while retaining the main topological features of the graphics, ensuring the accuracy of the shape and structure, providing more accurate data support for the subsequent generation of graphic paths, ensuring that a more refined and reasonable path representation can be obtained even for complex graphics, and providing a more accurate and coherent graphic path data foundation for the subsequent generation of the movement route of the target graphics on the target map.
[0149] In an optional embodiment of the present application, determining a key point on at least one graphic instance based on non-zero pixels includes the following specific steps:
[0150] From the non-zero pixels, the non-zero pixels located at the intersection and the endpoints are determined as key points on at least one graphic instance.
[0151] The non-zero pixels at the intersection are non-zero pixels at the intersection of multiple pixel line segments in the graphic instance. These non-zero pixels usually represent important connection points in the graphic structure.
[0152] The non-zero pixels at the endpoints are non-zero pixels at the endpoints of any pixel-constituting line segments in the graphics instance. These non-zero pixels mark the start or end point of a line segment.
[0153] For example, for the four graphic instances, the non-zero pixels located at the intersections and endpoints are determined as key points on the four graphic instances, such as Figure 4 As shown by the black dots in .
[0154] In the embodiment of the present application, the core structural features of the graphic instance are effectively captured by accurately extracting intersections and endpoints and identifying non-zero pixels at intersections and endpoints as key points. This not only simplifies the graphic representation and reduces data redundancy, but also improves the accuracy and efficiency of subsequent path generation.
[0155] In an optional embodiment of the present application, in step 106, based on a graph structure with key points as vertices and connections between key points as edges, generating a graphic path of the target graph includes the following specific steps:
[0156] The graph structure is constructed with key points as vertices and the connections between key points as edges;
[0157] Determine a starting vertex from a first vertex of the graph structure, wherein the first vertex is any vertex in the graph structure;
[0158] Mark any edge connected to the starting vertex as visited, delete the edge marked as visited, update the connecting vertex of the edge to the starting vertex, return to execute the step of marking any edge connected to the starting vertex as visited, until the connecting vertex of the edge is the first vertex, and connect the edges marked as visited into a graph path;
[0159] Return to the step of marking any edge connected to the starting vertex as visited until the number of edges connected to the starting vertex is zero, and delete the first vertex;
[0160] Return to the step of determining the starting vertex from the first vertex of the graph structure until no vertex exists in the graph structure, and obtain the graph path of the target graph.
[0161] The starting vertex is the vertex selected as the starting point of path generation in the graph structure. In the motion route generation algorithm, the starting vertex is a vertex randomly selected from the graph structure (consisting of key points as vertices and connections between key points as edges) to start the path exploration process.
[0162] The edges of the starting vertex are the edges directly connected to the starting vertex. These edges represent other vertices that can be directly reached from the starting vertex. They are the first edges considered during the path generation process to decide which direction to go next.
[0163] Visited edges are edges that have been selected and processed during the path generation process. When an edge is marked as visited, it means that the edge has been included in the path currently being built and no longer needs to be considered or processed again. This is to avoid repeatedly covering the same path and ensure the rationality of path planning.
[0164] The connecting vertex of an edge is another vertex that an edge connects to, except the starting vertex. Whenever an edge is visited, its connecting vertex becomes the new starting vertex to continue the path construction. This helps to gradually build a complete path until all necessary edges have been visited.
[0165] Figure 6 A schematic diagram of an Euler path of a motion route generation method provided by an embodiment of the present application is shown. Figure 6 As shown:
[0166] The graph structure is constructed with 6 key points as vertices and the connections between the 6 key points as edges.
[0167] Select Vertex 1 as the starting vertex.
[0168] For Euler path 1:
[0169] Starting vertex: 1. Connecting edges: 1->2. Update starting vertex: 2. Connecting edges: 2->3. Update starting vertex: 3. Connecting edges: 3->4. Update starting vertex: 4. Connecting edges: 4->5. Update starting vertex: 5. Connecting edges: 5->1. Update starting vertex: 1. Complete path: 1->2->3->4->5->1.
[0170] For Euler path 2:
[0171] Starting vertex: 1. Connecting edges: 1->2. Update starting vertex: 2. Connecting edges: 2->3. Update starting vertex: 3. Connecting edges: 3->4. Update starting vertex: 4. Connecting edges: 4->5. Update starting vertex: 5. Connecting edges: 5->1. Update starting vertex: 1. Complete path: 1->2->3->4->5->1.
[0172] For Euler path 3:
[0173] Starting vertex: 1. Connecting edges: 1->2. Update starting vertex: 2. Connecting edges: 2->3. Update starting vertex: 3. Connecting edges: 3->4. Update starting vertex: 4. Connecting edges: 4->5. Update starting vertex: 5. Connecting edges: 5->1. Update starting vertex: 1. Complete path: 1->2->3->4->5->1.
[0174] For Euler path 4:
[0175] Starting vertex: 1. Connecting edges: 1->2. Update starting vertex: 2. Connecting edges: 2->3. Update starting vertex: 3. Connecting edges: 3->4. Update starting vertex: 4. Connecting edges: 4->5. Update starting vertex: 5. Connecting edges: 5->1. Update starting vertex: 1. Complete path: 1->2->3->4->5->1.
[0176] For Euler path 5:
[0177] Starting vertex: 1. Connecting edges: 1->2. Update starting vertex: 2. Connecting edges: 2->3. Update starting vertex: 3. Connecting edges: 3->4. Update starting vertex: 4. Connecting edges: 4->5. Update starting vertex: 5. Connecting edges: 5->1. Update starting vertex: 1. Complete path: 1->2->3->4->5->1.
[0178] For Euler path 6:
[0179] Starting vertex: 1. Connecting edges: 1->2. Update starting vertex: 2. Connecting edges: 2->3. Update starting vertex: 3. Connecting edges: 3->4. Update starting vertex: 4. Connecting edges: 4->5. Update starting vertex: 5. Connecting edges: 5->1. Update starting vertex: 1. Complete path: 1->2->3->4->5->1.
[0180] For Euler path 7:
[0181] Starting vertex: 1. Connecting edges: 1->2. Update starting vertex: 2. Connecting edges: 2->3. Update starting vertex: 3. Connecting edges: 3->4. Update starting vertex: 4. Connecting edges: 4->5. Update starting vertex: 5. Connecting edges: 5->1. Update starting vertex: 1. Complete path: 1->2->3->4->5->1.
[0182] For Euler path 8:
[0183] Starting vertex: 1. Connecting edges: 1->2. Update starting vertex: 2. Connecting edges: 2->3. Update starting vertex: 3. Connecting edges: 3->4. Update starting vertex: 4. Connecting edges: 4->5. Update starting vertex: 5. Connecting edges: 5->1. Update starting vertex: 1. Complete path: 1->2->3->4->5->1.
[0184] Each of the above Euler paths starts from the starting vertex, passes through all edges only once, and finally returns to the starting vertex. This ensures the rationality of path planning and avoids repeatedly covering the same path.
[0185] In the embodiment of the present application, by constructing a graph structure with key points as vertices and connections between key points as edges, and using the Euler path algorithm to generate the graphic path of the target graph, the rationality and efficiency of path planning are ensured. Starting from the first vertex selected arbitrarily, the visited edges are gradually marked and deleted, and the starting vertex is updated until all necessary edges are visited and the Euler path is formed. This process effectively avoids the generation of duplicate paths, achieves complete coverage of the entire graph structure, ensures the continuity and integrity of the path, and improves the efficiency of path planning, so that the obtained target graphic path is not only feasible, but also can meet the optimization path requirements under specific conditions, such as motion route planning.
[0186] In an optional embodiment of the present application, step 108 includes the following specific steps:
[0187] Under the constraints of instance spatial relationship and path spatial relationship, the movement route of the target graphic on the target map is generated by matching the graphic path of the target graphic with the road set of the target map.
[0188] If the constraints of instance spatial relationships are not considered, the logical order between graphic instances may be confused: for example, in a hand-drawn graphic, the user draws the number "2024", but if the constraints of instance spatial relationships are not followed, these number instances may be mistakenly arranged in an incorrect order. For example, when generating a motion route, it may become "4202", resulting in the final generated motion route not being consistent with the user's intention. If the constraints of path spatial relationships are not considered, the relative positions of graphic instances may be misplaced: if the relative positions between instances are ignored, then when matching the road set on the target map, graphic instances that should be closely connected or arranged in a specific order may be mistakenly placed far away from each other, destroying the integrity and coherence of the graphic. For example, two graphic instances that should be adjacent (such as "2" and "0") may be separated far apart on the actual map.
[0189] Instance space relations are the relative positions and relationships between graphic instances. Instance space relations describe how graphic instances are distributed in visual space and the connections or interactions between them. Instance space relations are very important for understanding the overall structure of hand-drawn graphics. It can help algorithms identify which graphic instances should be grouped together to form a larger whole, or determine the logical order between different graphic instances. For example, in a hand-drawn graphic, each number in the number "2024" can be regarded as an independent graphic instance, and the order in which they are arranged constitutes part of the instance space relations.
[0190] The path spatial relationship is the spatial relationship of the graph structure composed of key points and edges, specifically how the nodes (key points) and edges (connections between key points) on the graph path are organized to ensure the coherence and rationality of the path. The path spatial relationship ensures that the generated motion route meets the user's intention and can be actually applied to the target map. It takes into account whether each part of the path is coherent, whether there are disconnections or jumps, and whether the path complies with the physical rules of the real world, such as the minimum turning radius of the road.
[0191] Under the constraints of instance spatial relationship and path spatial relationship, the graphic path of the target graphic and the road set of the target map are matched to generate the movement route of the target graphic on the target map. One optional method is: under the constraints of instance spatial relationship and path spatial relationship, geometric similarity matching is performed based on the graphic path of the target graphic and the road set of the target map to generate the movement route of the target graphic on the target map. Another optional method is: under the constraints of instance spatial relationship and path spatial relationship, path planning is performed based on the graphic path of the target graphic and the road set of the target map using graph theory algorithm to generate the movement route of the target graphic on the target map. No limitation is made here.
[0192] Exemplarily, under the constraints of instance spatial relationship (i.e., the relative position and logical order between each digit of the number "2024" as an independent graphic instance) and path spatial relationship (i.e., the spatial relationship of the graph structure composed of key points and edges within each number to ensure path consistency and rationality), geometric similarity matching is performed based on 4 image paths (corresponding to the paths of the numbers "2", "0", "2", and "4" in the hand-drawn graphics) and the road set of the target map that running enthusiasts need to run, to generate the movement route of the hand-drawn graphics (the number "2024") on the target map.
[0193] In the embodiment of the present application, by combining the dual constraints of instance spatial relationship and path spatial relationship, hand-drawn graphics can be accurately converted into practical and feasible motion routes, which not only ensures that the logical order between graphic instances is correct, but also ensures that the relative positions of each instance on the target map are reasonable and coherent, avoiding possible confusion or dislocation problems.
[0194] In an optional embodiment of the present application, after step 104, the following specific steps are also included:
[0195] An instance spatial relationship between at least one graphics instance is determined based on the visual spatial position of at least one graphics instance.
[0196] The visual spatial location of a graph instance includes, but is not limited to, recording information such as relative position and connection relationships to ensure that the relationships between graph instances and their roles in the entire graph can be accurately understood. To achieve this, instance spatial relationships use a graph structure to store topological information, where each graph instance is represented as a node and the connections between them are represented by edges. This representation method not only helps capture the static layout of graph instances, but also can express the dynamic interaction patterns between instances.
[0197] Optionally, in order to further optimize the process of determining the instance spatial relationship, evaluation indicators of the instance spatial relationship are calculated and maintained. These evaluation indicators are intended to quantify the quality of the segmentation results and ensure that the original design intent is not destroyed during the processing. For example, the evaluation indicators can include multiple dimensions such as connectivity, compactness, and consistency. By continuously monitoring the changes in these indicators, the algorithm can reasonably segment and reorganize the graphic instances while ensuring the correctness of the graphic logic, so as to better adapt to the subsequent matching needs with the target map road set.
[0198] For example, when a user draws the number "2024", each individual number ("2", "0", "2", "4") is first identified as an independent graphic instance, and their visual spatial positions, that is, their relative positions to each other and possible connections, are recorded. Subsequently, a graph structure is constructed to represent the instance spatial relationship of these instances, ensuring that the logical order and spatial layout of "2024" are preserved.
[0199] In the embodiment of the present application, by constructing instance spatial relationships to store topological information between graphic instances, the logical order and spatial layout of the hand-drawn graphics are accurately preserved during the conversion process, ensuring that the generated motion route restores the user's original design intent and improving the accuracy and consistency of path planning.
[0200] In an optional embodiment of the present application, after step 106, the following specific steps are also included:
[0201] Based on the visual space positions of the graphic paths of the target graphic, a path space relationship between the graphic paths is determined.
[0202] The visual spatial location of the graphic path includes but is not limited to recording the spatial distribution of key points and edges, the connection method, and the direction of the path to ensure that the coherence and rationality between the path segments can be accurately captured. To achieve this, the path space relationship uses a graph structure to store topological information, where each key point is represented as a node and the connection between key points is represented by an edge. This representation method not only helps capture the static structure inside the graphic path, but also can express the dynamic transition mode between paths.
[0203] Optionally, in order to further optimize the process of determining the path spatial relationship, the evaluation indicators of the path spatial relationship are calculated and maintained. These evaluation indicators are intended to quantify the quality of path planning and ensure that the original design intent is not destroyed during the processing. For example, the evaluation indicators can include multiple dimensions such as path coherence, reasonable turning radius, and avoiding disconnection or jump. By continuously monitoring the changes in these indicators, the graphic path can be reasonably smoothed and optimized while ensuring the correctness of the path logic, so as to better meet the needs of subsequent matching with the target map road set.
[0204] For example, when a user draws the number "2024" by hand, the corresponding graphic paths are generated according to each graphic instance. The spatial distribution of the key points and edges of these paths, as well as the connection between them, are analyzed to construct a graph structure to represent the path spatial relationship. Subsequently, a graph structure is constructed to represent the path spatial relationship of these paths to ensure that the logical order and path dependency within "2024" are preserved.
[0205] In the embodiment of the present application, by constructing a path space relationship to store the topological information between graphic paths, the continuity and rationality of the graphic paths are ensured, disconnection or jumping on the paths are avoided, and the generated motion routes are guaranteed to restore the original design intent of the user while complying with the physical rules of the real world, thereby improving the accuracy and feasibility of path planning.
[0206] In summary, Figure 7 A schematic diagram of a flow chart of a method for generating a motion route provided by an embodiment of the present application is shown. Figure 7 As shown:
[0207] Get the original graphics drawn by the user on the front end.
[0208] Preprocess the original graphics to obtain the target graphics.
[0209] At least one graphic instance is segmented from the target graphic based on the graphic features of the target graphic.
[0210] For a single graphic instance, add to the graphic instance group.
[0211] For multiple graphic instances, they are added to the graphic instance group, and based on the visual space positions of the multiple graphic instances, the instance space relationship between the multiple graphic instances is determined.
[0212] Based on the graph structure with key points as vertices and connections between key points as edges, the Euler path of the target graph is generated.
[0213] For a single Euler path, add to the Euler path group.
[0214] For multiple Euler paths, they are added to the Euler path group, and based on the visual space positions of the multiple Euler paths, the path space relationship between the multiple Euler paths is determined.
[0215] Under the constraints of instance spatial relationship and path spatial relationship, the Euler path of the target graph and the road set of the target map are matched to generate the movement route of the target graph on the target map.
[0216] The above three-stage motion route generation method decomposes complex hand-drawn graphics into a set of executable paths while maintaining the spatial relationship between graphic elements, ensuring that the final motion route is both faithful to the original graphics drawn by the user and can be reasonably applied in the actual environment to meet actual execution needs.
[0217] The following combination Figure 8 Taking the application of the motion route generation method provided by the present application to a running route as an example, the motion route generation method is further described. Figure 8 A processing flow chart of a motion route generation method for a running route provided by an embodiment of the present application is shown, which specifically includes the following steps:
[0218] Step 802: Obtain the original hand-drawn graphics drawn by the user on the front end of the running application.
[0219] Step 804: gradually perform filtering and noise reduction processing, graphic instance binarization processing and graphic morphology processing on the original hand-drawn graphic to obtain an optimized hand-drawn graphic.
[0220] Step 806: Perform multi-perspective transformation on the optimized hand-drawn graphics to obtain multiple transformed graphics, use the ViT model to extract features of the optimized hand-drawn graphics to obtain first graphic features, and use the ViT model to extract features of the multiple transformed graphics to obtain multiple second graphic features, determine a loss value based on the first graphic features and the multiple second graphic features, adjust model parameters of the ViT model based on the loss value, and obtain a graphic instance segmentation model.
[0221] Step 808: Utilize the graphic instance segmentation model to perform feature extraction on the optimized hand-drawn graphic to obtain graphic features of the optimized hand-drawn graphic, perform feature aggregation on the graphic feature units in the graphic features of the optimized hand-drawn graphic to obtain multiple visual entities, use the multiple visual entities as vertices, use the visual space distances between the multiple visual entities as edges, perform instance division on the multiple visual entities under the constraints of geometric rules and with a target smoothing function as a target, obtain at least one graphic instance, and determine the instance space relationship between at least one graphic instance based on the visual space position of the at least one graphic instance.
[0222] Step 810: For the boundary pixels of any graphic instance, count the number of non-zero pixels in the neighborhood of the boundary pixels. If the number of non-zero pixels does not reach a preset threshold, convert the non-zero pixels into zero pixels, update the boundary pixels, and return to execute the step of counting the number of non-zero pixels in the neighborhood of the boundary pixels of any graphic instance until the preset iteration end condition is reached, and determine from the non-zero pixels, the non-zero pixels located at the intersection and the endpoint as the key points on at least one graphic instance.
[0223] Step 812: Construct a graph structure with key points as vertices and connections between key points as edges, determine a starting vertex from the first vertex of the graph structure, mark any edge connected to the starting vertex as visited, delete the edge marked as visited, update the connecting vertex of the edge to the starting vertex, return to execute the step of marking any edge connected to the starting vertex as visited, until the connecting vertex of the edge is the first vertex, connect the edges marked as visited as a graphic path, return to execute the step of marking any edge connected to the starting vertex as visited, until the number of edges connected to the starting vertex is zero, delete the first vertex, return to execute the step of determining the starting vertex from the first vertex of the graph structure, until the vertex does not exist in the graph structure, obtain the graphic path of the optimized hand-drawn graphic, and determine the path space relationship between the graphic paths based on the visual space position of the graphic path of the optimized hand-drawn graphic.
[0224] Step 814: Under the constraints of the instance spatial relationship and the path spatial relationship, the graphic path of the optimized hand-drawn graphic is matched with the road set of the target map to generate a running route of the optimized hand-drawn graphic on the target map.
[0225] Step 816: Feedback the running route to the front end of the running application so that the user can perform running exercises according to the running route.
[0226] In the embodiments of the present application, an unsupervised segmentation technology that does not require labeled data and a technology that maintains the spatial relationship of graphics at both the instance and path levels are used. This not only gets rid of the traditional method's reliance on a large amount of labeled data, reduces costs and improves the versatility and scalability of the system, but also ensures that the spatial characteristics of the original graphics can be accurately retained in the process from the user's hand-drawn graphics to the final running route generation, making the generated running route closer to the user's creative intentions, adding the function of personalized route creation, improving the fun and interactivity of the user experience, promoting the user's continued participation and application activity, while also enriching the user-generated content and improving the user experience.
[0227] Corresponding to the above method embodiment, the present application also provides a motion route generation device embodiment, Fig. 9 FIG. 1 is a schematic diagram showing the structure of a motion route generating device provided by an embodiment of the present application. Fig. 9 As shown, the device comprises:
[0228] An acquisition module 902 is configured to acquire a target graphic drawn by a user on the front end;
[0229] The segmentation module 904 is configured to segment at least one graphic instance from the target graphic based on the graphic features of the target graphic using the graphic instance segmentation model;
[0230] A path generation module 906 is configured to extract key points from at least one graphic instance, and generate a graphic path of a target graphic based on a graph structure with the key points as vertices and connections between the key points as edges;
[0231] The route generation module 908 is configured to generate a movement route of the target graphic on the target map based on matching the graphic path of the target graphic with the road set of the target map.
[0232] Optionally, the acquisition module 902 is further configured to:
[0233] The original graphics drawn by the user on the front end are obtained; the original graphics are preprocessed to obtain the target graphics, wherein the preprocessing includes at least one of filtering and noise reduction processing, graphics instance binarization processing, and graphics morphology processing.
[0234] Optionally, the device further comprises:
[0235] The model training module is configured to perform multi-view transformation on the target graphic to obtain multiple transformed graphics; use the visual processing model to extract features of the target graphic to obtain a first graphic feature, and use the visual processing model to extract features of the multiple transformed graphics to obtain multiple second graphic features; determine a loss value based on the first graphic feature and the multiple second graphic features; based on the loss value, adjust the model parameters of the visual processing model to obtain a graphic instance segmentation model.
[0236] Optionally, the segmentation module 904 is further configured to:
[0237] Using a graphics instance segmentation model, feature extraction is performed on a target graphic to obtain graphic features of the target graphic; feature aggregation is performed on graphic feature units in the graphic features of the target graphic to obtain multiple visual entities; with multiple visual entities as vertices, visual space distances between multiple visual entities as edges, and a target smoothing function as a target, multiple visual entities are instanced to obtain at least one graphic instance.
[0238] Optionally, the segmentation module 904 is further configured to:
[0239] Taking multiple visual entities as vertices, taking visual space distances between the multiple visual entities as edges, and taking a target smoothing function as a target under the constraints of geometric rules, the multiple visual entities are instanced and divided to obtain at least one graphic instance.
[0240] Optionally, the path generation module 906 is further configured to:
[0241] For the boundary pixels of any graphic instance, the number of non-zero pixels in the neighborhood of the boundary pixels is counted; when the number of non-zero pixels does not reach a preset threshold, the non-zero pixels are converted to zero pixels; the boundary pixels are updated, and the step of counting the number of non-zero pixels in the neighborhood of the boundary pixels of any graphic instance is returned to execute until a preset iteration end condition is reached, and based on the non-zero pixels, a key point on at least one graphic instance is determined.
[0242] Optionally, the path generation module 906 is further configured to:
[0243] From the non-zero pixels, the non-zero pixels located at the intersection and the endpoints are determined as key points on at least one graphic instance.
[0244] Optionally, the path generation module 906 is further configured to:
[0245] A graph structure is constructed with key points as vertices and connections between key points as edges; a starting vertex is determined from the first vertex of the graph structure, wherein the first vertex is any vertex in the graph structure; any edge connected to the starting vertex is marked as visited, and the edge marked as visited is deleted, the connecting vertex of the edge is updated to the starting vertex, and the step of marking any edge connected to the starting vertex as visited is returned until the connecting vertex of the edge is the first vertex, and the edges marked as visited are connected as a graph path; the step of marking any edge connected to the starting vertex as visited is returned until the number of edges connected to the starting vertex is zero, and the first vertex is deleted; the step of determining the starting vertex from the first vertex of the graph structure is returned until the vertex does not exist in the graph structure, and the graph path of the target graph is obtained.
[0246] Optionally, the route generation module 908 is further configured to:
[0247] Under the constraints of instance spatial relationship and path spatial relationship, the movement route of the target graphic on the target map is generated by matching the graphic path of the target graphic with the road set of the target map.
[0248] Optionally, the device further comprises:
[0249] The first relationship determination module is configured to determine an instance spatial relationship between at least one graphic instance based on a visual spatial position of at least one graphic instance.
[0250] Optionally, the device further comprises:
[0251] The second relationship determination module is configured to determine the path space relationship between the graphic paths based on the visual space position of the graphic path of the target graphic.
[0252] In the embodiment of the present application, a graphic instance segmentation model is used to intelligently analyze the complex hand-drawn graphics drawn by the user on the front end based on the graphic features of the target graphics, and accurately identify and segment at least one independent graphic instance. Key points are extracted from each accurately segmented graphic instance, and a graph structure based on the key points is constructed to generate a graphic path, which improves the flexibility and accuracy of path generation and ensures that a fine and reasonable path representation can be obtained even for complex graphics. The generated graphic path is matched with the road set on the target map to improve the accuracy and practicality of the path conversion, so that the final generated motion route is both in line with the user's intention and can be used in practice. The motion route is generated through an interactive form drawn by the front end, which not only makes the motion route generation intuitive and highly interesting, but also accurately restores the spatial structure of the hand-drawn graphics at both the instance level and the path level, ensuring that the generated motion route meets the user's drawing intention and improves the accuracy of motion route generation.
[0253] The above is a schematic scheme of a motion route generation device of this embodiment. It should be noted that the technical scheme of the motion route generation device and the technical scheme of the motion route generation method described above are of the same concept, and the details not described in detail in the technical scheme of the motion route generation device can be referred to the description of the technical scheme of the motion route generation method described above.
[0254] Fig.10 The structure block diagram of a computing device 1000 provided according to an embodiment of the present application is shown. The components of the computing device 1000 include but are not limited to a memory 1010 and a processor 1020. The processor 1020 is connected to the memory 1010 via a bus 1030, and the database 1050 is used to store data.
[0255] The computing device 1000 also includes an access device 1040, which enables the computing device 1000 to communicate via one or more networks 1060. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 1040 may include one or more of any type of network interface (e.g., a Network Interface Controller (NIC)) of wired or wireless, such as an IEEE 1002.11 Wireless Local Area Network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, and a Near Field Communication (NFC).
[0256] In one embodiment of the present application, the above components of the computing device 1000 and Fig.10 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig.10 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.
[0257] The computing device 1000 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 1000 may also be a mobile or stationary server.
[0258] The processor 1020 is used to execute the following computer program / instruction, which implements the steps of the above-mentioned motion route generation method when executed by the processor.
[0259] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned motion route generation method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned motion route generation method.
[0260] An embodiment of the present application further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned motion route generation method when executed by a processor.
[0261] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned motion route generation method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned motion route generation method.
[0262] An embodiment of the present application further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned motion route generation method when executed by a processor.
[0263] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned motion route generation method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned motion route generation method.
[0264] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0265] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the contents contained in the computer readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer readable media do not include electric carrier signals and telecommunication signals.
[0266] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described action sequence, because according to the embodiments of the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present application.
Claims
1. A method for generating a motion route, characterized in that: include: Get the target graphics drawn by the user on the front end; Using a graphic instance segmentation model, based on graphic features of the target graphic, segment at least one graphic instance from the target graphic; Extracting key points from the at least one graphic instance, and generating a graphic path of the target graphic based on a graph structure with the key points as vertices and connections between the key points as edges; Based on matching the graphic path of the target graphic and the road set of the target map, a movement route of the target graphic on the target map is generated.
2. The method according to claim 1, characterized in that: The step of obtaining the target graphic drawn by the user on the front end includes: Get the original graphics drawn by the user on the front end; The original graphics are preprocessed to obtain a target graphics, wherein the preprocessing includes at least one of filtering and noise reduction processing, graphics instance binarization processing, and graphics morphology processing.
3. The method according to claim 1, characterized in that Before segmenting at least one graphic instance from the target graphic based on the graphic features of the target graphic using the graphic instance segmentation model, the method further includes: Performing multi-view transformation on the target graphic to obtain multiple transformed graphics; Using the visual processing model, extracting features from the target graphic to obtain first graphic features, and using the visual processing model, extracting features from the plurality of transformed graphics to obtain a plurality of second graphic features; determining a loss value based on the first graphical feature and the plurality of second graphical features; Based on the loss value, the model parameters of the visual processing model are adjusted to obtain a graphic instance segmentation model.
4. The method according to claim 1 or 3, characterized in that: The step of using the graphic instance segmentation model to segment at least one graphic instance from the target graphic based on the graphic features of the target graphic comprises: Using a graphic instance segmentation model, extracting features of the target graphic to obtain graphic features of the target graphic; Performing feature aggregation on graphic feature units in the graphic features of the target graphic to obtain multiple visual entities; Taking the multiple visual entities as vertices, taking the visual space distances between the multiple visual entities as edges, and taking the target smoothing function as a target, the multiple visual entities are instance-divided to obtain at least one graphic instance.
5. The method according to claim 4, characterized in that The method of taking the multiple visual entities as vertices, taking the visual space distances between the multiple visual entities as edges, and taking the target smoothing function as a target, performing instance division on the multiple visual entities to obtain at least one graphic instance includes: Taking the multiple visual entities as vertices, taking the visual space distances between the multiple visual entities as edges, and taking the target smoothing function as a target under the constraints of geometric rules, the multiple visual entities are instanced to obtain at least one graphic instance.
6. The method according to claim 1, characterized in that The extracting key points from the at least one graphic instance comprises: For a boundary pixel of any graphic instance, count the number of non-zero pixels in the neighborhood of the boundary pixel; When the number of the non-zero pixels does not reach a preset threshold, converting the non-zero pixels into zero pixels; Update the boundary pixels, return to execute the step of counting the number of non-zero pixels in the neighborhood of the boundary pixels of any graphic instance, until a preset iteration end condition is reached, and determine the key points on the at least one graphic instance based on the non-zero pixels.
7. The method according to claim 6, characterized in that The determining, based on the non-zero pixels, a key point on the at least one graphic instance comprises: From the non-zero pixels, the non-zero pixels located at the intersection and the endpoint are determined as key points on the at least one graphic instance.
8. The method according to claim 1, characterized in that The step of generating a graphic path of the target graphic based on a graph structure with the key points as vertices and connections between the key points as edges comprises: Constructing a graph structure by using the key points as vertices and the connections between the key points as edges; Determine a starting vertex from a first vertex of the graph structure, wherein the first vertex is any vertex in the graph structure; Mark any edge connected to the starting vertex as visited, delete the edge marked as visited, update the connecting vertex of the edge to the starting vertex, return to execute the step of marking any edge connected to the starting vertex as visited, until the connecting vertex of the edge is the first vertex, and connect the edges marked as visited into a graphic path; Return to the step of marking any edge connected to the starting vertex as visited until the number of edges connected to the starting vertex is zero, and delete the first vertex; Return to the step of determining a starting vertex from the first vertex of the graph structure until no vertex exists in the graph structure, and obtain the graph path of the target graph.
9. The method according to claim 1, characterized in that: The step of matching the graphic path based on the target graphic with the road set of the target map to generate a movement route of the target graphic on the target map includes: Under the constraints of instance spatial relationship and path spatial relationship, matching is performed based on the graphic path of the target graphic and the road set of the target map to generate a movement route of the target graphic on the target map.
10. The method according to claim 8, characterized in that After segmenting at least one graphic instance from the target graphic based on the graphic features of the target graphic using the graphic instance segmentation model, the method further includes: An instance spatial relationship between the at least one graphics instance is determined based on the visual spatial position of the at least one graphics instance.
11. The method according to claim 8, characterized in that After extracting key points from the at least one graphic instance and generating a graphic path of the target graphic based on a graph structure with the key points as vertices and connections between the key points as edges, the method further includes: Based on the visual space positions of the graphic paths of the target graphics, a path space relationship between the graphic paths is determined.
12. A motion route generating device, characterized in that: include: An acquisition module is configured to acquire a target graphic drawn by a user on the front end; A segmentation module is configured to segment at least one graphic instance from the target graphic based on the graphic features of the target graphic by using a graphic instance segmentation model; a path generation module configured to extract key points from the at least one graphic instance, and generate a graphic path of the target graphic based on a graph structure with the key points as vertices and connections between the key points as edges; The route generation module is configured to generate a movement route of the target graphic on the target map based on matching the graphic path of the target graphic and the road set of the target map.
13. A computing device, characterized in that: include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the method described in any one of claims 1 to 11 are implemented.
14. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which implements the steps of the method described in any one of claims 1 to 11 when executed by a processor.
15. A computer program product, characterized in that The invention comprises a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.
Citation Information
Cited By
Carbon emission optimization-oriented muck disposal method and system
CN120373796A
A slag disposal method and system oriented to carbon emission optimization
CN120373796B
Routing tree construction method, communication method, program product, and electronic device
CN122293579A
Routing tree construction methods, communication methods, program products and electronic devices
CN122293579B