Page detection method and device, equipment and storage medium
By combining methods of optical character recognition on pages and using machine learning models, the problem of insufficient page detection accuracy and preventiveness in the prior art is solved, and efficient and accurate page detection and prevent abnormal presentation are achieved.
Patent Information
- Application Number
- CN202411819432.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-08
AI Technical Summary
When faced with complex and rich page structure, the accuracy of the detection results is difficult to guarantee, and it is often detected only when the page content cannot be correctly presented. It has lag and cannot prevent abnormal page rendering.
By obtaining the image of the page to be detected, optical character recognition is performed, and based on the recognition results, whether to use a trained machine learning model for detection is determined, and the model is used to determine whether the page content can be correctly presented.
It realizes accurate and efficient detection of whether the page can be correctly presented, improves the accuracy of the detection, and prevents abnormal page rendering.
Smart Images

Figure CN119785356A_ABST
Abstract
Description
Technical Field
[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to a method, an apparatus, a device, and a computer-readable storage medium for page detection. Background Art
[0002] With the development of computer technology, the Internet has become an indispensable part of people's daily life. Through the Internet, people can enjoy Internet services by browsing pages. As the content on the Internet becomes richer and richer, the structure of pages becomes more and more complex, the content presented by the pages becomes richer and richer, and the number of pages to be presented increases, thereby increasing the probability that the content of the page cannot be presented correctly. Therefore, there is an urgent need for a page detection solution that can efficiently and accurately verify whether a page can be presented correctly. Summary of the invention
[0003] In a first aspect of the present disclosure, a method for traveling is provided. The method includes: obtaining an image corresponding to a page to be detected; performing optical character recognition on the image to obtain an optical character recognition result for the page; determining whether to use a machine learning model to perform detection based on the optical character recognition result; and in response to determining that the machine learning model is to be used to perform detection, using a trained machine learning model, at least based on the optical character recognition result, determining a detection result for the page, the detection result indicating whether the content of the page can be correctly presented on the client. In this way, it is possible to accurately and efficiently detect whether the page can be correctly presented.
[0004] In a second aspect of the present disclosure, a device for traveling is provided. The device includes: an image acquisition module, configured to: obtain an image corresponding to a page to be detected; a character recognition module, configured to: perform optical character recognition on the image to obtain an optical character recognition result of the page; a determination module, configured to: determine whether to use a machine learning model to perform detection based on the optical character recognition result; and a model determination module, configured to: in response to determining that the machine learning model is to be used to perform detection, use a trained machine learning model to determine a detection result of the page based at least on the optical character recognition result, the detection result indicating whether the content of the page can be correctly presented on the client.
[0005] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit. When the instructions are executed by the at least one processing unit, the device executes the method of the first aspect.
[0006] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to implement the method of the first aspect.
[0007] In a fifth aspect of the present disclosure, a computer program product is provided, which is tangibly stored in a computer storage medium and includes computer executable instructions, which, when executed by a device, cause the device to perform the method of the first aspect.
[0008] It should be understood that the contents described in this content section are not intended to limit the key features or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0010] Figure 1 A schematic diagram showing an example environment in which embodiments according to the present disclosure may be implemented;
[0011] Figure 2 A flowchart showing an example interactive process of page detection according to some embodiments of the present disclosure is shown;
[0012] Figure 3 A flowchart showing an example interactive process of page detection according to some embodiments of the present disclosure is shown;
[0013] Figure 4 A flowchart showing an example interactive process of page detection according to some embodiments of the present disclosure is shown;
[0014] Figure 5 A schematic structural block diagram showing an example apparatus for page detection according to some embodiments of the present disclosure; and
[0015] Figure 6 A block diagram of an electronic device capable of implementing various embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0016] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0017] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below.
[0018] Herein, unless explicitly stated, executing a step “in response to A” does not mean executing the step immediately after “A” but may include one or more intermediate steps.
[0019] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0020] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0021] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information, so that the user can independently choose whether to provide personal information to software or hardware such as electronic devices, applications, servers or storage media that execute the operations of the technical solution of the present disclosure based on the prompt message.
[0022] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information is sent to the user in a manner such as a pop-up window, in which the prompt information can be presented in text form. In addition, the pop-up window can also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0023] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0024] As used herein, the term "model" can learn the association between the corresponding input and output from the training data, so that after the training is completed, the corresponding output can be generated for a given input. The generation of the model can be based on machine learning technology. Deep learning is a machine learning algorithm that processes inputs and provides corresponding outputs by using multi-layer processing units. A neural network model is an example of a model based on deep learning. In this article, "model" may also be referred to as "machine learning model", "learning model", "machine learning network" or "learning network", and these terms are used interchangeably in this article.
[0025] A "neural network" is a machine learning network based on deep learning. A neural network is capable of processing inputs and providing corresponding outputs, and typically includes an input layer and an output layer and one or more hidden layers between the input layer and the output layer. Neural networks used in deep learning applications typically include many hidden layers, thereby increasing the depth of the network. The layers of a neural network are connected in sequence so that the output of the previous layer is provided as input to the next layer, where the input layer receives the input of the neural network and the output of the output layer serves as the final output of the neural network. Each layer of a neural network includes one or more nodes (also called processing nodes or neurons), each of which processes input from the previous layer.
[0026] Generally, machine learning can be roughly divided into three stages, namely the training stage, the testing stage, and the application stage (also called the inference stage). In the training stage, a given model can be trained using a large amount of training data, and the parameter values are continuously updated iteratively until the model can obtain consistent inferences that meet the expected goals from the training data. Through training, the model can be considered to be able to learn the association between input and output (also called input-to-output mapping) from the training data. The parameter values of the trained model are determined. In the testing stage, the test input is applied to the trained model to test whether the model can provide the correct output, thereby determining the performance of the model. The testing stage can sometimes be integrated into the training stage. In the application or inference stage, the trained model can be used to process the actual model input based on the parameter values obtained through training to determine the corresponding model output.
[0027] With the development of computer technology, the Internet has become an indispensable part of people's daily life. Through the Internet, people can enjoy Internet services by browsing web pages. As the content on the Internet becomes richer and richer, the structure of pages becomes more and more complex, the content presented by the pages becomes richer and richer, and the number of pages to be presented increases, thereby increasing the probability that the content of the page cannot be presented correctly.
[0028] In order to detect whether the content of a page can be presented correctly, some page detection schemes have been proposed. In some schemes, multiple screenshot operations can be performed on the client, and the obtained multiple screenshots can be compared to determine whether the content of the page can be displayed correctly. However, page jitter often occurs, for example, pop-up windows, etc., resulting in a low accuracy rate of the result of detecting the page based on the comparison of screenshots. In other schemes, a page detection scheme based on a DOM tree (Document ObjectModel tree) is proposed. In this scheme, page elements are organized and evaluated in the form of a hierarchical tree. This scheme can run well in scenes with a relatively simple page structure. However, when the structure of the page becomes complex, the accuracy of its detection results will be greatly reduced. In some other schemes, a group of page elements at preset positions in the page can be collected, and the display state of the page elements at this group of preset positions can be used to determine whether the content of the page can be presented correctly. However, in real scenarios, abnormal page presentation will also appear in other positions of the page, resulting in a low accuracy rate of detection of page elements based on preset positions.
[0029] It can be seen that the detection accuracy of the above schemes needs to be further improved. More importantly, the above schemes are usually implemented at the client. In other words, the above page detection scheme can only be detected when the page content cannot be correctly presented, which has a lag and cannot prevent abnormal page presentation. Therefore, there is an urgent need for a page detection scheme that can efficiently and accurately verify whether a page can be correctly presented.
[0030] The embodiment of the present disclosure proposes a solution for page detection. The solution proposed herein includes: obtaining an image corresponding to a page to be detected; performing optical character recognition on the image to obtain an optical character recognition result for the page; determining whether to use a machine learning model to perform detection based on the optical character recognition result; and in response to determining that a machine learning model is to be used to perform detection, using a trained machine learning model, at least based on the optical character recognition result, determining a detection result for the page, the detection result indicating whether the content of the page can be correctly presented on the client. In this way, it is possible to accurately and efficiently detect whether a page can be correctly presented.
[0031] It should be understood that the term "using a machine learning model" as used herein refers to using one or more machine learning models. Specifically, a single machine learning model can be used to complete the multimedia content recommendation operation, or multiple machine learning models can be used to collaboratively complete the multimedia content recommendation operation, wherein each machine learning model completes a link in the multimedia content recommendation operation.
[0032] Some example embodiments of the present disclosure will be described below with continued reference to the accompanying drawings.
[0033] Example Environment
[0034] Figure 1 1 is a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. Figure 1 As shown, the example environment 100 may include a terminal device 150. In the example environment 100, an application 155 is installed in the terminal device 150. The user 140 may interact with the application 155 via the terminal device 150 and / or an attached device of the terminal device 150.
[0035] Application 155 can provide the user 140 with an integration of multiple applications or components. These applications can be used as application modules in application 155. In some embodiments, application 155 can be downloaded and installed as an application on terminal device 150. In some embodiments, application 155 can also be accessed in other ways, such as through a web page.
[0036] Application 155 may be any appropriate type of application capable of providing media content, examples of which may include but are not limited to: social applications, audio / video applications, media item playback applications, broadcast applications, etc. The embodiments of the present disclosure are not limited in this respect.
[0037] exist Figure 1 In the environment 100, if the application 155 is active, the terminal device 150 can present an interactive page through the application 155. The interactive page can be any appropriate type of page, which can support the user 140 to input any appropriate type of data and present media items of any media item type to the user 140. The interactive interface can include various interfaces that can be provided by the application 155, such as a conversation interface for presenting chat content, an editing interface, a publishing interface, and the like.
[0038] In some embodiments, the terminal device 150 can communicate with the server 130 to provide services for the application 155. The terminal device 150 can be any type of mobile terminal, fixed terminal or portable terminal, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a handheld computer, a portable game terminal, a VR / AR device, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio receiver, an e-book device, a game device, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof. In some embodiments, the terminal device 150 can also support any type of interface for the user (such as a "wearable" circuit, etc.).
[0039] The server 130 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, and big data and artificial intelligence platforms. The server 130 may include, for example, a computing system / server, such as a mainframe, an edge computing node, a computing device in a cloud environment, etc. The server 130 may provide background services for the application 155 that supports virtual scenes in the terminal device 150.
[0040] A communication connection may be established between the server 130 and the terminal device 150. The communication connection may be established in a wired manner or a wireless manner. The communication connection may include, but is not limited to, a Bluetooth connection, a mobile network connection, a Universal Serial Bus (USB) connection, a Wireless Fidelity (WiFi) connection, etc., and the embodiments of the present disclosure are not limited in this respect. In the embodiments of the present disclosure, the server 130 and the terminal device 150 may implement signaling interaction through the communication connection between the two.
[0041] A machine learning model 120 is deployed in the environment 100. The machine learning model 120 can be deployed on an appropriate electronic device. As an example, the machine learning model 120 can also be deployed on other electronic devices different from the server 130, and the server 130 can, for example, call the machine learning model 120 to perform the corresponding task by way of a service call. In another example, the machine learning model 120 can also be deployed locally on the server 130, for example.
[0042] As will be described in detail below, the terminal device 150 can use the machine learning model 120 to recommend target multimedia content to the user 140. As an example, the terminal device 150 can call the machine learning model 120, for example, through the server 130. As another example, the terminal device 150 can also directly call the machine learning model 120. In short, the present disclosure is not limited in terms of the deployment location and calling method of the machine learning model 120.
[0043] For ease of discussion, the terminal device 150 and / or the server 130 and / or the machine learning model 120 are sometimes also collectively referred to as the electronic device 110. For ease of discussion only, in some example embodiments of the present disclosure, the example process is described with the electronic device 110 as the execution subject. It should be understood that in the present disclosure, the electronic device 110 performing action A may include at least one of the following: the terminal device 150 independently performs action A, the server 130 independently performs action A, the machine learning model 120 independently performs action A, or at least two of the terminal device 150 and / or the server 130 and / or the machine learning model 120 collaborate to perform action A.
[0044] It should be understood that the structure and function of the various elements in the environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure.
[0045] Example Interaction
[0046] Next, we will combine Figure 2 and 3 The flowcharts of the example interaction processes 200 and 300 of page detection according to some embodiments of the present disclosure are shown to describe the example interaction of the present disclosure. It should be understood that the interaction processes 200 and 300 do not imply or limit the operation sequence, jump logic and necessary operation steps of the present disclosure. In fact, the operation logic of each embodiment of the present disclosure can be set arbitrarily, the order of each operation step can be adjusted according to actual needs, and the operations shown can also be increased or reduced according to actual needs.
[0047] For the convenience of discussion, we will combine Figure 1 To describe the example interaction processes 200 and 300, for example, by utilizing Figure 1 The electronic device 110 in the interaction process 200 and 300 is not the only subject of the operation, and may include but is not limited to the terminal device 125, the server 130 and / or the machine learning model 120, wherein the machine learning model 120 may include one or more models.
[0048] like Figure 2As shown, according to some embodiments of the present disclosure, page detection may involve the following three stages: page loading stage, preprocessing stage, and model determination stage. Next, the above three stages will be described in detail as follows.
[0049] In operation, the electronic device 110 obtains an image corresponding to the page to be detected. In some embodiments, the electronic device 110 can obtain the page to be detected by taking a screenshot of the loaded page. As an example implementation, the electronic device 110 can use a preset browser to load the page based on the access link of the page, and in response to determining that the page has been loaded, obtain the loaded page. Figure 2 In an example embodiment, the electronic device 110 obtains (202) a link to be detected. In some embodiments, the link to be detected can be a uniform resource locator that can uniquely identify the page to be displayed. Based on the link to be detected, the electronic device 110 uses a preset browser to load (204) the page. It should be understood that the preset browser can simulate the page loading behavior of the client browser. In actual operation, the preset browser can obtain the loading result without performing a real loading process. It should also be understood that compared with a traditional client browser, the preset browser can omit some page elements, such as an address input bar, etc. The electronic device 110 waits (206) for the page loading to be completed to obtain (210) the loaded page. In this way, the electronic device 110 can simulate the page presentation state of the client and detect and troubleshoot the page in advance.
[0050] In some cases, the loading process of the page may fail. In some embodiments, during the process of loading the page, in response to determining that the loading is abnormal, the electronic device 110 reloads the page. Additionally, the maximum number of reloads can be constrained. Specifically, in response to the number of times the page is loaded exceeding (or reaching) a predetermined number of times, the electronic device 110 determines that the detection result of the page is that the content of the page cannot be loaded correctly.
[0051] exist Figure 2 In the example embodiment, the electronic device 110 can determine whether the page is loaded abnormally. If it is determined that there is a page record abnormality, it can be further determined (207) whether the number of loading anomalies reaches (or exceeds) a predetermined threshold. If it is determined that the number of loading anomalies has reached (or exceeded) the predetermined threshold, an alarm (222) can be directly triggered, that is, it is determined that the content of the page cannot be correctly presented on the client. Conversely, if it is determined that the number of loading anomalies does not reach (or is less than) the predetermined threshold, the page can be loaded again (204) using a preset browser. In this way, the loading status of the page can be used to perform a preliminary detection of whether the content of the page can be correctly presented, thereby avoiding unnecessary model judgments.
[0052] In the preprocessing stage, the electronic device 110 performs optical character recognition (OCR) on the image to obtain an OCR result for the page. In some embodiments, the OCR result includes the characters recognized from the image and the position information of the characters in the image. Figure 2 In the example embodiment, the electronic device 110 uses (214) optical character recognition to recognize the text and coordinates in the screenshot. According to some embodiments of the present disclosure, it is fully considered that the content of the text on the page and the position where the text is presented can reflect whether the page is displayed correctly. Therefore, the accuracy of page detection can be improved by performing optical character recognition on the screenshot of the page.
[0053] Next, the electronic device 110 may determine whether to use a machine learning model to perform detection based on the optical character recognition result. In some embodiments, in response to determining that the optical character recognition result includes characters recognized from the image, the electronic device 110 may determine to use a machine learning model to perform detection. Accordingly, in response to determining that the optical character recognition result does not include characters recognized from the image, the electronic device 110 may determine that the detection result of the page indicates that the content of the page cannot be correctly presented on the client. Figure 2 In the example embodiment, based on the OCR recognition result in the screenshot, the electronic device 110 can determine (216) whether the page has text and coordinates. If it is determined that the page does not have text and coordinates, an alarm is directly triggered (222), that is, it is determined that the content of the page cannot be correctly presented on the client. In this way, the optical character recognition result can be used to perform a preliminary test on whether the content of the page can be correctly presented, thereby avoiding unnecessary model determination.
[0054] In some embodiments, in response to determining to use a machine learning model to perform detection, the electronic device 110 may use the trained machine learning model to determine a detection result for the page based at least on the optical character recognition result, wherein the detection result indicates whether the content of the page can be correctly presented on the client. Additionally, in some embodiments, the electronic device 110 may provide the optical character recognition result and the image to the trained machine learning model to determine the detection result for the page. Figure 2In the example embodiment, the electronic device 110 determines the detection result of the page based on at least the optical character recognition result, and uses the trained machine learning model to determine (218) whether the content of the page can be correctly presented on the client. The electronic device 110 determines (220) whether the page content can be correctly displayed based on the output of the machine model. If it is determined that the page content cannot be correctly presented, an alarm is directly triggered (222). In this way, the advantage of the machine learning model that can perform complex analysis on the data can be utilized to improve the accuracy of page detection.
[0055] In some embodiments, the electronic device 110 can use the trained machine learning model to determine the detection result of the page by the following operation: the electronic device 110 can use the first machine learning model to determine the first detection result of the page based on at least the optical character recognition result. In response to the first detection result indicating that the content of the page cannot be correctly presented on the client, the electronic device 110 can further use the second machine learning model to determine the second detection result of the page based on at least the optical character recognition result. The electronic device 110 can determine the detection result of the page based on the first detection result and the second detection result. In some embodiments, in response to the first detection result indicating that the content of the page can be correctly presented on the client, the electronic device 110 can determine that the detection result of the page indicates that the content of the page can be correctly presented on the client. In some embodiments, the first machine learning model can be a small model, and the second machine learning model can be a large model. In this way, a small model can be used for preliminary judgment first, and a complex model can be called for judgment only when necessary. Thereby optimizing the resources of the system.
[0056] exist Figure 2 In the example embodiment, the electronic device 110 uses (250-1) a first machine learning model to determine whether the page content can be correctly presented. If the first machine learning model determines that the content of the page can be displayed normally, it can be directly determined that the content of the page can be correctly presented without further judgment. Conversely, if the first machine learning model determines that the machine learning model determines that the content of the page cannot be correctly presented, the second machine learning model is further used to determine whether the page content can be correctly presented. Only when the second machine learning model still determines that the content of the page cannot be correctly presented, it is determined that the page content cannot be correctly presented. Additionally, the judgment (250-2) can be performed multiple times by N models, where N is greater than or equal to 2. In this way, the misjudgment that the content of the page cannot be correctly presented is avoided.
[0057] In some embodiments, the electronic device 110 may determine prompt word information for the machine learning model based on the optical character recognition result, wherein the prompt word information may indicate at least one of the following: a detection rule for a page, an output requirement for a detection result, and at least one example for page detection. Figure 3 In the example embodiment, when it is determined that there are text and coordinates on the page, the OCR recognition result can be compiled (219) into the prompt word.
[0058] In some embodiments, the detection rules for the page may include at least one of the following: the limitation of the content of the OCR recognition element and / or the limitation of the position of the OCR recognition element. In one example, the detection rule may specify that when a predetermined character is detected, it is determined that the content of the page cannot be correctly presented, wherein the predetermined character includes but is not limited to, 404 error, program error, etc. In another example, the detection rule may specify that when a predetermined character is detected, it is determined that the content of the page can be correctly presented, wherein the predetermined character includes but is not limited to, input box, search box, message box, drop-down box, table, etc. In another example, the detection rule may specify that the predetermined character is not used as a criterion for determination, wherein the predetermined character includes but is not limited to, title, navigation key, top navigation, top message box, left sidebar, etc. It should be understood that the above detection rules are only exemplary. In other embodiments, other detection rules may be defined. In some embodiments, the output requirements of the detection result can define the output content, for example, the following results can be defined to be output: analysis process and / or determination result, etc. In some embodiments, at least one example for page detection can be any example that helps the machine learning model perform determination, for example, the main body area of the page does not contain any valid elements, and the content of the determination page cannot be displayed correctly. In this way, by defining appropriate prompt words, the OCR recognition results can be fully utilized to improve the accuracy of page detection.
[0059] Figure 3 1 shows a flow chart of an example interactive process 300 of page detection according to some embodiments of the present disclosure. Figure 1 and Figure 2 Let's discuss process 300. Figure 2 and Figure 3 In the drawings, the same or similar operations are numbered the same.
[0060] exist Figure 3 In the example embodiment of , the electronic device 110 obtains (202) a link to be detected. In some embodiments, the link to be detected may be a uniform resource locator that can uniquely identify a page to be displayed. Based on the link to be detected, the electronic device 110 loads (204) a page using a preset browser.
[0061] exist Figure 3 In an example embodiment, the electronic device 110 uses a trained machine learning model to determine (218) whether the content of the page can be correctly presented on the client. In operation, the electronic device 110 can use the machine learning model to make M independent determinations, where M is a positive integer greater than or equal to 2. If the electronic device 110 determines (222) that the number of times / probability that the content of the page cannot be correctly presented is greater than (or reaches) a threshold, an alarm is triggered (222). In this way, through multiple determinations, the accuracy of the page detection result is greatly improved.
[0062] Through the above embodiments of the present disclosure, the advantages of the machine learning model can be fully utilized, combined with the text layout characteristics of the page, to improve the accuracy of page detection. More importantly, the platform can dynamically detect the pages it maintains, thereby preventing abnormal presentation of the page.
[0063] Example Process
[0064] Figure 4 FIG. 4 is a flowchart of an example process 400 for traveling according to some embodiments of the present disclosure. The process 400 may be implemented at the electronic device 110. Figure 1 4. The process 400 is described below.
[0065] In block 410 , the electronic device obtains an image corresponding to a page to be detected.
[0066] In block 420 , the electronic device performs optical character recognition (OCR) on the image to obtain an OCR result for the page.
[0067] In box 430, the electronic device determines whether to use a machine learning model to perform detection based on the OCR results.
[0068] In box 440, in response to determining that a machine learning model is to be used to perform detection, the electronic device uses the trained machine learning model to determine a detection result for the page based at least on the OCR result, and the detection result indicates whether the content of the page can be correctly presented on the client.
[0069] In some embodiments, based on the OCR result, determining whether to use a machine learning model to perform detection includes: in response to determining that the OCR result includes characters recognized from the image, the electronic device determines that the machine learning model is to be used to perform detection. In addition, in response to determining that the OCR result does not include characters recognized from the image, the electronic device determines that the detection result of the page indicates that the content of the page cannot be correctly presented on the client.
[0070] In some embodiments, using a trained machine learning model to determine a detection result for a page based at least on an OCR result includes: the electronic device provides the OCR result and the image to the trained machine learning model to determine the detection result for the page.
[0071] In some embodiments, utilizing a trained machine learning model to determine a detection result for a page at least based on an OCR result includes: the electronic device determines prompt word information for the machine learning model based on the OCR result, the prompt word information also indicating at least one of the following: a detection rule for the page, an output requirement for a detection result, and at least one example for page detection.
[0072] In some embodiments, the OCR result includes characters recognized from the image and position information of the characters in the image.
[0073] In some embodiments, using a trained machine learning model to determine a detection result of a page based at least on an OCR result includes: the electronic device using a first machine learning model to determine a first detection result of the page based at least on an OCR result; in response to the first detection result indicating that the content of the page cannot be correctly presented on the client, the electronic device using a second machine learning model to determine a second detection result of the page based at least on the OCR result; and the electronic device determines the detection result of the page based on the first detection result and the second detection result.
[0074] In some embodiments, using a trained machine learning model, determining the detection result of a page at least based on an OCR result also includes: in response to a first detection result indicating that the content of the page can be correctly presented on the client, the electronic device determines that the detection result of the page indicates that the content of the page can be correctly presented on the client.
[0075] In some embodiments, the electronic device uses a preset browser to load a page based on an access link of the page; and in response to determining that the page has been loaded, obtains the loaded page.
[0076] In some embodiments, during the process of loading a page, in response to determining that an abnormality occurs in the loading, the electronic device reloads the page; and in response to the number of times the page is loaded exceeds a predetermined number of times, the electronic device determines that the detection result of the page is that the content of the page cannot be loaded correctly.
[0077] Example devices and equipment
[0078] The embodiments of the present disclosure also provide corresponding devices for implementing the above methods or processes. Figure 5A schematic structural block diagram of an example apparatus 500 for traveling according to some embodiments of the present disclosure is shown. The apparatus 500 may be implemented as or included in the electronic device 110. Each module / component in the apparatus 500 may be implemented by hardware, software, firmware, or any combination thereof.
[0079] like Figure 5 As shown, the device 500 includes: an image acquisition module 510, configured to obtain an image corresponding to a page to be detected; a character recognition module 520, configured to perform optical character recognition on the image to obtain an optical character recognition result for the page; a determination module 530, configured to determine whether to use a machine learning model to perform detection based on the optical character recognition result; and a model determination module 540, configured to determine, in response to determining that a machine learning model is to be used to perform detection, a detection result for the page based on at least the optical character recognition result using a trained machine learning model, the detection result indicating whether the content of the page can be correctly presented on the client.
[0080] In some embodiments, the determination module 530 is further configured to: in response to determining that the OCR result includes characters recognized from the image, determine to use a machine learning model to perform detection. The device 500 also includes an indication module, configured to: in response to determining that the OCR result does not include characters recognized from the image, determine that the detection result of the page indicates that the content of the page cannot be correctly presented on the client.
[0081] In some embodiments, the model determination module 540 is further configured to provide the OCR result and the image to a trained machine learning model to determine a detection result for the page.
[0082] In some embodiments, the model determination module 540 is further configured to determine prompt word information for the machine learning model based on the OCR results, and the prompt word information also indicates at least one of the following: detection rules for the page, output requirements for the detection results, and at least one example for page detection.
[0083] In some embodiments, the OCR result includes characters recognized from the image and position information of the characters in the image.
[0084] In some embodiments, the model determination module 540 is also configured to: determine a first detection result for the page using a first machine learning model, at least based on the OCR result; in response to the first detection result indicating that the content of the page cannot be correctly presented on the client, determine a second detection result for the page using a second machine learning model, at least based on the OCR result; and determine the detection result of the page based on the first detection result and the second detection result.
[0085] In some embodiments, the model determination module 540 is further configured to: in response to the first detection result indicating that the content of the page can be correctly presented on the client, determine that the detection result of the page indicates that the content of the page can be correctly presented on the client.
[0086] In some embodiments, the device 500 also includes a loading module configured to: load a page based on an access link of the page using a preset browser; and obtain the loaded page in response to determining that the page has been loaded.
[0087] In some embodiments, the device 500 also includes a reloading module configured to: during the process of loading the page, in response to determining that an abnormality occurs in the loading, reload the page; and in response to the number of times the page is loaded exceeding a predetermined number of times, determine that the detection result of the page is that the content of the page cannot be loaded correctly.
[0088] like Figure 6 As shown, the electronic device 600 is in the form of a general electronic device. The components of the electronic device 600 may include, but are not limited to, one or more processors or processing units 610, a memory 620, a storage device 630, one or more communication units 640, one or more input devices 660, and one or more output devices 660. The processing unit 610 may be an actual or virtual processor and is capable of performing various processes according to a program stored in the memory 620. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to improve the parallel processing capability of the electronic device 600.
[0089] The electronic device 600 typically includes a plurality of computer storage media. Such media may be any accessible media that is accessible to the electronic device 600, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 620 may be a volatile memory (e.g., registers, caches, random access memory (RAM)), a non-volatile memory (e.g., a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 630 may be a removable or non-removable medium, and may include a machine-readable medium, such as a flash drive, a disk, or any other medium, which may be capable of being used to store information and / or data and may be accessed within the electronic device 600.
[0090] The electronic device 600 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 6As shown in , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to the bus (not shown) by one or more data media interfaces. The memory 620 may include a computer program product 625 having one or more program modules that are configured to perform various methods or actions of various embodiments of the present disclosure.
[0091] The communication unit 640 implements communication with other electronic devices through a communication medium. Additionally, the functions of the components of the electronic device 600 can be implemented with a single computing cluster or multiple computing machines that can communicate through a communication connection. Therefore, the electronic device 600 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.
[0092] The input device 650 may be one or more input devices, such as a mouse, a keyboard, a tracking ball, etc. The output device 660 may be one or more output devices, such as a display, a speaker, a printer, etc. The electronic device 600 may also communicate with one or more external devices (not shown) through the communication unit 640 as needed, such as a storage device, a display device, etc., communicate with one or more devices that allow a user to interact with the electronic device 600, or communicate with any device that allows the electronic device 600 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).
[0093] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.
[0094] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices, equipment, and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0095] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0096] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0097] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0098] The above descriptions of various implementations of the present disclosure are exemplary, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the various implementations disclosed herein.
Claims
1. A method for page detection, comprising: Obtain the image corresponding to the page to be detected; Performing optical character recognition on the image to obtain an optical character recognition result for the page; Based on the optical character recognition result, determining whether to use a machine learning model to perform detection; as well as In response to determining that the detection is to be performed using a machine learning model, a detection result for the page is determined using the trained machine learning model at least based on the optical character recognition result, wherein the detection result indicates whether the content of the page can be correctly presented on the client.
2. The method according to claim 1, wherein based on the optical character recognition result, determining whether to use a machine learning model to perform detection comprises: In response to determining that the optical character recognition result includes a character recognized from the image, determining to perform detection using a machine learning model; and The method further comprises: In response to determining that the optical character recognition result does not include characters recognized from the image, determining that the detection result for the page indicates that content of the page cannot be correctly presented on a client.
3. The method according to claim 1, wherein using a trained machine learning model to determine the detection result of the page based at least on the optical character recognition result comprises: The optical character recognition result and the image are provided to a trained machine learning model to determine a detection result for the page.
4. The method according to claim 1, wherein using a trained machine learning model to determine a detection result of the page based at least on the optical character recognition result comprises: Determine prompt word information for the machine learning model based on the optical character recognition result, wherein the prompt word information further indicates at least one of the following: The detection rules for the page, The output requirements of the test results are: At least one example for page detection. The method according to claim 1 , wherein the optical character recognition result includes characters recognized from the image and position information of the characters in the image.
6. The method according to claim 1, wherein using a trained machine learning model to determine a detection result of the page based at least on the optical character recognition result comprises: Determine, using a first machine learning model, a first detection result for the page based at least on the optical character recognition result; In response to the first detection result indicating that the content of the page cannot be correctly presented on the client, using a second machine learning model to determine a second detection result for the page based at least on the optical character recognition result; as well as The detection result of the page is determined based on the first detection result and the second detection result.
7. The method according to claim 6, wherein using a trained machine learning model to determine the detection result of the page based at least on the optical character recognition result further comprises: In response to the first detection result indicating that the content of the page can be correctly presented on the client, it is determined that the detection result of the page indicates that the content of the page can be correctly presented on the client.
8. The method according to claim 1, further comprising: Using a preset browser, loading the page based on an access link of the page; as well as In response to determining that the page has been loaded, the loaded page is obtained.
9. The method according to claim 8, further comprising: In the process of loading the page, in response to determining that an abnormality occurs in the loading, reloading the page; as well as In response to the number of times the page is loaded exceeding a predetermined number, it is determined that the detection result of the page is that the content of the page cannot be correctly loaded.
10. A device for page detection, comprising: The image acquisition module is configured to: obtain an image corresponding to the page to be detected; A character recognition module is configured to: perform optical character recognition on the image to obtain an optical character recognition result for the page; A determination module is configured to: determine whether to use a machine learning model to perform detection based on the optical character recognition result; as well as The model determination module is configured to: in response to determining that a machine learning model is to be used to perform detection, use a trained machine learning model to determine a detection result for the page based at least on the optical character recognition result, wherein the detection result indicates whether the content of the page can be correctly presented on the client.
11. An electronic device, comprising: at least one processing unit; as well as At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to perform the method according to any one of claims 1 to 9 when executed by the at least one processing unit.
12. A computer-readable storage medium having a computer program stored thereon, wherein the computer program can be executed by a processor to implement the method according to any one of claims 1 to 9.
13. A computer program product tangibly stored in a computer storage medium and comprising computer executable instructions which, when executed by a device, cause the device to perform the method according to any one of claims 1 to 9.