A wax-printed butterfly pattern extraction method based on edge perception and semantic gating

By using a nested edge-aware network and an adaptive semantic gating mechanism, the problem of edge detection errors and breaks caused by ice-like interference in batik images was solved, achieving high-precision extraction and detail preservation of batik butterfly patterns.

CN122492737APending Publication Date: 2026-07-31BEIJING INSTITUTE OF GRAPHIC COMMUNICATION
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING INSTITUTE OF GRAPHIC COMMUNICATION
Filing Date
2026-04-29
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing technologies are prone to interference from ice patterns when extracting batik butterfly patterns from batik images, and edge detection is prone to errors. Multi-scale networks lack an adaptive filtering mechanism during feature fusion, resulting in rough and broken edges that lose their artistic beauty.

Method used

An edge-aware and semantic-gated approach is adopted. Multi-scale features are extracted by a nested edge-aware network and a hollow spatial pyramid pooling module. Combined with an adaptive deep semantic gating mechanism, the fusion ratio is dynamically adjusted to suppress ice-crack noise and stitch up edge breaks.

Benefits of technology

It achieves high-precision, high-connectivity batik pattern extraction against a complex ice-pattern background, preserving the details and artistic beauty of the batik butterfly pattern.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122492737A_ABST
    Figure CN122492737A_ABST
Patent Text Reader

Abstract

This disclosure provides a method for extracting batik butterfly patterns based on edge perception and semantic gating. The method includes steps S11-S15: S11: Acquire raw batik image data, perform standardization preprocessing and complexity awareness, and construct input tensors for images in simple and complex pattern sets; S12: Input the input tensors into a nested edge perception network to extract multi-scale features and capture global distribution and multi-scale contextual features; S13: Generate multi-level fusion features; S14: Based on the nested architecture, generate corresponding multi-level side prediction maps and calculate the initial fusion prediction results; S15: Construct an adaptive deep semantic gating mechanism to output the final extracted batik butterfly pattern result. This method addresses the problems of ice crack interference and edge breakage in existing batik image pattern extraction methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer science, and more specifically, to a method for extracting batik butterfly patterns based on edge perception and semantic gating. Background Technology

[0002] Batik is a traditional intangible cultural heritage of my country, and its unique "ice pattern" is the soul of batik art. Among the many batik patterns, the butterfly pattern is the most common due to its rich cultural connotations. With the advancement of intangible cultural heritage digitization, how to accurately extract and vectorize the butterfly pattern on batik fabric has become a research hotspot.

[0003] In the field of traditional image processing, Zhang Yu et al. proposed an edge detection method based on a genetic algorithm to optimize the Canny operator for extracting patterns from woven and embroidered cultural relics. This method effectively extracted the pattern outlines of woven and embroidered cultural relics, proving the application value of edge detection technology in the digitization of intangible cultural heritage. However, when faced with the unique and dense "ice crack" noise in batik images, relying solely on traditional edge detection operators often extracts a large number of invalid ice crack boundaries, making it difficult to distinguish the main pattern from background noise.

[0004] With the development of deep learning, semantic segmentation technology has been introduced into pattern extraction. Chen Shijie et al. proposed an image semantic segmentation algorithm based on a multi-scale network to address the problem of pattern extraction from Miao embroidery pieces. By introducing a multi-scale extraction mechanism and residual structure, the algorithm effectively extracts global pattern information and significantly improves the model's segmentation accuracy for ethnic minority clothing patterns.

[0005] Although the aforementioned existing technologies have achieved significant results in pattern extraction in specific intangible cultural heritage fields, the following technical challenges remain when directly applied to extract batik butterfly patterns against a complex ice-pattern background: (1) The background of the batik image is covered with dense ice patterns. The shallow network is very likely to misidentify the ice patterns as the edge of the pattern, resulting in noise in the extraction result.

[0006] (2) The butterfly pattern varies greatly in size. Although conventional multi-scale networks expand the receptive field, they lack an adaptive filtering mechanism for noise and effective features when processing the fusion of features at different scales.

[0007] (3) In the feature fusion stage, deep semantic features are often accompanied by a decrease in spatial resolution, resulting in rough edges, loss of microscopic antennae, and even edge breakage of the extracted butterfly, thus losing its original artistic beauty.

[0008] Therefore, there is an urgent need for a novel extraction method that can overcome the interference of complex ice patterns, adapt to multi-scale changes, and maintain the high connectivity of the pattern edges. Summary of the Invention

[0009] The purpose of this disclosure is to provide a method for extracting batik butterfly patterns based on edge awareness and semantic gating, aiming to solve the problems of ice crack interference and edge breakage when extracting batik image patterns using existing methods.

[0010] In general, a method for extracting batik butterfly patterns based on edge awareness and semantic gating is provided, including steps S11-S15: S11: Collect the original batik image data, perform standardized preprocessing and complexity awareness, divide the collected butterfly pattern image sequence into a simple pattern set and a complex pattern set through a sorting algorithm, and construct input tensors for the images in the simple pattern set and the complex pattern set. S12: Input the input tensor into the overall nested edge perception network, and extract multi-scale features through the multi-layer convolution and downsampling operations of the encoder; the basic building block of the encoder is based on continuous convolutional blocks, with a basic channel number of 16 and a network depth of 5; in the deepest layer of the encoder, a hollow spatial pyramid pooling module containing four parallel branches is connected to capture global distribution and multi-scale contextual features. S13: Input the global distribution and multi-scale context features obtained by the void space pyramid pooling module into the decoder, and generate multi-level fusion features by upsampling layer by layer and splicing with skip connections; S14: Based on the overall nested architecture, multiple independent side predictors configured at the end of each network layer of the decoder are used to perform edge feature mapping on the multi-level fusion feature set generated in step S13, generate the corresponding multi-level side prediction map, and calculate the initial fusion prediction result; wherein, the overall nested architecture refers to the structure in which side outputs are taken out at each layer of the decoding network to perform multi-scale deep supervised prediction. S15: Construct an adaptive deep semantic gating mechanism, extract the deepest side prediction map to generate a semantic mask, dynamically adjust the fusion ratio between the initial fusion prediction result and the semantic mask using learnable gating weight parameters, and output the final extracted batik butterfly pattern result.

[0011] The standardized preprocessing and complexity-aware method is as follows: First, the acquired single original batik image is set as... Spatial resolution is Edge pre-detection was performed using the Canny operator to obtain a binarized edge map. Then, the density distribution of non-zero pixels in the edge map is calculated to characterize the complexity of ice patterns in the image background. When the density distribution is below a set threshold... If a pattern is found to be in a simple pattern set, it is classified into a complex pattern set; otherwise, it is classified into a complex pattern set. Finally, bilinear interpolation is used to normalize the size of the image and pixel values ​​are standardized to construct the final input tensor. .

[0012] The specific calculation method for the non-zero pixel density distribution of the calculated edge map, which characterizes the complexity of ice patterns in the image background, is as follows: in, Represents the binary edge map E in spatial coordinates The pixel value at the location; H and W represent the height and width of the spatial resolution of the original batik image I, respectively.

[0013] The specific method for pixel value normalization is as follows: in, The image after size normalization. and These are the global pixel mean and standard deviation, respectively.

[0014] The multi-scale feature extraction method is as follows: The input tensor X is input into the encoder of a nested edge-aware network to extract features. The basic building block of the encoder is based on continuous convolutional blocks, with a basic channel count of 16 and a network depth of 5. A dilated spatial pyramid pooling module containing four parallel branches is connected to its deepest layer. The first branch is a 1×1 standard convolution, and the second to fourth branches are 3×3 dilated convolutions with different dilation rates, set to 6, 12, and 18 respectively, to capture butterfly body and ice pattern features of different scales. Subsequently, a smooth, non-monotonic... The function performs non-linear activation mapping on each branch, concatenates them along the channel dimension, and then performs dimensionality reduction and fusion through 1×1 convolution and batch normalization in sequence. Different void ratios The formula for calculating 3×3 dilated convolution is: in, Indicates the output feature map in spatial coordinates The value at; W represents the input feature map; The weights of the convolution kernel; i and j are the spatial coordinate indices of the output feature map in the height and width directions, respectively; and This is the local spatial offset index inside the convolution kernel; The porosity is used to control the size of the receptive field during feature extraction.

[0015] The final output multi-scale contextual features are: in, These represent the feature maps extracted and output by the first to fourth branches in the void space pyramid pooling module, respectively; Concat represents the feature concatenation operation in the channel dimension. express The convolutional dimensionality reduction operation; BN represents the batch normalization operation; SiLU represents the smooth non-monotonic activation function.

[0016] The method for generating multi-level fused features is as follows: In the decoding network, a bilinear interpolation algorithm is used to amplify the spatial resolution of the context features output by the dilated spatial pyramid pooling module and the input features of each decoding level; then, the amplified features are spliced ​​with the corresponding level features with the same spatial resolution in the encoding network through skip connections in the channel dimension; finally, the spliced ​​features are input into a processing module containing convolutional layers and batch normalization layers for channel dimensionality reduction and feature reconstruction, outputting a multi-level fused feature set. .in, Indicates the decoding network at the th The fused features generated and output at each level; L represents the total number of levels in the decoding network; This is a hierarchical index, with a value range of [value range missing]. To L.

[0017] The specific method for generating the corresponding multi-level side prediction map by edge feature mapping is as follows: an independent side predictor is configured at the end of each network layer of the decoder, and the multi-channel fused features of each layer are mapped into a single-channel local prediction feature map through 1×1 convolution; then, the local prediction feature map of each layer is spatially scaled up using a bilinear interpolation algorithm, and uniformly upsampled to the spatial resolution of the original input tensor to obtain the multi-level side prediction map, and the initial fused prediction result of each layer is calculated based on this. The single-channel prediction map is mapped using a 1×1 convolution, following the formula: in, Indicates the decoding network at the th Hierarchically generated single-channel local prediction feature maps in spatial coordinates The value at; Indicates the first The total number of channels in the multi-channel fusion features of the hierarchical input; For channel indexing; Indicates the first The hierarchical multi-channel fusion feature in the first Each channel, spatial coordinates The value at; Indicating that in the side predictor Convolution kernel corresponding to the first The weight parameters of each channel; This represents the bias term of the side predictor at this level.

[0018] Spatial scale enlargement follows the formula: in, Indicates the first The side prediction map is obtained by spatially scaling the local prediction feature map of the hierarchy. This indicates a bilinear interpolation upsampling operation; Indicates the first The hierarchical input is the single-channel local prediction feature map of this operation; This represents the target spatial resolution of the upsampling operation, i.e., the height H and width W uniformly mapped to the original input tensor.

[0019] The construction and training method of the adaptive deep semantic gating mechanism is as follows: extract the deepest side prediction map, activate it with the Sigmoid function to generate a deep semantic gating mask representing the semantic region of the butterfly's main stem; and set an unbounded, learnable scalar parameter. It is initialized to 0, and then processed by the function. By nonlinearly mapping it to the interval (0, 1), the gate weight parameters are obtained. Based on this weight parameter, the ratio of the initial fusion prediction result to the deep semantic gating mask is dynamically adjusted to adaptively suppress ice pattern noise in shallow features and stitch together the main body fracture boundary. Finally, a joint loss function for structure awareness and noise resistance is constructed. The loss is calculated by comparing the side prediction maps at each level and the joint prediction output with the real edge labels. The network weights and the scalar parameters are then updated synchronously through backpropagation using the gradient descent algorithm. The structure-aware and noise-resistant joint loss function The specific calculation formula is as follows:

[0020] in, Indicates the first Side prediction map The loss weights; Y represents the true edge label; Indicates the joint prediction output; The connectivity loss coefficient; This is a weighted cross-entropy loss function used to address the pixel-level class imbalance between the ice pattern background and the butterfly edge. This is a Dice loss function based on region overlap, used to improve the overall structural connectivity of edges.

[0021] The weighted cross-entropy loss function With Dice loss function The calculation formulas are as follows: Where P represents any prediction graph; This represents the proportion of non-edge pixels to the total pixels, used to suppress false positive predictions of background ice patterns, which constitute a large proportion of the total pixels. To prevent extremely small constants with a denominator of zero.

[0022] The specific method for the joint prediction output of dynamically adjusting the ratio is as follows: In another general aspect, a batik butterfly pattern extraction system based on multi-scale edge perception and adaptive semantic gating is provided, including: The feature preprocessing module is used to collect raw batik image data, perform standardized preprocessing and complexity awareness, divide the collected butterfly pattern image sequence into a simple pattern set and a complex pattern set through a sorting algorithm, and construct input tensors for the images in the simple pattern set and the complex pattern set. A multi-scale encoding module is used to input the input tensor into the overall nested edge perception network and extract multi-scale features through multi-layer convolution and downsampling operations of the encoder; in the deepest layer of the encoder, a hollow spatial pyramid pooling module is used to capture global distribution and multi-scale contextual features. The feature restoration and fusion module is used to input the global distribution and multi-scale context features obtained by the void space pyramid pooling module into the decoder, and generate multi-level fused features by upsampling layer by layer and splicing with skip connections. The multi-level edge prediction module is used to perform edge feature mapping on features at each level based on the overall nested architecture, using multiple side predictors to generate corresponding multi-level side prediction maps, and calculate the initial fusion prediction results. An adaptive gating fusion module constructs an adaptive deep semantic gating mechanism, extracts the deepest side prediction map to generate a semantic mask, and dynamically adjusts the fusion ratio between the initial fusion prediction result and the semantic mask using learnable gating weight parameters, outputting the final extracted batik butterfly pattern result.

[0023] The technical effects to be achieved by the embodiments of the present invention are as follows: To address the unique challenge of extracting complex patterns from batik, an intangible cultural heritage, characterized by dense "ice crack" noise interference, this invention selects the butterfly pattern, rich in morphological and scale variations, for precise extraction. This invention, considering the interference characteristics of batik ice cracks and the multi-scale features of butterfly patterns, proposes a novel complexity-aware and multi-scale contextual feature enhancement strategy, combining the Canny edge detection operator and the hollow space pyramid pooling module. Furthermore, to resolve the edge fragmentation problem caused by the conflict between deep semantics and shallow details during multi-level feature fusion, this invention proposes an adaptive deep semantic gating mechanism, achieving high-precision, high-connectivity batik pattern extraction even under complex ice crack background interference. Attached Figure Description

[0024] The above and other objects and features of this disclosure will become clearer from the following description taken in conjunction with the accompanying drawings.

[0025] Figure 1 A flowchart illustrating a batik butterfly pattern extraction method based on multi-scale edge perception and adaptive semantic gating, provided for an embodiment of the present invention; Figure 2 This is a schematic diagram of the overall nested edge sensing network and the void space pyramid pooling (ASPP) module provided in an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating the adaptive deep semantic gating mechanism and multi-level feature fusion principle provided in an embodiment of the present invention. Figure 4 This is a schematic diagram of the logical structure of a batik butterfly pattern extraction system provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0026] The following detailed embodiments are provided to aid the reader in gaining a comprehensive understanding of the methods, apparatus, and / or systems described herein. However, various changes, modifications, and equivalents of the methods, apparatus, and / or systems described herein will become apparent upon understanding this disclosure. For example, the order of operations described herein is merely illustrative and is not limited to those orders set forth herein, but may be changed as will become clear upon understanding this disclosure, except for operations that must occur in a specific order. Furthermore, for clarity and conciseness, descriptions of features known in the art may be omitted.

[0027] The features described herein may be implemented in different forms and should not be construed as limited to the examples described herein. Rather, the examples described herein are provided only to illustrate some of the many feasible ways of implementing the methods, apparatus, and / or systems described herein, which will become clear upon understanding the disclosure of this application.

[0028] As used herein, the term “and / or” includes any one of the associated listed items and any combination of any two or more.

[0029] Although terms such as “first,” “second,” and “third” may be used herein to describe various components, assemblies, regions, layers, or parts, these components, assemblies, regions, layers, or parts should not be limited by these terms. Rather, these terms are used only to distinguish one component, assembly, region, layer, or part from another. Thus, without departing from the teaching of the examples described herein, the first component, first assembly, first region, first layer, or first part referred to as the first component, first assembly, first region, first layer, or first part may also be referred to as the second component, second assembly, second region, second layer, or second part.

[0030] In the specification, when an element (such as a layer, region, or substrate) is described as being "on" another element, "connected to," or "bonded to" another element, the element may be directly "on" another element, directly "connected to," or "bonded to" the other element, or one or more other elements may be present in between. Conversely, when an element is described as being "directly on" another element, "directly connected to," or "directly bonded to" another element, no other elements may be present in between.

[0031] The terminology used herein is for the purpose of describing various examples only and is not intended to limit disclosure. Unless the context clearly indicates otherwise, the singular form is intended to include the plural form as well. The terms “comprising,” “including,” and “having” indicate the presence of the described features, quantities, operations, components, elements, and / or combinations thereof, but do not preclude the presence or addition of one or more other features, quantities, operations, components, elements, and / or combinations thereof.

[0032] Unless otherwise defined, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains upon understanding this disclosure. Unless expressly defined herein, terms (such as those defined in a general dictionary) shall be interpreted as having a meaning consistent with their meaning in the context of the relevant field and in this disclosure, and shall not be interpreted in an idealized or overly formalistic manner.

[0033] Furthermore, in the description of the examples, detailed descriptions of well-known related structures or functions will be omitted when it is believed that such detailed descriptions would lead to a vague interpretation of this disclosure.

[0034] Figure 1 This is a schematic diagram illustrating a method for extracting batik butterfly patterns based on edge awareness and semantic gating according to an embodiment of the present disclosure.

[0035] To achieve the aforementioned objectives, the present invention employs the following technical framework: Figure 1 As shown.

[0036] To facilitate understanding of this embodiment, a detailed description of the batik butterfly pattern extraction method based on multi-scale edge perception and adaptive semantic gating disclosed in this embodiment of the invention will be provided first. (See [link to relevant documentation]). Figure 1 The diagram shows a flowchart of a batik butterfly pattern extraction method based on multi-scale edge perception and adaptive semantic gating. This method can be applied to a batik butterfly pattern extraction system, which includes: a feature encoding and context extraction module, a feature decoding and skip splicing module, a global nested prediction module, and an adaptive gating fusion module. The method mainly includes the following steps S11 to S15: S11: Collect the original batik image data, use the Canny operator to perform edge pre-detection on the image and combine the background complexity to divide the image into simple and complex pattern sets, and then perform size normalization and pixel value standardization preprocessing to construct the input tensor; S12: Input the constructed input tensor into the encoder of the overall nested edge perception network, extract multi-scale features through multi-layer convolution and downsampling operations, and capture multi-scale contextual features with global perception capabilities using the hollow spatial pyramid pooling (ASPP) module in the deepest layer of the network. S13: Input the extracted context features into the decoder, and generate multi-level fused features by upsampling layer by layer and splicing them with the features of the corresponding level in the encoder through skip connections; S14: Based on the overall nested architecture, multiple independent side predictors configured at the end of each decoding level are used to perform local edge feature mapping on the multi-level fused features, generate a multi-level side prediction map, and calculate the initial fusion prediction result. S15: Extract the deepest side prediction map to generate a deep semantic gating mask, construct an adaptive deep semantic gating mechanism, dynamically adjust the fusion ratio between the initial fusion prediction result and the deep semantic gating mask using internally learnable gating weight parameters, output the final extraction result and complete deep supervised training.

[0037] As a specific example, this application provides a detailed construction and processing flow for a holistic nested edge-aware network and a hollow spatial pyramid pooling (ASPP) module. See [link to relevant documentation]. Figure 2 This includes the following steps S21-S24: S21: Constructing an encoder for multi-scale feature extraction. This invention selects an encoder based on the U-Net architecture as the basic feature extraction network. Through layer-by-layer convolution and downsampling operations, it gradually extracts multi-scale features from the batik image, ranging from shallow textures (such as ice crack noise) to deep semantics (such as the overall outline of a butterfly).

[0038] (The encoder's basic building blocks are based on consecutive convolutional blocks, with a base channel count of 16 and a network depth of 5. The preprocessed input tensors undergo multiple convolutional and pooling operations to generate feature maps at different spatial resolutions. Compared to traditional networks, this structure can better preserve local details and global location information at different scales, providing rich hierarchical feature sources for subsequent edge detection.) S22: Constructing a Spatial Pyramid Pooling (ASPP) module to extract multi-scale contextual information. In the deepest layer of the encoder, the receptive field of conventional convolution is limited, making it difficult to simultaneously capture the global structure of a large butterfly and the complex distribution of ice patterns in the background. Therefore, this invention incorporates an ASPP module in the deepest layer, achieving the fusion of multi-scale receptive fields through dilated convolutions with different dilation rates.

[0039] (The ASPP module mainly consists of four parallel feature extraction branches: the first branch is a standard 1×1 convolution; the second to fourth branches are 3×3 dilated convolutions with dilation rates r set to 6, 12 and 18 respectively, used to capture medium, large and ultra-large ranges of contextual information. In order to ensure the smoothness of gradient propagation and retain more edge details, the network uses SiLU (Sigmoid Linear Unit) as a non-linear activation function. The outputs of the four branches are concatenated in the channel dimension, and then dimensionality reduction and feature fusion are performed through 1×1 convolution and batch normalization. Specifically, the calculation of dilated convolution follows formula (1), where X is the input feature map and W is the convolution kernel weight; the final output contextual features follow formula (2), where Y1 to Y4 are the feature maps after activation of each branch.) S23: Construct the decoder and skip connection module. The deepest context features enhanced by ASPP are fed into the decoder. The spatial resolution of the feature map is restored by upsampling layer by layer, and the detailed features of the corresponding layer of the encoder are fused through skip connections.

[0040] During the decoding stage, the model employs bilinear interpolation to spatially amplify the deep features. The amplified features are then concatenated with the corresponding feature maps in the encoder that have the same spatial resolution along the channel dimension. This skip-concatenation mechanism effectively compensates for the loss of microscopic detail location information (such as the delicate antennae of a butterfly) during downsampling. The concatenated features are then input into a processing module containing convolutional layers and batch normalization layers for channel dimensionality reduction and reconstruction, ultimately generating a multi-level fused feature set. (where L is the total number of network layers.) S24: Construct a multi-level side prediction structure based on holistically-nested edge detection. To overcome the breakage and blurring problems that easily occur when extracting edges in a single output layer, this invention combines a holistically-nested edge detection architecture, extracting side outputs at each level of the decoder and performing multi-scale depth-supervised prediction.

[0041] (Side prediction stage: At the end of each network layer l of the decoder, an independent side predictor composed of 1×1 convolutions is configured. This predictor maps the multi-channel fused features Fl of each layer to a single-channel local prediction feature map Pl. Subsequently, the local prediction feature maps of each layer are uniformly enlarged to the resolution size (H, W) of the original input image using the bilinear interpolation upsampling operator to obtain multi-level side prediction maps. The process of mapping a single-channel prediction map through 1×1 convolution follows formula (3), where Cl is the number of channels, and Wl and bl are the weights and biases, respectively. The generated multi-level side prediction maps are not only used for subsequent fusion with the gating mechanism, but also directly calculate the loss with the real edge labels during the training stage to achieve deep supervision and ensure that each scale layer can learn an effective edge-aware representation.) In summary, the overall nested edge-aware network and the hollow spatial pyramid pooling module provided in this application overcome the limitation of insufficient receptive field in traditional U-Net models when processing complex intangible cultural heritage patterns. By innovatively introducing the ASPP module into the deepest layer of the network, the model's contextual discrimination ability for multi-scale batik butterfly patterns and complex "ice crack" noise is significantly enhanced. At the same time, combined with the multi-level side output design of the overall nested architecture, the texture features at different scales are preserved to the greatest extent, providing a high-quality multi-level feature source for subsequent stitching of broken edges through an adaptive semantic gating mechanism, thereby achieving high-precision edge extraction under complex background interference.

[0042] As a specific example, this embodiment of the invention illustrates in detail the implementation process of the adaptive deep semantic gating mechanism and multi-level feature fusion. See [link to relevant documentation]. Figure 3 Its core logic includes the following processing flow: Adaptive Gated Fusion Stage: First, the initial fusion prediction result (Combined) is calculated using the multi-level side prediction maps generated by each layer of the decoder; then, the local prediction map with strong semantic information generated by the deepest layer of the network is extracted, and a deep semantic gate mask (Gate) is generated by activating the Sigmoid function to represent the main position of the butterfly pattern. At the same time, the system initializes a learnable gate weight parameter. (The initial value is set to 0.0, and the initial weight is 0.5 after Sigmoid mapping), which is used to automatically learn the contribution weight of deep semantic information to low-level detail features during training. Finally, the initial fusion result is dynamically adjusted at the spatial pixel level using a gated mask, and its joint prediction output follows formula (4). This mechanism can ensure that under complex "ice pattern" noise interference, the accuracy of deep semantics is used to "stitch" the pattern breaks that may occur in shallow prediction and suppress the noise output of non-pattern areas.

[0043] This invention also provides a batik butterfly pattern extraction device based on multi-scale edge perception and adaptive semantic gating (i.e., Figure 4 (The system shown), see Figure 4 The device includes: Feature preprocessing module 41: Used to input the original batik image to be detected, perform complexity-aware classification using the Canny operator, and standardize the image.

[0044] Multiscale coding module 42: used to extract features through the encoder and capture multiscale contextual features at different expansion rates using the hollow spatial pyramid pooling (ASPP) module accessed at its deepest layer.

[0045] Feature restoration and fusion module 43: It is used to use the upsampling mechanism of the decoder and the skip connection structure to perform channel splicing of deep semantics and shallow details of the encoder to generate multi-level fused features.

[0046] Multi-level edge prediction module 44: used to generate multi-scale edge prediction maps using side predictors nested in each level of the decoder, and to calculate the initial fusion prediction results.

[0047] Adaptive Gated Fusion Module 45: Used to dynamically optimize the prediction results using a deep semantic gating mechanism with learnable weights, and output the final batik butterfly pattern extraction result.

[0048] The batik butterfly pattern extraction system provided in this application embodiment can be specific hardware on a device or software or firmware installed on the device. The device provided in this application embodiment has the same implementation principle and technical effect as the aforementioned method embodiment. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here. The extraction device provided in this embodiment, through the coupling of the ASPP module and the adaptive gating mechanism, significantly improves the model's ability to capture fine details of butterfly patterns (such as antennae and minor edge undulations), and effectively solves the recognition noise problem caused by background ice pattern interference in batik images.

[0049] This application also provides an electronic device, specifically, the electronic device includes a processor and a storage device; the storage device stores a computer program, and the computer program, when run by the processor, executes the method described in any of the above embodiments. The processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), or an off-the-shelf programmable gate array (FPGA). The storage medium may be located in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, or electrically erasable programmable memory.

[0050] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 500 includes: a processor 50, a memory 51, a bus 52, and a communication interface 53. The processor 50, the communication interface 53, and the memory 51 are connected through the bus 52. The processor 50 is used to execute executable modules, such as computer programs, stored in the memory 51.

[0051] The memory 51 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 53 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc.

[0052] Bus 52 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0053] The memory 51 is used to store the program. After receiving the execution instruction, the processor 50 executes the program. The batik butterfly pattern extraction method based on multi-scale edge perception and adaptive semantic gating disclosed in any of the foregoing embodiments of the present invention can be applied to the processor 50 or implemented by the processor 50.

[0054] Processor 50 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 50 or by instructions in software form. Processor 50 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 51. The processor 50 reads the information in memory 51 and, in conjunction with its hardware, completes the steps of the above method.

[0055] Corresponding to the above method, this application embodiment also provides a computer-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and run by a processor, the machine-executable instructions cause the processor to perform the steps of the above method.

[0056] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0057] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0058] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0059] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, electronic device, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0060] It should be noted that similar reference numerals and letters in the accompanying drawings indicate similar items. Therefore, once an item is defined in one accompanying drawing, it does not need to be further defined and explained in subsequent accompanying drawings. In addition, the terms "first," "second," "third," etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0061] While some embodiments of this disclosure have been shown and described, those skilled in the art will understand that modifications may be made to these embodiments without departing from the principles and spirit of this disclosure, which are defined by the claims and their equivalents.

Claims

1. A method for extracting batik butterfly patterns based on edge perception and semantic gating, characterized in that, Including steps S11-S15: S11: Collect the original batik image data, perform standardized preprocessing and complexity awareness, divide the collected butterfly pattern image sequence into a simple pattern set and a complex pattern set through a sorting algorithm, and construct input tensors for the images in the simple pattern set and the complex pattern set. S12: Input the input tensor into the overall nested edge perception network, and extract multi-scale features through multi-layer convolution and downsampling operations of the encoder; the basic building block of the encoder is based on continuous convolutional blocks, with a basic channel number of 16 and a network depth of 5; in the deepest layer of the encoder, a hollow spatial pyramid pooling module containing four parallel branches is connected to capture global distribution and multi-scale contextual features. S13: Input the global distribution and multi-scale context features obtained by the void space pyramid pooling module into the decoder, and generate multi-level fusion features by upsampling layer by layer and splicing with skip connections; S14: Based on the overall nested architecture, multiple independent side predictors configured at the end of each network layer of the decoder are used to perform edge feature mapping on the multi-level fusion feature set generated in step S13, generate the corresponding multi-level side prediction map, and calculate the initial fusion prediction result; wherein, the overall nested architecture refers to the structure in which side outputs are taken out at each layer of the decoding network to perform multi-scale deep supervised prediction. S15: Construct an adaptive deep semantic gating mechanism, extract the deepest side prediction map to generate a semantic mask, dynamically adjust the fusion ratio between the initial fusion prediction result and the semantic mask using learnable gating weight parameters, and output the final extracted batik butterfly pattern result.

2. The method for extracting batik butterfly patterns based on edge perception and semantic gating as described in claim 1, characterized in that, The standardized preprocessing and complexity-aware method is as follows: First, the acquired single original batik image is set as... Spatial resolution is Edge pre-detection was performed using the Canny operator to obtain a binarized edge map. Then, the density distribution of non-zero pixels in the edge map is calculated to characterize the complexity of ice patterns in the image background. When the density distribution is below a set threshold... If a pattern is found to be in a simple pattern set, it is classified into a complex pattern set; otherwise, it is classified into a complex pattern set. Finally, bilinear interpolation is used to normalize the size of the image and pixel values ​​are standardized to construct the final input tensor. .

3. The method for extracting batik butterfly patterns based on edge perception and semantic gating as described in claim 2, characterized in that, The specific calculation method for the non-zero pixel density distribution of the calculated edge map, which characterizes the complexity of ice patterns in the image background, is as follows: in, Represents the binary edge map E in spatial coordinates The pixel value at the location; H and W represent the height and width of the spatial resolution of the original batik image I, respectively; The specific method for pixel value normalization is as follows: in, The image after size normalization. and These are the global pixel mean and standard deviation, respectively.

4. The method for extracting batik butterfly patterns based on edge perception and semantic gating as described in claim 1, characterized in that, The multi-scale feature extraction method is as follows: The input tensor X is input into the encoder of a nested edge-aware network to extract features. The basic building block of the encoder is based on continuous convolutional blocks, with a basic channel count of 16 and a network depth of 5. A dilated spatial pyramid pooling module containing four parallel branches is connected to its deepest layer. The first branch is a 1×1 standard convolution, and the second to fourth branches are 3×3 dilated convolutions with different dilation rates, set to 6, 12, and 18 respectively, to capture butterfly body and ice pattern features of different scales. Subsequently, a smooth, non-monotonic... The function performs non-linear activation mapping on each branch, concatenates them along the channel dimension, and then performs dimensionality reduction and fusion through 1×1 convolution and batch normalization in sequence. Different void ratios The formula for calculating 3×3 dilated convolution is: in, Indicates the output feature map in spatial coordinates The value at; W represents the input feature map; The weights of the convolution kernel; i and j are the spatial coordinate indices of the output feature map in the height and width directions, respectively; and This is the local spatial offset index inside the convolution kernel; The porosity is used to control the size of the receptive field during feature extraction. The final output multi-scale contextual features are: in, These represent the feature maps extracted and output by the first to fourth branches in the void space pyramid pooling module, respectively; Concat represents the feature concatenation operation in the channel dimension. express The convolutional dimensionality reduction operation; BN represents the batch normalization operation; SiLU represents the smooth non-monotonic activation function.

5. The method for extracting batik butterfly patterns based on edge perception and semantic gating as described in claim 1, characterized in that, The method for generating multi-level fused features is as follows: In the decoding network, a bilinear interpolation algorithm is used to amplify the spatial resolution of the context features output by the dilated spatial pyramid pooling module and the input features of each decoding level; then, the amplified features are spliced ​​with the corresponding level features with the same spatial resolution in the encoding network through skip connections in the channel dimension; finally, the spliced ​​features are input into a processing module containing convolutional layers and batch normalization layers for channel dimensionality reduction and feature reconstruction, outputting a multi-level fused feature set. ;in, Indicates the decoding network at the th The fused features generated and output at each level; L represents the total number of levels in the decoding network; This is a hierarchical index, with a value range of [value range missing]. To L.

6. The method for extracting batik butterfly patterns based on edge perception and semantic gating as described in claim 1, characterized in that, The specific method for generating the corresponding multi-level side prediction map by edge feature mapping is as follows: an independent side predictor is configured at the end of each network layer of the decoder, and the multi-channel fused features of each layer are mapped into a single-channel local prediction feature map through 1×1 convolution; then, the local prediction feature map of each layer is spatially scaled up using a bilinear interpolation algorithm, and uniformly upsampled to the spatial resolution of the original input tensor to obtain the multi-level side prediction map, and the initial fused prediction result of each layer is calculated based on this. The single-channel prediction map is mapped using a 1×1 convolution, following the formula: in, Indicates the decoding network at the th Hierarchically generated single-channel local predicted feature maps in spatial coordinates The value at; Indicates the first The total number of channels in the multi-channel fusion features of the hierarchical input; For channel indexing; Indicates the first The hierarchical multi-channel fusion feature in the first Each channel, spatial coordinates The value at; Indicating that in the side predictor Convolution kernel corresponds to the first The weight parameters of each channel; This represents the bias term of the side predictor at this level; Spatial scale enlargement follows the formula: in, Indicates the first The side prediction map is obtained by spatially scaling the local prediction feature map of the hierarchy. This indicates a bilinear interpolation upsampling operation; Indicates the first The hierarchical input is the single-channel local prediction feature map of this operation; This represents the target spatial resolution of the upsampling operation, i.e., the height H and width W uniformly mapped to the original input tensor.

7. The method for extracting batik butterfly patterns based on edge perception and semantic gating as described in claim 1, characterized in that, The construction and training method of the adaptive deep semantic gating mechanism is as follows: extract the deepest side prediction map, and generate a deep semantic gating mask representing the semantic region of the butterfly trunk by activating the Sigmoid function; Define an unbounded, learnable scalar parameter. It is initialized to 0, and then processed by the function. By nonlinearly mapping it to the interval (0, 1), the gate weight parameters are obtained. Based on this weight parameter, the ratio of the initial fusion prediction result to the deep semantic gating mask is dynamically adjusted to adaptively suppress ice pattern noise in shallow features and stitch together the main body fracture boundary. Finally, a joint loss function for structure awareness and noise resistance is constructed. The loss is calculated by comparing the side prediction maps at each level and the joint prediction output with the real edge labels. The network weights and the scalar parameters are then updated synchronously through backpropagation using the gradient descent algorithm. The structure-aware and noise-resistant joint loss function The specific calculation formula is as follows: in, Indicates the first Side prediction map The loss weights; Y represents the true edge label; Indicates the joint prediction output; The connectivity loss coefficient; This is a weighted cross-entropy loss function used to address the pixel-level class imbalance between the ice pattern background and the butterfly edge. This is a Dice loss function based on region overlap, used to improve the overall structural connectivity of edges; The weighted cross-entropy loss function With Dice loss function The calculation formulas are as follows: Where P represents any prediction graph; This represents the proportion of non-edge pixels to the total pixels, used to suppress false positive predictions of background ice patterns, which constitute a large proportion of the total pixels. To prevent extremely small constants with a denominator of zero; The specific method for the joint prediction output of dynamically adjusting the ratio is as follows: 。 8. A batik butterfly pattern extraction system based on multi-scale edge perception and adaptive semantic gating, characterized in that, include: The feature preprocessing module is used to collect raw batik image data, perform standardized preprocessing and complexity awareness, divide the collected butterfly pattern image sequence into a simple pattern set and a complex pattern set through a sorting algorithm, and construct input tensors for the images in the simple pattern set and the complex pattern set. A multi-scale encoding module is used to input the input tensor into the overall nested edge perception network and extract multi-scale features through multi-layer convolution and downsampling operations of the encoder; in the deepest layer of the encoder, a hollow spatial pyramid pooling module is used to capture global distribution and multi-scale contextual features. The feature restoration and fusion module is used to input the global distribution and multi-scale context features obtained by the void space pyramid pooling module into the decoder, and generate multi-level fused features by upsampling layer by layer and splicing with skip connections. The multi-level edge prediction module is used to perform edge feature mapping on features at each level based on the overall nested architecture, using multiple side predictors to generate corresponding multi-level side prediction maps, and calculate the initial fusion prediction results. An adaptive gating fusion module constructs an adaptive deep semantic gating mechanism, extracts the deepest side prediction map to generate a semantic mask, and dynamically adjusts the fusion ratio between the initial fusion prediction result and the semantic mask using learnable gating weight parameters, outputting the final extracted batik butterfly pattern result.