CN108228463B - Method and device for detecting first screen time - Google Patents

Method and device for detecting first screen time Download PDF

Info

Publication number
CN108228463B
CN108228463B CN201810023347.6A CN201810023347A CN108228463B CN 108228463 B CN108228463 B CN 108228463B CN 201810023347 A CN201810023347 A CN 201810023347A CN 108228463 B CN108228463 B CN 108228463B
Authority
CN
China
Prior art keywords
time
screenshot
webpage
loading
gray
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810023347.6A
Other languages
Chinese (zh)
Other versions
CN108228463A (en
Inventor
张�浩
杨敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baidu Online Network Technology Beijing Co Ltd
Original Assignee
Baidu Online Network Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Baidu Online Network Technology Beijing Co Ltd filed Critical Baidu Online Network Technology Beijing Co Ltd
Priority to CN201810023347.6A priority Critical patent/CN108228463B/en
Publication of CN108228463A publication Critical patent/CN108228463A/en
Application granted granted Critical
Publication of CN108228463B publication Critical patent/CN108228463B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the application discloses a method and a device for detecting first screen time. One embodiment of the method comprises: in response to receiving a webpage loading request, intercepting at least two screenshots of the requested webpage in the process of loading the first screen content, and recording the intercepting time of each screenshot; determining the picture information entropy of each screenshot, and determining the screenshot when the loading of the first screen content of the webpage is finished from at least two screenshots based on the picture information entropy of each screenshot; determining the interception time of the screenshot when the loading of the first screen content of the webpage is finished as the webpage loading finishing time, and selecting the earliest interception time from the interception times of at least two screenshots as the webpage loading starting time; and determining the difference value of the webpage loading completion time and the webpage loading starting time as the first screen time of the webpage, and outputting the first screen time. This embodiment improves the accuracy of the first screen time detection.

Description

Method and device for detecting first screen time
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to the technical field of the Internet, and particularly relates to a device for detecting a first screen time method.
Background
With the rapid development of internet technology, the speed requirement of a user on loading a webpage by a browser is higher and higher. The total loading time of the pages is different due to different page sizes of various websites. The time consumed by the browser for displaying the first screen page can be called first screen time, and the first screen time is used as an important index for measuring the internet surfing experience of the user and directly influences the cognition degree of the user on a website, so that how to accurately acquire the first screen time of the webpage becomes an important standard for evaluating the page loading speed.
Disclosure of Invention
The embodiment of the application provides a method and a device for detecting first screen time.
In a first aspect, an embodiment of the present application provides a method for detecting a first screen time, including: in response to receiving a webpage loading request, intercepting at least two screenshots of the requested webpage in the process of loading the first screen content, and recording the intercepting time of each screenshot; determining the picture information entropy of each screenshot, and determining the screenshot when the loading of the first screen content of the webpage is finished from at least two screenshots based on the picture information entropy of each screenshot; determining the interception time of the screenshot when the loading of the first screen content of the webpage is finished as the webpage loading finishing time, and selecting the earliest interception time from the interception times of at least two screenshots as the webpage loading starting time; and determining the difference value of the webpage loading completion time and the webpage loading starting time as the first screen time of the webpage, and outputting the first screen time.
In some embodiments, determining the picture information entropy for each screenshot comprises: aiming at each screenshot, carrying out graying processing on the screenshot to obtain a gray picture, acquiring the gray value of each pixel point in the gray picture, and determining the picture information entropy of the screenshot based on the gray value of each pixel point.
In some embodiments, determining the picture information entropy of the screenshot based on the gray value of each pixel point includes: counting the number of pixel points of which the gray value is the gray value according to each gray value of each pixel point in the gray picture, and determining the ratio of the number to the number of the pixel points in the gray picture as the occurrence probability of the gray value; and determining the picture information entropy of the screenshot based on the occurrence probability of each gray value.
In some embodiments, determining a screenshot when loading of the first screen content of the web page is completed from at least two screenshots based on the picture information entropy of each screenshot includes: selecting the largest picture information entropy from the picture information entropies of at least two screenshots, and determining the product of the selected picture information entropy and a preset coefficient as a picture information entropy threshold; and selecting the screenshot with the picture information entropy larger than the picture information entropy threshold value and the corresponding earliest interception time from the at least two screenshots as the screenshot when the loading of the first screen content of the webpage is finished.
In some embodiments, intercepting at least two screenshots of a requested web page during a first screen content loading process includes: intercepting a screenshot of the first screen content of the webpage when the first screen content of the requested webpage starts to be loaded, and recording the intercepting time as first intercepting time; determining the sum of the first interception time and the preset time length as a second interception time; and from the second interception time, intercepting screenshots of the webpage in the process of loading the first screen content according to a preset time interval.
In a second aspect, an embodiment of the present application provides an apparatus for detecting a first screen time, including: the system comprises an intercepting unit, a display unit and a display unit, wherein the intercepting unit is configured to respond to a received webpage loading request, intercept at least two screenshots of a requested webpage in a first screen content loading process, and record intercepting time of each screenshot; the first determining unit is configured to determine the picture information entropy of each screenshot, and determine the screenshot when the loading of the first screen content of the webpage is finished from at least two screenshots based on the picture information entropy of each screenshot; the second determining unit is configured to determine the interception time of the screenshot when the loading of the first screen content of the webpage is completed as the webpage loading completion time, and select the earliest interception time from the interception times of at least two screenshots as the webpage loading starting time; and the output unit is configured to determine the difference value between the webpage loading completion time and the webpage loading start time as the first screen time of the webpage and output the first screen time.
In some embodiments, the first determining unit is further configured to: aiming at each screenshot, carrying out graying processing on the screenshot to obtain a gray picture, acquiring the gray value of each pixel point in the gray picture, and determining the picture information entropy of the screenshot based on the gray value of each pixel point.
In some embodiments, the first determination unit comprises: the first determining module is configured to count the number of pixel points of which the gray values are gray values according to each gray value of each pixel point in the gray picture, and determine the ratio of the number to the number of the pixel points in the gray picture as the occurrence probability of the gray value; and the second determination module is configured to determine the picture information entropy of the screenshot based on the occurrence probability of each gray value.
In some embodiments, the first determination unit comprises: the first selection module is configured to select the largest picture information entropy from the picture information entropies of the at least two screenshots, and determine the product of the selected picture information entropy and a preset coefficient as a picture information entropy threshold; and the second selection module is configured to select the screenshot with the picture information entropy larger than the picture information entropy threshold and the corresponding earliest interception time from the at least two screenshots as the screenshot when the loading of the first screen content of the webpage is finished.
In some embodiments, the truncation unit comprises: the recording module is configured to intercept a screenshot of the first screen content of the webpage when the first screen content of the requested webpage starts to be loaded, and record interception time as first interception time; the determining module is configured to determine the sum of the first interception time and the preset time length as a second interception time; and the intercepting module is configured to intercept the screenshot of the webpage in the first screen content loading process from the second intercepting time according to a preset time interval.
In a third aspect, an embodiment of the present application further provides an electronic device, including: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method for detecting the first screen time provided by the application.
In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for detecting the first screen time provided by the present application.
The method and the device for detecting the first screen time provided by the application intercept at least two screenshots of a webpage in the loading process, recording the interception time of each screenshot, then determining the picture information entropy of each screenshot, determining the screenshot when the loading of the first screen content of the webpage is finished from at least two intercepted screenshots based on the picture information entropy of each screenshot, then determining the interception time of the screenshot when the loading of the first screen content of the webpage is finished as the webpage loading finishing time, selecting the earliest interception time from the recorded interception times as the webpage loading starting time, determining the difference between the webpage loading finishing time and the webpage loading starting time as the first screen time of the webpage, outputting the first screen time, therefore, the picture information entropy of each screenshot is effectively utilized, and the accuracy of first-screen time detection is improved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for detecting a first screen time according to the present application;
FIG. 3 is a schematic diagram of an application scenario of a method for detecting a first screen time according to the present application;
FIG. 4 is a flow diagram of yet another embodiment of a method for detecting a first screen time according to the present application;
FIG. 5 is a schematic diagram illustrating an embodiment of an apparatus for detecting a first screen time according to the present application;
FIG. 6 is a schematic block diagram of a computer system suitable for use in implementing an electronic device according to embodiments of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 illustrates an exemplary system architecture 100 to which embodiments of the method for detecting an initial screen time or the apparatus for detecting an initial screen time of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include user terminals 1011, 1012, 1013, a server 102, output terminals 1031, 1032, 1033, networks 1041, 1042 and an information display device 105. The network 1041 serves to provide a medium for communication links between the user terminals 1011, 1012, 1013 and the server 102. Network 1042 serves to provide a medium for communication links between server 102 and output terminals 1031, 1032, 1033. The networks 1041, 1042 may comprise various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may interact with the server 102 via the network 1041 using user terminals 1011, 1012, 1013 for the server 102 to receive a user's web page loading request, etc. The user terminals 1011, 1012, 1013 may have installed thereon various communication client applications, such as a web browser application, a shopping-type application, a search-type application, and the like.
Output terminals 1031, 1032, 1033 interact with server 102 via network 1042 for server 102 to output the first screen time, etc. using output terminals 1031, 1032, 1033. The output terminals 1031, 1032, 1033 may have installed thereon various communication client applications, such as a web browser application, an instant messaging tool, a mailbox client, social platform software, and the like.
The user terminals 1011, 1012, 1013 and the output terminals 1031, 1032, 1033 may be various electronic devices having display screens and supporting information interaction, including but not limited to smart phones, tablet computers, e-book readers, laptop portable computers, desktop computers, and the like.
The server 102 may be a server providing various services, such as a background server detecting a first screen time of a web page requested by the user terminal 1011, 1012, 1013. The background server may analyze and process the received data such as the web page loading request, and feed back a processing result (e.g., the first screen time of the web page) to the output terminals 1031, 1032, 1033 or the information display device 105.
It should be noted that the method for detecting the first screen time provided in the embodiment of the present application is generally executed by the server 102, and accordingly, the apparatus for detecting the first screen time is generally disposed in the server 102.
It should be understood that the number of user terminals, servers, output terminals, networks, and information display devices in fig. 1 is merely illustrative. There may be any number of user terminals, servers, output terminals, networks, and information display devices, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for detecting an initial screen time in accordance with the present application is shown. The method for detecting the first screen time comprises the following steps:
step 201, in response to receiving a webpage loading request, intercepting at least two screenshots of the requested webpage in the process of loading the first screen content, and recording the intercepting time of each screenshot.
In this embodiment, an electronic device (for example, a server shown in fig. 1) on which the method for detecting the first screen time is executed may detect whether a webpage loading request is received, and if a webpage loading request is received, the electronic device may intercept at least two screenshots of a requested webpage in a first screen content loading process, and may record the interception time of each screenshot, where the first screen content may be content in a first screen page of the webpage displayed by a browser. The webpage loading request may be sent by the electronic device when the electronic device simulates a user loading a webpage by using an open source browser (e.g., phantomjs (a webkit kernel based headless browser)). The electronic equipment can intercept the screenshot of the requested webpage in the process of loading the first screen content at preset screenshot time intervals. Generally speaking, the smaller the screenshot time interval, the higher the screenshot time precision, the greater the number of the intercepted screenshots, and the more accurate the detected first screen time.
It should be noted that at least one of the at least two screenshots intercepted by the electronic device needs to include a screenshot of the requested web page at the beginning of loading.
In this embodiment, the electronic device may also display a loading process of the first screen content of the requested web page in a locally connected display screen, and capture at least two screenshots by using a high-speed camera, screen recording software, and the like, and record capture time of each screenshot.
In some optional implementation manners of this embodiment, the electronic device may intercept the screenshot of the first screen content of the requested webpage when starting to load the first screen content of the requested webpage, and record, as the first interception time, an interception time when the first screen content of the requested webpage starts to be loaded; then, the electronic device may determine a sum of the first truncation time and a preset time length (e.g., 1 second) as a second truncation time; finally, the electronic device may capture the screenshot of the webpage in the process of loading the first screen content according to a preset time interval (e.g., 0.1 second and 0.05 second) from the second capture time. For example, if the electronic device intercepts the first screen content of the requested web page at 7 points 56 minutes 37.02 seconds, the length of the time is 1 second, and the time interval is 0.1 second, the electronic device may intercept the screenshot of the web page during the loading of the first screen content at 0.1 second time interval from 7 points 56 minutes 38.02 seconds. By using the interception mode, the system overhead of the electronic equipment during screenshot interception can be reduced.
Step 202, determining the picture information entropy of each screenshot, and determining the screenshot when the loading of the first screen content of the webpage is finished from at least two screenshots based on the picture information entropy of each screenshot.
In this embodiment, the electronic device may first determine a picture information entropy of each screenshot, where the picture information entropy may also be referred to as an image entropy or a picture information amount, and may be represented as a bit average of an image gray level set, and also describes an average information amount of an image source.
In this embodiment, the electronic device may first determine an image histogram of each screenshot. The image histogram reflects a statistical table of the pixel distribution of an image, and may include a gray level histogram and a color histogram. The abscissa of the gray level histogram represents the gray level value of the image pixels, and the ordinate represents the total number of the pixels of each gray level value in the image or the percentage of the total number of the pixels; the abscissa of the color histogram represents the color values of the pixels of the image and the ordinate represents the total number of pixels or the percentage of all pixels in the image for each color value. Then, for each screenshot, for the gray level histogram of the screenshot, the electronic device may multiply the total number of pixels in the image of each gray level by the corresponding preset weight, add the obtained products and divide by the number of gray levels, and determine the obtained ratio as the image information entropy of the screenshot.
Then, the electronic device can determine the screenshot when the loading of the first screen content of the webpage is completed from at least two screenshots based on the picture information entropy of each screenshot. The electronic equipment can select the screenshot with the largest picture information entropy from the at least two screenshots as the screenshot when the loading of the first screen content of the webpage is finished.
Step 203, determining the interception time of the screenshot when the loading of the first screen content of the webpage is completed as the webpage loading completion time, and selecting the earliest interception time from the interception times of at least two screenshots as the webpage loading start time.
In this embodiment, the electronic device may determine, as the web page loading completion time, the interception time of the screenshot when the loading of the first screen content of the web page determined in step 202 is completed, and may select, as the web page loading start time, the earliest interception time from the interception times of the at least two screenshots.
And step 204, determining the difference value between the webpage loading completion time and the webpage loading starting time as the first screen time of the webpage, and outputting the first screen time.
In this embodiment, the electronic device may determine a difference between the webpage loading completion time determined in step 203 and the webpage loading start time selected in step 203 as a first screen time of the requested webpage, and output the first screen time.
In this embodiment, the electronic device may present the first screen time in a text form, an audio form, an image form, or the like; the first screen time may also be stored locally in the electronic device, or stored in another electronic device.
With continued reference to fig. 3, fig. 3 is a schematic diagram of an application scenario of the method for detecting the first screen time according to the present embodiment. In the application scenario of fig. 3, in response to the server 301 receiving a web page loading request 302 for the web page a, the server 301 intercepts screenshots of the web page a in the process of loading the first screen content, which are respectively an a screenshot 3031, a B screenshot 3032, a C screenshot 3033, a D screenshot 3034, an E screenshot 3035 and an F screenshot 3036, and records that an interception time 3041 of the a screenshot 3031 is 5 hours and 6 minutes for 30.02 seconds, an interception time 3042 of the B screenshot 3032 is 5 hours and 6 minutes for 30.22 seconds, an interception time 3043 of the C screenshot 3033 is 5 hours and 6 minutes for 30.42 seconds, an interception time 3044 of the D screenshot 3034 is 5 hours and 6 minutes for 30.62 seconds, an interception time 3045 of the E screenshot 3035 is 5 hours and 6 minutes for 30.82 seconds, and an interception time 3046 of the F screenshot 3036 is 5 hours and 6 minutes for 31.02 seconds; then, the server 301 determines that the picture information entropy 3051 of the screenshot 3031 a is 0.01, the picture information entropy 3052 of the screenshot 3032B is 0.54, the picture information entropy 3053 of the screenshot 3033C is 0.89, the picture information entropy 3054 of the screenshot 3034D is 1.23, the picture information entropy 3055 of the screenshot 3035E is 1.22, and the picture information entropy 3056 of the screenshot 3036F is 1.25; then, the server 301 selects an F screenshot 3036 with the largest picture information entropy as a screenshot when loading of the first screen content of the webpage a is completed; then, the server 301 takes the interception time 5 hours and 6 minutes 31.02 seconds of the screenshot 3036 as the webpage loading completion time, and selects the earliest interception time 6 minutes and 30.02 seconds from the six interception times as the webpage loading start time; finally, the server 301 determines the difference 1 second between the web page loading completion time 5 hours 6 minutes 31.02 seconds and the web page loading start time 5 hours 6 minutes 30.02 seconds as the first screen time 308 of the web page a, and outputs the first screen time 1 second.
According to the method provided by the embodiment of the application, the webpage loading completion time is determined according to the picture information entropy of each screenshot, and the accuracy of the first-screen time detection is improved.
With further reference to fig. 4, a flow 400 of yet another embodiment of a method for detecting an initial screen time is shown. The process 400 of the method for detecting the first screen time includes the following steps:
step 401, in response to receiving a webpage loading request, intercepting at least two screenshots of the requested webpage in the process of loading the first screen content, and recording the intercepting time of each screenshot.
In this embodiment, the operation of step 401 is substantially the same as the operation of step 201, and is not described herein again.
Step 402, aiming at each screenshot, performing graying processing on the screenshot to obtain a gray picture, and obtaining the gray value of each pixel point in the gray picture.
In this embodiment, for each screenshot, the electronic device may perform graying processing on the screenshot, and obtain a grayscale value of each pixel point in a grayscale picture. Each of the above-mentioned screenshots is usually a color image, in which the color of each pixel point is determined by three components of R (red), G (green) and B (blue), and the gray image is a special color image with R, G, B components being the same. The description of a grayscale image, like a color image, still reflects the distribution and characteristics of the chrominance and luminance levels, both globally and locally, of the entire image.
In this embodiment, the electronic device may convert the screenshot into a grayscale picture in the following manners:
first, floating-point algorithm: gray ═ R0.3 + G0.59 + B0.11;
second, integer method: gray ═ (R30 + G59 + B11)/100;
third, mean method: (R + G + B)/3;
fourth, take green only algorithm: g ═ G;
for each pixel point in the screenshot, R is a value of a red component of the pixel point, G is a value of a green component of the pixel point, B is a value of a blue component of the pixel point, and Gray is a Gray value of the pixel point.
Then, the electronic device may replace R, G, and B in RGB (R, G, and B) of the screenshot with Gray to form new color RGB (Gray ), and replace the original RGB (R, G, and B) with the new color RGB (Gray ) to obtain a grayscale image of the screenshot, and may obtain a grayscale value of each pixel point in the grayscale image.
Step 403, for each gray value in each gray value of each pixel point in the gray image, counting the number of pixel points whose gray values are the gray values in the gray image, and determining the ratio of the number to the number of pixel points in the gray image as the occurrence probability of the gray value.
In this embodiment, for each gray value of the gray values of the pixel points in the gray picture obtained in step 402, the electronic device may count the number of the pixel points whose gray values are the gray values in the gray picture, and determine the ratio of the number of the pixel points whose gray values are the gray values to the number of the pixel points in the gray picture as the occurrence probability of the gray value.
For example, if there are 5 kinds of gray-scale values in all of the pixels in the gray-scale picture, which are 2, 37, 106, 189, and 255, respectively, the number of pixels in the gray-scale picture is 100 ten thousand. For the gray value 2, the electronic device may count that the number of pixel points with the gray value 2 in the gray picture is 2000, and determine the ratio 0.002 between the number of pixel points with the gray value 2 2000 and the number of pixel points in the gray picture of 100 ten thousand as the occurrence probability of the gray value 2. Meanwhile, it can be determined that the probability of occurrence of the gray value 37 is 0.03, the probability of occurrence of the gray value 106 is 0.053, the probability of occurrence of the gray value 189 is 0.105, and the probability of occurrence of the gray value 255 is 0.81.
And step 404, determining the picture information entropy of the screenshot based on the occurrence probability of each gray value.
In this embodiment, based on the occurrence probability of each gray scale value, the electronic device may determine the picture information entropy of the screenshot. The electronic device can determine the picture information entropy of the screenshot according to the following formula 1:
Figure BDA0001544231890000101
h is the picture information entropy of the screenshot, i is the ith gray value in the gray image, and piN is the number (number) of gray-scale values.
It should be noted that the logarithm in formula 1 generally takes a base 2 and the unit is a bit. However, other logarithmic bases can be adopted, and other corresponding units can be adopted, and the conversion between the logarithmic bases and the corresponding units can be realized by using a base conversion formula.
Step 405, selecting the largest picture information entropy from the picture information entropies of the at least two screenshots, and determining the product of the selected picture information entropy and a preset coefficient as a picture information entropy threshold.
In this embodiment, the electronic device may select the largest picture information entropy from the picture information entropies of the at least two screenshots, and then determine a product of the selected picture information entropy and a preset coefficient (e.g., 0.9) as the picture information entropy threshold. Here, the above-mentioned preset coefficient is generally a value between 0 and 1. In the loading process of the webpage, the occurrence of the information such as the advertisement popup window may be accompanied, the occurrence of the advertisement popup window may cause the webpage loading page to shake, and the page shaking may cause the content in the webpage with the later interception time to be less than the content in the webpage with the earlier interception time, so that the error caused by the occurrence of the information such as the advertisement popup window to the detected first screen time can be reduced by determining the picture information entropy threshold.
And 406, selecting the screenshot in which the picture information entropy is larger than the picture information entropy threshold and the corresponding interception time is the earliest from the at least two screenshots as the screenshot when the loading of the first screen content of the webpage is finished.
In this embodiment, the electronic device may select, from the at least two screenshots, a screenshot in which the picture information entropy is greater than the picture information entropy threshold and the corresponding capture time is the earliest, as the screenshot when loading of the first screen content of the web page is completed.
In this embodiment, the electronic device may also sort the at least two screenshots according to the order of the interception time from first to last, and then select, from the sorted screenshots, a screenshot in which the picture information entropy is greater than the picture information entropy threshold and the most sorted position is the screenshot when loading of the first screen content of the web page is completed.
As an example, if the electronic device intercepts 5 screenshots, the electronic device may sort the 5 screenshots according to the interception time sequence, the picture information entropies of the sorted 5 screenshots are respectively 0.1, 1.25, 1.56, 1.55, and 1.57, and the picture information entropy threshold is 1.54, and then the electronic device may select the screenshot with the picture information entropy of 1.56 as the screenshot when the loading of the first screen content of the web page is completed.
Step 407, determining the interception time of the screenshot when the loading of the first screen content of the webpage is completed as the webpage loading completion time, and selecting the earliest interception time from the interception times of at least two screenshots as the webpage loading start time.
And step 408, determining the difference value between the webpage loading completion time and the webpage loading starting time as the first screen time of the webpage, and outputting the first screen time.
In the present embodiment, the operations of steps 407-408 are substantially the same as the operations of steps 203-204, and are not described herein again.
As can be seen from fig. 4, compared with the embodiment corresponding to fig. 2, the flow 400 of the method for detecting the first screen time in this embodiment highlights a step of determining the picture information entropy of the screenshot and a step of determining the screenshot when the loading of the first screen content of the web page is completed. Therefore, the scheme described in the embodiment can more accurately determine the image information entropy of each screenshot, and more accurately determine the screenshot when the loading of the first screen content of the webpage is completed from at least two screenshots, so that the accuracy of the first screen time detection is further improved.
With further reference to fig. 5, as an implementation of the methods shown in the above-mentioned figures, the present application provides an embodiment of an apparatus for detecting a first screen time, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be applied to various electronic devices.
As shown in fig. 5, the apparatus 500 for detecting the first screen time of the present embodiment includes: a clipping unit 501, a first determination unit 502, a second determination unit 503, and an output unit 504. The intercepting unit 501 is configured to, in response to receiving a web page loading request, intercept at least two screenshots of a requested web page in a first screen content loading process, and record an intercepting time of each screenshot; the first determining unit 502 is configured to determine a picture information entropy of each screenshot, and determine a screenshot when loading of the first screen content of the web page is completed from at least two screenshots based on the picture information entropy of each screenshot; the second determining unit 503 is configured to determine the interception time of the screenshot when the loading of the first screen content of the webpage is completed as the webpage loading completion time, and select the earliest interception time from the interception times of at least two screenshots as the webpage loading start time; the output unit 504 is configured to determine a difference between the web page loading completion time and the web page loading start time as a first screen time of the web page, and output the first screen time.
In this embodiment, the specific processing of the intercepting unit 501, the first determining unit 502, the second determining unit 503 and the output unit 504 of the apparatus 500 for detecting the first screen time may refer to step 201, step 202, step 203 and step 204 in the corresponding embodiment of fig. 2.
In some optional implementation manners of this embodiment, for each screenshot, the first determining unit 502 may perform graying processing on the screenshot, and obtain a grayscale value of each pixel point in the grayscale image. Each of the above screenshots is usually a color image, the color of each pixel in the color image is determined by R, G, B three components, and the gray image is a special color image with R, G, B three components being the same. The description of a grayscale image, like a color image, still reflects the distribution and characteristics of the chrominance and luminance levels, both globally and locally, of the entire image. The first determining unit 502 may convert the screenshot into a grayscale picture by the following methods:
first, floating-point algorithm: gray ═ R0.3 + G0.59 + B0.11;
second, integer method: gray ═ (R30 + G59 + B11)/100;
third, mean method: (R + G + B)/3;
fourth, take green only algorithm: g ═ G;
for each pixel point in the screenshot, R is a value of a red component of the pixel point, G is a value of a green component of the pixel point, B is a value of a blue component of the pixel point, and Gray is a Gray value of the pixel point.
Then, the first determining unit 502 may replace R, G, and B in RGB (R, G, and B) of the screenshot with Gray to form a new color RGB (Gray ), and replace the original RGB (R, G, and B) with the new color RGB (Gray ) to obtain a grayscale image of the screenshot, and may obtain a grayscale value of each pixel point in the grayscale image. Then, the first determining unit 502 may determine the picture information entropy of the screenshot based on the gray-level value of each pixel point.
In some optional implementations of the present embodiment, the first determining unit 502 may include a first determining module (not shown in the figure) and a second determining module (not shown in the figure). For each gray value in each gray value of each pixel point in the gray picture, the first determining module may count the number of pixel points whose gray values are the gray values in the gray picture, and may determine the ratio of the number of pixel points whose gray values are the gray values to the number of pixel points in the gray picture as the occurrence probability of the gray value; then, based on the probability of occurrence of each gray value, the second determining module may determine the picture information entropy of the screenshot. The second determining module may determine the picture information entropy of the screenshot according to the following formula 1:
Figure BDA0001544231890000131
h is the picture information entropy of the screenshot, i is the ith gray value in the gray image, and piN is the occurrence probability of the ith gray scale value, and n is the number of gray scale values.
It should be noted that the logarithm in formula 1 generally takes a base 2 and the unit is a bit. However, other logarithmic bases can be adopted, and other corresponding units can be adopted, and the conversion between the logarithmic bases and the corresponding units can be realized by using a base conversion formula.
In some optional implementations of the present embodiment, the first determining unit 502 may further include a first selecting module (not shown in the figure) and a second selecting module (not shown in the figure). The first selection module may select a maximum picture information entropy from the picture information entropies of the at least two screenshots, and then may determine a product of the selected picture information entropy and a preset coefficient as a picture information entropy threshold. Here, the above-mentioned preset coefficient is generally a value between 0 and 1. In the loading process of the webpage, the occurrence of the information such as the advertisement popup window may be accompanied, the occurrence of the advertisement popup window may cause the webpage loading page to shake, and the page shaking may cause the content in the webpage with the later interception time to be less than the content in the webpage with the earlier interception time, so that the error caused by the occurrence of the information such as the advertisement popup window to the detected first screen time can be reduced by determining the picture information entropy threshold. The second selection module can select the screenshot with the picture information entropy larger than the picture information entropy threshold and the corresponding interception time earliest from the at least two screenshots as the screenshot when the loading of the first screen content of the webpage is finished.
In some optional implementations of this embodiment, the intercepting unit 501 may include a recording module (not shown in the figure), a determining module (not shown in the figure), and an intercepting module (not shown in the figure). The recording module can intercept the screenshot of the first screen content of the webpage when the first screen content of the requested webpage starts to be loaded, and record the interception time when the first screen content of the requested webpage starts to be loaded as the first interception time; then, the determining module may determine a sum of the first truncation time and a preset time duration as a second truncation time; and finally, the interception module can intercept the screenshot of the webpage in the process of loading the first screen content according to a preset time interval from the second interception time. By using the interception mode, the system overhead of the electronic equipment during screenshot interception can be reduced.
Referring now to FIG. 6, shown is a block diagram of a computer system 600 suitable for use with the electronic device implementing an embodiment of the present invention. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Liquid Crystal Display (LCD) and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the method of the present application when executed by a Central Processing Unit (CPU) 601. It should be noted that the computer readable medium mentioned above in the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present invention may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes an intercepting unit, a first determining unit, a second determining unit, and an output unit. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves. For example, the output unit may also be described as a "unit that determines a difference between a web page load completion time and a web page load start time as a first screen time of a web page, and outputs the first screen time".
As another aspect, the present application also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be present separately and not assembled into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to: in response to receiving a webpage loading request, intercepting at least two screenshots of the requested webpage in the process of loading the first screen content, and recording the intercepting time of each screenshot; determining the picture information entropy of each screenshot, and determining the screenshot when the loading of the first screen content of the webpage is finished from at least two screenshots based on the picture information entropy of each screenshot; determining the interception time of the screenshot when the loading of the first screen content of the webpage is finished as the webpage loading finishing time, and selecting the earliest interception time from the interception times of at least two screenshots as the webpage loading starting time; and determining the difference value of the webpage loading completion time and the webpage loading starting time as the first screen time of the webpage, and outputting the first screen time.
The foregoing description is only exemplary of the preferred embodiments of the invention and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention according to the present invention is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is possible without departing from the scope of the invention as defined by the appended claims. For example, the above features and (but not limited to) features having similar functions disclosed in the present invention are mutually replaced to form the technical solution.

Claims (10)

1. A method for detecting an initial screen time, comprising:
in response to receiving a webpage loading request, intercepting at least two screenshots of the requested webpage in the process of loading the first screen content, and recording the intercepting time of each screenshot;
determining the picture information entropy of each screenshot, selecting the largest picture information entropy from the picture information entropies of the at least two screenshots, and determining the product of the selected picture information entropy and a preset coefficient as a picture information entropy threshold; selecting the screenshot with the picture information entropy larger than the picture information entropy threshold and the corresponding earliest interception time from the at least two screenshots as the screenshot when the loading of the first screen content of the webpage is finished;
determining the interception time of the screenshot when the loading of the first screen content of the webpage is finished as the webpage loading finishing time, and selecting the earliest interception time from the interception times of the at least two screenshots as the webpage loading starting time;
and determining the difference value of the webpage loading completion time and the webpage loading starting time as the first screen time of the webpage, and outputting the first screen time.
2. The method of claim 1, wherein the determining picture information entropy for each screenshot comprises:
aiming at each screenshot, carrying out graying processing on the screenshot to obtain a gray picture, acquiring the gray value of each pixel point in the gray picture, and determining the picture information entropy of the screenshot based on the gray value of each pixel point.
3. The method of claim 2, wherein the determining the picture information entropy of the screenshot based on the gray-level value of each pixel point comprises:
counting the number of pixel points with gray values of the pixel points in the gray picture as gray values according to each gray value in the gray values of the pixel points in the gray picture, and determining the ratio of the number to the number of the pixel points in the gray picture as the occurrence probability of the gray value;
and determining the picture information entropy of the screenshot based on the occurrence probability of each gray value.
4. The method of claim 1, wherein intercepting at least two screenshots of the requested web page during the loading of the first screen content comprises:
intercepting a screenshot of the first screen content of the webpage when the first screen content of the requested webpage starts to be loaded, and recording the intercepting time as first intercepting time;
determining the sum of the first interception time and a preset time length as a second interception time;
and from the second interception time, intercepting the screenshot of the webpage in the process of loading the first screen content according to a preset time interval.
5. An apparatus for detecting an initial screen time, comprising:
the system comprises an intercepting unit, a display unit and a display unit, wherein the intercepting unit is configured to respond to a received webpage loading request, intercept at least two screenshots of a requested webpage in a first screen content loading process, and record intercepting time of each screenshot;
the first determining unit is configured to determine the picture information entropy of each screenshot, select the largest picture information entropy from the picture information entropies of the at least two screenshots, and determine the product of the selected picture information entropy and a preset coefficient as a picture information entropy threshold; selecting the screenshot with the picture information entropy larger than the picture information entropy threshold and the corresponding earliest interception time from the at least two screenshots as the screenshot when the loading of the first screen content of the webpage is finished;
the second determining unit is configured to determine the interception time of the screenshot when the loading of the first screen content of the webpage is completed as the webpage loading completion time, and select the earliest interception time from the interception times of the at least two screenshots as the webpage loading start time;
and the output unit is configured to determine the difference value between the webpage loading completion time and the webpage loading starting time as the first screen time of the webpage and output the first screen time.
6. The apparatus of claim 5, wherein the first determining unit is further configured to:
aiming at each screenshot, carrying out graying processing on the screenshot to obtain a gray picture, acquiring the gray value of each pixel point in the gray picture, and determining the picture information entropy of the screenshot based on the gray value of each pixel point.
7. The apparatus of claim 6, wherein the first determining unit comprises:
the first determining module is configured to count the number of pixel points of which the gray values are the gray values aiming at each gray value of each pixel point in the gray picture, and determine the ratio of the number to the number of the pixel points in the gray picture as the occurrence probability of the gray value;
and the second determination module is configured to determine the picture information entropy of the screenshot based on the occurrence probability of each gray value.
8. The apparatus of claim 5, wherein the truncating unit comprises:
the recording module is configured to intercept a screenshot of the first screen content of the requested webpage when the first screen content of the webpage starts to be loaded, and record interception time as first interception time;
the determining module is configured to determine the sum of the first interception time and a preset time length as a second interception time;
and the intercepting module is configured to intercept the screenshot of the webpage in the first screen content loading process according to a preset time interval from the second intercepting time.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.
10. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 1-4.
CN201810023347.6A 2018-01-10 2018-01-10 Method and device for detecting first screen time Active CN108228463B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810023347.6A CN108228463B (en) 2018-01-10 2018-01-10 Method and device for detecting first screen time

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810023347.6A CN108228463B (en) 2018-01-10 2018-01-10 Method and device for detecting first screen time

Publications (2)

Publication Number Publication Date
CN108228463A CN108228463A (en) 2018-06-29
CN108228463B true CN108228463B (en) 2021-09-21

Family

ID=62641716

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810023347.6A Active CN108228463B (en) 2018-01-10 2018-01-10 Method and device for detecting first screen time

Country Status (1)

Country Link
CN (1) CN108228463B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446095A (en) * 2018-11-07 2019-03-08 北京奇艺世纪科技有限公司 A kind of test method, device and the electronic equipment of page presentation speed
CN111324521B (en) * 2018-12-13 2023-03-28 花瓣云科技有限公司 Graphical interface performance test method and test equipment
CN109710529A (en) * 2018-12-27 2019-05-03 江苏满运软件科技有限公司 Web project operation detection method, device, electronic equipment, storage medium
CN109885492B (en) * 2019-02-13 2022-01-28 福建天晴数码有限公司 Response time testing method and terminal based on image recognition and curve fitting
CN112084444B (en) * 2019-06-12 2023-10-27 腾讯科技(深圳)有限公司 Page loading time detection method, device and computer readable storage medium
CN110781063B (en) * 2019-10-25 2023-12-05 北京博睿宏远数据科技股份有限公司 Method, device, equipment and storage medium for measuring first screen time of web page
CN110825456B (en) * 2019-11-01 2024-01-23 北京博睿宏远数据科技股份有限公司 Loading time calculation method, loading time calculation device, computer equipment and storage medium
CN111026989B (en) * 2019-11-15 2023-06-27 汉海信息技术(上海)有限公司 Page loading time detection method and device and electronic equipment
CN110968508B (en) * 2019-11-21 2021-05-14 腾讯科技(深圳)有限公司 Method, device, terminal and storage medium for determining loading time of applet
CN112507261A (en) * 2020-12-18 2021-03-16 无线生活(杭州)信息科技有限公司 First screen time calculation method and device
CN113780163A (en) * 2021-09-09 2021-12-10 上海浦东发展银行股份有限公司 Page loading time detection method and device, electronic equipment and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103324521A (en) * 2013-06-20 2013-09-25 张家港保税区润桐电子技术研发有限公司 Method for measuring initial screen time of webpage
CN105373617A (en) * 2015-11-27 2016-03-02 中国联合网络通信集团有限公司 Web page first screen determination method and apparatus
CN106911943A (en) * 2017-02-21 2017-06-30 腾讯科技(深圳)有限公司 A kind of video display method and its device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102611823B (en) * 2012-01-13 2014-06-04 百度在线网络技术(北京)有限公司 Method and equipment capable of selecting compression algorithm based on picture content
CN103793426A (en) * 2012-11-01 2014-05-14 腾讯科技(深圳)有限公司 Method and device for keeping web page access records
CN103577547B (en) * 2013-10-12 2017-11-10 优视科技有限公司 Webpage type identification method and device
CN104899336B (en) * 2015-07-01 2018-05-22 北京博睿宏远数据科技股份有限公司 It is a kind of to measure the first method for shielding complete render time of webpage
CN105045620B (en) * 2015-07-07 2019-01-11 深信服网络科技(深圳)有限公司 Measure the method and detection device of webpage head screen load time

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103324521A (en) * 2013-06-20 2013-09-25 张家港保税区润桐电子技术研发有限公司 Method for measuring initial screen time of webpage
CN105373617A (en) * 2015-11-27 2016-03-02 中国联合网络通信集团有限公司 Web page first screen determination method and apparatus
CN106911943A (en) * 2017-02-21 2017-06-30 腾讯科技(深圳)有限公司 A kind of video display method and its device

Also Published As

Publication number Publication date
CN108228463A (en) 2018-06-29

Similar Documents

Publication Publication Date Title
CN108228463B (en) Method and device for detecting first screen time
CN108805091B (en) Method and apparatus for generating a model
CN108197652B (en) Method and apparatus for generating information
CN111125574B (en) Method and device for generating information
US8577827B1 (en) Network page latency reduction using gamma distribution
CN110213614B (en) Method and device for extracting key frame from video file
CN109344752B (en) Method and apparatus for processing mouth image
CN109389072B (en) Data processing method and device
CN109255767B (en) Image processing method and device
US11514263B2 (en) Method and apparatus for processing image
CN109214501B (en) Method and apparatus for identifying information
CN109377508B (en) Image processing method and device
CN109862100B (en) Method and device for pushing information
CN108288064B (en) Method and device for generating pictures
CN116385328A (en) Image data enhancement method and device based on noise addition to image
CN107402878B (en) Test method and device
CN113205189A (en) Prediction model training method, prediction method and prediction device
CN111062914B (en) Method, apparatus, electronic device and computer readable medium for acquiring facial image
CN109522429B (en) Method and apparatus for generating information
CN111367778B (en) Data analysis method and device for evaluating search strategy
CN108921792B (en) Method and device for processing pictures
CN107451860B (en) Information pushing method and device
CN113409199A (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN112308074A (en) Method and device for generating thumbnail
CN109657183B (en) Method and apparatus for processing information

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant