Pattern processing method, electronic device and readable storage medium

By marking traditional pattern images and training the pattern detection model, the problem of difficult and low accuracy of pattern image recognition is solved, automatic pattern identification and marking is realized, and data organization efficiency and image usage range are improved.

CN113269198BActive Publication Date: 2025-03-11SHANGHAI QICHENG CULTURE DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110586927.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-27
Publication Date
2025-03-11
Estimated Expiration
2041-05-27

AI Technical Summary

Technical Problem

Traditional pattern images are difficult to recognize and have low accuracy, especially when the pattern images on different materials are different, resulting in the problem of difficult and low accuracy in recognition and segmentation.

Method used

By marking traditional pattern pictures, marking the pattern type and position size, the marked picture is input into the machine learning algorithm as training data, and the pattern detection model is obtained. This model takes the pattern picture as input, outputs the pattern type and position size.

Benefits of technology

It realizes automatic identification and marking of traditional patterns, improves the initial identification and organization efficiency of pattern data, reduces the difficulty of secondary editing and modification of images, expands the scope of use of images, and improves the re-creation efficiency of designers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113269198B_ABST
    Figure CN113269198B_ABST
Patent Text Reader

Abstract

The present invention discloses a pattern processing method, an electronic device and a readable storage medium, the processing method comprising: marking a pattern type label and a pattern position size in a traditional pattern image; inputting the marked traditional pattern image as training data into a machine learning algorithm, and training to obtain a pattern detection model; the input data of the pattern detection model is the pattern image, and the output data is the type of pattern in the pattern image and the position size of the pattern. This application combines artificial intelligence technology with traditional pattern work to achieve automatic identification and marking of traditional patterns, helping researchers and creators to more effectively perform initial batch identification and sorting of pattern image data; the image vectorization function included in the application helps image users and designers quickly realize image vectorization and generate pattern line drawings, thereby effectively reducing the difficulty of secondary editing and modification of images, expanding the scope of image use, and improving re-creation efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image processing, and in particular relates to a pattern processing method, an electronic device and a readable storage medium. Background Art

[0002] In the process of traditional pattern identification and statistical processing, if the screening is done manually, the workload is too large and it is easily affected by the experience of the processor, resulting in uneven detection rate or processing results. If it is based on machine recognition and processing, due to the characteristics of the pattern itself, the pattern itself is complex and the expression method is irregular, which makes it difficult to identify and segment. In addition, there are also large differences in the pattern images obtained on different materials, such as porcelain, New Year paintings, and fabrics. The photographed images obtained from porcelain and New Year paintings usually have a relatively obvious and uniform background, and are less affected by lighting, angles, etc.; on fabrics, because fabrics contain both flat photographs such as clothing and multi-angle pictures such as hand-embroidery, there is a lot of background noise, and there will also be problems of difficulty in identification and segmentation and low accuracy. Summary of the invention

[0003] The technical problem to be solved by the present invention is to overcome the defects of the conventional pattern image recognition in the prior art, that is, the difficulty is high and the precision is low, and to provide a pattern processing method, an electronic device and a readable storage medium.

[0004] The present invention solves the above technical problems through the following technical solutions:

[0005] A pattern processing method, the processing method comprising:

[0006] Mark the pattern type label and pattern position size in the traditional pattern image;

[0007] The marked traditional pattern images are input into the machine learning algorithm as training data to obtain the pattern detection model;

[0008] The pattern detection model takes a pattern image as input and takes the type of pattern in the pattern image and the position and size of the pattern as output.

[0009] Preferably, there are multiple patterns, and the step of inputting the marked traditional pattern image as training data into the machine learning algorithm to train and obtain the pattern detection model specifically includes:

[0010] Select the largest pattern in the traditional pattern picture;

[0011] Taking the center of the largest pattern as the center of the preset segmentation frame, cutting the traditional pattern image to obtain segmented images;

[0012] Selecting a new pattern with the largest size from the remaining area of ​​the traditional pattern image that does not contain the sub-image;

[0013] Taking the center of the new largest pattern as the center of the preset segmentation frame, cutting the traditional pattern image to obtain a new sub-image, and then returning to the step of selecting the new largest pattern from the remaining area of ​​the traditional pattern image that does not contain the sub-image, until the sub-images obtained by cutting cover all the patterns;

[0014] The plurality of sub-pictures are input into a machine learning algorithm as training data to obtain the pattern detection model through training.

[0015] Preferably, before the step of selecting the largest pattern in the traditional pattern picture, the pattern processing method further comprises:

[0016] Scaling the traditional pattern image according to the size of the smallest pattern;

[0017] In the step of selecting the largest pattern in the traditional pattern picture, the scaled traditional pattern picture is selected.

[0018] Preferably, the step of inputting the marked traditional pattern images as training data into a machine learning algorithm to train and obtain a pattern detection model further comprises:

[0019] Selecting Cascade RCNN as the basic model of the machine learning algorithm, and superimposing a convolutional neural network layer on the input layer of the machine learning algorithm to train the marked traditional pattern images;

[0020] And / or, selecting a ResNet101 network as the backbone network of the machine learning algorithm;

[0021] And / or, selecting a GIoU loss function as the loss function of the machine learning algorithm.

[0022] Preferably, the step of inputting the marked traditional pattern images as training data into a machine learning algorithm to train and obtain a pattern detection model further comprises:

[0023] Select a verification pattern image and input it into the pattern detection model, and output the type of pattern in the verification pattern image and the position and size of the pattern;

[0024] Detect whether the type of the pattern is consistent with the type label of the verification pattern image. If so, determine whether the confidence of the position size of the pattern is within a preset range. If not, adjust the parameters of the pattern detection model and perform optimization training of the pattern detection model until the type output of the pattern is consistent with the type label and the confidence of the position size of the pattern is within a preset range. The step of inputting the marked traditional pattern image as training data into the machine learning algorithm to train the pattern detection model also includes:

[0025] Performing data enhancement processing on the marked traditional pattern image, wherein the data enhancement processing includes at least one of flipping, scaling, rotating, cropping, deformation scaling, and color conversion;

[0026] The traditional pattern image after data enhancement processing is input into the machine learning algorithm.

[0027] Preferably, after the step of inputting the marked traditional pattern image as training data into a machine learning algorithm to obtain a pattern detection model through training, the pattern processing method further comprises:

[0028] Inputting the acquired current pattern image into the pattern detection model, and outputting a plurality of current patterns in the current pattern image;

[0029] Obtaining the object type to which the current pattern image belongs; the object types include porcelain, New Year paintings and fabrics;

[0030] Obtaining vectorization adjustment optimal parameters corresponding to the object type;

[0031] The current pattern is input into the Potrace algorithm adjusted by the vectorization adjustment optimal parameters, and a vectorized image of the current pattern is output.

[0032] Preferably, the step of obtaining the vectorized adjustment parameter corresponding to the object type specifically includes:

[0033] Inputting a plurality of pattern images of the target object type into the Potrace algorithm to obtain vectorized images of the plurality of pattern images;

[0034] Calculate the IOU values ​​of the vectorized images of the plurality of pattern images based on the IOU function;

[0035] If the IOU value is not within the preset threshold range, adjusting the model parameters of the Potrace algorithm until the IOU value is within the preset threshold range;

[0036] The model parameters of the Potrace algorithm when the IOU value reaches a preset threshold range are used as the vectorization adjustment optimal parameters corresponding to the target object type.

[0037] A pattern processing system, the processing system comprising:

[0038] A marking module is used to mark the pattern type label and pattern position size in the traditional pattern image;

[0039] A training module, used to input the marked traditional pattern images as training data into the machine learning algorithm to train and obtain a pattern detection model;

[0040] The pattern detection model takes a pattern image as input and takes the type of pattern in the pattern image and the position and size of the pattern as output.

[0041] Preferably, the training module specifically includes:

[0042] A selection unit, used for selecting the largest pattern in the traditional pattern picture;

[0043] A cutting unit, used for cutting the traditional pattern picture to obtain a divided picture by taking the center of the largest pattern as the center of a preset cutting frame;

[0044] The selection unit is also used to select a new pattern with the largest size from the remaining area of ​​the traditional pattern picture that does not contain the sub-picture;

[0045] The cutting unit is further used to cut the traditional pattern image to obtain a new sub-image by taking the center of the new largest pattern as the center of the preset cutting frame, and then return to call the selection unit until the sub-images obtained by cutting cover all patterns;

[0046] The training unit is used to input the multiple sub-pictures as training data into the machine learning algorithm to obtain the pattern detection model through training.

[0047] Preferably, the training module further includes:

[0048] A scaling unit, used for scaling the traditional pattern image according to the size of the smallest pattern;

[0049] The selection unit is used to select the scaled traditional pattern image.

[0050] Preferably, the training module is further used to select Cascade RCNN as the basic model of the machine learning algorithm, and superimpose a convolutional neural network layer on the input layer of the machine learning algorithm to train the marked traditional pattern images;

[0051] And / or, the training module is further used to select a ResNet101 network as the backbone network of the machine learning algorithm;

[0052] And / or, the training module is also used to select a GIoU loss function as the loss function of the machine learning algorithm.

[0053] Preferably, the training module also includes:

[0054] A verification unit, used for selecting a verification pattern image to input into the pattern detection model, and outputting the type of pattern in the verification pattern image and the position and size of the pattern;

[0055] A detection unit, used to detect whether the type of the pattern is consistent with the type label of the verification pattern image, and if so, call the judgment unit;

[0056] The judging unit is used to judge whether the confidence of the position and size of the pattern is within a preset range, and if not, calling the first parameter adjustment unit;

[0057] The first parameter adjustment unit adjusts the parameters of the pattern detection model and calls the training unit to perform optimization training of the pattern detection model until the type output of the pattern is consistent with the type label and the confidence of the position size of the pattern is within a preset range.

[0058] Preferably, the training module also includes:

[0059] An enhancement processing unit, used for performing data enhancement processing on the marked traditional pattern image, wherein the data enhancement processing includes at least one of flipping, scaling, rotating, cropping, deformation scaling, and color conversion;

[0060] The training unit is used to input the traditional pattern image after data enhancement processing into the machine learning algorithm.

[0061] Preferably, the pattern processing system further comprises:

[0062] A pattern detection module, inputting the acquired current pattern image into the pattern detection model, and outputting a plurality of current patterns in the current pattern image;

[0063] A module for acquiring the object type to which the picture belongs, used to acquire the object type to which the current pattern picture belongs; the object types include porcelain, New Year paintings and fabrics;

[0064] An optimal parameter acquisition module, used to acquire the optimal parameters of vectorization adjustment corresponding to the object type;

[0065] The vectorization module is used to input the current pattern into the Potrace algorithm adjusted by the vectorization adjustment optimal parameters, and output the vectorized image of the current pattern.

[0066] Preferably, the optimal parameter acquisition module specifically includes:

[0067] An input unit, used for inputting a plurality of pattern images of a target object type into the Potrace algorithm to obtain vectorized images of the plurality of pattern images;

[0068] An IOU calculation unit, configured to calculate the IOU values ​​of the vectorized images of the plurality of pattern images based on an IOU function;

[0069] A second parameter adjustment unit, configured to adjust the model parameters of the Potrace algorithm when the IOU value is not within a preset threshold range, until the IOU value is within the preset threshold range;

[0070] The optimal parameter acquisition module is used to use the model parameters of the Potrace algorithm when the IOU value reaches a preset threshold range as the vectorization adjustment optimal parameters corresponding to the target object type.

[0071] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned pattern processing method when executing the computer program.

[0072] A computer-readable storage medium stores a computer program, which implements the above-mentioned pattern processing method when executed by a processor.

[0073] The positive progress of the present invention is that: the present application combines artificial intelligence technology with traditional pattern work to realize automatic identification and marking of traditional patterns, helping researchers and creators to more effectively identify and organize pattern data in batches at the initial stage, and further image vectorization function helps image users and designers to quickly realize image vectorization conversion and generate pattern line drafts, thereby effectively reducing the difficulty of secondary editing and modification of images, expanding the scope of image use, and improving the efficiency of designers' re-creation. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] Figure 1 Flow chart of the pattern processing method according to embodiment 1 of the present invention.

[0075] Figure 2 Flow chart of step 20 in the pattern processing method of embodiment 1 of the present invention.

[0076] Figure 3 This is a schematic diagram of cutting a pattern image in the pattern processing method of embodiment 1 of the invention.

[0077] Figure 4 Flow chart of the pattern processing method according to embodiment 2 of the present invention.

[0078] Figure 5 Flow chart of step 50 in the pattern processing method according to embodiment 2 of the present invention.

[0079] Figure 6 Schematic diagram of the effect of vectorization processing in the pattern processing method of embodiment 2 of the present invention.

[0080] Figure 7 Schematic diagram of the modules of the pattern processing system according to the third embodiment of the present invention.

[0081] Figure 8 Schematic diagram of a module of a pattern processing system according to Embodiment 4 of the present invention.

[0082] Fig. 9 This is a schematic diagram of the structure of an electronic device according to Embodiment 5 of the present invention. DETAILED DESCRIPTION

[0083] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.

[0084] Example 1

[0085] A pattern processing method, such as Figure 1 As shown, the processing method includes:

[0086] Step 10: Mark the pattern type label and pattern position size in the traditional pattern image;

[0087] Among them, the pattern image involved in this embodiment can specifically be a traditional pattern image. Existing image annotation tools can be used to intercept to obtain the position and size of the pattern, and the intercepted pattern can be marked with the type, so as to create an image data set conveniently and quickly, and subsequent deep learning training can be carried out very conveniently. Pattern image data collection, labeling and inspection are the basic work of model training. At this stage, it is necessary to define data size, category name, number of categories, labeling rules, etc.

[0088] Step 20: Input the marked traditional pattern images as training data into a machine learning algorithm to obtain a pattern detection model through training;

[0089] The pattern detection model takes the pattern image as input and takes the type of pattern and the position and size of the pattern in the pattern image as output.

[0090] In this embodiment, there are multiple patterns. In view of the characteristics of pattern detection project data, such as large image size variation, containing a large number of small targets, and incomplete annotations, in general, large images with more than 2000 pixels account for a high proportion. Since some categories are dominated by small targets, the image size varies, the target size contained in the image varies, and there are many changes within the image class. The size of the pattern detection training image data varies too much, but the network input size is limited. If the image is scaled too small, the small target will be lost. Therefore, in order to retain more image information, Figure 2 As shown, step 20 specifically includes:

[0091] Step 201, selecting the largest pattern in the traditional pattern picture;

[0092] Step 202: Using the center of the largest pattern as the center of the preset segmentation frame, the traditional pattern image is segmented to obtain segmented images;

[0093] Step 203: Select a new pattern with the largest size from the remaining area of ​​the traditional pattern picture that does not contain the sub-picture;

[0094] Step 204, using the center of the new largest pattern as the center of the preset splitting frame to cut the traditional pattern image to obtain a new split image; it should be noted that when cutting the image, if the preset splitting frame exceeds the boundary of the traditional pattern image, the border of the preset splitting frame is moved to the nearest boundary.

[0095] Step 205, determine whether the sub-pictures obtained by cutting the picture cover all the patterns, if so, execute step 206, if not, return to step 203;

[0096] Step 206: Input the plurality of sub-pictures as training data into a machine learning algorithm;

[0097] Step 207: Train and obtain a pattern detection model.

[0098] See also Figure 3 , a specific example is given to further illustrate the image cutting process of this embodiment.

[0099] Select the pattern frame 0 with the largest preset segmentation, and use the dotted frame (preset segmentation frame) to segment the image. All frames inside the segmentation image cannot be used as the center. Select the largest pattern frame 1 from the remaining patterns 1, 3, and 5 as the center to segment the image again. If the preset segmentation frame exceeds the boundary (dotted dotted frame), move the frame to the boundary to segment the image. Continue to select the center of the remaining uncovered pattern frames for segmentation until all pattern frames are covered by the segmented images.

[0100] In the above scheme, the image cutting method can ensure diverse image cutting positions and sizes, and can minimize the possibility of large targets being cut into multiple parts. After image cutting training, the proportion of small targets in the image is increased, which is equivalent to detecting large targets, and the detection effect is significantly improved.

[0101] In this embodiment, before step 201, the pattern processing method further includes:

[0102] Step 200, scaling the traditional pattern image according to the size of the smallest pattern;

[0103] The pixel value of the minimum target is determined to be not lower than a certain pixel value (50); if it is not lower than 2800-3200, the image is scaled to 2800-3200; if the pixel value of the minimum target is too small, the scaling ratio is further increased.

[0104] Further, in step 201, see Figure 2 , select the scaled traditional pattern image.

[0105] In this embodiment, step 20 also includes:

[0106] Cascade RCNN is selected as the basic model of the machine learning algorithm, and a convolutional neural network is superimposed on the input layer of the machine learning algorithm to train the labeled traditional pattern images;

[0107] Among them, by analyzing the traditional pattern data set, it is found that the traditional pattern data set contains a large number of high-definition large images, and the image size ranges from a few kb to tens of MB. The image size varies, and the width and height range from 300 pixels to 9000 pixels. The objects in the image vary in size, including small objects such as plum blossoms and clouds, and large objects such as unicorns and dragons. Similar objects, such as clouds, have variable shapes, and some appear in pieces. Considering the characteristics of pattern detection project data such as large image size changes, a large number of small objects, and incomplete annotations, CascadeRCNN is used as the basic model of the pattern detection model. Its design of filtering candidate boxes layer by layer with multiple IOU thresholds makes the detection performance relatively stable in different scenarios. The CascadeRCNN structure achieves the purpose of continuously optimizing the prediction results by cascading several detection networks. Unlike ordinary cascades, the several detection networks of CascadeRCNN are trained on positive and negative samples determined by different IOU thresholds. Since the IOU threshold directly affects the model's final bias towards samples near the IOU value, a combination of multiple IOU strategies can alleviate the model's tendency, so that the model has better detection effects for detection boxes with different IOU thresholds. In addition, deformable convolution is added to the CascadeRCNN, and a convolutional neural network is added to the input layer, which doubles the input image resolution.

[0108] Select the ResNet101 network as the backbone network of the machine learning algorithm;

[0109] Among them, the ResNeXt101 network has a simple structure and modularization, with fewer hyperparameters that need to be manually adjusted. Compared with ResNet, the number of parameters is similar, but the results are better. A 101-layer ResNeXt network is close to the accuracy of a 200-layer ResNet, but the computational complexity is only half of the latter. In addition, in order to achieve higher performance indicators, DCNv2 deformable convolutions are added to the end of the last two layers of the resnext101 network to improve the model's ability to detect rotating targets and improve the model's ability to detect rotating targets and the backbone network's ability to express features.

[0110] The GIoU loss function is selected as the loss function of the machine learning algorithm.

[0111] Among them, CascadeRCNN's own IoU has the advantage of scale invariance, but if it is used as a loss function, if the two targets do not overlap, IoU will be 0, and it will not reflect the distance between the two targets. In this case of non-overlapping targets, if IoU is used as a loss function, the gradient is 0 and cannot be optimized. IoU cannot distinguish different alignments between two objects. More precisely, the IoUs of two overlapping objects with the same cross-level in different directions will be exactly the same. In order to solve the above problems with IoUloss, GIoU is introduced as a regression loss calculation to improve the accuracy of the model detection frame. Specifically, for any two A and B boxes, first find a minimum box C that can enclose them. Then calculate the ratio of the area of ​​C\(A∪B) to the area of ​​C, where the area of ​​C\(A∪B) is the area of ​​C minus the area of ​​A∪B, and then subtract this ratio from the IoU values ​​of A and B to get GIoU. GIoU is always the lower limit of IoU, that is, GIoU(A, B) <= IoU(A, B). When A and B completely overlap, GIoU(A, B) = IoU(A, B) = 1, (A∪B) / C→0, that is, when the area of ​​A∪B is extremely small relative to C, GIoU converges to -1; at the same time, GIoU takes into account the non-overlapping areas that IoU does not take into account, and can reflect the way A and B overlap.

[0112] In this embodiment, after step 206, see Figure 2 , step 20 further includes:

[0113] Step 211, select a verification pattern image and input it into a pattern detection model, and output the type of pattern in the verification pattern image and the position and size of the pattern;

[0114] Step 212: Check whether the type of the pattern is consistent with the type label of the verification pattern image. If so, execute step 213;

[0115] Step 213, determine whether the confidence of the position and size of the pattern is within a preset range, if not, execute step 214; if yes, execute step 207;

[0116] Step 214, adjusting the parameters of the pattern detection model, and returning to step 206 to perform optimization training of the pattern detection model;

[0117] Among them, at the beginning of training, there is a large difference between the classification and regression results of the network and the label. The size of the difference, i.e., the loss, is calculated to guide the neural network to update the parameters. By continuously optimizing the model parameters, the classification and regression results can be correctly input. The output results of the pattern detection model contain two fields: results, img (pattern image). Results is a list of results. If 15 categories of patterns need to be labeled, the output list length 15 represents 15 categories. The order of categories is output according to the global parameter agreement order. The category with the largest value is taken as the recognized category. Generally, the target with a confidence level lower than 0.5 is filtered out. Each category contains Nx5 data. The 5 columns (x, y, w, h, c) of a single data represent the coordinates of the upper left corner point (x, y), the width and height (w, h) of the bbox (pattern box), and the confidence level (GIoU value) of the bbox. The higher the confidence level, the more credible the model believes the detected target is.

[0118] In this embodiment, step 206 specifically includes:

[0119] Performing data enhancement processing on the marked sub-images, where the data enhancement processing includes at least one of flipping, scaling, rotating, cropping, deformation scaling, and color transformation;

[0120] Among them, data enhancement is to use preset data transformation rules to expand data based on existing data, including single-sample data enhancement and multi-sample data enhancement, where single samples include geometric operation class and color transformation class. Conventional data enhancement methods include random flipping, adjusting hue and saturation, random scaling, automatic data enhancement, etc., which can be used during model training. The geometric transformation class is to perform geometric transformation on the image, including flipping, rotation, cropping, deformation and scaling, and other operations. Another important transformation of color transformation is color perturbation, which is to increase or decrease certain color components in a certain color space, or change the order of color channels.

[0121] The segmented images after data enhancement processing are input into the machine learning algorithm, and then step 207 is executed.

[0122] Let me give you a specific example;

[0123] In the pattern detection project, 14,159 pattern images of 15 categories were prepared, including brocade, utensils, New Year paintings and other styles. In order to detect small targets in the image and facilitate model training, the super large image was scaled according to the data enhancement method, and then the image was segmented for model training. 10% of them were divided as test data, and the other 90% were used as training data.

[0124] Test environment: Hardware: Linux system Inspur server, Nvidia GTX1080Tix4; Software: pytorch=1.6, torchvision=0.7; Test data 3347 pictures, the specific data of each category is shown in Table 1 below.

[0125] Table 1 Test data

[0126]

[0127]

[0128] Model: Improved CascadeRCNN model, the backbone network uses ResNeXt101, and the regression loss is GIOUloss.

[0129] Finally, the average accuracy of 15 categories of targets is MAP: 0.766, and the average recall is Recall: 0.907. The detailed data is shown in Table 2 below. In this application, GIoU is used to estimate the error of the model, and it is hoped that the predicted box is as close to the target box as possible:

[0130] Table 2 Pattern detection test results

[0131]

[0132]

[0133] Wherein: ('feng': phoenix, 'hehua': lotus, 'hudie': butterfly, 'juhua': chrysanthemum, 'laohu': tiger, 'long': dragon, 'meihua': plum blossom, 'mudan': peony, 'nvren': woman, 'qilin': unicorn, 'ruyi': Ruyi, 'wan': ten thousand, 'yinghai': baby, 'yun': cloud, 'yuwen': fish pattern) In this embodiment, combined with the existing marking tools and image recognition technology, a pattern detection algorithm under supervised learning is developed to achieve an average recall rate (recall) of 85% (range 75% to 95%) and an average precision rate (AP) of 75% (range 60% to 85%) of the pattern elements in the identified pattern images.

[0134] In this embodiment, artificial intelligence technology is combined with traditional pattern work to achieve automatic identification and marking of traditional patterns, helping researchers and creators to more effectively perform initial batch identification and organization of pattern data.

[0135] Example 2

[0136] The pattern processing method of this embodiment is further improved on the basis of embodiment 1. Due to the characteristics of the pattern itself, there are great differences on different materials, such as on porcelain and New Year pictures. Usually these two types of patterns have a relatively obvious and unified background, and are less affected by lighting, angles, etc. The optimization algorithm has obvious improvement effects on these two types of materials; on fabrics, because fabrics contain both flat photographic images such as clothing and multi-angle images such as hand embroidery, it brings difficulty to vectorization. Therefore, in the final parameter scheme, different optimization parameters are set for corresponding training. Alternatively, the parameters of utensils and New Year pictures can be unified, and independent parameters can be used for fabrics alone.

[0137] like Figure 4 As shown, after step 20, the pattern processing method further includes:

[0138] Step 30: input the acquired current pattern image into the pattern detection model, and output multiple current patterns in the current pattern image; specifically, the position size and type labels of multiple patterns in the output previous pattern image, and for the convenience of identification, they can also be directly visualized in the original image;

[0139] Step 40, obtaining the object type to which the current pattern image belongs; the object types include porcelain, New Year pictures and fabrics; wherein the pattern image can be obtained by photographing porcelain, New Year pictures and fabrics, etc. to obtain an image containing the pattern.

[0140] Step 50: Obtain optimal vector adjustment parameters corresponding to the object type;

[0141] Step 60: Input the current pattern into the Potrace algorithm adjusted by the optimal vectorization adjustment parameters, and output the vectorized image of the current pattern. Specifically, the vectorized image may be a line drawing of the current pattern image, and in order to facilitate secondary editing, a vectorized file of a corresponding format that can be used for secondary editing may be output.

[0142] Among them, Figure 5 As shown, step 50 specifically includes:

[0143] Step 501: Input multiple pattern images of the target object type into the Potrace algorithm to obtain vectorized images of the multiple pattern images; since the Potrace algorithm includes corner detection, detecting too many corners will make the image more like a polygon and no longer smooth; if too few corners are detected, the image will be too smooth. For the processing of contour curves, continuous Bezier curve segments can be added for optimization.

[0144] Step 502: Calculate the IOU values ​​of the vectorized images of the plurality of pattern images based on the IOU function;

[0145] Step 503: determine whether the IOU value is within a preset threshold range. If not, execute step 504; if yes, execute step 505;

[0146] Step 504: adjust the model parameters of the Potrace algorithm, and then return to step 501;

[0147] Step 505: The model parameters of the Potrace algorithm when the IOU value reaches a preset threshold range are used as vectorization adjustment optimal parameters corresponding to the target object type.

[0148] In addition, it should be noted that due to the particularity of the pattern, the test data often has unclear edges around the target body compared to the regular data (especially for fabric materials), and many pictures have similar color blocks close to each other without obvious dividing lines. In addition, due to the presence of multiple arcs and multiple inflection points in the details of the pattern body, the original parameters will lose color blocks during the vectorization process (the calculation of the area between the inflection point and the boundary will be ignored during the Bezier curve calculation process). At the same time, when distinguishing between the details of the pattern body and the background details, the original parameters will cause more noise in the vectorization process, and it is impossible to better balance the two (such as the details are lost after the main body is vectorized, and more detail noise is retained after the background is vectorized).

[0149] To solve the problem of missing some color blocks when the Bezier curve calculates the area connectivity, try multiple parameter combinations to increase the number of inflection points. (For example, under the original calculation, a 5×5 area is connected and optimized through a Bezier curve; under the new parameter combination, by adjusting the threshold, 3 inflection points are added, 4 connected areas and Bezier curves are generated, and the area ignored by the algorithm itself is reduced. The original ignored area is 0.8×0.8, and the ignored area after optimization is 0.15×0.15×3, which is about 90% less than before optimization). Again, in terms of the problem of similar color blocks, multiple sets of color gamut adjustment parameters are used to increase the algorithm's sensitivity to color, so that similar color blocks can still maintain a large visual difference after vectorization. Finally, in order to solve the problem of distinguishing between background and subject, the foreground and background parameters of the image are adjusted. By increasing the foreground and background thresholds, the subject and details can be more completely preserved at the expense of some background details. The above optimization parameter settings can be synchronously updated to the aforementioned vectorization adjustment optimal parameters to ultimately achieve the output of a more ideal vectorized image. See Figure 6 ,The example image is vectorized using the above method and the line drawing is output, and the IOU value is calculated to be 0.733, which meets the accuracy requirements.

[0150] In this embodiment, the recognized pattern can be further vectorized, and the vectorized result has secondary processability. The above scheme of the present application can improve the IOU of edge curve pixels extracted from the vector image and the original image. It helps image users and designers to quickly realize image vectorization conversion and generate pattern line drafts, thereby effectively reducing the difficulty of secondary editing and modification of images and expanding the scope of image use. It improves the efficiency of designers' re-creation.

[0151] Example 3

[0152] A pattern processing system, such as Figure 7 As shown, the processing system includes:

[0153] Marking module 1, used to mark the pattern type label and pattern position size in the traditional pattern image;

[0154] Among them, the pattern image involved in this embodiment can specifically be a traditional pattern image. Existing image annotation tools can be used to intercept to obtain the position and size of the pattern, and the intercepted pattern can be marked with the type, so as to create an image data set conveniently and quickly, and subsequent deep learning training can be carried out very conveniently. Pattern image data collection, labeling and inspection are the basic work of model training. At this stage, it is necessary to define data size, category name, number of categories, labeling rules, etc.

[0155] Training module 2, used to input the marked traditional pattern images as training data into the machine learning algorithm to obtain the pattern detection model through training;

[0156] The pattern detection model takes a pattern image as input and takes the type of pattern in the pattern image and the position and size of the pattern as output.

[0157] In this embodiment, there are multiple patterns. In view of the characteristics of pattern detection project data, such as large image size variation, containing a large number of small targets, and incomplete annotations, in general, large images with more than 2000 pixels account for a high proportion. Since some categories are dominated by small targets, the image size varies, the target size contained in the image varies, and there are many changes within the image class. The size of the pattern detection training image data varies too much, but the network input size is limited. If the image is scaled too small, the small targets will be lost. Therefore, in order to retain more image information, see Figure 7 , the training module 2 specifically includes:

[0158] A selection unit 21, configured to select the largest pattern in the traditional pattern image;

[0159] A cutting unit 22, configured to cut the traditional pattern image to obtain a sub-image by taking the center of the largest pattern as the center of a preset cutting frame;

[0160] The selection unit 21 is also used to select a new pattern with the largest size from the remaining area of ​​the traditional pattern picture that does not contain the sub-picture;

[0161] The cutting unit 22 is also used to cut the traditional pattern image with the center of the new largest pattern as the center of the preset cutting frame to obtain a new sub-image, and then return to call the selection unit 21 until the sub-image obtained by cutting covers all patterns; it should be noted that when cutting, if the preset cutting frame exceeds the boundary of the traditional pattern image, the border of the preset cutting frame will be moved to the nearest boundary.

[0162] The training unit 23 is used to input the multiple sub-pictures as training data into the machine learning algorithm to obtain the pattern detection model through training.

[0163] In the above scheme, the image cutting method can ensure diverse image cutting positions and sizes, and can minimize the possibility of large targets being cut into multiple parts. After image cutting training, the proportion of small targets in the image is increased, which is equivalent to detecting large targets, and the detection effect is significantly improved.

[0164] In this embodiment, see Figure 7 , the training module 2 also includes:

[0165] A scaling unit 24, used for scaling the traditional pattern image according to the size of the smallest pattern;

[0166] The pixel value of the minimum target is determined to be not lower than a certain pixel value (50); if it is not lower than 2800-3200, the image is scaled to 2800-3200; if the pixel value of the minimum target is too small, the scaling ratio is further increased.

[0167] The selection unit 21 is used to select the scaled traditional pattern image.

[0168] In this embodiment, the training module 2 is further used to select Cascade RCNN as the basic model of the machine learning algorithm, and superimpose a convolutional neural network layer on the input layer of the machine learning algorithm to train the marked traditional pattern image;

[0169] Among them, by analyzing the traditional pattern data set, it is found that the traditional pattern data set contains a large number of high-definition large images, and the image size ranges from a few kb to tens of MB. The image size varies, and the width and height range from 300 pixels to 9000 pixels. The objects in the image vary in size, including small objects such as plum blossoms and clouds, and large objects such as unicorns and dragons. Similar objects, such as clouds, have variable shapes, and some appear in pieces. Considering the characteristics of pattern detection project data such as large image size changes, a large number of small objects, and incomplete annotations, CascadeRCNN is used as the basic model of the pattern detection model. Its design of filtering candidate boxes layer by layer with multiple IOU thresholds makes the detection performance relatively stable in different scenarios. The CascadeRCNN structure achieves the purpose of continuously optimizing the prediction results by cascading several detection networks. Unlike ordinary cascades, the several detection networks of CascadeRCNN are trained on positive and negative samples determined by different IOU thresholds. Since the IOU threshold directly affects the model's final bias towards samples near the IOU value, a combination of multiple IOU strategies can alleviate the model's tendency, so that the model has better detection effects for detection boxes with different IOU thresholds. In addition, deformable convolution is added to the CascadeRCNN, and a convolutional neural network is added to the input layer, which doubles the input image resolution.

[0170] The training module 2 is also used to select the ResNet101 network as the backbone network of the machine learning algorithm;

[0171] Among them, the ResNeXt101 network has a simple structure and modularization, with fewer hyperparameters that need to be manually adjusted. Compared with ResNet, the number of parameters is similar, but the results are better. A 101-layer ResNeXt network is close to the accuracy of a 200-layer ResNet, but the computational complexity is only half of the latter. In addition, in order to achieve higher performance indicators, DCNv2 deformable convolutions are added to the end of the last two layers of the resnext101 network to improve the model's ability to detect rotating targets and improve the model's ability to detect rotating targets and the backbone network's ability to express features.

[0172] The training module 2 is also used to select the GIoU loss function as the loss function of the machine learning algorithm.

[0173] Among them, CascadeRCNN's own IoU has the advantage of scale invariance, but if it is used as a loss function, if the two targets do not overlap, IoU will be 0, and it will not reflect the distance between the two targets. In this case of non-overlapping targets, if IoU is used as a loss function, the gradient is 0 and cannot be optimized. IoU cannot distinguish different alignments between two objects. More precisely, the IoUs of two overlapping objects with the same cross-level in different directions will be exactly the same. In order to solve the above problems with IoUloss, GIoU is introduced as a regression loss calculation to improve the accuracy of the model detection frame. Specifically, for any two A and B boxes, first find a minimum box C that can enclose them. Then calculate the ratio of the area of ​​C\(A∪B) to the area of ​​C, where the area of ​​C\(A∪B) is the area of ​​C minus the area of ​​A∪B, and then subtract this ratio from the IoU values ​​of A and B to get GIoU. GIoU is always the lower limit of IoU, that is, GIoU(A, B) <= IoU(A, B). When A and B completely overlap, GIoU(A, B) = IoU(A, B) = 1, (A∪B) / C→0, that is, when the area of ​​A∪B is extremely small relative to C, GIoU converges to -1; at the same time, GIoU takes into account the non-overlapping areas that IoU does not take into account, and can reflect the way A and B overlap.

[0174] In this embodiment, see Figure 7 , the training module 2 also includes:

[0175] A verification unit 25, used for selecting a verification pattern image to input into the pattern detection model, and outputting the type of pattern in the verification pattern image and the position and size of the pattern;

[0176] The detection unit 26 is used to detect whether the type of the pattern is consistent with the type label of the verification pattern image, and if so, call the judgment unit 27;

[0177] The judging unit 27 is used to judge whether the confidence of the position and size of the pattern is within a preset range, and if not, the first parameter adjustment unit 28 is called;

[0178] The first parameter adjustment unit 28 adjusts the parameters of the pattern detection model and calls the training unit 23 to perform optimization training of the pattern detection model until the type output of the pattern is consistent with the type label and the confidence of the position size of the pattern is within a preset range.

[0179] Among them, at the beginning of training, there is a large difference between the classification and regression results of the network and the label. The size of the difference, i.e., the loss, is calculated to guide the neural network to update the parameters. By continuously optimizing the model parameters, the classification and regression results can be correctly input. The output results of the pattern detection model contain two fields: results, img (pattern image). Results is a list of results. If 15 categories of patterns need to be labeled, the output list length 15 represents 15 categories. The order of categories is output according to the global parameter agreement order. The category with the largest value is taken as the recognized category. Generally, the target with a confidence level lower than 0.5 is filtered out. Each category contains Nx5 data. The 5 columns (x, y, w, h, c) of a single data represent the coordinates of the upper left corner point (x, y), the width and height (w, h) of the bbox (pattern box), and the confidence level (GIoU value) of the bbox. The higher the confidence level, the more credible the model believes the detected target is.

[0180] In this embodiment, see Figure 7 , the training module 2 also includes:

[0181] An enhancement processing unit 29, used for performing data enhancement processing on the marked traditional pattern image, wherein the data enhancement processing includes at least one of flipping, scaling, rotating, cropping, deformation scaling, and color conversion;

[0182] Among them, data enhancement is to use preset data transformation rules to expand data based on existing data, including single-sample data enhancement and multi-sample data enhancement, where single samples include geometric operation class and color transformation class. Conventional data enhancement methods include random flipping, adjusting hue and saturation, random scaling, automatic data enhancement, etc., which can be used during model training. The geometric transformation class is to perform geometric transformation on the image, including flipping, rotation, cropping, deformation and scaling, and other operations. Another important transformation of color transformation is color perturbation, which is to increase or decrease certain color components in a certain color space, or change the order of color channels.

[0183] The training unit 23 is used to input the traditional pattern image after data enhancement processing into the machine learning algorithm.

[0184] In this embodiment, the existing marking tools and image recognition technology are combined to develop a pattern detection algorithm under supervised learning to achieve an average recall rate (recall) of 85% (range 75% to 95%) and an average precision rate (AP) of 75% (range 60% to 85%) of the pattern elements in the identified pattern images.

[0185] In this embodiment, artificial intelligence technology is combined with traditional pattern work to achieve automatic identification and marking of traditional patterns, helping researchers and creators to more effectively perform initial batch identification and organization of pattern data.

[0186] Example 4

[0187] The pattern processing system of this embodiment is further improved on the basis of Embodiment 3. Due to the characteristics of the pattern itself, there are great differences in different materials, such as on porcelain and New Year pictures. Usually these two types of patterns have a relatively obvious and unified background, and are less affected by lighting, angles, etc. The optimization algorithm has obvious improvement effects on these two types of materials; on fabrics, because fabrics contain both flat photographic images such as clothing and multi-angle images such as hand embroidery, it brings difficulty to vectorization. Therefore, in the final parameter scheme, different optimization parameters are set for corresponding training. Alternatively, the parameters of utensils and New Year pictures can be unified, and independent parameters can be used for fabrics alone.

[0188] like Figure 8 As shown, the pattern processing system also includes:

[0189] The pattern detection module 3 inputs the acquired current pattern image into the pattern detection model, and outputs multiple current patterns in the current pattern image; specifically, the position size and type labels of multiple patterns in the output previous pattern image, and for the convenience of identification, they can also be directly visualized in the original image;

[0190] The module 4 for obtaining the object type to which the picture belongs is used to obtain the object type to which the current pattern picture belongs; the object types include porcelain, New Year pictures and fabrics; wherein the pattern picture can be obtained by photographing porcelain, New Year pictures and fabrics, etc. to obtain a picture containing a pattern.

[0191] An optimal parameter acquisition module 5, used to acquire the optimal vectorization adjustment parameters corresponding to the object type;

[0192] The vectorization module 6 is used to input the current pattern into the Potrace algorithm adjusted by the vectorization adjustment optimal parameters, and output the vectorized image of the current pattern. Specifically, the vectorized image can be a line drawing of the current pattern image, and in order to facilitate secondary editing, a vectorized file of a corresponding format that can be used for secondary editing can be output.

[0193] In this embodiment, see Figure 8 , the optimal parameter acquisition module 5 specifically includes:

[0194] The input unit 51 is used to input multiple pattern images of the target object type into the Potrace algorithm to obtain vectorized images of the multiple pattern images; wherein, since the Potrace algorithm includes corner detection, detecting too many corners will make the image more like a polygon and no longer smooth; if too few corners are detected, the image will be too smooth. For the processing of contour curves, continuous Bezier curve segments can be added for optimization processing.

[0195] An IOU calculation unit 52, configured to calculate the IOU values ​​of the vectorized images of the plurality of pattern images based on an IOU function;

[0196] A second parameter adjustment unit 53, used for adjusting the model parameters of the Potrace algorithm when the IOU value is not within the preset threshold range, until the IOU value is within the preset threshold range;

[0197] The optimal parameter acquisition module 5 is used to use the model parameters of the Potrace algorithm when the IOU value reaches a preset threshold range as the vectorization adjustment optimal parameters corresponding to the target object type.

[0198] In addition, it should be noted that due to the particularity of the pattern, the test data often has unclear edges around the target body compared to the regular data (especially for fabric materials), and many pictures have similar color blocks close to each other without obvious dividing lines. In addition, due to the presence of multiple arcs and multiple inflection points in the details of the pattern body, the original parameters will lose color blocks during the vectorization process (the calculation of the area between the inflection point and the boundary will be ignored during the Bezier curve calculation process). At the same time, when distinguishing between the details of the pattern body and the background details, the original parameters will cause more noise in the vectorization process, and it is impossible to better balance the two (such as the details are lost after the main body is vectorized, and more detail noise is retained after the background is vectorized).

[0199] In order to solve the problem of missing some color blocks when the Bezier curve calculates the area connected, we try multiple parameter combinations to increase the number of inflection points. (For example, under the original calculation, the 5×5 area is connected and optimized through a Bezier curve; under the new parameter combination, by adjusting the threshold, 3 inflection points are added, 4 connected areas and Bezier curves are generated, and the area ignored by the algorithm itself is reduced. The original ignored area is 0.8×0.8, and the ignored area after optimization is 0.15×0.15×3, which is about 90% less than before optimization). Again, in terms of the problem of similar color blocks, multiple sets of color gamut adjustment parameters are used to increase the algorithm's sensitivity to color, so that similar color blocks can still maintain a large visual difference after vectorization. Finally, in order to solve the problem of distinguishing between background and subject, the foreground and background parameters of the image are adjusted. By increasing the foreground and background thresholds, the subject and details can be more completely preserved at the expense of some background details. The above optimization parameter settings can be synchronously updated to the aforementioned vectorization adjustment optimal parameters to ultimately achieve the output of a more ideal vectorized image.

[0200] In this embodiment, the recognized pattern can be further vectorized, and the vectorized result has secondary processability. The above scheme of the present application can improve the IOU of edge curve pixels extracted from the vector image and the original image, helping image users and designers to quickly realize image vectorization conversion and generate pattern line drafts, thereby effectively reducing the difficulty of secondary editing and modification of the image and expanding the scope of image use. Improve the efficiency of designers' re-creation.

[0201] Example 5

[0202] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the pattern processing method described in Embodiment 1 or 2 when executing the computer program.

[0203] Fig. 9 A schematic diagram of the structure of an electronic device provided in this embodiment. Fig. 9 A block diagram of an exemplary electronic device 90 suitable for use in implementing embodiments of the present invention is shown. Fig. 9 The electronic device 90 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0204] like Fig. 9 As shown, the electronic device 90 may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 90 may include, but are not limited to: at least one processor 91, at least one memory 92, and a bus 93 connecting different system components (including the memory 92 and the processor 91).

[0205] The bus 93 includes a data bus, an address bus, and a control bus.

[0206] The memory 92 may include a volatile memory, such as a random access memory (RAM) 921 and / or a cache memory 922 , and may further include a read-only memory (ROM) 923 .

[0207] The memory 92 may also include a program tool 925 having a set (at least one) of program modules 924, such program modules 924 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.

[0208] The processor 91 executes various functional applications and data processing by running computer programs stored in the memory 92 .

[0209] The electronic device 90 may also communicate with one or more external devices 94 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 95. Furthermore, the electronic device 90 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 96. The network adapter 96 communicates with other modules of the electronic device 90 via a bus 93. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 90, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.

[0210] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.

[0211] Example 6

[0212] A computer-readable storage medium stores a computer program, which implements the pattern processing method described in embodiment 1 or 2 when executed by a processor.

[0213] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.

[0214] In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the pattern processing method described in Example 1 or 2.

[0215] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on a user device, partially on a user device, as an independent software package, partially on a user device and partially on a remote device, or entirely on a remote device.

[0216] Although the specific embodiments of the present invention are described above, it should be understood by those skilled in the art that this is only for illustration and the protection scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.

Claims

1. A pattern processing method, characterized in that: The processing method comprises: Mark the pattern type label and pattern position size in the traditional pattern image; The marked traditional pattern images are input into the machine learning algorithm as training data to obtain a pattern detection model through training. The pattern may be multiple, including: Select the largest pattern in the traditional pattern picture; Taking the center of the largest pattern as the center of the preset segmentation frame, cutting the traditional pattern image to obtain segmented images; Selecting a new pattern with the largest size from the remaining area of ​​the traditional pattern image that does not contain the sub-image; Taking the center of the new largest pattern as the center of the preset segmentation frame, cutting the traditional pattern image to obtain a new sub-image, and then returning to the step of selecting the new largest pattern from the remaining area of ​​the traditional pattern image that does not contain the sub-image, until the sub-images obtained by cutting cover all the patterns; Inputting the plurality of sub-pictures as training data into a machine learning algorithm to obtain the pattern detection model through training; Selecting Cascade RCNN as the basic model of the machine learning algorithm, and superimposing a convolutional neural network layer on the input layer of the machine learning algorithm to train the marked traditional pattern images; The pattern detection model takes a pattern image as input and takes the type of pattern in the pattern image and the position and size of the pattern as output.

2. The pattern processing method according to claim 1, characterized in that: Before the step of selecting the largest pattern in the traditional pattern picture, the pattern processing method further includes: Scaling the traditional pattern image according to the size of the smallest pattern; In the step of selecting the largest pattern in the traditional pattern picture, the scaled traditional pattern picture is selected.

3. The pattern processing method according to claim 1, characterized in that: The step of inputting the marked traditional pattern image as training data into the machine learning algorithm to train and obtain the pattern detection model also includes: Select the ResNet101 network as the backbone network of the machine learning algorithm; And / or, selecting a GIoU loss function as the loss function of the machine learning algorithm.

4. The pattern processing method according to claim 1, characterized in that: The step of inputting the marked traditional pattern image as training data into the machine learning algorithm to train and obtain the pattern detection model also includes: Select a verification pattern image and input it into the pattern detection model, and output the type of pattern in the verification pattern image and the position and size of the pattern; Check whether the type of the pattern is consistent with the type label of the verification pattern image. If so, determine whether the confidence of the position and size of the pattern is within a preset range. If not, adjust the parameters of the pattern detection model and perform optimization training on the pattern detection model until the type output of the pattern is consistent with the type label and the confidence of the position and size of the pattern is within a preset range.

5. The pattern processing method according to claim 1, characterized in that: The step of inputting the marked traditional pattern image as training data into the machine learning algorithm to train and obtain the pattern detection model also includes: Performing data enhancement processing on the marked traditional pattern image, wherein the data enhancement processing includes at least one of flipping, scaling, rotating, cropping, deformation scaling, and color conversion; The traditional pattern image after data enhancement processing is input into the machine learning algorithm.

6. The pattern processing method according to claim 1, characterized in that: After the step of inputting the marked traditional pattern image as training data into the machine learning algorithm to obtain the pattern detection model through training, the pattern processing method further comprises: Inputting the acquired current pattern image into the pattern detection model, and outputting a plurality of current patterns in the current pattern image; Obtaining the object type to which the current pattern image belongs; the object types include porcelain, New Year paintings and fabrics; Obtaining vectorization adjustment optimal parameters corresponding to the object type; The current pattern is input into the Potrace algorithm adjusted by the vectorization adjustment optimal parameters, and a vectorized image of the current pattern is output.

7. The pattern processing method according to claim 6, characterized in that: The step of obtaining the vectorization adjustment parameter corresponding to the object type specifically includes: Inputting a plurality of pattern images of the target object type into the Potrace algorithm to obtain vectorized images of the plurality of pattern images; Calculate the IOU values ​​of the vectorized images of the plurality of pattern images based on the IOU function; If the IOU value is not within the preset threshold range, adjusting the model parameters of the Potrace algorithm until the IOU value is within the preset threshold range; The model parameters of the Potrace algorithm when the IOU value reaches a preset threshold range are used as the vectorization adjustment optimal parameters corresponding to the target object type.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the texture processing method according to any one of claims 1 to 7 is implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the texture processing method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Embedded deep learning-oriented oversized image target detection method and system thereof

    CN111191730A

  • Yao-nationality pattern symbol recognition method based on target detection

    CN111931792A