Stable diffusion-based niche pattern recognition and optimization method

CN122887755APending Publication Date: 2026-10-09SICHUAN AGRI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511477149.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-16
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0007]针对现有技术的不足,本发明提供了基于StableDiffusion的小众纹样识别与优化方法,解决了现有基于人工智能的图像生成技术,例如基于StableDiffusion的模型,所生成的纹样图像为栅格格式,其内部结构与风格元素相互耦合,导致纹样不具备可编辑性、难以进行精确的参数化优化,并且在应用于矢量设计或工业生产时需要复杂的人工重绘的问题

Benefits of technology

1、本发明的用户能够通过修改与特定几何或风格属性直接对应的明确参数值,对生成的纹样进行确定性的、可预测的调整,从而实现了对纹样结构的精确控制。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122887755A_ABST
    Figure CN122887755A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of computer graphics and artificial intelligence, and discloses a small-pattern recognition and optimization method based on Stable Diffusion, which comprises the following steps: extracting a skeleton from an input raster pattern image, concurrently sampling color, texture and width information of the raster pattern image, binding a morph field vector to each skeleton point, and generating an attributed skeleton; converting the attributed skeleton into an attribute graph, searching and identifying one or more types of structure primitives in the attribute graph according to a preset attributed subgraph similarity function; analyzing the hierarchical and combination relationship among the structure primitives, reversely deducing a generative grammar containing structure generation rules and style propagation rules; and finally, extracting adjustable parameters according to the grammar, and iteratively generating a new vector format pattern according to the parameter values set by a user. The application converts a static bitmap into a dynamic vector generation model which can be accurately controlled and parameterized, and realizes the conversion from AI creative generation to direct industrial application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer graphics and artificial intelligence, specifically to a method for identifying and optimizing niche patterns based on StableDiffusion. Background Technology

[0002] In recent years, AI-powered content generation technologies, exemplified by models such as StableDiffusion, have made significant progress, enabling the creation of visually appealing and innovative content. This is particularly evident in niche and complex pattern design fields, where they have demonstrated powerful generative capabilities. Designers can quickly obtain a wealth of novel pattern ideas by inputting text prompts.

[0003] However, existing technologies have inherent limitations when utilizing these AI-generated results for in-depth design and industrial applications. Current mainstream image generation models output raster images. The inherent property of this format is that it represents an image as a pixel matrix, which does not contain any high-level structural information about the image content or generation logic.

[0004] This format characteristic leads to a series of problems. First, subsequent editing and optimization of the generated grid pattern is extremely difficult. Any modification, such as adjusting the size, rotation angle, or color of an element in the pattern, must be done manually, pixel-level image processing software. This process is not only inefficient but also easily destroys the overall harmony and integrity of the pattern's details.

[0005] Secondly, the existing generation process lacks precise parametric control. Users primarily guide changes in the generated results by modifying natural language text prompts, which is an indirect and non-deterministic control method. This makes it difficult to achieve systematic and predictable adjustments to specific structural or stylistic attributes of the pattern. Therefore, it is impossible to develop a series of derivative designs based on a satisfactory initial design.

[0006] Furthermore, raster image formats face insurmountable obstacles when applied to industrial production processes requiring high precision and scalability. Whether for textile printing, material surface etching, or other computer-aided manufacturing scenarios, vector graphics formats are typically required as input. Converting complex AI-generated raster patterns into clean, usable vector graphics often necessitates time-consuming and laborious manual redrawing or tracing by designers. This not only constitutes a major bottleneck in the design process but also frequently leads to the loss of subtle details in the original AI design. Summary of the Invention

[0007] To address the shortcomings of existing technologies, this invention provides a method for identifying and optimizing niche patterns based on StableDiffusion. This method solves the problem that existing AI-based image generation technologies, such as those based on StableDiffusion, produce raster-format pattern images with coupled internal structures and style elements. This results in patterns that are not editable, difficult to perform precise parametric optimization, and require complex manual redrawing when applied to vector design or industrial production.

[0008] To address the aforementioned technical problems, this invention provides a system and method for identifying and optimizing niche patterns based on StableDiffusion.

[0009] The first aspect of this invention provides a niche pattern recognition and optimization system based on StableDiffusion, which includes: an attributed skeleton extraction module, a structural primitive mining module, a generative grammar derivation module, and a parameterized regeneration module.

[0010] The attributed skeleton extraction module is used to receive the input raster pattern image, perform binarization processing on the raster pattern image, and extract a skeleton with a width of one pixel using a distance transform algorithm. During the extraction of the skeleton, the module concurrently performs neighborhood sampling on the input raster pattern image with each skeleton point as the center, calculates and binds a morphological field vector for each skeleton point, thereby generating an attributed skeleton.

[0011] In one embodiment, the morphological field vector From color attribute vector Texture attribute vector and width property scalar Composition, which is defined as: ; in, These are the skeleton points on the skeleton; To achieve this by analyzing the skeleton points The color attribute vector is obtained by weighted averaging of the color values ​​in the corresponding neighborhood of the input raster pattern image; To achieve this by analyzing the skeleton points The texture attribute vector is obtained by calculating the local binary pattern histogram of the gray values ​​in the corresponding neighborhood of the input raster pattern image; For the skeleton point The minimum Euclidean distance to the foreground boundary of the binarized raster pattern image.

[0012] The structural primitive mining module, connected to the attributed skeleton extraction module, is used to receive the attributed skeleton. This module first defines skeleton points with a degree not equal to 2 as nodes and continuous skeleton paths connecting nodes as edges, thereby constructing an attribute graph. Subsequently, the module uses a preset attributed subgraph similarity function to search for topologically isomorphic and attribute-similar subgraph clusters in the attribute graph, and defines each subgraph cluster as a type of structural primitive.

[0013] In one embodiment, the attributed subgraph similarity function The calculation method is as follows: ; in, and These are two subgraphs to be compared within the attribute graph; Let be a topological isomorphism criterion function if and only if the subgraph and Its value is 1 when topologically isomorphic, and 0 otherwise; A similarity function of attributes is used in the subgraph and Under the condition of topological isomorphism, calculate the weighted similarity of the morphological field vectors of the corresponding nodes and edges.

[0014] The generative grammar derivation module, connected to the structural primitive mining module, is used to receive one or more types of structural primitives and their positions and hierarchical relationships in the attribute graph. This module analyzes the inclusion and substitution relationships between structural primitives of different sizes to derive structural generation rules for describing pattern geometry generation. Simultaneously, for each structural generation rule, the module synchronously analyzes the statistical transformation relationship of the morphological field vectors between its parent and child primitives, deriving style propagation rules for describing pattern style evolution. The structural generation rules and the style propagation rules together constitute a generative grammar.

[0015] In one embodiment, the style propagation rule includes a color propagation rule for defining the transformation relationship between parent and child primitive color attribute vectors, which is defined as follows: ; in, For the father's generation of basic elements, As the offspring unit; and These are the average color attribute vectors of the parent and child primitives, respectively; This is the color transformation matrix obtained by performing linear regression fitting on multiple instances; It is a color offset vector.

[0016] The parameterized regeneration module, connected to the generative grammar derivation module, receives the generative grammar. This module extracts a set of adjustable parameters from the affine transformation operators of the structure generation rules and the statistical transformation relationships of the style propagation rules. Based on the specific values ​​set by the user for these parameters, the module iteratively executes the generative grammar, starting from the initial primitives, to generate the final attribute graph. Then, based on the geometric structure and morphological field vector attributes of the final attribute graph, it renders and outputs a new pattern in vector format.

[0017] A second aspect of this invention provides a method for identifying and optimizing niche patterns based on StableDiffusion, the method comprising: S1. The step of extracting the attributed skeleton: This step processes the input raster pattern image, extracts the skeleton of the pattern, and concurrently samples the corresponding positions of the raster pattern image, binding a morphological field vector to each skeleton point on the skeleton, thereby generating the attributed skeleton. S2, the step of mining structural primitives, which transforms the attributed skeleton into an attribute graph, and searches and identifies one or more types of structural primitives in the attribute graph according to a preset attributed subgraph similarity function. S3. The steps for deriving a generative grammar are as follows: This step analyzes the hierarchical and combinatorial relationships between the structural primitives and reverse-derives a generative grammar that includes structural generation rules and style propagation rules. S4. The step of parametric regeneration involves extracting adjustable parameters based on the generative grammar and iteratively generating new patterns output in vector format based on user-defined parameter values.

[0018] This invention provides a method for identifying and optimizing niche patterns based on StableDiffusion. It offers the following advantages: 1. Users of this invention can make deterministic and predictable adjustments to the generated patterns by modifying explicit parameter values ​​that directly correspond to specific geometric or style attributes, thereby achieving precise control over the pattern structure.

[0019] 2. This invention uses an attributed skeleton extraction module to extract the pattern skeleton while concurrently binding a morphological field vector containing color, texture, and width information to each skeleton point. Furthermore, it establishes a correspondence between structure generation rules and style propagation rules in the subsequent generative grammar. Therefore, when generating new patterns using the parametric regeneration module, changes in geometric structure and evolution of visual style will follow the same internal generation logic, ensuring that the generated series of patterns have a high degree of unity and logical coherence in structure and style.

[0020] 3. This invention, through a parametric regeneration module, directly renders and outputs vector-format patterns after iteratively generating the final attribute map. Unlike existing technologies that generate raster images with fixed resolutions, the vector files output by this invention have resolution-independent characteristics and can be directly recognized and processed by computer-aided design and computer-aided manufacturing software. This eliminates the manual redrawing step from raster images to vector graphics and improves the conversion efficiency from creative generation to industrial application. Attached Figure Description

[0021] Figure 1 This is a system architecture diagram of the present invention; Figure 2 This is a flowchart of the method of the present invention. Detailed Implementation

[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0023] Example: Please see the appendix Figure 1 This invention provides a method for identifying and optimizing niche patterns based on StableDiffusion, including: The attributed skeleton extraction module is used to process the input raster pattern image, extract the skeleton of the pattern, and concurrently sample the corresponding positions in the raster pattern image. It binds a morphological field vector to each skeleton point on the skeleton, thereby generating an attributed skeleton. In this embodiment, the attributed skeleton extraction module, as a functional unit in the system of the present invention, aims to transform the input, unstructured raster pattern image into an attributed data structure that carries both topological structure information and local visual style information. The specific implementation of this module includes the following steps.

[0024] Specifically, upon receiving an input raster pattern image, the module first performs an image preprocessing step to separate the foreground pattern from the background. To improve the method's adaptability to images from different sources and under different lighting conditions, this step employs an adaptive thresholding method on the input raster pattern image. Binarization is performed. Preferably, Otsu's method can be used to automatically calculate an optimal global segmentation threshold, thereby generating a binary image. The pixel values ​​in this binary image are set as identifiers for the foreground or background, as shown below: ; in, The set of pixels with a median value of 1 constitutes the foreground of the pattern to be analyzed.

[0025] After obtaining the binary image, the core function of this module is to extract its skeleton and simultaneously perform attribute sampling. This module employs a distance-transform-based curve skeletonization algorithm, such as the Medusa transform, to calculate a one-pixel-wide central skeleton for the foreground region. This skeleton is composed of a series of skeleton points. The set that constitutes the composition.

[0026] A key aspect of this embodiment is that the skeleton extraction process and the attribute sampling process are not executed sequentially, but concurrently. This means that during the iterative process of the skeletonization algorithm, when each skeleton point is determined... When the position is determined in the image coordinate system, the module immediately centers on that point in the input, unprocessed raw raster pattern image. The corresponding position and its neighborhood Multi-dimensional information sampling is performed within the image. The purpose of this is to directly and firmly bind the pure geometric skeleton points to their visual context in the original image, thereby avoiding the irreversible loss of style information that may occur during simple skeletonization.

[0027] To achieve this binding, the module assigns each skeleton point... A morphological field vector was constructed. This vector is a multi-dimensional data structure whose function is to comprehensively describe the skeleton points in a quantitative manner. The local visual style attributes of the location. This morphological field vector consists of three main components: ; For morphological field vectors The specific calculation methods for each component are explained below: First, there is the color attribute vector. To obtain a stable color metric that better matches human visual perception, the original raster pattern image can be sampled before sampling. The color space is converted from its original RGB color space to a perceived uniform space, preferably using the CIELAB color space. Then, at the skeleton points... Gaussian neighborhood Within this process, a weighted average of the CIELAB color values ​​of each pixel is calculated to effectively suppress image noise and extract the dominant color tone. The calculation formula is as follows: ; in, For pixels in the neighborhood CIELAB color vectors, It is a skeleton point The Gaussian weight function centered at the center is defined as follows: Here, For point With point The Euclidean distance between them The standard deviation of the Gaussian kernel is used to control the range of neighborhood weight decay.

[0028] Secondly, there is the texture attribute vector. To capture and quantify subtle features such as surface texture, material reflection, or brushstrokes in patterns, this module uses skeletal points... neighborhood Inside, the grayscale version of the image Calculate a texture descriptor. Preferably, a Local Binary Pattern (LBP) algorithm can be used, and the calculated LBP encoded values ​​are statistically converted into a histogram, which is the texture attribute vector. : ; in, This represents the operation of statistically analyzing the LBP encoded values ​​within the neighborhood and generating a histogram. This vector can effectively describe the texture composition of a local region.

[0029] Thirdly, it is the width attribute scalar. To accurately describe the variation in thickness of the pattern at different locations, this attribute value is defined as the skeleton point. To binary image Foreground boundary The shortest Euclidean distance. This value is an inherent product of the Medusa Transform algorithm in the skeleton calculation process. In this embodiment, it is directly extracted and used as a component of the morphological field vector. Its calculation method is as follows: ; in, This represents the set of boundary points of the foreground region in a binary image.

[0030] Through the above steps, the final output of the attributed skeleton extraction module is the attributed skeleton. The attributed skeleton is a set containing all skeleton points and their corresponding morphological field vectors, i.e. Thus, an originally unstructured raster pattern image is successfully transformed into a one-dimensional, discrete, attributed data structure where each structural point carries multi-dimensional quantified style information. This data structure not only preserves the core topological connectivity of the pattern but also solidifies its local visual artistic features in a numerical manner, thereby providing sufficient and necessary data support for subsequent structural primitive mining and generative grammar derivation steps.

[0031] The structural primitive mining module is used to convert attributed skeletons into attributed graphs, and search and identify one or more types of structural primitives in the attributed graphs based on a preset attributed subgraph similarity function. In this embodiment, the structural primitive mining module, as the core analysis unit of the system of the present invention, receives the attributed skeleton generated by the attributed skeleton extraction module. The purpose of this module is to abstract and organize the discrete point set data generated in the previous stage into a mathematical structure that is more suitable for topological analysis and pattern recognition. On this basis, it automatically and objectively mines the reusable basic building blocks that constitute the entire pattern, namely the structural primitives.

[0032] Specifically, when the module receives the attributed skeleton Next, the attribute graph construction step is performed. The purpose of this step is to transform the one-dimensional linear skeleton structure into a graph structure composed of nodes and edges, enabling analysis using graph theory tools. In one embodiment, this module traverses all skeleton points in the attributed skeleton and determines the role of each point in the graph structure based on its connections: All skeleton points with a connectivity of not equal to 2, i.e., endpoints (connectivity of 1) and intersections (connectivity of greater than 2), are defined as attribute graphs. nodes .

[0033] A continuous skeleton path connecting any two nodes is defined as an edge of the attribute graph. .

[0034] After defining the graph's topology, the module will also attribute the morphological field vectors bound to the skeleton. Aggregate the data onto the corresponding graph elements to construct a complete attribute graph. .in, and These are the attribute sets for nodes and edges, respectively. Preferably, an edge... The attributes can be obtained by aggregating the morphological field vectors of all skeleton points along its path. For example, the edge The color attribute vector can be taken from the color vectors of all points on the path. The average value; while its width attribute can be obtained by measuring the width scalar of all points on its path. A polynomial function is fitted to the graph, and a set of coefficients is used to characterize the trend of width variation. This transforms the attributes of discrete points into continuous or aggregated attributes of graph elements, providing a basis for subsequent similarity comparisons.

[0035] After successfully constructing the property graph Next, the core task of this module is to mine structural primitives. This process aims to search and identify recurring subgraphs in the attribute graph that are structurally identical and similar in style attributes. To achieve this, this embodiment introduces and defines an attributed subgraph similarity function. Used to quantize any two subgraphs and The degree of similarity between them. The design of this function takes into account the consistency of both topological structure and visual style.

[0036] Attributed subgraph similarity function The calculation method is as follows: ; The result of this function is obtained by multiplying two parts: First, there is the topological isomorphism judgment function. This function is used for rigorous structural comparison; its purpose is to determine the relationship between two subgraphs. and Whether the node connections are completely identical, i.e., whether there is a graph isomorphism. This is a Boolean function: ; in, Subgraph and It is topologically isomorphic. Subsequent attribute similarity calculations are only meaningful when this function returns 1. This ensures that the identified structural primitives have the same basic shape in their geometric skeletons.

[0037] Secondly, there is the attribute similarity function. This function, assuming the two subgraphs are topologically isomorphic, further quantifies their similarity in visual style. The function's value is obtained by weighted summation of similarity across different attribute dimensions: ; in, Assign preset weights to each attribute, and satisfy the following conditions: Similarity scores for each item This is calculated by comparing the attributes of the corresponding graph elements under the graph isomorphism mapping. Preferably, color similarity is used. Cosine similarity of the corresponding element color attribute vectors can be used to measure it; texture similarity The histogram intersection coefficients of the corresponding element texture attribute vectors can be used to measure width similarity; The normalized Euclidean distance of the corresponding element's width attribute can be used for measurement.

[0038] This module uses a recursive subgraph search algorithm to search the entire attribute graph. The module iterates through the subgraphs. For each subgraph pair found, the module uses an attributed subgraph similarity function. Perform the calculation. If the calculation result is higher than the preset similarity threshold... At that time, that is Then the subgraph is considered and They belong to the same type of structural unit.

[0039] By performing the pairwise comparisons and clustering described above on all subgraphs in the entire graph, the final output of this module is a series of categories of structural primitives. Each category Each represents a basic unit that recurs in the original pattern, possessing both a specific structure and style. This output reveals the inherent compositional rules of the original pattern in a highly abstract and structured manner, and provides direct and effective input for the next stage of the generative grammar derivation module.

[0040] The generative grammar derivation module is used to analyze the hierarchical and combinatorial relationships between structural primitives and derive a generative grammar that includes structural generation rules and style propagation rules. In this embodiment, the generative grammar derivation module, serving as the logical inference unit in the system of this invention, is connected to the structural primitive mining module. This module receives a series of structural primitive categories identified in the previous stage. and its properties All instances within this module. The core function of this module is to reverse engineer and derive a formal grammar that can completely describe the original pattern generation logic by analyzing the spatial hierarchical relationships and attribute evolution rules among these structural primitive instances, i.e., a generative grammar.

[0041] Specifically, the generative grammar derived in this module While it borrows from the L-System in form, its key innovation lies in its production rules. It is not a single structure replacement rule, but a set of structure generation rules. Rules of Style Communication The rule duality of the formation, that is This design aims to model the geometric construction process of a pattern in a unified manner with the evolution of its visual style, thereby ensuring the inherent consistency of subsequently generated patterns.

[0042] After receiving the input set of structural primitives, the module first performs structural generation rules. The derivation of this process aims to infer the dynamic, hierarchical construction steps from a static, completed pattern layout. In one embodiment, the module identifies the hierarchy by analyzing the spatial containment relationships between different categories of structural primitive instances in the attribute graph. For example, if the module observes multiple large-sized structural primitives in the graph... Instances whose geometric boundaries spatially contain one or more smaller primitives. , From examples such as these, a rule for structure generation can be derived.

[0043] This structure generation rule It is expressed using a context-free grammar, and its general form is as follows: ; in, The predecessor term represents a parent primitive; "Etc" represents a successor term, indicating a child primitive. ∘ is an affine transformation operator used to precisely describe the spatial pose of a child primitive relative to its parent primitive; ∘ is a geometric combination operator. Through this rule, a complex structural unit is decomposed into its constituent parts, thus revealing the recursive or combinatorial construction method of the pattern.

[0044] Another key aspect of this embodiment is that, while deriving each structure generation rule, the module simultaneously derives the corresponding style propagation rule. The purpose of this is not only to replicate the geometric structure, but also to learn and reproduce the subtle stylistic evolution patterns that accompany changes in the structural layers of the original patterns.

[0045] Therefore, for each identified structure generation rule instance, the module extracts the aggregated morphological field vector of its parent and child primitive instances, and fits the quantitative transformation relationship between parent and child attributes by performing statistical analysis on all instances of the rule.

[0046] Specifically, style dissemination rules Includes transformation functions for different attribute components: Color propagation rule: This rule describes how the color of a child primitive is derived from the color of its parent primitive. Preferably, this transformation relationship can be modeled as a linear transformation. For a structural rule... Its color propagation rules are as follows: ; in, and These are the average color attribute vectors of the parent and child primitives, respectively; It is a 3x3 color transformation matrix; This is a color offset vector. These two parameters... and It was obtained by performing multiple linear regression analysis on all instances of the structural rule appearing in the original attribute graph, thus capturing the overall trend of color change in a statistically optimal way.

[0047] Width propagation rule: This rule defines how the thickness of pattern lines varies with structural levels. In one embodiment, this relationship is modeled as a scaling factor: ; in, and These are the average width attribute scalars for the parent and child primitives, respectively. This is a width scaling factor, the value of which is determined by calculating the average of the child-to-parent width ratios across all instances of the rule.

[0048] Texture propagation rule: This rule describes the evolution of texture features. This relationship can be more complex and can be defined as a non-linear function. ; in, and These are the texture attribute vectors for the parent and child generations; It is a texture evolution function, which can be a linear interpolation, a neural network model or other mapping function, and its form depends on the specific pattern features; The recursive depth parameter is introduced so that the evolution of the texture can depend on its depth in the structural hierarchy, for example, presenting a simplified texture at the end of the pattern.

[0049] By analyzing all the hierarchical relationships in the diagram as described above, the final output of the generative grammar derivation module is a complete generative grammar. The grammar consists of an axiom (usually the largest or top-level structural primitive in the graph) and a set of dual production rules. This grammar, in a highly condensed and abstract form, completely encodes all the generation information of the original pattern, from macroscopic layout to microscopic style, providing an executable and deterministic instruction set for the next stage of parameterized regeneration module.

[0050] The parameterized regeneration module is used to extract adjustable parameters based on the generative grammar and iteratively generate new patterns that are output in vector format based on the user-defined parameter values. In this embodiment, the parameterized regeneration module, serving as the execution unit in the system of this invention that implements the transformation from abstract rules to concrete designs, is connected to the output of the generative grammar derivation module. This module receives the generative grammar completely derived in the previous stage. The core function of this module is to transform the static, descriptive grammar rules into a dynamic, interactive generative model, and finally output vector-format patterns that can be directly used in industrial applications.

[0051] Specifically, when the module receives a generative grammar After that, it first performs the parameter extraction step. The purpose of this step is to extract parameters from the duality of the grammar's production rules. In this process, the module automatically identifies and extracts all parameters that are fixed as constants during the derivation process, exposing these parameters to the user to control the generation process. In one embodiment, the parameter set extracted by this module... include: Derived from structure generation rules The geometric transformation parameters in the affine transformation. Specifically, these are the parameters that constitute each affine transformation operator. The rotation angle, scaling factor, and translation vector.

[0052] Derived from style communication rules The style evolution parameters in the code. Specifically, this includes the color transformation matrix used for the color propagation rules. Each element and color offset vector in The individual components; the width scaling factor used for the width propagation rule. ; and texture evolution functions for texture propagation rules. The adjustable coefficient in.

[0053] Global control parameter, i.e., recursion depth It is used to control the complexity and level of detail of the generated patterns.

[0054] After completing parameter extraction and constructing the parameter set This module then provides these parameters to the user interface. This module receives the parameter set from the user. The specific value set .

[0055] Subsequently, this module enters the core iterative generation step. This step is based on user-defined parameter values. and recursion depth Strictly and deterministically execute generative grammars This process begins with an axiom in the grammar, namely the initial structural primitives that represent the initial state of the pattern.

[0056] This module iteratively repeats the following operations until the user-defined recursion depth is reached. : In each iteration, the module traverses the currently generated geometry, searching for all instances that match the predecessors of a given production rule. For each matching instance, the module applies the dual of that production rule. Perform replacement and generation.

[0057] This application process is performed synchronously: First, the rules for generating the module application structure. Based on the user-defined affine transformation parameters, the parent primitives are replaced with geometric combinations of child primitives that have undergone precise translation, rotation, and scaling. This operation constructs the geometric skeleton for the next level.

[0058] At the same time, the style propagation rules are applied synchronously to the module. For each newly generated child primitive, the module calculates its own morphological field vector precisely based on the morphological field vector of its parent primitive and the user-defined style evolution parameters. For example, the calculation of its color attribute vector follows: ; This ensures that the newly generated geometry is endowed with the correct visual style attributes that are consistent with its structural hierarchy.

[0059] Once the iteration process reaches the preset recursion depth, the module's output is the final attribute graph with complete attribute information. This attribute graph is an internal data structure that needs to be converted into a visual graph.

[0060] Therefore, the final step in this module is vectorization rendering. This step will produce the final attribute map. It converts the data into a standardized vector graphics file. In one embodiment, the module iterates through each edge of the final property graph. For each edge, the module reads its associated morphological field vector attribute and renders accordingly: The geometric path of that edge is itself used as the baseline for rendering.

[0061] The width attribute scalar of this side The stroke thickness used to set the rendering path.

[0062] The color attribute vector of this edge Used to set the stroke color of the rendering path; if the property is in function form, it can achieve color gradient.

[0063] The texture attribute vector of this edge It can be used in driver-driven texture shaders to give surface texture to the rendering path.

[0064] Through the rendering process described above, the module ultimately outputs a complete, resolution-independent vector pattern. Preferably, this vector format is SVG. This output file retains the structured information of the pattern, can be scaled infinitely without distortion, and can be directly used by downstream computer-aided design or manufacturing software.

[0065] Please see the appendix Figure 2 Another embodiment of the invention provides a method for identifying and optimizing niche patterns based on StableDiffusion, including the following steps: S1. The step of extracting the attributed skeleton is to process the input raster pattern image, extract the skeleton of the pattern, and concurrently sample the corresponding positions in the raster pattern image, and bind a morphological field vector to each skeleton point on the skeleton to generate the attributed skeleton. S2, the step of mining structural primitives, which transforms the attributed skeleton into an attributed graph, and searches and identifies one or more types of structural primitives in the attributed graph based on a preset attributed subgraph similarity function. S3. The steps for deriving a generative grammar are as follows: This step analyzes the hierarchical and combinatorial relationships between structural primitives and reverse-derives a generative grammar that includes structural generation rules and style propagation rules. S4. The parameterized regeneration step extracts adjustable parameters based on the generative grammar and iteratively generates new patterns output in vector format based on user-defined parameter values.

[0066] The method in this embodiment can be used to execute the above system embodiment, and its principle and technical effect are similar, so it will not be described again here.

[0067] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A niche pattern recognition and optimization system based on StableDiffusion, characterized in that, include: The attributed skeleton extraction module is used to process the input raster pattern image, extract the skeleton of the pattern, and concurrently sample the corresponding positions of the raster pattern image, and bind a morphological field vector to each skeleton point on the skeleton to generate an attributed skeleton. The structural primitive mining module is used to convert the attributed skeleton into an attribute graph, and search and identify one or more types of structural primitives in the attribute graph according to a preset attributed subgraph similarity function. The generative grammar derivation module is used to analyze the hierarchical and combinatorial relationships between the structural primitives and derive a generative grammar that includes structural generation rules and style propagation rules. The parameterized regeneration module is used to extract adjustable parameters based on the generative grammar, and iteratively generate new patterns output in vector format based on user-defined parameter values.

2. The niche pattern recognition and optimization system based on StableDiffusion according to claim 1, characterized in that, The attributed skeleton extraction module is specifically used for: Each skeleton point is bound to a morphological field vector consisting of a color attribute vector, a texture attribute vector, and a width attribute scalar.

3. The niche pattern recognition and optimization system based on StableDiffusion according to claim 2, characterized in that, The morphological field vector The definition is as follows: ; in, Skeleton points on the skeleton The morphological field vector; For the skeleton point The color attribute vector; For the skeleton point The texture attribute vector; and For the skeleton point The width attribute scalar.

4. The niche pattern recognition and optimization system based on StableDiffusion according to claim 1, characterized in that, The structural element mining module is specifically used for: The attributed subgraph similarity function is used to judge any two subgraphs in the attributed graph. The calculation of the attributed subgraph similarity function depends on both the topological isomorphism and the attribute similarity of the two subgraphs.

5. The niche pattern recognition and optimization system based on StableDiffusion according to claim 4, characterized in that, The attributed subgraph similarity function The calculation method is as follows: ; in, The value of the attributed subgraph similarity function; and These are two subgraphs to be compared within the attribute graph; The value of the topological isomorphism determination function used to determine the topological isomorphism; This is the value of the attribute similarity function used to calculate the attribute similarity.

6. The niche pattern recognition and optimization system based on StableDiffusion according to claim 1, characterized in that, The generative grammar derivation module is specifically used for: Based on the structural generation rules derived from the combination relationships between each of the structural primitives, the quantization relationship of the morphological field vectors between the parent primitives and the child primitives is analyzed simultaneously to derive the corresponding style propagation rules.

7. The niche pattern recognition and optimization system based on StableDiffusion according to claim 6, characterized in that, The style propagation rule includes a color propagation rule, which defines the transformation relationship between the color attribute vector of the child primitive and the color attribute vector of the parent primitive through a color transformation matrix and a color offset vector.

8. The niche pattern recognition and optimization system based on StableDiffusion according to claim 1, characterized in that, The parameterized regeneration module is specifically used for: Affine transformation parameters are extracted from the structure generation rules of the generative grammar, and evolution parameters of color, width, or texture are extracted from the style propagation rules, together forming parameters that can be adjusted by the user.

9. The niche pattern recognition and optimization system based on StableDiffusion according to claim 1, characterized in that, The vector format output by the parameterized regeneration module is SVG format.

10. A method for identifying and optimizing niche patterns based on StableDiffusion, the system for identifying and optimizing niche patterns based on StableDiffusion according to any one of claims 1-9, comprising the following steps: S1. The step of extracting the attributed skeleton: This step processes the input raster pattern image, extracts the skeleton of the pattern, and concurrently samples the corresponding positions of the raster pattern image, binding a morphological field vector to each skeleton point on the skeleton, thereby generating the attributed skeleton. S2, the step of mining structural primitives, which transforms the attributed skeleton into an attribute graph, and searches and identifies one or more types of structural primitives in the attribute graph according to a preset attributed subgraph similarity function. S3. The steps for deriving a generative grammar are as follows: This step analyzes the hierarchical and combinatorial relationships between the structural primitives and reverse-derives a generative grammar that includes structural generation rules and style propagation rules. S4. The step of parametric regeneration involves extracting adjustable parameters based on the generative grammar and iteratively generating new patterns output in vector format based on user-defined parameter values.