Picture processing method and device, electronic equipment and storage medium

CN115797959BActive Publication Date: 2026-10-27BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211658626.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-22
Publication Date
2026-10-27
Estimated Expiration
2042-12-22

AI Technical Summary

Benefits of technology

[0045]本发明实施例提供的技术方案,通过获取待处理图片,将待处理图片输入至已训练的检测模型,得到检测模型输出的预测掩码。其中,预测掩码至少包括:文字预测掩码和特效预测掩码,文字预测掩码对应于待处理图片中文字区域,特效预测掩码对应于待处理图片中文字特效的特效区域。对文字预测掩码及特效预测掩码进行合并处理,得到待处理图片中文字区域和特效区域的目标预测掩码。如此,可快速、准确实现对待处理图片中文字和文字特效的检测操作,获取到检测模型输出的待处理图片中文字区域和特效区域的目标预测掩码,提高检测待处理图片的工作效率,为后续对待处理图片中文字和文字特效的擦除操作做基础。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115797959B_ABST
    Figure CN115797959B_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to a picture processing method and device, electronic equipment and storage medium, the method comprising: obtaining a picture to be processed, inputting the picture to be processed into a trained detection model to obtain a predicted mask output by the detection model; the predicted mask at least includes a text predicted mask and a special effect predicted mask, the text predicted mask corresponds to a text region in the picture to be processed, and the special effect predicted mask corresponds to a special effect region of a text special effect in the picture to be processed; performing merging processing on the text predicted mask and the special effect predicted mask to obtain a target predicted mask of the text region and the special effect region in the picture to be processed. Thus, the detection operation of the text and the text special effect in the picture to be processed can be quickly and accurately performed, the target predicted mask of the text region and the special effect region in the picture to be processed output by the detection model is obtained, and the working efficiency of detecting the picture to be processed is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an image processing method, apparatus, electronic device and storage medium. Background Technology

[0002] In common movie and TV posters, there are often large artistic fonts, such as the movie / TV show title and actors' names. When displaying movie / TV posters, too much or too large text can negatively impact the viewer's experience. Therefore, it's advisable to remove excessive or overly large artistic fonts from the posters.

[0003] However, before erasing excessively large artistic text from posters, the first step is to identify such text. Therefore, a solution that can identify excessively large artistic text in posters is urgently needed. Summary of the Invention

[0004] In view of this, in order to solve the above-mentioned technical problems, embodiments of the present invention provide an image processing method, apparatus, electronic device and storage medium, so as to be able to identify excessive and large artistic characters in a poster and obtain the mask data of the artistic characters.

[0005] In a first aspect, embodiments of the present invention provide an image processing method, the method comprising:

[0006] Obtain the image to be processed, input the image to be processed into the trained detection model, and obtain the prediction mask output by the detection model;

[0007] The prediction mask includes at least: a text prediction mask and an effect prediction mask, wherein the text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed.

[0008] The text prediction mask and the effect prediction mask are merged to obtain the target prediction mask of the text region and the effect region in the image to be processed.

[0009] In an optional implementation, the step of merging the text prediction mask and the effect prediction mask to obtain the target prediction mask for the text region and the effect region in the image to be processed includes:

[0010] The text prediction mask and the effect prediction mask are merged to obtain the merged mask of the text region and the effect region in the image to be processed.

[0011] The merged mask is subjected to pixel dilation processing, and the dilated merged mask is determined as the target prediction mask for the text region and the special effect region in the image to be processed.

[0012] In an optional implementation, the text prediction mask includes a first text prediction mask and a second text prediction mask, wherein the first text prediction mask corresponds to the text in the image to be processed, and the second text prediction mask corresponds to the edges of the text in the image to be processed.

[0013] The special effects prediction mask includes a first special effects prediction mask and a second special effects prediction mask. The first special effects prediction mask corresponds to the text special effects in the image to be processed, and the second special effects prediction mask corresponds to the edges of the text special effects in the image to be processed.

[0014] In an optional implementation, the trained detection model is obtained in the following way:

[0015] Obtain a sample image, input the sample image into a preset initial detection model, and obtain the sample prediction mask output by the initial detection model;

[0016] The sample prediction mask includes at least: a sample text prediction mask and a sample effect prediction mask, wherein the sample text prediction mask corresponds to the sample text region in the sample image, and the effect prediction mask corresponds to the sample effect region of the text in the sample image.

[0017] Determine the text cross-entropy of the sample text region based on the sample text prediction mask;

[0018] Determine the cross-entropy of the sample effect region based on the sample effect prediction mask;

[0019] The text cross-entropy and the effect cross-entropy are backpropagated to complete the training of the initial detection model.

[0020] In an optional implementation, the sample text prediction mask includes at least: a first prediction mask and a first edge prediction mask; the first prediction mask corresponds to the sample text in the sample text region, and the first edge prediction mask corresponds to the sample text edge in the sample text region;

[0021] The sample effect prediction mask includes at least: a second prediction mask and a second edge prediction mask; the second prediction mask corresponds to the sample text effect in the sample effect region, and the second edge prediction mask corresponds to the edge of the sample text effect in the sample effect region;

[0022] The text cross-entropy includes at least: a first cross-entropy and a second cross-entropy; the first cross-entropy corresponds to the cross-entropy of the sample text in the sample text region, and the second cross-entropy corresponds to the cross-entropy of the sample text edges in the sample text region;

[0023] The special effects cross-entropy includes at least: a third cross-entropy and a fourth cross-entropy; the third cross-entropy corresponds to the cross-entropy of the sample text special effects in the sample special effects region, and the fourth cross-entropy corresponds to the cross-entropy of the sample text special effects edge in the sample special effects region.

[0024] In an optional implementation, after acquiring the sample image, the method further includes:

[0025] The sample text region of the sample image is marked by a first marker mask, and the sample effect region of the sample image is marked by a second marker mask.

[0026] The sample text edges are obtained from the sample text region and marked using a third marker mask;

[0027] The sample text effect edges are obtained from the sample effect area and marked using a fourth marker mask.

[0028] In an optional implementation, determining the text cross-entropy of the sample text region based on the sample text prediction mask includes:

[0029] A preset cross-entropy algorithm is used to calculate the first marker mask and the first prediction mask to obtain the first cross-entropy of the sample text in the sample text region.

[0030] A preset cross-entropy algorithm is used to calculate the third marker mask and the first edge prediction mask to obtain the second cross-entropy of the sample text edges in the sample text region;

[0031] The first cross-entropy and the second cross-entropy are determined to be the text cross-entropy of the sample text region.

[0032] In an optional implementation, determining the effect cross-entropy of the sample effect region based on the sample effect prediction mask includes:

[0033] The second marker mask and the second prediction mask are processed using a preset cross-entropy algorithm to obtain the third cross-entropy of the special effects in the sample special effect region;

[0034] The fourth cross-entropy of the sample text effect edge in the sample effect region is obtained by performing calculations on the fourth marker mask and the second edge prediction mask using a preset cross-entropy algorithm.

[0035] The third cross-entropy and the fourth cross-entropy are determined to be the effective cross-entropy of the sample's special effect region.

[0036] In an optional implementation, the backpropagation process of the text cross-entropy and the effect cross-entropy to complete the training of the initial detection model includes:

[0037] The first cross-entropy, the second cross-entropy, the third cross-entropy, and the fourth cross-entropy are summed using a preset summation algorithm to obtain the target cross-entropy.

[0038] The target cross-entropy is backpropagated to complete the training of the initial detection model.

[0039] Secondly, embodiments of the present invention provide an image processing apparatus, the apparatus comprising:

[0040] The image acquisition module is used to acquire the image to be processed, input the image to be processed into the trained detection model, and obtain the prediction mask output by the detection model.

[0041] The prediction mask includes at least: a text prediction mask and an effect prediction mask, wherein the text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed.

[0042] The mask determination module is used to merge the text prediction mask and the effect prediction mask to obtain the target prediction mask of the text region and the effect region in the image to be processed.

[0043] Thirdly, embodiments of the present invention provide an electronic device, including: a processor and a memory, wherein the processor is configured to execute an image processing program stored in the memory to implement the image processing method described in any one of the first aspects.

[0044] Fourthly, embodiments of the present invention provide a storage medium storing one or more programs, which can be executed by one or more processors to implement the image processing method described in any one aspect.

[0045] The technical solution provided by this invention involves acquiring an image to be processed, inputting the image into a trained detection model, and obtaining a prediction mask output by the detection model. The prediction mask includes at least two parts: a text prediction mask and an effect prediction mask. The text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed. The text prediction mask and the effect prediction mask are merged to obtain the target prediction masks for the text region and the effect region in the image to be processed. This allows for fast and accurate detection of text and text effects in the image to be processed, obtaining the target prediction masks for the text region and the effect region output by the detection model, improving the efficiency of image detection, and laying the foundation for subsequent text and text effect erasure operations. Attached Figure Description

[0046] Figure 1 A flowchart illustrating an embodiment of an image processing method provided by the present invention;

[0047] Figure 2 A flowchart illustrating another image processing method provided by an embodiment of the present invention;

[0048] Figure 3 A flowchart illustrating an embodiment of a model training method provided by this invention;

[0049] Figure 4 A schematic diagram illustrating a data annotation method provided in an embodiment of the present invention;

[0050] Figure 5 A schematic diagram illustrating another data annotation method provided in an embodiment of the present invention;

[0051] Figure 6 A flowchart illustrating an embodiment of a target cross-entropy determination method provided by this invention;

[0052] Figure 7 This is a schematic diagram illustrating a visual interface according to an embodiment of the present invention;

[0053] Figure 8 This is a schematic diagram illustrating another visual interface according to an embodiment of the present invention;

[0054] Figure 9 A flowchart illustrating another model training method provided in this invention;

[0055] Figure 10 This is a block diagram illustrating an embodiment of an image processing apparatus provided by the present invention.

[0056] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

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

[0058] In common movie and TV drama posters, the titles are often displayed in large artistic font. When these posters are used for display on iQiyi's main website, it's undesirable to have too much large text on the poster. Therefore, it's necessary to remove this artistic font using technical means. Existing methods typically use Photoshop. However, Photoshop is complex to operate and requires a high level of technical skill. Processing large amounts of data requires significant manpower and time, and the quality of the resulting images may also be problematic. Before removing the artistic font from the poster, it's necessary to first detect it. When detecting artistic fonts, some may have large shadows or outlines. If only the artistic font itself is detected without detecting the shadows or outlines, the removal effect will be unsatisfactory in actual use, such as in artistic font erasing.

[0059] Therefore, this embodiment of the invention proposes to use a smaller mask to more perfectly cover all the artistic text in the poster within the area where the artistic text is located. This lays a good foundation for subsequent text erasure, ultimately achieving the erasure of the artistic text within the poster.

[0060] Specifically, to ensure the erasure effect of artistic fonts and their effects in posters, the detection process must detect not only the artistic font itself but also its corresponding shadows and strokes. If shadows and strokes are treated as a single unit, during the generation and training of effect masks, some effects may be too large, leading to content that only resembles the effects but lacks artistic font characteristics being mistakenly detected as artistic fonts.

[0061] To address the aforementioned technical problems, this invention proposes a pre-trained detection model that detects artistic text and artistic text effects in posters separately, ensuring that artistic text and artistic text effects are separated. This effectively suppresses other target objects from being misidentified as artistic text or artistic text effects due to their similarity to the visual features of artistic text effects.

[0062] The image processing method provided by the present invention will be further explained and described below with reference to the accompanying drawings and specific embodiments. The embodiments do not constitute a limitation on the embodiments of the present invention.

[0063] See Figure 1 This is a flowchart illustrating an embodiment of an image processing method provided by the present invention. Figure 1 As shown, the process may include the following steps:

[0064] Step 101: Obtain the image to be processed. Input the image to be processed into the trained detection model to obtain the prediction mask output by the detection model.

[0065] Step 102: The prediction mask includes at least: a text prediction mask and an effect prediction mask. The text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed.

[0066] The following provides a unified description of steps 101 and 102:

[0067] In this embodiment of the invention, to achieve rapid detection of text and corresponding text effects in an image to be processed, a detection model is pre-trained. By inputting the image to be processed into the trained detection model, the predicted mask output by the detection model can be obtained. The specific method for training the detection model can be found in the relevant description in the flowchart below, and will not be detailed here.

[0068] Specifically, the aforementioned prediction mask includes at least: a text prediction mask and an effect prediction mask. The text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed. It is understood that the aforementioned image to be processed is an image containing both text and text effects. This embodiment of the invention does not impose specific limitations on the number, size, or other image information of the image to be processed.

[0069] Step 103: Merge the text prediction mask and the effect prediction mask to obtain the target prediction mask for the text region and the effect region in the image to be processed.

[0070] As described above, in this embodiment of the invention, after obtaining the text prediction mask and the effect prediction mask, the text prediction mask and the effect prediction mask can be merged (or combined) to obtain the prediction masks of the text region and the effect region in the image to be processed (hereinafter referred to as the target prediction mask).

[0071] This processing method allows for the rapid and accurate detection of the image to be processed, and the acquisition of the target prediction mask for the text region and text effect region in the image. This lays the foundation for subsequent text erasure operations on the image to be processed, thus enabling better text erasure of the image.

[0072] This concludes the process. Figure 1 The process described is as follows.

[0073] pass Figure 1 As shown in the flowchart, in the technical solution of this invention, the image to be processed is acquired and input into a trained detection model to obtain a prediction mask output by the detection model. The prediction mask includes at least a text prediction mask and an effect prediction mask. The text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed. The text prediction mask and the effect prediction mask are merged to obtain the target prediction mask for the text region and the effect region in the image to be processed. In this way, the detection operation of text and text effects in the image to be processed can be performed quickly and accurately, obtaining the target prediction mask of the text region and the effect region in the image to be processed output by the detection model, improving the efficiency of image detection, and laying the foundation for subsequent text and text effect erasure operations.

[0074] See Figure 2 This is a flowchart illustrating another embodiment of an image processing method provided by the present invention. Figure 2 The process shown is in Figure 1 Based on the illustrated process, this section describes in detail how to implement the processing operations on the image to be processed, and the training operations of the detection model. For example... Figure 2 As shown, the process may include the following steps:

[0075] Step 201: Obtain the image to be processed and input it into the trained detection model to obtain the prediction mask output by the detection model.

[0076] Step 202: The prediction mask includes at least: a text prediction mask and an effect prediction mask. The text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed.

[0077] The following provides a unified description of steps 201 and 202:

[0078] based on Figure 1As described in the process description, the prediction mask includes at least a text prediction mask and an effect prediction mask. The text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed. In this embodiment of the invention, to better distinguish between text and text effects in the image to be processed, the edges of the text and the edges of the text effects can also be determined.

[0079] Based on this, it can be seen that the aforementioned text prediction mask may include a first text prediction mask and a second text prediction mask. The first text prediction mask corresponds to the text in the image to be processed, and the second text prediction mask corresponds to the edges of the text in the image to be processed. The effect prediction mask may include a first effect prediction mask and a second effect prediction mask. The first effect prediction mask corresponds to the text effects in the image to be processed, and the second effect prediction mask corresponds to the edges of the text effects in the image to be processed. Thus, prediction masks for the text and text edges in the text region of the image to be processed, and prediction masks for the text effects and text effect edges in the effect region, can be obtained.

[0080] In practical applications, due to the difference between the first text prediction mask and the second prediction mask of text effects in the image to be processed, the text and text effects in the image to be processed can be distinguished relatively well. Therefore, the first edge prediction mask of the text edges and the second edge prediction mask of the text effect edges can be ignored. Accordingly, the text prediction mask can be the first prediction mask, and the effect prediction mask can be the second prediction mask. This embodiment of the invention does not impose specific limitations on this.

[0081] In one embodiment, the trained detection model described above can be obtained in the following manner: see details below. Figure 3 This is a flowchart illustrating an embodiment of a model training method provided by the present invention. Figure 3 As shown, the process may include the following steps:

[0082] Step 301: Obtain sample images and input them into the preset initial detection model to obtain the sample prediction mask output by the initial detection model.

[0083] Step 302: The sample prediction mask includes at least: a sample text prediction mask and a sample effect prediction mask. The sample text prediction mask corresponds to the sample text region in the sample image, and the effect prediction mask corresponds to the sample effect region of the text in the sample image.

[0084] The following provides a unified description of steps 301 and 302:

[0085] In this embodiment of the invention, sample images can be obtained in advance, and sample prediction masks in the sample images can be obtained, so as to train the initial detection model based on the sample prediction masks and obtain the detection model.

[0086] In one embodiment, after acquiring the sample image, the sample text region corresponding to the sample text and the sample effect region corresponding to the sample text effect in the sample image can be determined, and the sample text edge of the sample text region and the sample text effect edge of the sample effect region can be determined. In practical applications, for the convenience of data annotation, two types of annotation can be performed: 1. Annotation based on the outer and inner edges of the text itself; 2. Annotation based on the outer and inner edges of the text plus the text effect. See details for further information. Figure 4 This is a schematic diagram of a data annotation method provided in an embodiment of the present invention. Regarding the following... Figure 4 The image shown is labeled as follows: Figure 4 (a) is the original image. In this image, the first line, "Season 2," contains text without any text effects, while the second line, "Anti-Japanese Heroines," contains text with 3D effects. Therefore, for the data processing here, the text without text effects is labeled separately, resulting in the following: Figure 4 (b) The dark gray Mask (hereinafter referred to as the first marker mask); for special effects containing text effects, the Mask of the combined annotation result of the special effects and artistic fonts is used, minus the Mask of the text itself, resulting in the following: Figure 2 The light gray Mask (hereinafter referred to as the second marker mask) portion.

[0087] The specific representation in the original image can be seen here. Figure 4 In (c), the light gray mask represents the artistic text without special effects, and the dark gray mask represents the artistic text with special effects.

[0088] It should be noted that the above text effect processing solutions are more effective for images containing large amounts of text and text effects in film and television productions. This is mainly because by separating text effects from the text itself, the model can effectively learn the characteristics and incompleteness of the surrounding effects during training, effectively distinguishing them from other effects that do not contain text, and ensuring their completeness. For more details, please refer to [link to relevant documentation]. Figure 5 This is a schematic diagram of another data annotation method provided in an embodiment of the present invention. Figure 5 exist Figure 4 Based on the data annotation method shown, text and text effects data annotations are performed on images of the animation type. Specifically, as shown... Figure 5 As shown, a detailed description of the specific annotation process can be found in [link to documentation]. Figure 4 The relevant descriptions in the text will not be elaborated here.

[0089] Furthermore, the sample text region of the sample image can be marked with a first marker mask, and the sample effect region of the sample image can be marked with a second marker mask. In this way, sample text and sample text effects in the sample image can be distinguished. Moreover, to better distinguish between sample text and sample text effects, the first marker mask and the second marker mask can be masks of different layers.

[0090] Furthermore, sample text edges are obtained from the sample text region and marked using a third marker mask; sample text effect edges are obtained from the sample effect region and marked using a fourth marker mask. In this way, sample text edges and sample text effect edges can be set within the sample text region and marked using masks.

[0091] Specifically, after determining the first marker mask of the sample text region, pixel erosion processing can be performed on the first marker mask to obtain the third marker mask. Similarly, after determining the second marker mask of the sample effect region, pixel erosion processing can be performed on the second marker mask to obtain the fourth marker mask. For example, the sample text edge after erosion by 3 pixels and the sample text effect edge after erosion by 3 pixels can be obtained. This embodiment of the invention does not impose a specific limitation on the number of pixels for pixel erosion.

[0092] Optionally, to better distinguish between sample text regions and sample effect regions in the sample image, after marking the sample text regions of the sample image with a first marker mask and the sample effect regions of the sample image with a second marker mask, a preset number of pixel intervals between the sample text regions and the sample effect regions can be obtained as an interval region. The preset number can be any positive integer, such as 2, and this embodiment of the invention does not impose any limitation on it.

[0093] Specifically, taking the preset quantity of 2 as an example, pixel dilation processing can be performed on the edges of the sample text in the sample text area to obtain an interval region after dilation of 2 pixels. This interval region can be marked using a fifth and a sixth marker mask. The fifth marker mask corresponds to the sample text interval, and the sixth marker mask corresponds to the sample text effect interval. It should be noted that the 2-pixel interval region can be represented by a value of 255, while areas in the corresponding sample image without any text can be represented by a value of 0. In this way, the sample text region and the sample effect region in the sample image can be accurately distinguished.

[0094] Furthermore, by inputting sample images into a pre-defined initial detection model, a sample prediction mask output by the initial detection model can be obtained. This sample prediction mask includes at least a sample text prediction mask and a sample effect prediction mask.

[0095] Specifically, the aforementioned sample text prediction mask includes at least: a first prediction mask and a first edge prediction mask. The first prediction mask corresponds to the sample text in the sample text region, and the first edge prediction mask corresponds to the sample text edges in the sample text region. The aforementioned sample effect prediction mask includes at least: a second prediction mask and a second edge prediction mask. The second prediction mask corresponds to the sample text effects in the sample effect region, and the second edge prediction mask corresponds to the sample text effect edges in the sample effect region.

[0096] Optionally, the specific implementation of determining the first predicted mask for the sample text and the second predicted mask for the sample text effects may include: performing feature extraction processing on the sample image using a feature extraction algorithm to obtain the image features of the sample image, and then processing the image features using a preset masking algorithm to predict the predicted masks for the sample text and sample text effects in the sample image. The first predicted mask for the sample text and the second predicted mask for the sample text effects obtained above can be predicted masks from different output layers.

[0097] It should be noted that the first and second prediction masks of the different output layers mentioned above can be relatively independent. The output layer of each prediction mask has the same size as the original image and can be represented by floating-point values ​​of 0-1. A mask closer to 1 indicates the presence of text or effects at that location, while a mask closer to 0 indicates the absence of text.

[0098] Step 303: Determine the text cross-entropy of the sample text region based on the sample text prediction mask.

[0099] Step 304: Determine the effect cross-entropy of the sample effect region based on the sample effect prediction mask.

[0100] The following provides a unified description of steps 303 and 304:

[0101] The aforementioned text cross-entropy includes at least two types: a first cross-entropy and a second cross-entropy. The first cross-entropy corresponds to the cross-entropy of the sample text within the sample text region, and the second cross-entropy corresponds to the cross-entropy of the sample text edges within the sample text region.

[0102] The aforementioned special effects cross-entropy includes at least two types: third cross-entropy and fourth cross-entropy. The third cross-entropy corresponds to the cross-entropy of the sample text effects in the sample special effects region, and the fourth cross-entropy corresponds to the cross-entropy of the edges of the sample text effects in the sample special effects region.

[0103] In one embodiment, the specific implementation of determining the text cross-entropy of a sample text region based on the sample text prediction mask may include: using a preset cross-entropy algorithm to calculate the first marker mask and the first prediction mask to obtain the first cross-entropy of the sample text in the sample text region; using the preset cross-entropy algorithm to calculate the third marker mask and the first edge prediction mask to obtain the second cross-entropy of the sample text edges in the sample text region. Thus, the first cross-entropy and the second cross-entropy can be determined as the text cross-entropy of the sample text region. Specifically, the cross-entropy algorithm can be a loss function algorithm, and the specific type of loss function algorithm is not limited in this embodiment of the invention.

[0104] For example, taking the first cross-entropy mentioned above, the first marker mask and the first prediction mask of the sample text are represented by images of the same size. It is assumed that the value of the first marker mask `mask_background` is 0 or 1, while the value of the first prediction mask `pred_mask` is a probability value within the interval [0, 1]. For each specific location, the corresponding first cross-entropy calculation process can be as follows:

[0105] Assuming the first predicted mask `pred_mask` is 0.9, and the corresponding standard value, i.e., the first marker mask, is 1, then, according to the above description, the first marker mask and the first predicted mask are calculated using a preset cross-entropy algorithm, resulting in the first cross-entropy of the sample text in the sample text region being 1*ln0.9 + 0*ln0.1. The text cross-entropy and effect cross-entropy of the entire sample image are calculated using this method.

[0106] In one embodiment, the specific implementation of determining the effect cross-entropy of the sample effect region based on the sample effect prediction mask may include: using a preset cross-entropy algorithm to calculate the second marker mask and the second prediction mask to obtain the third cross-entropy of the effects in the sample effect region; using a preset cross-entropy algorithm to calculate the fourth marker mask and the second edge prediction mask to obtain the fourth cross-entropy of the sample text effect edges in the sample effect region. Thus, the third and fourth cross-entropies can be determined as the effect cross-entropy of the sample effect region.

[0107] It should also be noted that the first cross-entropy mentioned above can be used to regress the region range of sample text in the sample image, the second cross-entropy mentioned above can be used to regress the edge of sample text in the sample image, the third cross-entropy mentioned above can be used to regress the region range of sample text effects in the sample image, and the fourth cross-entropy mentioned above can be used to regress the edge of sample text effects in the sample image.

[0108] Step 305: Perform backpropagation on the text cross-entropy and the special effects cross-entropy to complete the training of the initial detection model.

[0109] The backpropagation method described above is a recursive method for calculating the gradient of an expression using the chain rule.

[0110] Referring to the descriptions of steps 303 and 304 above, in this embodiment of the invention, the aforementioned text cross-entropy includes at least a first cross-entropy and a second cross-entropy, and the aforementioned special effects cross-entropy includes at least a third cross-entropy and a fourth cross-entropy. Thus, the model can be trained based on the first cross-entropy, the second cross-entropy, the third cross-entropy, and the fourth cross-entropy.

[0111] Based on the above description, in one embodiment, the specific implementation of backpropagation processing of the text cross-entropy and effect cross-entropy to complete the training of the initial detection model may include: summing the first cross-entropy, second cross-entropy, third cross-entropy, and fourth cross-entropy using a preset summation algorithm to obtain the target cross-entropy; and performing backpropagation processing on the target cross-entropy to complete the training of the initial detection model. In this way, a detection model can be trained to achieve subsequent detection processing of the image to be processed.

[0112] For details, please refer to Figure 6 The above is a flowchart of an embodiment of a target cross-entropy determination method provided by an embodiment of the present invention. Figure 6 As shown in the figure, "image" represents the sample image, and "feature extract" represents the image features obtained by extracting features from the sample image. A pre-defined masking algorithm is used to process these image features, predicting the mask for the sample text and its effects within the sample image. Specifically, Pred edge mask1 is the first predicted edge mask for the sample text edges, Pred mask2 is the second predicted edge mask for the sample text effects, and Pred edge mask3 is the fourth predicted edge mask for the sample text effects.

[0113] Figure 6 In the diagram, gt edge mask1 is the second labeled mask for the edge of the sample text in the sample text region, and gtmask1 is the first labeled mask for the sample text. gt mask2 is the third labeled mask for the sample text effect in the sample effect region, and gt edge mask2 is the second edge prediction mask for the sample text effect.

[0114] The preset cross-entropy algorithm is used to calculate the gt edge mask1 and Pred edge mask1 to obtain the second cross-entropy of the sample text edges in the sample text region as edge_loss1.

[0115] The preset cross-entropy algorithm is used to calculate gt mask1 and Pred mask1 to obtain the first cross-entropy of the sample text in the sample text region as mask_loss1.

[0116] The preset cross-entropy algorithm is used to calculate gt mask2 and Pred mask2 to obtain the third cross-entropy of the sample text in the sample text region as mask_loss2.

[0117] The preset cross-entropy algorithm is used to calculate the gt edge mask2 and Pred edge mask2 to obtain the fourth cross-entropy of the sample text edges in the sample text region as edge_loss2.

[0118] Then, the first cross-entropy mask_loss1, the second cross-entropy edge_loss1, the third cross-entropy mask_loss2, and the fourth cross-entropy edge_loss2 are summed using a preset summation algorithm to obtain the target cross-entropy as total loss.

[0119] It's important to note that backpropagation requires summing all cross-entropies to obtain a comprehensive cross-entropy (i.e., the target cross-entropy). Backpropagation is then performed using this target cross-entropy, representing the partial derivative of the network loss function with respect to the neuron output values ​​in each masked output layer. Then, according to the optimization algorithm, the gradient value of each neuron is calculated, and each parameter is updated. This completes the training of the initial detection model, resulting in the trained detection model.

[0120] This concludes the process. Figure 3 The process described is as follows.

[0121] By acquiring sample images and inputting them into a pre-defined initial detection model, the model outputs a sample prediction mask. This mask includes at least two parts: a sample text prediction mask and a sample effect prediction mask. The text prediction mask corresponds to the sample text region in the sample image, and the effect prediction mask corresponds to the sample effect region of the text in the sample image. The text cross-entropy of the sample text region is determined based on the text prediction mask, and the effect cross-entropy of the sample effect region is determined based on the effect prediction mask. Backpropagation is then performed on the text cross-entropy and effect cross-entropy to train the initial detection model. This allows for the determination of the sample image's prediction mask, and the determination of the text cross-entropy and effect cross-entropy of the sample text region, enabling the training of the initial detection model through backpropagation. This allows the trained detection model to quickly detect images and obtain accurate results, improving efficiency and detection effectiveness.

[0122] Step 203: Merge the text prediction mask and the effect prediction mask to obtain the merged mask of the text region and the effect region in the image to be processed.

[0123] Step 204: Perform pixel dilation on the merged mask, and determine the dilated merged mask as the target prediction mask for the text region and special effect region in the image to be processed.

[0124] The following provides a unified description of steps 203 and 204:

[0125] As can be seen from the above description, in the embodiments of the present invention, the text prediction mask and the effect prediction mask belong to different mask output layers. Therefore, the merged mask of the text region and the effect region in the image to be processed can be determined by merging the text prediction mask and the effect prediction mask.

[0126] Furthermore, to avoid omissions during mask detection of the image to be processed, which would result in incomplete text erasure when text erasure is performed based on the predicted masks of the text and effect areas in the image, leading to poor erasure results and a poor user experience.

[0127] Based on this, the text and effect regions in the image to be processed can be expanded. Specifically, after determining the merge mask for the text and effect regions in the image to be processed, pixel dilation processing is performed on the text and effect regions of the different output layers of the merged mask. For example, a preset number of pixel regions are obtained as the expanded regions for the text and effect regions. The predicted number can be any positive integer, such as 5, and this embodiment of the invention does not limit this. See also [further details omitted]. Figure 7This is a schematic diagram illustrating a visual interface according to an embodiment of the present invention. Figure 7 include Figure 7 (a) Figure 7 (b) and Figure 7 (c). Among them, the above Figure 7 (a) is the image to be processed. Figure 7 (b) is the image of the text region and the effect region output after merging the text prediction mask and the effect prediction mask. Figure 7 (c) is the image of the text area and the effect area output after pixel dilation processing of the merged mask.

[0128] For more details, please see also Figure 8 This is a schematic diagram illustrating another visual interface according to an embodiment of the present invention. Figure 8 include Figure 8 (a) and Figure 8 (b) Figure 8 (a) is the image to be processed. Figure 8 (b) The image after dilating the text and effect areas of the image to be processed by 5 pixels. The image shows that the detected merge mask, after pixel dilation, effectively covers all text areas with minimal unnecessary coverage.

[0129] In this embodiment of the invention, pixel dilation is performed on the merged mask, and the dilated merged mask is determined as the target prediction mask for the text region and the special effect region in the image to be processed.

[0130] The above processing method can expand the text and effect areas in the image to be processed, thus avoiding detection omissions when performing mask detection on the image.

[0131] This concludes the process. Figure 2 The process described is as follows.

[0132] The above processing method enables rapid and accurate detection of text and text effects in the image to be processed. Furthermore, by expanding the text and effect regions in the image, it avoids omissions during mask detection. This allows for the acquisition of the target prediction masks for the text and effect regions in the image output by the detection model, improving the efficiency of image detection and laying the foundation for subsequent text and text effect erasure operations.

[0133] See Figure 9 This is a flowchart illustrating another embodiment of the model training method provided by this invention. Figure 9 As shown, the process may include the following steps:

[0134] Step 901: Obtain sample images.

[0135] Step 902: Mark the sample text area of ​​the sample image with the first marker mask, and mark the sample effect area of ​​the sample image with the second marker mask.

[0136] Step 903: Obtain the sample text edges from the sample text region and mark them using the third marker mask.

[0137] Step 904: Obtain the edge of the sample text effect from the sample effect area and mark it using the fourth mark mask.

[0138] Step 905: Input the sample image into the preset initial detection model to obtain the sample prediction mask output by the initial detection model.

[0139] Step 906: The sample prediction mask includes at least: a sample text prediction mask and a sample effect prediction mask. The sample text prediction mask corresponds to the sample text region in the sample image, and the effect prediction mask corresponds to the sample effect region of the text in the sample image.

[0140] Step 907: Use the preset cross-entropy algorithm to calculate the first marker mask and the first prediction mask to obtain the first cross-entropy of the sample text in the sample text region.

[0141] Step 908: The third marker mask and the first edge prediction mask are calculated using a preset cross-entropy algorithm to obtain the second cross-entropy of the sample text edges in the sample text region.

[0142] Step 909: Use the preset cross-entropy algorithm to calculate the second marker mask and the second prediction mask to obtain the third cross-entropy of the special effects in the sample effect region.

[0143] Step 910: Use the preset cross-entropy algorithm to calculate the fourth marker mask and the second edge prediction mask to obtain the fourth cross-entropy of the sample text effect edge in the sample effect region.

[0144] Step 911: Use a preset summation algorithm to sum the first cross-entropy, the second cross-entropy, the third cross-entropy, and the fourth cross-entropy to obtain the target cross-entropy.

[0145] Step 912: Perform backpropagation on the target cross-entropy to complete the training of the initial detection model.

[0146] For a detailed description of steps 901 to 912, please refer to [link / reference]. Figure 3 The relevant descriptions of the process shown will not be repeated here.

[0147] Corresponding to the aforementioned embodiments of the image processing method, the present invention also provides an embodiment block diagram of the apparatus.

[0148] See Figure 10 This is a block diagram of an embodiment of an image processing apparatus provided by an embodiment of the present invention. Figure 10 As shown, the device includes:

[0149] Image acquisition module 1001 is used to acquire an image to be processed, input the image to be processed into a trained detection model, and obtain the prediction mask output by the detection model.

[0150] The prediction mask includes at least: a text prediction mask and an effect prediction mask, wherein the text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed.

[0151] The mask determination module 1002 is used to merge the text prediction mask and the effect prediction mask to obtain the target prediction mask of the text region and the effect region in the image to be processed.

[0152] In an optional implementation, the mask determination module 1002 is specifically used for:

[0153] The text prediction mask and the effect prediction mask are merged to obtain the merged mask of the text region and the effect region in the image to be processed.

[0154] The merged mask is subjected to pixel dilation processing, and the dilated merged mask is determined as the target prediction mask for the text region and the special effect region in the image to be processed.

[0155] In an optional implementation, the text prediction mask includes a first text prediction mask and a second text prediction mask, wherein the first text prediction mask corresponds to the text in the image to be processed, and the second text prediction mask corresponds to the edges of the text in the image to be processed.

[0156] The special effects prediction mask includes a first special effects prediction mask and a second special effects prediction mask. The first special effects prediction mask corresponds to the text special effects in the image to be processed, and the second special effects prediction mask corresponds to the edges of the text special effects in the image to be processed.

[0157] In an optional embodiment, the device further includes (not shown in the figures):

[0158] The model training model, used in the trained detection model, is obtained in the following way:

[0159] The mask determination unit is used to acquire sample images, input the sample images into a preset initial detection model, and obtain the sample prediction mask output by the initial detection model.

[0160] The sample prediction mask includes at least: a sample text prediction mask and a sample effect prediction mask, wherein the sample text prediction mask corresponds to the sample text region in the sample image, and the effect prediction mask corresponds to the sample effect region of the text in the sample image.

[0161] A text cross-entropy determination unit is used to determine the text cross-entropy of the sample text region based on the sample text prediction mask.

[0162] The special effects cross-entropy determination unit is used to determine the special effects cross-entropy of the sample special effects region based on the sample special effects prediction mask.

[0163] The model training unit is used to perform backpropagation processing on the text cross-entropy and the effect cross-entropy to complete the training of the initial detection model.

[0164] In an optional implementation, the sample text prediction mask includes at least: a first prediction mask and a first edge prediction mask; the first prediction mask corresponds to the sample text in the sample text region, and the first edge prediction mask corresponds to the sample text edge in the sample text region;

[0165] The sample effect prediction mask includes at least: a second prediction mask and a second edge prediction mask; the second prediction mask corresponds to the sample text effect in the sample effect region, and the second edge prediction mask corresponds to the edge of the sample text effect in the sample effect region;

[0166] The text cross-entropy includes at least: a first cross-entropy and a second cross-entropy; the first cross-entropy corresponds to the cross-entropy of the sample text in the sample text region, and the second cross-entropy corresponds to the cross-entropy of the sample text edges in the sample text region;

[0167] The special effects cross-entropy includes at least: a third cross-entropy and a fourth cross-entropy; the third cross-entropy corresponds to the cross-entropy of the sample text special effects in the sample special effects region, and the fourth cross-entropy corresponds to the cross-entropy of the sample text special effects edge in the sample special effects region.

[0168] In an optional embodiment, the device further includes (not shown in the figures):

[0169] The first marking module is used to mark the sample text region of the sample image with a first marking mask and mark the sample effect region of the sample image with a second marking mask after the sample image is acquired.

[0170] The second marking module is used to obtain the sample text edges from the sample text region and mark them using the third marking mask;

[0171] The third marking module is used to obtain the sample text effect edges from the sample effect area and mark them using the fourth marking mask.

[0172] In an optional implementation, the text cross-entropy determination unit is specifically used for:

[0173] A preset cross-entropy algorithm is used to calculate the first marker mask and the first prediction mask to obtain the first cross-entropy of the sample text in the sample text region.

[0174] A preset cross-entropy algorithm is used to calculate the third marker mask and the first edge prediction mask to obtain the second cross-entropy of the sample text edges in the sample text region;

[0175] The first cross-entropy and the second cross-entropy are determined to be the text cross-entropy of the sample text region.

[0176] In an optional implementation, the special effect cross-entropy determination unit is specifically used for:

[0177] The second marker mask and the second prediction mask are processed using a preset cross-entropy algorithm to obtain the third cross-entropy of the special effects in the sample special effect region;

[0178] The fourth cross-entropy of the sample text effect edge in the sample effect region is obtained by performing calculations on the fourth marker mask and the second edge prediction mask using a preset cross-entropy algorithm.

[0179] The third cross-entropy and the fourth cross-entropy are determined to be the effective cross-entropy of the sample's special effect region.

[0180] In an optional implementation, the model training unit is specifically used for:

[0181] The first cross-entropy, the second cross-entropy, the third cross-entropy, and the fourth cross-entropy are summed using a preset summation algorithm to obtain the target cross-entropy.

[0182] The target cross-entropy is backpropagated to complete the training of the initial detection model.

[0183] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 11The illustrated electronic device 1100 includes at least one processor 1101, a memory 1102, at least one network interface 1104, and a user interface 1103. The various components in the electronic device 1100 are coupled together via a bus system 1105. It is understood that the bus system 1105 is used to implement communication between these components. In addition to a data bus, the bus system 1105 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 11 The general labeled all buses as Bus System 1105.

[0184] The user interface 1103 may include a display, keyboard or clicking device (e.g., mouse, trackball), touchpad or touch screen, etc.

[0185] It is understood that the memory 1102 in the embodiments of the present invention can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 1102 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0186] In some implementations, memory 1102 stores elements, executable units or data structures, or subsets thereof, or extended sets thereof: operating system 11021 and application program 11022.

[0187] The operating system 11021 includes various system programs, such as the framework layer, core library layer, and driver layer, used to implement various basic business functions and handle hardware-based tasks. The application program 11022 includes various applications, such as a media player and a browser, used to implement various application functions. The program implementing the method of this embodiment can be included in the application program 11022.

[0188] In this embodiment of the invention, by calling the program or instructions stored in memory 1102, specifically the program or instructions stored in application program 11022, processor 1101 executes the method steps provided in each method embodiment, including, for example:

[0189] Obtain the image to be processed, input the image to be processed into the trained detection model, and obtain the prediction mask output by the detection model;

[0190] The prediction mask includes at least: a text prediction mask and an effect prediction mask, wherein the text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed.

[0191] The text prediction mask and the effect prediction mask are merged to obtain the target prediction mask of the text region and the effect region in the image to be processed.

[0192] The methods disclosed in the above embodiments of the present invention can be applied to processor 1101, or implemented by processor 1101. Processor 1101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 1101 or by instructions in the form of software. The processor 1101 may be a general-purpose processor, 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 the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software units in the decoding processor. The software units may be located 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 1102. Processor 1101 reads the information in memory 1102 and, in conjunction with its hardware, completes the steps of the above method.

[0193] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.

[0194] For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.

[0195] The electronic device provided in this embodiment may be as follows: Figure 11 The electronic device shown can perform the following: Figure 1-2 All steps of the image processing method in the middle, thus realizing Figure 1-2 For details on the technical effects of the image processing methods described in the article, please refer to [link / reference]. Figure 1-2 The relevant descriptions are presented concisely and will not be elaborated upon here.

[0196] This invention also provides a storage medium (computer-readable storage medium). This storage medium stores one or more programs. The storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive; the memory may also include combinations of the above types of memory.

[0197] One or more programs in the storage medium can be executed by one or more processors to implement the image processing method described above that is executed on the electronic device side.

[0198] The processor is used to execute an image processing program stored in the memory to implement the following steps of an image processing method executed on the electronic device side:

[0199] Obtain the image to be processed, input the image to be processed into the trained detection model, and obtain the prediction mask output by the detection model;

[0200] The prediction mask includes at least: a text prediction mask and an effect prediction mask, wherein the text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed.

[0201] The text prediction mask and the effect prediction mask are merged to obtain the target prediction mask of the text region and the effect region in the image to be processed.

[0202] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0203] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0204] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An image processing method, characterized in that, The method includes: Obtain the image to be processed, input the image to be processed into the trained detection model, and obtain the prediction mask output by the detection model; The prediction mask includes at least: a text prediction mask and an effect prediction mask, wherein the text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed. The text prediction mask and the effect prediction mask are merged to obtain the target prediction mask of the text region and the effect region in the image to be processed. The trained detection model is obtained in the following way: A sample image is acquired and input into a preset initial detection model to obtain a sample prediction mask output by the initial detection model. The sample prediction mask includes at least a sample text prediction mask and a sample effect prediction mask. The sample text prediction mask corresponds to the sample text region in the sample image, and the effect prediction mask corresponds to the sample effect region of the text in the sample image. The text cross-entropy of the sample text region is determined based on the sample text prediction mask. The effect cross-entropy of the sample effect region is determined based on the sample effect prediction mask. The text cross-entropy and the effect cross-entropy are backpropagated to complete the training of the initial detection model.

2. The method according to claim 1, characterized in that, The step of merging the text prediction mask and the effect prediction mask to obtain the target prediction mask for the text region and the effect region in the image to be processed includes: The text prediction mask and the effect prediction mask are merged to obtain the merged mask of the text region and the effect region in the image to be processed. The merged mask is subjected to pixel dilation processing, and the dilated merged mask is determined as the target prediction mask for the text region and the special effect region in the image to be processed.

3. The method according to claim 1, characterized in that, The text prediction mask includes a first text prediction mask and a second text prediction mask. The first text prediction mask corresponds to the text in the image to be processed, and the second text prediction mask corresponds to the edges of the text in the image to be processed. The special effects prediction mask includes a first special effects prediction mask and a second special effects prediction mask. The first special effects prediction mask corresponds to the text special effects in the image to be processed, and the second special effects prediction mask corresponds to the edges of the text special effects in the image to be processed.

4. The method according to claim 1, characterized in that, The sample text prediction mask includes at least: a first prediction mask and a first edge prediction mask; the first prediction mask corresponds to the sample text in the sample text region, and the first edge prediction mask corresponds to the edge of the sample text in the sample text region; The sample effect prediction mask includes at least: a second prediction mask and a second edge prediction mask; the second prediction mask corresponds to the sample text effect in the sample effect region, and the second edge prediction mask corresponds to the edge of the sample text effect in the sample effect region; The text cross-entropy includes at least: a first cross-entropy and a second cross-entropy; the first cross-entropy corresponds to the cross-entropy of the sample text in the sample text region, and the second cross-entropy corresponds to the cross-entropy of the sample text edges in the sample text region; The special effects cross-entropy includes at least: a third cross-entropy and a fourth cross-entropy; the third cross-entropy corresponds to the cross-entropy of the sample text special effects in the sample special effects region, and the fourth cross-entropy corresponds to the cross-entropy of the sample text special effects edge in the sample special effects region.

5. The method according to claim 4, characterized in that, After obtaining the sample image, the process also includes: The sample text region of the sample image is marked by a first marker mask, and the sample effect region of the sample image is marked by a second marker mask. The sample text edges are obtained from the sample text region and marked using a third marker mask; The sample text effect edges are obtained from the sample effect area and marked using a fourth marker mask.

6. The method according to claim 5, characterized in that, Determining the text cross-entropy of the sample text region based on the sample text prediction mask includes: A preset cross-entropy algorithm is used to calculate the first marker mask and the first prediction mask to obtain the first cross-entropy of the sample text in the sample text region. A preset cross-entropy algorithm is used to calculate the third marker mask and the first edge prediction mask to obtain the second cross-entropy of the sample text edges in the sample text region; The first cross-entropy and the second cross-entropy are determined to be the text cross-entropy of the sample text region.

7. The method according to claim 5, characterized in that, Determining the effect cross-entropy of the sample effect region based on the sample effect prediction mask includes: The second marker mask and the second prediction mask are processed using a preset cross-entropy algorithm to obtain the third cross-entropy of the special effects in the sample special effect region; The fourth cross-entropy of the sample text effect edge in the sample effect region is obtained by performing calculations on the fourth marker mask and the second edge prediction mask using a preset cross-entropy algorithm. The third cross-entropy and the fourth cross-entropy are determined to be the effective cross-entropy of the sample's special effect region.

8. The method according to claim 4, characterized in that, The backpropagation process of the text cross-entropy and the special effects cross-entropy to complete the training of the initial detection model includes: The first cross-entropy, the second cross-entropy, the third cross-entropy, and the fourth cross-entropy are summed using a preset summation algorithm to obtain the target cross-entropy. The target cross-entropy is backpropagated to complete the training of the initial detection model.

9. An image processing apparatus, characterized in that, The device includes: The image acquisition module is used to acquire the image to be processed, input the image to be processed into the trained detection model, and obtain the prediction mask output by the detection model. The prediction mask includes at least: a text prediction mask and an effect prediction mask, wherein the text prediction mask corresponds to the text region in the image to be processed, and the effect prediction mask corresponds to the effect region of the text effect in the image to be processed. The mask determination module is used to merge the text prediction mask and the special effect prediction mask to obtain the target prediction mask of the text region and the special effect region in the image to be processed. The model training module includes: a mask determination unit, used to acquire sample images and input the sample images into a preset initial detection model to obtain a sample prediction mask output by the initial detection model; the sample prediction mask includes at least: a sample text prediction mask and a sample effect prediction mask, the sample text prediction mask corresponding to the sample text region in the sample image, and the effect prediction mask corresponding to the sample effect region of the text in the sample image; a text cross-entropy determination unit, used to determine the text cross-entropy of the sample text region based on the sample text prediction mask; an effect cross-entropy determination unit, used to determine the effect cross-entropy of the sample effect region based on the sample effect prediction mask; and a model training unit, used to perform backpropagation processing on the text cross-entropy and the effect cross-entropy to complete the training of the initial detection model.

10. An electronic device, characterized in that, include: A processor and a memory, the processor being configured to execute an image processing program stored in the memory to implement the image processing method according to any one of claims 1 to 8.

11. A storage medium, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the image processing method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Target bacteria detection method and terminal equipment

    CN108830149A

  • Font detection method and device, equipment and medium

    CN115019322A