A method, apparatus, device, and storage medium for image review.
Patent Information
- Application Number
- CN202111194505.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-13
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2041-10-13
AI Technical Summary
[0022]根据本公开的第五方面,提供了一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现根据第一方面所述的方法。
Smart Images

Figure CN113934963B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing, and in particular to the fields of content moderation and content security. Background Technology
[0002] With the rapid increase in the number of websites, webpage content has become incredibly rich, often containing numerous images. To ensure the compliance of webpage content, it is necessary to review and approve the content, such as images. Summary of the Invention
[0003] This disclosure provides an image review method, apparatus, device, and storage medium.
[0004] According to a first aspect of this disclosure, an image review method is provided, comprising:
[0005] Get the webpage source code;
[0006] Based on the webpage source code, a document object model (DOM) tree is created. The DOM tree includes multiple nodes, and each node represents a tag in the webpage source code.
[0007] Using the type identifier of the nodes in the DOM tree, all image nodes in the DOM tree are selected, and based on the DOM tree, the image size corresponding to each image node and the nesting level of each image node are determined; wherein, for each image node, the nesting level represents the number of levels from the root node to the image node in the DOM tree;
[0008] Based on the image size of the image corresponding to each image node and the number of nesting levels of each image node, select the image nodes to be reviewed from all the image nodes;
[0009] The images corresponding to the image nodes to be reviewed are reviewed.
[0010] According to a second aspect of this disclosure, an image review device is provided, comprising:
[0011] The retrieval module is used to retrieve the source code of a webpage.
[0012] A creation module is used to create a Document Object Model (DOM) tree based on the webpage source code. The DOM tree includes multiple nodes, and each node represents a tag in the webpage source code.
[0013] The first selection module is used to select all image nodes in the DOM tree by utilizing the type identifier of the nodes in the DOM tree;
[0014] The first determining module is used to determine the image size of the image corresponding to each image node and the nesting level of each image node based on the DOM tree; wherein, for each image node, the nesting level represents the number of levels from the root node to the image node in the DOM tree;
[0015] The second selection module is used to select the image node to be reviewed from all the image nodes based on the image size of the image corresponding to each image node and the nesting level of each image node;
[0016] The review module is used to review the images corresponding to the image nodes to be reviewed.
[0017] According to a third aspect of this disclosure, an electronic device is provided, comprising:
[0018] At least one processor; and
[0019] A memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.
[0021] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method according to the first aspect.
[0022] According to a fifth aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method according to the first aspect.
[0023] This disclosure enables image review at a lower cost.
[0024] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0025] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0026] Figure 1 This is a flowchart of an image review method provided in this embodiment of the disclosure;
[0027] Figure 2 This is a schematic diagram of the document object model (DOM) tree created in the embodiments of this disclosure;
[0028] Figure 3 In this embodiment of the disclosure, the nesting level of each image node is determined based on the DOM tree;
[0029] Figure 4 This is a flowchart in this embodiment of the process of selecting the image node to be reviewed from all image nodes based on the image size of the image corresponding to each image node and the nesting level of each image node;
[0030] Figure 5 This is another flowchart of the image review method provided in this embodiment of the disclosure;
[0031] Figure 6 A schematic diagram of the image review device provided in this embodiment;
[0032] Figure 7 Another structural schematic diagram of the image review device provided in this embodiment;
[0033] Figure 8 This is a block diagram of an electronic device used to implement the image review method of the present disclosure embodiments. Detailed Implementation
[0034] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0035] Information materials, such as advertising materials, need to undergo risk control audits to ensure compliance. For example, landing page links within advertising materials may need to be reviewed. Advertising materials may contain multiple landing page links. The review of landing page links requires extracting and reviewing the source code of the linked web pages, including text and images. A landing page, also known as a guide page, is the webpage displayed to users after they have searched using a search engine. This page typically displays extended content related to the search results. Landing page links are links related to the aforementioned landing pages.
[0036] In related technologies, Cascading Style Sheets (CSS) are used to render webpage source code, allowing for the extraction of detailed information such as image positions and sizes. While CSS rendering enables precise image review, it also has drawbacks. A landing page link may contain dozens of image tags, including important images and less important ones like avatars. The Uniform Resource Locator (URL) for images on a webpage, also known as the webpage address, can be extracted from tags, but there's no effective way to distinguish which images are important and which are representative of the content. Therefore, related technologies review all images on a webpage, but when reviewing a large number of webpages, the CSS rendering time is too long, failing to meet the timeliness requirements. Thus, when a large number of webpages need review, and machine resources and review time are limited, reducing costs and only reviewing representative information becomes crucial. Image review is particularly time-consuming, making cost-effective image review of large batches of webpages an important aspect of content review.
[0037] This disclosure provides a low-cost method for reviewing webpage images. By extracting representative and important images from the webpage source code, only the important images on the webpage are reviewed, thereby achieving low-cost review of a large number of images.
[0038] The image review method provided in this disclosure will be described in detail below.
[0039] The image review method provided in this disclosure can be applied to electronic devices, specifically, electronic devices may include servers, terminals, etc.
[0040] This disclosure provides an image review method, which may include:
[0041] Get the webpage source code;
[0042] Based on the webpage source code, a Document Object Model (DOM) tree is created. The DOM tree includes multiple nodes, and each node represents a tag in the webpage source code.
[0043] Using the type identifier of nodes in the DOM tree, select all image nodes in the DOM tree, and based on the DOM tree, determine the image size corresponding to each image node and the nesting level of each image node; where, for each image node, the nesting level represents the number of levels from the root node to the image node in the DOM tree.
[0044] Based on the image size of the image corresponding to each image node and the nesting level of each image node, select the image nodes to be reviewed from all image nodes;
[0045] The images corresponding to the image nodes to be reviewed are reviewed.
[0046] In this embodiment, a DOM tree is created based on the webpage source code. Then, all image nodes are selected based on the DOM tree, and the image size and nesting level of each image node are determined. Based on the image size and nesting level of each image node, image nodes to be reviewed are selected from all image nodes. The images corresponding to the image nodes to be reviewed are then reviewed. In other words, images are reviewed selectively, and only some images, i.e., important images (the images corresponding to the images to be reviewed), are reviewed, while non-important images are not reviewed. This saves overall review costs and achieves low-cost and fast review of a large number of images.
[0047] Figure 1 This is a flowchart of the image review method provided in this embodiment of the disclosure, refer to... Figure 1 The image review method provided in this disclosure embodiment may include:
[0048] S101, Get the webpage source code.
[0049] You can use a source code scraping module to obtain the source code of a webpage. For example, you can use a source code scraper to obtain the source code of a webpage.
[0050] S102, based on the webpage source code, creates a Document Object Model (DOM) tree.
[0051] The DOM tree consists of multiple nodes, and each node represents a tag in the webpage source code.
[0052] For example, webpage source code may include tags such as div (block-level element), table (form tag), and img (image tag).
[0053] The DOM tree is used to represent the relationships between various tags in the source code of a webpage.
[0054] DOM (Document Object Model) uses the following structure: "d" stands for document, which allows you to convert a web page document into a document object; "o" stands for object, which is a self-contained collection of data; and "m" stands for model.
[0055] For example, a DOM tree can be created using litehtml (an open-source web page source code parsing module).
[0056] like Figure 2 As shown, the created DOM tree can include three levels.
[0057] The first level, root node, is `html` (Hypertext Markup Language), containing three child nodes. Node 0 has no name and only contains the text "STATUS OK" (status is normal). The second level has child node 1 as `body` and node 2 as `head`. The 5th, 6th, and 7th child nodes of the `body` node are `img` nodes. The `img` node contains the `src` (source, resource location) attribute (image URL). Here, `body` represents the main body of the webpage, and the `head` tag defines the document's header; it is the container for all header elements. The document header describes various attributes and information about the document, including its title, its position on the webpage, and its relationship to other documents.
[0058] S103. Using the type identifier of the node in the DOM tree, select all image nodes in the DOM tree, determine the image size of the image corresponding to each image node, and determine the nesting level of each image node based on the DOM tree.
[0059] For each image node, the nesting level represents the number of levels from the root node to the image node in the DOM tree.
[0060] The DOM tree can include the attributes of each node, such as the node's type identifier. If the node is an image node, it can also include the image size, storage address, and so on.
[0061] In the DOM tree, the type identifier of a node is its tag name. For example, if the tag name is "img", it means that the node is an image node.
[0062] The `img` tag can be selected using the jQuery selector embedded in the source code analysis module.
[0063] The image size can be obtained directly from the properties of the image node in the DOM tree.
[0064] like Figure 3 As shown, determining the nesting level of each image node based on the DOM tree can include:
[0065] S301, based on the DOM tree, determines the nesting path of each image node.
[0066] For each image node, the nested path represents the path from the root node to the image node in the DOM tree.
[0067] The HTML path of the image tag can be obtained based on the hierarchical relationship of image nodes in the DOM tree.
[0068] S302, for each image node, use the nested path of the image node to count the number of levels from the root node to the image node in the DOM tree, and use the number of levels as the nested level of the image node.
[0069] In this way, the nesting level of image nodes can be accurately determined by nested paths.
[0070] S104. Based on the image size of the image corresponding to each image node and the nesting level of each image node, select the image node to be reviewed from all image nodes.
[0071] In this embodiment of the disclosure, through statistical analysis of a large amount of webpage source code, it was found that the images corresponding to image nodes with larger image sizes and shallower nesting levels are representative images in the webpage source code, and can also be understood as important images.
[0072] like Figure 4 As shown, S104 may include:
[0073] S401, sort the image nodes based on the image size of the image corresponding to each image node.
[0074] S402, in response to sorting by image size from largest to smallest, select the first preset number of image nodes at the top of the sort as the initial nodes.
[0075] S403, in response to sorting by image size from smallest to largest, select the first preset number of image nodes that are sorted last as the initial nodes.
[0076] S404: Select image nodes with a nesting level less than the preset level from the initial node as image nodes to be reviewed.
[0077] The first preset number can be determined according to actual needs. For example, the first preset number can be 8, 9, 10, etc.
[0078] The preset number of nesting levels can also be determined according to actual needs. For example, if a nesting level of more than 10 is considered too deep, then the preset number of nesting levels can be 10.
[0079] Simply put, first, select the first preset number of initial nodes based on the image size. Then, based on the nesting level of the image nodes, select the shallowest nested image nodes from the initial nodes. This can also be understood as removing the most deeply nested image nodes from the initial nodes.
[0080] If the nesting level of all nodes in the initial node is less than the preset level, then all nodes in the initial node will be treated as image nodes to be reviewed. Alternatively, if no image node has a nesting level exceeding the preset level, then it does not need to be removed.
[0081] For example, you can first sort the images from largest to smallest and select the top 8 largest image nodes. Then, select the shallowest nested image nodes from these 8, such as image nodes with a nesting level of less than 10. This can also be understood as removing images with deep nesting from these 8 (e.g., removing image nodes with a nesting level of more than 10).
[0082] If there is no deep nesting, then there is no need to remove them. That is, if the image size of these 8 image nodes is less than 10, then these 8 image nodes will all be treated as image nodes to be reviewed.
[0083] In this embodiment of the disclosure, image nodes with larger image sizes and shallower nesting levels are selected based on the image size of the image corresponding to each image node and the nesting level of each image node. This enables the selection of important images for review based on the image size of the image corresponding to each image node and the nesting level of each image node.
[0084] S105, review the image corresponding to the image node to be reviewed.
[0085] Obtain the image address corresponding to the image node to be reviewed; retrieve the image based on the image address; review the image.
[0086] An image address can be the image's URL.
[0087] For each image node to be reviewed, the image can be segmented and reviewed. Specifically, text can be extracted from the image, and then a strategy model can be applied to review the text content. The strategy model can be determined according to actual needs.
[0088] This embodiment of the disclosure, through statistical analysis of a large amount of webpage source code, reveals that images with larger file sizes and shallower node nesting are important images on the webpage, or representative images. Images with shallower node nesting are, for example, images highly relevant to the webpage's theme. This embodiment selects images with larger file sizes and shallower node nesting for review, enabling the review of only representative images on the webpage under limited resources. This saves overall review costs and improves timeliness, thus achieving low-cost and rapid review of a large number of images.
[0089] In one alternative embodiment, such as Figure 5 As shown, it may also include:
[0090] S501, determine whether the total number of all image nodes exceeds the second preset number.
[0091] The value of the second preset number can be the same as the value of the first preset number, or the value of the second preset number can be different from the value of the first preset number.
[0092] S104 may include:
[0093] S502, in response to the fact that the total number of all image nodes exceeds the second preset number, select the image node to be reviewed from all image nodes based on the image size of the image corresponding to each image node and the nesting level of each image node.
[0094] When the total number of image nodes exceeds a second preset number, select image nodes to be reviewed from all image nodes. Specifically, as described above, sort each image node based on the image size corresponding to that image; in response to sorting by image size from largest to smallest, select the first preset number of image nodes at the top of the sorted list as initial nodes; in response to sorting by image size from smallest to largest, select the last preset number of image nodes at the bottom of the sorted list as initial nodes; from the initial nodes, select image nodes with a nesting level less than a preset number as image nodes to be reviewed.
[0095] If the total number of image nodes does not exceed a second preset number, then all images are reviewed. Specifically, the image addresses corresponding to all image nodes are obtained; the images are retrieved based on the image addresses; and the images are reviewed.
[0096] Only N important images can be extracted for review. When the number of image nodes does not exceed N, the images corresponding to each image node are reviewed directly. However, when the number of image nodes exceeds N, considering the image size and the nested paths of the image nodes (which can also be understood as image HTML path information such as XPath), the Extensible Markup Language (XML) path can be used to retrieve only the first N important images.
[0097] In this way, selective review can be carried out when resources are limited, saving overall review costs and improving timeliness, thereby enabling low-cost and rapid review of a large number of images and ensuring the timeliness of image review; while when resources are sufficient, all images can be reviewed.
[0098] When a large number of landing pages require image review, due to limitations in machine resources and review timeframes, it's impossible to render CSS for each page to obtain the actual image size and detailed display location information. This disclosure, through extensive source code statistical analysis, reveals that important images are typically larger and shallowly nested within the page layout. Using jQuery selectors, images can be sorted by size, prioritizing the review of top-ranked images. Alternatively, only images sorted from largest to smallest can be reviewed. Furthermore, important images generally have shallow node nesting; combining this with HTML path information allows for filtering out images with deep HTML paths, thus selecting shallowly nested images. The image review method provided in this disclosure, which obtains important images from batches of web page source code for review, saves significant resources and time.
[0099] Corresponding to the image review method provided in the above embodiments, this disclosure also provides an image review device, such as... Figure 6 As shown, it may include:
[0100] Module 601 is used to obtain the source code of a webpage.
[0101] Create module 602 to create a Document Object Model (DOM) tree based on the webpage source code. The DOM tree includes multiple nodes, and each node represents a tag in the webpage source code.
[0102] The first selection module 603 is used to select all image nodes in the DOM tree by utilizing the type identifier of the nodes in the DOM tree;
[0103] The first determining module 604 is used to determine the image size of the image corresponding to each image node based on the DOM tree and to determine the nesting level of each image node based on the DOM tree; wherein, for each image node, the nesting level represents the number of levels from the root node to the image node in the DOM tree.
[0104] The second selection module 605 is used to select the image node to be reviewed from all image nodes based on the image size of the image corresponding to each image node and the nesting level of each image node;
[0105] The review module 606 is used to review the images corresponding to the image nodes to be reviewed.
[0106] Optionally, the second selection module 605 is specifically used to sort each image node based on the image size of the image corresponding to each image node; in response to sorting in descending order of image size, select the first preset number of image nodes at the top of the sort as initial nodes; in response to sorting in ascending order of image size, select the first preset number of image nodes at the bottom of the sort as initial nodes; and select image nodes with a nesting level less than a preset number of nesting levels from the initial nodes as image nodes to be reviewed.
[0107] Optional, such as Figure 7 As shown, the device also includes:
[0108] The judgment module 701 is used to determine whether the total number of all image nodes exceeds the second preset number;
[0109] The second selection module 605 is specifically used to select the image node to be reviewed from all image nodes in response to the fact that the number of all image nodes exceeds a second preset number, based on the image size of the image corresponding to each image node and the nesting level of each image node.
[0110] Optionally, the first determining module 604 is specifically used to determine the nesting path of each image node based on the DOM tree; for each image node, the nesting path of the image node is used to count the number of levels from the root node to the image node in the DOM tree, and the number of levels is used as the nesting level of the image node.
[0111] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0112] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0113] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0114] like Figure 8As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 802 or a computer program loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.
[0115] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0116] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as the image review method. For example, in some embodiments, the image review method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the image review method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the image review method by any other suitable means (e.g., by means of firmware).
[0117] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0118] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0119] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0120] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0121] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0122] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0123] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0124] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. An image review method, comprising: Get the webpage source code; Based on the webpage source code, a document object model (DOM) tree is created. The DOM tree includes multiple nodes, and each node represents a tag in the webpage source code. Using the type identifier of the nodes in the DOM tree, all image nodes in the DOM tree are selected, and based on the DOM tree, the image size corresponding to each image node and the nesting level of each image node are determined; wherein, for each image node, the nesting level represents the number of levels from the root node to the image node in the DOM tree; Based on the image size of the image corresponding to each image node and the number of nesting levels of each image node, select the image nodes to be reviewed from all the image nodes; The images corresponding to the image nodes to be reviewed are reviewed; The step of selecting the image node to be reviewed from all image nodes based on the image size of the image corresponding to each image node and the nesting level of each image node includes: Based on the image size of the image corresponding to each image node, sort the image nodes. In response to sorting by image size from largest to smallest, select the first preset number of image nodes at the top of the sort as the initial nodes; In response to sorting by image size from smallest to largest, select the first preset number of image nodes at the end of the sorted order as the initial nodes; Image nodes with a nesting level less than a preset level are selected from the initial nodes as image nodes to be reviewed.
2. The method according to claim 1, further comprising: Determine whether the total number of all image nodes exceeds a second preset number; The process of selecting image nodes to be reviewed from all image nodes based on the image size corresponding to each image node and the nesting level of each image node includes: In response to the fact that the total number of all image nodes exceeds the second preset number, an image node to be reviewed is selected from all image nodes based on the image size of the image corresponding to each image node and the nesting level of each image node.
3. The method according to claim 1 or 2, wherein, Determining the nesting level of each image node based on the DOM tree includes: Based on the DOM tree, determine the nesting path of each image node; For each image node, the nesting path of the image node is used to count the number of levels from the root node to the image node in the DOM tree, and the number of levels is used as the nesting level of the image node.
4. An image verification device, comprising: The acquisition module is used to retrieve the source code of a webpage. A creation module is used to create a Document Object Model (DOM) tree based on the webpage source code. The DOM tree includes multiple nodes, and each node represents a tag in the webpage source code. The first selection module is used to select all image nodes in the DOM tree by utilizing the type identifier of the nodes in the DOM tree; The first determining module is used to determine the image size of the image corresponding to each image node and the nesting level of each image node based on the DOM tree; wherein, for each image node, the nesting level represents the number of levels from the root node to the image node in the DOM tree; The second selection module is used to select the image node to be reviewed from all the image nodes based on the image size of the image corresponding to each image node and the nesting level of each image node; The review module is used to review the images corresponding to the image nodes to be reviewed; Specifically, the second selection module is used to sort each image node based on the image size of the image corresponding to each image node; in response to sorting in descending order of image size, select a first preset number of image nodes as initial nodes; in response to sorting in ascending order of image size, select a first preset number of image nodes as initial nodes; and select image nodes with a nesting level less than a preset number of nesting levels from the initial nodes as image nodes to be reviewed.
5. The apparatus according to claim 4, further comprising: The judgment module is used to determine whether the total number of all image nodes exceeds a second preset number; The second selection module is specifically used to select the image node to be reviewed from all the image nodes in response to the fact that the number of all image nodes exceeds the second preset number, based on the image size of the image corresponding to each image node and the nesting level of each image node.
6. The apparatus according to claim 4 or 5, wherein, The first determining module is specifically used to determine the nesting path of each image node based on the DOM tree; for each image node, the nesting path of the image node is used to count the number of levels from the root node to the image node in the DOM tree, and the number of levels is used as the nesting level of the image node.
7. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-3.
8. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-3.
9. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-3.
Citation Information
Patent Citations
Webpage information extraction method and device thereof
CN101944094A
Method for extracting webpage comment content
CN105630772A