A method for identifying vector elements in a journal layout editing
Patent Information
- Application Number
- CN202611082023.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-21
- Publication Date
- 2026-10-30
AI Technical Summary
现有技术(如CN109992822A)通常采用位图模板匹配或简单的几何包围盒比对,无法在矢量元素经历复杂变换后仍保持精准识别,导致同一元素被重复创建或无法被定位
使被旋转、缩放、镜像的矢量元素被准确识别,无需依赖原始变换状态;
Smart Images

Figure SMS_1 
Figure SMS_3 
Figure SMS_4
Abstract
Description
Technical Field
[0001] This invention relates to the field of journal typesetting and graphic processing technology, specifically to a method for automatic identification, classification, deduplication, and intelligent layout recommendation of vector elements in journal images, which is applicable to quickly locating, classifying, and reusing editable vector objects during the page editing process. Background Technology
[0002] Journal editing frequently utilizes vector elements such as logos, title boxes, decorative lines, chart components, separators, subscripts, and background textures. In the editing process, editors need to frequently reuse or replace these vector elements across issue numbers and page layouts to maintain consistency in the journal's layout and brand recognition. However, the following technical issues exist in the actual editing process: Transform invariance identification is difficult: Vector elements often undergo transformations such as rotation, proportional scaling, non-proportional scaling, mirroring, and translation during editing. Existing technologies (such as CN109992822A) typically use bitmap template matching or simple geometric bounding box comparison, which cannot maintain accurate identification after vector elements have undergone complex transformations, resulting in the same element being created repeatedly or unable to be located.
[0003] The semantic gap problem: Vector elements with similar geometric shapes but different editing functions (such as "chapter separators" and "table borders") are highly similar in geometric features. Existing technologies rely only on geometric attributes or manual feature engineering, which cannot achieve cross-level classification from geometric shape to editing semantics.
[0004] Layout context unawareness: Existing recognition methods only focus on the detection and matching of individual elements and fail to use the spatial layout relationship between recognized elements to infer missing supporting elements. Editors still need to manually search for and fill in the supporting elements one by one. Summary of the Invention
[0005] The purpose of this section is to outline some aspects of embodiments of the present invention and to briefly describe some preferred embodiments. Simplifications or omissions may be made in this section, as well as in the abstract and title of this application, to avoid obscuring the purpose of these documents; however, such simplifications or omissions should not be construed as limiting the scope of the invention.
[0006] To address the shortcomings of existing technologies, this invention proposes a systematic solution that achieves high-precision and high-efficiency intelligent recognition and editing assistance for vector elements by constructing a vector fingerprint with transformation invariance, a graph convolutional neural network semantic classification model based on topological graphs, and a context-aware layout recommendation engine.
[0007] Specifically, the present invention provides the following technical solution: a vector element recognition method in journal pattern editing, comprising the following steps: Step S1: parse the journal pattern file, recursively expand all grouped and wrapped structures, unlock layers and masks, extract the geometric path data, fill attributes, stroke attributes, transformation matrix, and stacking depth and drawing order information of each basic primitive object, and construct an initial metadata pool; Step S2: perform equal arc length resampling on the path of each primitive object, take 256 sampling points at equal intervals on the path, calculate the discrete curvature value at each sampling point, and obtain a curvature sequence; perform discrete Fourier transform on the curvature sequence, After extracting the amplitude values of the first 32 non-zero frequency components, norm normalization is performed to obtain a 32-dimensional principal shape feature vector. The radial distance of each sampling point relative to the center of the object's bounding box is calculated, and the standard deviation and first-order autocorrelation coefficient of the radial distance sequence are combined to form a 2-dimensional auxiliary displacement feature vector. The fill color and stroke color are converted from the RGB color space to the HSV color space and then quantized and encoded to obtain a color code. The principal shape feature vector, auxiliary displacement feature vector, and color code are mapped to a 128-bit binary vector fingerprint using a hash function. Step S3: All vector fingerprints are indexed using a multi-hash table locality-sensitive hashing algorithm, and fingerprints falling into the same hash table are indexed. The fingerprints within the bucket are used to calculate the binary Hamming distance. Instances with a Hamming distance less than a set threshold are then classified as shape-similar. MinHash signature compression and density clustering are then performed. Instances within a cluster are classified as duplicates. The object with the smallest stacking depth and earliest drawing order in the cluster is selected as the representative template, and its bounding box position information is recorded. Step S4: The path of the representative template is converted into a topological graph. Nodes are the intersections and endpoints of the path, and edges are the path segments. Node and edge features are extracted and input into a pre-trained graph convolutional neural network. After multi-layer mean aggregation and global readout, the semantic category probability is output through a fully connected layer and a Softmax function. Step S5: Construct a three-layer index structure knowledge base containing a semantic category hash index, a MinHash signature space index, and a location sequence space index. Each entry stores the vector fingerprint, bounding box size, and historical occurrence records of the template. Step S6: After performing steps S1 and S2 on the new journal pattern, use the knowledge base index to match similar templates to generate precise positioning recommendations. At the same time, construct a layout map of the identified objects in the new pattern according to their spatial locations. Use the subgraph isomorphic matching algorithm to retrieve topologically similar historical layout maps in the knowledge base and infer the missing matching elements to generate layout complementary recommendations.
[0008] As a preferred embodiment of the vector element recognition method in the journal pattern editing of the present invention, the discrete curvature in step S2 is calculated as follows: for the j-th sampling point, the difference between the direction angles of the two chords formed by the j-th sampling point and the two adjacent sampling points is calculated, and then divided by the equal arc length step size to obtain the discrete curvature value at that point.
[0009] As a preferred embodiment of the vector element recognition method in journal pattern editing described in this invention, the norm normalization method in step S2 is as follows: divide each of the 32 amplitude values by the square root of the sum of the squares of the 32 amplitude values.
[0010] As a preferred embodiment of the vector element recognition method in journal pattern editing described in this invention, the standard deviation of the radial distance sequence in step S2 is calculated as follows: the mean of all radial distances is calculated, the mean is subtracted from each radial distance, the squares are summed, and then the sum is divided by the number of sampling points, and the square root of the value is taken; the first-order autocorrelation coefficient is calculated as follows: the deviation sequence is obtained by subtracting the mean from all radial distances, and the sum of the products of the deviation sequence and its one-position lag sequence is calculated and divided by the sum of the squares of the deviation sequence; the combination method is as follows: the natural logarithm of the standard deviation and the autocorrelation coefficient are combined into a 2-dimensional vector.
[0011] As a preferred embodiment of the vector element recognition method in journal pattern editing described in this invention, the color code generation method in step S2 is as follows: after normalizing the RGB color values of the fill color and the stroke color, the hue, saturation and lightness components are calculated according to the standard conversion formula. The hue is divided into 36 quantization intervals with 10-degree intervals, and the saturation and lightness are each evenly divided into 4 quantization intervals to obtain the quantization results. The quantization results of the fill color and the stroke color are concatenated into a binary color code.
[0012] As a preferred embodiment of the vector element recognition method in journal pattern editing described in this invention, the specific method of the multi-hash table locality-sensitive hash algorithm in step S3 is as follows: 20 hash tables are set, each hash table uses 6 random hyperplanes, and 6 bits are randomly selected from each of the 20 hash tables as hash keys for each vector fingerprint, and the fingerprint is assigned to the corresponding hash bucket; the threshold value of the Hamming distance is set to 19 bits.
[0013] As a preferred embodiment of the vector element recognition method in journal pattern editing described in this invention, the specific method of MinHash signature compression in step S3 is as follows: the position indices of binary bits 1 in the 128-bit vector fingerprint are regarded as a set, and each index of the set is rearranged using 64 independent random permutation functions. The minimum value after each permutation is taken as the hash value corresponding to the permutation, resulting in a total of 64 hash values forming a 64-bit MinHash signature; the density clustering adopts the DBSCAN algorithm, with Jaccard distance as the metric, the radius parameter is set to 0.25, and the minimum number of adjacent sample points is set to 2.
[0014] As a preferred embodiment of the vector element recognition method in journal pattern editing described in this invention, the node features in step S4 include five features: normalized coordinates, discrete curvature value, node degree, and node type; the edge features include three features: normalized edge length, orientation angle, and stroke type; the graph convolutional neural network adopts a three-layer structure, and each layer uses a mean aggregation function to aggregate the embedding vectors of the node itself and its neighboring nodes, and then applies a ReLU activation function. The output dimensions of the three layers are 64, 128, and 256, respectively; the global readout method is to take the dimensional average of all node embedding vectors output by the third layer to obtain the global graph vector.
[0015] As a preferred embodiment of the vector element recognition method in journal pattern editing described in this invention, the three-layer index structure in step S5 is as follows: the first layer is a hash index with semantic category identifier as the key and a list of all template identifiers under that category as the value; the second layer is a KD-Tree spatial index with 64-dimensional MinHash signature as the key; and the third layer is an R-Tree spatial index with template bounding box center coordinates as the key and storing historical position sequences.
[0016] As a preferred embodiment of the vector element recognition method in journal pattern editing described in this invention, the specific method of layout complementarity recommendation in step S6 is as follows: a layout graph is constructed using the bounding box center of each identified object in the new pattern as a node, the Euclidean distance between nodes being less than half the page width or height as the edge connection condition, and the reciprocal of the distance as the edge weight; a variant of the VF2 subgraph isomorphic matching algorithm is used to retrieve historical layout graphs with topological similarity to the layout graph in the third-level index of the knowledge base, limiting the complete matching of node semantic categories and allowing a relative tolerance of plus or minus 30% for edge distance; for each matched historical layout graph, the templates corresponding to the subgraph structures contained in it but missing in the new pattern layout graph are extracted, and the top three are selected as recommendations after being sorted in descending order of matching degree.
[0017] This invention provides a method for vector element recognition in journal image editing, which has the following beneficial effects: It enables the accurate identification of rotated, scaled, and mirrored vector elements without relying on the original transformation state; Inferring editing purpose directly from geometric shapes greatly reduces manual annotation work; Automatically cluster repeatedly created elements and extract unique templates; Automatically recommends missing elements based on historical context, improving layout consistency and efficiency. Detailed Implementation
[0018] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0019] To address the shortcomings of existing technologies, this invention proposes a systematic solution that achieves high-precision and high-efficiency intelligent recognition and editing assistance for vector elements by constructing a vector fingerprint with transformation invariance, a graph convolutional neural network semantic classification model based on topological graphs, and a context-aware layout recommendation engine.
[0020] Specifically, this invention provides a method for intelligent recognition of vector elements in journal pattern editing, comprising the following six steps.
[0021] Step S1: Vector analysis and primitive metadata extraction S1-1: File Format Parsing and Structured Flattening The system reads the target journal's image files, supporting common vector formats including but not limited to Adobe Illustrator (AI format), Encapsulated PostScript (EPS format), Portable Document Format (PDF format), and Scalable Vector Graphics (SVG format). The reading operation unfolds all grouping and wrapping structures within the file level by level using the underlying parser. For SVG files, recursively expand all. <g>For element nodes, additionally mark the parent container ID for groups with a nesting depth greater than 3, and unlock all locked layers and masks.
[0022] For PDF files, we parse structural objects containing vector paths, such as Form XObject and Type3 Font, and extract the path operators inside them layer by layer.
[0023] For AI and EPS files, parse the PostScript instruction sequence and expand all BeginCompoundPath and BeginGroup structures.
[0024] After the above operations, a flattened list of all basic primitive objects is obtained. For each basic primitive object O... i Extract the following metadata to form the metadata set M of this object. i : S1-2: Geometric Path Attribute Extraction Geometric path P i This is a mathematical description of the object's shape. Each path point is represented as p. i,k =(x k ,y k ,t k ),in: (x k ,y k ) represents the absolute coordinates of the point in the page coordinate system (unit: millimeters or pounds, rounded to two decimal places).
[0025] t k The curve type parameter for this point: t k =0 indicates the vertex of the line segment; t k =1 indicates the control point of the Bézier curve; t k =2 represents the vertex of the quadratic curve.
[0026] Number of path points K i The coordinates vary with the complexity of the graph and have no fixed upper limit. For closed paths (such as rectangles and circles), the coordinates of the first and last points are the same; for open paths (such as line segments), the coordinates of the first and last points are different.
[0027] S1-3: Extraction of Fill and Stroke Attributes Fill attribute F i It contains four parameters: Color value: Represented in RGB color space, (c r ,c g ,c b Each component takes the value of an integer between 0 and 255.
[0028] Transparency α: A floating-point number ranging from 0 to 1, where 0 represents complete transparency and 1 represents complete opacity.
[0029] Fill type T: T=0 indicates solid color fill, T=1 indicates linear gradient fill, T=2 indicates radial gradient fill, T=3 indicates pattern fill.
[0030] Stroke attribute S i It contains four parameters: Stroke width w: Unit pt (points), a floating-point number ranging from 0 to 1000.
[0031] Stroke color value: also represented in RGB space, (c r ,c g ,c b The same applies to units.
[0032] Dashed line pattern d p : An integer array, such as [4,2] representing a solid line segment of 4pt and an empty line segment of 2pt. If it is a solid line, the array is [0].
[0033] S1-4: Transformation Matrix and Layer Information Extraction Transformation matrix T i It is a 2×3 matrix representing the spatial transformation of a primitive object relative to its parent container:
[0034] Where submatrix This is the linear transformation part, which includes rotation, scaling, and shearing operations; the vector (e,f) is the translation vector. The physical meaning of each parameter is as follows: a: Scaling factor in the x-axis direction.
[0035] b: The y-axis shear coefficient relative to the x-axis (in the rotation matrix, it is -sinθ).
[0036] c: The shear coefficient of the x-axis relative to the y-axis (sinθ in the rotation matrix).
[0037] d: Scaling factor in the y-axis direction.
[0038] e: Translation along the x-axis.
[0039] f: Translation along the y-axis.
[0040] When an object undergoes only translation, a=d=1, b=c=0; when an object undergoes rotation by an angle θ, a=d=cosθ, b=−sinθ, c=sinθ; when an object undergoes non-uniform scaling, a≠d.
[0041] Stacked Information Z i =(depth,order): depth: The parent level depth of this object in the document object tree, with the root node having a depth of 0.
[0042] order: The drawing order of sibling nodes within the same parent level. The smaller the value, the earlier it is drawn (i.e., located at the bottom level).
[0043] All M i (including P) i ,F i ,S i ,T i Z i This constitutes the initial metadata pool M.
[0044] Step S2: Transform-invariant vector fingerprint generation The core objective of this step is to: for each primitive object O i Generate a 128-bit binary fingerprint f i The fingerprint remains unchanged after the object undergoes rotation, proportional scaling, mirroring, and translation transformations, and maintains high similarity even after undergoing non-proportional scaling and minor color changes, thus possessing accurate object matching capabilities.
[0045] S2-1: Equal Arc Length Resampling For object O i geometric path P i Perform equal arc length resampling operation, the specific steps are as follows: Calculate the total arc length: for path P i Integrate piecewise across all path segments. For a straight line segment, its length is [(x...]]. k+1 -x k ) 2 +(y k+1 -y k ) 2 ] 0.5 For the Bézier curve segment, the de Casteljau algorithm is used for parametric integration. The curve is divided into 100 equal sub-intervals, and the chord lengths of each sub-interval are summed to obtain the approximate arc length. The final total arc length L of the path is then obtained. i (Unit: millimeters)
[0046] Determine the number of sampling points: Set N=256. 256 sampling points have been verified as the optimal balance point in engineering practice: too few sampling points will lead to the loss of shape information (such as small jagged edges being ignored), while too many will increase the computational overhead and become sensitive to noise.
[0047] Calculate the step size for equal arc length: Δs = L i / N means taking a point every Δs distance.
[0048] Generate the sampling point sequence: Starting from the path origin, take one point every Δs along the path direction to obtain the sampling point sequence Q of equal arc length. i ={q1,q2,…,q N }, where each q j =(x j ,y j ).
[0049] Explanation of the principle: The key to equal arc length sampling is that it is unaffected by the uneven distribution of vertices in the original path. For example, a circle with 100 vertices and a circle with 4 Bézier control points will both yield 256 evenly distributed points after equal arc length sampling. This makes subsequent curvature calculations comparable. Furthermore, equal arc length sampling itself is translation invariant (coordinate values change with the object's position, but the relative relationships between sampling points remain unchanged).
[0050] S2-2: Calculation of Discrete Curvature Sequences For each sampling point q j (j=2,3,…,N−1), calculate its discrete curvature value κ. j : κ j =Δθ j / Δs Where Δθ j The change in direction angle between adjacent chords is calculated as follows: Δθ j =arctan2(y j+1 -y j ,x j+1 -x j )-arctan2(y j -y j-1 ,x j -x j-1 ) The arctan2 function returns an angle value in the range (−π, π), which is used to calculate the direction angle of the line connecting two points.
[0051] Δθ j The value of is in the range of (−π, π), representing the direction and degree of path curvature at the current point. A positive value indicates that the path bends to the left, and a negative value indicates that it bends to the right.
[0052] For the first point q1 and the last point q N Due to the lack of forward and backward sampling points, forward and backward difference are used for approximate calculation: κ1=κ2, κ N =κ N−1 .
[0053] A curvature sequence C of length N=256 is obtained. i ={κ1,κ2,…,κ N }
[0054] Explanation of the principle: Curvature κ is a local geometric property of the path shape, and its physical meaning is the amount of directional change of the path per unit arc length. For rotational transformations, the curvature value remains unchanged because rotation only changes the global orientation angle and not the degree of path curvature. For a uniform scaling s, the path length becomes s times its original length, therefore Δs becomes s times its original length, while Δθ... j The value remains unchanged, therefore κ j It becomes 1 / s of the original value. This scaling effect will be normalized in subsequent steps.
[0055] S2-3: Discrete Fourier Transform For curvature sequence C i Perform the Discrete Fourier Transform (DFT):
[0056] in: i is the imaginary unit.
[0057] k is the frequency index, and k=0 corresponds to the DC component (mean of curvature).
[0058] e ﹣i2πkj / N These are complex exponential basis functions, representing sine and cosine components of different frequencies.
[0059] X k The result is a complex number, representing the Fourier coefficients at frequency k.
[0060] Extract the amplitude values of the first M=32 non-DC frequency components: A k =∣X k ∣=[Re(X k ) 2 +Im(X k ) 2 ] 0.5 k=1,2,…,32 Re(X k ) and Im(X k ) are respectively X k The real and imaginary parts of .
[0061] A k is a real number representing the energy intensity of the curvature sequence at frequency k.
[0062] Principle Explanation: The Fourier transform transforms a curvature sequence from the spatial domain (with sampling point positions as independent variables) to the frequency domain (with frequency k as independent variable). Low-frequency components (smaller k) represent the global shape features of the path, such as the overall curvature trend; high-frequency components (larger k) represent local details, such as jagged edges or burrs. This invention uses the first 32 low-frequency components because vector elements in journal images typically have neat, smooth geometric shapes, and low-frequency features are sufficient to distinguish different categories. Rotation invariance is a key property of Fourier amplitude: rotation operations only change the phase of the Fourier transform, while the amplitude |X| remains unchanged. k | Remains unchanged. Scaling effect: When an object undergoes a uniform scaling s, all κ remain unchanged. j It becomes 1 / s of the original value, therefore all A k It also becomes 1 / s of the original value, meaning the overall scale is proportional, and the relative proportion remains unchanged. Subsequent normalization can eliminate this effect.
[0063] S2-4: Normalized principal shape feature vector Norm normalization is performed on the 32 amplitude values to give the resulting vector a unit Euclidean norm:
[0064] Obtain the principal shape feature vector v shape = ∈R 32 .
[0065] Explanation of principle: Norm normalization eliminates the effect of proportional scaling on the curvature amplitude. If the object is enlarged by a factor of s, all A... k It becomes 1 / s of the original value, and the denominator (∑A) m 2 ) 0.5 It also becomes 1 / s of the original value, therefore the ratio This makes the fingerprint completely invariant to proportional scaling.
[0066] S2-5: Auxiliary displacement feature vector For non-uniform scaling (such as horizontal stretching by 2 times while keeping the vertical direction unchanged), the curvature sequence undergoes a non-uniform change, resulting in a Fourier amplitude A. k The proportional relationship changes, making it impossible for the main shape feature vector to remain completely unchanged. To solve this problem, this invention introduces an auxiliary displacement feature vector to capture the deformation information caused by non-uniform scaling.
[0067] Calculate the bounding box center: c x = (x min +x max ) / 2,c y =(y min +y max ) / 2 Where x min ,y min ,x max ,y max These are the coordinates of the four boundaries of the object's path bounding box.
[0068] Calculate the radial offset: for each sampling point q j Calculate its relative to the center (c x ,c y Radial distance: rj=[(x j -c x ) 2 +(y j -c y ) 2 ] 0.5 Statistical measures for calculating radial offset: Mean:
[0069] Standard deviation:
[0070] First-order autocorrelation coefficient:
[0071] Logarithms and Combinations: v displace =(log(σ r ),ρ r )∈R 2 Explanation of the principle: When an object undergoes a proportional scaling s, all r j It becomes s times the original value, therefore σ r It also becomes s times the original, log(σ) r ) becomes log(σ) r )+log(s). This additive change is represented as an offset in subsequent hash encoding, which can be partially eliminated through tolerance processing.
[0072] First-order autocorrelation coefficient ρ r Measure the linear correlation of radial offsets between adjacent sampling points. For uniform scaling, all r j Proportional change, ρ r It remains unchanged. For non-uniform scaling, the autocorrelation structure of the radial offset sequence changes, ρ r The value changes accordingly. Therefore, v displace It can distinguish between proportional scaling and non-proportional scaling.
[0073] S2-6: HSV Quantization Encoding of Fill and Stroke Attributes To eliminate the impact of minute color differences (±5% color difference tolerance) on matching while retaining distinguishable color information, this invention converts RGB color values to the HSV color space and then performs quantization encoding.
[0074] RGB to HSV conversion: Assume R, G, B are color values normalized to [0,1]: C max =max(R,G,B), C min =min(R,G,B), Δ=C max -C min
[0075] Quantitative operations: Hue H (0-360 degrees): Quantized into 36 intervals of 10 degrees each: H quant =⌊H / 10⌋.
[0076] Saturation S(0-1): uniformly quantized into 4 intervals: S quant =⌊S×4⌋.
[0077] Brightness V (0-1): Uniformly quantized into 4 intervals: V quant =⌊V×4⌋.
[0078] Encoding generation: Perform the above quantization operation on the fill color and stroke color respectively to obtain two quantization codes. Each quantization code is 5 bits long (H). quant Occupies 6 bits, i.e., binary 2 6 =64>36, but only 36 states are actually needed, which can be encoded as 6 bits; S quant With V quant Each color occupies 2 bits, for a total of 10 bits. The fill color and stroke color are concatenated into a 10-bit binary code. color .
[0079] Explanation of the principle: The HSV color space better matches the human eye's perception of color, with hue (H) being the primary distinguishing dimension for color types. Quantization categorizes adjacent hues (e.g., H=10° and H=12°) into the same range, merging minute color differences and achieving tolerance matching. The coarse-grained quantization also prevents noise interference.
[0080] S2-7: 128-bit vector fingerprint combination The above three encoding results are combined into a 128-bit binary fingerprint f. i : For the 32-dimensional principal shape feature vector v shape Perform 64-bit hashing: Use the MurMurHash3 algorithm to map floating-point vectors to 64-bit integers.
[0081] For the 2D auxiliary displacement eigenvector v displace Perform a 64-bit hash: also using the MurMurHash3 algorithm.
[0082] Combine the two 64-bit hash values with the 10-bit color code e color Perform bitwise concatenation: the first 64 bits are the shape hash, the middle 64 bits are the shift hash, and the last 10 bits are the color code (parts exceeding 128 bits are discarded or truncated).
[0083] Finally, a 128-bit binary fingerprint f was obtained. i .
[0084] The fingerprint invariance properties are summarized in Table A below: Table A: Summary of Properties
[0085] Step S3: Fast Deduplication and Template Extraction Based on Locality Sensitive Hashing Since the initial metadata pool M may contain a large number of duplicate vector elements (such as the same logo appearing multiple times, symmetrical decorative elements, etc.), this step aims to quickly detect duplicate instances and extract representative templates.
[0086] S3-1: Construction of Locality Sensitive Hash Index Employing an E2LSH (Locality Sensitive Hash) architecture based on Euclidean distance, nearest neighbor retrieval is performed using 128-bit binary Hamming distance: Set the number of hash tables to L=20. The larger L is, the higher the recall rate of the retrieval, but the greater the computational cost. Engineering verification shows that 20 hash tables can achieve a recall rate of >0.95 in a pool of 100,000 objects.
[0087] Each hash table uses k=6 random hyperplanes. Each hyperplane selects a random bit index (0-127), projects a 128-bit fingerprint onto that bit, and obtains a binary vector of length 6 as the hash key of the table.
[0088] For each fingerprint f i The hash key is calculated in each of the 20 hash tables, and then assigned to the corresponding hash bucket. All fingerprints within the same bucket are considered as candidate nearest neighbors.
[0089] S3-2: Hamming Distance Calculation and Repeat Detection For any two fingerprint pairs (f) located in the same hash bucket i ,f j ), calculate its Hamming distance:
[0090] Where f i [b] represents the binary value (0 or 1) of the fingerprint at the b-th bit, where 1 is the indicator function.
[0091] Set the threshold T = 19 bits (i.e., 0.15 × 128 ≈ 19.2, rounded down). If d Hamming If the value is ≤19, then the two objects are considered to be similar in shape.
[0092] S3-3: MinHash Signature Compression To reduce redundant comparisons, fingerprints identified as duplicates are compressed using MinHash: Consider the 128-bit fingerprint as a set S, where each element is the index (0-127) of a binary bit with a value of 1.
[0093] Select M=64 independent hash permutation functions π1,π2,…,π 64 Each permutation function π m Randomly rearrange the set {0,1,…,127}.
[0094] For each permutation function, calculate the minimum hash value: h m =min{π m (x)∣x∈S}.
[0095] Concatenate the 64 smallest hash values into a 64-bit MinHash signature. i .
[0096] Explanation of the principle: The property of MinHash indicates that the Jaccard similarity of two sets is equal to the probability that their MinHash signatures are equal. This provides an accurate similarity measure for subsequent clustering.
[0097] S3-4: DBSCAN Clustering 64-bit MinHash signatures i Density clustering was performed using the DBSCAN algorithm: Distance metric: Jaccard distance
[0098] Where s i ∩s j This indicates the number of corresponding positions that are equal.
[0099] The radius parameter ε = 0.25: two signatures are considered adjacent if the Jaccard distance between them is less than 0.25.
[0100] Minimum number of adjacent sample points minPts=2: that is, at least two points are needed to form a cluster.
[0101] Clustering result C={C1,C2,…,C l }, each cluster C l It contains a set of semantically identical vector element instances.
[0102] S3-5: Selection of Representative Templates For each cluster C l Select one of the objects as the representative template O repr The selection rules are as follows: Sort by stacking depth in ascending order (prioritize objects at higher levels and avoid selecting deeply nested sub-objects).
[0103] If the depths are the same, sort them in ascending order according to the drawing order (prioritize the earliest drawn "draft" object, which usually has the most complete path data).
[0104] Choose the object ranked first.
[0105] Simultaneously record the global location features of this representative template: Bounding box boundary: B repr =(x min ,y min ,x max ,y max ) Center of bounding box: c repr =((x min +x max ) / 2,(y min +y max ) / 2) Bounding box width and height: w=x max -x min , h=y max -y min Step S4: Semantic classification based on graph convolutional neural networks The core objective of this step is to map the geometric shape of representative templates to editing semantic categories, thus solving the classification problem of "similar geometric shapes but different editing uses".
[0106] S4-1: Topology Graph Construction Representative template O repr geometric path P i Convert to topological graph G i =(V,E,X v ,X e ): Node V: All intersections (the points where two or more path segments intersect) and endpoints (the first and last points of a path segment) in the path. The set of nodes is denoted as V = {v1, v2, ..., v...}. ∣V∣ }
[0107] Edge E: A path segment connecting two nodes. If the two nodes v a With v b If there are continuous path segments without any other intersections or endpoints, then there exists an edge e. ab ∈E.
[0108] Node feature X v Each node v defines a 5-dimensional feature vector: First dimension x v Normalized x-coordinate v =(xc x ) / max(w,h), where (c x ,c y (w,h) represents the center of the bounding box, and (w,h) represents the width and height of the bounding box.
[0109] The second dimension y v : Normalized ordinate, y v =(yc y ) / max(w,h).
[0110] The third dimension κ v The discrete curvature at the node is calculated in the same way as in step S2-2, but using three path points (previous, current, and next) in the neighborhood of the node.
[0111] The fourth dimension, deg(v), represents the degree of a node, i.e., the number of edges connected to that node.
[0112] The 5th dimension, type(v), represents the node type: type=0 indicates an endpoint (degree 1), type=1 indicates an intersection (degree ≥ 2), and type=2 indicates an isolated point (degree 0).
[0113] Edge feature X e Each edge e=(u,v) defines a 3-dimensional feature vector: First dimension e Normalized side length, l e =∣∣p u -p v || / max(w,h), where p u With p v These are the coordinates of nodes u and v, respectively.
[0114] The second dimension θ e : Direction angle of the side, θ e =arctan2(y v -y u ,x v -x u ), with a value range of [0,π), and no direction distinction.
[0115] 3rd Dimension Style e The stroke type of the edge, style e =0 indicates a solid line, style e =1 indicates a dashed line, style e =2 indicates no outline.
[0116] S4-2: Graph Convolutional Neural Network Structure The GraphSAGE framework is adopted, which has inductive learning capabilities and can handle graphs of different sizes and structures that have not been seen during the training phase.
[0117] Model structure: Input layer: Node feature dimension is 5, and edge feature dimension is 3.
[0118] First GraphSAGE convolutional layer: Neighbor sampling count: 10 neighbors are sampled for each node.
[0119] Aggregation function: Mean Aggregator.
[0120] Output dimensions: 64.
[0121] Activation function: ReLU.
[0122] Second GraphSAGE convolutional layer: Neighbor sampling count: 15 neighbors are sampled for each node.
[0123] Aggregation function: Mean aggregator.
[0124] Output dimensions: 128.
[0125] Activation function: ReLU.
[0126] The third GraphSAGE convolutional layer: Neighbor sampling number: 20 neighbors are sampled for each node.
[0127] Aggregation function: Mean aggregator.
[0128] Output dimensions: 256.
[0129] Activation function: ReLU.
[0130] Mathematical form of aggregate functions: At layer k, the embedding update formula for node v is: h v (k+1) =ReLU(W (k) •MEAN({h v (k) }∪{h u (k) :∀u∈N(v)})) in: h v (k) The embedding vector of node v at layer k (where k=0 is the input feature X) v ).
[0131] N(v) is the set of neighboring nodes of node v (a sampled subset).
[0132] MEAN represents the element-wise mean of all vectors in the set.
[0133] W (k) Let be the trainable weight matrix of the k-th layer, with dimensions equal to the input dimension × the output dimension.
[0134] Principle: Mean aggregation is insensitive to node order and has inductive ability (it can handle dynamic graph structures) and is suitable for vector elements of different complexities.
[0135] S4-3: Global Graph Readout and Classification Taking the average of all node embeddings yields a 256-dimensional global graph vector g:
[0136] Input g into two fully connected layers: FC1: 256 → 128, ReLU FC2: 128 → 6, Softmax Output a 6-dimensional probability vector p∈R 6 These correspond to 6 semantic categories, as shown in Table B below: Table B: Category Correspondence Table
[0137] The category with the highest probability is selected as the final category result.
[0138] S4-4: Training Data and Pre-training Dataset: 200,000 manually labeled vector element samples, covering 6 categories, with approximately 33,000 samples in each category.
[0139] Data augmentation: Apply random rotation (0-360°), random scaling (0.5-2.0), random translation (±20%), and random mirror flipping to each sample, augmenting it up to 5 times.
[0140] Loss function: Categorical Cross-Entropy + L2 regularization (coefficient 1e-4).
[0141] Optimizer: Adam, learning rate 1e-3, using Warmup scheduling to linearly increase to 1e-2 for the first 100 epochs, then decaying by cosine annealing.
[0142] Step S5: Building a Multi-Level Indexed Knowledge Base S5-1: Three-level index structure, as shown in Table C below: Table C: Three-level index structure table
[0143] S5-2: Knowledge Base Entries Each knowledge base entry contains: Template ID (unique and incrementing) Semantic Category ID MinHash signature Vector fingerprint f i (128-bit) Box width and height (w, h) Historical records: Records={(issue_id,page_id,x j ,y j ,operated)}, where operated is a boolean value indicating whether the instance has been edited, selected, and operated (scaled / rotated / colored, etc.).
[0144] Finally, a timestamp appears. S5-3: Incremental Update After processing each new journal, newly discovered templates (not yet appearing in the knowledge base) are inserted into the three-level index.
[0145] For a new instance of a known template, update its position sequence record.
[0146] Step S6: Intelligent Layout Matching and Recommendation S6-1: Preliminary processing of the new pattern Perform steps S1 and S2 on the new pattern to obtain each object O. j new Vector fingerprint f j new And query its semantic category c through step S4 (if real-time classification is required) or through the MinHash signature in S5-2. j new .
[0147] S6-2: Precise Positioning Recommendation For each object O in the new pattern j new : Using its MinHash signature, a known template T that matches (similarity > 92%) is found in the second-level index of the knowledge base. match .
[0148] If one or more matching templates are retrieved: If T match The width and height of the enclosure box are the same as O j new If the width and height difference is greater than 15%, a recommendation will be generated: "An element similar to template [TID:xxx] has been detected, but the size is different. It is recommended to replace it with the original size of the template to maintain consistency?".
[0149] If T match If the historical operation log shows that the template has been edited and colored (operated=True percentage > 50%), then the recommendation is: "This element has been frequently colored and modified in history, and 3 common color scheme variations are provided for selection." S6-3: Recommendations for Complementary Layouts Core innovation: Missing element inference based on graph structure.
[0150] Construct a layout map G based on the spatial location of the identified objects in the new pattern. layout : Node: Each identified object (with its bounding box center as the node).
[0151] Edge: The line connecting the centers of two objects (only if the Euclidean distance is less than half the page width or height).
[0152] Edge weight: the inverse of the distance (the closer the edge, the greater the weight).
[0153] Retrieve from the third-level index of the knowledge base related to G layout A set H of topologically similar historical layout graphs. A subgraph isomorphic matching algorithm (a variant of the VF2 algorithm) is used, allowing matching of node attributes (category ID) and allowing a tolerance of ±30% for edge distance.
[0154] For each matching historical layout H∈H, find the new pattern G that exists in H. layout The missing subgraphs (i.e., nodes and their edge structures) are identified. The templates corresponding to these missing subgraphs are the recommended matching elements.
[0155] Return to the recommendation list, sorted by match degree (H and G) layout Sort the nodes in descending order (number of shared nodes / total number of nodes in H), and select the top 3 for recommendation.
[0156] Example: If a "title badge" and a "separator" are detected in the new pattern, and the knowledge base history layout shows that "title badge + separator + badge" is a common combination, then the system recommends: "Based on the current layout, it is recommended to add a badge element. Recommended template [TID:1045], located in the lower right corner of the page." To better understand the technical solution of the present invention, the following embodiments are provided: This embodiment uses the cover image of the third issue of a certain science and technology magazine in 2026 as an example to demonstrate the complete execution process of the method of the present invention. The cover image is an AI format file containing vector elements such as logos, title boxes, decorative lines, and corner marks, with a file size of approximately 2.3MB. The calculation and analysis are then carried out step by step according to the method steps below.
[0157] Step S1: Vector analysis and primitive metadata extraction S1-1: File Format Parsing The parser reads the cover AI file and finds that the document object tree contains four levels of nested groups: root document (depth 0) → page container (depth 1) → content group (depth 2) → specific primitive objects (depth 3). After expanding all groups, one locked layer and two mask structures are unlocked, resulting in 47 basic primitive objects.
[0158] S1-2: Example of primitive attribute extraction Taking one of the objects—the journal logo "star trail symbol"—as an example, the extracted metadata is as follows: Geometric Path P1: This logo consists of three curve segments and contains 32 path points. Example of partial keypoint data: p 1,1 =(12.34, 45.67, 0): Starting point of the straight line segment p 1,2 =(18.92, 52.13, 1): Bessel control point p 1,3 =(25.50, 48.60, 1): Bessel control point p 1,4 =(30.01, 40.22, 0): End point of the straight line segment …(The remaining 28 points are omitted) p 1,32 =(12.34, 45.67, 0): Returns to the starting point, path closed. Fill attribute F1: Color value: (c r c g c b ) = (0, 102, 204), which represents blue. Transparency: α = 1.0 (completely opaque) Fill type: T=0 (solid fill) Stroke attribute S1: Stroke width: w=2.0 pt Stroke color value: (c r c g c b = (255, 255, 255), white Dashed line pattern: d p =[0] (solid line) Transformation matrix T1:
[0159] This matrix indicates that the object has been rotated by 30° (cos30°=0.866, sin30°=0.500) and translated by 60mm in the x-direction and 120mm in the y-direction. There is no scaling or shearing (a=d=0.866=1, but due to rotation, the actual row vector length is 0.866). 2 +0.500 2 ) 0.5 =1, therefore no scaling).
[0160] Stacking information Z1: Hierarchical depth: depth=3 Drawing order: order=5 (the 5th object to be drawn in this layer) The data for the other 46 objects is similar and will not be listed individually here.
[0161] S1-3: Initial Metadata Pool Construction The metadata collection M of 47 objects has been constructed, and each object contains P. i F i S i T i Z i Five data points.
[0162] Step S2: Transform-invariant vector fingerprint generation Using the "star trail marker" object as an example, the fingerprint generation process is demonstrated in detail.
[0163] S2-1: Equal Arc Length Resampling Calculate the total arc length: Solve segment by segment for each of the 32 path points. For straight line segments, calculate the distance between two points directly. For Bézier curve segments, use the de Casteljau algorithm to divide them into 100 equal segments and then sum them.
[0164] The total arc length L is calculated. i =78.45 mm.
[0165] Determine the step size: Δs = 78.45 / 256 = 0.3064 mm Generate sampling points: Starting from the path starting point (12.34, 45.67), take one point every 0.3064mm along the path direction. The first sampling point is the starting point itself: q1 = (12.34, 45.67) The second sampling point moves 0.3064 mm along the path. We need to determine which segment of the path this distance falls on. The distance from the starting point to the second path point (18.92, 52.13) is a Bézier curve segment with a total length of 5.12 mm. 0.3064 mm < 5.12 mm, so we interpolate proportionally along this segment. Using the Bézier curve parameterization formula, we calculate the value at parameter t = 0.3064 / 5.12 = 0.0598, obtaining: q2 = (13.72, 46.91). Repeat this process to obtain a total of 256 sampling points. The coordinates of some of these sampling points are shown in Table 1 below. Table 1: Coordinates of some sampling points
[0166] S2-2: Calculation of Discrete Curvature Sequences Calculate the curvature for the second sampling point q2=(13.72, 46.91).
[0167] Calculate the direction angle of adjacent chords: chord q1→q2: direction angle θ 12 =arctan2(46.91−45.67,13.72−12.34)=arctan2(1.24,1.38)=0.733rad (approximately 42°) Chord q2→q3: q3=(15.18, 48.02), direction angle θ 23 =arctan2(48.02−46.91,15.18−13.72)=arctan2(1.11,1.46)=0.649rad (approximately 37.2°) Calculate the change in angle: Δθ² = 0.649 − 0.733 = −0.084 rad Calculate the curvature: k2 = -0.084 / 0.3064 = -0.274 rad / mm A negative value indicates that the path bends to the right at that point.
[0168] Repeat the above calculation for all 256 sampling points to obtain the first 10 values of the curvature sequence (unit: rad / mm), as shown in Table 2 below: Table 2: Curvature sequence display
[0169] S2-3: Discrete Fourier Transform For a curvature sequence C={k1,…,k...} of length 256 256 Perform a discrete Fourier transform.
[0170] Calculate X0 (DC component): X0 = ∑ j=0 255 k j =﹣12.45 Calculate X1 (fundamental frequency component): X1 = ∑ j=0 255 k j ×e ﹣i2π×1×j / 256 This calculation involves complex number operations. Let's take the first few examples (j=0, 1, 2): j=0:k0×e 0 =﹣0.251×1=﹣0.251 j=1:k1×e ﹣i2π×1 / 256 =﹣0.274×(cos(0.0245)-isin(0.0245))=﹣0.274×(0.9997-i0.0245)=﹣0.274+i0.0067 j=2: k2×e ﹣i2π×2 / 256 =﹣0.289×(cos(0.0491)-isin(0.0491))=﹣0.289×(0.9988-i0.0490)=﹣0.289+i0.0142 Summing all 256 terms, we get: X1 = -1.247 + i0.312 Take the amplitude value: A1 = |X1| = [(﹣1.247) 2 +(0.312) 2 ] 0.5 = (1.555 + 0.097) 0.5 =1.652 0.5 =1.285 Continue calculating the amplitude values from k=2 to k=32. Some results are shown in Table 3 below: Table 3: Results
[0171] S2-4: Normalized principal shape feature vector Calculate the sum of squares of the 32 amplitude values: ∑ m=1 32 A m 2 =1.285 2 +0.921 2 +0.578 2 +…+0.001 2 =1.651 + 0.848 + 0.334 + ... + 0.000 = 3.217 The root of the extract is 3.217. 0.5 =1.794 Normalization process: A^1 = 1.285 / 1.794 = 0.716 A^2 = 0.921 / 1.794 = 0.513 A^3 = 0.578 / 1.794 = 0.322 A^4 = 0.312 / 1.794 = 0.174 A^5 = 0.167 / 1.794 = 0.093 A^6 = 0.089 / 1.794 = 0.050 A^7 = 0.052 / 1.794 = 0.029 A^8 = 0.031 / 1.794 = 0.017 … A^ 32 =0.001 / 1.794=0.0006 We obtain the 32-dimensional principal shape feature vector: v shape =(0.716, 0.513, 0.322, 0.174, 0.093, 0.050, 0.029, 0.017, ..., 0.0006) S2-5: Auxiliary displacement feature vector Calculate the bounding box center: The bounding box boundary of this object is: x min =10.02, x max =32.15⇒c x =(10.02+32.15) / 2=21.09 y min =38.44, y max =53.21⇒c y =(38.44+53.21) / 2=45.83 Calculate the radial offset: For the first sampling point q1=(12.34, 45.67): r1=[(12.34-21.09)] 2 +(45.67-45.83) 2 ] 0.5 =[(﹣8.75) 2 +(﹣0.16) 2 ] 0.5 = (76.56 + 0.03) 0.5 =76.59 0.5 =8.75 mm For the second sampling point q2=(13.72, 46.91): r2=[(13.72-21.09) 2 +(46.91-45.83) 2 ] 0.5 =[(-7.37) 2 +(1.08) 2 ] 0.5 = (54.32 + 1.17) 0.5 =55.49 0.5 =7.45 mm The radial offset sequence was obtained by repeating the calculation on 256 sampling points. Some values are shown in Table 4 below: Table 4: Radial Offset Sequence
[0172] Calculate the mean: rˉ = (1 / 256) × ∑ j=1 256 r j =1843.20 / 256=7.20 mm Calculate the standard deviation: σ r =[(1 / 256)×∑ j=1 256 (r) j -7.20) 2 )] 0.5 Calculate the sum of squared deviations: ∑ j=1 256 (r j -7.20) 2 =(8.75-7.20) 2 +(7.45-7.20) 2 +…+(8.75-7.20) 2 =(1.55) 2 +(0.25) 2 +(﹣1.08) 2 +…+(1.55) 2 =2.40 + 0.06 + 1.17 + ... + 2.40 = 156.80 σ r =[156.80 / 256] 0.5 =0.6125 0.5 =0.783 Calculate the first-order autocorrelation coefficient: Calculate the numerator: ∑ j=2 256 (r j -7.20)(r j-1 -7.20) = (7.45 - 7.20)(8.75 - 7.20) + (6.12 - 7.20)(7.45 - 7.20) + … = 0.25 × 1.55 + (-1.08) × 0.25 + … = 0.388 + (-0.270) + … = 82.30 The denominator is ∑ j=1 256 (r j -7.20) 2 =156.80 ρ r =82.30 / 156.80=0.525 Logarithm and Combination: log(σ) r =log(0.783) = -0.245 v displace =(﹣0.245,0.525) S2-6: Color Quantization Coding The fill color (0, 102, 204) is normalized to [0, 1]: R=0, G=0.4, B=0.8 HSV conversion: C max =max(0, 0.4, 0.8)=0.8=B C min =min(0, 0.4, 0.8)=0 Δ = 0.8 − 0 = 0.8 Because C max =B:H=60°×[(0-0.4) / 0.8+4]=60°×(﹣0.5+4)=210° S = 0.8 / 0.8 = 1.0 V=0.8 Quantification: H quant =⌊210 / 10⌋=21 (binary: 010101) S quant =⌊1.0×4⌋=3 (binary: 11) V quant =⌊0.8×4⌋=3 (binary: 11) Fill color code: 010101 11 11 = 0101011111 (10 bits) The stroke color is white (255, 255, 255), which becomes (1, 1, 1) after normalization: H=0° (because R=G=B), H quant =0 (binary: 000000) S=0, S quant =0 (binary: 00) V=1, V quant =3 (binary: 11) Outline color code: 000000 00 11 = 0000000011 (10 digits) Overall color code: e color =01010111110000000011=01010111110000000011 (20 bits, but only the first 10 or the last 10 bits are taken. Here, the last 10 bits are taken as the final code, i.e., 0000000011) S2-7: 128-bit vector fingerprint combination Hash the principal shape feature vector: Convert 32 floating-point numbers A^1 to A^ 32 After serialization, the MurMurHash3 algorithm is used to calculate a 64-bit hash value, resulting in: hash shape =0x7A3B1C4D5E6F7890 Hash the auxiliary displacement eigenvector: Serialize the two floating-point numbers -0.245 and 0.525 and then hash them: hash displace =0x12345678ABCDEF00 Concatenation: First 64 bits: hash shape =0111101000111011000111000100110101011110011011110111100010010000 Middle 64 bits: hash displace =000100100011010001010110011110001010101111001101111011110111100000000 Last 10 digits: e color =0000000011 Final 128-bit fingerprint: f1=01111010 00111011 00011100 01001101 0101111001101111 01111000 10010000 00010010 00110100 01010110 01111000 1010101111001101 11101111 00000000 0000000011 (Note: The last 10 digits are padded with 0000000011) Step S3: Fast deduplication and template extraction based on LSH S3-1: Locality-Sensitive Hash Index Vector fingerprints for all 47 objects were generated using the above process. Taking f1 as an example: Six bit indices are randomly selected from each of the 20 hash tables. Assuming the bit indices selected in the first hash table are (3, 17, 45, 68, 92, 110), the values of these bits are retrieved from f1: Bit 3 = 0 Bit 17 = 1 Bit 45 = 0 68 bits = 1 92 bits = 1 Bit 110 = 0 The hash key is 010110 (binary), which is 22 in decimal. Assign f1 to bucket number 22 of the first hash table.
[0173] S3-2: Hamming Distance Calculation In the 22nd bucket of the first hash table, f1 and f8 (another object "Star Trail Mark Copy") were detected to be in the same bucket.
[0174] Calculate the Hamming distance: Compare the two 128-bit fingerprints bit by bit and count the number of differences. The comparison shows that f1 and f8 differ at bits 7, 33, and 89, while the other bits are the same.
[0175] d Hamming =3 Since 3 ≤ 19, it is determined to be a duplicate instance.
[0176] S3-3: MinHash Compression and Clustering Pairwise in-bucket comparisons were performed on all 47 fingerprints, and 8 duplicate instance pairs were found, involving 12 objects.
[0177] MinHash compression is performed on these 12 objects: taking f1 as an example, the index of the position with a 1 bit is: {0, 2, 4, 7, 9, 11, ...}, and a total of 67 1 bits are counted.
[0178] Using 64 random permutation functions, the first permutation function π1 rearranges the indices {0, 1, ..., 127} into {55, 23, 91, 17, ...}. The first MinHash value is min(π1(set)) = 17. This process is repeated to obtain 64 MinHash values.
[0179] DBSCAN clustering (Jaccard distance, ε=0.25, minPts=2): f1 and f8: Jaccard distance = 1 - (128 - 3) / 128 = 0.023 (less than 0.25, adjacent) f1 and f 12 (Another copy): Distance = 0.032 (adjacency) f1 and f 22 (Different elements): Distance = 0.78 (not adjacent) Clustering results: 3 clusters were formed. Cluster 1: contains {f1, f8, f...} 12 }——All are star trail markers Cluster 2: contains {f3, f 15 }—— Two identical title boxes Cluster 3: contains {f5, f 20 f 35 }——Three identical decorative lines S3-4: Selection of Representative Templates Taking cluster 1 as an example, it contains 3 objects: O1, O8, and O 12 The stack depth is 3 for all layers. The drawing order is 5, 2, 11. The O8 (order=2) with the smallest order is selected as the representative template.
[0180] Record its location characteristics: Enclosure: B repr =(10.02, 38.44, 32.15, 53.21) Center: c repr =(21.09, 45.83) Width and height: w=22.13 mm, h=14.77 mm Step S4: Semantic classification based on graph convolutional neural networks S4-1: Topology Graph Construction Taking the representative template O8 (star trail marker) as an example, its path has 32 points, which are identified as follows: Intersection points: Points 7 and 23 are both self-intersection points of the path, identified as 3 intersection points (two self-intersection points + a central intersection point?). Endpoint: The path is closed and has no endpoints. Actual calculation: There are 4 intersections (degree ≥ 2) and 4 endpoints (degree is 1, but the first and last points of a closed path coincide and are considered as one node, with a degree of 2).
[0181] The final number of nodes |V| = 7, and the number of edges |E| = 10.
[0182] Example of node feature calculation (node v1): Normalized coordinates: x = (12.34 - 21.09) / 22.13 = -0.395, y = (45.67 - 45.83) / 22.13 = -0.007 Curvature: k1 = -0.251 rad / mm Degree: deg(v1)=2 Type: type(v1)=1 (intersection) 5-dimensional node feature vector: (−0.395, −0.007, −0.251, 2, 1) Example of edge feature calculation (edge e) 12 (Connecting v1 and v2) Normalized side length: l = [∣∣(12.34, 45.67)-(18.92, 52.13)∣∣] / 22.13 = 8.12 / 22.13 = 0.367 Direction angle: θ = arctan²(52.13 - 45.67, 18.92 - 12.34) = arctan²(6.46, 6.58) = 0.775 rad Stroke type: style=0 (solid line) 3D edge feature vector: (0.367, 0.775, 0) S4-2: GCN Forward Propagation The constructed 7-node, 10-edge topology graph is input into a pre-trained three-layer GraphSAGE network.
[0183] First layer: Node v1 samples 10 neighbors (actually there are only 4, but all 4 are taken). Mean aggregation: h v1 (1) =ReLU(W (1) ×MEAN({h v1 (0) h v2 (0) h v3 (0) h v4 (0) h v6 (0) })) Where h vi (0) That is, the input 5-dimensional feature vector. Assume W... (1) ∈R 5×64 Output a 64-dimensional vector.
[0184] The second layer is similar to the third layer. After three aggregations, a 256-dimensional embedding for each node is obtained.
[0185] Global graph reading: The average of the 256-dimensional embeddings of the 7 nodes is taken to obtain the 256-dimensional global graph vector g.
[0186] Fully connected layer: g input FC1 (256→128, ReLU), then input FC2 (128→6, Softmax).
[0187] Assume the output probability distribution is: p = (0.02, 0.91, 0.04, 0.01, 0.01, 0.01) Category Index: 0 = Decorative Wireframe, 1 = Title Badge, 2 = Chart Component, 3 = Separator, 4 = Subscript, 5 = Background Texture Unit p1=0.91 is the maximum value, so the template is classified as "Title Badge".
[0188] Step S5: Knowledge Base Construction Assuming the knowledge base already has 1000 templates, the three newly identified clusters (star trail markers, title boxes, and decorative lines) and their representative templates are stored in the knowledge base.
[0189] Taking the star trail icon template as an example, the knowledge base entries are shown in Table 5 below:
[0190] Step S6: Intelligent Layout Matching and Recommendation S6-1: New Pattern Processing Assume the cover image of the new journal's fourth issue in 2026 has been parsed, resulting in 55 objects. Perform S2 to generate a fingerprint for each object.
[0191] S6-2: Precise Positioning Recommendation An object O was detected in the new pattern. new 12 The fingerprint has a Hamming distance of 5 with the fingerprint of template ID=1001 (highly similar), but the bounding box is 30.15mm wide and 20.22mm high. The original template is 22.13mm wide and 14.77mm high.
[0192] Width difference: (30.15-22.13) / 22.13=36.3%>15% Height difference: (20.22-14.77) / 14.77=36.9%>15% The generated recommendation is: "The size of the star trail icon element has been adjusted (width increased by 36.3%, height increased by 36.9%). It is recommended to replace it with the original template size (22.13mm × 14.77mm) to maintain layout consistency." Meanwhile, the historical operation records of template ID=1001 show that none of its instances have been edited (all instances of 'operated' are false), therefore no color scheme variation recommendations are generated.
[0193] S6-3: Recommendations for Complementary Layouts The new pattern contains 40 identified objects, and a layout diagram G is constructed. layout Suppose the following identified elements and their locations are detected, as shown in Table 6 below: Table 6: Identified Elements and Their Locations
[0194] Node distance determination (page size: 210mm × 297mm, half the height = 148.5mm): Distance AB: |180-200| = 20mm < 148.5mm, connect the edges, weight 1 / 20 = 0.05 Distance AC: |180-120| = 60 mm < 148.5 mm, connect the edges, weight 1 / 60 = 0.017 AD distance: |180−220| = 40mm < 148.5mm, connect the edges, weight 1 / 40 = 0.025 Distance BC: |200-120| = 80mm < 148.5mm, connect the edges, weight 1 / 80 = 0.013 BD distance: |200-220| = 20mm < 148.5mm, connecting edges, weight 1 / 20 = 0.05 CD distance: |120220| = 100mm < 148.5mm, connecting edges, weight 1 / 100 = 0.01 The layout diagram contains 4 nodes and 6 edges.
[0195] Searching in the third-level index of the knowledge base, the historical layout diagram H1 contains nodes (A', B', C', D', E'), where A', B', C', and D' correspond to A, B, C, and D respectively, and E' is a subscript element located at the upper right corner of the page (x=190mm, y=20mm).
[0196] VF2 subgraph isomorphic matching: A↔A' (Category 1 matching), B↔B' (Category 3 matching), C↔C' (Category 1 matching), D↔D' (Category 0 matching), edge distance: The distance between the sides of AB is 20mm, and the distance between the sides of A' and B' in H1 is 18mm. The difference (20-18) / 18 = 11.1% < 30%, therefore, a match is possible. The other edges are similar, all within a 30% tolerance. Match successful! Shared node count = 4, total number of nodes in H1 = 5, matching degree = 4 / 5 = 0.8.
[0197] Missing subgraph: E' (indicator), recommended template ID=784 (indicator element).
[0198] Recommendation generated: "Based on the current layout (title badge + separator + title box + decorative border), a missing matching corner mark element has been detected. It is recommended to add template ID=784 and place it in the upper right corner of the page (approximate coordinates: 190mm, 20mm)." A complete summary of the results of the examples is shown in Table 7 below: Table 7: Summary of Complete Results of the Examples
[0199] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.< / g>
Claims
1. A method for vector element recognition in journal image editing, characterized in that, Includes the following steps: Step S1: Parse the journal pattern file, recursively expand all grouped and wrapped structures, unlock layers and masks, extract the geometric path data, fill attributes, stroke attributes, transformation matrix, and stacking depth and drawing order information of each basic primitive object, and build an initial metadata pool. Step S2: Perform equal arc length resampling on the path of each primitive object, take 256 sampling points at equal intervals on the path, and calculate the discrete curvature value at each sampling point to obtain the curvature sequence; A discrete Fourier transform is performed on the curvature sequence, and the amplitude values of the first 32 non-zero frequency components are extracted and then normalized to obtain a 32-dimensional principal shape feature vector. The radial distance of each sampling point relative to the center of the object's bounding box is calculated, and the standard deviation and first-order autocorrelation coefficient of the radial distance sequence are calculated and combined to form a 2-dimensional auxiliary displacement feature vector. The fill color and stroke color are converted from the RGB color space to the HSV color space and then quantized and encoded to obtain a color code. The principal shape feature vector, auxiliary displacement feature vector, and color code are mapped to a 128-bit binary vector fingerprint using a hash function. Step S3: Use the multi-hash table local sensitive hashing algorithm to index all vector fingerprints. Calculate the binary Hamming distance for fingerprint pairs that fall into the same hash bucket. If the Hamming distance is less than a set threshold, determine them as similar shape instances. Then perform MinHash signature compression and density clustering. If the instances in the cluster are determined to be duplicate instances, select the object with the smallest stacking depth and the earliest drawing order in the cluster as the representative template and record its bounding box position information. Step S4: Convert the path of the representative template into a topological graph. Take the intersection and endpoint of the path as nodes and the path segment as edges. Extract the node features and edge features and input them into a pre-trained graph convolutional neural network. After multi-layer mean aggregation and global readout, output the semantic category probability through a fully connected layer and a Softmax function. Take the category with the maximum probability as the semantic category of the template. Step S5: Construct a three-layer index structure knowledge base containing a semantic category hash index, a MinHash signature space index, and a position sequence space index. Each entry stores the vector fingerprint of the template, the bounding box size, and historical occurrence records. Step S6: After performing steps S1 and S2 on the new journal pattern, use the knowledge base index to match similar templates to generate precise positioning recommendations. At the same time, construct a layout map of the identified objects in the new pattern according to their spatial location. Use the subgraph isomorphic matching algorithm to retrieve topologically similar historical layout maps in the knowledge base and infer the missing supporting elements to generate layout complementary recommendations.
2. The vector element recognition method in journal pattern editing according to claim 1, characterized in that, The discrete curvature in step S2 is calculated as follows: for the j-th sampling point, calculate the difference between the direction angles of the two chords formed by the j-th sampling point and the two adjacent sampling points before and after it, and then divide it by the equal arc length step size to obtain the discrete curvature value at that point.
3. The vector element recognition method in journal pattern editing according to claim 2, characterized in that, The norm normalization method described in step S2 is as follows: divide each of the 32 amplitude values by the square root of the sum of the squares of the 32 amplitude values.
4. The vector element recognition method in journal pattern editing according to claim 3, characterized in that, The standard deviation of the radial distance sequence in step S2 is calculated as follows: calculate the mean of all radial distances, subtract the mean from each radial distance, sum the squares, divide by the number of sampling points, and take the square root of the value; the first-order autocorrelation coefficient is calculated as follows: subtract the mean from all radial distances to obtain the deviation sequence, calculate the sum of the products of the deviation sequence and its one-position lagged sequence, and divide by the sum of the squares of the deviation sequence; the combination method is: combine the natural logarithm of the standard deviation and the autocorrelation coefficient into a 2-dimensional vector.
5. The vector element recognition method in journal pattern editing according to claim 4, characterized in that, The color encoding method described in step S2 is as follows: after normalizing the RGB color values of the fill color and the stroke color, the hue, saturation and lightness components are calculated according to the standard conversion formula. The hue is divided into 36 quantization intervals with 10-degree intervals, and the saturation and lightness are each evenly divided into 4 quantization intervals to obtain the quantization result. The quantization results of the fill color and the stroke color are concatenated into a binary color encoding.
6. The vector element recognition method in journal pattern editing according to claim 5, characterized in that, The specific method of the multi-hash table locality sensitive hashing algorithm in step S3 is as follows: set 20 hash tables, each hash table uses 6 random hyperplanes, and randomly select 6 bits as hash keys for each vector fingerprint in the 20 hash tables, and assign the fingerprint to the corresponding hash bucket; the threshold for the Hamming distance is set to 19 bits.
7. The vector element recognition method in journal pattern editing according to claim 6, characterized in that, The specific method of MinHash signature compression in step S3 is as follows: the positions where the binary bits are 1 in the 128-bit vector fingerprint are regarded as a set, and each index of the set is rearranged using 64 independent random permutation functions. The minimum value after each permutation is taken as the hash value corresponding to the permutation, resulting in a total of 64 hash values forming a 64-bit MinHash signature; the density clustering adopts the DBSCAN algorithm, with Jaccard distance as the metric, the radius parameter is set to 0.25, and the minimum number of adjacent sample points is set to 2.
8. The vector element recognition method in journal pattern editing according to claim 7, characterized in that, The node features in step S4 include five features: normalized coordinates, discrete curvature value, node degree, and node type. The edge features include three features: normalized edge length, orientation angle, and stroke type. The graph convolutional neural network adopts a three-layer structure. Each layer uses a mean aggregation function to aggregate the embedding vectors of the node itself and its neighboring nodes, and then applies a ReLU activation function. The output dimensions of the three layers are 64, 128, and 256, respectively. The global readout method is to take the dimensional average of all node embedding vectors output by the third layer to obtain the global graph vector.
9. The vector element recognition method in journal pattern editing according to claim 8, characterized in that, The specific method of the three-layer index structure in step S5 is as follows: the first layer is a hash index with semantic category identifier as key and a list of all template identifiers under that category as value; the second layer is a KD-Tree spatial index with 64-dimensional MinHash signature as key; and the third layer is an R-Tree spatial index with template bounding box center coordinates as key and storing historical position sequences.
10. The vector element recognition method in journal pattern editing according to claim 9, characterized in that, The specific method for complementary layout recommendation in step S6 is as follows: A layout graph is constructed using the bounding box center of each identified object in the new pattern as a node, with the Euclidean distance between nodes being less than half the page width or height as the edge connection condition, and the reciprocal of the distance as the edge weight. A variant of the VF2 subgraph isomorphic matching algorithm is used to retrieve historical layout graphs with topological similarity to the layout graph in the third-level index of the knowledge base, limiting the complete matching of node semantic categories and allowing a relative tolerance of plus or minus 30% for edge distance. For each matching historical layout graph, the templates corresponding to the subgraph structures it contains but are missing in the new pattern layout graph are extracted, and the top three are selected as recommendations after being sorted in descending order of matching degree.
Citation Information
Patent Citations
Method for improving calibration precision of shifting fork shifting force of transmission by applying CAE technology
CN109992822A
