A data processing method, a data processing device and a data processing device
By segmenting web pages and judging features, it solves the problems of high resource consumption and low feature distinction during web page rendering, and achieves efficient target image recall and accurate judgment.
Patent Information
- Application Number
- CN201810555878.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-06-01
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2039-04-14
AI Technical Summary
Existing image search technology consumes a lot of system resources and time during the rendering process of web pages, resulting in low recall efficiency of target images, and low distinction of image features within the entire web page, affecting the accuracy of judgment of target images.
By dividing the web page source code into blocks, the image features corresponding to the page blocks are determined, including the text features surrounding the image and the page structure features, to determine whether the image is the target image, avoiding the rendering process, thereby saving resources and improving recall efficiency.
Without rendering the web page, the recall efficiency and judgment accuracy of the target image are improved, the distinction of features between different images is enhanced, and system resource consumption is reduced.
Smart Images

Figure CN110633399B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Internet information processing, and in particular to a data processing method, device and a device for data processing. Background Art
[0002] Image search refers to the information retrieval process of searching from image data based on the user's search request and returning sorted image results to the user according to indicators such as relevance. Image search can meet the user's needs to find images on the Internet. In the process of accumulating image data, the recall of target images of web pages has an important impact on the sorting results in image search. The target image of a web page can refer to the image that is closely related to the main content of the web page. The concepts corresponding to the target image can include: advertising images, recommended content images, website LOGO (trademark, LOGOtype), and other images that are less related to the main content, hereinafter referred to as non-target images.
[0003] A related technology can render a web page and recall a target image based on the rendered web page; however, the web page rendering process consumes a lot of system resources and time resources, and makes the recall efficiency of the target image low. Summary of the invention
[0004] The embodiments of the present invention provide a data processing method, a device and a device for data processing, which can save system resources and time resources consumed in the rendering process of a web page and improve the recall efficiency of a target image.
[0005] In order to solve the above problem, an embodiment of the present invention discloses a data processing method, including:
[0006] Dividing a web page into blocks according to page elements included in the web page source code to obtain a plurality of page blocks included in the web page;
[0007] Determine the image features of the image corresponding to the page block; the image features include: features of text surrounding the image and page structure features;
[0008] Based on the picture features, determine whether the corresponding picture is the target picture.
[0009] On the other hand, an embodiment of the present invention discloses a data processing device, including:
[0010] A web page segmentation module, used to segment a web page according to page elements included in the web page source code, so as to obtain a plurality of page segments included in the web page;
[0011] A picture feature determination module is used to determine the picture features of the picture corresponding to the page block; the picture features include: surrounding text features and page structure features around the picture; and
[0012] The target image judging module is used to judge whether the corresponding image is the target image according to the image features.
[0013] In another aspect, an embodiment of the present invention discloses a device for data processing, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations:
[0014] Dividing a web page into blocks according to page elements included in the web page source code to obtain a plurality of page blocks included in the web page;
[0015] Determine the image features of the image corresponding to the page block; the image features include: features of text surrounding the image and page structure features;
[0016] Based on the picture features, determine whether the corresponding picture is the target picture.
[0017] On the other hand, an embodiment of the present invention discloses a machine-readable medium having instructions stored thereon, which, when executed by one or more processors, enables the device to perform one or more of the data processing methods described above.
[0018] The embodiments of the present invention include the following advantages:
[0019] The embodiment of the present invention divides a web page into blocks based on page elements included in the web page source code, and can do so without rendering the web page. Therefore, it can save system resources and time resources consumed in the web page rendering process and can improve the recall efficiency of target images.
[0020] Furthermore, the embodiment of the present invention determines the image features in units of page blocks, which can achieve the distinction of image features between different images, and can overcome the problem of low distinction of image features between different images caused by determining image features in the entire web page, that is, the distinction of image features between different images can be improved; on this basis, whether the corresponding image is a target image can be judged based on image features with higher distinction, thereby improving the judgment accuracy of the target image. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0022] Figure 1 It is a schematic diagram of an application environment of a data processing method according to an embodiment of the present invention;
[0023] Figure 2 is a flow chart of steps of a data processing method embodiment 1 of the present invention;
[0024] Figure 3 A schematic diagram of a tree structure according to an embodiment of the present invention;
[0025] Figure 4 is a flow chart of steps of a second embodiment of a data processing method of the present invention;
[0026] Figure 5 is a flow chart of steps of a data processing method embodiment 3 of the present invention;
[0027] Figure 6 It is a schematic diagram of a picture corresponding to a page block of the present invention;
[0028] Figure 7 is a structural block diagram of an embodiment of a data processing device of the present invention;
[0029] Figure 8 is a block diagram of an apparatus 800 for data processing according to the present invention; and
[0030] Fig. 9 It is a schematic diagram of the structure of the server in some embodiments of the present invention. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] An embodiment of the present invention provides a data processing solution, which can divide a web page into blocks based on page elements included in the web page source code to obtain multiple page blocks included in the web page; determine the image features of the images corresponding to the page blocks; the image features may include: text features surrounding the image and page structure features; and based on the image features, determine whether the corresponding image is a target image.
[0033] The embodiment of the present invention divides a web page into blocks based on page elements included in the web page source code, and can do so without rendering the web page. Therefore, it can save system resources and time resources consumed in the web page rendering process and can improve the recall efficiency of target images.
[0034] Furthermore, the embodiment of the present invention determines the image features in units of page blocks, which can achieve the distinction of image features between different images, and can overcome the problem of low distinction of image features between different images caused by determining image features in the entire web page, that is, the distinction of image features between different images can be improved; on this basis, whether the corresponding image is a target image can be judged based on image features with higher distinction, thereby improving the judgment accuracy of the target image.
[0035] The data processing method provided by the embodiment of the present invention can be applied in an application environment such as a website and / or an APP (application) to realize the recall of a target image on a web page.
[0036] The data processing method provided by the embodiment of the present invention can be applied to Figure 1 In the application environment shown, Figure 1 As shown, the client 100 and the server 200 are located in a wired or wireless network, and the client 100 and the server 200 perform data exchange through the wired or wireless network.
[0037] In one embodiment of the present invention, a picture recall interface can be provided for calling, and the picture recall interface can be used to recall a target picture in a web page. Specifically, the picture recall interface can recall the target picture in the web page based on the input web page using the data processing method of the embodiment of the present invention, and output the target picture. Optionally, in the process of calling the picture recall interface, the user can upload the web page code of the web page, or can upload the URL (Uniform Resource Locator) and other information of the web page.
[0038] In another embodiment of the present invention, a server (e.g., an image search server) may determine a webpage library, and use the data processing method of an embodiment of the present invention to recall target images from webpages in the webpage library. The recalled images may be used in image search scenarios. Optionally, the webpages in the webpage library may be obtained by webpage crawling.
[0039] It can be understood that the above-mentioned image recall interface and image search scenario of the present invention are only examples of application scenarios of the embodiment of the present invention, and the embodiment of the present invention does not limit the specific application scenarios. The categories of web pages in the embodiment of the present invention may include: news categories, blog categories, forum categories, etc., and the embodiment of the present invention does not limit the specific categories of web pages.
[0040] Optionally, the client 100 can run on a terminal, which specifically includes but is not limited to: smart phones, tablet computers, e-book readers, MP3 (Moving Picture Experts Group Audio Layer III) players, MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, car computers, desktop computers, set-top boxes, smart TVs, wearable devices, etc.
[0041] Method Example 1
[0042] Reference Figure 2 , shows a flow chart of the steps of a data processing method embodiment 1 of the present invention, which may specifically include the following steps:
[0043] Step 201: divide the web page into blocks according to the page elements included in the web page source code to obtain a plurality of page blocks included in the web page;
[0044] Step 202: Determine the image features of the image corresponding to the page block; the image features may include: features of text surrounding the image and page structure features;
[0045] Step 203: Determine whether the corresponding image is a target image based on the image features.
[0046] Figure 2 At least one step of the illustrated embodiment may be executed by a server and / or a client. Of course, the embodiment of the present invention does not limit the specific execution subject of each step.
[0047] In step 201, the web page source code may refer to the source code of the web page, which may represent the language structure of the web page.
[0048] The computer languages corresponding to the web page code mainly include: HTML (Hypertext Markup Language), VB (Visual Basic), JAVA, etc. Among them, HTML is the most commonly used and basic language, and an indispensable language in web pages. The setting of page elements such as the title, frame, background, font, hyperlink, color, etc. of the web page can be completed by HTML language. Of course, the embodiment of the present invention does not limit the specific computer language corresponding to the web page code.
[0049] The web page source code is actually a web page file composed of many various page elements, and the browser can usually directly run web page files such as HTML files. Page elements can be used as the basic objects that constitute web page files. Page elements can be defined by tags.
[0050] Tags are used to mark HTML elements. The text between the start tag and the end tag can be used as the content of the page element. In one example, the tags can be (used to define information about the document), (used to define the body of the document), (used to define tables) and other objects enclosed by angle brackets "<" and ">". Some tags appear in pairs, such as <hr>
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061] Figure 3
[0062]
[0063] Used to define paragraphs.
[0064] Will Figure 3 The tree structure shown is converted into a one-dimensional vector: [html, head, body, p, img].
[0065] The embodiment of the present invention divides the one-dimensional vector into blocks according to preset boundary elements; wherein the preset boundary elements can play the role of boundaries.
[0066] In an optional embodiment of the present invention, the above-mentioned preset boundary elements may include: style (style is used to define style information for HTML documents) elements, script (script is used to define client scripts, such as JavaScript) elements, comment (comment) elements, external content (article) elements, or elements containing non-digital identifiers (ID, Identity).
[0067] The above-mentioned preset boundary elements can usually indicate the end of a logical unit, so they can be used as boundaries. Generally, page elements with IDs are the areas that page editors focus on, and are more likely to contain text images; however, IDs with numbers are more likely to come from avatar images in a hierarchical structure, and are generally not valid text images, similar to forum user avatar images. Therefore, elements with non-digital IDs can be used as preset boundary elements.
[0068] Optionally, the element containing a non-numeric identifier may specifically include: a table element containing a non-numeric identifier, a section (div) element containing a non-numeric identifier, or an unordered list (ul) element containing a non-numeric identifier, etc.
[0069] It can be understood that those skilled in the art can use elements with boundary properties as preset boundary elements according to actual application requirements, and the embodiments of the present invention do not limit the specific preset boundary elements.
[0070] In an application example of the present invention, it is assumed that the one-dimensional vector is:
[0071] [body,p,div,img,comment,div,p,span,text,script,text,div(id='foot')]
[0072] Then the one-dimensional vector can be divided into the following page blocks:
[0073] [body,p,div,img,comment|,div,p,span,text,script|,text,div(id='foot')]
[0074] Among them, "|" represents the segmentation point, span is used to represent the section in the document, and text is used to represent the text in the page element. In this example, comment, div, and script are used as boundary elements to perform one-dimensional vector segmentation to obtain the corresponding four page blocks.
[0075] Step 201 divides a web page into a plurality of page blocks, wherein a page block may include a page element img (used to represent a picture) element, or a page block may not include an img element. The embodiment of the present invention may use a picture corresponding to an img element in a page block as a picture corresponding to the page block. The embodiment of the present invention may extract corresponding picture features for a picture corresponding to a page block. The embodiment of the present invention determines picture features in units of page blocks, and can achieve differentiation of picture features between different pictures, and can overcome the problem of low differentiation of picture features between different pictures caused by determining picture features in the entire web page, that is, can improve the differentiation of picture features between different pictures.
[0076] The picture features of the embodiment of the present invention may include: features of text surrounding the picture and page structure features.
[0077] Among them, the surrounding text feature around the image can be used to characterize the properties of the surrounding text around the image.
[0078] According to an embodiment, the property of the text surrounding the picture may include: the density of the text surrounding the picture. Generally, the higher the density, the greater the probability that the picture is the target picture; conversely, the lower the density, the smaller the probability that the picture is the target picture.
[0079] According to another embodiment, the property of the surrounding text around the picture may include: the degree of variation of the surrounding text around the picture. Generally, the greater the degree of variation, the greater the probability that the picture is the target picture; conversely, the smaller the degree of variation, the more similar the length of the surrounding text around the picture is, and the smaller the probability that the picture is the target picture.
[0080] According to another embodiment, the nature of the text surrounding the picture may include: recommended text surrounding the picture. Examples of recommended text may include: "Guess you like", "Popular short video recommendation", "Recommended", "I will watch again after watching", "Highlights", etc. In the case where recommended text appears around the picture, the probability that the picture is the target picture is small.
[0081] In an optional embodiment of the present invention, the text feature surrounding the image may include but is not limited to at least one of the following features:
[0082] Feature A1, recommended text features;
[0083] Feature A2: variance of the length of text surrounding the image;
[0084] Feature A3, the total number of texts surrounding the image;
[0085] Feature A4, the average length of text surrounding the image; and
[0086] Feature A5: The proportion of hyperlink text in the surrounding text around the image.
[0087] Feature A1 is used to characterize the recommended text around the picture. Optionally, the recommended text may also correspond to a position feature, which is used to characterize the positional relationship between the recommended text and the picture. The above position feature may include: a first position feature of the picture relative to the recommended text, or a second position feature of the recommended text relative to the picture. Therefore, the recommended text feature of the embodiment of the present invention may include: recommended text and position features. Taking "Guess you like" as an example, the picture is usually located below "Guess you like", so the first position feature is "below".
[0088] The embodiment of the present invention can determine whether a short text in a web page is a recommended text through a judgment method, thereby realizing the collection of recommended texts. The judgment method may include: natural language processing related algorithms, manual screening methods, etc. Among them, natural language processing related algorithms may include: grammatical analysis methods, or machine classification methods, etc. Among them, the grammatical analysis method is used to determine whether a short text in a web page is a recommended text from a grammatical level, and the machine classification method is used to determine whether a short text in a web page is a recommended text from a classification level. Natural language processing related algorithms can mine more recommended texts, thereby improving the coverage of recommended texts and improving the judgment accuracy of target images.
[0089] The embodiment of the present invention can also determine the corresponding position feature for the collected recommended text. Taking the position feature as the first position feature as an example, the first position feature can include: "below", "above", "left", or "right", etc. It can be understood that the embodiment of the present invention does not limit the specific position feature.
[0090] Feature A2 is used to characterize the degree of change of the text surrounding the image. A process for determining the variance of the length of the text surrounding the image may include: for the image corresponding to the page block, counting the length changes of N texts before and after the image in the page block where it is located; wherein N may be a natural number greater than 1, for example, N may be a value such as 2, 3, 4, or 5. "Before and after" may follow the order of elements in a one-dimensional vector. For example, if the vector segment where a page block is located is [a, b, c, img, e, f, g], then N non-empty text elements may be taken from before and after the img element in the vector segment, respectively, to determine the length of the N texts, and calculate the variance corresponding to the N texts.
[0091] Features A3 and A4 are used to characterize the density of text surrounding the image. Feature A3 is the total number of characters of text surrounding the image; feature A4 is the average number of characters of text surrounding the image.
[0092] In feature A5, a hyperlink refers to a link that jumps to the page pointed to by the link when clicked. A hyperlink can link to pictures, programs, music, videos, and even non-page elements. The higher the proportion of hyperlink text in the surrounding text around the picture, the higher the probability that the picture is a recommended content picture, that is, the lower the probability that the picture is a target picture. Conversely, the lower the proportion of hyperlink text in the surrounding text around the picture, the lower the probability that the picture is a recommended content picture, that is, the higher the probability that the picture is a target picture.
[0093] When there are many surrounding texts around the image, the surrounding text features can serve as a good basis for judging whether the image is a target image. However, for short text pages or single image pages, the target images have fewer surrounding texts, while the non-target images also have certain surrounding texts. Therefore, it is usually impossible to effectively distinguish the target images and non-target images in the short text page or the single image page, which leads to a low accuracy rate in judging the target images, that is, a poor recall effect of the target images.
[0094] The page structure feature may refer to the page structure corresponding to the page block, that is, the layout of the content of the page block where the image is located. The above-mentioned page structure feature may reflect features different from the features of the surrounding text around the image, and therefore, may be used as a supplement to the features of the surrounding text around the image. In particular, when there is less surrounding text around the image corresponding to the image, combining the surrounding text features around the image and the page structure feature may improve the accuracy of the target image judgment, that is, may improve the recall effect of the target image.
[0095] In an optional embodiment of the present invention, the page structure features may include: page block features corresponding to the image, and / or page element features surrounding the image.
[0096] The page block feature can reflect the type of the page block to a certain extent. For example, the type of the page block may include: text type, comment type, directory area type, personal information type, or recommendation area type, etc. If the type of the page block is the text type, the probability that the image is the target image is high. If the type of the page block is the comment type, directory area type, personal information type, or recommendation area type, the probability that the image is the target image is low.
[0097] Optionally, the page block feature may include at least one of the following features:
[0098] Feature B1, a first number of page elements included in the page block;
[0099] Feature B2, a ratio of a first number of page elements included in a page block to a second number of page elements included in a web page;
[0100] Feature B3, the third amount of time information contained in the page block;
[0101] Feature B4, a ratio of a third amount of time information included in the page block to a fourth amount of time information included in the web page;
[0102] Feature B5, a ratio of the fifth amount of hyperlink text contained in the page block to the sixth amount of text contained in the page block;
[0103] Feature B6: the ratio of the seventh number of hyperlink images contained in the page block to the eighth number of images contained in the page block.
[0104] Examples of feature B1 may include: the first number of li elements included in the page block, or the first number of br elements included in the page block, or the first number of p elements included in the page block, etc. Among them, the li element is used to define the items of the list, the br element is used to define a simple line break, and the p element is used to define a paragraph.
[0105] Examples of feature B2 may include: the ratio of the first number of li elements included in the page block to the second number of li elements included in the web page, or the ratio of the first number of br elements included in the page block to the second number of br elements included in the web page, or the ratio of the first number of p elements included in the page block to the second number of p elements included in the web page, etc.
[0106] Both feature B1 and feature B2 can reflect the number of page elements contained in the page block. In an example of the present invention, if the page block contains more br elements and p elements, the type of the page block may be a text type.
[0107] For features B3 and B4, time information may refer to information representing time, such as "x year x month x day", "x month x day", "x hour x minute", etc. If a page block contains more time information, it is more likely to be a comment type.
[0108] For features B5 and B6, hyperlink text and hyperlink images are both hyperlinks. If the ratio of the number of hyperlinks contained in a page block to the number of normal text or normal images contained in the page block is high, it means that the probability that the page block is a recommended area type is high.
[0109] In an optional embodiment of the present invention, the features of page elements around the image may specifically include: the number of page elements around the image, and / or the proportion of hyperlink images around the image.
[0110] The number of page elements around the image may include: the number of h1 elements (used to define HTML titles), h2 elements (used to define HTML titles), h3 elements (used to define HTML titles), h4 elements (used to define HTML titles), input elements (used to define input controls), select elements (used to define selection lists (drop-down lists)), form elements (used to define HTML forms for user input), option elements (used to define options in selection lists), p elements, div elements, span elements, li elements, ol elements (used to define ordered lists), a elements (used to define anchors), br elements, or img elements before (after) the image. The ratio of hyperlink images around the image may refer to the ratio of the ninth number of hyperlink images around the image in the page block where the image is located to the eighth number of images contained in the page block. The ratio of hyperlink images around the image may include: the ratio of hyperlink images before the image, and / or the ratio of hyperlink images after the image, etc.
[0111] The page elements around the image can reflect to a certain extent whether the image is the target image. For example, for a non-list page, if there are many li elements around the image, the content around the image may be recommended content, which means the image is less likely to be the target image. For another example, if there are input elements around the image, the image may be a small image near the search box, which means the image is less likely to be the target image.
[0112] In an optional embodiment of the present invention, the above-mentioned picture features may also include: picture features themselves and / or page features corresponding to the picture, which can improve the diversity of picture features and further improve the accuracy of determining the target picture.
[0113] The specific characteristics of the image itself may include but are not limited to: URL length, image name length, the proportion of numbers contained in the image name, the width and height attribute values of the image, the similarity between the alt attribute and the HTML title, the number of unconventional attributes of the image, the position of the image in the web page source code, whether the image is a hyperlink image, whether the image is below the content title, and the height of the DOM tree corresponding to the image, etc.
[0114] Among them, the alt attribute is a parameter attribute used in the web page language HTML and XHTML (Extensible Hypertext Markup Language) for outputting plain text. Its function is to display the alt (alternative) text as a remedial measure when the object of the HTML element itself cannot be rendered.
[0115] Among them, the unconventional attributes of image elements mainly refer to some attributes defined by the web page editors themselves, which are mainly used to distinguish regular attributes (such as width, height, class name, etc.).
[0116] The features of the image itself are strong features and can be used to distinguish target images from non-target images.
[0117] Taking URL length as an example, the longer the URL, the greater the probability that the image is a text image. For example, the URL of Image 1 is: http: / / static.nipic.com / images / oh_help.jpg, and the URL of Image 2 is: http: / / pic158.nipic.com / file / 20180322 / 10185515_142500532000_2.jpg. Judging from the URL length alone, the probability that Image 2 is the target image is higher.
[0118] The page features corresponding to the image can be used to determine the category of the webpage, and the category of the webpage can be further used as a basis for judging whether the image is a target image. The above page features may include but are not limited to: the number of key information such as the host / posts on the page, whether the page contains a title, the location of the page title, the location of the page breadcrumbs, the location of the page number, etc. For example, if the page contains key information such as the host / posts, it can be said that the category of the webpage is a forum category.
[0119] In step 203, it is determined whether the corresponding picture is a target picture based on the picture features.
[0120] In an optional embodiment of the present invention, a mapping relationship between a combination of picture features and a determination result of a target picture may be preset, and step 203 may use the mapping relationship to determine whether the corresponding picture is the target picture.
[0121] Referring to Table 1, an example of a mapping relationship according to an embodiment of the present invention is shown.
[0122] In a mapping relationship record, if the surrounding text feature A around the image is "no recommended text appears around the image", and the page structure feature A is "the page block contains more br elements and p elements", then the image is the target image.
[0123] In another mapping relationship record, the surrounding text feature B around the image is "recommended text appears around the image", and the page structure feature B is "there are many li elements around the image", then the image is a non-target image.
[0124] In another mapping relationship record, the text feature C surrounding the image is "the variance of the length of the text surrounding the image is large", the page structure feature C is "the page block contains more br elements and p elements, and the image does not contain time information", and the URL of the image is long, then the image is the target image.
[0125] In another mapping relationship record, the feature D of the text surrounding the picture is "the variance of the length of the text surrounding the picture is large", the page structure feature D is "the page block contains more br elements and p elements, and the picture does not contain time information", the URL of the picture is long, and the page contains key information such as posting, then the picture is the target picture.
[0126] It can be understood that the above mapping relationship is recorded only as an example, and those skilled in the art can determine the required mapping relationship according to actual application requirements, and the embodiment of the present invention does not limit the specific mapping relationship.
[0127] Table 1
[0128]
[0129]
[0130] In another optional embodiment of the present invention, step 203 is a process of determining whether the corresponding image is a target image based on the image features, which may specifically include: obtaining a feature vector based on the image features; inputting the feature vector into a classification model to obtain a classification result output by the classification model; the categories corresponding to the classification model may include: a target image category and a non-target image category.
[0131] The classification model may be a two-category classification model, that is, the classification result output by the classification model may include: a target image category or a non-target image category.
[0132] This solution regards the recall problem of target images as a binary classification problem of page images, uses images as samples for classification, extracts image features by analyzing the source code of web pages, uses machine learning algorithms to learn large-scale training data, trains classification models, and uses the classification model to predict whether the image corresponding to the page block is the text image.
[0133] In practical applications, a machine learning algorithm can be used to train the training data to obtain the above classification model. The above training data may include: picture features corresponding to the target picture samples and the non-target picture samples, respectively. Examples of the above machine learning algorithms may include: nearest neighbor classification, Bayesian, LR (logistic regression), SVM (support vector machine), Adaboost (adaptive boost), neural network, etc. It can be understood that the embodiments of the present application do not limit the machine learning algorithm corresponding to the classification model.
[0134] In an application example of the present application, it is assumed that the set corresponding to the above training data is {(x i ,y i )}, where i = 1, ..., n, x i are the image features corresponding to the target image samples and non-target image samples, respectively, y i For the x i The corresponding image category, y i The number of types may be consistent with the number of types of picture categories. Specifically, in the embodiment of the present invention, the types of picture categories may be two: target picture categories and non-target picture categories. Then y i The value 1 or -1 can represent the target image category and the non-target image category respectively; the SVM model trained by the machine learning algorithm can represent
[0135] Among them, sgn is the sign function, b * is the classification threshold, α i * is the optimal classification parameter obtained through training, x represents the image features, and f(x) is the output function.
[0136] The embodiment of the present invention does not limit the method for determining the training data. Optionally, the target image can be obtained offline by rendering a web page, and then used as training data to train the classification model of the embodiment of the present invention to improve the judgment accuracy and recall rate of the target image.
[0137] In an optional embodiment of the present invention, the embodiment of the present invention may recall an erroneous target image, that is, the judgment of step 203 is wrong. In this case, the erroneous target image can be used as a non-target image sample to update the parameters of the classification model. In addition, the embodiment of the present invention can also obtain the corresponding similar web page for the web page where the erroneous target image is located, and obtain the corresponding non-target image for the similar image, and use the non-target image as a non-target image sample to update the parameters of the classification model. Because generally for similar web pages, images in the same position will be recalled incorrectly, the non-target images obtained by the embodiment of the present invention may include: images that are easily recalled incorrectly.
[0138] The above scheme can improve the accuracy of target image recall to a certain extent and reduce the problem of erroneous recall of non-target images; more training data can be added to improve the overall effect of the classification model while reducing the labor cost of collecting training data; and the situation of erroneous recall of non-target images can be effectively reduced.
[0139] In summary, the data processing method of the embodiment of the present invention divides the web page into blocks according to the page elements included in the web page source code, and can be performed without rendering the web page. Therefore, it can save system resources and time resources consumed in the rendering process of the web page, and can improve the recall efficiency of the target image.
[0140] Furthermore, the embodiment of the present invention determines the image features in units of page blocks, which can achieve the distinction of image features between different images, and can overcome the problem of low distinction of image features between different images caused by determining image features in the entire web page, that is, the distinction of image features between different images can be improved; on this basis, whether the corresponding image is a target image can be judged based on image features with higher distinction, thereby improving the judgment accuracy of the target image.
[0141] Method Example 2
[0142] Reference Figure 4 , shows a flow chart of the steps of a data processing method embodiment 2 of the present invention, which may specifically include the following steps:
[0143] Step 401: divide the web page into blocks according to the page elements included in the web page source code to obtain a plurality of page blocks included in the web page;
[0144] Step 402: Determine the image features of the image corresponding to the page block; the image features may include: features of text surrounding the image and page structure features;
[0145] Step 403: Obtain a feature vector according to the image features;
[0146] Step 404: if the web page is a list page, input the feature vector into a first classification model to obtain a first classification result output by the first classification model; the first classification model may be obtained based on training data corresponding to the list page; or
[0147] Step 405: If the web page is a non-list page, the feature vector is input into a second classification model to obtain a second classification result output by the second classification model; the second classification model can be obtained based on the training data corresponding to the non-list page.
[0148] Relative to Figure 2 In the first embodiment of the method shown, this embodiment refines the process of judging whether the corresponding picture is the target picture according to the picture features through steps 403 to 405. In practical applications, steps 403 and 404 may be performed, or steps 403 and 405 may be performed.
[0149] Since the layout corresponding to the recommended pictures of non-list pages is similar to the layout corresponding to the target pictures of list pages, in order to avoid the classification model from mistakenly identifying the recommended pictures of non-list pages as target pictures, the embodiment of the present invention trains classification models for list pages and non-list pages separately. Specifically, the first classification model is trained for list pages, and the second classification model is trained for non-list pages. In this way, the classification effects of the first classification model and the second classification model can be improved.
[0150] The embodiment of the present invention does not limit the method for determining whether a web page is a list page. For example, the determination method may be a rule determination method, or the determination method may be a website matching method, or the determination method may be a classification method.
[0151] Furthermore, the embodiment of the present invention does not limit the timing of determining whether a web page is a list page. For example, it is possible to determine whether a web page is a list page before step 403, or to determine whether a web page is a list page after step 403, or to determine whether a web page is a list page at the same time as step 403, and so on.
[0152] In summary, the data processing method of the embodiment of the present invention trains a first classification model for list pages and trains a second classification model for non-list pages, which can prevent the second classification model from mistakenly identifying recommended images on non-list pages as target images.
[0153] Method Example 3
[0154] Reference Figure 5 , shows a flow chart of the steps of a data processing method embodiment 3 of the present invention, which may specifically include the following steps:
[0155] Step 501: Based on the webpage source code, a machine learning algorithm is used to determine whether the webpage is a list page to obtain a corresponding determination result;
[0156] For example, for a web page with the URL http: / / blog.sina.com.cn / s / blog_4cd1c1670102x4ku.html, it can be determined that it is a non-list page.
[0157] Step 502: converting page elements in the webpage source code into one-dimensional vectors, and dividing the one-dimensional vectors into blocks according to preset boundary elements to obtain a plurality of page blocks included in the webpage;
[0158] Step 503: extract corresponding picture features for the picture corresponding to the page block;
[0159] For example, for Figure 6 The page corresponding to the hot event shown may specifically include: picture A, text 1 located above picture A, and text 2 located below picture A. The URL corresponding to picture A is:
[0160] http: / / s5.sinaimg.cn / mw690 / 001pdJDVzy7g3dSt8FKd4&690
[0161] The image features corresponding to image A are as follows:
[0162] Recommended text features: No recommended text appears around the image;
[0163] Image characteristics: URL length is 52, and the proportion of numbers is 14 / 52;
[0164] Features of elements around the image: The total number of texts surrounding the image is: 301 (501);
[0165] Features of the page where the image is located: there is a title.
[0166] Step 504: input the feature vector corresponding to the image feature into the classification model corresponding to the judgment result to obtain the classification result output by the classification model.
[0167] for Figure 6 For the picture shown, the second classification model will output 1, which means that the picture is the target picture.
[0168] In summary, the data processing method of the embodiment of the present invention trains the second classification model for non-list pages, which can prevent the second classification model from mistakenly identifying recommended images on non-list pages as target images.
[0169] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0170] Device Embodiment
[0171] Reference Figure 7 , shows a structural block diagram of an embodiment of a data processing device of the present invention, which may specifically include: a web page segmentation module 701, a picture feature determination module 702 and a target picture judgment module 703.
[0172] The web page segmentation module 701 is used to segment the web page according to the page elements included in the web page source code to obtain a plurality of page blocks included in the web page;
[0173] The picture feature determination module 702 is used to determine the picture features of the picture corresponding to the page block; the picture features include: surrounding text features and page structure features around the picture; and
[0174] The target image judging module 703 is used to judge whether the corresponding image is the target image according to the image features.
[0175] Optionally, the page structure features may include: page block features corresponding to the image, and / or page element features surrounding the image.
[0176] Optionally, the page block feature may include at least one of the following features:
[0177] a first number of page elements that a page block may include;
[0178] A ratio of a first number of page elements included in a page block to a second number of page elements that a web page may include;
[0179] a third amount of time information contained in the page block;
[0180] a ratio of a third amount of time information included in the page block to a fourth amount of time information that can be included in the web page;
[0181] a ratio of a fifth amount of hyperlink text contained in the page block to a sixth amount of text contained in the page block;
[0182] The ratio of the seventh number of hyperlink images included in the page block to the eighth number of images included in the page block.
[0183] Optionally, the features of page elements around the image may include: the number of page elements around the image, and / or the proportion of hyperlink images around the image.
[0184] Optionally, the text feature surrounding the image may include at least one of the following features:
[0185] Recommended text features;
[0186] The variance of the length of the text surrounding the image;
[0187] The total amount of text surrounding the image;
[0188] The proportion of hyperlinked text in the surrounding text around the image; and
[0189] The average length of text surrounding the image.
[0190] Optionally, the picture features may also include: features of the picture itself and / or features of a page corresponding to the picture.
[0191] Optionally, the webpage segmentation module 701 may include:
[0192] A one-dimensional vector determination submodule, used to obtain a corresponding one-dimensional vector according to a page element in a webpage source code; and
[0193] The vector segmentation submodule is used to segment the one-dimensional vector into blocks according to preset boundary elements to obtain a plurality of page blocks that the web page may include.
[0194] Optionally, the preset boundary element may include: a style element, a script element, a comment element, an external content element, or an element including a non-digital identifier.
[0195] Optionally, the picture determination module 703 may include:
[0196] A feature vector determination submodule, used to obtain a feature vector according to the image features; and
[0197] The model judgment submodule is used to input the feature vector into the classification model to obtain the classification result output by the classification model; the categories corresponding to the classification model may include: target image category and non-target image category.
[0198] Optionally, the picture determination module 703 may include:
[0199] A feature vector determination submodule obtains a feature vector according to the image features;
[0200] A first model judgment submodule is used for inputting the feature vector into a first classification model to obtain a first classification result output by the first classification model if the web page is a list page; the first classification model is obtained based on training data corresponding to the list page; or
[0201] The second model judgment submodule is used to input the feature vector into a second classification model if the web page is a non-list page to obtain a second classification result output by the second classification model; the second classification model is obtained based on the training data corresponding to the non-list page.
[0202] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0203] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0204] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0205] An embodiment of the present invention provides a device for data processing, including a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations: dividing a web page into blocks based on page elements included in a web page source code to obtain multiple page blocks included in the web page; determining image features of images corresponding to the page blocks; the image features include: text features surrounding the image and page structure features; and judging whether the corresponding image is a target image based on the image features.
[0206] Figure 8 8 is a block diagram of a data processing apparatus 800 according to an exemplary embodiment. For example, the apparatus 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0207] Reference Figure 8 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0208] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0209] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0210] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.
[0211] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0212] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a voice data processing mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0213] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0214] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0215] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency data processing (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0216] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.
[0217] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0218] Fig. 9 1 is a schematic diagram of the structure of the server in some embodiments of the present invention. The server 1900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1922 (for example, one or more processors) and memory 1932, and one or more storage media 1930 (for example, one or more mass storage devices) storing application programs 1942 or data 1944. Among them, the memory 1932 and the storage medium 1930 can be short-term storage or permanent storage. The program stored in the storage medium 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 1922 can be configured to communicate with the storage medium 1930 and execute a series of instruction operations in the storage medium 1930 on the server 1900.
[0219] The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input and output interfaces 1958, one or more keyboards 1956, and / or, one or more operating systems 1941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0220] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a device (server or terminal), enables the device to perform Figure 2 or Figure 3 or Figure 4 or Figure 5 The data processing method shown.
[0221] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a device (server or terminal), the device is able to execute a data processing method, the method comprising: dividing a web page into blocks according to page elements included in a web page source code to obtain a plurality of page blocks included in the web page; determining image features of images corresponding to the page blocks; the image features comprising: features of text surrounding the image and page structure features; and judging whether the corresponding image is a target image according to the image features.
[0222] The embodiment of the present invention discloses A1, a data processing method, the method comprising:
[0223] Dividing a web page into blocks according to page elements included in the web page source code to obtain a plurality of page blocks included in the web page;
[0224] Determine the image features of the image corresponding to the page block; the image features include: features of text surrounding the image and page structure features;
[0225] Based on the picture features, determine whether the corresponding picture is the target picture.
[0226] A2. According to the method described in A1, the page structure features include: page block features corresponding to the image, and / or page element features surrounding the image.
[0227] A3. According to the method described in A2, the page block feature includes at least one of the following features:
[0228] a first number of page elements included in the page block;
[0229] a ratio of a first number of page elements included in the page block to a second number of page elements included in the web page;
[0230] a third amount of time information contained in the page block;
[0231] a ratio of a third amount of time information included in the page block to a fourth amount of time information included in the web page;
[0232] a ratio of a fifth amount of hyperlink text contained in the page block to a sixth amount of text contained in the page block;
[0233] The ratio of the seventh number of hyperlink images included in the page block to the eighth number of images included in the page block.
[0234] A4. According to the method described in A2, the features of page elements around the image include: the number of page elements around the image, and / or the proportion of hyperlink images around the image.
[0235] A5. According to the method described in A1, the text feature surrounding the image includes at least one of the following features:
[0236] Recommended text features;
[0237] The variance of the length of the text surrounding the image;
[0238] The total amount of text surrounding the image;
[0239] The proportion of hyperlinked text in the surrounding text around the image; and
[0240] The average length of text surrounding the image.
[0241] A6. According to any of the methods described in A1 to A5, the image features further include: features of the image itself and / or features of a page corresponding to the image.
[0242] A7. According to any one of the methods described in A1 to A5, dividing the webpage into blocks comprises:
[0243] According to the page elements in the webpage source code, the corresponding one-dimensional vector is obtained;
[0244] The one-dimensional vector is divided into blocks according to preset boundary elements to obtain a plurality of page blocks included in the web page.
[0245] A8. According to the method described in A7, the preset boundary element includes: a style element, a script element, a comment element, an external content element, or an element containing a non-digital identifier.
[0246] A9. According to any one of the methods described in A1 to A5, judging whether the corresponding picture is a target picture based on the picture feature includes:
[0247] According to the picture features, a feature vector is obtained;
[0248] The feature vector is input into a classification model to obtain a classification result output by the classification model; the categories corresponding to the classification model include: a target picture category and a non-target picture category.
[0249] A10. According to any one of the methods described in A1 to A5, judging whether the corresponding picture is a target picture based on the picture feature includes:
[0250] According to the picture features, a feature vector is obtained;
[0251] If the web page is a list page, the feature vector is input into a first classification model to obtain a first classification result output by the first classification model; the first classification model is obtained based on training data corresponding to the list page; or
[0252] If the web page is a non-list page, the feature vector is input into a second classification model to obtain a second classification result output by the second classification model; the second classification model is obtained based on the training data corresponding to the non-list page.
[0253] The embodiment of the present invention discloses B11, a data processing device, including:
[0254] A web page segmentation module, used to segment a web page according to page elements included in the web page source code, so as to obtain a plurality of page segments included in the web page;
[0255] A picture feature determination module is used to determine the picture features of the picture corresponding to the page block; the picture features include: surrounding text features and page structure features around the picture; and
[0256] The target image judging module is used to judge whether the corresponding image is the target image according to the image features.
[0257] B12. According to the device described in B11, the page structure features include: page block features corresponding to the picture, and / or page element features around the picture.
[0258] B13. According to the apparatus of B12, the page block feature comprises at least one of the following features:
[0259] a first number of page elements included in the page block;
[0260] a ratio of a first number of page elements included in the page block to a second number of page elements included in the web page;
[0261] a third amount of time information contained in the page block;
[0262] a ratio of a third amount of time information included in the page block to a fourth amount of time information included in the web page;
[0263] a ratio of a fifth amount of hyperlink text contained in the page block to a sixth amount of text contained in the page block;
[0264] The ratio of the seventh number of hyperlink images included in the page block to the eighth number of images included in the page block.
[0265] B14. According to the device described in B12, the page element characteristics around the picture include: the number of page elements around the picture, and / or the proportion of hyperlink pictures around the picture.
[0266] B15. According to the device described in B11, the text feature surrounding the picture includes at least one of the following features:
[0267] Recommended text features;
[0268] The variance of the length of the text surrounding the image;
[0269] The total amount of text surrounding the image;
[0270] The proportion of hyperlinked text in the surrounding text around the image; and
[0271] The average length of text surrounding the image.
[0272] B16. According to any one of the apparatuses described in B11 to B15, the picture features further include: features of the picture itself and / or features of a page corresponding to the picture.
[0273] B17. According to any one of B11 to B15, the webpage segmentation module comprises:
[0274] A one-dimensional vector determination submodule, used to obtain a corresponding one-dimensional vector according to a page element in a webpage source code; and
[0275] The vector segmentation submodule is used to segment the one-dimensional vector into blocks according to preset boundary elements to obtain a plurality of page blocks included in the web page.
[0276] B18. According to the device described in B17, the preset boundary element includes: a style element, a script element, an annotation element, an external content element, or an element containing a non-digital identifier.
[0277] B19. According to any one of B11 to B15, the image determination module comprises:
[0278] A feature vector determination submodule, used to obtain a feature vector according to the image features; and
[0279] The model judgment submodule is used to input the feature vector into the classification model to obtain the classification result output by the classification model; the categories corresponding to the classification model include: target image category and non-target image category.
[0280] B20. According to any one of B11 to B15, the image determination module comprises:
[0281] A feature vector determination submodule obtains a feature vector according to the image features;
[0282] A first model judgment submodule is used for inputting the feature vector into a first classification model to obtain a first classification result output by the first classification model if the web page is a list page; the first classification model is obtained based on training data corresponding to the list page; or
[0283] The second model judgment submodule is used to input the feature vector into a second classification model if the web page is a non-list page to obtain a second classification result output by the second classification model; the second classification model is obtained based on the training data corresponding to the non-list page.
[0284] The embodiment of the present invention discloses C21, a device for data processing, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations:
[0285] Dividing a web page into blocks according to page elements included in the web page source code to obtain a plurality of page blocks included in the web page;
[0286] Determine the image features of the image corresponding to the page block; the image features include: features of text surrounding the image and page structure features;
[0287] Based on the picture features, determine whether the corresponding picture is the target picture.
[0288] C22. According to the device described in C21, the page structure characteristics include: page block characteristics corresponding to the picture, and / or page element characteristics around the picture.
[0289] C23. According to the apparatus of C22, the page block feature comprises at least one of the following features:
[0290] a first number of page elements included in the page block;
[0291] a ratio of a first number of page elements included in the page block to a second number of page elements included in the web page;
[0292] a third amount of time information contained in the page block;
[0293] a ratio of a third amount of time information included in the page block to a fourth amount of time information included in the web page;
[0294] a ratio of a fifth amount of hyperlink text contained in the page block to a sixth amount of text contained in the page block;
[0295] The ratio of the seventh number of hyperlink images included in the page block to the eighth number of images included in the page block.
[0296] C24. According to the device described in C22, the page element characteristics around the picture include: the number of page elements around the picture, and / or the proportion of hyperlink pictures around the picture.
[0297] C25. According to the device described in C21, the text feature surrounding the picture includes at least one of the following features:
[0298] Recommended text features;
[0299] The variance of the length of the text surrounding the image;
[0300] The total amount of text surrounding the image;
[0301] The proportion of hyperlinked text in the surrounding text around the image; and
[0302] The average length of text surrounding the image.
[0303] C26. According to any one of the devices described in C21 to C25, the image features further include: features of the image itself and / or features of a page corresponding to the image.
[0304] C27. According to any one of C21 to C25, the step of dividing the web page into blocks comprises:
[0305] According to the page elements in the webpage source code, the corresponding one-dimensional vector is obtained;
[0306] The one-dimensional vector is divided into blocks according to preset boundary elements to obtain a plurality of page blocks included in the web page.
[0307] C28. According to the device described in C27, the preset boundary element includes: a style element, a script element, an annotation element, an external content element, or an element containing a non-digital identifier.
[0308] C29. According to any one of the apparatuses described in C21 to C25, judging whether the corresponding picture is a target picture according to the picture feature comprises:
[0309] According to the image features, a feature vector is obtained;
[0310] The feature vector is input into a classification model to obtain a classification result output by the classification model; the categories corresponding to the classification model include: a target picture category and a non-target picture category.
[0311] C30. According to any one of the apparatuses described in C21 to C25, judging whether the corresponding picture is a target picture according to the picture feature includes:
[0312] According to the image features, a feature vector is obtained;
[0313] If the web page is a list page, the feature vector is input into a first classification model to obtain a first classification result output by the first classification model; the first classification model is obtained based on training data corresponding to the list page; or
[0314] If the web page is a non-list page, the feature vector is input into a second classification model to obtain a second classification result output by the second classification model; the second classification model is obtained based on the training data corresponding to the non-list page.
[0315] The embodiment of the present invention discloses D31, a machine-readable medium having instructions stored thereon, which, when executed by one or more processors, enables the device to execute the data processing method as described in one or more of A1 to A10.
[0316] Those skilled in the art will readily appreciate other embodiments of the invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0317] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
[0318] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
[0319] The data processing method, the data processing device and the device for data processing provided by the present invention are introduced in detail above. The principle and implementation mode of the present invention are explained by using specific examples in this article. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation mode and the scope of application. In summary, the content of this specification should not be understood as limiting the present invention. , <form>< / form> ,in <form>< / form> Indicates an HTML form for defining user input. Of course, there are some tags that do not appear in pairs, such as (used to define a simple line break), (used to define a horizontal line), etc. There is a corresponding relationship between the tags and the page elements in the embodiment of the present invention, so the page elements can be represented by tags. The page elements also correspond to attributes. Attributes are used to provide additional information for page elements. Attributes can appear in the form of name-value pairs such as "attribute name = attribute value", and attributes can be defined in the start tag of the page element. Step 201 can divide the web page into blocks according to the relationship between the page elements included in the web page source code to obtain multiple page blocks included in the web page. In an optional embodiment of the present invention, step 201 can specifically include: according to the page elements in the web page source code, obtain a corresponding one-dimensional vector; according to the preset boundary elements, divide the one-dimensional vector into blocks to obtain multiple page blocks included in the web page. According to an embodiment, a tree structure can be used to represent the relationship between the page elements included in the web page source code, and the tree structure can include a DOM (Document Object Model) tree, etc. According to the HTML DOM standard, the content in an HTML document can be used as a node in a DOM tree: the entire document is a document node; an HTML element is an element node; the text in an HTML element is a text node; an HTML attribute is an attribute node; and a comment is a comment node. The embodiment of the present invention can convert a tree structure into a one-dimensional vector, wherein the elements of the one-dimensional vector can represent nodes in the tree structure. The above process of converting a tree structure into a one-dimensional vector may include: taking the root node as the first element of the one-dimensional vector, and arranging the nodes corresponding to the branches under the root node after the first element in order from left to right. Specifically, the node of the first branch from the left under the root node is arranged after the first element, the node of the second branch from the left under the root node is arranged after the last node of the first branch, ... the node of the (i+1)th branch from the left under the root node is arranged after the last node of the i-th branch, wherein i is a natural number. Referring to, an example of a tree structure of an embodiment of the present invention is shown, and its corresponding page elements include: html element, head element, body element, p element and img element, and the relationship between the page elements includes: wherein,
Claims
1. A data processing method, characterized in that: The method comprises: According to the page elements in the webpage source code, the corresponding one-dimensional vector is obtained; According to preset boundary elements, the one-dimensional vector is divided into blocks to obtain a plurality of page blocks included in the web page; wherein the preset boundary elements include: style elements, script elements, annotation elements, external content elements, or elements containing non-digital identifiers; Determine the image features of the image corresponding to the page block; the image features of the image corresponding to the page block include: surrounding text features and page structure features around the image; the page structure features include page block features corresponding to the image and / or page element features around the image, the page block features include image features for the page block; the page block features include image features extracted from the image corresponding to the page block; According to the picture feature of the picture corresponding to the page block, it is determined whether the corresponding picture is the target picture.
2. The method according to claim 1, characterized in that The page block features include at least one of the following features: a first number of page elements included in the page block; a ratio of a first number of page elements included in the page block to a second number of page elements included in the web page; a third amount of time information contained in the page block; a ratio of a third amount of time information included in the page block to a fourth amount of time information included in the web page; a ratio of a fifth amount of hyperlink text contained in the page block to a sixth amount of text contained in the page block; The ratio of the seventh number of hyperlink images included in the page block to the eighth number of images included in the page block.
3. The method according to claim 1, characterized in that The features of page elements around the image include: the number of page elements around the image, and / or the proportion of hyperlink images around the image.
4. The method according to claim 1, characterized in that: The text surrounding the picture includes at least one of the following features: Recommended text features; the recommended text features may include: recommended text and location features; The variance of the length of the text surrounding the image; The total amount of text surrounding the image; The proportion of hyperlinked text in the surrounding text around the image; and The average length of text surrounding the image.
5. The method according to any one of claims 1 to 4, characterized in that: The picture features of the picture corresponding to the page block also include: features of the picture itself and / or features of the page corresponding to the picture.
6. The method according to any one of claims 1 to 4, characterized in that: The step of judging whether the corresponding picture is a target picture according to the picture feature of the picture corresponding to the page block includes: Obtaining a feature vector according to the picture features of the picture corresponding to the page block; The feature vector is input into a classification model to obtain a classification result output by the classification model; the categories corresponding to the classification model include: a target picture category and a non-target picture category.
7. The method according to any one of claims 1 to 4, characterized in that: The step of judging whether the corresponding picture is a target picture according to the picture feature of the picture corresponding to the page block includes: Obtaining a feature vector according to the picture features of the picture corresponding to the page block; If the web page is a list page, the feature vector is input into a first classification model to obtain a first classification result output by the first classification model; the first classification model is obtained based on training data corresponding to the list page; or If the web page is a non-list page, the feature vector is input into a second classification model to obtain a second classification result output by the second classification model; the second classification model is obtained based on the training data corresponding to the non-list page.
8. A data processing device, characterized in that: include: A one-dimensional vector determination submodule is used to obtain a corresponding one-dimensional vector according to a page element in a webpage source code; as well as A vector segmentation submodule, configured to segment the one-dimensional vector into blocks according to preset boundary elements to obtain a plurality of page blocks included in the web page; wherein the preset boundary elements include: style elements, script elements, annotation elements, external content elements, or elements containing non-digital identifiers; A picture feature determination module is used to determine the picture features of the picture corresponding to the page block; the picture features of the picture corresponding to the page block include: surrounding text features and page structure features; the page structure features include page block features corresponding to the picture and / or page element features around the picture, the page block features include picture features for the page block; the page block features include extracted picture features for the picture corresponding to the page block; The target image judging module is used to judge whether the corresponding image is the target image according to the image features of the image corresponding to the page block.
9. The device according to claim 8, characterized in that The page block features include at least one of the following features: a first number of page elements included in the page block; a ratio of a first number of page elements included in the page block to a second number of page elements included in the web page; a third amount of time information contained in the page block; a ratio of a third amount of time information included in the page block to a fourth amount of time information included in the web page; a ratio of a fifth amount of hyperlink text contained in the page block to a sixth amount of text contained in the page block; The ratio of the seventh number of hyperlink images included in the page block to the eighth number of images included in the page block.
10. The device according to claim 8, characterized in that The features of page elements around the image include: the number of page elements around the image, and / or the proportion of hyperlink images around the image.
11. The device according to claim 8, characterized in that The text surrounding the picture includes at least one of the following features: Recommended text features; the recommended text features may include: recommended text and location features; The variance of the length of the text surrounding the image; The total amount of text surrounding the image; The proportion of hyperlinked text in the surrounding text around the image; and The average length of text surrounding the image.
12. The device according to any one of claims 8 to 11, characterized in that The picture features of the picture corresponding to the page block also include: features of the picture itself and / or features of the page corresponding to the picture.
13. The device according to any one of claims 8 to 11, characterized in that The image judgment module includes: A feature vector determination submodule, used to obtain a feature vector according to the picture features of the picture corresponding to the page block; and The model judgment submodule is used to input the feature vector into the classification model to obtain the classification result output by the classification model; the categories corresponding to the classification model include: target image category and non-target image category.
14. The device according to any one of claims 8 to 11, characterized in that The image judgment module includes: A feature vector determination submodule obtains a feature vector according to the picture features of the picture corresponding to the page block; A first model judgment submodule is used for inputting the feature vector into a first classification model to obtain a first classification result output by the first classification model if the web page is a list page; the first classification model is obtained based on training data corresponding to the list page; or The second model judgment submodule is used to input the feature vector into a second classification model if the web page is a non-list page to obtain a second classification result output by the second classification model; the second classification model is obtained based on the training data corresponding to the non-list page.
15. A device for data processing, characterized in that: The system comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations: According to the page elements in the webpage source code, the corresponding one-dimensional vector is obtained; According to preset boundary elements, the one-dimensional vector is divided into blocks to obtain a plurality of page blocks included in the web page; wherein the preset boundary elements include: style elements, script elements, comment elements, external content elements, or elements containing non-digital identifiers, to obtain a plurality of page blocks included in the web page; Determine the image features of the image corresponding to the page block; the image features of the image corresponding to the page block include: surrounding text features and page structure features around the image; the page structure features include page block features corresponding to the image and / or page element features around the image, the page block features include image features for the page block; the page block features include extracted image features for the image corresponding to the page block; According to the picture feature of the picture corresponding to the page block, it is determined whether the corresponding picture is the target picture.
16. The device according to claim 15, characterized in that The page block features include at least one of the following features: a first number of page elements included in the page block; a ratio of a first number of page elements included in the page block to a second number of page elements included in the web page; a third amount of time information contained in the page block; a ratio of a third amount of time information included in the page block to a fourth amount of time information included in the web page; a ratio of a fifth amount of hyperlink text contained in the page block to a sixth amount of text contained in the page block; The ratio of the seventh number of hyperlink images included in the page block to the eighth number of images included in the page block.
17. The device according to claim 15, characterized in that The features of page elements around the image include: the number of page elements around the image, and / or the proportion of hyperlink images around the image.
18. The device according to claim 15, characterized in that The text surrounding the picture includes at least one of the following features: Recommended text features; the recommended text features may include: recommended text and location features; The variance of the length of the text surrounding the image; The total amount of text surrounding the image; The proportion of hyperlinked text in the surrounding text around the image; and The average length of text surrounding the image.
19. The device according to any one of claims 15 to 18, characterized in that The picture features of the picture corresponding to the page block also include: features of the picture itself and / or features of the page corresponding to the picture.
20. The device according to any one of claims 15 to 18, characterized in that The step of judging whether the corresponding picture is a target picture according to the picture feature of the picture corresponding to the page block includes: Obtaining a feature vector according to the picture features of the picture corresponding to the page block; The feature vector is input into a classification model to obtain a classification result output by the classification model; the categories corresponding to the classification model include: a target picture category and a non-target picture category.
21. The device according to any one of claims 15 to 18, characterized in that The step of judging whether the corresponding picture is a target picture according to the picture feature of the picture corresponding to the page block includes: Obtaining a feature vector according to the picture features of the picture corresponding to the page block; If the web page is a list page, the feature vector is input into a first classification model to obtain a first classification result output by the first classification model; the first classification model is obtained based on training data corresponding to the list page; or If the web page is a non-list page, the feature vector is input into a second classification model to obtain a second classification result output by the second classification model; the second classification model is obtained based on the training data corresponding to the non-list page.
22. A machine-readable medium having instructions stored thereon, which, when executed by one or more processors, cause an apparatus to perform a data processing method as claimed in one or more of claims 1 to 7.
