Image generation method, model training method, and text bolding method
By generating and scaling random text images and training them using a deep learning network model, the problem of unnatural text bolding in screen content images was solved, achieving a natural text bolding effect and improving readability and aesthetics.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU SHIYUAN ELECTRONICS CO LTD
- Filing Date
- 2024-12-03
- Publication Date
- 2026-06-05
AI Technical Summary
Existing image processing techniques produce unnatural results when bolding text in screen content images, affecting the readability and aesthetics of the text.
A first image containing random text is generated and thickened based on preset thickening parameters to obtain a second image. This second image is then scaled to the target image size. These images are used to train a deep learning network model, improving the model's generalization ability and achieving a natural text thickening effect.
It achieves text bolding effects under different sizes and backgrounds, improving the readability and aesthetics of text in screen content images and enhancing the model's generalization ability.
Smart Images

Figure CN122156347A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image generation method, a model training method, and a text bolding method. Background Technology
[0002] Screen content images (SCIs) typically contain a large amount of text and serve as an important carrier of information, widely used in scenarios such as multi-screen interaction, online meetings, and online education.
[0003] Text in screen content images can be difficult to read due to small font size, low image resolution, or other reasons. Boldening the text in screen content images makes it more prominent, thereby improving readability.
[0004] However, when using existing image processing techniques to bold text in screen content images, the bolding effect is unnatural, affecting the readability and aesthetics of the text. Summary of the Invention
[0005] This application provides an image generation method, a model training method, and a text bolding method, which can solve the problem that "when bolding text in a screen content image, the bolding effect is unnatural, affecting the readability and aesthetics of the text." To achieve the above objectives, the technical solutions provided by this application are as follows:
[0006] In a first aspect, embodiments of this application provide an image generation method, the image generation method comprising:
[0007] Randomly select one of the multiple preset image sizes to use as the first image, and generate the first image containing random text;
[0008] The random text in the first image is thickened based on preset thickening parameters to obtain the second image; wherein, the preset thickening parameters include a preset thickening direction and a preset thickening value;
[0009] Scale the first and second images to the target image size.
[0010] Secondly, embodiments of this application provide a model training method, including:
[0011] Obtain training image pairs for training a preset deep learning network model; wherein, the training image pairs include the first image and the second image described in the first aspect, or include a first large image generated based on multiple first images and a second large image generated based on multiple second images;
[0012] The deep learning network model is trained using the training images.
[0013] Thirdly, embodiments of this application provide a method for bolding text in a screen content image, including:
[0014] The screen content image to be processed is input into a deep learning network model to obtain a screen content image with bolded text; wherein, the deep learning network model is trained according to the model training method described in the second aspect.
[0015] Fourthly, embodiments of this application provide a display device, including:
[0016] The text bolding module is used to input the screen content image to be processed into a deep learning network model to obtain a screen content image with bolded text; wherein, the deep learning network model is trained according to the model training method described in the second aspect;
[0017] The display module is used to display the screen content image after the text has been bolded.
[0018] Fifthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the image generation method as described in the first aspect, the model training method as described in the second aspect, or the text bolding method as described in the third aspect.
[0019] In the various embodiments provided in this application, a randomly generated first image is bolded to obtain a second image, and then the first and second images are scaled to the target image size. Since the initial size of the first image and the text font size are optional, multiple first images may be generated with different sizes, and consequently, multiple second images may also have different sizes. After scaling images of different sizes to the same target image size, second images with different degrees of text bolding can be obtained. These processed first and second images can then be used to train a pre-set deep learning network model, which can improve the model's generalization ability, achieve the effect of "boldening small fonts while keeping large fonts unchanged," and ensure the readability and aesthetics of the text in the screen content image output by the model.
[0020] Furthermore, equivalent affine transformations can be performed on the first and second images to mimic irregular fonts in real-world situations. Then, using the transformed images to train a deep learning network model can improve the model's generalization ability and achieve a better bolding effect for irregular fonts.
[0021] When bolding random text in the first image based on preset bolding parameters, the random text can be copied first, and then the copied text can be moved to change its position in the first image. This simple and intuitive method of bolding text in the first image improves image generation efficiency.
[0022] This process involves copying random text multiple times and then translating these copies in multiple directions to obtain a first image containing the bolded text. The more text is copied and translated, the bolder the text in the first image becomes.
[0023] Furthermore, the preset bolding value of the copied text can be determined based on the font size of the original random text in the first image; the smaller the font size, the greater the bolding. This further enhances the effect of "boldening small fonts while keeping large fonts unchanged."
[0024] Furthermore, after generating several pairs of first and second images, multiple first images can be stitched together to form a first large image, and multiple second images can be stitched together to form a second large image. Then, the stitched large image is used to train a deep learning network model. The model can simultaneously process text of different colors and sizes, and maintain good bolding effects even under complex background interference, making text bolding of screen content images more intelligent and efficient. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 A flowchart illustrating an image generation method provided in an embodiment of this application;
[0027] Figure 2 A schematic diagram illustrating a preset bolding direction provided in an embodiment of this application;
[0028] Figure 3A This is a schematic diagram illustrating a text bolding effect provided in an embodiment of this application;
[0029] Figure 3B This is an illustration of another text bolding effect provided in an embodiment of this application;
[0030] Figure 4 This is a schematic diagram of an image stitching effect provided in an embodiment of this application;
[0031] Figure 5This application provides an illustration of a text bolding effect on a screen content image.
[0032] Figure 6A A timing diagram illustrating a method for bolding text in a screen content image, provided in an embodiment of this application.
[0033] Figure 6B A timing diagram of another method for bolding text in screen content images provided in an embodiment of this application;
[0034] Figure 7 This is a schematic diagram of the structure of an image generation device provided in an embodiment of this application. Detailed Implementation
[0035] Screen content image (SCI) can be understood as the content presented on the screen of a display device, which typically includes various types of information such as text, graphics, and images. As an important carrier of information transmission, screen content images are widely used in scenarios such as multi-screen interaction, online meetings, and online education.
[0036] For example, in multi-screen interaction scenarios, the screen content of smartphones, tablets, or laptops can be shared to display devices such as TVs and large conference screens for presentations. Displaying screen content on a larger screen makes information presentation clearer. Similarly, in online meeting scenarios, participants can use screen sharing to display PowerPoint presentations, documents, videos, and other meeting materials in real time, enabling efficient communication and collaboration among people in different locations. Furthermore, in online education scenarios, teachers can transmit teaching materials, experimental demonstrations, and other learning resources to students' devices via screen content. This breaks down the traditional time and space limitations of education, making remote teaching more vivid and intuitive, and facilitating students' review and consolidation of learning content.
[0037] In screen content images, text readability is often affected by a variety of adverse factors, significantly diminishing the reading experience. For example, if the font size in the screen content image is too small, the strokes and details of the text will be unclear and difficult to read; low image resolution will result in a loss of overall image detail and blurred text edges, leading to reading difficulties.
[0038] To improve the readability of text in screen content images, an effective method is to bold the text. Bold text offers several advantages. Firstly, in information-rich screen content images, bolded text allows key information to be captured immediately, improving information delivery efficiency. Secondly, for people with poor eyesight, bolded text is easier to recognize and read, enhancing the readability of the screen content.
[0039] Traditional image processing techniques typically employ morphological methods or sharpening techniques to bold text. However, these methods often yield unsatisfactory results. Specifically, morphological methods usually achieve text bolding through operations such as dilation and erosion, but this approach struggles to precisely control the degree of bolding, easily leading to text distortion, blurring, or text blending into the background. Furthermore, the bolded image remains binary, unable to recover the original image's color information. While sharpening techniques can enhance image edges to some extent, their effect on text bolding is often unnatural, potentially resulting in over-sharpening that produces jagged edges or noise, impacting readability and aesthetics.
[0040] Based on this, this application provides an image generation method that obtains a second image by bolding the text in a randomly generated first image, and then scales both the first and second images to the target image size. Since the initial size of the first image and the text font size are optional, multiple generated first images may have different sizes, resulting in multiple second images with different sizes. Scaled images of different sizes to the same target image size, second images with varying degrees of text bolding can be obtained, achieving the effect of "boldening small fonts while keeping large fonts unchanged." Subsequently, these processed first and second images can be used to train a pre-set deep learning network model, improving the model's generalization ability. The text in the screen content images output by the model is clearer, more prominent, and more natural, ensuring the readability and aesthetics of the text in the screen content images output by the model.
[0041] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0042] It should be understood that the described embodiments are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0043] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0044] In the description of this application, it should be understood that the terms "first," "second," "third," etc., are used only to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances. Furthermore, in the description of this application, unless otherwise stated, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0045] Figure 1 An image generation method disclosed in this application may include the following steps:
[0046] S102, Generate a first image containing random text.
[0047] In practice, for ease of description, the screen content image before the font bolding is called the first image, and the screen content image after the font bolding is called the second image.
[0048] In implementation, the font size of the random text is selected from a preset font size range, and the size of the first image is selected from multiple preset image sizes. In other words, a font size can be selected from the preset font size range as the font size of the random text in the first image, and a size can be randomly selected from multiple preset image sizes as the size of the first image. Then, a first image containing the random text can be generated based on the selected font size and image size.
[0049] For example, the preset font size range can be [20, 200] points (pt), and the preset image size can include any pixel value such as 512×512 pixels (px), 768×768 pixels, 896×896 pixels, 1024×1024 pixels, etc. It is worth mentioning that the preset font size range and preset image size can be set according to the actual application scenario and business needs, and this application does not restrict their values.
[0050] In one embodiment, the random text can also be randomly selected from multiple font types, multiple font styles, and multiple colors. For example, font types can include Arabic numerals, characters or symbols of various languages such as English and Chinese; font styles can include Neo-Roman, KaiTi, HeiTi, etc., and can further include regular, italic, and bold styles; multiple colors can include solid colors, gradient colors, etc.
[0051] In one embodiment, a background image style can be randomly selected for the first image. By pasting the aforementioned random text into any position on the background image, the first image before text bolding is obtained. The background image style can include solid color fill, gradient fill, pattern fill, etc.
[0052] In this way, when generating the first and second images, various aspects such as the text's font type, font size, font style, thickness, angle, and color can be fully considered, as well as the background image's style. Consequently, it is possible to generate image pairs with comprehensive styles.
[0053] S104, based on preset bolding parameters, the random text in the first image is bolded to obtain the second image.
[0054] In practice, the bolding effect can be achieved by copying and translating random text. Accordingly, the preset bolding parameters can include a preset bolding direction and a preset bolding value. The preset bolding direction determines the direction of movement of the copied text, and the preset bolding value determines the distance the copied text moves.
[0055] Bold text enhances its visual impact, making it more prominent against complex backgrounds. This allows users to easily recognize and read text in screen content images, even with small font sizes or low resolution. It's understandable that larger font sizes in screen content images are easier to read and therefore require less bolding. When using the same preset bolding parameters to bold random text, larger font sizes result in smaller bold portions. Once the font size reaches a certain value, the bold portion becomes negligible, achieving the effect of "bold small fonts, unchanged large fonts."
[0056] In one embodiment, the specific processing of S104 may include: copying random text in the first image to obtain copied text; and shifting the copied text in a preset bolding direction by a preset bolding value to obtain a second image.
[0057] In practice, when bolding random text in the first image based on preset bolding parameters, the random text can be copied first, and then the copied text can be moved to change its position in the first image. This simple and intuitive method of bolding text in the first image improves image generation efficiency.
[0058] In one embodiment, see Figure 2 The preset bolding direction can include any one or more of the following directions: up, down, left, right, upper left, lower left, upper right, and lower right. This application does not limit this direction.
[0059] For example, see Figure 3A When the preset bolding direction is up, down, left, and right, and the preset bolding value is 1 pixel, the random text "A" on the left can be copied 4 times. Each of the 4 copied texts is then shifted 1 pixel in each of the four directions (up, down, left, and right) to obtain a second image containing the bolded text on the right. It can be understood that the bolded text is formed by superimposing the 4 shifted copied texts and the original random text.
[0060] For example, see Figure 3B When the preset bolding direction is left and right, and the preset bolding value is 1 pixel, the random text "A" on the left can be copied twice. The two copied texts are then shifted 1 pixel to the left and right respectively, resulting in a second image that includes the bolded text on the right. This bolded text is formed by superimposing the two shifted copied texts and the original random text.
[0061] It is worth mentioning that when bolding random text, one can generate and shift a copy of the text before generating and shifting the next copy; or multiple copies can be generated at once, and then shifted separately. This application does not restrict the generation and shifting order of the copies.
[0062] See you again Figure 3A and 3B It is understandable that the more preset bolding directions, the bolder the text. However, too many bolding directions may lead to over-bold text, which reduces readability. Therefore, the bolding directions and their number can be set according to the actual application scenario and business needs; this application does not impose any restrictions on this.
[0063] Similarly, the larger the preset bold value, the greater the displacement of the copied text relative to the original random text, and to a certain extent, the more obvious the text bolding effect. When the bold value is too large, it may lead to excessive text bolding, or even text ghosting, which reduces the readability of the text. Therefore, the bold value can be set according to the actual application scenario and business needs, and this application does not impose any restrictions on it.
[0064] In one embodiment, before step S104, the image generation method disclosed in this application embodiment may further include: when the font size of the random text is smaller than the preset font size, determining the first bold value as the preset bold value; otherwise, determining the second bold value as the preset bold value; wherein, the boldness corresponding to the first bold value is higher than the boldness corresponding to the second bold value.
[0065] In implementation, the random text can be bolded to varying degrees depending on its font size. For example, with a preset font size of 100 points, the first bold value is 2 pixels, and the second bold value is 1 pixel. When bolding random text, first determine if its font size exceeds 100 points. If the font size is less than 100 points, shift it 2 pixels in the preset bold direction; if the font size is 100 points or more, shift it 1 pixel in the preset bold direction.
[0066] It's understandable that larger font sizes make text easier to read, thus reducing the need for bolding. By setting different levels of bolding for different font sizes, the effect of "boldening small fonts while keeping large fonts unchanged" can be further enhanced.
[0067] S106, scale the first image and the second image to the target image size.
[0068] In practice, the target image size can be any value, which can be one of the preset image sizes or other image sizes. This application does not limit this.
[0069] For example, in one embodiment, the preset image sizes include 512×512 pixels, 768×768 pixels, 896×896 pixels, and 1024×1024 pixels, and the target image size is 256×256 pixels. It can be understood that the originally randomly generated first image can be 512×512 pixels, 768×768 pixels, 896×896 pixels, or 1024×1024 pixels, with multiple first images of varying sizes. Assuming that the font size of the random text in the multiple first images is the same, then after applying preset bolding parameters to bold the random text in each first image, the resulting bolded text will also have the same font size. After scaling the multiple first images to the same target image size, i.e., 256×256 pixels, due to the different image scaling ratios, the font sizes of the bolded text in each first image and the second image will no longer be the same, thus obtaining image data with different degrees of bolding.
[0070] Based on the method provided in this embodiment, a large number of paired images of text before and after bolding can be generated quickly. These image pairs can then be used to create a training dataset. Training a pre-defined deep learning network model based on this dataset can improve the model's generalization ability, achieving the effect of "boldening small fonts while keeping large fonts unchanged," and ensuring the readability and aesthetics of the text in the screen content images output by the model.
[0071] In one embodiment, the image generation method further includes performing the same affine transformation on the first image and the second image.
[0072] In implementation, the first and second images can be subjected to equivalent affine transformations before step S106. An affine transformation is a process of transforming a vector space into another vector space by performing a linear transformation (multiplication by a matrix) and a translation (addition of a vector). Affine transformations can include basic transformations such as scaling, translation, rotation, flipping, and shearing, as well as composite transformations of these basic transformations; this application does not limit the scope of such transformations.
[0073] It's worth noting that randomly generated text from computer devices typically uses relatively standard fonts. In real-world applications, screen content images may include text that has been rotated or distorted. To simulate potential real-world scenarios, an affine transformation can be applied to both the first image of the text before bolding and the corresponding second image after bolding. This allows for better generalization of the model when training a pre-defined deep learning network using the first and second images after the affine transformation, achieving a better bolding effect even for non-standard fonts.
[0074] In one embodiment, to avoid excessive stretching and rotation of the text, the rotation angle of the affine transformation can be controlled within the range of (-15°, 15°).
[0075] It's understandable that if the first and second images undergo excessively large affine transformations, the deep learning network model might overfit these deformed images, failing to correctly learn image features and thus leading to overfitting. Therefore, by setting the rotation angle appropriately, such as no more than 15° clockwise or counterclockwise, excessive stretching and rotation of the text can be avoided, thereby reducing the risk of overfitting.
[0076] It is worth mentioning that the rotation angle range of affine transformation can be adjusted according to the actual application scenario and business needs, and this application does not impose any restrictions on this.
[0077] In one embodiment, after step S106, the image generation method provided in one embodiment of this application may further include: acquiring multiple different first images and corresponding multiple second images; stitching the multiple first images into a first large image according to a preset stitching rule, and stitching the multiple second images into a second large image.
[0078] In implementation, see Figure 4 The preset stitching rule is to stitch the four images together in a "cross" pattern to form a four-square grid. Accordingly, after step S106, four different first images can be obtained, and these four first images can be stitched together to form a "four-square grid," resulting in... Figure 4 The first large image shown on the left before the text is bolded. And four corresponding second images are obtained, and these four second images are stitched together to form a "four-square grid". Figure 4 The second largest image shown on the right with the text in bold.
[0079] Subsequently, when the first large image after stitching together and the corresponding second large image are used to train the deep learning network model, the model can process text of different colors and sizes at the same time, and can still maintain a good bolding effect under the interference of complex backgrounds, making the text bolding processing of screen content images more intelligent and efficient.
[0080] It is worth mentioning that the preset splicing rule can be any image splicing rule, such as splicing two images horizontally. This application does not limit the number of first images or the splicing method.
[0081] It should be noted that, due to space limitations, this application specification does not exhaustively list all possible implementation methods. Those skilled in the art should be able to conceive after reading this application specification that, as long as the technical features do not contradict each other, any combination of technical features can constitute an optional implementation method.
[0082] For example, in one embodiment, a technical feature is described: "The first image and the second image undergo the same affine transformation." In another embodiment, another technical feature is described: "The random text in the first image is copied to obtain copied text; and the copied text is shifted by the preset bolding value in the preset bolding direction to obtain the second image." Since the above two technical features do not contradict each other, those skilled in the art should be able to conceive, after reading this application specification, that is, to first translate and superimpose the random text in the first image to obtain the second image with bolded text, and then perform the same affine transformation on the first image and the second image.
[0083] Based on the same technical concept, this application also provides a model training method applied to a model training device. The model training method may include: acquiring training image pairs for training a preset deep learning network model; and training the deep learning network model using the training image pairs.
[0084] In practice, the first image and the corresponding second image generated by the above-mentioned image generation method embodiments can be obtained, and the first image and the corresponding second image can be used as training image pairs for training deep learning network models; alternatively, a first large image generated based on multiple different first images and a second large image generated based on multiple corresponding second images can be obtained, and the first large image and the corresponding second large image can be used as training image pairs for training deep learning network models.
[0085] It is understandable that when the first large image and the corresponding second large image are used as training image pairs for training the preset deep learning network model, it is equivalent to simultaneously obtaining paired image data that cover text with different colors, font sizes, rotation angles and bolding levels, as well as backgrounds with different levels of complexity.
[0086] In practice, bolding text within a screen image involves operations such as translating and overlaying text pixels. Furthermore, the deep learning network model used for text bolding needs to output the same result for both the original and its translated version of the same image; that is, it needs to possess translation invariance. Therefore, a translation-invariant convolutional neural network can be used as the pre-defined deep learning network model.
[0087] In one embodiment, the L1 loss function (Mean Absolute Error) can be used as the loss function for the deep learning network model used for the text bolding task. In this case, the final model optimization objective θ * It can be:
[0088]
[0089] Where θ represents a convolutional neural network, I norm This refers to the input image, i.e., the image before the text is bolded (e.g., the first image or the first large image), I bold This represents the truth image, i.e., the image with the text in bold (e.g., the second image or the second largest image).
[0090] During training, the parameters of the convolutional neural network model can be continuously updated to reduce the error in the predicted image θ(I) output by the model. norm ) and the truth image I boldThe L1 loss is calculated between the updated model parameters and the target model. If the updated model parameters minimize the L1 loss or the L1 loss no longer decreases, then the convolutional neural network using these model parameters has achieved its optimization objective θ. * Then the training of the convolutional neural network model can be terminated.
[0091] It is worth mentioning that other loss functions can also be used to train the deep learning network model for text bolding provided in this application, and this application does not impose any restrictions on this.
[0092] Based on the same technical concept, this application embodiment also provides a method for bolding text in a screen content image, which can be applied to a text bolding device. The text bolding method may include: inputting the screen content image to be processed into a deep learning network model to obtain a screen content image with bolded text; wherein, the deep learning network model is trained according to the above-described model training method.
[0093] In one embodiment, the text bolding device can be a display device for displaying an image of the screen content with bolded text.
[0094] It is worth mentioning that the text bolding method for screen content images provided in the above embodiments and the image generation method belong to the same concept. For details of its specific implementation process, please refer to the various embodiments of the image generation method. This application will not repeat it here.
[0095] In implementation, please refer to Figure 5 , will be Figure 5 The image above shows the screen content before text bolding. After inputting this image into a trained deep learning network model for text bolding, the model's output can be obtained as shown above. Figure 5 The image below shows the screen content with the text bolded. As can be seen from the comparison, the deep learning network model obtained using the model training method provided in this application can not only handle text of different colors and sizes, but also maintain a good bolding effect even under complex background interference.
[0096] In one embodiment, see Figure 6A The image generation device can generate a training dataset for training a deep learning network model. This training dataset includes a large number of training image pairs obtained based on the aforementioned image generation methods. The model training device can obtain the training dataset from the image generation device and iteratively train the deep learning network model based on the training image pairs therein. Afterward, the trained deep learning network model can be provided to a display device, enabling the display device to process the screen content image (based on the trained deep learning network model). Figure 6AText is bolded using the symbol SCI (Structured Text Concentration). The display device can then display the bolded text image on its screen.
[0097] In another embodiment, see Figure 6B Text bolding can also be performed by a text bolding device independent of the display device. The display device can then acquire the bolded screen content image from the text bolding device and display the bolded screen content image on its screen.
[0098] It is worth mentioning that the model training method provided in the above embodiments requires training the deep learning network model using image pairs generated by the image generation method provided in the embodiments of this application. The text bolding method for screen content images provided in the above embodiments requires bolding the text in the screen content images based on the trained deep learning network model. The model training method and the text bolding method for screen content images provided in the above embodiments belong to the same concept as the image generation method; their specific implementation processes are detailed in the various embodiments of the image generation method, and will not be repeated here.
[0099] Furthermore, the image generation method, model training method, and text bolding method for screen content images provided in the above embodiments can be executed by different computer devices or by the same computer device, and this application does not impose any restrictions on this.
[0100] Based on the same technical concept, this application also provides an image generation apparatus, see [link to relevant documentation]. Figure 7 It can include:
[0101] A first image generation module is used to generate a first image containing random text; wherein the font size of the random text is selected from a preset font size range, and the size of the first image is selected from a plurality of preset image sizes;
[0102] The second image generation module is used to thicken the random text in the first image based on preset thickening parameters to obtain a second image; wherein, the preset thickening parameters include a preset thickening direction and a preset thickening value;
[0103] An image scaling module is used to scale the first image and the second image to the target image size.
[0104] In one embodiment, the image generating apparatus may further include:
[0105] An affine transformation module is used to perform the same affine transformation on the first image and the second image.
[0106] In one embodiment, the second image generation module can be specifically used for:
[0107] The random text in the first image is copied to obtain the copied text;
[0108] The copied text is then moved by the preset bolding value in the preset bolding direction to obtain the second image.
[0109] In one embodiment, the preset bolding direction includes any one or more of the following directions: up, down, left, right, upper left, lower left, upper right, and lower right.
[0110] In one embodiment, the second image generation module may further be used for:
[0111] When the font size of the random text is smaller than the preset font size, the first bold value is determined as the preset bold value; otherwise, the second bold value is determined as the preset bold value.
[0112] The degree of bolding corresponding to the first bolding value is higher than the degree of bolding corresponding to the second bolding value.
[0113] In one embodiment, the image generating apparatus may further include a large image generating module, used for:
[0114] Acquire multiple different first images and corresponding multiple second images;
[0115] According to the preset splicing rules, multiple first images are spliced together to form a first large image, and multiple second images are spliced together to form a second large image.
[0116] It should be noted that the image generation apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when executing the image generation method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the image generation apparatus and the image generation method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.
[0117] Based on the same technical concept, embodiments of this application also provide a display device, including:
[0118] The text bolding module is used to input the screen content image to be processed into a deep learning network model to obtain a screen content image with bolded text; wherein, the deep learning network model is trained according to the model training method described in the above embodiments;
[0119] The display module is used to display the screen content image after the text has been bolded.
[0120] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the prior art, can be embodied in the form of software products. The software products of the image generation method, model training method, or text bolding method can be stored in computer-readable storage media, such as ROM / RAM, magnetic disk, optical disk, etc., including storing several instructions to cause a computer device to execute the methods described in various embodiments or some parts of the embodiments.
[0121] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. An image generation method, characterized in that, The image generation method includes: Generate a first image containing random text; wherein the font size of the random text is selected from a preset font size range, and the size of the first image is selected from a plurality of preset image sizes; The random text in the first image is thickened based on preset thickening parameters to obtain the second image; wherein, the preset thickening parameters include a preset thickening direction and a preset thickening value; Scale the first and second images to the target image size.
2. The method as described in claim 1, characterized in that, The image generation method further includes: The same affine transformation is performed on the first image and the second image.
3. The method as described in claim 2, characterized in that, The rotation angle of the affine transformation ranges from -15° to 15°.
4. The method as described in claim 1, characterized in that, The step of bolding the random text in the first image based on preset bolding parameters to obtain the second image includes: The random text in the first image is copied to obtain the copied text; The copied text is then moved by the preset bolding value in the preset bolding direction to obtain the second image.
5. The method as described in claim 4, characterized in that, The preset bolding direction includes any one or more of the following directions: up, down, left, right, upper left, lower left, upper right, and lower right.
6. The method as described in claim 4, characterized in that, Before obtaining the second image by thickening the random text in the first image based on preset thickening parameters, the method further includes: When the font size of the random text is smaller than the preset font size, the first bold value is determined as the preset bold value; otherwise, the second bold value is determined as the preset bold value. The degree of bolding corresponding to the first bolding value is higher than the degree of bolding corresponding to the second bolding value.
7. The method according to any one of claims 1-6, characterized in that, After scaling the first image and the second image to the target image size, the image generation method further includes: Acquire multiple different first images and corresponding multiple second images; According to the preset splicing rules, multiple first images are spliced together to form a first large image, and multiple second images are spliced together to form a second large image.
8. A model training method, characterized in that, include: Obtain training image pairs for training a preset deep learning network model; wherein, the training image pairs include the first image and the second image as described in any one of claims 1-6, or include the first large image and the second large image as described in claim 7; The deep learning network model is trained using the training images.
9. The model training method as described in claim 8, characterized in that, The deep learning network model is a convolutional neural network model.
10. The model training method as described in claim 8, characterized in that, The model training method also includes: The deep learning model is iteratively trained using the L1 loss function.
11. A method for bolding text in a screen content image, characterized in that, include: The screen content image to be processed is input into a deep learning network model to obtain a screen content image with bolded text; wherein, the deep learning network model is trained by the model training method according to any one of claims 8-10.
12. A display device, characterized in that, include: The text bolding module is used to input the screen content image to be processed into a deep learning network model to obtain a screen content image with bolded text; wherein, the deep learning network model is trained according to the model training method according to any one of claims 8-10; The display module is used to display the screen content image after the text has been bolded.
13. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the image generation method as described in any one of claims 1 to 7, or the model training method as described in any one of claims 8 to 10, or the text bolding method as described in claim 11.