WO2024066490A1 - Character beautification method and electronic device - Google Patents

Character beautification method and electronic device Download PDF

Info

Publication number
WO2024066490A1
WO2024066490A1 PCT/CN2023/100493 CN2023100493W WO2024066490A1 WO 2024066490 A1 WO2024066490 A1 WO 2024066490A1 CN 2023100493 W CN2023100493 W CN 2023100493W WO 2024066490 A1 WO2024066490 A1 WO 2024066490A1
Authority
WO
WIPO (PCT)
Prior art keywords
font
style
text
electronic device
user
Prior art date
Application number
PCT/CN2023/100493
Other languages
French (fr)
Chinese (zh)
Inventor
刘琳琳
杨阳
李璟澜
柏忠嘉
郑文植
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024066490A1 publication Critical patent/WO2024066490A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/253Grammatical analysis; Style critique
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/268Morphological analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/32Digital ink

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

Provided in the present application are a character beautification method and an electronic device. The method comprises: an electronic device generating, in response to a first operation by a user on a touch screen, a first character track, and recognizing the first character track so as to obtain a first style of the first character track; and also acquiring a second style of a target font; then generating a third style according to the first style and the second style; and then beautifying the first character track according to the third style so as to obtain a second character track, and displaying the second character track on the touch screen. In this way, the electronic device can fuse the first style of the first character track with the second style of the target font, so as to adjust the font structure of character tracks written by a user on the touch screen while retaining the original writing style of the user, thereby achieving a style-adaptive beautification effect, and satisfying different requirements of different users for character beautification.

Description

一种文字美化方法及电子设备Text beautification method and electronic device
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求在2022年09月26日提交中国专利局、申请号为202211180551.1、申请名称为“一种文字美化方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the China Patent Office on September 26, 2022, with application number 202211180551.1 and application name “A Text Beautification Method and Electronic Device”, all contents of which are incorporated by reference in this application.
技术领域Technical Field
本申请涉及计算机视觉技术领域,尤其涉及一种文字美化方法及电子设备。The present application relates to the field of computer vision technology, and in particular to a text beautification method and electronic equipment.
背景技术Background technique
随着科技的快速发展,在企业会议、医疗或教育场景等,越来越多的用于书写文字的电子设备(比如电子白板)逐渐替代了传统书写板(比如传统普通白板)。但是,由于电子设备和手写笔的材质,以及电子设备屏幕的触控采集和显示原理,使得电子设备上的书写内容是由简单的线条组成,因此会与纸质书写在文字轮廓、文字粗细等方面存在较大的差异,导致用户在电子设备上的书写内容的字体不够美观。同时,由于在电子设备上的书写姿势与在纸上的书写姿势不同,因此导致在电子设备上的书写字迹会产生变形,不易阅读。针对于此,为了能够有效地增加用户手写文字的易读性与美观度,需要针对用户在电子设备上的书写内容进行美化处理。With the rapid development of science and technology, more and more electronic devices for writing text (such as electronic whiteboards) have gradually replaced traditional writing boards (such as traditional ordinary whiteboards) in corporate meetings, medical or educational scenarios. However, due to the materials of electronic devices and styluses, as well as the touch acquisition and display principles of electronic device screens, the writing content on electronic devices is composed of simple lines, so there will be large differences in text outline, text thickness, etc. compared with paper writing, resulting in the font of the user's writing content on the electronic device not being beautiful enough. At the same time, because the writing posture on the electronic device is different from the writing posture on paper, the handwriting on the electronic device will be deformed and difficult to read. In view of this, in order to effectively increase the readability and beauty of the user's handwritten text, it is necessary to beautify the writing content of the user on the electronic device.
现阶段,在一种文字美化方案中,通过对用户输入的文字进行笔锋美化,以及对用户输入的文字进行笔画渲染,来达到美化用户输入的文字的目的。但是,这种只改变笔画轮廓的方案是无法达到好的美化效果的。At present, in a text beautification scheme, the purpose of beautifying the text input by the user is achieved by beautifying the pen tip of the text input by the user and rendering the stroke of the text input by the user. However, this scheme of only changing the stroke outline cannot achieve a good beautification effect.
发明内容Summary of the invention
本申请实施例提供一种文字美化方法及电子设备,用以实现满足不同用户对文字美化的不同需求。The embodiments of the present application provide a text beautification method and an electronic device, so as to meet different needs of different users for text beautification.
第一方面,本申请实施例提供一种文字美化方法,该方法可以应用于具有触控屏的电子设备。在该方法中,电子设备响应于用户在触控屏上的第一操作,生成第一文字轨迹,并可以对第一文字轨迹进行识别,获取第一文字轨迹的第一风格,其中,第一风格用于表征第一文字轨迹具有的字型特征。以及,电子设备也可以获取目标字体的第二风格,其中,第二风格用于表征目标字体的文字轨迹具有的字型特征。之后,电子设备通过根据第一风格与第二风格,可以生成第三风格。然后,电子设备可以根据第三风格,对第一文字轨迹进行美化处理,得到第二文字轨迹,并可以在触控屏上显示第二文字轨迹。In the first aspect, an embodiment of the present application provides a text beautification method, which can be applied to an electronic device with a touch screen. In this method, the electronic device generates a first text track in response to a first operation of a user on the touch screen, and can identify the first text track to obtain a first style of the first text track, wherein the first style is used to characterize the font features of the first text track. And, the electronic device can also obtain a second style of the target font, wherein the second style is used to characterize the font features of the text track of the target font. Afterwards, the electronic device can generate a third style based on the first style and the second style. Then, the electronic device can beautify the first text track according to the third style to obtain a second text track, and can display the second text track on the touch screen.
上述设计中,电子设备通过将用户在触控屏上形成的第一文字轨迹的第一风格与自动选择或用户手动选择的目标字体的第二风格相融合,即可实现两种不同的风格进行互补,然后通过根据融合得到的第三风格进行美化用户在触控屏上形成的第一文字轨迹,即可实现在保留用户原有书写风格的基础上,调整用户在触控屏上形成的文字轨迹的字体结构,以此达到自适应风格的美化效果,从而可以实现满足不同用户对文字美化的不同需求。In the above design, the electronic device can achieve the complementarity of two different styles by fusing the first style of the first text track formed by the user on the touch screen with the second style of the target font automatically selected or manually selected by the user, and then beautify the first text track formed by the user on the touch screen according to the third style obtained by the fusion. It can be achieved on the basis of retaining the user's original writing style and adjusting the font structure of the text track formed by the user on the touch screen, so as to achieve the beautification effect of adaptive style, thereby meeting the different needs of different users for text beautification.
在一种可能的设计中,对第一文字轨迹进行识别,获取第一文字轨迹的第一风格,包括: In a possible design, recognizing the first text track to obtain the first style of the first text track includes:
将第一文字轨迹输入风格识别模型,得到第一风格。The first text track is input into the style recognition model to obtain a first style.
上述设计中,电子设备通过预训练好的风格识别模型对第一文字轨迹进行识别,可以及时准确地得到第一文字轨迹的第一风格。In the above design, the electronic device recognizes the first text track through the pre-trained style recognition model, and can obtain the first style of the first text track in a timely and accurate manner.
在一种可能的设计中,获取目标字体的第二风格,包括:In a possible design, obtaining the second style of the target font includes:
将目标字体对应的文字模型输入风格识别模型,得到第二风格;或者从风格库中确定目标字体的第二风格。The text model corresponding to the target font is input into the style recognition model to obtain the second style; or the second style of the target font is determined from the style library.
上述设计中,存在两种实现方式可以实现电子设备获取目标字体的第二风格,即一种实现方式是电子设备通过预训练好的风格识别模型对目标字体对应的文字模型进行识别,即可及时准确地得到目标字体的第二风格;另一种实现方式是电子设备通过预先创建好的风格库,即可及时准确地得到目标字体的第二风格,该风格库中存储多个字体以及该多个字体的风格。In the above design, there are two implementation methods that can enable the electronic device to obtain the second style of the target font. One implementation method is that the electronic device recognizes the text model corresponding to the target font through a pre-trained style recognition model, and can obtain the second style of the target font in a timely and accurate manner; the other implementation method is that the electronic device can obtain the second style of the target font in a timely and accurate manner through a pre-created style library, which stores multiple fonts and the styles of the multiple fonts.
在一种可能的设计中,所述方法还包括:In one possible design, the method further includes:
在字体库中选择目标字体,其中,字体库中包含至少一个字体;或者响应于用户在触控屏上的第二操作,获取目标字体。The target font is selected in a font library, wherein the font library contains at least one font; or the target font is acquired in response to a second operation of the user on the touch screen.
上述设计中,存在两种实现方式可以实现目标字体的选择,字体选择方式比较灵活,即一种实现方式是电子设备在字体库中选择与第一文字轨迹匹配的字体作为目标字体,有助于实现目标字体的自动选择,且自动选择准确性也比较高;另一种实现方式是电子设备提供用户选择目标字体的功能,比如通过用户在触控屏上的选择操作即可实现目标字体的选择,有助于实现根据用户的实际需求确定目标字体,很大程度地满足了用户的文字美化需求,可以适用不同用户对文字美化的不同理解,从而可以提升用户体验。In the above design, there are two implementation methods for realizing the selection of the target font, and the font selection method is relatively flexible. That is, one implementation method is that the electronic device selects a font matching the first text track in the font library as the target font, which helps to realize the automatic selection of the target font, and the accuracy of the automatic selection is also relatively high; another implementation method is that the electronic device provides the user with the function of selecting the target font. For example, the target font can be selected by the user through the selection operation on the touch screen, which helps to determine the target font according to the actual needs of the user, and largely meets the user's needs for text beautification. It can be adapted to the different understandings of text beautification by different users, thereby improving the user experience.
在一种可能的设计中,在字体库中选择目标字体,包括:In one possible design, a target font is selected in a font library, including:
计算第一文字轨迹与至少一个字体中每个字体的相似度;calculating a similarity between the first text track and each font of at least one font;
在字体库中,选择与第一文字轨迹相似度最高的字体为目标字体。In the font library, a font having the highest similarity to the first text track is selected as the target font.
上述设计中,电子设备通过计算第一文字轨迹与字体库中的至少一个字体中每个字体的相似度,即可准确地选择与第一文字轨迹匹配的目标字体。In the above design, the electronic device can accurately select a target font that matches the first text track by calculating the similarity between the first text track and each font in at least one font in the font library.
在一种可能的设计中,计算第一文字轨迹与至少一个字体中每个字体的相似度,包括:In a possible design, calculating the similarity between the first text track and each font in at least one font includes:
将第一文字轨迹输入第一笔迹特征提取模型,得到第一文字轨迹的第一笔迹特征向量;Inputting the first text trajectory into a first handwriting feature extraction model to obtain a first handwriting feature vector of the first text trajectory;
根据第一笔迹特征向量以及至少一个字体的笔迹特征向量,计算第一文字轨迹与至少一个字体中每个字体的相似度。The similarity between the first text track and each font in the at least one font is calculated according to the first handwriting feature vector and the handwriting feature vector of the at least one font.
上述设计中,电子设备通过预训练好的第一笔迹特征提取模型对第一文字轨迹进行特征提取,即可及时准确地提取出第一笔迹特征向量,从而通过第一笔迹特征向量以及至少一个字体的笔迹特征向量,即可及时有效地计算第一文字轨迹与至少一个字体中每个字体的相似度。In the above design, the electronic device performs feature extraction on the first text trajectory through a pre-trained first handwriting feature extraction model, and can timely and accurately extract the first handwriting feature vector, so that the similarity between the first text trajectory and each font in at least one font can be timely and effectively calculated through the first handwriting feature vector and the handwriting feature vector of at least one font.
在一种可能的设计中,所述方法还包括:In one possible design, the method further includes:
确定第一字体,将确定的第一字体更新至字体库。A first font is determined, and the determined first font is updated to a font library.
上述设计中,电子设备可以实时或定期更新字体库,比如电子设备可以将每次确定的新的字体更新至字体库。In the above design, the electronic device can update the font library in real time or periodically. For example, the electronic device can update the font library with a new font that is determined each time.
在一种可能的设计中,确定第一字体,包括:In a possible design, determining the first font includes:
将第三文字轨迹输入第一笔迹特征提取模型,得到第三文字轨迹的第二笔迹特征向量,并将第二笔迹特征向量输入字体鉴定模型,得到第三文字轨迹的字体为第一字体;其中, 第三文字轨迹是根据任一个用户在触控屏上触发的第三操作生成的;或者The third text track is input into the first handwriting feature extraction model to obtain the second handwriting feature vector of the third text track, and the second handwriting feature vector is input into the font identification model to obtain the font of the third text track as the first font; wherein, The third text track is generated according to a third operation triggered by any user on the touch screen; or
将目标文字模型输入第二笔迹特征提取模型,得到目标文字模型的第三笔迹特征向量,并将第三笔迹特征向量输入字体鉴定模型,得到目标文字模型对应的字体为第一字体。The target text model is input into the second handwriting feature extraction model to obtain a third handwriting feature vector of the target text model, and the third handwriting feature vector is input into the font identification model to obtain that the font corresponding to the target text model is the first font.
上述设计中,电子设备可以通过两种实现方式进行确定第一字体,即一种实现方式是电子设备针对用户在线操作生成的文字轨迹进行字体鉴定,确定第一字体;另一种实现方式是电子设备针对图像或图片形式的目标文字模型进行字体鉴定,确定第一字体。如此,通过上述设计,可以满足不同场景下的字体鉴定需求,并可以使得字体库的覆盖面比较广,从而可以在一定程度上满足不同的字体选择需求。In the above design, the electronic device can determine the first font in two implementation methods, namely, one implementation method is that the electronic device performs font identification on the text track generated by the user's online operation to determine the first font; the other implementation method is that the electronic device performs font identification on the target text model in the form of an image or picture to determine the first font. In this way, through the above design, the font identification needs in different scenarios can be met, and the coverage of the font library can be relatively wide, so that different font selection needs can be met to a certain extent.
在一种可能的设计中,响应于用户在触控屏上的第二操作,获取目标字体,包括:In a possible design, in response to a second operation of the user on the touch screen, obtaining a target font includes:
当检测到用户在触控屏上作用于字体选择图标的操作时,显示多个候选字体;When detecting a user operation on a font selection icon on the touch screen, displaying a plurality of candidate fonts;
响应于用户在多个候选字体中选中任一个候选字体的第二操作,将用户选中的候选字体作为目标字体。In response to a second operation in which the user selects any one of the plurality of candidate fonts, the candidate font selected by the user is used as the target font.
上述设计中,电子设备提供用户选择某一个字体作为目标字体的功能,比如电子设备在检测到用户在触控屏上触发的字体选择操作时,会显示多个候选字体供用户选择,字体选择灵活性比较高,有助于满足用户在不同场景下的不同字体选择需求,从而可以提升用户体验。In the above design, the electronic device provides the user with the function of selecting a certain font as the target font. For example, when the electronic device detects that the user has triggered a font selection operation on the touch screen, it will display multiple candidate fonts for the user to choose from. The font selection flexibility is relatively high, which helps to meet the user's different font selection needs in different scenarios, thereby improving the user experience.
在一种可能的设计中,根据第一风格与第二风格,生成第三风格,包括:In a possible design, a third style is generated according to the first style and the second style, including:
获取用于调整第一文字轨迹的美化程度的美化参数值;Obtaining a beautification parameter value for adjusting a beautification degree of the first text track;
将美化参数值、第一风格以及第二风格输入特征融合模型,得到第三风格。The beautification parameter value, the first style, and the second style are input into the feature fusion model to obtain the third style.
上述设计中,电子设备提供用户选择文字美化程度的功能,比如用户可以根据自己的文字美化需求在触控屏上选择或者输入美化参数值,有助于满足不同用户对美化程度的不同需求,从而可以满足不同用户的不同美化需求。可选的,也可以在电子设备中预先配置好美化参数值,以便电子设备在需要对某一文字轨迹进行美化时,可以直接使用预先配置好的美化参数值。In the above design, the electronic device provides the user with a function of selecting the degree of text beautification. For example, the user can select or input a beautification parameter value on the touch screen according to his or her text beautification needs, which helps to meet the different beautification needs of different users, thereby meeting the different beautification needs of different users. Optionally, the beautification parameter value can also be pre-configured in the electronic device, so that when the electronic device needs to beautify a certain text track, the pre-configured beautification parameter value can be directly used.
第二方面,本申请实施例提供了一种电子设备,有益效果可以参见第一方面的描述,此处不再赘述。所述电子设备具有实现上述第一方面的方法实例中行为的功能。所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。在一种可能的设计中,所述电子设备包括获取模块和处理模块,所述处理模块,用于响应于用户在触控屏上的第一操作,生成第一文字轨迹;所述处理模块,还用于对第一文字轨迹进行识别,获取第一文字轨迹的第一风格;其中,第一风格用于表征第一文字轨迹具有的字型特征;所述获取模块,用于获取目标字体的第二风格;第二风格用于表征目标字体的文字轨迹具有的字型特征;所述处理模块,还用于根据第一风格与第二风格,生成第三风格;所述处理模块,还用于根据第三风格,对第一文字轨迹进行美化处理,得到第二文字轨迹;所述处理模块,还用于在触控屏上显示第二文字轨迹。这些模块可以执行上述第一方面方法示例中的相应功能,具体参见方法示例中的详细描述,此处不做赘述。In the second aspect, the embodiment of the present application provides an electronic device, and the beneficial effects can be found in the description of the first aspect, which will not be repeated here. The electronic device has the function of implementing the behavior in the method example of the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. In a possible design, the electronic device includes an acquisition module and a processing module, the processing module is used to generate a first text track in response to a first operation of a user on a touch screen; the processing module is also used to identify the first text track and obtain the first style of the first text track; wherein the first style is used to characterize the font features of the first text track; the acquisition module is used to obtain the second style of the target font; the second style is used to characterize the font features of the text track of the target font; the processing module is also used to generate a third style according to the first style and the second style; the processing module is also used to beautify the first text track according to the third style to obtain the second text track; the processing module is also used to display the second text track on the touch screen. These modules can perform the corresponding functions in the method example of the first aspect, and refer to the detailed description in the method example for details, which will not be repeated here.
第三方面,本申请实施例提供了一种电子设备,该电子设备包括通信接口以及处理器,可选的,还包括存储器。其中,该存储器用于存储计算机程序或指令,处理器与存储器、通信接口耦合,当处理器执行所述计算机程序或指令时,使得所述电子设备执行上述第一方面的任一种可能的设计中的方法。 In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising a communication interface and a processor, and optionally, a memory. The memory is used to store computer programs or instructions, and the processor is coupled to the memory and the communication interface. When the processor executes the computer program or instruction, the electronic device executes the method in any possible design of the first aspect.
第四方面,本申请实施例提供了一种计算机程序产品,所述计算机程序产品包括计算机程序或指令,当所述计算机程序或指令在计算机上运行时,使得所述计算机执行上述第一方面的任一种可能的设计中的方法。In a fourth aspect, an embodiment of the present application provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are run on a computer, the computer executes a method in any possible design of the first aspect above.
第五方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序或指令,当所述计算机程序或指令被计算机执行时,使得所述计算机执行上述第一方面的任一种可能的设计中的方法。In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program or instructions are stored. When the computer program or instructions are executed by a computer, the computer executes a method in any possible design of the first aspect above.
第六方面,本申请实施例还提供了一种芯片,所述芯片与存储器耦合,所述芯片用于读取存储器中存储的计算机程序,执行上述第一方面的任一种可能的设计中的方法。In a sixth aspect, an embodiment of the present application further provides a chip, which is coupled to a memory, and is used to read a computer program stored in the memory to execute a method in any possible design of the first aspect above.
第七方面,本申请实施例还提供了一种芯片系统,该芯片系统包括处理器,用于支持计算机装置实现上述第一方面的任一种可能的设计中的方法。在一种可能的设计中,所述芯片系统还包括存储器,所述存储器用于保存该计算机装置必要的程序和数据。该芯片系统可以由芯片构成,也可以包含芯片和其他分立器件。In a seventh aspect, an embodiment of the present application further provides a chip system, which includes a processor for supporting a computer device to implement the method in any possible design of the first aspect. In one possible design, the chip system also includes a memory, which is used to store the necessary programs and data of the computer device. The chip system can be composed of a chip, or it can include a chip and other discrete devices.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1示例性示出本申请实施例提供的一种应用场景示意图;FIG1 exemplarily shows a schematic diagram of an application scenario provided by an embodiment of the present application;
图2示例性示出本申请实施例提供的一种电子设备的结构示意图;FIG2 exemplarily shows a schematic structural diagram of an electronic device provided in an embodiment of the present application;
图3示例性示出本申请实施例提供的一种电子设备的功能模块结构示意图;FIG3 exemplarily shows a schematic diagram of a functional module structure of an electronic device provided in an embodiment of the present application;
图4a示例性示出本申请实施例提供的一种滑杆式的美化参数值选择框;FIG4a exemplarily shows a slide bar type beautification parameter value selection box provided in an embodiment of the present application;
图4b示例性示出本申请实施例提供的一种包含多个美化参数值的选择框;FIG4b exemplarily shows a selection box including multiple beautification parameter values provided in an embodiment of the present application;
图4c示例性示出本申请实施例提供的一种滑动按钮式的美化参数值选择框;FIG4c exemplarily shows a sliding button type beautification parameter value selection box provided in an embodiment of the present application;
图5示例性示出本申请实施例提供的一种文字美化方法的流程示意图;FIG5 exemplarily shows a flow chart of a text beautification method provided in an embodiment of the present application;
图6a示例性示出本申请实施例提供的一种风格识别模型识别文字轨迹的示意图;FIG6a exemplarily shows a schematic diagram of a style recognition model provided in an embodiment of the present application recognizing a text track;
图6b示例性示出本申请实施例提供的一种生成第三风格的示意图;FIG6b exemplarily shows a schematic diagram of generating a third style provided by an embodiment of the present application;
图6c示例性示出本申请实施例提供的一种生成第二文字轨迹的示意图;FIG6c exemplarily shows a schematic diagram of generating a second text trajectory provided by an embodiment of the present application;
图7示例性示出本申请实施例提供的一种可能的电子设备的结构示意图;FIG7 exemplarily shows a structural diagram of a possible electronic device provided in an embodiment of the present application;
图8示例性示出本申请实施例提供的一种可能的电子设备的结构示意图。FIG8 exemplarily shows a schematic structural diagram of a possible electronic device provided in an embodiment of the present application.
具体实施方式Detailed ways
在介绍本申请提供的技术方案之前,首先对本申请中涉及的部分用语进行解释说明,以便于本领域技术人员进行理解。Before introducing the technical solution provided by the present application, some of the terms involved in the present application are first explained to facilitate understanding by those skilled in the art.
(1)人工智能(artificial intelligence,AI)算法:人工智能是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,可以获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。(1) Artificial intelligence (AI) algorithm: Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, acquire knowledge and use knowledge to obtain the best results. It attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is also the study of the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
一般来说,AI算法可以包括机器学习算法和深度学习算法。其中,机器学习算法可以包括决策树、逻辑回归(logistic regression,LR),朴素贝叶斯(naive bayes,NB)分类算法,随机森林(random forest,RF)算法、支持向量机(support vector machines,SVM)分类算法等。深度学习算法可以包括神经网络、深度神经网络、卷积神经网络(Convolutional Neuron Network,CNN)、生成对抗网络(Generative Adversarial Network,GAN)等。深 度学习可以理解为是机器学习的一种优化,可以使用大量的训练样本进行训练以得出较为准确的计算结果。机器学习和深度学习有一定区别,比如,对于训练数据量较少的情况下,机器学习的效果更好,当训练数据量较多的情况下,可能深度学习的效果更好。Generally speaking, AI algorithms can include machine learning algorithms and deep learning algorithms. Among them, machine learning algorithms can include decision trees, logistic regression (LR), naive Bayes (NB) classification algorithms, random forest (RF) algorithms, support vector machines (SVM) classification algorithms, etc. Deep learning algorithms can include neural networks, deep neural networks, convolutional neural networks (CNN), generative adversarial networks (GAN), etc. Deep Deep learning can be understood as an optimization of machine learning, which can use a large number of training samples to obtain more accurate calculation results. There are certain differences between machine learning and deep learning. For example, when the amount of training data is small, machine learning is more effective, and when the amount of training data is large, deep learning may be more effective.
下面以神经网络、深度神经网络、卷积神经网络、生成对抗网络为例进行简单的介绍。The following is a brief introduction using neural networks, deep neural networks, convolutional neural networks, and generative adversarial networks as examples.
(2)神经网络:神经网络可以是由神经单元组成的,简单来说,神经单元是指具有运算能力的运算单元。神经网络可以是将许多个上述单一的神经单元联结在一起形成的网络,神经网络中不同神经单元之间可以连接,比如一个神经单元的输出可以是另一个神经单元的输入,这样逐个经过所有神经单元得到最终的输出信号。(2) Neural network: A neural network can be composed of neural units. In simple terms, a neural unit refers to a computing unit with computing capabilities. A neural network can be formed by connecting many of the above-mentioned single neural units together. Different neural units in a neural network can be connected. For example, the output of one neural unit can be the input of another neural unit. In this way, the final output signal is obtained by passing through all neural units one by one.
(3)深度神经网络(Deep Neural Network,DNN):也称多层神经网络。一般,DNN内部的神经网络可以分为三类:输入层,隐含层,输出层。第一层是输入层,用于接收输入数据,最后一层是输出层,用于输出数据,第一层和最后一层中间的层都是隐含层。层与层之间是全连接的,也就是说,第i层的任意一个神经元一定与第i+1层的任意一个神经元相连。(3) Deep Neural Network (DNN): also known as multi-layer neural network. Generally, the neural network inside a DNN can be divided into three categories: input layer, hidden layer, and output layer. The first layer is the input layer, which is used to receive input data, and the last layer is the output layer, which is used to output data. The layers between the first and last layers are all hidden layers. The layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer.
需要注意的是,输入层是没有权重矩阵的。由于DNN层数多,则权重矩阵和偏移向量的数量也就很多,训练深度神经网络的过程也就是学习权重矩阵的过程,使得训练后的深度神经网络的输出结果更接近理想结果。在深度神经网络中,更多的隐含层让网络更能够刻画现实世界中的复杂情形。It should be noted that the input layer does not have a weight matrix. Since there are many DNN layers, there are also many weight matrices and offset vectors. The process of training a deep neural network is the process of learning the weight matrix, which makes the output of the trained deep neural network closer to the ideal result. In a deep neural network, more hidden layers allow the network to better describe complex situations in the real world.
(4)卷积神经网络(Convolutional Neuron Network,CNN):是一种带有卷积结构的深度神经网络。与深度神经网络DNN不同的是,卷积神经网络CNN中权重用卷积核替代。卷积核可以是一个二维或三维的矩阵,用于与输入数据(比如输出图像)进行卷积运算,以提取出输入数据中的特征信息。如果输入数据是一张图像,那么提取的特征信息可以是图像上的颜色、亮度、曝光、灰度等特征信息。(4) Convolutional Neural Network (CNN): It is a deep neural network with a convolutional structure. Unlike deep neural networks (DNNs), weights in convolutional neural networks (CNNs) are replaced by convolution kernels. The convolution kernel can be a two-dimensional or three-dimensional matrix, which is used to perform convolution operations with input data (such as output images) to extract feature information from the input data. If the input data is an image, the extracted feature information can be feature information such as color, brightness, exposure, grayscale, etc. on the image.
示例性地,CNN内部的神经网络也可以分为三类:输入层,隐含层,输出层。每层对应特征提取器,特征提取器中包括卷积核。同一层可以对应一个或多个特征提取器,即对应一个或多个卷积核,不同层对应的特征抽取器可以相同或不同。需要说明的是,输入层可以没有特征提取器。每层可以使用该层对应的特征提取器对输入到该层的输入图像进行特征提取。Exemplarily, the neural network inside CNN can also be divided into three categories: input layer, hidden layer, and output layer. Each layer corresponds to a feature extractor, which includes a convolution kernel. The same layer can correspond to one or more feature extractors, that is, one or more convolution kernels, and the feature extractors corresponding to different layers can be the same or different. It should be noted that the input layer may not have a feature extractor. Each layer can use the feature extractor corresponding to the layer to extract features from the input image input to the layer.
一般来说,卷积核数量越多,卷积操作反映的图像信息越丰富,可以提升后续过程中对图像识别时的准确性。而且,特定的特征提取器(即特定的卷积核)可以提取输入数据中的特定的特征信息,所以,特征提取器的设计尤为重要,所以CNN的训练过程即训练特征提取器中的卷积核的过程。Generally speaking, the more convolution kernels there are, the richer the image information reflected by the convolution operation, which can improve the accuracy of image recognition in the subsequent process. Moreover, a specific feature extractor (i.e., a specific convolution kernel) can extract specific feature information from the input data, so the design of the feature extractor is particularly important. Therefore, the training process of CNN is the process of training the convolution kernel in the feature extractor.
(5)生成对抗网络:是深度学习领域的一个重要生成模型,即两个网络(生成器和鉴别器)在同一时间训练并且在极小化极大算法(minimax)中进行竞争。这种对抗方式避免了一些传统生成模型在实际应用中的一些困难,巧妙地通过对抗学习来近似一些不可解的损失函数,在图像、视频、自然语言和音乐等数据的生成方面有着广泛应用。(5) Generative Adversarial Network: It is an important generative model in the field of deep learning. That is, two networks (generator and discriminator) are trained at the same time and compete in the minimax algorithm. This adversarial approach avoids some difficulties of traditional generative models in practical applications. It cleverly approximates some unsolvable loss functions through adversarial learning and has been widely used in the generation of data such as images, videos, natural language and music.
示例性地,生成器从潜在空间(latent space)中随机采样作为输入,其输出结果需要尽量模仿训练集中的真实样本。判别器的输入则为真实样本或生成网络的输出,其目的是将生成器的输出从真实样本中尽可能分辨出来。而生成器则要尽可能地欺骗判别网络。两个网络相互对抗、不断调整参数,最终目的是使判别器无法判断生成器的输出结果是否真实。 For example, the generator randomly samples from the latent space as input, and its output needs to imitate the real samples in the training set as much as possible. The input of the discriminator is the real sample or the output of the generator network, and its purpose is to distinguish the output of the generator from the real sample as much as possible. The generator should deceive the discriminant network as much as possible. The two networks compete with each other and constantly adjust parameters, and the ultimate goal is to make it impossible for the discriminator to determine whether the output of the generator is real.
(6)损失函数:以训练CNN为例,在训练CNN的过程中,因为希望CNN的输出尽可能的接近真正想要的值,所以可以通过比较当前CNN的输出值和真正想要的目标值,再根据两者之间的差异情况来更新CNN中每层神经网络的权重(当然,在第一次更新之前通常会有初始化的过程,即为网络各层预先配置参数)。比如,如果输出值高了,就调整权重让它输出值低一些,不断的调整,直到能够得到出真正想要的目标值或与真正想要的目标值非常接近的值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量输出值和目标值的差异的重要方程。其中,以损失函数为例,损失函数的输出值(loss)越高,表示差异越大,那么训练过程就变成了尽可能缩小这个loss的过程。(6) Loss function: Taking the training of CNN as an example, in the process of training CNN, because we hope that the output of CNN is as close to the desired value as possible, we can compare the current CNN output value with the desired target value, and then update the weight of each layer of the neural network in CNN according to the difference between the two (of course, there is usually an initialization process before the first update, that is, pre-configuring parameters for each layer of the network). For example, if the output value is high, adjust the weight to make its output value lower, and continue to adjust until the desired target value or a value very close to the desired target value can be obtained. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value", which is the loss function (loss function) or objective function (objective function). They are important equations used to measure the difference between the output value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training process becomes a process of minimizing this loss as much as possible.
为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述。应理解,方法实施例中的具体操作方法也可以应用于装置实施例或系统实施例中。且,在本申请的描述中,“至少一个”是指一个或多个,多个是指两个或两个以上。鉴于此,本发明实施例中也可以将“多个”理解为“至少两个”。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,字符“三种,如无特殊说明,一般表示前后关联对象是一种“或”的关系。另外,需要理解的是,在本申请的描述中,“第一”、“第二”等词汇,仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific operating methods in the method embodiments can also be applied to device embodiments or system embodiments. Moreover, in the description of the present application, "at least one" refers to one or more, and multiple refers to two or more. In view of this, "multiple" can also be understood as "at least two" in the embodiments of the present invention. "And/or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and/or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the characters "three kinds, unless otherwise specified, generally indicate that the objects associated before and after are in an "or" relationship. In addition, it should be understood that in the description of the present application, words such as "first" and "second" are only used to distinguish the purpose of description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.
下面结合附图对本申请实施例进行详细描述。The embodiments of the present application are described in detail below with reference to the accompanying drawings.
本申请公开的文字美化方法的技术方案可以应用于设置有触控屏的电子设备中。在本申请一些实施例中,电子设备可以是具有处理器的便携式电子设备,诸如手机、平板电脑、具备无线通讯功能的可穿戴设备(比如智能手表等)、车载设备等。便携式电子设备的示例性实施例包括但不限于搭载或者其它操作系统的便携式电子设备。上述便携式电子设备也可以是诸如具有触敏表面(比如触控面板等)的膝上型计算机(Laptop)等。应当理解的是,在本申请其他一些实施例中,上述电子设备也可以不是便携式设备,例如也可以是电子白板,比如柜式电子白板或镶墙式电子白板等,或者也可以是台式计算机,例如PC,或者也可以是电视机等。The technical solution of the text beautification method disclosed in this application can be applied to electronic devices equipped with touch screens. In some embodiments of this application, the electronic device can be a portable electronic device with a processor, such as a mobile phone, a tablet computer, a wearable device with wireless communication function (such as a smart watch, etc.), a vehicle-mounted device, etc. Exemplary embodiments of portable electronic devices include but are not limited to devices equipped with Or a portable electronic device with other operating systems. The portable electronic device may also be a laptop computer (Laptop) with a touch-sensitive surface (such as a touch panel, etc.). It should be understood that in some other embodiments of the present application, the electronic device may not be a portable device, for example, it may be an electronic whiteboard, such as a cabinet electronic whiteboard or a wall-mounted electronic whiteboard, or it may be a desktop computer, such as a PC, or it may be a television, etc.
图1示例性示出了本申请实施例提供的一种应用场景示意图。该应用场景包括用户100以及电子设备200。可选的,触控屏可以设置在电子设备200中,或者触控屏也可以独立于电子设备单独进行设置,比如,触控屏作为一个独立的实体进行设置,该触控屏与包含有处理器的电子设备相连接。可选的,电子设备200中可以安装多个应用程序,比如视频会议、投屏书写、白板、文件管理、相机、图像等应用程序。示例性地,以用户100选中电子设备200中的白板应用程序进行文字书写为例,用户100在白板上书写一个或多个文字时,电子设备200可以采用本申请实施例提供的文字美化方法对用户100书写的一个或多个文字进行美化处理,并将美化后的一个或多个文字显示在触控屏上。此时用户100可以看到触控屏上显示的是美化后的一个或多个文字,给用户带来了文字具有易读性和美观舒适度的视觉冲击。FIG1 exemplarily shows a schematic diagram of an application scenario provided by an embodiment of the present application. The application scenario includes a user 100 and an electronic device 200. Optionally, the touch screen can be set in the electronic device 200, or the touch screen can also be set independently of the electronic device, for example, the touch screen is set as an independent entity, and the touch screen is connected to an electronic device including a processor. Optionally, multiple applications can be installed in the electronic device 200, such as video conferencing, screen writing, whiteboard, file management, camera, image and other applications. Exemplarily, taking the case where the user 100 selects the whiteboard application in the electronic device 200 for text writing, when the user 100 writes one or more words on the whiteboard, the electronic device 200 can beautify the one or more words written by the user 100 using the text beautification method provided in the embodiment of the present application, and display the beautified one or more words on the touch screen. At this time, the user 100 can see that the one or more words displayed on the touch screen are beautified, which brings the user a visual impact of readability and aesthetic comfort of the text.
需要说明的是,图1仅示意性的提供了一种应用场景,并不对本申请提供的文字美化方法的应用场景构成限定,本申请提供的文字美化方法可以适用于更多种场景,本申请不 再一一列举。It should be noted that FIG. 1 only schematically provides an application scenario, and does not limit the application scenario of the text beautification method provided in this application. The text beautification method provided in this application can be applied to more scenarios. Let me list them one by one.
基于图1所示的应用场景,本申请实施例提供了一种电子设备。参见图2,电子设备可以包括处理器210、外部存储器接口220、内部存储器221、通用串行总线(universal serial bus,USB)接口230、充电管理模块240、电源管理模块241、电池242、天线1、天线2、移动通信模块251、无线通信模块252、音频模块270、扬声器270A、受话器270B、麦克风270C、耳机接口270D、传感器模块280、按键290、马达291、指示器292、摄像头293、显示屏294以及用户标识模块(subscriber identification module,SIM)卡接口295等。其中,传感器模块280可以包括压力传感器280A、陀螺仪传感器280B、气压传感器280C、加速度传感器280D、接近光传感器280E、环境光传感器280F、指纹传感器280G、温度传感器280H和触摸传感器280I,当然,电子设备200也可以包括其它传感器,比如磁传感器、距离传感器、骨传导传感器等。Based on the application scenario shown in FIG1 , an embodiment of the present application provides an electronic device. Referring to FIG2 , the electronic device may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 251, a wireless communication module 252, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a subscriber identification module (SIM) card interface 295, etc. Among them, the sensor module 280 may include a pressure sensor 280A, a gyroscope sensor 280B, an air pressure sensor 280C, an acceleration sensor 280D, a proximity light sensor 280E, an ambient light sensor 280F, a fingerprint sensor 280G, a temperature sensor 280H and a touch sensor 280I. Of course, the electronic device 200 may also include other sensors, such as a magnetic sensor, a distance sensor, a bone conduction sensor, etc.
需要说明的是,图2中示出的天线1、天线2是一种示例,在其它一些实施例中也可以包括其它天线。应当理解,图2示出的电子设备仅是一种示例,并不构成对电子设备的限定。例如,电子设备200可以具有比图中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。It should be noted that the antenna 1 and antenna 2 shown in FIG. 2 are examples, and other antennas may also be included in other embodiments. It should be understood that the electronic device shown in FIG. 2 is only an example and does not constitute a limitation on the electronic device. For example, the electronic device 200 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application-specific integrated circuits.
下面结合图2对电子设备200的部分部件进行具体的介绍:The following is a detailed introduction to some components of the electronic device 200 in conjunction with FIG. 2 :
图2中的处理器210,可以包括一个或多个处理单元,比如,处理器210可以包括应用处理器(application processor,AP)、基带处理器、图形处理器(graphics processing unit,GPU)、图像信号处理器(image signal processor,ISP)、控制器、存储器、视频编解码器、数字信号处理器(digital signal processor,DSP)和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。其中,控制器可以是电子设备200的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The processor 210 in FIG. 2 may include one or more processing units. For example, the processor 210 may include an application processor (AP), a baseband processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP) and/or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. The controller may be the nerve center and command center of the electronic device 200. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
处理器210中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器210中的存储器为高速缓冲存储器。该存储器可以保存处理器210刚用过或循环使用的指令或数据,比如该存储器可以存储文字美化方法的程序代码。如果处理器210需要再次使用该指令或数据,可从所述存储器中直接调用,从而可避免重复存取,可减少处理器210的等待时间,因而可提高系统的效率。The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or cyclically used. For example, the memory may store program codes of a text beautification method. If the processor 210 needs to use the instruction or data again, it may be directly called from the memory, thereby avoiding repeated access, reducing the waiting time of the processor 210, and thus improving the efficiency of the system.
处理器210可以运行本申请提供的文字美化方法,处理器210可以响应于用户对触控屏的操作,启动与用户的操作相对应的功能。当处理器210集成不同的器件,比如集成CPU和GPU时,CPU和GPU可以配合执行本申请提供的文字美化方法,以得到较快的处理效率。The processor 210 can run the text beautification method provided in the present application, and the processor 210 can respond to the user's operation on the touch screen and start the function corresponding to the user's operation. When the processor 210 integrates different devices, such as a CPU and a GPU, the CPU and the GPU can cooperate to execute the text beautification method provided in the present application to obtain faster processing efficiency.
外部存储器接口220可以用于连接外部存储卡,例如Micro SD卡,可以实现扩展电子设备200的存储能力。外部存储卡通过外部存储器接口220与处理器210通信,可以实现数据存储功能。比如,可以将图片,视频等文件保存在外部存储卡中。The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 200. The external memory card communicates with the processor 210 through the external memory interface 220 to implement a data storage function. For example, files such as pictures and videos can be saved in the external memory card.
内部存储器221可以用于存储计算机可执行程序代码,可执行程序代码包括指令。内部存储器221可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等,比如可以存储文 字美化方法的程序代码。存储数据区可存储电子设备200使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器221可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器210通过运行存储在内部存储器221的指令和/或存储在设置于处理器中的存储器的指令,执行电子设备200的各种功能应用以及数据处理。The internal memory 221 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 221 may include a program storage area and a data storage area. The program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), and may store files, The program code of the word beautification method. The data storage area can store data (such as audio data, phone book, etc.) created during the use of the electronic device 200. In addition, the internal memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 210 executes various functional applications and data processing of the electronic device 200 by running instructions stored in the internal memory 221 and/or instructions stored in a memory provided in the processor.
在一些实施例中,处理器210可以包括一个或多个接口。比如,接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或,通用串行总线(universal serial bus,USB)接口等。In some embodiments, the processor 210 may include one or more interfaces. For example, the interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (SIM) interface, and/or a universal serial bus (USB) interface.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器210可以包含多组I2C总线。处理器210可以通过不同的I2C总线接口分别耦合触摸传感器280I,充电器,闪光灯,摄像头293等。例如:处理器210可以通过I2C接口耦合触摸传感器280I,使处理器210与触摸传感器280I通过I2C总线接口通信,实现电子设备200的触摸功能。The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 210 may include multiple groups of I2C buses. The processor 210 may be coupled to the touch sensor 280I, the charger, the flash, the camera 293, etc. through different I2C bus interfaces. For example, the processor 210 may be coupled to the touch sensor 280I through the I2C interface, so that the processor 210 communicates with the touch sensor 280I through the I2C bus interface, thereby realizing the touch function of the electronic device 200.
I2S接口可以用于音频通信。在一些实施例中,处理器210可以包含多组I2S总线。处理器210可以通过I2S总线与音频模块270耦合,实现处理器210与音频模块270之间的通信。在一些实施例中,音频模块270可以通过I2S接口向无线通信模块252传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, the processor 210 can include multiple groups of I2S buses. The processor 210 can be coupled to the audio module 270 via the I2S bus to achieve communication between the processor 210 and the audio module 270. In some embodiments, the audio module 270 can transmit an audio signal to the wireless communication module 252 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块270与无线通信模块252可以通过PCM总线接口耦合。在一些实施例中,音频模块270也可以通过PCM接口向无线通信模块252传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 270 and the wireless communication module 252 can be coupled via a PCM bus interface. In some embodiments, the audio module 270 can also transmit audio signals to the wireless communication module 252 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器210与无线通信模块252。例如:处理器210通过UART接口与无线通信模块252中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块270可以通过UART接口向无线通信模块252传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 210 and the wireless communication module 252. For example, the processor 210 communicates with the Bluetooth module in the wireless communication module 252 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 270 can transmit an audio signal to the wireless communication module 252 through the UART interface to implement the function of playing music through a Bluetooth headset.
MIPI接口可以被用于连接处理器210与显示屏294,摄像头293等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器210和摄像头293通过CSI接口通信,实现电子设备200的拍摄功能。处理器210和显示屏294通过DSI接口通信,实现电子设备200的显示功能。The MIPI interface can be used to connect the processor 210 with peripheral devices such as the display screen 294 and the camera 293. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 210 and the camera 293 communicate via the CSI interface to realize the shooting function of the electronic device 200. The processor 210 and the display screen 294 communicate via the DSI interface to realize the display function of the electronic device 200.
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器210与摄像头293,显示屏294,无线通信模块252,音频模块270,传感器模块280等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 210 with the camera 293, the display 294, the wireless communication module 252, the audio module 270, the sensor module 280, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
USB接口230是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB 接口,USB Type C接口等。USB接口230可以用于连接充电器为电子设备200充电,也可以用于电子设备200与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 230 is an interface that complies with the USB standard specification, and can be a Mini USB interface, a Micro USB The USB interface 230 may be used to connect a charger to charge the electronic device 200, or to transmit data between the electronic device 200 and a peripheral device. The USB interface 230 may also be used to connect headphones to play audio. The interface may also be used to connect other electronic devices, such as AR devices.
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备200的结构限定。在本申请的另一些实施例中,电子设备200也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 200. In other embodiments of the present application, the electronic device 200 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
充电管理模块240用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块240可以通过USB接口230接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块240可以通过电子设备200的无线充电线圈接收无线充电输入。充电管理模块240为电池242充电的同时,还可以通过电源管理模块241为电子设备200供电。The charging management module 240 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 240 may receive charging input from a wired charger through the USB interface 230. In some wireless charging embodiments, the charging management module 240 may receive wireless charging input through a wireless charging coil of the electronic device 200. While the charging management module 240 is charging the battery 242, it may also power the electronic device 200 through the power management module 241.
电源管理模块241用于连接电池242,充电管理模块240与处理器210。电源管理模块241接收电池242和/或充电管理模块240的输入,为处理器210,内部存储器221,显示屏294,摄像头293,和无线通信模块252等供电。电源管理模块241还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块241也可以设置于处理器210中。在另一些实施例中,电源管理模块241和充电管理模块240也可以设置于同一个器件中。The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives input from the battery 242 and/or the charging management module 240, and supplies power to the processor 210, the internal memory 221, the display screen 294, the camera 293, and the wireless communication module 252. The power management module 241 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 241 can also be set in the processor 210. In other embodiments, the power management module 241 and the charging management module 240 can also be set in the same device.
电子设备200的无线通信功能可以通过天线1,天线2,移动通信模块251,无线通信模块252,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 200 can be implemented through the antenna 1, the antenna 2, the mobile communication module 251, the wireless communication module 252, the modem processor and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。电子设备200中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 200 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
移动通信模块251可以提供应用在电子设备200上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块251可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块251可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块251还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块251的至少部分功能模块可以被设置于处理器210中。在一些实施例中,移动通信模块251的至少部分功能模块可以与处理器210的至少部分模块被设置在同一个器件中。The mobile communication module 251 can provide solutions for wireless communications including 2G/3G/4G/5G applied to the electronic device 200. The mobile communication module 251 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 251 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 251 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 251 can be set in the processor 210. In some embodiments, at least some of the functional modules of the mobile communication module 251 can be set in the same device as at least some of the modules of the processor 210.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器270A,受话器270B等)输出声音信号,或通过显示屏294显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器210,与移动通信模块251或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 270A, a receiver 270B, etc.), or displays an image or video through a display screen 294. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 210 and be set in the same device as the mobile communication module 251 or other functional modules.
无线通信模块252可以提供应用在电子设备200上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency  modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块252可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块252经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器210。无线通信模块252还可以从处理器210接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 252 can provide wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM) and other communication functions applied to the electronic device 200. The wireless communication module 252 can be one or more devices integrating at least one communication processing module. The wireless communication module 252 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 210. The wireless communication module 252 can also receive the signal to be sent from the processor 210, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
在一些实施例中,电子设备200的天线1和移动通信模块251耦合,天线2和无线通信模块252耦合,使得电子设备200可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),新无线接入技术(new radio access technology,NR),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。In some embodiments, the antenna 1 of the electronic device 200 is coupled to the mobile communication module 251, and the antenna 2 is coupled to the wireless communication module 252, so that the electronic device 200 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), new radio access technology (NR), BT, GNSS, WLAN, NFC, FM, and/or IR technology.
可选的,GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。Optionally, GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and/or a satellite based augmentation system (SBAS).
电子设备200通过GPU,显示屏294,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏294和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器210可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 200 implements the display function through a GPU, a display screen 294, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 210 may include one or more GPUs, which execute program instructions to generate or change display information.
显示屏294用于显示图像,视频等。显示屏294包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。The display screen 294 is used to display images, videos, etc. The display screen 294 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diodes (QLED), etc.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断自学习。通过NPU可以实现电子设备200的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the electronic device 200 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
压力传感器280A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器280A可以设置于显示屏294。压力传感器280A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器280A,电极之间的电容改变。电子设备200根据电容的变化确定压力的强度。当有触摸操作作用于显示屏294,电子设备200根据压力传感器280A检测所述触摸操作强度。电子设备200也可以根据压力传感器280A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。The pressure sensor 280A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 280A can be set on the display screen 294. There are many types of pressure sensors 280A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 280A, the capacitance between the electrodes changes. The electronic device 200 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 294, the electronic device 200 detects the intensity of the touch operation according to the pressure sensor 280A. The electronic device 200 can also calculate the position of the touch based on the detection signal of the pressure sensor 280A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions.
陀螺仪传感器280B可以用于确定电子设备200的运动姿态。在一些实施例中,可以通过陀螺仪传感器280B确定电子设备200围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器280B可以用于拍摄防抖。陀螺仪传感器280B还可以用于导航,体感游戏场景。 The gyro sensor 280B can be used to determine the motion posture of the electronic device 200. In some embodiments, the angular velocity of the electronic device 200 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 280B. The gyro sensor 280B can be used for shooting anti-shake. The gyro sensor 280B can also be used for navigation and somatosensory game scenes.
气压传感器280C用于测量气压。在一些实施例中,电子设备200通过气压传感器280C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 280C is used to measure air pressure. In some embodiments, the electronic device 200 calculates the altitude through the air pressure value measured by the air pressure sensor 280C to assist in positioning and navigation.
加速度传感器280D可检测电子设备200在各个方向上(一般为三轴)加速度的大小。当电子设备200静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 280D can detect the magnitude of the acceleration of the electronic device 200 in all directions (generally three axes). When the electronic device 200 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
接近光传感器280E可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备200通过发光二极管向外发射红外光。电子设备200使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备200附近有物体。当检测到不充分的反射光时,电子设备200可以确定电子设备200附近没有物体。电子设备200可以利用接近光传感器280E检测用户手持电子设备200贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器280E也可用于皮套模式,口袋模式自动解锁与锁屏。The proximity light sensor 280E may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 200 emits infrared light outward through the light emitting diode. The electronic device 200 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 200. When insufficient reflected light is detected, the electronic device 200 can determine that there is no object near the electronic device 200. The electronic device 200 can use the proximity light sensor 280E to detect that the user holds the electronic device 200 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 280E can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
环境光传感器280F用于感知环境光亮度。电子设备200可以根据感知的环境光亮度自适应调节显示屏294亮度。环境光传感器280F也可用于拍照时自动调节白平衡。环境光传感器280F还可以与接近光传感器280E配合,检测电子设备200是否在口袋里,以防误触。The ambient light sensor 280F is used to sense the ambient light brightness. The electronic device 200 can adaptively adjust the brightness of the display screen 294 according to the perceived ambient light brightness. The ambient light sensor 280F can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 280F can also cooperate with the proximity light sensor 280E to detect whether the electronic device 200 is in a pocket to prevent accidental touch.
指纹传感器280G用于采集指纹。电子设备200可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。例如,可以在电子设备200的正面(显示屏294的下方)配置指纹传感器,或者,在电子设备200的背面(后置摄像头的下方)配置指纹传感器。另外,也可以通过在触控屏中配置指纹传感器来实现指纹识别功能,即指纹传感器可以与触控屏集成在一起来实现电子设备200的指纹识别功能。在这种情况下,该指纹传感器可以配置在触控屏中,可以是触控屏的一部分,也可以是以其他方式配置在触控屏中。The fingerprint sensor 280G is used to collect fingerprints. The electronic device 200 can use the collected fingerprint characteristics to realize fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc. For example, a fingerprint sensor can be configured on the front of the electronic device 200 (below the display screen 294), or a fingerprint sensor can be configured on the back of the electronic device 200 (below the rear camera). In addition, the fingerprint recognition function can also be realized by configuring a fingerprint sensor in the touch screen, that is, the fingerprint sensor can be integrated with the touch screen to realize the fingerprint recognition function of the electronic device 200. In this case, the fingerprint sensor can be configured in the touch screen, can be a part of the touch screen, or can be configured in the touch screen in other ways.
另外,该指纹传感器还可以被实现为全面板指纹传感器,因此,可以把触控屏看成是任何位置可都可以进行指纹采集的一个面板。在一些实施例中,该指纹传感器可以对采集到的指纹进行处理(例如指纹是否验证通过)发送给处理器210,由处理器210根据指纹处理结果做出相应的处理。在另一些实施例中,指纹传感器还可以将采集到的指纹发送给处理器210,以便处理器210对该指纹进行处理(例如指纹验证等)。本申请中的指纹传感器可以采用任何类型的感测技术,包括但不限于光学式、电容式、压电式或超声波传感技术等。In addition, the fingerprint sensor can also be implemented as a full-panel fingerprint sensor, so the touch screen can be regarded as a panel where fingerprints can be collected at any position. In some embodiments, the fingerprint sensor can process the collected fingerprint (for example, whether the fingerprint is verified) and send it to the processor 210, and the processor 210 makes corresponding processing according to the fingerprint processing result. In other embodiments, the fingerprint sensor can also send the collected fingerprint to the processor 210 so that the processor 210 processes the fingerprint (for example, fingerprint verification, etc.). The fingerprint sensor in this application can adopt any type of sensing technology, including but not limited to optical, capacitive, piezoelectric or ultrasonic sensing technology.
温度传感器280H用于检测温度。在一些实施例中,电子设备200利用温度传感器280H检测的温度,执行温度处理策略。例如,当温度传感器280H上报的温度超过阈值,电子设备200执行降低位于温度传感器280H附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备200对电池242加热,以避免低温导致电子设备200异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备200对电池242的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 280H is used to detect temperature. In some embodiments, the electronic device 200 uses the temperature detected by the temperature sensor 280H to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 280H exceeds a threshold, the electronic device 200 reduces the performance of a processor located near the temperature sensor 280H to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 200 heats the battery 242 to avoid abnormal shutdown of the electronic device 200 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 200 performs a boost on the output voltage of the battery 242 to avoid abnormal shutdown caused by low temperature.
触摸传感器280I,也称“触控面板”。触摸传感器280I可以设置于显示屏294,由触摸传感器280I与显示屏294组成触控屏,也称“触摸屏”。触摸传感器280I用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏294提供与触摸操作相关的视觉输出。在另一些实施例 中,触摸传感器280I也可以设置于电子设备200的表面,与显示屏294所处的位置不同。The touch sensor 280I is also called a "touch panel". The touch sensor 280I can be set on the display screen 294. The touch sensor 280I and the display screen 294 form a touch screen, also called a "touch screen". The touch sensor 280I is used to detect a touch operation acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 294. In other embodiments In the embodiment, the touch sensor 280I may also be disposed on the surface of the electronic device 200, which is different from the position of the display screen 294.
基于图2所示的电子设备,本申请实施例还提供了一种电子设备的功能模块结构。参见图3,按照电子设备的逻辑功能进行划分,可以划分出以下模块:目标字体选取模块、文字美化生成模块以及美化程度模块等。下面分别对各个模块的功能进行说明。Based on the electronic device shown in FIG2 , the embodiment of the present application further provides a functional module structure of the electronic device. Referring to FIG3 , according to the logical functions of the electronic device, the following modules can be divided: a target font selection module, a text beautification generation module, and a beautification degree module. The functions of each module are described below.
目标字体选取模块用于响应于用户的手动选择确定目标字体,或者用于对用户在触控屏上触发的相应操作产生的文字轨迹进行笔迹特征提取,并根据提取出的笔迹特征向量从字体库中确定对应的目标字体。The target font selection module is used to determine the target font in response to the user's manual selection, or to extract handwriting features of the text track generated by the corresponding operation triggered by the user on the touch screen, and determine the corresponding target font from the font library based on the extracted handwriting feature vector.
示例性地,以用户手动选择确定目标字体为例,目标字体选取模块响应于用户在触控屏上的相应操作(比如用户在触控屏上点击目标字体按钮),在触控屏上显示目标字体选择框,用户可以从目标字体选择框中选择楷书、草书或宋体等标准字体,或者也可以从目标字体选择框中选择某一个网络热门字体。然后,目标字体选取模块响应于用户在目标字体选择框中选中某一字体的操作,确定该字体为用户所需的目标字体。For example, taking the case where the user manually selects and determines the target font, the target font selection module responds to the user's corresponding operation on the touch screen (such as the user clicking the target font button on the touch screen) and displays a target font selection box on the touch screen. The user can select a standard font such as Kaishu, Caoshu or Songti from the target font selection box, or can also select a popular online font from the target font selection box. Then, the target font selection module responds to the user's operation of selecting a font in the target font selection box and determines that the font is the target font required by the user.
文字美化生成模块用于通过风格识别模型提取用户在触控屏上产生的文字轨迹的第一风格,并通过风格识别模型提取目标字体对应的文字模型的第二风格。然后,文字美化生成模块将第一风格和第二风格进行融合,生成第三风格,并根据第三风格对用户在触控屏上产生的文字轨迹进行美化处理,生成美化后的文字轨迹。The text beautification generation module is used to extract the first style of the text track generated by the user on the touch screen through the style recognition model, and extract the second style of the text model corresponding to the target font through the style recognition model. Then, the text beautification generation module merges the first style and the second style to generate a third style, and performs beautification processing on the text track generated by the user on the touch screen according to the third style to generate a beautified text track.
示例性地,以用户在触控屏上书写了某一文字(比如“永”)为例,并假设目标字体为楷书。文字美化生成模块可以通过风格识别模型,比如预训练好的基于GAN的深度神经网络模型,提取用户书写的文字“永”的风格,并可以通过风格识别模型提取某一楷书文字(比如“永”)的风格。然后,将用户书写的文字“永”的风格与楷书文字“永”的风格进行融合,生成融合后的风格,并根据融合后的风格对用户书写的文字“永”进行美化处理,生成美化后的文字“永”。Exemplarily, a user writes a certain word (such as "永") on the touch screen, and it is assumed that the target font is regular script. The text beautification generation module can extract the style of the word "永" written by the user through a style recognition model, such as a pre-trained GAN-based deep neural network model, and can extract the style of a regular script word (such as "永") through a style recognition model. Then, the style of the word "永" written by the user is merged with the style of the regular script word "永" to generate a merged style, and the word "永" written by the user is beautified according to the merged style to generate a beautified word "永".
当然,文字美化生成模块也可以通过风格识别模型提取其它楷书文字(比如楷书文字“你”、“我”或“他”等)的风格,将其它楷书文字的风格与用户书写的文字“永”的风格进行融合,本申请实施例对此并不作限定。Of course, the text beautification generation module can also extract the styles of other regular script characters (such as the regular script characters "you", "I" or "he", etc.) through the style recognition model, and merge the styles of other regular script characters with the style of the text "永" written by the user. The embodiment of the present application is not limited to this.
可选的,文字美化生成模块在将第一风格和第二风格进行融合的过程中,也可以获取配置好的用于调整用户在触控屏上产生的文字轨迹的美化程度的美化参数值,或者也可以获取用户选择或输入的用于调整用户在触控屏上产生的文字轨迹的美化程度的美化参数值。然后,文字美化生成模块将美化参数值、第一风格和第二风格进行融合,生成第三风格。Optionally, in the process of fusing the first style and the second style, the text beautification generation module may also obtain a configured beautification parameter value for adjusting the beautification degree of the text track generated by the user on the touch screen, or may also obtain a beautification parameter value selected or input by the user for adjusting the beautification degree of the text track generated by the user on the touch screen. Then, the text beautification generation module fuses the beautification parameter value, the first style and the second style to generate a third style.
美化程度模块用于根据用户选择或输入的美化参数值对用户在触控屏上产生的文字轨迹进行调整。The beautification degree module is used to adjust the text track generated by the user on the touch screen according to the beautification parameter value selected or input by the user.
例如,美化程度模块响应于用户在触控屏上的某一操作(比如用户在触控屏上点击美化参数值输入按钮),显示美化参数值输入框,用户可以在美化参数值输入框中输入相应的美化参数值。For example, the beautification degree module responds to a certain operation of the user on the touch screen (such as the user clicking a beautification parameter value input button on the touch screen) and displays a beautification parameter value input box, in which the user can input a corresponding beautification parameter value.
示例性地,美化程度模块响应于用户在触控屏上点击美化参数值输入按钮,显示美化参数值输入框,比如用户在美化参数值输入框中输入5,则5可以作为调整用户在触控屏上产生的文字轨迹的美化程度的美化参数值。Exemplarily, the beautification degree module displays a beautification parameter value input box in response to the user clicking a beautification parameter value input button on the touch screen. For example, if the user enters 5 in the beautification parameter value input box, 5 can be used as the beautification parameter value for adjusting the beautification degree of the text trajectory generated by the user on the touch screen.
再例如,美化程度模块响应于用户在触控屏上的其它操作(比如用户在触控屏上点击 美化参数值选择按钮),显示美化参数值选择框,比如,如图4a所示意的滑杆式的美化参数值选择框(用户可以调节滑杆按钮来选择相应的美化参数值)、如图4b所示意的包含多个美化参数值的选择框(用户可以从多个美化参数值中选择相应的美化参数值)、如图4c所示意的滑动按钮式的美化参数值选择框(用户可以通过滑动按钮来选择相应的美化参数值)等。For another example, the beautification degree module responds to other operations of the user on the touch screen (such as the user clicking on the touch screen). Beautification parameter value selection button), displaying a beautification parameter value selection box, for example, a slide bar type beautification parameter value selection box as shown in FIG4a (the user can adjust the slide bar button to select the corresponding beautification parameter value), a selection box containing multiple beautification parameter values as shown in FIG4b (the user can select the corresponding beautification parameter value from multiple beautification parameter values), a slide button type beautification parameter value selection box as shown in FIG4c (the user can select the corresponding beautification parameter value by sliding the button), etc.
示例性地,以滑杆式的美化参数值选择框为例,美化程度模块响应于用户在触控屏上点击美化参数值选择按钮,显示滑杆式的美化参数值选择框,比如滑杆式的美化参数值选择框的取值范围为1-10,用户可以通过调节滑杆按钮来选择一个美化参数值(比如美化参数值为3),则3可以作为调整用户在触控屏上产生的文字轨迹的美化程度的美化参数值。Exemplarily, taking a slider-type beautification parameter value selection box as an example, the beautification degree module displays a slider-type beautification parameter value selection box in response to the user clicking a beautification parameter value selection button on the touch screen. For example, the value range of the slider-type beautification parameter value selection box is 1-10, and the user can select a beautification parameter value (for example, the beautification parameter value is 3) by adjusting the slider button. Then 3 can be used as a beautification parameter value for adjusting the beautification degree of the text trajectory generated by the user on the touch screen.
下面结合附图介绍本申请实施例提供的一种文字美化方法。该方法适用于具有触控屏的电子设备,例如图1所示意的电子设备200。如图5所示,该方法包括:A text beautification method provided by an embodiment of the present application is described below in conjunction with the accompanying drawings. The method is applicable to an electronic device with a touch screen, such as the electronic device 200 shown in FIG. 1 . As shown in FIG. 5 , the method includes:
步骤501:响应于用户在触控屏上的第一操作,生成第一文字轨迹。Step 501: In response to a first operation of a user on a touch screen, a first text track is generated.
可选的,当电子设备中安装有文字书写应用程序时,如果用户需要通过电子设备进行文字书写操作,则可以在电子设备的触控屏上点击文字书写应用程序(比如白板应用程序),文字书写应用程序响应于用户的点击操作,显示文字书写界面。然后,用户可以在文字书写界面上书写一个或多个文字,如此,一个或多个文字在文字书写界面上形成了对应的文字轨迹。Optionally, when a text writing application is installed in the electronic device, if the user needs to perform a text writing operation through the electronic device, the user can click the text writing application (such as a whiteboard application) on the touch screen of the electronic device, and the text writing application responds to the user's click operation and displays a text writing interface. Then, the user can write one or more characters on the text writing interface, so that the one or more characters form corresponding text tracks on the text writing interface.
可选的,当电子设备自身作为文字书写的设备(比如电子白板)时,用户可以直接在电子设备的触控屏上进行文字书写操作,比如用户可以在电子设备的触控屏上进行板书,或者用户也可以在电子设备的触控屏上进行书写会议内容等。如此,用户在电子设备的触控屏上书写的一个或多个文字形成了对应的文字轨迹。Optionally, when the electronic device itself is used as a text writing device (such as an electronic whiteboard), the user can directly perform text writing operations on the touch screen of the electronic device, for example, the user can write on the blackboard on the touch screen of the electronic device, or the user can also write meeting content on the touch screen of the electronic device. In this way, one or more characters written by the user on the touch screen of the electronic device form corresponding text tracks.
示例性地,以电子设备为电子白板为例。比如,用户在参加公司举办的某一企业会议的过程中需要手写展示相关的会议内容,则用户可以在电子白板的触控屏上书写相应的会议内容,例如用户在电子白板的触控屏上书写了多个文字“第二季度企业的销售额”。如此,多个文字“第二季度企业的销售额”在电子白板的触控屏上形成了对应的文字轨迹。For example, the electronic device is an electronic whiteboard. For example, when a user attends a corporate meeting held by a company and needs to handwrite relevant meeting content, the user can write the corresponding meeting content on the touch screen of the electronic whiteboard. For example, the user writes multiple words "Second quarter corporate sales" on the touch screen of the electronic whiteboard. In this way, multiple words "Second quarter corporate sales" form corresponding text tracks on the touch screen of the electronic whiteboard.
步骤502:对第一文字轨迹进行识别,获取第一文字轨迹的第一风格。Step 502: Recognize the first text track to obtain the first style of the first text track.
可选的,电子设备可以通过风格识别模型对第一文字轨迹进行识别,得到第一文字轨迹的第一风格。其中,第一风格可以用于表征第一文字轨迹具有的字型特征。应理解,该风格识别模型可以是基于样本进行监督学习得到的,并存储于电子设备中。Optionally, the electronic device may identify the first text track through a style recognition model to obtain a first style of the first text track. The first style may be used to characterize the font features of the first text track. It should be understood that the style recognition model may be obtained through supervised learning based on samples and stored in the electronic device.
可选的,电子设备也可以通过风格提取模型对第一文字轨迹进行风格提取,得到第一文字轨迹的第一风格。示例性地,风格提取模型可以为预训练好的VGG-16(Visual Geometry Group Network 16,视觉几何组网络)模型或预训练好的RNN(Recurrent Neural Network,循环神经网络)模型或预训练好的基于GAN的深度神经网络模型或预训练好的CNN模型等,本申请实施例对此并不作限定。应理解,该风格提取模型可以是基于样本进行监督学习得到的,并存储于电子设备中。Optionally, the electronic device may also perform style extraction on the first text track through a style extraction model to obtain a first style of the first text track. Exemplarily, the style extraction model may be a pre-trained VGG-16 (Visual Geometry Group Network 16) model or a pre-trained RNN (Recurrent Neural Network) model or a pre-trained GAN-based deep neural network model or a pre-trained CNN model, etc., and the embodiments of the present application are not limited to this. It should be understood that the style extraction model may be obtained through supervised learning based on samples and stored in the electronic device.
示例性地,参见图6a,为本申请实施例提供的一种风格识别模型识别文字轨迹的示意图。例如,以用户在电子设备的触控屏上书写的文字“霁”为例,对风格识别模型识别文字轨迹的识别过程进行介绍。For example, see Fig. 6a, which is a schematic diagram of a style recognition model recognizing a text track according to an embodiment of the present application. For example, taking the word "霁" written by a user on a touch screen of an electronic device as an example, the recognition process of the style recognition model recognizing a text track is introduced.
可选的,电子设备将用户在电子设备的触控屏上书写的文字“霁”对应的文字轨迹输 入到风格识别模型中,可以得到文字“霁”的风格,比如风格a。Optionally, the electronic device inputs the text track corresponding to the word "霁" written by the user on the touch screen of the electronic device By inputting it into the style recognition model, we can get the style of the word "霁", such as style a.
下面以训练风格识别模型为例,对风格识别模型的训练过程进行介绍。The following takes the training of the style recognition model as an example to introduce the training process of the style recognition model.
可选的,训练方式可以包括监督训练、非监督训练等,本申请实施例以监督训练为例对风格识别模型的训练过程进行介绍。Optionally, the training method may include supervised training, unsupervised training, etc. The embodiment of the present application takes supervised training as an example to introduce the training process of the style recognition model.
首先,获取训练样本集。First, obtain the training sample set.
例如,练样本集中可以包括文字样本以及文字样本的标签风格。For example, the training sample set may include text samples and the label styles of the text samples.
示例性地,该标签风格可以是人工标注结果,用于指示文字样本所属的风格。比如,训练样本集中第一个文字样本经过人工标注,它的人工标注结果为楷书对应的风格,训练样本集中第二个文字样本经过人工标注,它的人工标注结果为宋体对应的风格。如此,训练样本集中每个文字样本对应一个人工标注结果。Exemplarily, the label style may be a manual annotation result, which is used to indicate the style to which the text sample belongs. For example, the first text sample in the training sample set is manually annotated, and its manual annotation result is the style corresponding to Kaishu, and the second text sample in the training sample set is manually annotated, and its manual annotation result is the style corresponding to Songti. In this way, each text sample in the training sample set corresponds to a manual annotation result.
再者,将训练样本集中的第一文字样本输入初始的风格识别模型,得到第一文字样本的风格。Furthermore, the first text sample in the training sample set is input into the initial style recognition model to obtain the style of the first text sample.
示例性地,第一文字样本是训练样本集中的任一个文字样本。Exemplarily, the first text sample is any text sample in the training sample set.
然后,通过损失函数计算第一文字样本的风格与第一文字样本的标签风格之间的损失值。Then, the loss value between the style of the first text sample and the label style of the first text sample is calculated through the loss function.
示例性地,在得到损失值后,如果损失值大于损失阈值,则反向传播,更新初始的风格识别模型。然后,更新后的风格识别模型重新通过损失函数计算第二文字样本的风格与第二文字样本的标签风格之间的损失值。其中,第二文字样本是训练样本集中除第一文字样本之外的其它任一个文字样本。如果再次计算得到的损失值小于或等于损失阈值,则停止训练,否则继续反向传播以继续更新,直到更新后的风格识别模型得到的文字样本的风格与该文字样本的标签风格之间的损失值小于或等于损失阈值。Exemplarily, after obtaining the loss value, if the loss value is greater than the loss threshold, back propagation is performed to update the initial style recognition model. Then, the updated style recognition model recalculates the loss value between the style of the second text sample and the label style of the second text sample through the loss function. The second text sample is any other text sample in the training sample set except the first text sample. If the loss value calculated again is less than or equal to the loss threshold, the training is stopped, otherwise the back propagation is continued to continue updating until the loss value between the style of the text sample obtained by the updated style recognition model and the label style of the text sample is less than or equal to the loss threshold.
步骤503:获取目标字体的第二风格。Step 503: Obtain the second style of the target font.
示例性地,在具体实施过程中,电子设备可以通过如下方式获取目标字体的第二风格。Exemplarily, in a specific implementation process, the electronic device may obtain the second style of the target font in the following manner.
方式一:电子设备可以在生成第一文字轨迹之后,在字体库中选择与第一文字轨迹匹配的字体作为目标字体。然后,电子设备可以从风格库中确定目标字体的第二风格,或者也可以将目标字体对应的文字模型输入到风格识别模型中,得到目标字体的第二风格。可选的,字体库中包含至少一个字体,或者也可以包含至少一个字体的笔迹特征向量。其中,第二风格可以用于表征目标字体的文字轨迹具有的字型特征。Method 1: After generating the first text trajectory, the electronic device can select a font that matches the first text trajectory from the font library as the target font. Then, the electronic device can determine the second style of the target font from the style library, or input the text model corresponding to the target font into the style recognition model to obtain the second style of the target font. Optionally, the font library contains at least one font, or may also contain a handwriting feature vector of at least one font. The second style can be used to characterize the font features of the text trajectory of the target font.
其中,风格库包括多个字体以及该多个字体的风格。可选的,风格库可以是离线创建好的。应理解,风格库是可以定期更新的。比如,在创建风格库的实施方式中,针对任一个已存在的字体,电子设备可以将该字体对应的文字模型输入到风格识别模型中,得到该字体的风格,并可以将该字体以及该字体的风格存储至风格库。Among them, the style library includes multiple fonts and styles of the multiple fonts. Optionally, the style library can be created offline. It should be understood that the style library can be updated regularly. For example, in an implementation method of creating a style library, for any existing font, the electronic device can input the text model corresponding to the font into the style recognition model to obtain the style of the font, and can store the font and the style of the font in the style library.
示例性地,以字体为楷书为例,电子设备可以将楷书对应的文字模型(比如楷书文字“文”、“中”或“书”等)输入到风格识别模型中,得到楷书的风格。For example, taking the regular script as an example, the electronic device can input the text model corresponding to the regular script (such as the regular script characters "文", "中" or "书", etc.) into the style recognition model to obtain the style of the regular script.
基于上述内容,下面对电子设备在字体库中选择与第一文字轨迹匹配的字体作为目标字体的实现方式进行介绍。Based on the above content, the following introduces an implementation method in which the electronic device selects a font matching the first text track in a font library as a target font.
可选的,电子设备将第一文字轨迹输入到第一笔迹特征提取模型中,可以得到第一文字轨迹的第一笔迹特征向量。之后,电子设备可以根据第一笔迹特征向量以及字体库中的至少一个字体的笔迹特征向量,计算第一文字轨迹与至少一个字体中每个字体的相似度,如此可以得到至少一个相似度。可选的,电子设备也可以通过其它方式计算第一文字轨迹 与至少一个字体中每个字体的相似度,比如无需提取第一文字轨迹的第一笔迹特征向量,通过某种相似度匹配算法,直接计算第一文字轨迹与字体库中任一个字体的相似度。然后,电子设备可以从至少一个相似度中选择最大的相似度,并可以将最大的相似度对应的字体作为目标字体。示例性地,第一笔迹特征提取模型可以为具有记忆功能的神经网络模型,例如LSTM(Long Short-Term Memory,长短期记忆网络)模型。Optionally, the electronic device inputs the first text track into a first handwriting feature extraction model to obtain a first handwriting feature vector of the first text track. Afterwards, the electronic device can calculate the similarity between the first text track and each font in at least one font based on the first handwriting feature vector and the handwriting feature vector of at least one font in the font library, so as to obtain at least one similarity. Optionally, the electronic device can also calculate the first text track by other means. The similarity with each font in at least one font, for example, without extracting the first handwriting feature vector of the first text track, directly calculates the similarity between the first text track and any font in the font library through a similarity matching algorithm. Then, the electronic device can select the greatest similarity from at least one similarity, and can use the font corresponding to the greatest similarity as the target font. Exemplarily, the first handwriting feature extraction model can be a neural network model with memory function, such as an LSTM (Long Short-Term Memory) model.
示例性地,电子设备可以采用相似度匹配算法,比如欧几里得距离算法、皮尔逊相关系数算法或余弦相似度算法等,计算第一文字轨迹与至少一个字体中每个字体的相似度。Exemplarily, the electronic device may use a similarity matching algorithm, such as a Euclidean distance algorithm, a Pearson correlation coefficient algorithm, or a cosine similarity algorithm, to calculate the similarity between the first text track and each font in the at least one font.
例如,以相似度匹配算法为余弦相似度算法例,假设字体库中有3个字体,即字体a、字体b和字体c,并假设第一文字轨迹的笔迹特征向量为f,字体a的笔迹特征向量为a1,字体b的笔迹特征向量为b1,字体c的笔迹特征向量为c1。电子设备采用余弦相似度算法,对笔迹特征向量f与笔迹特征向量a1进行计算,计算出第一文字轨迹与字体a的相似度k1;对笔迹特征向量f与笔迹特征向量b1进行计算,计算出第一文字轨迹与字体b的相似度k2;对笔迹特征向量f与笔迹特征向量c1进行计算,计算出第一文字轨迹与字体c的相似度k3。比如,假设k1<k3<k2,则电子设备通过比较k1、k2和k3,可以确定第一文字轨迹与字体b的相似度是最大的,因此可以将字体b作为目标字体。For example, taking the cosine similarity algorithm as the similarity matching algorithm, it is assumed that there are three fonts in the font library, namely font a, font b and font c, and it is assumed that the handwriting feature vector of the first text track is f, the handwriting feature vector of font a is a1, the handwriting feature vector of font b is b1, and the handwriting feature vector of font c is c1. The electronic device uses the cosine similarity algorithm to calculate the handwriting feature vector f and the handwriting feature vector a1, and calculate the similarity k1 between the first text track and font a; calculate the handwriting feature vector f and the handwriting feature vector b1, and calculate the similarity k2 between the first text track and font b; calculate the handwriting feature vector f and the handwriting feature vector c1, and calculate the similarity k3 between the first text track and font c. For example, assuming k1<k3<k2, the electronic device can determine that the similarity between the first text track and font b is the largest by comparing k1, k2 and k3, so font b can be used as the target font.
示例性地,字体库中可以包括多个字体和/或该多个字体的笔迹特征向量。可选的,字体库可以是离线创建好的。应理解,字体库是可以实时或定期更新的。Exemplarily, the font library may include multiple fonts and/or handwriting feature vectors of the multiple fonts. Optionally, the font library may be created offline. It should be understood that the font library may be updated in real time or regularly.
例如,在创建字体库的实施方式中,针对任一个第三文字轨迹,电子设备将该第三文字轨迹输入到第一笔迹特征提取模型中,可以得到该第三文字轨迹的第二笔迹特征向量。之后,电子设备将该第二笔迹特征向量输入到字体鉴定模型(比如通过训练CNN得到的字体鉴定模型)中,可以得到该第三文字轨迹的字体。然后,电子设备可以将该第三文字轨迹的字体和/或该第三文字轨迹的第二笔迹特征向量存储至字体库中。For example, in the implementation of creating a font library, for any third text track, the electronic device inputs the third text track into the first handwriting feature extraction model to obtain the second handwriting feature vector of the third text track. Afterwards, the electronic device inputs the second handwriting feature vector into a font identification model (such as a font identification model obtained by training CNN) to obtain the font of the third text track. Then, the electronic device can store the font of the third text track and/or the second handwriting feature vector of the third text track in the font library.
其中,第三文字轨迹是根据任一个用户在触控屏上触发的第三操作生成的,比如用户在电子设备的触控屏上书写了一个或多个文字形成了对应的文字轨迹。应理解,第三文字轨迹是联机模式下在线书写的文字形成的轨迹,属于联机笔迹。The third text track is generated according to a third operation triggered by any user on the touch screen, such as a user writing one or more characters on the touch screen of the electronic device to form a corresponding text track. It should be understood that the third text track is a track formed by the characters written online in the online mode, and belongs to online handwriting.
示例性地,用户在电子设备的触控上书写了一个文字“你”,文字“你”可以在电子设备的触控上形成对应的文字轨迹。之后,电子设备将文字“你”对应的文字轨迹输入到LSTM模型中,可以得到文字“你”的笔迹特征向量。然后,电子设备将文字“你”的笔迹特征向量输入到字体鉴定模型中,可以得到文字“你”的字体。最后,电子设备可以将文字“你”的字体和/或文字“你”的笔迹特征向量存储至字体库中。Exemplarily, a user writes a word "you" on the touch screen of an electronic device, and the word "you" can form a corresponding text track on the touch screen of the electronic device. Afterwards, the electronic device inputs the text track corresponding to the word "you" into the LSTM model, and a handwriting feature vector of the word "you" can be obtained. Then, the electronic device inputs the handwriting feature vector of the word "you" into the font identification model, and the font of the word "you" can be obtained. Finally, the electronic device can store the font of the word "you" and/or the handwriting feature vector of the word "you" in the font library.
再例如,针对任一个目标文字模型,电子设备将该目标文字模型输入到第二笔迹特征提取模型中,可以得到该目标文字模型的第三笔迹特征向量。之后,电子设备将该第三笔迹特征向量输入到字体鉴定模型中,可以得到该目标文字模型的字体。然后,电子设备可以将该目标文字模型对应的字体和/或该目标文字模型的第三笔迹特征向量存储至字体库中。可选的,目标文字模型可以是脱机模式下的文字图像,属于脱机笔迹。可选的,目标文字模型可以是标准字体(比如楷书、宋书等)对应的文字图像,或者也可以是网络热门字体对应的文字图像等,本申请实施例对此并不作限定。示例性地,第二笔迹特征提取模型可以为不具有记忆功能的神经网络模型,例如通过训练CNN得到的笔迹特征提取模型。For another example, for any target text model, the electronic device inputs the target text model into the second handwriting feature extraction model to obtain the third handwriting feature vector of the target text model. Afterwards, the electronic device inputs the third handwriting feature vector into the font identification model to obtain the font of the target text model. Then, the electronic device can store the font corresponding to the target text model and/or the third handwriting feature vector of the target text model in the font library. Optionally, the target text model can be a text image in offline mode, which belongs to offline handwriting. Optionally, the target text model can be a text image corresponding to a standard font (such as regular script, Song script, etc.), or it can also be a text image corresponding to a popular font on the Internet, etc., and the embodiments of the present application are not limited to this. Exemplarily, the second handwriting feature extraction model can be a neural network model without a memory function, such as a handwriting feature extraction model obtained by training CNN.
示例性地,针对任一个脱机文字图像,例如楷书文字“我”的图像。电子设备将楷书文字“我”的图像输入到第二笔迹特征提取模型中,可以得到楷书文字“我”的图像对应 的笔迹特征向量。然后,电子设备将楷书文字“我”的图像对应的笔迹特征向量输入到字体鉴定模型中,可以得到楷书文字“我”的图像对应的字体。最后,电子设备可以将楷书文字“我”的图像对应的字体和/或楷书文字“我”的图像对应的笔迹特征向量存储至字体库中。For example, for any offline text image, such as the image of the regular script character “我”, the electronic device inputs the image of the regular script character “我” into the second handwriting feature extraction model, and can obtain the image corresponding to the regular script character “我”. Then, the electronic device inputs the handwriting feature vector corresponding to the image of the regular script character "I" into the font identification model, and the font corresponding to the image of the regular script character "I" can be obtained. Finally, the electronic device can store the font corresponding to the image of the regular script character "I" and/or the handwriting feature vector corresponding to the image of the regular script character "I" in the font library.
方式二:电子设备响应于用户在触控屏上的第二操作,获取目标字体。然后,电子设备可以从风格库中确定目标字体的第二风格,或者也可以将目标字体对应的文字模型输入风格识别模型,得到目标字体的第二风格。Method 2: The electronic device obtains the target font in response to the second operation of the user on the touch screen. Then, the electronic device can determine the second style of the target font from the style library, or input the text model corresponding to the target font into the style recognition model to obtain the second style of the target font.
基于上述内容,下面对电子设备响应于用户在触控屏上的第二操作,获取目标字体的实现方式进行介绍。Based on the above content, the following introduces an implementation method for the electronic device to obtain the target font in response to the second operation of the user on the touch screen.
可选的,电子设备上安装有用于用户选择目标字体的字体选择应用程序,当检测到用户在触控屏上作用于字体选择应用程序对应的字体选择图标的操作时,电子设备显示多个候选字体。之后,用户可以从多个候选字体中选择一个候选字体作为目标字体。比如,用户可以根据自己的需求进行选择哪一个候选字体作为目标字体。然后,电子设备响应于用户在多个候选字体中选中某一候选字体的操作,将用户选中的该候选字体作为目标字体。Optionally, a font selection application for the user to select a target font is installed on the electronic device. When the user's operation on the font selection icon corresponding to the font selection application is detected on the touch screen, the electronic device displays multiple candidate fonts. Afterwards, the user can select a candidate font from the multiple candidate fonts as the target font. For example, the user can select which candidate font to use as the target font according to his or her needs. Then, in response to the user's operation of selecting a candidate font from the multiple candidate fonts, the electronic device uses the candidate font selected by the user as the target font.
示例性地,当电子设备检测到用户作用于字体选择应用程序对应的字体选择图标的操作时,可以显示多个候选字体,比如显示如“楷书”、“草书”、“行书”和“宋体”等多个候选字体。假设用户根据自己的需求选择了“草书”,则电子设备可以将用户选择的“草书”作为目标字体。For example, when the electronic device detects that the user operates the font selection icon corresponding to the font selection application, multiple candidate fonts may be displayed, such as "Regular Script", "Cursive Script", "Running Script" and "Song Ti". Assuming that the user selects "Cursive Script" according to his needs, the electronic device may use the "Cursive Script" selected by the user as the target font.
步骤504:根据第一风格与第二风格,生成第三风格。Step 504: Generate a third style according to the first style and the second style.
在一种实施方式中,电子设备可以直接将第一风格与第二风格进行融合,生成第三风格。例如,电子设备可以将第一风格、第二风格输入到特征融合模型中,得到第三风格。示例性地,特征融合模型可以为基于注意力机制的风格迁移模型或基于注意力机制的字形变形模块(Attentive Font Morphing module,AFM)等。In one implementation, the electronic device may directly fuse the first style with the second style to generate a third style. For example, the electronic device may input the first style and the second style into a feature fusion model to obtain the third style. Exemplarily, the feature fusion model may be a style transfer model based on an attention mechanism or an Attentive Font Morphing module (AFM) based on an attention mechanism.
在另一种实施方式中,可以通过引入用于调整文字轨迹的美化程度的美化参数值,对第一风格和第二风格进行加权处理,来生成第三风格。In another embodiment, a beautification parameter value for adjusting the beautification degree of the text track may be introduced to perform weighted processing on the first style and the second style to generate a third style.
例如,电子设备可以将预先配置好的一个美化参数值(比如默认的美化参数值)、第一风格和第二风格输入到特征融合模型中,得到第三风格,或者也可以将预先配置好的多个美化参数值、第一风格和第二风格输入到特征融合模型中,得到第三风格。For example, the electronic device can input a preconfigured beautification parameter value (such as a default beautification parameter value), a first style, and a second style into a feature fusion model to obtain a third style, or it can input multiple preconfigured beautification parameter values, a first style, and a second style into a feature fusion model to obtain a third style.
再例如,电子设备也可以获取用户在美化参数值选择框中选择的一个或多个美化参数值或者用户在美化参数值输入框中输入的一个或多个美化参数值,并可以将用户选择或输入的一个或多个美化参数值、第一风格和第二风格输入到特征融合模型中,得到第三风格。For another example, the electronic device may also obtain one or more beautification parameter values selected by the user in a beautification parameter value selection box or one or more beautification parameter values entered by the user in a beautification parameter value input box, and may input the one or more beautification parameter values selected or entered by the user, the first style, and the second style into a feature fusion model to obtain a third style.
示例性地,电子设备对第一风格和第二风格的加权处理可以满足下述形式。
Vx′=Vx1*α+Vx2
Exemplarily, the weighted processing of the first style and the second style by the electronic device may satisfy the following form.
V x ′=V x1 *α+V x2
其中,Vx′表示加权处理后得到的第三风格,Vx1表示第一风格,Vx2表示第二风格,α、β表示用户选择或输入的美化参数值。Wherein, V x ′ represents the third style obtained after weighted processing, V x1 represents the first style, V x2 represents the second style, and α and β represent beautification parameter values selected or input by the user.
示例性地,参见图6b,为本申请实施例提供的一种生成第三风格的示意图。例如,以用户在电子设备的触控屏上书写的文字“霁”为例,且以目标字体对应的文字模型“永”为例,对生成第三风格的过程进行介绍。For example, see Fig. 6b, which is a schematic diagram of generating a third style provided by an embodiment of the present application. For example, taking the word "霁" written by a user on a touch screen of an electronic device as an example, and taking the word model "永" corresponding to the target font as an example, the process of generating the third style is introduced.
可选的,电子设备将用户在电子设备的触控屏上书写的文字“霁”对应的文字轨迹输 入到风格识别模型中,可以得到文字“霁”的风格,比如风格a。此外,电子设备将目标字体对应的文字模型“永”输入到风格识别模型中,可以得到目标字体的风格,比如风格b。然后,电子设备将用于调整文字轨迹的美化程度的一个美化参数值(比如美化参数值1)、风格a、风格b输入到基于注意力机制的风格迁移模型中,可以得到融合后的风格,比如风格c。Optionally, the electronic device inputs the text track corresponding to the word "霁" written by the user on the touch screen of the electronic device Into the style recognition model, the style of the word "霁" can be obtained, such as style a. In addition, the electronic device inputs the word model "永" corresponding to the target font into the style recognition model to obtain the style of the target font, such as style b. Then, the electronic device inputs a beautification parameter value (such as beautification parameter value 1) for adjusting the beautification degree of the text track, style a, and style b into the style transfer model based on the attention mechanism to obtain a fused style, such as style c.
步骤505:根据第三风格,对第一文字轨迹进行美化处理,得到第二文字轨迹。Step 505: Beautify the first text track according to the third style to obtain a second text track.
可选的,电子设备在生成第一文字轨迹之后,也可以将第一文字轨迹通过OCR(Optical Character Recognition,光学字符识别)技术,提取出第一文字轨迹的字符。然后,在得到第三风格之后,电子设备将第三风格以及第一文字轨迹的字符通过解码器进行解码处理,可以得到美化后的第一文字轨迹,即第二文字轨迹。Optionally, after generating the first text track, the electronic device may also extract the characters of the first text track through OCR (Optical Character Recognition) technology. Then, after obtaining the third style, the electronic device decodes the third style and the characters of the first text track through a decoder to obtain the beautified first text track, that is, the second text track.
示例性地,该解码器可以与作为编码器的风格识别模型相对应,或者该解码器也可以与作为编码器的风格提取模型或风格识别模型相对应。比如,解码器可以由反卷积层、归一化层、激活层等组成。Exemplarily, the decoder may correspond to the style recognition model as the encoder, or the decoder may correspond to the style extraction model or the style recognition model as the encoder. For example, the decoder may be composed of a deconvolution layer, a normalization layer, an activation layer, and the like.
可选的,电子设备在生成第一文字轨迹之后,也可以将第一文字轨迹输入到字符识别模型(比如通过训练CNN得到的字符识别模型)中,得到第一文字轨迹的字符。然后,在得到第三风格之后,电子设备将第三风格以及第一文字轨迹的字符通过解码器进行解码处理,可以得到美化后的第一文字轨迹,即第二文字轨迹。Optionally, after generating the first text track, the electronic device may also input the first text track into a character recognition model (such as a character recognition model obtained by training CNN) to obtain the characters of the first text track. Then, after obtaining the third style, the electronic device decodes the third style and the characters of the first text track through a decoder to obtain the beautified first text track, i.e., the second text track.
示例性地,参见图6c,为本申请实施例提供的一种生成第二文字轨迹的示意图。例如,以用户在电子设备的触控屏上书写的文字“霁”为例,对生成第二文字轨迹的过程进行介绍。For example, see Fig. 6c, which is a schematic diagram of generating a second text track provided by an embodiment of the present application. For example, taking the word "霁" written by a user on the touch screen of an electronic device as an example, the process of generating the second text track is introduced.
例如,电子设备将文字“霁”的字符和文字“霁”对应的融合后的风格(比如风格c)通过解码器进行解码处理,可以得到美化后的文字“霁”。For example, the electronic device decodes the characters of the word "霁" and the fused style (such as style c) corresponding to the word "霁" through a decoder to obtain the beautified word "霁".
步骤506:在触控屏上显示第二文字轨迹。Step 506: Display a second text track on the touch screen.
可选的,电子设备在得到第二文字轨迹后,通过触控屏显示该第二文字轨迹。例如,以用户在电子设备的触控屏上书写的文字“霁”为例,在电子设备对文字“霁”对应的文字轨迹进行美化处理后,得到美化后的文字“霁”。然后,电子设备可以在触控屏上显示美化后的文字“霁”。Optionally, after obtaining the second text track, the electronic device displays the second text track through the touch screen. For example, taking the text "霁" written by the user on the touch screen of the electronic device as an example, after the electronic device performs beautification processing on the text track corresponding to the text "霁", the beautified text "霁" is obtained. Then, the electronic device can display the beautified text "霁" on the touch screen.
需要说明的是,以上各个实施例中涉及的每个步骤可以为相应的设备执行,也可以是该设备内的芯片、处理器或芯片系统等部件执行,本申请实施例并不对其构成限定。以上各实施例仅以由相应设备执行为例进行说明。It should be noted that each step involved in the above embodiments can be performed by a corresponding device, or by a chip, processor or chip system in the device, and the embodiments of the present application do not limit them. The above embodiments are only described by taking the corresponding device as an example.
需要说明的是,在以上各个实施例中,可以选择部分步骤进行实施,还可以调整图示中步骤的顺序进行实施,本申请对此不做限定。应理解,执行图示中的部分步骤、调整步骤的顺序或相互结合进行具体实施,均落在本申请的保护范围内。It should be noted that in the above embodiments, some steps can be selected for implementation, and the order of the steps in the diagram can be adjusted for implementation, and this application does not limit this. It should be understood that executing some steps in the diagram, adjusting the order of the steps, or combining them for specific implementation all fall within the scope of protection of this application.
可以理解的是,为了实现上述实施例中功能,上述实施例中涉及的各个设备包括了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本申请中所公开的实施例描述的各示例的单元及方法步骤,本申请能够以硬件或硬件和计算机软件相结合的形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用场景和设计约束条件。It is understandable that, in order to implement the functions in the above embodiments, the various devices involved in the above embodiments include hardware structures and/or software modules corresponding to the execution of the various functions. It should be easily appreciated by those skilled in the art that, in combination with the units and method steps of the various examples described in the embodiments disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.
应注意:本申请实施例中的“步骤”仅是个示意,是为了更好的理解实施例所采用的一种表现方法,不对本申请的方案的执行构成实质性限定,例如:该“步骤”还可以理解 成“特征”。此外,该步骤不对本申请方案的执行顺序构成任何限定,任何在此基础上做出的不影响整体方案实现的步骤顺序改变或步骤合并或步骤拆分等操作,所形成的新的技术方案也在本申请公开的范围之内。It should be noted that the "steps" in the embodiments of the present application are merely illustrative and are a method of expression used to better understand the embodiments. They do not constitute a substantial limitation on the execution of the solutions of the present application. For example, the "steps" can also be understood as In addition, this step does not constitute any limitation on the execution order of the solution of this application. Any new technical solution formed by any change in the order of steps, merging steps, or splitting steps made on this basis that does not affect the implementation of the overall solution is also within the scope of the disclosure of this application.
基于相同的技术构思,本申请实施例还提供了一种可能的电子设备,所述电子设备适用于如图1所示的应用场景中。所述电子设备用于实现以上实施例提供的文字美化方法,或者所述电子设备的模块(比如芯片)用于实现以上实施例提供的文字美化方法,因此也能实现上述实施例所具备的有益效果。在本申请实施例中,所述电子设备可以是如图1所示意的电子设备200。Based on the same technical concept, the embodiment of the present application also provides a possible electronic device, which is suitable for the application scenario shown in Figure 1. The electronic device is used to implement the text beautification method provided in the above embodiment, or the module (such as a chip) of the electronic device is used to implement the text beautification method provided in the above embodiment, so the beneficial effects of the above embodiment can also be achieved. In the embodiment of the present application, the electronic device can be an electronic device 200 as shown in Figure 1.
参见图7,所述电子设备700包括获取模块701和处理模块702。所述处理模块702,用于响应于用户在触控屏上的第一操作,生成第一文字轨迹;所述处理模块702,用于对第一文字轨迹进行识别,获取第一文字轨迹的第一风格;其中,第一风格用于表征第一文字轨迹具有的字型特征;所述获取模块701,用于获取目标字体的第二风格;第二风格用于表征目标字体的文字轨迹具有的字型特征;所述处理模块702,还用于根据第一风格与第二风格,生成第三风格;所述处理模块702,还用于根据第三风格,对第一文字轨迹进行美化处理,得到第二文字轨迹;所述处理模块702,还用于在触控屏上显示第二文字轨迹。Referring to FIG. 7 , the electronic device 700 includes an acquisition module 701 and a processing module 702. The processing module 702 is used to generate a first text track in response to a first operation of a user on the touch screen; the processing module 702 is used to identify the first text track and obtain a first style of the first text track; wherein the first style is used to characterize the font features of the first text track; the acquisition module 701 is used to obtain a second style of the target font; the second style is used to characterize the font features of the text track of the target font; the processing module 702 is also used to generate a third style based on the first style and the second style; the processing module 702 is also used to beautify the first text track according to the third style to obtain the second text track; the processing module 702 is also used to display the second text track on the touch screen.
关于上述获取模块701和处理模块702更详细的描述,可参考上述方法实施例中的相关描述,在此不再一一赘述。For a more detailed description of the acquisition module 701 and the processing module 702, please refer to the relevant description in the above method embodiment, which will not be repeated here.
应理解,本申请实施例中的获取模块701可以由通信接口或通信接口相关电路组件实现,处理模块702可以由处理器或处理器相关电路组件实现。It should be understood that the acquisition module 701 in the embodiment of the present application can be implemented by a communication interface or a communication interface related circuit component, and the processing module 702 can be implemented by a processor or a processor related circuit component.
需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。It should be noted that the division of modules in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
基于相同的构思,本申请实施例还提供了一种可能的电子设备,所述电子设备适用于如图1所示的应用场景中。所述电子设备用于实现以上实施例提供的文字美化方法,因此也能实现上述方法实施例所具备的有益效果。参见图8所示,所述电子设备800包括:通信接口801、处理器802。可选的,所述电子设备还包括存储器803。其中,所述通信接口801、所述处理器802以及所述存储器803之间相互连接。当所述电子设备800用于实现以上实施例提供的方法时,通信接口801可用于实现上述获取模块701的功能,处理器802用于实现上述处理模块702的功能。 Based on the same concept, the embodiment of the present application also provides a possible electronic device, which is suitable for the application scenario shown in Figure 1. The electronic device is used to implement the text beautification method provided in the above embodiment, and therefore can also achieve the beneficial effects of the above method embodiment. As shown in Figure 8, the electronic device 800 includes: a communication interface 801 and a processor 802. Optionally, the electronic device also includes a memory 803. Among them, the communication interface 801, the processor 802 and the memory 803 are interconnected. When the electronic device 800 is used to implement the method provided in the above embodiment, the communication interface 801 can be used to implement the function of the above acquisition module 701, and the processor 802 is used to implement the function of the above processing module 702.
可选的,所述通信接口801、所述处理器802以及所述存储器803之间通过总线804相互连接。所述总线804可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图8中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。Optionally, the communication interface 801, the processor 802 and the memory 803 are interconnected via a bus 804. The bus 804 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, FIG8 is represented by only one thick line, but it does not mean that there is only one bus or one type of bus.
所述通信接口801,用于接收和发送数据,实现与图1所示意的电子设备中的其它功能部件之间的通信,或者也可以实现与电子设备以外的其它设备进行通信。可选的,所述通信接口801可以为输入输出接口。例如,所述电子设备可以使用通信接口与触控屏进行通信,或者所述电子设备也可以使用通信接口与其它电子设备进行通信。The communication interface 801 is used to receive and send data, realize communication with other functional components in the electronic device shown in FIG1, or realize communication with other devices other than the electronic device. Optionally, the communication interface 801 can be an input and output interface. For example, the electronic device can use the communication interface to communicate with a touch screen, or the electronic device can also use the communication interface to communicate with other electronic devices.
所述处理器802的功能可以参照以上实施例中的描述,此处不再赘述。其中,处理器802可以是中央处理器(central processing unit,CPU),网络处理器(network processor,NP)或者CPU和NP的组合等等。处理器802还可以进一步包括硬件芯片。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(complex programmable logic device,CPLD),现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。处理器802在实现上述功能时,可以通过硬件实现,当然也可以通过硬件执行相应的软件实现。The functions of the processor 802 can refer to the description in the above embodiments, and will not be repeated here. Among them, the processor 802 can be a central processing unit (CPU), a network processor (NP) or a combination of CPU and NP, etc. The processor 802 can further include a hardware chip. The above-mentioned hardware chip can be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. When the processor 802 realizes the above-mentioned functions, it can be realized by hardware, and of course, it can also be realized by executing the corresponding software through hardware.
所述存储器803,用于存放程序指令等。具体地,程序指令可以包括程序代码,该程序代码包括计算机操作指令。存储器803可能包含随机存取存储器(random access memory,RAM),也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。处理器802执行存储器803所存放的程序指令,实现上述功能,从而实现上述实施例提供的方法。The memory 803 is used to store program instructions, etc. Specifically, the program instructions may include program codes, and the program codes include computer operation instructions. The memory 803 may include random access memory (RAM), and may also include non-volatile memory (non-volatile memory), such as at least one disk memory. The processor 802 executes the program instructions stored in the memory 803 to implement the above functions, thereby implementing the method provided in the above embodiment.
基于相同的构思,本申请实施例还提供了一种计算机程序产品,所述计算机程序产品包括计算机程序或指令,当所述计算机程序或指令在计算机上运行时,使得所述计算机执行以上实施例提供的方法。Based on the same concept, an embodiment of the present application further provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed on a computer, the computer executes the method provided in the above embodiment.
基于相同的构思,本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序或指令,当所述计算机程序或指令被计算机执行时,使得所述计算机执行以上实施例提供的方法。Based on the same concept, an embodiment of the present application also provides a computer-readable storage medium, in which a computer program or instruction is stored. When the computer program or instruction is executed by a computer, the computer executes the method provided in the above embodiment.
其中,存储介质可以是计算机能够存取的任何可用介质。以此为例但不限于:计算机可读介质可以包括RAM、ROM、EEPROM、CD-ROM或其他光盘存储、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质。The storage medium may be any available medium that can be accessed by a computer. For example, but not limited to, a computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer.
基于相同的构思,本申请实施例还提供了一种芯片,所述芯片与存储器耦合,所述芯片用于读取存储器中存储的计算机程序,实现以上实施例提供的方法。Based on the same concept, an embodiment of the present application further provides a chip, which is coupled to a memory and is used to read a computer program stored in the memory to implement the method provided in the above embodiment.
基于相同的构思,本申请实施例还提供了一种芯片系统,该芯片系统包括处理器,用于支持计算机装置实现以上实施例中电子设备所涉及的功能。在一种可能的设计中,所述芯片系统还包括存储器,所述存储器用于保存该计算机装置必要的程序和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。Based on the same concept, the embodiment of the present application also provides a chip system, which includes a processor for supporting a computer device to implement the functions involved in the electronic device in the above embodiment. In a possible design, the chip system also includes a memory, which is used to store the necessary programs and data for the computer device. The chip system can be composed of chips, or it can include chips and other discrete devices.
本申请实施例提供的方法中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计 算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,高密度数字视频光盘(digital video disc,DVD))、或者半导体介质(例如,固态硬盘(solid state drive,SSD))等。The methods provided in the embodiments of the present application may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented by software, they may be implemented in whole or in part in the form of a computer program product. A computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a high-density digital video disc (DVD)), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.
本申请实施例中所描述的方法的步骤可以直接嵌入硬件、处理器执行的软件单元、或者这两者的结合。软件单元可以存储于RAM、ROM、EEPROM、寄存器、硬盘、可移动磁盘、CD-ROM或本领域中其它任意形式的存储媒介中。示例性地,存储媒介可以与处理器连接,以使得处理器可以从存储媒介中读取信息,并可以向存储媒介存写信息。可选的,存储媒介还可以集成到处理器中。处理器和存储媒介可以设置于ASIC中。The steps of the method described in the embodiments of the present application can be directly embedded in the software unit executed by the hardware, the processor, or a combination of the two. The software unit can be stored in a RAM, ROM, EEPROM, register, hard disk, removable disk, CD-ROM or other storage media of any form in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be arranged in an ASIC.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。 Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims (15)

  1. 一种文字美化方法,其特征在于,应用于具有触控屏的电子设备,所述方法包括:A text beautification method, characterized in that it is applied to an electronic device with a touch screen, and the method comprises:
    响应于用户在所述触控屏上的第一操作,生成第一文字轨迹;In response to a first operation of a user on the touch screen, generating a first text track;
    对所述第一文字轨迹进行识别,获取所述第一文字轨迹的第一风格;其中,所述第一风格用于表征所述第一文字轨迹具有的字型特征;Recognize the first text track to obtain a first style of the first text track; wherein the first style is used to characterize the font features of the first text track;
    获取目标字体的第二风格;所述第二风格用于表征所述目标字体的文字轨迹具有的字型特征;Acquire a second style of the target font; the second style is used to characterize the font features of the text track of the target font;
    根据所述第一风格与所述第二风格,生成第三风格;generating a third style according to the first style and the second style;
    根据所述第三风格,对所述第一文字轨迹进行美化处理,得到第二文字轨迹;Beautify the first text track according to the third style to obtain a second text track;
    在所述触控屏上显示所述第二文字轨迹。The second text track is displayed on the touch screen.
  2. 如权利要求1所述的方法,其特征在于,对所述第一文字轨迹进行识别,获取所述第一文字轨迹的第一风格,包括:The method according to claim 1, wherein identifying the first text track to obtain the first style of the first text track comprises:
    将所述第一文字轨迹输入风格识别模型,得到所述第一风格。The first text trajectory is input into a style recognition model to obtain the first style.
  3. 如权利要求1或2所述的方法,其特征在于,获取目标字体的第二风格,包括:The method according to claim 1 or 2, characterized in that obtaining the second style of the target font comprises:
    将所述目标字体对应的文字模型输入风格识别模型,得到所述第二风格;或者从风格库中确定所述目标字体的第二风格。The text model corresponding to the target font is input into a style recognition model to obtain the second style; or the second style of the target font is determined from a style library.
  4. 如权利要求1-3任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 3, characterized in that the method further comprises:
    在字体库中选择所述目标字体,其中,所述字体库中包含至少一个字体;或者响应于所述用户在所述触控屏上的第二操作,获取所述目标字体。The target font is selected in a font library, wherein the font library contains at least one font; or the target font is acquired in response to a second operation of the user on the touch screen.
  5. 如权利要求4所述的方法,其特征在于,在字体库中选择所述目标字体,包括:The method according to claim 4, wherein selecting the target font in a font library comprises:
    计算所述第一文字轨迹与所述至少一个字体中每个字体的相似度;Calculating the similarity between the first text track and each font of the at least one font;
    在所述字体库中,选择与所述第一文字轨迹相似度最高的字体为所述目标字体。In the font library, a font having the highest similarity to the first text track is selected as the target font.
  6. 如权利要求5所述的方法,其特征在于,计算所述第一文字轨迹与所述至少一个字体中每个字体的相似度,包括:The method according to claim 5, wherein calculating the similarity between the first text trajectory and each font of the at least one font comprises:
    将所述第一文字轨迹输入第一笔迹特征提取模型,得到所述第一文字轨迹的第一笔迹特征向量;Inputting the first text trajectory into a first handwriting feature extraction model to obtain a first handwriting feature vector of the first text trajectory;
    根据所述第一笔迹特征向量以及所述至少一个字体的笔迹特征向量,计算所述第一文字轨迹与所述至少一个字体中每个字体的相似度。The similarity between the first text track and each font in the at least one font is calculated according to the first handwriting feature vector and the handwriting feature vector of the at least one font.
  7. 如权利要求4-6任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 4 to 6, characterized in that the method further comprises:
    确定第一字体,将确定的所述第一字体更新至字体库。A first font is determined, and the determined first font is updated to a font library.
  8. 如权利要求7所述的方法,其特征在于,确定第一字体,包括:The method of claim 7, wherein determining the first font comprises:
    将第三文字轨迹输入所述第一笔迹特征提取模型,得到所述第三文字轨迹的第二笔迹特征向量,并将所述第二笔迹特征向量输入字体鉴定模型,得到所述第三文字轨迹的字体为所述第一字体;其中,所述第三文字轨迹是根据任一个用户在所述触控屏上触发的第三操作生成的;或者Inputting a third text track into the first handwriting feature extraction model to obtain a second handwriting feature vector of the third text track, and inputting the second handwriting feature vector into a font identification model to obtain that the font of the third text track is the first font; wherein the third text track is generated according to a third operation triggered by any user on the touch screen; or
    将目标文字模型输入第二笔迹特征提取模型,得到所述目标文字模型的第三笔迹特征向量,并将所述第三笔迹特征向量输入所述字体鉴定模型,得到所述目标文字模型对应的字体为所述第一字体。The target text model is input into the second handwriting feature extraction model to obtain a third handwriting feature vector of the target text model, and the third handwriting feature vector is input into the font identification model to obtain that the font corresponding to the target text model is the first font.
  9. 如权利要求4所述的方法,其特征在于,响应于所述用户在所述触控屏上的第二操作,获取所述目标字体,包括: The method according to claim 4, wherein, in response to the second operation of the user on the touch screen, obtaining the target font comprises:
    当检测到所述用户在所述触控屏上作用于字体选择图标的操作时,显示多个候选字体;When detecting that the user operates a font selection icon on the touch screen, displaying a plurality of candidate fonts;
    响应于所述用户在所述多个候选字体中选中任一个候选字体的所述第二操作,将所述用户选中的所述候选字体作为所述目标字体。In response to the second operation of the user selecting any one candidate font from the plurality of candidate fonts, the candidate font selected by the user is used as the target font.
  10. 如权利要求1-9任一项所述的方法,其特征在于,根据所述第一风格与所述第二风格,生成第三风格,包括:The method according to any one of claims 1 to 9, characterized in that generating a third style according to the first style and the second style comprises:
    获取用于调整所述第一文字轨迹的美化程度的美化参数值;Obtaining a beautification parameter value for adjusting the beautification degree of the first text track;
    将所述美化参数值、所述第一风格以及所述第二风格输入特征融合模型,得到所述第三风格。The beautification parameter value, the first style, and the second style are input into a feature fusion model to obtain the third style.
  11. 一种电子设备,其特征在于,包括用于执行如权利要求1-10中的任一项所述方法的模块。An electronic device, characterized in that it comprises a module for executing the method as claimed in any one of claims 1 to 10.
  12. 一种电子设备,其特征在于,包括存储器和处理器;An electronic device, characterized in that it comprises a memory and a processor;
    所述存储器,用于存储计算机程序指令;The memory is used to store computer program instructions;
    所述处理器,用于执行调用所述存储器中的计算机程序指令,以使所述电子设备执行如权利要求1-10中任一项所述的方法的操作步骤。The processor is used to execute and call the computer program instructions in the memory so that the electronic device performs the operating steps of the method as described in any one of claims 1-10.
  13. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序或指令,当所述计算机程序或指令被计算机执行时,使得所述计算机执行如权利要求1-10任一项所述的方法的操作步骤。A computer-readable storage medium, characterized in that a computer program or instruction is stored in the computer-readable storage medium, and when the computer program or instruction is executed by a computer, the computer executes the operating steps of the method according to any one of claims 1 to 10.
  14. 一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机程序或指令,当所述计算机程序或指令在计算机上运行时,使得所述计算机执行如权利要求1-10任一项所述的方法的操作步骤。A computer program product, characterized in that the computer program product comprises a computer program or instructions, and when the computer program or instructions are run on a computer, the computer is caused to execute the operating steps of the method according to any one of claims 1 to 10.
  15. 一种芯片,其特征在于,所述芯片与存储器耦合,所述芯片读取存储器中存储的计算机程序,执行如权利要求1-10任一项所述的方法的操作步骤。 A chip, characterized in that the chip is coupled to a memory, and the chip reads a computer program stored in the memory to execute the operating steps of the method according to any one of claims 1 to 10.
PCT/CN2023/100493 2022-09-26 2023-06-15 Character beautification method and electronic device WO2024066490A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211180551.1 2022-09-26
CN202211180551.1A CN117807989A (en) 2022-09-26 2022-09-26 Text beautifying method and electronic equipment

Publications (1)

Publication Number Publication Date
WO2024066490A1 true WO2024066490A1 (en) 2024-04-04

Family

ID=90433980

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/100493 WO2024066490A1 (en) 2022-09-26 2023-06-15 Character beautification method and electronic device

Country Status (2)

Country Link
CN (1) CN117807989A (en)
WO (1) WO2024066490A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130136377A1 (en) * 2011-11-29 2013-05-30 Samsung Electronics Co., Ltd. Method and apparatus for beautifying handwritten input
KR20150021357A (en) * 2013-08-20 2015-03-02 삼성전자주식회사 A Method and Apparatus For Font Beautification Based On Writer-dependent Handwriting Recognition
CN114418834A (en) * 2021-12-29 2022-04-29 北京字跳网络技术有限公司 Character generation method and device, electronic equipment and storage medium
CN114549698A (en) * 2022-02-22 2022-05-27 上海云从企业发展有限公司 Text synthesis method and device and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130136377A1 (en) * 2011-11-29 2013-05-30 Samsung Electronics Co., Ltd. Method and apparatus for beautifying handwritten input
KR20150021357A (en) * 2013-08-20 2015-03-02 삼성전자주식회사 A Method and Apparatus For Font Beautification Based On Writer-dependent Handwriting Recognition
CN114418834A (en) * 2021-12-29 2022-04-29 北京字跳网络技术有限公司 Character generation method and device, electronic equipment and storage medium
CN114549698A (en) * 2022-02-22 2022-05-27 上海云从企业发展有限公司 Text synthesis method and device and electronic equipment

Also Published As

Publication number Publication date
CN117807989A (en) 2024-04-02

Similar Documents

Publication Publication Date Title
US20210349940A1 (en) Video clip positioning method and apparatus, computer device, and storage medium
US20210011942A1 (en) Method, apparatus, and storage medium for classifying multimedia resource
US9992641B2 (en) Electronic device, server, and method for outputting voice
CN109213732B (en) Method for improving photo album classification, mobile terminal and computer readable storage medium
US10917552B2 (en) Photographing method using external electronic device and electronic device supporting the same
CN112272830A (en) Image classification by label delivery
CN110544272B (en) Face tracking method, device, computer equipment and storage medium
CN110135336B (en) Training method, device and storage medium for pedestrian generation model
US20220309836A1 (en) Ai-based face recognition method and apparatus, device, and medium
CN111243668B (en) Method and device for detecting molecule binding site, electronic device and storage medium
US11816876B2 (en) Detection of moment of perception
CN110162604B (en) Statement generation method, device, equipment and storage medium
WO2022042120A1 (en) Target image extracting method, neural network training method, and device
WO2021000943A1 (en) Method and apparatus for managing fingerprint switch
CN112269853A (en) Search processing method, search processing device and storage medium
CN111898561A (en) Face authentication method, device, equipment and medium
WO2022193973A1 (en) Image processing method and apparatus, electronic device, computer readable storage medium, and computer program product
KR20180111242A (en) Electronic device and method for providing colorable content
WO2024066490A1 (en) Character beautification method and electronic device
WO2022143314A1 (en) Object registration method and apparatus
CN113836946B (en) Method, device, terminal and storage medium for training scoring model
US20220199070A1 (en) Method and system for detecting unsupported utterances in natural language understanding
CN111597823B (en) Method, device, equipment and storage medium for extracting center word
CN114333997A (en) Data processing method, data processing model training method, data processing device, data processing equipment and data processing medium
CN114281937A (en) Training method of nested entity recognition model, and nested entity recognition method and device