Electronic Fence Generation Method Based on Road Name Sequence Parsing
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-21
- Publication Date
- 2026-08-14
AI Technical Summary
[0005]本发明的目的在于克服现有技术的缺陷,提供一种基于路名序列解析的电子围栏生成方法,解决现有技术中如何将路名序列形式的监管指令自动、准确地转换为电子围栏的问题
1、实现路名序列到电子围栏的自动转换;本发明能够将道路名称顺序表示的路线指令,自动转换为连续网格轨迹和电子围栏,避免监管人员手动绘制围栏或逐段录入坐标点,提高通行路线配置效率。
Smart Images

Figure CN122575155A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart city governance technology, and specifically to a method for generating electronic fences based on road name sequence parsing. Background Technology
[0002] In the modern smart city governance system, controlling the routes of special vehicles such as hazardous chemical transport vehicles, dump trucks, and overweight logistics vehicles is an important task to ensure urban public safety and traffic order. To avoid densely populated areas and protect sensitive road sections, regulatory authorities usually implement a strict passage approval system. In actual operation, the issuance of permits is not based on GPS coordinates that are difficult to verify manually, but rather on road name topology sequences in the form of symbolic trajectories (such as "A Expressway - B Highway - C East Road"). This semantically based path description has advantages such as being easy to manually review and conforming to the logic of administrative divisions.
[0003] However, existing digital traffic monitoring methods (such as electronic fences) rely on detailed spatiotemporal geometric information, namely specific geographic coordinates or spatial grid ranges, in their underlying implementation. This technology paradigm, which is based on spatial geometry, is in a modal mismatch with the management instructions of regulatory departments based on road name semantics, making it difficult for administrative regulatory rules to be directly mapped into automated monitoring systems.
[0004] Therefore, how to automatically and accurately convert regulatory instructions in the form of road name sequences into electronic fences that can be used for vehicle monitoring is a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of the prior art and provide an electronic fence generation method based on road name sequence parsing, which solves the problem of how to automatically and accurately convert regulatory instructions in the form of road name sequences into electronic fences in the prior art.
[0006] To achieve the above objectives, this invention provides a method for generating electronic fences based on road name sequence parsing, comprising the following steps: Instruction Encoding: Receives a route instruction consisting of a start point, an end point, and at least one road name arranged in the order of passage approval; assigns a stage instruction tag representing its order in the passage order to each road name, and encodes all stage instruction tags to generate stage instruction features with contextual order relationships. Grid generation: The monitored area is divided into multiple grid cells, and a mapping relationship between road names and grid cells is established; according to the mapping relationship, the stage instruction features corresponding to each road name are written into the corresponding candidate grid cells; the grid cells are spatially encoded to generate a spatial semantic field under the instruction conditions; Global information compression: The spatial semantic field under the given instruction conditions is compressed to generate coarse-grained spatial features; Autoregressive decoding: Starting from the starting grid, based on the generated historical trajectory, endpoint features, stage instruction features, local neighborhood information of the current position, and coarse-grained spatial features, the continuous grid trajectory from the starting point to the endpoint is predicted and generated step by step in an autoregressive manner, and the continuous grid trajectory is identified as the electronic fence.
[0007] By adopting this technical solution, the end-to-end automatic conversion from road name sequences to electronic fences is achieved through four steps: instruction encoding, grid generation, global information compression, and autoregressive encoding. This can automatically convert the passage instructions given by regulatory authorities based on road name topology sequences into electronic fences that can be used for real-time vehicle positioning and matching. This solves the modal mismatch problem between digital monitoring methods based on spatial geometry and management instructions based on road name semantics, avoids the tedious operation of manually drawing fences and entering coordinate points segment by segment, and improves the efficiency of traffic route configuration.
[0008] Furthermore, the instruction encoding step further includes: A fixed random orthogonal code is generated as the initial vector for each stage instruction mark; The initial vector is input into a Transformer encoder with rotation position encoding to express the relative order between instruction stages, and the stage instruction features are generated through context modeling.
[0009] By adopting this technical solution, the distinguishability of each stage instruction in the feature space is guaranteed by random orthogonal encoding, the relative order relationship between instruction stages is expressed by rotational position encoding, and context modeling is performed by Transformer encoder. This ensures that the output features of each stage instruction not only contain its own stage information, but also the context relationship between its preceding and following stages, thus providing richer semantic constraints for subsequent mesh generation and trajectory decoding.
[0010] Furthermore, in the grid generation step, when a grid cell corresponds to multiple road names, multiple stage instructions associated with that grid cell are retained, and feature fusion is performed through mean pooling.
[0011] By adopting this technical solution, when a grid belongs to multiple road names at the same time, instead of forcibly selecting a single stage, multiple stage instructions are retained at the same time, and feature fusion is performed through mean pooling. This can accurately express complex situations such as road intersections, road overlaps, and candidate areas of roads with the same name, avoiding information loss caused by forced selection.
[0012] Furthermore, in the mesh generation step, a sine and cosine spatial position code is generated based on the row and column number of each mesh cell, and fused with the stage instruction features to obtain an initial mesh feature representation; The U-Net grid encoder is then used to spatially encode the entire grid map composed of the initial grid feature representation to generate the spatial semantic field under the command conditions.
[0013] By adopting this technical solution, each grid is given spatial location information through sine and cosine position encoding. Through the convolution, downsampling, upsampling and residual connection operations of the U-Net grid encoder, the features of each grid can be fused with local and large-scale spatial relationships to generate an instruction conditional spatial semantic field with global perception capabilities.
[0014] Furthermore, the global information compression step further includes: downsampling the spatial semantic field under the instruction condition, and aggregating the features of multiple adjacent grid units into coarse-grained spatial feature units; In each step of the autoregressive decoding process, local features of eight neighboring grid cells around the current location grid are extracted as the local neighborhood information, and spatial summary features in eight directions far from the current location are extracted as the coarse-grained spatial features.
[0015] By adopting this technical solution, coarse-grained spatial features are generated by downsampling the spatial semantic field. At each step of decoding, local eight-neighborhood features and far-end eight-direction features are extracted simultaneously. The complete spatial semantic field is compressed into a spatial memory representation of "local neighborhood information + far-end direction summary". This allows the model to not only focus on the road continuity near the current location, but also perceive the route direction and target area distribution at a distance, thus retaining the global path guidance capability with low computational cost.
[0016] Furthermore, the eight directions at the far end include east, west, south, north, and four diagonal directions.
[0017] By adopting this technical solution, the far-end directions are clearly defined, including east, west, south, north, and four diagonal directions, for a total of eight directions. This enables comprehensive perception of far-end spatial information and provides complete global directional guidance for autoregressive decoding.
[0018] Furthermore, the autoregressive decoding step adopts a Transformer decoder structure, utilizes the generated historical trajectory through causal masking, and reads the stage instruction features through a cross-attention mechanism, so that the generation process is constrained by the order of road names.
[0019] By adopting this technical solution, a Transformer decoder structure is used. Causal masking ensures that the decoding process relies only on historical information. Cross-attention mechanism is used to read stage instruction features, so that the generation process is continuously constrained by the road name order, ensuring that the generated grid trajectory is consistent with the road order of the approved route.
[0020] Furthermore, when connecting roads, ramps, auxiliary roads, turning sections, or short-distance transition sections are omitted in the route instruction, the autoregressive decoding step automatically generates intermediate connecting grids by moving the continuous grid to supplement the missing road segments, so that the generated continuous grid trajectory is spatially continuous and reachable.
[0021] By adopting this technical solution, when connecting roads, ramps, auxiliary roads, turning sections, or short-distance transition sections are omitted in the approval route text, the decoder can automatically generate intermediate connecting grids through continuous grid movement, thereby supplementing the missing road sections and making the final generated regulatory route spatially continuous and accessible. This solves the technical problem of missing connecting road section information between major roads in the actual approval text.
[0022] Furthermore, it also includes a reasoning step: receiving the input sequence of start point, end point and road name, executing the instruction encoding step, grid generation step, global information compression step and autoregressive decoding step, and outputting a continuous grid trajectory; The correspondence between the road name sequence, stage instruction markers, instruction grid, generated grid trajectory, and electronic fence results is saved for review and traceability.
[0023] By adopting this technical solution, the system can receive the input start point, end point, and road name sequence during the inference phase and output a continuous grid trajectory. At the same time, it saves the correspondence between the road name sequence, phase instruction markers, instruction grids, generated trajectory, and electronic fence results, which facilitates subsequent manual review, audit traceability, route adjustment, and fence updates, thereby enhancing the auditability and maintainability of the system.
[0024] Compared with the prior art, the present invention has the following advantages: 1. Automatic conversion of road name sequence to electronic fence: This invention can automatically convert route instructions represented by road name sequence into continuous grid trajectory and electronic fence, avoiding the need for supervisors to manually draw fences or enter coordinate points segment by segment, thus improving the efficiency of traffic route configuration.
[0025] 2. Reduce reliance on GPS coordinates and manual route selection; approvers only need to provide road name sequences that conform to business practices, without the need to provide complex latitude and longitude points, road centerlines or spatial polygons; this invention can automatically generate the spatial objects required for supervision based on road name sequences and map grid data.
[0026] 3. Utilization of the context of road name order: This invention does not process each road name in isolation, but encodes the order of road names in the route as a stage instruction, and continuously utilizes the context relationship through the Transformer encoder and autoregressive decoding process. For connecting roads, ramps, auxiliary roads, turning sections or short-distance transition sections not explicitly written in the approval text, this invention can automatically supplement intermediate paths through continuous grid trajectory generation, so that the final generated regulatory route is spatially continuous and reachable. Attached Figure Description
[0027] Figure 1 This is a schematic diagram of the grid structure of the electronic fence generation method based on road name sequence parsing of the present invention. Detailed Implementation
[0028] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0029] Please see the appendix Figure 1 This invention provides a method for generating electronic fences based on road name sequence parsing, comprising the following steps: Step 1: Instruction Encoding This algorithm receives route instructions consisting of a starting point, an ending point, and several road names, where the road names are arranged in the order of permit approval; for example, the permit route for a hazardous chemical transport vehicle is: "Starting point—A Expressway—B Highway—C East Road—Ending point".
[0030] Each road name is assigned a unique stage instruction marker based on its position in the sequence; for example, "A Expressway" is stage 1, "B Highway" is stage 2, and "C East Road" is stage 3; this marker is used to indicate "which stage of the current route the road is in", rather than simply indicating the road name itself.
[0031] To ensure that instructions at different stages are separable from each other in the feature space, the algorithm uses a fixed random orthogonal encoding to generate initial vectors for each stage of instructions, avoiding the introduction of artificial order bias. After obtaining the initial vectors, the algorithm inputs them into a Transformer encoder with rotational position encoding, which is used to express the relative order relationship between instruction stages. The encoder completes the context modeling of the instruction sequence, so that the output features of each stage instruction not only contain its own stage information, but also the context relationship between its preceding and following stages. Step 2: Mesh Generation This algorithm divides the target monitoring area into a regular spatial grid with equal side lengths, for example, a grid of 50 meters × 50 meters, and records the coordinates of the center point of each grid and the corresponding row and column positions.
[0032] Based on electronic map road data, a mapping relationship between road names and grids is established; for example, "A Expressway" corresponds to multiple grid cells (covering all road sections of the expressway within the monitored area); for each road name in the input route, the algorithm queries its corresponding candidate grid set as the candidate location range of the road in space.
[0033] Based on the stage instruction features obtained in step 1, the instruction features of each road are written into the candidate grid corresponding to the road; for example, the instruction features of stage 1 are written into all candidate grids corresponding to "A Expressway"; when a grid belongs to multiple road names at the same time (for example, a grid is located at the intersection of "A Expressway" and "B Highway"), the algorithm does not forcibly select a certain stage, but retains the instructions of multiple stages associated with the grid at the same time, and performs feature fusion by mean pooling; the resulting grid semantic encoding can express complex situations such as road intersections, road overlaps, candidate areas of roads with the same name, and multi-segment coverage of long roads.
[0034] The algorithm generates fixed sine and cosine position codes based on the row and column numbers of each grid cell, and then fuses the position codes with the grid semantic coding features to obtain the initial grid feature representation.
[0035] The algorithm uses a U-Net grid encoder, taking the entire grid map as input. It first expands the receptive field through convolution and downsampling operations, enabling each grid to fuse information over a larger range. Then, it restores the original grid resolution through upsampling and residual connections. After U-Net encoding, the algorithm obtains a spatial semantic field under the command conditions. Each grid feature includes its own corresponding stage command and two-dimensional spatial location, as well as surrounding grids and large-scale spatial relationships. Step 3: Global Information Compression Based on the instruction conditional spatial semantic field obtained in step 2, the algorithm compresses the entire grid map; it downsamples the spatial semantic field output by U-Net and aggregates the features of multiple adjacent grids into a coarse-grained spatial feature unit; the coarse-grained spatial features are used to represent the road distribution, subsequent instruction area and destination direction information over a large area.
[0036] At each step of trajectory generation, the algorithm extracts two types of spatial information centered on the current position grid: one type is the local features of the eight neighboring grids around the current position, used to determine the next possible direction of movement; the other type is the spatial summary features in the eight directions far from the current position, generated based on the relative direction between the current position and the coarse-grained spatial units, including east, west, south, north and four diagonal directions; the coarse-grained spatial units in each direction are aggregated into a directional feature, used to determine the approximate location of the subsequent road and the destination.
[0037] In this way, the algorithm compresses the complete spatial semantic field into a spatial memory representation of "local neighborhood information + far-end direction summary", enabling the model to not only focus on the road continuity near the current location, but also to perceive the route direction and target area distribution at a distance. Step 4: Autoregressive Decoding The algorithm uses the starting grid as the initial position and generates the route grid step by step according to the time step. At each step, the decoder receives the generated historical steps, the instruction code obtained in step 1, and the local neighborhood information and far-end direction summary of the current step obtained in step 3.
[0038] The decoder adopts the Transformer decoder structure and uses causal masking to ensure that the current step can only use the historical trajectory information that has been generated, and cannot use the future trajectory information. At the same time, the decoder reads the instruction encoding of step 1 through cross attention, so that the generation process is continuously constrained by the road name order.
[0039] In each decoding step, the algorithm predicts the next move based on the current hidden state and adds the grid corresponding to the move result to the generated trajectory sequence until the endpoint is reached or the preset maximum number of steps is reached.
[0040] During the generation process, the model sequentially passes through the candidate grid areas of the corresponding roads according to the stage instructions. When connecting roads, ramps, auxiliary roads, turning sections, or short-distance transition sections are omitted in the approved route, the decoder can automatically generate intermediate connecting grids through continuous grid movement to supplement the missing road segments and make the final route spatially continuous and accessible. For example, there may be a lack of ramp information between "Highway A" and "Road B", and the decoder will automatically generate ramp grids connecting the two. Step 5: Reasoning During the inference phase, the system receives the starting point, the ending point, and the sequence of road names arranged in the order of approval. It executes steps 1 to 4 and outputs a continuous grid trajectory. The system finally converts the grid trajectory into a coordinate point column, a grid set, or a buffer area as a vehicle monitoring electronic fence. It also saves the correspondence between the original road name sequence, stage instructions, candidate grid sets, generated grid trajectories, and electronic fence results for subsequent manual review, audit traceability, route adjustment, and fence updates. The present invention has been described in detail above with reference to the accompanying drawings and embodiments. Those skilled in the art can make various modifications to the present invention based on the above description. Therefore, certain details in the embodiments should not be construed as limiting the present invention, and the scope of protection of the present invention shall be defined by the appended claims.
Claims
1. A method for generating electronic fences based on road name sequence parsing, characterized in that, Includes the following steps: Instruction Encoding: Receives a route instruction consisting of a start point, an end point, and at least one road name arranged in the order of passage approval; assigns a stage instruction tag representing its order in the passage order to each road name, and encodes all stage instruction tags to generate stage instruction features with contextual order relationships. Grid generation: Divide the monitored area into multiple grid cells and establish a mapping relationship between road names and grid cells; Based on the mapping relationship, write the stage instruction features corresponding to each road name into the corresponding candidate grid cell; Spatial encoding is performed on the grid cells to generate a spatial semantic field under instruction conditions; Global information compression: The spatial semantic field under the given instruction conditions is compressed to generate coarse-grained spatial features; Autoregressive decoding: Starting from the starting grid, based on the generated historical trajectory, endpoint features, stage instruction features, local neighborhood information of the current position, and coarse-grained spatial features, the continuous grid trajectory from the starting point to the endpoint is predicted and generated step by step in an autoregressive manner, and the continuous grid trajectory is identified as the electronic fence.
2. The electronic fence generation method based on road name sequence parsing according to claim 1, characterized in that, The instruction encoding step further includes: A fixed random orthogonal code is generated as the initial vector for each stage instruction mark; The initial vector is input into a Transformer encoder with rotation position encoding to express the relative order between instruction stages, and the stage instruction features are generated through context modeling.
3. The electronic fence generation method based on road name sequence parsing according to claim 1, characterized in that, In the grid generation step, when a grid cell corresponds to multiple road names, multiple stage instructions associated with the grid cell are retained, and feature fusion is performed through mean pooling.
4. The electronic fence generation method based on road name sequence parsing according to claim 1, characterized in that, In the grid generation step, a sine and cosine spatial position code is generated based on the row and column number of each grid cell, and then fused with the stage instruction features to obtain an initial grid feature representation. The U-Net grid encoder is then used to spatially encode the entire grid map composed of the initial grid feature representation to generate the spatial semantic field under the command conditions.
5. The electronic fence generation method based on road name sequence parsing according to claim 1, characterized in that, The global information compression step further includes: downsampling the spatial semantic field under the instruction condition, and aggregating the features of multiple adjacent grid units into coarse-grained spatial feature units; In each step of the autoregressive decoding process, local features of eight neighboring grid cells around the current location grid are extracted as the local neighborhood information, and spatial summary features in eight directions far from the current location are extracted as the coarse-grained spatial features.
6. The electronic fence generation method based on road name sequence parsing according to claim 5, characterized in that, The eight directions at the far end include east, west, south, north, and four diagonal directions.
7. The electronic fence generation method based on road name sequence parsing according to claim 1, characterized in that, The autoregressive decoding step adopts a Transformer decoder structure, utilizes the generated historical trajectory through causal masking, and reads the stage instruction features through a cross-attention mechanism, so that the generation process is constrained by the order of road names.
8. The electronic fence generation method based on road name sequence parsing according to claim 1, characterized in that, When connecting roads, ramps, auxiliary roads, turning sections, or short-distance transition sections are omitted in the route instruction, the autoregressive decoding step automatically generates intermediate connecting grids by moving the continuous grid to supplement the missing road segments, so that the generated continuous grid trajectory is spatially continuous and reachable.
9. The electronic fence generation method based on road name sequence parsing according to claim 1, characterized in that, It also includes a reasoning step: receiving the input sequence of start point, end point and road name, executing the instruction encoding step, grid generation step, global information compression step and autoregressive decoding step, and outputting a continuous grid trajectory; The correspondence between the road name sequence, stage instruction markers, instruction grid, generated grid trajectory, and electronic fence results is saved for review and traceability.