A data processing method, device and storage medium
By identifying the mark of the interface mark image and determining the area type, the interface display program is generated, which solves the problems of low efficiency and poor readability of manually written code in Android application development, and improves the readability and portability of the interface display data.
Patent Information
- Application Number
- CN201910188965.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-03-13
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2039-03-13
AI Technical Summary
In Android application development, due to the low efficiency and high cost of manually writing code, the generated layout files cannot guarantee good readability and portability.
By obtaining the interface mark image of the application, using the preset mark detection model to identify the mark, determining the area type, and generating the interface display program based on the mark information and area type, the readability and portability of the interface display data are improved.
It improves the readability and portability of interface display data and reduces the development time and cost of application interface display programs.
Smart Images

Figure CN111694567B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to program development technology, and in particular to a data processing method and device, and a storage medium. Background Art
[0002] In existing Android application development, developers manually write code to generate layout files of Android applications based on page design drawings of Android applications. However, manual code writing is inefficient and has high labor costs. In addition, due to the instability of developers' coding ability, the readability and portability of the code cannot be guaranteed. As a result, it is impossible to quickly generate layout files with good readability and high portability. Summary of the invention
[0003] The main purpose of the present invention is to provide a data processing method and device, and a storage medium, which improve the readability and portability of interface display data.
[0004] The technical solution of the present invention is achieved in this way:
[0005] An embodiment of the present invention provides a data processing method, the method comprising:
[0006] Acquire an interface mark image of an application, wherein the interface mark image includes at least one marked area;
[0007] Using a preset mark detection model, mark recognition is performed on the interface mark image to obtain mark information of each area in the at least one marked area; the preset mark detection model represents the correspondence between the interface mark image and the mark information, and the mark information represents the mark feature corresponding to each area;
[0008] Obtaining the area type corresponding to each area according to the correspondence between the preset marking information and the area type and the marking information;
[0009] An interface display program of the application is obtained according to the interface marking image, the marking information, the area type and a preset program library; the preset program library represents the area program corresponding to the area type.
[0010] In the above solution, the at least one marked area is at least one area marked by a colored marking frame; the marking information includes a marking position and a marking color.
[0011] In the above scheme, the preset mark detection model includes a mark box detection model and a color detection model;
[0012] The method of using a preset mark detection model to perform mark recognition on the interface mark image to obtain mark information of each area in the at least one marked area includes:
[0013] Using the mark frame detection model, perform position detection on the interface mark image to obtain the mark position;
[0014] The mark color is obtained according to the mark position, the interface mark image and the color detection model.
[0015] In the above scheme, the area type is a layout type or a control type, and the correspondence between the preset mark information and the area type includes: a first correspondence between a preset first mark color and a control type, and a second correspondence between a preset second mark color and a layout type;
[0016] The obtaining the region type corresponding to each region according to the correspondence between the preset marking information and the region type and the marking information includes:
[0017] When a marking color of an area matches a first marking color in the first corresponding relationship, a control type corresponding to the area is obtained according to the marking color and the first corresponding relationship; the area belongs to the at least one marked area;
[0018] When the mark color of the one region matches the second mark color in the second corresponding relationship, the layout type corresponding to the one region is obtained according to the mark color and the second corresponding relationship; and then the region type corresponding to each region is obtained.
[0019] In the above scheme, obtaining the interface display program of the application according to the interface mark image, the mark information, the area type and the preset program library includes:
[0020] According to the marked position, the area type and the preset program library, an initial interface area program for each area is obtained;
[0021] Obtaining the area content of each area according to the area type, the mark position and the interface mark image;
[0022] Obtaining the interface area program of each area according to the initial interface area program and the area content;
[0023] When the at least one marked area includes at least two marked areas, obtaining, according to the marking positions, a corresponding inclusion relationship between the at least two marked areas;
[0024] According to the inclusion relationship, the interface area programs are combined to obtain the interface display program.
[0025] In the above solution, the area type is a layout type or a control type, and the control type includes a text control and an image control;
[0026] The obtaining of the area content of each area according to the area type, the mark position and the interface mark image includes:
[0027] When the area type corresponding to one of the at least one marked area is the text control, performing text recognition on an image corresponding to a marked position of the one area in the interface marked image to obtain area text within the one area, and using the area text as area content of the one area;
[0028] When the area type corresponding to the one area is the image control, performing image extraction on an image corresponding to a mark position of the one area in the interface mark image to obtain an area image within the one area, and using the area image as the area content of the one area;
[0029] When the area type corresponding to the one area is the layout type, background recognition is performed on the image corresponding to the mark position of the one area in the interface mark image to obtain the area background within the one area, and the area background is used as the area content of the one area; then the area content of each area is obtained.
[0030] In the above solution, the marking position includes the coordinates of the positioning points of the marking box corresponding to each area;
[0031] The obtaining, according to the marked positions, the corresponding inclusion relationship of the at least two marked areas comprises:
[0032] According to the coordinates of the positioning points of each two areas in the at least two marked areas, the sub-inclusion relationship corresponding to the each two areas is determined, and then the inclusion relationship is obtained.
[0033] In the above scheme, the marking box is a square box, and the positioning point coordinates include the upper left corner coordinates and the lower right corner coordinates of the square box corresponding to each area, or the positioning point coordinates include the lower left corner coordinates and the upper right corner coordinates of the square box corresponding to each area.
[0034] In the above solution, the marking frame is a circular frame, and the positioning point coordinates include the center coordinates and radius of the circular frame corresponding to each area.
[0035] In the above scheme, the marking box detection model includes a grid coordinate detection model and a confidence calculation model, the grid coordinate detection model represents the corresponding relationship between the sub-unit grid and the predicted coordinates, and the confidence calculation model represents the corresponding relationship between the predicted coordinates and the confidence;
[0036] The using the mark frame detection model to perform position detection on the interface mark image to obtain the mark position includes:
[0037] Performing grid division on the interface mark image to obtain at least one unit grid corresponding to the interface mark image;
[0038] Matching the at least one unit grid with each region to obtain a sub-unit grid corresponding to each region; the sub-unit grid belongs to the at least one unit grid;
[0039] The position of each area is detected by using the sub-unit grid, the grid coordinate detection model and the confidence calculation model to obtain the marked position.
[0040] In the above solution, the marking frame is a marking frame of a preset width;
[0041] The obtaining the mark color according to the mark position, the interface mark image and the color detection model includes:
[0042] Extracting the image corresponding to the marked position from the interface marked image to obtain the marked area image of each area;
[0043] The color detection model is used to perform color recognition on a target area in the marked area image that meets the preset width to obtain the marked color.
[0044] An embodiment of the present invention provides a data processing device, the device comprising: an image acquisition unit, a mark recognition unit, a type determination unit and a program generation unit; wherein:
[0045] The image acquisition unit is used to acquire an interface mark image of the application, wherein the interface mark image includes at least one marked area;
[0046] The mark recognition unit is used to perform mark recognition on the interface mark image using a preset mark detection model to obtain mark information of each area in the at least one marked area; the preset mark detection model represents the correspondence between the interface mark image and the mark information, and the mark information represents the mark feature corresponding to each area;
[0047] The type determination unit is used to obtain the area type corresponding to each area according to the correspondence between the preset marking information and the area type and the marking information;
[0048] The program generation unit is used to obtain the interface display program of the application according to the interface mark image, the mark information, the area type and a preset program library; the preset program library represents the area program corresponding to the area type.
[0049] In the above solution, the at least one marked area is at least one area marked by a colored marking frame; the marking information includes a marking position and a marking color.
[0050] In the above scheme, the preset mark detection model includes a mark box detection model and a color detection model;
[0051] The mark recognition unit is specifically used to use the mark frame detection model to perform position detection on the interface mark image to obtain the mark position; and to obtain the mark color according to the mark position, the interface mark image and the color detection model.
[0052] In the above scheme, the area type is a layout type or a control type, and the correspondence between the preset mark information and the area type includes: a first correspondence between a preset first mark color and a control type, and a second correspondence between a preset second mark color and a layout type;
[0053] The type determination unit is specifically used to obtain the control type corresponding to the area according to the marking color and the first corresponding relationship when the marking color of the area matches the first marking color in the first corresponding relationship; the area belongs to the at least one marked area; and when the marking color of the area matches the second marking color in the second corresponding relationship, obtain the layout type corresponding to the area according to the marking color and the second corresponding relationship; and then obtain the area type corresponding to each area.
[0054] In the above scheme, the program generation unit is specifically used to obtain the initial interface area program for each area according to the marking position, the area type and the preset program library; and obtain the area content of each area according to the area type, the marking position and the interface marking image; and obtain the interface area program for each area according to the initial interface area program and the area content; and when the at least one marked area includes at least two marked areas, obtain the corresponding inclusion relationship of the at least two marked areas according to the marking position; and combine the interface area programs according to the inclusion relationship to obtain the interface display program.
[0055] In the above solution, the area type is a layout type or a control type, and the control type includes a text control and an image control;
[0056] The program generation unit is specifically used to perform text recognition on the image corresponding to the marking position of the one area in the interface marking image to obtain the regional text in the one area, and use the regional text as the regional content of the one area when the area type corresponding to one area among the at least one marked area is the text control; and when the area type corresponding to the one area is the image control, perform image extraction on the image corresponding to the marking position of the one area in the interface marking image to obtain the regional image in the one area, and use the regional image as the regional content of the one area; and when the area type corresponding to the one area is the layout type, perform background recognition on the image corresponding to the marking position of the one area in the interface marking image to obtain the regional background in the one area, and use the regional background as the regional content of the one area; and then obtain the regional content of each area.
[0057] In the above solution, the marking position includes the coordinates of the positioning points of the marking box corresponding to each area;
[0058] The program generation unit is specifically used to determine the sub-inclusion relationship corresponding to each two areas according to the coordinates of the positioning points of each two areas in the at least two marked areas, and then obtain the inclusion relationship.
[0059] In the above scheme, the marking box is a square box, and the positioning point coordinates include the upper left corner coordinates and the lower right corner coordinates of the square box corresponding to each area, or the positioning point coordinates include the lower left corner coordinates and the upper right corner coordinates of the square box corresponding to each area.
[0060] In the above solution, the marking frame is a circular frame, and the positioning point coordinates include the center coordinates and radius of the circular frame corresponding to each area.
[0061] In the above scheme, the marking box detection model includes a grid coordinate detection model and a confidence calculation model, the grid coordinate detection model represents the corresponding relationship between the sub-unit grid and the predicted coordinates, and the confidence calculation model represents the corresponding relationship between the predicted coordinates and the confidence;
[0062] The mark recognition unit is specifically used to grid the interface mark image to obtain at least one unit grid corresponding to the interface mark image; and match the at least one unit grid with each area to obtain a sub-unit grid corresponding to each area; the sub-unit grid belongs to the at least one unit grid; and use the sub-unit grid, the grid coordinate detection model and the confidence calculation model to perform position detection on each area to obtain the mark position.
[0063] In the above solution, the marking frame is a marking frame of a preset width;
[0064] The mark recognition unit is specifically used to extract the image corresponding to the mark position from the interface mark image to obtain the mark area image of each area; and use the color detection model to perform color recognition on the target area that meets the preset width in the mark area image to obtain the mark color.
[0065] An embodiment of the present invention also provides a data processing device, which includes: a processor, a memory and a communication bus, wherein the memory communicates with the processor via the communication bus, and the memory stores one or more data processing programs executable by the processor. When the one or more data processing programs are executed, the steps of any one of the above-mentioned data processing methods are performed by the processor.
[0066] An embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a data processing program. When the data processing program is executed by a processor, the processor is enabled to execute the steps of any one of the above-mentioned data processing methods.
[0067] The embodiment of the present invention provides a data processing method and device, and a storage medium, which adopts the above-mentioned technical implementation scheme, obtains the area type corresponding to each area based on the correspondence between the interface mark image, preset mark information and area type of the application, and then obtains the interface display program of the application according to the interface mark image, mark information, area type and preset program library, wherein, since the preset program library represents the area program corresponding to the area type, according to the area type of each area, the interface area program of each area in the application can be called from the preset program library, and as long as a preset program library with good readability and high portability is set, the readability and portability of the interface display program of the application can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 A schematic diagram of the structure of a data processing system provided by an embodiment of the present invention;
[0069] Figure 2A flowchart of a data processing method provided by an embodiment of the present invention;
[0070] Figure 3 A performance comparison chart of a deep learning-based target detection algorithm provided by an embodiment of the present invention;
[0071] Figure 4 A schematic diagram of an HSV (Hue, Saturation, Value) color model provided in an embodiment of the present invention;
[0072] Figure 5 A schematic diagram of an interface design image of an application provided by an embodiment of the present invention;
[0073] Figure 6 A schematic diagram of an interface markup image of an application provided by an embodiment of the present invention;
[0074] Figure 7 A schematic diagram of a data processing device provided in an embodiment of the present invention Figure 1 ;
[0075] Figure 8 A schematic diagram of a data processing device provided in an embodiment of the present invention Figure 2 . DETAILED DESCRIPTION
[0076] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0077] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present invention, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0078] See below Figure 1 , which is a schematic diagram of a data processing system for implementing various embodiments of the present invention, the system 1 may include: a display module 11, an input module 12, and a data processing device 13; the data processing device 13 obtains an interface design image (e.g., a page design image) of an application, and sends it to the display module 11, and displays the interface design image of the application on the display module 11; when the interface design image of the application is displayed on the display module 11, a marking instruction for the interface design image is received from the input module 12; the data processing device 13 generates an interface marking image (e.g., a page marking image) of the application according to the marking instruction, and may also send it to the display module 11, and display the interface marking image on the display module 11;
[0079] Alternatively, the data processing device 13 directly obtains the interface mark image of the application.
[0080] Exemplarily, an interface design image of an application program and a correspondence between preset marking information and area types are displayed on the display module 11. The user can perform a marking operation on each area in the interface design image through the input module 12 according to the correspondence. The input module 12 receives a marking instruction corresponding to the marking operation. The area includes the layout of the page and the controls of the page.
[0081] Those skilled in the art will understand that Figure 1 The structure of the data processing system shown in the figure does not constitute a limitation of the data processing system. The data processing system may include more or less components than shown in the figure, or combine some components, or arrange the components differently.
[0082] It should be noted that the embodiments of the present invention can be based on Figure 1 The data processing device shown is implemented as follows. Figure 1 A specific embodiment of data processing is described below.
[0083] Embodiment 1
[0084] The embodiment of the present invention provides a data processing method, such as Figure 2 As shown, the method includes:
[0085] S201: Acquire an interface mark image of an application, where the interface mark image includes at least one marked area;
[0086] The data processing device obtains an interface marking image, which is generated by marking the interface design image of the application, and the interface design image includes at least one area; the interface marking image is used to obtain the interface display program (interface display code) of the application, and the interface display program is a display program of the interface design image of the application.
[0087] Exemplarily, the application includes an Android system application, and the area includes a layout and a control; wherein the control is the smallest design unit of the Android system application, a layout may include at least one control, and may also include at least one other layout, and each other layout may include at least one control.
[0088] In some embodiments, before obtaining the interface marking image of the application, the interface design image of the application and the correspondence between preset marking information and area types are obtained and displayed; a marking instruction for the interface design image is received; and an interface marking image is generated based on the marking instruction and the interface design image; wherein the marking instruction is an instruction to generate marking information in the correspondence between preset marking information and area types.
[0089] The data processing device displays the correspondence between the preset marking information and the area type to prompt the user to use the marking information matching the area type of each area in at least one area to mark each area and generate at least one marked area.
[0090] Exemplarily, the user sets corresponding marking information for each area type in the interface design image of the application, and generates a correspondence between the preset marking information and the area type; wherein, for applications on the Android system, the area type includes layout type and control type, the layout type includes linear layout LinearLayout, table layout TableLayout, relative layout RelativeLayout, layer layout FrameLayout, absolute layout AbsoluteLayout and grid layout GridLayout, etc., and the control type includes text control TextView, image control ImageView, video control ImageView, input box control EditText, button control Button, check box control CheckBox, radio button control RadioButton and date control DatePicker, etc.
[0091] It should be noted that the text control is a control for displaying text; the image control is a control for displaying images; the input box control is used to receive input information, and the input method of the input box control can be adjusted, for example, setting the input method of the soft keyboard; the button control is used to display button keys, and can also display pictures; the check box control is used to provide multiple button options that can be selected at the same time; the radio button control is used to provide a group of radio button options from which only one item can be selected; and the date control is used to display the date.
[0092] Exemplarily, the marking information includes a marking color, and the correspondence between the preset marking information and the area type includes: a first correspondence between a preset first marking color and a control type, and a second correspondence between a preset second marking color and a layout type, the first correspondence between the preset first marking color and the control type includes a one-to-one correspondence between each control type and each first marking color, and the second correspondence between the preset second marking color and the layout type includes a one-to-one correspondence between each layout type and each second marking color; wherein the first marking color is different from the second marking color.
[0093] S202: using a preset mark detection model, performing mark recognition on the interface mark image to obtain mark information of each area in at least one marked area; the preset mark detection model represents the correspondence between the interface mark image and the mark information, and the mark information represents the mark feature corresponding to each area;
[0094] The data processing device uses the interface mark image as the input of the preset mark detection model, and uses the preset mark detection model to perform mark recognition on the interface mark image to obtain the mark information of each area.
[0095] In some embodiments, at least one marked area is at least one area marked by a colored marking box; the marking information of each area includes a marking position and a marking color.
[0096] Exemplarily, the colored marking frame includes a colored square frame, a colored circle frame, and the like.
[0097] In some embodiments, the preset mark detection model includes a mark box detection model and a color detection model; the data processing device uses the mark box detection model to perform position detection on the interface mark image to obtain the mark position; based on the mark position, the interface mark image and the color detection model, the mark color of each area is obtained.
[0098] The data processing device inputs an interface mark image to a preset mark detection model for at least one area marked by a colored mark box, and the preset mark detection model outputs the mark position and mark color of each area. The mark position can be the positioning point coordinates of the mark box corresponding to each area.
[0099] In some embodiments, the marking box detection model includes a grid coordinate detection model and a confidence calculation model, the grid coordinate detection model characterizes the correspondence between the sub-unit grid and the predicted coordinates, and the confidence calculation model characterizes the correspondence between the predicted coordinates and the confidence; the data processing device grids the interface marking image to obtain at least one unit grid corresponding to the interface marking image; matches at least one unit grid with each area to obtain a sub-unit grid corresponding to each area; the sub-unit grid belongs to at least one unit grid; uses the sub-unit grid, the grid coordinate detection model and the confidence calculation model to perform position detection on each area to obtain the marking position.
[0100] The data processing device determines a unit grid to which the center position of each area belongs as a sub-unit grid; uses a grid coordinate detection model to calculate at least one predicted coordinate corresponding to the sub-unit grid; then uses a confidence calculation model to calculate the confidence of each predicted coordinate in at least one predicted coordinate; determines a target coordinate from at least one predicted coordinate according to the confidence of each predicted coordinate; and obtains a marked position of each area according to the target coordinate.
[0101] In some embodiments, the marking box is a marking box of a preset width; an image corresponding to the marking position is extracted from the interface marking image to obtain a marking area image of each area; and a color detection model is used to perform color recognition on a target area in the marking area image that meets the preset width to obtain a marking color.
[0102] The data processing device extracts the marked area image corresponding to the marked position of each area from the interface marked image according to the marked position; and uses the color detection model to perform color recognition on the target area in the marked area image to obtain the marked color.
[0103] S203: Obtaining the region type corresponding to each region according to the correspondence between the preset marking information and the region type and the marking information;
[0104] The data processing device determines the region type that matches the marking information of each region in the correspondence between the preset marking information and the region type, and the matched region type is the region type corresponding to each region.
[0105] In some embodiments, the correspondence between preset marking information and area types includes: a first correspondence between a preset first marking color and an area type, and a second correspondence between a preset second marking color and a layout type; when the marking color of an area matches the first marking color in the first correspondence, the data processing device obtains a control type corresponding to the area based on the marking color and the first correspondence; an area belongs to at least one marked area; when the marking color matches the second marking color in the second correspondence, the data processing device obtains a layout type corresponding to the area based on the marking color and the second correspondence; and then obtains the area type corresponding to each area.
[0106] The data processing device compares the mark color of an area with the first mark color, and when the mark color of an area matches one of the first mark colors, determines the control type corresponding to the first mark color from the first corresponding relationship, that is, the control type corresponding to the area; when the mark color of an area does not match the first mark color, compares the mark color of an area with the second mark color, and when the mark color of an area matches one of the second mark colors, determines the layout type corresponding to the second mark color from the second corresponding relationship, that is, the layout type corresponding to the area.
[0107] S204: Obtaining an interface display program of the application program according to the interface mark image, the mark information, the area type and the preset program library; the preset program library is the area program corresponding to the area type.
[0108] The data processing device obtains a preset program library, and combines the interface marking image, marking information and area type to obtain the interface area program (interface area code) of each area, and then obtains the interface display program (interface display code) composed of the interface area program of at least one marked area.
[0109] In some embodiments, the data processing device obtains the initial interface area program for each area based on the mark position, area type and preset program library; obtains the area content of each area based on the area type, mark position and interface mark image; obtains the interface area program for each area based on the initial interface area program and the area content; when at least one marked area includes at least two marked areas, obtains the inclusion relationship corresponding to the at least two marked areas based on the mark position; and combines the interface area programs based on the inclusion relationship to obtain an interface display program.
[0110] The data processing device calls the preset area program corresponding to the area type of each area from the preset program library, modifies the preset area program with the marking coordinates of each area to obtain the initial interface area program; modifies the initial interface area program with the area content of each area to generate the interface area program of each area; compares the marking positions of every two areas in at least two marked areas to determine the sub-inclusion relationship between every two areas, and then obtains the inclusion relationship corresponding to at least two marked areas; according to the inclusion relationship, nests and / or arranges the interface area programs of at least two marked areas to generate an interface display program.
[0111] It can be understood that since the preset program library represents the regional program corresponding to the regional type, the interface regional program of each region in the application can be called from the preset program library according to the regional type of each region, thereby reducing the development time of the interface display program of the application, and the preset program library can be reused, reducing the development cost of the interface display program of the application.
[0112] Exemplarily, the preset area program includes a first filling position corresponding to the mark position and a second filling position corresponding to the area content. After obtaining the mark coordinates and the preset area program, the mark coordinates are used to modify the code at the first filling position, and the area content is used to modify the code at the second filling position to obtain the initial interface area program.
[0113] Exemplarily, the preset area program and the initial interface area program may also include a third filling position corresponding to the area content. The code in the third filling position in the initial interface area program is modified by using the obtained area content of each area to obtain the interface area program.
[0114] Exemplarily, when the at least one marked area includes only one marked area, the interface area program is used as the interface display program.
[0115] Exemplarily, two areas in at least one marked area may be a layout and a control. When the corresponding sub-inclusion relationship is that the control belongs to the layout, the data processing device nests the interface area program of the control after the interface area program of the layout and before the layout type code corresponding to the layout according to the sub-inclusion relationship; when there is no sub-hierarchical relationship between the layout and the control, the interface area program of the control and the interface area program of the layout are arranged in any order; taking a layout whose corresponding layout type is LinearLayout as an example, the layout type code of the layout may be.
[0116] Exemplarily, the interface display program includes a file in the eXtensible Markup Language (xml) format.
[0117] In some embodiments, the area type is a layout type or a control type, and the control type includes a text control and an image control; when the area type corresponding to an area in at least one marked area is a text control, the data processing device performs text recognition on the image corresponding to the marked position of an area in the interface marking image to obtain the area text in an area, and takes the area text as the area content of an area; when the area type corresponding to an area is an image control, the image corresponding to the marked position of an area in the interface marking image is extracted to obtain the area image in an area, and takes the area image as the area content of an area; when the area type corresponding to an area is a layout type, the background recognition is performed on the image corresponding to the marked position of an area in the interface marking image to obtain the area background in an area, and takes the area background as the area content of an area; and then the area content of each area is obtained.
[0118] After the data processing device obtains the area type of each area, taking one area in at least one marked area as an example, when the area type of the area is a text control, the area content of the area is obtained by text recognition; when the area type of the area is an image control, the area content of the area is obtained by image extraction; when the area type of the area is a layout type, the area content of the area is obtained by background recognition; when the area type of the area is not a text control, image control and layout type, or when text recognition fails, image extraction recognition or background recognition fails, the preset area content corresponding to the area type of the area is determined from a preset area content library, and the preset area content is used as the area content of the area; wherein the preset area content library represents the preset area content corresponding to each area type.
[0119] Exemplarily, when the area type of the area is a text control, the data processing device crops the interface mark image according to the mark position of the area, retains the image corresponding to the mark position of the area in the interface mark image, and obtains the area image corresponding to the mark position of the area; uses an optical character recognition (OCR) algorithm to perform text recognition on the area image to obtain the area content of the area.
[0120] Exemplarily, the data processing device establishes a text recognition model based on the OCR algorithm; then uses the text recognition model to perform text recognition on the regional image to obtain a recognition result; or, then uses the text recognition model to perform text recognition on the regional image to obtain a model recognition result, and also uses a post-processing algorithm to optimize the model recognition result to obtain a recognition result.
[0121] Exemplarily, before using a text recognition model to perform text recognition on a regional image, obtaining the text recognition model includes: (1) generating simulation data: creating random text, generating a text image of the text through a font engine, fusing the text image with a background image, and obtaining a fused image corresponding to the text, wherein the font and size in the text image and the background image are randomly changed to generate a large number of fused images, and the large number of fused images are used as simulation data; (2) using the simulation data to train a convolutional recurrent neural network (CRNN) model to obtain a pre-trained model, wherein the CRNN model is composed of a convolutional neural network (CNN), a long short-term memory network (LSTM), and a connectionist temporal classification (CTC); (3) using the realistic fused image as adjustment data, setting the feature extraction layer parameters of the pre-trained model unchanged, using the adjustment data to reduce the learning rate of the pre-trained model for training, and using the trained model as the text recognition model.
[0122] Exemplarily, when the area type of the area is an image control, the data processing device crops the interface mark image according to the mark position of the area, retains the image corresponding to the mark position of the area in the interface mark image, and obtains the area image corresponding to the mark position of the area; and uses the area image as the area content of the area.
[0123] Exemplarily, when the area type of the area is a layout type, the data processing device performs image cropping on the interface mark image according to the mark position of the area, retains the image corresponding to the mark position of the area in the interface mark image, and obtains the area image corresponding to the mark position of the area; then uses the area image as the area background of the area, or performs color recognition on the area image to obtain the area color, and uses the area color as the area background of the area.
[0124] In some embodiments, the marking position includes the positioning point coordinates of the marking box corresponding to each area; the data processing device determines the sub-inclusion relationship corresponding to every two areas based on the positioning point coordinates of every two areas in the at least two marked areas, and then obtains the inclusion relationship corresponding to the at least two marked areas.
[0125] The data processing device sequentially takes out two areas from at least two marked areas, compares the coordinates of the positioning points of each two areas, determines the sub-inclusion relationship corresponding to each two areas according to the comparison result, and then obtains the inclusion relationship corresponding to at least one marked area.
[0126] In some embodiments, the marking box is a square box, and the positioning point coordinates include the upper left corner coordinates and the lower right corner coordinates of the square box corresponding to each area, or the positioning point coordinates include the lower left corner coordinates and the upper right corner coordinates of the square box corresponding to each area.
[0127] In some embodiments, the marking frame is a circular frame, and the positioning point coordinates include the center coordinates and radius of the circular frame corresponding to each area.
[0128] The data processing device uses a mark frame detection model in a preset mark detection module to perform mark frame detection on the interface mark image to obtain the coordinates of the positioning point of each area in at least two marked areas; wherein the coordinate reference information corresponding to the interface mark image is set in the mark frame detection model, and the coordinate reference information includes the coordinate origin, the X-coordinate axis, the positive direction of the X-coordinate axis, the Y-coordinate axis and the positive direction of the Y-coordinate axis; the positioning point coordinates are coordinates determined with reference to the coordinate reference information.
[0129] Exemplarily, the data processing device can set the upper left corner of the interface marking image as the coordinate origin, the upper border of the interface marking image as the X-coordinate axis, the rightward horizontal line as the positive direction of the X-coordinate axis, the left border of the interface marking image as the Y-coordinate axis, and the upward vertical line as the positive direction of the Y-coordinate axis in the marking box detection model to obtain the upper left corner coordinates and lower right corner coordinates of each area; wherein the upper left corner coordinates are (X1, Y1), X1 is the distance between the upper left corner of the box and the left border of the interface marking image, and Y1 is the distance between the upper left corner of the box and the upper border of the interface marking image; the lower right corner coordinates are (X2, Y2), X2 is the distance between the lower right corner of the box and the left border of the interface marking image, and Y2 is the distance between the lower right corner of the box and the upper border of the interface marking image; the center coordinates are (X3, Y3), X3 is the distance between the center of the circle and the left border of the interface marking image, and Y3 is the distance between the center of the circle and the upper border of the interface marking image.
[0130] Exemplarily, every two regions include one region and another region. When the upper left corner coordinate of one region is not greater than the upper left corner coordinate of the other region, and the lower right corner coordinate of one region is not less than the lower right corner coordinate of the other region, the data processing device determines that the other region belongs to one region and generates a sub-inclusion relationship between every two regions. Otherwise, it is determined that there is no inclusion relationship between one region and the other region, and the sub-inclusion relationship cannot be generated.
[0131] It should be noted that after obtaining the interface display program of the application, the developer can also modify the interface area program of any area in the interface display program according to actual needs to obtain an updated interface display program; for example, the layout type in the layout interface area program can be modified, and the area content in the layout or control interface area program can be modified; when the user needs to open the application on the terminal, he first downloads the installation package of the application, which includes the interface display program of the application. When the application is run, the terminal displays the interface design image of the application based on the interface display program; wherein, when displaying the interface design image, the position of the control in the interface design image depends on the layout type of the layout to which the control belongs, etc.
[0132] It should be noted that, before step S202, the data processing method further includes:
[0133] S205: Obtaining a preset marker detection model;
[0134] The data processing device obtains a preset mark detection model for identifying mark information of the interface mark image; wherein the preset mark detection model represents the correspondence between the interface mark image and the mark information.
[0135] In some embodiments, before using a preset mark detection model to mark and identify the interface mark image and obtain the mark information of each area in at least one marked area, the data processing device obtains a historical interface mark image (historical page mark image) of a historical application; the historical interface mark image is an image that conforms to the correspondence between the preset mark information and the area type; the historical interface mark image includes at least one marked historical area; the historical mark information of each historical area in at least one marked historical area is obtained; the preset initial mark detection model is trained using the historical interface mark image and the historical mark information until the accuracy of the trained preset initial mark detection model is not less than the preset accuracy threshold; the trained preset initial mark detection model is used as the preset mark detection model.
[0136] The data processing device obtains at least one historical interface marking image of at least one historical application, and historical marking information of each historical area in at least one marked historical area, and each historical interface marking image in at least one historical interface marking image includes at least one marked historical area; establishes a preset initial marking detection model according to a machine learning algorithm; uses the historical interface marking image as input data, and uses the corresponding historical marking information as training output data, trains the preset initial marking detection model using the input data and the output data, and calculates the accuracy of the trained preset initial marking detection model; adjusts the parameters of the trained preset initial marking detection model according to the accuracy and the preset accuracy threshold until the accuracy is not less than the preset accuracy threshold.
[0137] In some embodiments, the historical mark information includes the historical mark position and the historical mark color; the preset initial mark detection model includes an initial mark box detection model and an initial color detection model; before using the historical interface mark image and the historical mark information to train the preset initial mark detection model, a deep learning-based target detection algorithm is used to establish an initial mark box detection model; the first input of the initial mark box detection model is the historical interface mark image, and the first output of the initial mark box detection model is the historical mark position; a color recognition algorithm is used to establish an initial color detection model; the second input of the initial color detection model is the historical interface mark image and the historical mark position, and the second output of the initial color detection model is the historical mark color.
[0138] The data processing device uses a target detection algorithm based on deep learning to establish an initial mark box detection model, and uses a color recognition algorithm to establish an initial color detection model; the preset mark detection model includes a mark box detection model and a color detection model, and the data processing device uses a history interface to mark images and history mark positions to train the initial mark box detection model until the accuracy of the trained initial mark box detection model is not less than the preset accuracy threshold; the trained initial mark box detection model is used as the mark box detection model; the history interface is used to mark images, history mark positions and history mark colors to train the initial color detection model until the accuracy of the trained initial color detection model is not less than the preset accuracy threshold; the trained initial color detection model is used as the color detection model.
[0139] Exemplarily, at least one marked historical area is at least one historical area marked by a colored marking box. Correspondingly, the machine learning algorithm includes a color recognition algorithm and a target detection algorithm based on deep learning. An initial marking box detection model is established according to the target detection algorithm based on deep learning, and an initial color detection model is established according to the color recognition algorithm. The marking information includes the marking position and the marking color. The initial marking box detection model represents the correspondence between the interface marking image and the marking position. The initial color detection model represents the correspondence between the second input and the second output. The second input includes the interface marking image and the marking position, and the second output includes the marking color.
[0140] In some embodiments, the deep learning-based target detection algorithm includes YOLO (Your Olny LookOnce) algorithm, SSD (Single Shot Multibox Detector) algorithm, DSSD (Deconvolutional SingleShot Detector) algorithm, R-FCN (Region-based Fully Convolution Network) algorithm, FPN FRCN (feature pyramid networks Fast Region-CNN) algorithm, RetinaNet algorithm, etc.
[0141] For example, taking the YOLO algorithm as an example, the target detection process of the YOLO algorithm includes: (1) dividing the input interface marker image into s*s cells; wherein, if the center of a marker box falls on a certain cell, then this cell is responsible for predicting the coordinates of this marker box; (2) each cell predicts B groups of bounding box data, each group of bounding box data is used as the predicted coordinate, and a confidence is predicted for each predicted coordinate; wherein each predicted coordinate is (a1, b1, w, h), a1 is the distance between the upper left corner of the marker box and the left border of the grid, b1 is the distance between the upper left corner of the marker box and the upper border of the grid, h is the marker box height, and w is the marker box width; the confidence is calculated using Pr(Object)*IOUtruthpred, Pr(Object) indicates whether the marker box falls in the grid, Pr(Object)∈{0,1}, and IOUtruthpred indicates the overlap between the predicted box and the actual box (IOU, Intersection over Union) value; (3) Each cell needs to predict C conditional probability values, where C is equal to the total number of region types; (4) According to the B confidences and C conditional probability values predicted by each cell, one is selected from the B predicted coordinates as the target coordinate of the marking box, and then the a1 value in the target coordinate is added to the width w to obtain the horizontal coordinate a2 of the lower right corner of the marking box, and the b1 value in the target coordinate is added to the width h to obtain the vertical coordinate b2 of the lower right corner of the marking box; (5) Then, with the upper left corner of the input interface marking image as the coordinate origin, the upper border of the interface marking image as the X-coordinate axis, the rightward horizontal line as the positive direction of the X-coordinate axis, the left border of the interface marking image as the Y-coordinate axis, and the upward vertical line as the positive direction of the Y-coordinate axis, a1, b1, a2 and b2 are normalized to obtain the positioning point coordinates of the marking box, that is, the marking position of the marking box.
[0142] Exemplarily, s, B, and C are positive integers, s can be 7, and B can be 2.
[0143] It should be noted that the YOLO algorithm includes the YOLO v3 algorithm. The YOLO v3 algorithm is the target detection network with the most balanced speed and accuracy. The YOLO v3 algorithm uses a logistic classifier instead of a Softmax classifier, and the classification loss uses a binary cross-entropy loss, so that even when there are overlapping category labels for the target, detection and detection accuracy can be guaranteed; secondly, YOLO v3 uses upsampling and fusion methods, and fuses three scales (13*13, 26*26, and 52*52), and performs independent detection on the fused feature maps of multiple scales. In the end, the detection effect for small targets is significantly improved. Moreover, although each grid in YOLO v3 predicts two bounding boxes, which seems to be less than the five bounding boxes predicted by each grid in YOLO v2, because YOLO v3 uses feature fusion of multiple scales, the number of bounding boxes is much larger than before.
[0144] Exemplarily, the first SSD algorithm, the first DSSD algorithm, the R-FCN algorithm, the second SSD algorithm, the second DSSD algorithm, the FPN FRCN algorithm, the first RetinaNet algorithm, the second Retin aNet algorithm, the third RetinaNet algorithm, the first YOLO v3 algorithm, the second YOLO v3 algorithm, and the third YOLO v3 algorithm are respectively used to perform target detection on the same detection object, and the mean average precision (mAP) and running time t of each target detection algorithm are obtained, where t is in milliseconds. The mAP and t of the target detection algorithm are as follows: Figure 3 As shown, the first SSD algorithm corresponds to point A, the first DSSD algorithm corresponds to point B, the R-FCN algorithm corresponds to point C, the second SSD algorithm corresponds to point D, the second DSSD algorithm corresponds to point E, the FPN FRCN algorithm corresponds to point F, the first RetinaNet algorithm corresponds to point G, the second Retin aNet algorithm corresponds to point H, the third RetinaNet algorithm corresponds to point I, the first YOLO v3 algorithm corresponds to point J, the second YOLO v3 algorithm corresponds to point K, and the third YOLO v3 algorithm corresponds to point L; wherein the first, second, and third are only used to indicate that the same algorithm uses different parameter values; the mAP and t of the target detection algorithm are shown in Table 1 below:
[0145] Table 1
[0146] Object Detection Algorithms mAP t The first SSD algorithm 45.4 61 The first DSSD algorithm 46.1 85 R-FCN algorithm 51.9 85 Second SSD algorithm 50.4 125 Second DSSD algorithm 53.3 156 FPN FRCN algorithm 59.1 172 The first RetinaNet algorithm 50.9 73 Second RetinaNet algorithm 53.1 90 The third RetinaNet algorithm 57.5 198 The first YOLO v3 algorithm 51.5 22 Second YOLO v3 algorithm 55.3 29 Third YOLO v3 algorithm 57.9 51
[0147] from Figure 3From the data in Table 1, we can see that the average precision of the YOLO v3 algorithm is higher and the running time is shorter. That is to say, compared with other target detection algorithms, the speed and accuracy of the YOLO v3 algorithm are the most balanced. Therefore, the initial marker box detection model can be established based on the YOLO v3 algorithm.
[0148] Exemplarily, the color recognition algorithm includes a color recognition algorithm based on the HSV color model; the processing flow of the color recognition algorithm based on the HSV color model includes: obtaining the mark position of the interface mark image and the mark box; according to the mark position, extracting the area image corresponding to the mark position of each area from the interface mark image; converting the area image into an image under the HSV color model, and obtaining the RGB (Red, Green, Blue) value of the converted area image; according to the RGB value, determining the color of the area image, that is, the mark color of each area.
[0149] For example, Figure 4 As shown, the HSV color model corresponds to a cone subset in the cylindrical coordinate system. The top surface of the cone corresponds to V=1, which contains the three surfaces R=1, G=1, and B=1 in the RGB model, and the color it represents is brighter; the hue H is given by the rotation angle around the V axis, red corresponds to an angle of 0°, green corresponds to an angle of 120°, and blue corresponds to an angle of 240°. In the HSV color model, each color differs from its complementary color by 180°, where the complementary color of red is cyan, the complementary color of green is magenta, and the complementary color of blue is yellow; the saturation S takes values from 0 to 1, so the radius of the top surface of the cone is 1. The color domain represented by the HSV color model is a subset of the chromaticity diagram of the International Commission on Illumination (CIE). In this model, the purity of a color with a saturation of 100% is generally less than 100%. The vertex (i.e., the origin) of the cone corresponds to V=0, and H and S are undefined, representing black; the center point of the top surface of the cone corresponds to S=0, V=1, and H is undefined, representing white. From the center point of the top surface to the origin, it represents gray with gradually dimming brightness, that is, gray with different grayscales. The points on the line connecting the center point of the top surface to the origin correspond to S=0 and H is undefined. It can be said that the V axis in the HSV model corresponds to the main diagonal in the RGB color space. The points on the circumference of the top surface of the cone correspond to V=1 and S=1, indicating that the color is a pure color.
[0150] Exemplarily, a data processing method may include:
[0151] A1: The data processing device obtains an interface mark image of the application; the interface mark image includes at least one area marked by a colored box, and the box is a box of a preset width;
[0152] The data processing device obtains the correspondence between preset marking information and area types; displays the interface design image of an Android system application and the correspondence; receives a marking instruction based on the correspondence issued by a user, and generates an interface marking image according to the marking instruction and the interface design image; wherein the correspondence may include: the correspondence between video controls and C1 colors, the correspondence between linear layouts and C2 colors, the correspondence between image controls and C3 colors, and the correspondence between text controls and C4 colors, etc., and C1 color, C2 color, C3 color and C4 color are completely different colors.
[0153] For example, Figure 5 As shown, the interface design image 4 of the application of the Android system includes 7 areas, and the 7 areas include area 41, area 42, area 43, area 44, area 45, area 46 and area 47; Figure 6 As shown, an interface marking image 40 is generated based on the interface design image 4, and the interface marking image 40 is an image that conforms to the correspondence between preset marking information and area types, wherein area 41 is marked by a box 41-1 of C1 color, area 42 is marked by a box 42-2 of C2 color, area 43 is marked by a box 43-3 of C3 color, area 44 is marked by a box 44-4 of C4 color, area 45 is marked by a box 45-3 of C3 color, area 46 is marked by a box 46-4 of C4 color, and area 47 is marked by a box 47-4 of C4 color.
[0154] It should be noted that Figure 6 In the boxes 41-1, 42-2, 43-3, 44-4, 45-3, 46-4 and 47-4, different types of lines are used only to indicate different colors of the boxes, and the same type of lines are used to indicate that the boxes have the same color; wherein the lines used for the box 41-1 of color C1 are as follows: The line representation of the box 42-2 of color C2 is as follows: The lines used for the C3 color boxes 43-3 and 45-3 are as follows: The lines used for the C4 color blocks 44-4, 46-4, and 47-4 are as follows: In practical applications, the lines of boxes of different colors may be the same solid lines or dashed lines.
[0155] For example, in addition to the marking color, that is, using different colors to represent different distinction types, the marking color in the marking information can also be changed to a marking line or other marks, etc. When the marking color in the marking information is changed to a marking line or other marks, the correspondence between the preset marking information and the area type, and the color detection model change accordingly.
[0156] Exemplarily, taking the example of the mark color in the mark information being changed to the mark line, when the mark color in the mark information is changed to the mark line, the correspondence between the preset mark information and the area type is the correspondence between the preset mark line and the area type, and the correspondence between the preset mark line and the area type represents the one-to-one correspondence between each mark line and each layout type; the color detection model is changed to a line detection model, and the line detection model represents the correspondence between the interface mark image and the mark line.
[0157] Exemplarily, when at least one marked area is at least one area marked by different lines, the preset mark detection model includes a mark box detection model and a line detection model; the data processing device uses the mark box detection model to perform position detection on the interface mark image to obtain the mark position; based on the mark position, the interface mark image and the line detection model, the mark line of each area is obtained; and then, based on the mark line of each area, the area type corresponding to each area is determined from the correspondence between the preset mark lines and the area type.
[0158] A2: The data processing device uses a preset mark detection model to perform mark recognition on the interface mark image to obtain mark information of each area; the mark information includes the mark position and the mark color;
[0159] Exemplarily, the preset mark detection model is used to perform mark recognition on the interface mark image 40 to obtain the mark position 41-Z and C1 color of area 41, the mark position 42-Z and C2 color of area 42, the mark position 43-Z and C3 color of area 43, the mark position 44-Z and C4 color of area 44, the mark position 45-Z and C3 color of area 45, and the mark position 46-Z and C4 color of area 46.
[0160] Exemplarily, the data processing device can set coordinate reference information in a preset mark detection model, obtain the upper left corner coordinates of each area according to the coordinate reference information, and obtain the lower right corner coordinates of each area according to the second coordinate reference information; taking area 43 as an example, the mark position 43-Z of area 43 includes the upper left corner coordinates (x1, y1) and the upper right corner coordinates (x2, y2) of box 43-3; wherein x1 is the distance between the upper left corner of box 43-3 and the left border of the interface mark image, and y1 is the distance between the upper left corner of box 43-3 and the upper border of the interface mark image; the lower right corner coordinates are (x2, y2), x2 is the distance between the lower right corner of box 43-3 and the left border of the interface mark image, and y2 is the distance between the lower right corner of box 43-3 and the upper border of the interface mark image.
[0161] A3: The data processing device obtains the area type corresponding to each area according to the corresponding relationship between the mark color, the preset mark information and the area type;
[0162] Exemplarily, the data processing device obtains that the area type corresponding to area 41 is a video control based on the corresponding relationship and the C1 color of area 41; obtains that the area type corresponding to area 42 is a linear layout based on the corresponding relationship and the C2 color of area 42; obtains that the area type corresponding to area 43 is an image control based on the corresponding relationship and the C3 color of area 43; obtains that the area type corresponding to area 44 is a text control based on the corresponding relationship and the C4 color of area 44; obtains that the area type corresponding to area 45 is an image control based on the corresponding relationship and the C3 color of area 45; and obtains that the area type corresponding to area 46 is a text control based on the corresponding relationship and the C4 color of area 46.
[0163] A4: The data processing device obtains the initial interface area program for each area according to the preset program library, the marking coordinates of each area and the area type corresponding to each area.
[0164] Exemplarily, taking area 43 as an example, according to the area type corresponding to area 43 being an image control, a preset area program of area 43 is obtained from the preset program library; then, the upper left corner coordinates (x1, y1) and the upper right corner coordinates (x2, y2) of the box 43-3 corresponding to area 43 are used to modify the code at the corresponding first fill-in position in the preset area program, and the initial interface area program of area 43 is obtained, as shown below:
[0165]
[0166] Among them, ImageView indicates that area 43 is an image control, android:layout_gravity="center" indicates that area 43 is centered in the layout, android:id="@+id / back" indicates that an exclusive identification number id is assigned to area 43, android:layout_marginLeft="x1dp" indicates x1, android:layout_marginTop="y1dp" indicates y1, android:layout_marginRight="x2dp" indicates x2, and android:layout_marginBottom="y2dp" indicates y2.
[0167] A5: The data processing device obtains the area content of each area according to the area type, mark position and interface mark image; obtains the interface area program of each area according to the initial interface area program and the area content; when at least one marked area includes at least two marked areas, obtains the inclusion relationship corresponding to the at least two marked areas according to the mark position; according to the inclusion relationship, the interface area programs are combined to obtain the interface display program.
[0168] Exemplarily, the area content of area 44 is a date, and the area content of area 46 is text.
[0169] It can be understood that the data processing device obtains the area type corresponding to each area based on the correspondence between the interface mark image, preset mark information and area type of the application, and then obtains the interface display program of the application according to the interface mark image, mark information, area type and preset program library. Since the preset program library represents the area program corresponding to the area type, the interface area program of each area in the application can be called from the preset program library according to the area type of each area, thereby reducing the development time of the interface display program of the application. In addition, as long as a preset program library with good readability and high portability is set, the readability and portability of the interface display program of the application can be improved, and the preset program library can be reused, thereby reducing the development cost of the interface display program of the application.
[0170] Embodiment 2
[0171] Based on the same inventive concept of the first embodiment of the present invention, further description is given.
[0172] The embodiment of the present invention provides a data processing device 2, such as Figure 7 As shown, the device 2 includes an image acquisition unit 20, a mark recognition unit 21, a type determination unit 22 and a program generation unit 23; wherein,
[0173] An image acquisition unit 20 is used to acquire an interface mark image of an application program, wherein the interface mark image includes at least one marked area;
[0174] The mark recognition unit 21 is used to perform mark recognition on the interface mark image using a preset mark detection model to obtain mark information of each area in at least one marked area; the preset mark detection model represents the correspondence between the interface mark image and the mark information, and the mark information represents the mark feature corresponding to each area;
[0175] A type determination unit 22, configured to obtain the region type corresponding to each region according to the correspondence between the preset marking information and the region type and the marking information;
[0176] The program generating unit 23 is used to obtain the interface display program of the application program according to the interface marking image, marking information, area type and preset program library; the preset program library represents the area program corresponding to the area type.
[0177] In some embodiments, the at least one marked area is at least one area marked by a colored marking box; the marking information includes a marking position and a marking color.
[0178] In some embodiments, the preset marker detection model includes a marker box detection model and a color detection model;
[0179] The mark recognition unit 21 is specifically used to perform position detection on the interface mark image using a mark frame detection model to obtain the mark position; and to obtain the mark color according to the mark position, the interface mark image and the color detection model.
[0180] In some embodiments, the region type is a layout type or a control type, and the correspondence between the preset mark information and the region type includes: a first correspondence between a preset first mark color and a control type, and a second correspondence between a preset second mark color and a layout type;
[0181] The type determination unit 22 is specifically used to obtain a control type corresponding to an area according to the mark color and the first correspondence when the mark color of an area matches the first mark color in the first correspondence; an area belongs to at least one marked area; and when the mark color of an area matches the second mark color in the second correspondence, obtain a layout type corresponding to an area according to the mark color and the second correspondence; and then obtain the area type corresponding to each area.
[0182] In some embodiments, the program generation unit 23 is specifically used to obtain the initial interface area program for each area based on the mark position, area type and preset program library; and obtain the area content of each area based on the area type, mark position and interface mark image; and obtain the interface area program for each area based on the initial interface area program and the area content; and when at least one marked area includes at least two marked areas, obtain the inclusion relationship corresponding to the at least two marked areas based on the mark position; and combine the interface area programs based on the inclusion relationship to obtain the interface display program.
[0183] In some embodiments, the region type is a layout type or a control type, and the control type includes a text control and an image control;
[0184] The program generation unit 23 is specifically used to perform text recognition on an image corresponding to a marking position of a region in an interface marking image to obtain regional text within a region, and use the regional text as the regional content of a region when the region type corresponding to a region in at least one marked region is a text control; and to perform image extraction on an image corresponding to a marking position of a region in an interface marking image to obtain a regional image within a region, and use the regional image as the regional content of a region when the region type corresponding to a region is an image control; and to perform background recognition on an image corresponding to a marking position of a region in an interface marking image to obtain a regional background within a region, and use the regional background as the regional content of a region when the region type corresponding to a region is a layout type; and then obtain the regional content of each region.
[0185] In some embodiments, the marking position includes the coordinates of the positioning points of the marking box corresponding to each area;
[0186] The program generating unit 23 is specifically configured to determine the sub-inclusion relationship corresponding to each two regions according to the coordinates of the positioning points of each two regions in the at least two marked regions, and then obtain the inclusion relationship.
[0187] In some embodiments, the marking box is a square box, and the positioning point coordinates include the upper left corner coordinates and the lower right corner coordinates of the square box corresponding to each area, or the positioning point coordinates include the lower left corner coordinates and the upper right corner coordinates of the square box corresponding to each area.
[0188] In some embodiments, the marking frame is a circular frame, and the positioning point coordinates include the center coordinates and radius of the circular frame corresponding to each area.
[0189] In some embodiments, the marking box detection model includes a grid coordinate detection model and a confidence calculation model, the grid coordinate detection model represents the correspondence between the sub-unit grid and the predicted coordinates, and the confidence calculation model represents the correspondence between the predicted coordinates and the confidence;
[0190] The mark recognition unit 21 is specifically used to grid the interface mark image to obtain at least one unit grid corresponding to the interface mark image; and match at least one unit grid with each area to obtain a sub-unit grid corresponding to each area; the sub-unit grid belongs to at least one unit grid; and use the sub-unit grid, grid coordinate detection model and confidence calculation model to perform position detection on each area to obtain the mark position.
[0191] In some embodiments, the marking box is a marking box of a preset width;
[0192] The mark recognition unit 21 is specifically used to extract the image corresponding to the mark position from the interface mark image to obtain the mark area image of each area; and use the color detection model to perform color recognition on the target area that meets the preset width in the mark area image to obtain the mark color.
[0193] It should be noted that, in actual applications, the above-mentioned image acquisition unit 20, mark recognition unit 21, type determination unit 22 and program generation unit 23 can be implemented by a processor 24 located on the data processing device 2, specifically a CPU (Central Processing Unit), MPU (Microprocessor Unit), DSP (Digital Signal Processing) or a field programmable gate array (FPGA, Field Programmable Gate Array) and the like.
[0194] The embodiment of the present invention further provides a data processing device 2, such as Figure 8 As shown, the device 2 includes: a processor 24, a memory 25 and a communication bus 26. The memory 25 communicates with the processor 24 via the communication bus 26. The memory 25 stores one or more data processing programs executable by the processor 24. When one or more data processing programs are executed, any one of the data processing methods described in the aforementioned embodiments is executed by the processor 24.
[0195] In practical applications, the memory 25 can be a volatile first memory (volatile memory), such as a random access first memory (Random-Access Memory, RAM); or a non-volatile first memory (non-volatile memory), such as a read-only first memory (Read-Only Memory, ROM), a flash first memory (flash memory), a hard disk (Hard Disk Drive, HDD) or a solid-state drive (Solid-State Drive, SSD); or a combination of the above types of first memories, and provide programs and data to the processor 24.
[0196] An embodiment of the present invention provides a computer-readable storage medium, which stores a data processing program. When the data processing program is executed by the processor 24, the processor 24 executes any one of the data processing methods described in the above embodiments.
[0197] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program codes.
[0198] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0199] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0200] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0201] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention.
Claims
1. A data processing method, characterized in that: The method comprises: Acquire an interface markup image of an application, wherein the interface markup image includes at least one marked area; the interface markup image is generated after marking an interface design image of the application; the at least one marked area is at least one area marked by a colored markup frame; Using a preset mark detection model, the interface mark image is marked with a mark recognition to obtain the mark information of each area in the at least one marked area; the preset mark detection model represents the correspondence between the interface mark image and the mark information, and the mark information represents the mark feature corresponding to each area; the mark information includes a mark position and a mark color; Obtaining the area type corresponding to each area according to the correspondence between the preset marking information and the area type and the marking information; According to the marked position, the area type and the preset program library, an initial interface area program for each area is obtained; Obtaining the area content of each area according to the area type, the mark position and the interface mark image; Obtaining the interface area program of each area according to the initial interface area program and the area content; When the at least one marked area includes at least two marked areas, obtaining, according to the marking positions, a corresponding inclusion relationship between the at least two marked areas; According to the inclusion relationship, the interface area programs are combined to obtain the interface display program of the application program; the preset program library represents the area program corresponding to the area type.
2. The method according to claim 1, characterized in that: The preset mark detection model includes a mark frame detection model and a color detection model; The method of using a preset mark detection model to perform mark recognition on the interface mark image to obtain mark information of each area in the at least one marked area includes: Using the mark frame detection model, perform position detection on the interface mark image to obtain the mark position; The mark color is obtained according to the mark position, the interface mark image and the color detection model.
3. The method according to claim 1, characterized in that The area type is a layout type or a control type, and the correspondence between the preset mark information and the area type includes: a first correspondence between a preset first mark color and a control type, and a second correspondence between a preset second mark color and a layout type; The obtaining the region type corresponding to each region according to the correspondence between the preset marking information and the region type and the marking information includes: When a marking color of an area matches a first marking color in the first corresponding relationship, a control type corresponding to the area is obtained according to the marking color and the first corresponding relationship; the area belongs to the at least one marked area; When the mark color of the one region matches the second mark color in the second corresponding relationship, the layout type corresponding to the one region is obtained according to the mark color and the second corresponding relationship; and then the region type corresponding to each region is obtained.
4. The method according to claim 1, characterized in that: The area type is a layout type or a control type, and the control type includes a text control and an image control; The obtaining of the area content of each area according to the area type, the mark position and the interface mark image includes: When the area type corresponding to one of the at least one marked area is the text control, performing text recognition on an image corresponding to a marked position of the one area in the interface marked image to obtain area text within the one area, and using the area text as area content of the one area; When the area type corresponding to the one area is the image control, performing image extraction on an image corresponding to a mark position of the one area in the interface mark image to obtain an area image within the one area, and using the area image as the area content of the one area; When the area type corresponding to the one area is the layout type, background recognition is performed on the image corresponding to the mark position of the one area in the interface mark image to obtain the area background within the one area, and the area background is used as the area content of the one area; then the area content of each area is obtained.
5. The method according to claim 1, characterized in that The marking position includes the coordinates of the positioning points of the marking box corresponding to each area; The obtaining, according to the marked positions, the corresponding inclusion relationship of the at least two marked areas comprises: According to the coordinates of the positioning points of each two areas in the at least two marked areas, the sub-inclusion relationship corresponding to the each two areas is determined, and then the inclusion relationship is obtained.
6. The method according to claim 5, characterized in that The marking box is a square box, and the positioning point coordinates include the upper left corner coordinates and the lower right corner coordinates of the square box corresponding to each area, or the positioning point coordinates include the lower left corner coordinates and the upper right corner coordinates of the square box corresponding to each area.
7. The method according to claim 5, characterized in that The marking frame is a circular frame, and the positioning point coordinates include the center coordinates and radius of the circular frame corresponding to each area.
8. The method according to claim 2, characterized in that: The marking box detection model includes a grid coordinate detection model and a confidence calculation model, wherein the grid coordinate detection model represents the corresponding relationship between the sub-unit grid and the predicted coordinates, and the confidence calculation model represents the corresponding relationship between the predicted coordinates and the confidence; The using the mark frame detection model to perform position detection on the interface mark image to obtain the mark position includes: Performing grid division on the interface mark image to obtain at least one unit grid corresponding to the interface mark image; Matching the at least one unit grid with each region to obtain a sub-unit grid corresponding to each region; the sub-unit grid belongs to the at least one unit grid; The position of each area is detected by using the sub-unit grid, the grid coordinate detection model and the confidence calculation model to obtain the marked position.
9. The method according to claim 2, characterized in that: The marking frame is a marking frame of a preset width; The obtaining the mark color according to the mark position, the interface mark image and the color detection model includes: Extracting the image corresponding to the marked position from the interface marked image to obtain the marked area image of each area; The color detection model is used to perform color recognition on a target area in the marked area image that meets the preset width to obtain the marked color.
10. A data processing device, characterized in that: The device comprises: an image acquisition unit, a mark recognition unit, a type determination unit and a program generation unit; wherein, The image acquisition unit is used to acquire an interface mark image of the application, wherein the interface mark image includes at least one marked area; the interface mark image is generated after marking the interface design image of the application; the at least one marked area is at least one area marked by a colored mark frame; The mark recognition unit is used to perform mark recognition on the interface mark image using a preset mark detection model to obtain mark information of each area in the at least one marked area; the preset mark detection model represents the correspondence between the interface mark image and the mark information, and the mark information represents the mark features corresponding to each area; the mark information includes a mark position and a mark color; The type determination unit is used to obtain the area type corresponding to each area according to the correspondence between the preset marking information and the area type and the marking information; The program generation unit is used to obtain the initial interface area program of each area according to the mark position, the area type and the preset program library; obtain the area content of each area according to the area type, the mark position and the interface mark image; obtain the interface area program of each area according to the initial interface area program and the area content; when the at least one marked area includes at least two marked areas, obtain the inclusion relationship corresponding to the at least two marked areas according to the mark position; combine the interface area programs according to the inclusion relationship to obtain the interface display program of the application; the preset program library represents the area program corresponding to the area type.
11. The device according to claim 10, characterized in that The preset mark detection model includes a mark frame detection model and a color detection model; The mark recognition unit is specifically used to use the mark frame detection model to perform position detection on the interface mark image to obtain the mark position; and to obtain the mark color according to the mark position, the interface mark image and the color detection model.
12. The device according to claim 10, characterized in that The area type is a layout type or a control type, and the correspondence between the preset mark information and the area type includes: a first correspondence between a preset first mark color and a control type, and a second correspondence between a preset second mark color and a layout type; The type determination unit is specifically used to obtain the control type corresponding to the area according to the marking color and the first corresponding relationship when the marking color of the area matches the first marking color in the first corresponding relationship; the area belongs to the at least one marked area; and when the marking color of the area matches the second marking color in the second corresponding relationship, obtain the layout type corresponding to the area according to the marking color and the second corresponding relationship; and then obtain the area type corresponding to each area.
13. The device according to claim 10, characterized in that The area type is a layout type or a control type, and the control type includes a text control and an image control; The program generation unit is specifically configured to, when the area type corresponding to one of the at least one marked area is the text control, perform text recognition on the image corresponding to the marking position of the one area in the interface marking image to obtain the area text within the one area, and use the area text as the area content of the one area; When the area type corresponding to the one area is the image control, an image corresponding to the mark position of the one area in the interface mark image is extracted to obtain an area image within the one area, and the area image is used as the area content of the one area; And when the area type corresponding to the one area is the layout type, background recognition is performed on the image corresponding to the mark position of the one area in the interface mark image to obtain the regional background within the one area, and the regional background is used as the regional content of the one area; and then the regional content of each area is obtained.
14. The device according to claim 10, characterized in that The marking position includes the coordinates of the positioning points of the marking box corresponding to each area; The program generation unit is specifically used to determine the sub-inclusion relationship corresponding to each two areas according to the coordinates of the positioning points of each two areas in the at least two marked areas, and then obtain the inclusion relationship.
15. The device according to claim 14, characterized in that The marking box is a square box, and the positioning point coordinates include the upper left corner coordinates and the lower right corner coordinates of the square box corresponding to each area, or the positioning point coordinates include the lower left corner coordinates and the upper right corner coordinates of the square box corresponding to each area.
16. The device according to claim 14, characterized in that The marking frame is a circular frame, and the positioning point coordinates include the center coordinates and radius of the circular frame corresponding to each area.
17. The device according to claim 11, characterized in that The marking box detection model includes a grid coordinate detection model and a confidence calculation model, wherein the grid coordinate detection model represents the corresponding relationship between the sub-unit grid and the predicted coordinates, and the confidence calculation model represents the corresponding relationship between the predicted coordinates and the confidence; The mark recognition unit is specifically used to grid the interface mark image to obtain at least one unit grid corresponding to the interface mark image; and matching the at least one unit grid with each region to obtain a sub-unit grid corresponding to each region; The sub-unit grid belongs to the at least one unit grid; And using the sub-unit grid, the grid coordinate detection model and the confidence calculation model, position detection is performed on each area to obtain the marked position.
18. The device according to claim 11, characterized in that The marking frame is a marking frame of a preset width; The mark recognition unit is specifically used to extract the image corresponding to the mark position from the interface mark image to obtain the mark area image of each area; And using the color detection model, color recognition is performed on the target area in the marked area image that meets the preset width to obtain the marked color.
19. A data processing device, characterized in that: The device includes: a processor, a memory and a communication bus, the memory communicates with the processor via the communication bus, the memory stores one or more data processing programs executable by the processor, and when the one or more data processing programs are executed, the steps of the method described in any one of claims 1 to 9 are performed by the processor.
20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a data processing program, and when the data processing program is executed by a processor, the processor is enabled to execute the steps of the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Test method and test terminal
CN105930261A
Application icon setting method and apparatus, and mobile terminal
CN108008878A
Method and device for generating interface, computer equipment and storage medium
CN108304243A
Method and device for generating graphical interface
CN109117228A
