Courseware beautifying method and device, electronic equipment and storage medium
By obtaining and analyzing the element attribute information of the courseware page, determining the hierarchical relationship and setting the beautification method, the problem of inefficient courseware beautification in the existing technology is solved, and efficient and diversified courseware beautification effects are achieved.
Patent Information
- Application Number
- CN202311311438.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-10
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art is inefficient in the process of beautifying courseware and it is difficult to generate diversified courseware. Excessive dependence on template matching leads to complexity and inefficiency.
By obtaining the element attribute information of the courseware page, performing layout analysis to determine the hierarchical relationship of elements, and setting corresponding beautification methods according to the page category, beautifying the courseware page in a targeted manner to avoid large-scale template matching.
It improves the efficiency and effect of courseware beautification, ensures the diversity and aesthetics of courseware, and simplifies the unified process of background pictures.
Smart Images

Figure CN119808720A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a courseware beautification method, device, electronic equipment and storage medium. Background Art
[0002] Courseware is an important material for teaching. At present, the courseware production methods include self-production and selecting different courseware pages from different courseware to form a complete courseware. Among them, in the process of making courseware, the layout and style of the courseware are the problems that need to be solved urgently. Summary of the invention
[0003] In view of this, the present invention provides a courseware beautification method, device, electronic device and storage medium to solve the problem of courseware beautification.
[0004] In a first aspect, the present invention provides a courseware beautification method, the method comprising:
[0005] Obtaining element attribute information of each courseware page in the courseware to be beautified, wherein the element attribute information includes the position of the element and the category of the element;
[0006] For each courseware page, performing layout analysis based on the element attribute information to obtain the hierarchical relationship of the elements;
[0007] Based on the elements in each courseware page, determine the page category of each courseware page to obtain a beautification method corresponding to the page category;
[0008] Based on the hierarchical relationship of the elements in each courseware page and the beautification method, each courseware page is beautified to determine the target courseware.
[0009] The courseware beautification method provided by the embodiment of the present invention performs layout analysis through element attribute information to obtain the hierarchical relationship of elements, so as to facilitate the subsequent beautification of courseware pages; a corresponding beautification method is set for the page category of each courseware page, so that each courseware page can be beautified in a targeted manner. Finally, each courseware page is beautified in combination with the hierarchical relationship of elements and the beautification method, thereby ensuring the effectiveness of courseware beautification. At the same time, since the matching of large-scale beautification templates is avoided during the courseware beautification process, the efficiency of courseware beautification is improved.
[0010] In an optional implementation, determining the page category of each courseware page based on the elements in each courseware page to obtain a beautification method corresponding to the page category includes:
[0011] If the courseware page is a blank page, determining that the page category of the courseware page is a blank page, and the beautification method of the blank page includes unifying the background;
[0012] If the elements of the courseware page include preset elements, determining the page category of the courseware page as a preset element page, and the beautification method of the preset element page includes a unified background and a unified title style;
[0013] If the page category of the courseware page is other pages except the blank page and the preset element page, the beautification methods of the other pages include background unification, title style unification and element layout optimization.
[0014] The courseware beautification method provided by the embodiment of the present invention sets corresponding beautification methods for blank pages, preset element pages and other pages respectively, and can beautify the courseware pages in a targeted manner. Among them, for the preset element page, since the change of the position or style of the preset element may affect other elements, the beautification method for the preset element page includes background unification and title style unification, which can ensure the effectiveness of the courseware page.
[0015] In an optional implementation manner, the background uniform beautification method includes:
[0016] Obtaining the background image of each courseware page in the courseware to be beautified;
[0017] Counting the number of times each of the background images is used, and determining the target background image with the largest number of uses;
[0018] The target background image is determined as the background image for background unification.
[0019] The courseware beautification method provided by the embodiment of the present invention simplifies the unification method of background pictures by counting the number of times each background picture is used and using the background picture with the most number of times as the target background picture.
[0020] In an optional implementation, the beautification method of uniform title style includes:
[0021] Determining a title in the courseware page based on the category of the element;
[0022] Determine the level of the title by using the hierarchical relationship of the elements;
[0023] Get the preset styles for each level of headings;
[0024] Based on the levels of the various titles in the courseware page and the corresponding preset styles, the titles in the courseware page are processed in a unified style.
[0025] The courseware beautification method provided by the embodiment of the present invention obtains titles of various levels through the hierarchical relationship of elements, and unifies the title styles in combination with the preset styles of the titles of various levels, thereby avoiding the use of complex logical rules and improving the beautification efficiency of the title styles.
[0026] In an optional implementation manner, the beautification method of optimizing the element layout includes:
[0027] Obtaining a layout optimization model, wherein the layout optimization model is trained based on the attribute information of sample elements in the sample courseware page and the position labels of the sample elements;
[0028] Inputting the element attribute information of the courseware page into the layout optimization model to obtain the target position of the element in the courseware page;
[0029] The element layout of the courseware page is optimized based on the target position of the element.
[0030] The courseware beautification method provided by the embodiment of the present invention obtains the target position of elements in the courseware page by introducing a layout optimization model built based on a deep learning model, which can greatly avoid the processing of complex logic and improve the beautification speed and beautification effect.
[0031] In an optional implementation, the beautifying each courseware page based on the hierarchical relationship of the elements in each courseware page and the beautification method to determine the target courseware includes:
[0032] Obtaining the target background image of each courseware page after the background is unified;
[0033] Based on the color attribute of the target background image, matching is performed in the first-level title style to obtain the target style of the first-level title;
[0034] The first-level titles in the courseware pages are processed based on the target style to determine the style of the first-level titles in the target courseware.
[0035] In the courseware beautification method provided by the embodiment of the present invention, the unification of the first-level title has a great influence on the aesthetics of the courseware. After the style of the first-level title is beautified, the style of the first-level title is processed again in combination with the target background image to ensure that the first-level title can be clearly displayed in the target background image.
[0036] In an optional implementation, the beautifying each courseware page based on the hierarchical relationship of the elements in each courseware page and the beautification method to determine the target courseware further includes:
[0037] Obtaining an adjustment instruction for a first-level title in the courseware page, and adjusting the position of the first-level title;
[0038] Based on the adjusted position of the first-level title, the position of the first-level title in the target courseware is determined.
[0039] The courseware beautification method provided by the embodiment of the present invention provides a setting mode with position interaction for the first-level title, and fine-tunes the position of the first-level title through adjustment instructions to meet the preferences of different users.
[0040] In an optional implementation, for each courseware page, performing layout analysis based on the element attribute information to obtain the hierarchical relationship of the elements includes:
[0041] Acquire a relationship extraction model, wherein the relationship extraction model is trained based on a sample courseware page, element attribute information of a sample element in the sample courseware page, and a hierarchical label of the sample element;
[0042] The courseware page and the element attribute information are input into the relationship extraction model to obtain the hierarchical relationship of the elements in the courseware page.
[0043] The courseware beautification method provided by the embodiment of the present invention analyzes the hierarchical relationship of elements in the courseware page through a relationship extraction model. Since the relationship extraction model is constructed based on a deep learning model, the reliability of the obtained hierarchical relationship is improved.
[0044] In an optional implementation, the step of obtaining element attribute information of each courseware page in the courseware to be beautified includes:
[0045] Obtain the courseware to be beautified represented in the first format;
[0046] Converting the format of the courseware to be beautified to obtain the courseware to be beautified represented by a second format;
[0047] Field analysis is performed on the courseware to be beautified represented by the second format to obtain element attribute information of each courseware page.
[0048] The courseware beautification method provided by the embodiment of the present invention converts the format of the courseware to be beautified to obtain the courseware to be beautified represented in the second format capable of performing field analysis, thereby facilitating the extraction of element attributes and improving the accuracy of element attribute information.
[0049] In an optional implementation, the beautifying each courseware page based on the hierarchical relationship of the elements in each courseware page and the beautification method to determine the target courseware further includes:
[0050] Converting the target courseware in the second format to obtain the target courseware in the first format;
[0051] The target courseware in the first format is stored to obtain a target courseware file in the first format.
[0052] The courseware beautification method provided by the embodiment of the present invention converts the target courseware in the first format into the target courseware in the second format after beautifying the courseware to be beautified, and stores it as the target courseware file in the first format to ensure the normal use of the target courseware.
[0053] In a second aspect, the present invention provides a courseware beautification device, the device comprising:
[0054] An element attribute acquisition module is used to acquire element attribute information of each courseware page in the courseware to be beautified, wherein the element attribute information includes the position of the element and the category of the element;
[0055] A layout analysis module, used for performing layout analysis on each courseware page based on the element attribute information to obtain the hierarchical relationship of the elements;
[0056] A beautification method determination module, used to determine the page category of each courseware page based on the elements in each courseware page, so as to obtain a beautification method corresponding to the page category;
[0057] The courseware beautification module is used to beautify each courseware page based on the hierarchical relationship of the elements in each courseware page and the beautification method, and determine the target courseware.
[0058] In a third aspect, the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the courseware beautification method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0059] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the courseware beautification method of the first aspect or any corresponding embodiment thereof.
[0060] The courseware beautification device, electronic device, and computer-readable storage medium provided in the embodiment of the present invention correspond to the courseware beautification method provided in the embodiment of the present invention. Therefore, the beneficial effects of the courseware beautification device, electronic device, and computer-readable storage medium can be found in the description of the beneficial effects of the courseware beautification method above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0062] Figure 1 is a flow chart of a courseware beautification method according to an embodiment of the present invention;
[0063] Figure 2 is a flow chart of another courseware beautification method according to an embodiment of the present invention;
[0064] Figure 3 is a flow chart of another courseware beautification method according to an embodiment of the present invention;
[0065] Figure 4 is a structural block diagram of a courseware beautification device according to an embodiment of the present invention;
[0066] Figure 5 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0068] In the related art, the beautification of courseware is based on templates. However, since the production of templates requires a lot of manpower and material resources, the beautification efficiency of courseware is low. At the same time, over-reliance on the use of templates is not conducive to generating diversified courseware. The use of templates involves the problem of template matching, and the template matching method is relatively complex, which also affects the beautification efficiency.
[0069] According to an embodiment of the present invention, an embodiment of a courseware beautification method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0070] In this embodiment, a courseware beautification method is provided, which can be used for electronic devices such as smart blackboards, tablet computers, etc. Figure 1 is a flow chart of a courseware beautification method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0071] Step S101, obtaining element attribute information of each courseware page in the courseware to be beautified.
[0072] The element attribute information includes the location of the element and the category of the element.
[0073] The courseware to be beautified can be a courseware with completed content or a partially completed courseware, etc. That is, the courseware beautification method can be used during the courseware production process or after the courseware content is completed, etc. There is no limitation on the timing of the courseware beautification method, which can be set according to actual needs.
[0074] The courseware to be beautified includes at least one courseware page, which may include at least one element or may be a blank page. The elements in the courseware page include but are not limited to text, pictures, symbols, etc., and the specific form is not limited.
[0075] For each courseware page, it is analyzed to obtain the element attribute information of the courseware page. Specifically, element recognition is performed on each courseware page to obtain the category and position of each element. For example, by intercepting a picture of each courseware page, the intercepted picture is input into the element recognition model to obtain each element in the intercepted picture and the element attribute information. The input of the element recognition model is the picture, and the output is the elements in the picture and the element attribute information.
[0076] Alternatively, the courseware page can be converted into a preset format, in which each category of elements is represented by a corresponding field, and accordingly, the position of the element is also represented by another corresponding field. For example, for element 1, field 1 is represented as a1-b1, where field 1 corresponds to element 1, a1 represents the position of element 1, and b1 represents the category of element 1.
[0077] Of course, other methods may also be used to obtain the element attribute information of each courseware page, which are not limited to those shown above.
[0078] Step S102: for each courseware page, perform layout analysis based on element attribute information to obtain the hierarchical relationship of the elements.
[0079] For each page of the courseware to be beautified, after obtaining the element attribute information, the page layout is analyzed to obtain the hierarchical relationship between the elements. Among them, the categories of elements include titles, texts, pictures, etc. The hierarchical relationship is used to indicate the relationship between elements, for example, first-level title, second-level title, third-level title, second-level title corresponding to first-level title, text corresponding to second-level title, etc.
[0080] Layout analysis can be determined based on the category and position of elements. For example, for elements with the category of title, the first-level title and second-level title can be determined based on the position relationship of these elements. Since the second-level title is usually located below the first-level title, and the title and the text are usually expressed in different styles, the hierarchical relationship between the titles can be determined by category and position.
[0081] As for the hierarchical relationship between the title and the text, since the text corresponding to the title is generally below the title, for elements whose category is text, the title corresponding to the text can be obtained by utilizing the positional relationship.
[0082] As for the hierarchical relationship between images and text, since the text is usually placed around the image, or above or below the image, the hierarchical relationship between the image and the text can be obtained by combining the element category and position. Alternatively, semantic analysis can be performed on the image to determine the text corresponding to the image.
[0083] It should be noted that the layout analysis method is not limited to that shown above, and can also be implemented in other ways, for example, layout analysis based on a deep learning model, etc.
[0084] Step S103, based on the elements in each courseware page, determine the page category of each courseware page to obtain a beautification method corresponding to the page category.
[0085] Page categories include but are not limited to blank pages, special element pages or other pages, etc. The specific categories are set according to actual needs. Page categories correspond to beautification methods one by one. For each courseware page, after determining the page category, the corresponding relationship between it and the beautification method can be used to obtain the beautification method corresponding to the page category.
[0086] If there is no element in the courseware page, the page category of the courseware page is determined to be a blank page. Therefore, when beautifying the blank page, only the background image needs to be processed.
[0087] If the courseware page includes special elements, the page category of the courseware page is determined to be a special element page. Since the categories of the elements are obtained in the above-mentioned step S101, it can be determined whether the elements in the courseware page are special elements by the categories. Special elements include but are not limited to arrows, brackets and other mathematical symbols, etc. This is because if these special elements are changed, they will affect other elements. Taking the arrow as an example, if the position of the arrow is adjusted, the meaning of the courseware content may be changed. Therefore, when the special element page is beautified, it is necessary to avoid the processing of the special elements.
[0088] If a courseware page is a page other than a blank page and a special element page, it is called another page. Therefore, when beautifying another page, all elements in the courseware page can be beautified.
[0089] The beautification method of the courseware page can be used to indicate which elements in the courseware page are beautified. In combination with the above example, for a blank page, the elements that need to be beautified include the background image; for a special element page, the elements that need to be beautified need to exclude the special elements; for other pages, the elements that need to be beautified include all elements.
[0090] In the courseware to be beautified, the page categories of each courseware page may be the same or different. Based on the page category, the courseware page is beautified by a beautification method corresponding to the page category, which can improve the effectiveness of the courseware beautification.
[0091] Step S104, beautify each courseware page based on the hierarchical relationship of elements in each courseware page and the beautification method, and determine the target courseware.
[0092] As mentioned above, the hierarchical relationship of elements is used to represent the belonging of elements. Elements at different levels may have different corresponding styles. For example, you can set the first-level title, second-level title and their corresponding text styles. After determining the hierarchical relationship, you can use the corresponding style to beautify them. At the same time, combine the beautification methods of each courseware page to beautify the courseware page.
[0093] After the courseware page is beautified according to the hierarchical relationship and the beautification method, a beautified courseware page is obtained, wherein the target courseware can be obtained based on the beautified courseware page.
[0094] The courseware beautification method provided in this embodiment performs layout analysis through element attribute information to obtain the hierarchical relationship of elements, so as to facilitate the subsequent beautification of courseware pages; a corresponding beautification method is set for the page category of each courseware page, so that each courseware page can be beautified in a targeted manner. Finally, each courseware page is beautified in combination with the hierarchical relationship of elements and the beautification method, thereby ensuring the effectiveness of courseware beautification. At the same time, since the matching of large-scale beautification templates is avoided during the courseware beautification process, the efficiency of courseware beautification is improved.
[0095] In this embodiment, a courseware beautification method is provided, which can be used for electronic devices such as smart blackboards, tablet computers, etc. Figure 2 is a flow chart of a courseware beautification method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0096] Step S201, obtaining element attribute information of each courseware page in the courseware to be beautified.
[0097] The element attribute information includes the element's location and element category. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0098] Step S202: For each courseware page, perform layout analysis based on element attribute information to obtain the hierarchical relationship of the elements. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0099] Step S203, based on the elements in each courseware page, determine the page category of each courseware page to obtain a beautification method corresponding to the page category.
[0100] For each courseware page, the elements in the courseware page are analyzed to obtain the page category of each courseware page. Then, the corresponding relationship between the page category and the beautification method is used to obtain the beautification method corresponding to the page category, and accordingly, the beautification method of each courseware page is obtained.
[0101] Specifically, the above step S203 includes:
[0102] Step S2031: If the courseware page is a blank page, the page category of the courseware page is determined to be a blank page, and the beautification method of the blank page includes unifying the background.
[0103] If there is no element in the courseware page, the page category of the courseware page is a space page. The beautification method determined for the blank page includes background unification. Among them, background unification is to unify the background image of the blank page. For the courseware to be beautified, it includes at least one courseware page, and the background image of each courseware page can be the same or different. Therefore, when the background is unified, you can choose one background image as the background image of all courseware pages; or, unify the background into a given image, and so on. There is no limitation on the background image used for background unification.
[0104] Step S2032: If the elements of the courseware page include preset elements, the page category of the courseware page is determined to be a preset element page, and the beautification method of the preset element page includes a unified background and a unified title style.
[0105] Preset elements include, but are not limited to, arrows and mathematical symbols, etc. For the current courseware page, by querying the categories of the elements in the current courseware page, if preset elements are included, it is determined that the page type of the current courseware page is a preset element page. For the preset element page, its beautification method includes background unification and title style unification. Among them, the background unification is as shown above and will not be repeated here. Title style unification is to unify the titles of each level into their corresponding styles. For example, the first-level title corresponds to title style 1, and the second-level title corresponds to title style 2. Then, title style 1 is used to beautify the first-level title, and title style 2 is used to beautify the second-level title.
[0106] Step S2033, if the page category of the courseware page is other pages except blank pages and preset element pages, the beautification methods of other pages include background unification, title style unification and element layout optimization.
[0107] For other pages, the background, title style and element layout are unified. The background and title style are unified as shown above and will not be repeated here. Element layout optimization is used to optimize the position of elements, for example, placing the first-level title on the left side of the courseware page, and the starting points of all levels of titles are in the same vertical position, etc.
[0108] Step S204, beautify each courseware page based on the hierarchical relationship of the elements in each courseware page and the beautification method, and determine the target courseware.
[0109] Different beautification methods are used for courseware pages of different page categories. Therefore, after the beautification method is determined, the courseware page is beautified in combination with the hierarchical relationship of the elements in the courseware page. In the above, the beautification methods of the courseware page include unified background, unified title style and optimized element layout.
[0110] Specifically, the beautification methods of background unification include:
[0111] Step a1, obtaining the background image of each courseware page in the courseware to be beautified.
[0112] Step a2, counting the number of times each background image is used, and determining the target background image with the highest number of uses.
[0113] Step a3: determine the target background image as the background image for background unification.
[0114] The background image of each courseware page is obtained by analyzing the elements in the courseware page. As mentioned above, the element attribute information can be obtained for each element, and the element attribute information includes the category of the element. Based on this, for each courseware page, the background image of the courseware page can be obtained by querying the element with the category of background image.
[0115] For each courseware page in the courseware to be beautified, the background images used by each courseware page are counted to obtain the number of times each background image is used. The background image with the most times of use is used as the target background image, which is the background image used for background unification.
[0116] By counting the number of times each background image is used and using the background image with the most usage as the target background image, the courseware pages that need to process background images are reduced and the method of unifying background images is simplified.
[0117] Specifically, the beautification methods of unifying the title style include:
[0118] Step b1, determining the title in the courseware page based on the category of the element.
[0119] Step b2, using the hierarchical relationship of the elements to determine the level of the title.
[0120] Step b3, obtaining the preset styles of titles at each level.
[0121] Step b4, based on the level of each title in the courseware page and the corresponding preset style, the titles in the courseware page are processed in a unified style.
[0122] To unify the title style, it is necessary to use the category of the element to get the title in the courseware page, and then combine the hierarchical relationship of the elements to get the level of each title. For each level of title, there is a corresponding preset style, for example, the font size of the first-level title is 60, the font size of the second-level title is 40, the font size of the text is 30, the Chinese font is Kaiti, and the English font is Arial. These preset styles are used to unify the styles of titles at each level.
[0123] The titles of each level are obtained through the hierarchical relationship of the elements, and the title styles are unified in combination with the preset styles of the titles of each level, thus avoiding the use of complex logical rules and improving the beautification efficiency of the title styles.
[0124] Specifically, the beautification methods for element layout optimization include:
[0125] Step c1, obtaining a layout optimization model, where the layout optimization model is trained based on the attribute information of sample elements in the sample courseware page and the position labels of the sample elements.
[0126] Step c2: input the element attribute information of the courseware page into the layout optimization model to obtain the target position of the element in the courseware page.
[0127] Step c3, optimizing the element layout of the courseware page based on the target position of the element.
[0128] Element layout optimization is used to optimize the position of elements, where element layout optimization is implemented based on the layout optimization model. The input of the layout optimization model is the element attribute information of the courseware page, and the output is the target position of the element. The layout optimization model can be implemented based on the LayoutDM model, LayoutDM model: Transformer-basedDiffusion Model for Layout Generation, that is, the Transformer-based layout generation diffusion model.
[0129] When training the layout optimization model, the sample element attribute information of the sample courseware page is input into the initial layout optimization model to obtain the predicted position of the sample element. The position loss is calculated based on the position label of the sample element and the predicted position of the sample element, and the calculated position loss is used to iteratively update the parameters of the initial layout optimization model to determine the layout optimization model.
[0130] When the layout optimization model is used for reasoning, the element attribute information of the courseware page is input into the layout optimization model to obtain the target position of the element. Then, the position of the corresponding element is adjusted based on the target position of the element, thereby realizing the element layout optimization of the courseware page.
[0131] By introducing a layout optimization model built based on a deep learning model, the target position of elements in the courseware page can be obtained, which can greatly avoid the processing of complex logic and improve the beautification speed and effect.
[0132] When beautifying the courseware page, if the page category of the courseware page is a blank page, the blank page is beautified through the above-mentioned background unification beautification method; if the page category of the courseware page is a preset element page, the preset element page is beautified through the above-mentioned background unification and title style unification; if the page category of the courseware page is other pages, the other pages are beautified through the above-mentioned background unification, title style unification and element layout optimization.
[0133] In some optional implementations, the above step S204 further includes:
[0134] Step d1, obtaining the target background image of each courseware page after the background is unified.
[0135] Step d2, based on the color attribute of the target background image, matching is performed in the first-level title style to obtain the target style of the first-level title.
[0136] Step d3, processing the first-level titles in each courseware page based on the target style, and determining the style of the first-level titles in the target courseware.
[0137] After the background is unified, the background image of each courseware page is the target background image. The unification of the first-level title has a great impact on the aesthetics of the courseware. After the style of the first-level title is beautified, the style of the first-level title is processed again in combination with the target background image to ensure that the first-level title can be clearly shown in the target background image.
[0138] In order to clearly display the first-level title in the target background image, it is necessary to match the first-level title style in combination with the color attribute of the target background image. Specifically, since the target background image is unified, the first-level title style can be adjusted. By pre-setting a variety of title styles with different styles, the color attribute of the target background image is used to match these first-level title styles to obtain the target style of the first-level title.
[0139] The color attributes of the target background image include but are not limited to brightness and saturation, and different styles of title styles correspond to different brightness and saturation. For example, a correspondence between brightness, saturation and title style can be set, and then the color attributes of the target background image are used to query the correspondence to obtain the target style of the first-level title.
[0140] After obtaining the target style, the first-level title in each courseware page is processed using the target style, thereby obtaining the style of the first-level title in the target courseware.
[0141] In some optional implementations, the above step S204 further includes:
[0142] Step e1, obtaining an adjustment instruction for the first-level title in the courseware page, and adjusting the position of the first-level title.
[0143] Step e2, based on the adjusted position of the first-level title, determine the position of the first-level title in the target courseware.
[0144] After using the above-mentioned element layout optimization, the target position of each element is obtained. For the first-level title, an interactive adjustment function is also provided. By interacting with the first-level title, an adjustment instruction is generated to adjust the position of the first-level title. Among them, the position of the adjusted first-level title is the position of the first-level title in the target courseware.
[0145] An interactive position setting method is provided for the first-level title. The position of the first-level title can be fine-tuned by adjusting the instructions to meet the preferences of different users.
[0146] The courseware beautification method provided in this embodiment sets corresponding beautification methods for blank pages, preset element pages and other pages, respectively, and can beautify the courseware pages in a targeted manner. Among them, for the preset element page, since the change of the position or style of the preset element may affect other elements, the beautification method for the preset element page includes background unification and title style unification, which can ensure the effectiveness of the courseware page.
[0147] In this embodiment, a courseware beautification method is provided, which can be used for electronic devices such as smart blackboards, tablet computers, etc. Figure 3 is a flow chart of a courseware beautification method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0148] Step S301, obtaining element attribute information of each courseware page in the courseware to be beautified.
[0149] The element attribute information includes the location of the element and the category of the element.
[0150] Specifically, the above step S301 includes:
[0151] Step S3011, obtaining the courseware to be beautified represented by the first format.
[0152] The courseware to be beautified is played in the target application, and the courseware that can be played by the target application is represented by the first format. Therefore, the courseware to be beautified in the target application is represented by the first format. For example, the first format is XML format.
[0153] Step S3012, converting the format of the courseware to be beautified to obtain the courseware to be beautified represented by a second format.
[0154] In the subsequent beautification process, it is necessary to perform the beautification process on the courseware to be beautified in the second format. Therefore, it is necessary to convert the format of the courseware to be beautified to obtain the courseware to be beautified in the second format. For example, the second format is JSON format.
[0155] Step S3013, performing field analysis on the courseware to be beautified represented by the second format to obtain element attribute information of each courseware page.
[0156] In the second format, the courseware page is represented by fields and their field contents. Based on this, the element attribute information of each courseware page is obtained by analyzing the fields corresponding to each courseware page.
[0157] Step S302: for each courseware page, perform layout analysis based on element attribute information to obtain the hierarchical relationship of the elements.
[0158] Specifically, the above step S302 includes:
[0159] Step S3021, obtaining a relationship extraction model.
[0160] The relationship extraction model is trained based on the sample courseware page, the element attribute information of the sample elements in the sample courseware page, and the hierarchical labels of the sample elements.
[0161] The relationship extraction model can be obtained based on the GeoLayout model, GeoLayout model: GeometryDriven Room Layout Estimation Based on Depth Maps of Planes, that is, geometry-driven room layout estimation based on plane depth maps. Of course, the structure of the relationship extraction model is not limited to the GeoLayout model, and other model structures can also be used, which is not limited here.
[0162] When training the relationship extraction model, the sample courseware page and the element attributes of the sample elements in the sample courseware page are input into the initial relationship extraction model to obtain the predicted hierarchical relationship of the sample elements in the sample courseware page. The hierarchical prediction loss is then calculated in combination with the hierarchical labels of the sample elements and the predicted hierarchical relationship, and the hierarchical prediction loss is used to iteratively update the parameters of the initial relationship extraction model to obtain the relationship extraction model.
[0163] Step S3022: input the courseware page and element attribute information into the relationship extraction model to obtain the hierarchical relationship of the elements in the courseware page.
[0164] When the relation extraction model is used for reasoning, the screenshot of the courseware page and the attribute information of the elements in the courseware page are input into the relation extraction model, and the hierarchical relationship of the elements in the courseware page is output.
[0165] Step S303: Based on the elements in each courseware page, determine the page category of each courseware page to obtain a beautification method corresponding to the page category. Figure 2 Step S203 of the illustrated embodiment will not be described in detail here.
[0166] Step S304, beautify each courseware page based on the hierarchical relationship of the elements in each courseware page and the beautification method, and determine the target courseware. Figure 2 Step S204 of the illustrated embodiment will not be described in detail here.
[0167] In some optional implementations, the above step S304 further includes:
[0168] Step f1, converting the target courseware in the second format to obtain the target courseware in the first format.
[0169] Step f2, storing the target courseware in the first format to obtain the target courseware file in the first format.
[0170] As shown above, courseware beautification is performed based on the courseware to be beautified represented in the second format, while the courseware in the target application needs to be represented in the first format. Therefore, after the target courseware in the second format is obtained through beautification, the target courseware in the second format is converted into the first format. That is, the target courseware in JSON format is converted into the target courseware in XML format. Finally, the target courseware in XML format is stored to obtain the target courseware file in XML format.
[0171] After the courseware to be beautified is beautified, since the target courseware in the second format is obtained, it is converted into the target courseware in the first format and stored as the target courseware file in the first format to ensure the normal use of the target courseware.
[0172] The courseware beautification method provided in this embodiment converts the format of the courseware to be beautified to obtain the courseware to be beautified in the second format representation capable of field analysis, which is convenient for extracting element attributes and can improve the accuracy of element attribute information. The hierarchical relationship of elements in the courseware page is analyzed through the relationship extraction model. Since the relationship extraction model is constructed based on the deep learning model, the reliability of the obtained hierarchical relationship is improved.
[0173] As a specific application embodiment of an embodiment of the present invention, whiteboard software is installed in a tablet computer, and courseware is made by the whiteboard software to obtain courseware to be beautified. A beautification control is provided in the whiteboard software, and the beautification process of the courseware to be beautified is triggered by interaction with the beautification control. First, the courseware to be beautified is converted from XML format to JSON format, thereby obtaining the category and position of the elements of each courseware page in the courseware to be beautified. The category of the element is then used to obtain the background picture that is used the most times in the courseware page and use it as the unified background picture of the whole courseware. In order to achieve a unified and beautiful effect, it is necessary to know the element level relationship on the courseware page when the courseware is beautified, and therefore, the courseware page layout analysis is very important for subsequent beautification operations. Based on this, a relationship extraction model is adopted to analyze the courseware page, and the screenshot of the courseware page and the element attribute information are input into the relationship extraction model to obtain the element level relationship. Combine the elements in the courseware page to obtain the page category of each courseware page, so as to obtain the beautification method corresponding to the page category, and beautify the corresponding courseware page through the element hierarchy relationship and beautification method of the courseware page. After beautification by the corresponding beautification method, it is also necessary to beautify the style of the first-level title. By pre-setting ten first-level title styles with different styles, the first-level title style that matches it is selected by analyzing the brightness and saturation of the target background image. Combine the text of the first-level title with the selected first-level title style to finally form a title with a unified style. Of course, sometimes users have a relatively large preference for the position of the first-level title. Therefore, in the beautification process, it is also supported to fine-tune the position of the first-level title of the original courseware page to meet user preferences. Finally, the target courseware in JSON format is converted to the target courseware in XML format and saved as a target courseware file in XML format. Correspondingly, the target courseware file in XML format can be played in the whiteboard application.
[0174] In the present embodiment, a courseware beautification device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0175] This embodiment provides a courseware beautification device, such as Figure 4 As shown, including:
[0176] The element attribute acquisition module 401 is used to acquire the element attribute information of each courseware page in the courseware to be beautified. The element attribute information includes the position of the element and the category of the element.
[0177] The layout analysis module 402 is used to perform layout analysis on each courseware page based on element attribute information to obtain the hierarchical relationship of the elements.
[0178] The beautification method determination module 403 is used to determine the page category of each courseware page based on the elements in each courseware page, so as to obtain the beautification method corresponding to the page category.
[0179] The courseware beautification module 404 is used to beautify each courseware page based on the hierarchical relationship of elements in each courseware page and the beautification method, and determine the target courseware.
[0180] In some optional implementations, the beautification method determination module 403 includes:
[0181] The blank page determination unit is used to determine the page category of the courseware page as a blank page if the courseware page is a blank page. The beautification method of the blank page includes background unification.
[0182] The preset element page determination unit is used to determine the page category of the courseware page as a preset element page if the elements of the courseware page include preset elements. The beautification methods of the preset element page include unified background and unified title style.
[0183] The other page determination unit is used to beautify other pages including background unification, title style unification and element layout optimization if the page category of the courseware page is other pages except blank pages and preset element pages.
[0184] In some optional implementations, the background unified beautification module includes:
[0185] The background image acquisition unit is used to acquire the background image of each courseware page in the courseware to be beautified.
[0186] The usage count unit is used to count the usage counts of each background image and determine the target background image with the highest usage count.
[0187] The background picture determination unit is used to determine the target background picture as the background picture for background unification.
[0188] In some optional implementations, the title style unified beautification module includes:
[0189] The title determination unit is used to determine the title in the courseware page based on the category of the element.
[0190] The level determination unit is used to determine the level of the title by utilizing the hierarchical relationship of the elements.
[0191] The style acquisition unit is used to obtain the preset styles of titles at each level.
[0192] The style processing unit is used to unify the styles of the titles in the courseware page based on the levels of the titles in the courseware page and the corresponding preset styles.
[0193] In some optional implementations, the beautification module for element layout optimization includes:
[0194] The model acquisition unit is used to acquire a layout optimization model, where the layout optimization model is obtained by training based on the attribute information of sample elements in the sample courseware page and the position labels of the sample elements.
[0195] The position determination unit is used to input the element attribute information of the courseware page into the layout optimization model to obtain the target position of the element in the courseware page.
[0196] The layout optimization unit is used to optimize the element layout of the courseware page based on the target position of the elements.
[0197] In some optional implementations, the courseware beautification module 404 includes:
[0198] The target background image acquisition unit is used to acquire the target background image of each courseware page after the background is unified.
[0199] The target style matching unit is used to match the first-level title style based on the color attribute of the target background image to obtain the target style of the first-level title.
[0200] The title style processing unit is used to process the first-level title in each courseware page based on the target style and determine the style of the first-level title in the target courseware.
[0201] In some optional implementations, the courseware beautification module 404 further includes:
[0202] The adjustment instruction acquisition unit is used to acquire the adjustment instruction for the first-level title in the courseware page and adjust the position of the first-level title.
[0203] The first-level title position determination unit is used to determine the position of the first-level title in the target courseware based on the adjusted position of the first-level title.
[0204] In some optional implementations, the layout analysis module 402 includes:
[0205] A relationship extraction model is obtained, where the relationship extraction model is trained based on the sample courseware page, element attribute information of the sample elements in the sample courseware page, and the hierarchical labels of the sample elements.
[0206] The courseware page and element attribute information are input into the relationship extraction model to obtain the hierarchical relationship of the elements in the courseware page.
[0207] In some optional implementations, the element attribute acquisition module 401 includes:
[0208] The courseware acquisition unit is used to acquire the courseware to be beautified represented in the first format.
[0209] The first format conversion unit is used to convert the format of the courseware to be beautified to obtain the courseware to be beautified represented by the second format.
[0210] The field analysis unit is used to perform field analysis on the courseware to be beautified represented in the second format to obtain element attribute information of each courseware page.
[0211] In some optional implementations, the courseware beautification module 404 further includes:
[0212] The second format conversion unit is used to convert the target courseware in the second format to obtain the target courseware in the first format.
[0213] The courseware storage unit is used to store the target courseware in the first format to obtain the target courseware file in the first format.
[0214] The courseware beautification device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0215] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0216] The embodiment of the present invention also provides an electronic device having the above Figure 4 The courseware beautification device shown.
[0217] See also Figure 5 , Figure 5 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.
[0218] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0219] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0220] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0221] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0222] The electronic device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0223] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the electronic device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0224] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0225] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A courseware beautification method, characterized in that: The method comprises: Obtaining element attribute information of each courseware page in the courseware to be beautified, wherein the element attribute information includes the position of the element and the category of the element; For each courseware page, performing layout analysis based on the element attribute information to obtain the hierarchical relationship of the elements; Based on the elements in each courseware page, the page category of each courseware page is determined to obtain a beautification method corresponding to the page category; Based on the hierarchical relationship of the elements in each courseware page and the beautification method, each courseware page is beautified to determine the target courseware.
2. The method according to claim 1, characterized in that: The determining of the page category of each courseware page based on the elements in each courseware page to obtain a beautification method corresponding to the page category includes: If the courseware page is a blank page, determining the page category of the courseware page is a blank page, and the beautification method of the blank page includes unifying the background; If the elements of the courseware page include preset elements, determining the page category of the courseware page as a preset element page, and the beautification method of the preset element page includes a unified background and a unified title style; If the page category of the courseware page is other pages except the blank page and the preset element page, the beautification methods of the other pages include background unification, title style unification and element layout optimization.
3. The method according to claim 2, characterized in that The unified beautification method of the background includes: Obtaining the background image of each courseware page in the courseware to be beautified; Counting the number of times each of the background images is used, and determining the target background image with the largest number of uses; The target background image is determined as the background image for background unification.
4. The method according to claim 2, characterized in that: The beautification methods of the unified title style include: Determining a title in the courseware page based on the category of the element; Determine the level of the title by using the hierarchical relationship of the elements; Get the preset styles for each level of headings; Based on the levels of the various titles in the courseware page and the corresponding preset styles, the titles in the courseware page are processed in a unified style.
5. The method according to claim 2, characterized in that: The beautification methods of element layout optimization include: Obtaining a layout optimization model, wherein the layout optimization model is trained based on the attribute information of sample elements in the sample courseware page and the position labels of the sample elements; Inputting the element attribute information of the courseware page into the layout optimization model to obtain the target position of the element in the courseware page; The element layout of the courseware page is optimized based on the target position of the element.
6. The method according to claim 1, characterized in that The beautifying each courseware page based on the hierarchical relationship of the elements in each courseware page and the beautification method to determine the target courseware includes: Obtaining the target background image of each courseware page after the background is unified; Based on the color attribute of the target background image, matching is performed in the first-level title style to obtain the target style of the first-level title; The first-level titles in the courseware pages are processed based on the target style to determine the style of the first-level titles in the target courseware.
7. The method according to claim 1, characterized in that The beautifying each courseware page based on the hierarchical relationship of the elements in each courseware page and the beautification method to determine the target courseware also includes: Obtaining an adjustment instruction for a first-level title in the courseware page, and adjusting the position of the first-level title; Based on the adjusted position of the first-level title, the position of the first-level title in the target courseware is determined.
8. The method according to claim 1, characterized in that For each courseware page, performing layout analysis based on the element attribute information to obtain the hierarchical relationship of the elements includes: Acquire a relationship extraction model, wherein the relationship extraction model is trained based on a sample courseware page, element attribute information of a sample element in the sample courseware page, and a hierarchical label of the sample element; The courseware page and the element attribute information are input into the relationship extraction model to obtain the hierarchical relationship of the elements in the courseware page.
9. The method according to claim 1, characterized in that: The step of obtaining the element attribute information of each courseware page in the courseware to be beautified includes: Obtain the courseware to be beautified represented in the first format; Converting the format of the courseware to be beautified to obtain the courseware to be beautified represented by a second format; Field analysis is performed on the courseware to be beautified represented by the second format to obtain element attribute information of each courseware page.
10. The method according to claim 9, characterized in that The beautifying each courseware page based on the hierarchical relationship of the elements in each courseware page and the beautification method to determine the target courseware also includes: Converting the target courseware in the second format to obtain the target courseware in the first format; The target courseware in the first format is stored to obtain a target courseware file in the first format.
11. A courseware beautification device, characterized in that: The device comprises: An element attribute acquisition module is used to acquire element attribute information of each courseware page in the courseware to be beautified, wherein the element attribute information includes the position of the element and the category of the element; A layout analysis module, used for performing layout analysis on each courseware page based on the element attribute information to obtain the hierarchical relationship of the elements; A beautification method determination module, used to determine the page category of each courseware page based on the elements in each courseware page, so as to obtain a beautification method corresponding to the page category; The courseware beautification module is used to beautify each courseware page based on the hierarchical relationship of the elements in each courseware page and the beautification method, and determine the target courseware.
12. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the courseware beautification method according to any one of claims 1 to 10 by executing the computer instructions.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the courseware beautification method according to any one of claims 1 to 10.