Image analysis method and device

By obtaining and analyzing the management and displaying examples of pictures, calculating and displaying the actual and optimized memory amount of pictures, the problems of rough analysis and poor user experience in the existing technology are solved, and more refined memory analysis and better users are achieved. Experience.

CN112860590BActive Publication Date: 2025-02-21BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911192679.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-28
Publication Date
2025-02-21
Estimated Expiration
2039-11-28

AI Technical Summary

Technical Problem

The existing analysis methods can only determine the actual amount of memory used by the image on application, and cannot determine the amount of memory to be optimized, and users cannot intuitively see which picture the actual amount of usage belongs to, resulting in rough analysis and poor user experience.

Method used

By obtaining image management examples and displaying image instances, calculating the actual memory occupied by the image and the amount of memory to be optimized, and simultaneously displaying this information, as well as the image source, including the page, stack address and name to which the image belongs, to improve analysis the precision and user experience.

Benefits of technology

The fine memory analysis of the pictures is realized, and users can intuitively see the actual occupancy and amount to be optimized for each picture, improving the accuracy of user experience and analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112860590B_ABST
    Figure CN112860590B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for analyzing an image, and relates to the field of computer technology. A specific implementation of the method includes: obtaining information of an image, wherein the information of the image includes an instance of a management image class and an instance of a display image class; calculating the actual amount of memory occupied by the image according to the instance of the management image class, and calculating the amount of memory to be optimized for the image according to the instance of the management image class and the instance of the display image class; displaying the actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image at the same time, and displaying the image using the instance of the management image class and the instance of the display image class. This implementation improves the precision of the analysis and enhances the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a picture analysis method and device. Background Art

[0002] Existing analysis methods can only analyze the amount of memory occupied by various types of data in an application, for example, the amount of memory occupied by image data in an application.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] For each image in the application, the existing analysis method can only determine the actual memory usage of the image in the application, but cannot determine the memory usage to be optimized for the image; and the user cannot intuitively see which image the actual usage belongs to. Therefore, the existing analysis method is relatively rough and cannot meet user needs, resulting in poor user experience. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a method and device for image analysis, which improves the precision of analysis and enhances user experience.

[0006] To achieve the above objective, according to one aspect of an embodiment of the present invention, a picture analysis method is provided.

[0007] An image analysis method according to an embodiment of the present invention includes:

[0008] Obtaining information of a picture, wherein the information of the picture includes an instance of a class for managing pictures and an instance of a class for displaying pictures;

[0009] Calculating the actual amount of memory occupied by the image according to the instance of the image management class, and calculating the amount of memory to be optimized for the image according to the instance of the image management class and the instance of the image display class;

[0010] The actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture are displayed simultaneously, and the picture is displayed using an instance of the picture management class and an instance of the picture display class.

[0011] In one embodiment, the information of the picture also includes the source of the picture;

[0012] Get the information of the image, including:

[0013] If it is detected that the application downloads the picture or the application reads the picture, then the instance of the management picture class and the picture source are collected;

[0014] If it is detected that the display picture class loads the picture, then an instance of the display picture class is collected;

[0015] The instance of the management picture class, the picture source and the instance of the display picture class are matched and stored.

[0016] In one embodiment, the actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image are simultaneously displayed, including:

[0017] The actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image are simultaneously displayed on the analysis interface.

[0018] In one embodiment, the instance of the management picture class is stored in a weak reference manner;

[0019] After the actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture are simultaneously displayed, the method includes:

[0020] Controlling the terminal to which the application belongs not to display the application interface; wherein the application interface includes the picture;

[0021] If the image is displayed on the analysis interface, it is determined that the application memory of the image is not released.

[0022] In one embodiment, the actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image are simultaneously displayed, including:

[0023] Simultaneously displaying the actual amount of memory occupied by the image, the amount of memory to be optimized for the image, the image, and the image source;

[0024] The image source includes at least one of the page to which the image belongs, the stack address of the image, and the name of the image.

[0025] In one embodiment, after acquiring the instance of the management picture class and the picture source, the following steps are included:

[0026] If it is detected that the display picture class cannot load the picture, it is determined that the picture is an unused picture.

[0027] In one embodiment, calculating the actual amount of memory occupied by the image according to the instance of the management image class, and calculating the amount of memory to be optimized for the image according to the instance of the management image class and the instance of the display image class, includes:

[0028] Multiply the image length, the image scaling factor, the image width, the image scaling factor, and the number of bytes occupied per pixel, and obtain the product as the actual memory usage of the image;

[0029] Multiply the image display length, the scaling factor of the image, the image display width, the scaling factor of the image and the number of bytes occupied per pixel, and obtain the product as the minimum memory occupied by the image;

[0030] Subtract the actual memory usage of the image from the minimum memory usage of the image, and use the difference as the memory usage to be optimized for the image;

[0031] The instance of the management picture class includes the picture length, the picture width and the scaling factor of the picture, and the instance of the display picture class includes the picture display length and the picture display width.

[0032] To achieve the above objective, according to another aspect of an embodiment of the present invention, a picture analysis device is provided.

[0033] An image analysis device according to an embodiment of the present invention includes:

[0034] An acquisition unit, used to acquire information of a picture, wherein the information of the picture includes an instance of a class for managing pictures and an instance of a class for displaying pictures;

[0035] A processing unit, configured to calculate the actual amount of memory occupied by the image according to the instance of the image management class, and calculate the amount of memory to be optimized for the image according to the instance of the image management class and the instance of the image display class;

[0036] The analysis unit is used to simultaneously display the actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image, and to display the image using an instance of the management image class and an instance of the display image class.

[0037] In one embodiment, the information of the picture also includes the source of the picture;

[0038] The acquisition unit is used for:

[0039] If it is detected that the application downloads the picture or the application reads the picture, then the instance of the management picture class and the picture source are collected;

[0040] If it is detected that the display picture class loads the picture, then an instance of the display picture class is collected;

[0041] The instance of the management picture class, the picture source and the instance of the display picture class are matched and stored.

[0042] In one embodiment, the analysis unit is used to:

[0043] The actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image are simultaneously displayed on the analysis interface.

[0044] In one embodiment, the instance of the management picture class is stored in a weak reference manner;

[0045] The analysis unit is used for:

[0046] After simultaneously displaying the actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture, controlling the terminal to which the application belongs not to display the application interface; wherein the application interface includes the picture;

[0047] If the image is displayed on the analysis interface, it is determined that the application memory of the image is not released.

[0048] In one embodiment, the analysis unit is used to:

[0049] Simultaneously displaying the actual amount of memory occupied by the image, the amount of memory to be optimized for the image, the image, and the image source;

[0050] The image source includes at least one of the page to which the image belongs, the stack address of the image, and the name of the image.

[0051] In one embodiment, the analysis unit is used to:

[0052] After collecting the instance of the management picture class and the picture source, if it is detected that the display picture class cannot load the picture, it is determined that the picture is an unused picture.

[0053] In one embodiment, the processing unit is configured to:

[0054] Multiply the image length, the image scaling factor, the image width, the image scaling factor, and the number of bytes occupied per pixel, and obtain the product as the actual memory usage of the image;

[0055] Multiply the image display length, the scaling factor of the image, the image display width, the scaling factor of the image and the number of bytes occupied per pixel, and obtain the product as the minimum memory occupied by the image;

[0056] Subtract the actual memory usage of the image from the minimum memory usage of the image, and use the difference as the memory usage to be optimized for the image;

[0057] The instance of the management picture class includes the picture length, the picture width and the scaling factor of the picture, and the instance of the display picture class includes the picture display length and the picture display width.

[0058] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device is provided.

[0059] An electronic device according to an embodiment of the present invention includes: one or more processors; a storage device 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 image analysis method provided by the embodiment of the present invention.

[0060] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer readable medium is provided.

[0061] A computer-readable medium according to an embodiment of the present invention stores a computer program, and when the program is executed by a processor, the image analysis method provided by the embodiment of the present invention is implemented.

[0062] An embodiment of the above invention has the following advantages or beneficial effects: obtaining information of a picture, the information of the picture including an instance of a management picture class and an instance of a display picture class; calculating the amount of memory to be optimized for the picture according to the instance of the management picture class and the instance of the display picture class; and simultaneously displaying the actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture. The amount of memory to be optimized for the picture is determined, the precision of the analysis is improved, and the user is informed of which picture the actual amount of memory occupied and the amount of memory to be optimized belong to by displaying them simultaneously, thereby improving the user experience.

[0063] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0065] Figure 1 is a schematic diagram of the main process of the image analysis method according to an embodiment of the present invention;

[0066] Figure 2 is a schematic diagram of the main process of a picture analysis method according to another embodiment of the present invention;

[0067] Figure 3 This is an application scenario of the image analysis method according to another embodiment of the present invention;

[0068] Figure 4 is a storage example of NSMapTable in a picture analysis method according to another embodiment of the present invention;

[0069] Figure 5 is a display example of an analysis interface in a picture analysis method according to another embodiment of the present invention;

[0070] Figure 6 is a schematic diagram of main units of a picture analysis device according to an embodiment of the present invention;

[0071] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0072] Figure 8 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0073] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0074] It should be pointed out that the embodiments of the present invention and the features in the embodiments may be combined with each other if there is no conflict.

[0075] The existing analysis methods still have the following problems:

[0076] It is not possible to analyze the images that still occupy the application memory when the application interface containing the images is left; nor is it possible to analyze the images that are not used but occupy the application memory.

[0077] In order to solve the problems existing in the prior art, an embodiment of the present invention provides a picture analysis method, such as Figure 1 As shown, the method includes:

[0078] Step S101, obtaining picture information, wherein the picture information includes an instance of a management picture class and an instance of a display picture class.

[0079] In this step, the instance of the image management class refers to an instance object of UIImage (UIImage is a class used to manage images in the IOS operating system).

[0080] Step S102: Calculate the actual amount of memory occupied by the image according to the instance of the image management class, and calculate the amount of memory to be optimized for the image according to the instance of the image management class and the instance of the image display class.

[0081] Step S103: The actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture are displayed simultaneously, and the picture is displayed using an instance of the picture management class and an instance of the picture display class.

[0082] It should be understood that the memory refers to the application memory, and the application memory refers to the terminal memory allocated to the application by the terminal to which the application belongs.

[0083] It should be noted that the specific implementation of this embodiment is described in detail below and will not be repeated here.

[0084] In the embodiment of the present invention, the information of the picture also includes the source of the picture;

[0085] Get the information of the image, including:

[0086] If it is detected that the application downloads the picture or the application reads the picture, then the instance of the management picture class and the picture source are collected;

[0087] If it is detected that the display picture class loads the picture, then an instance of the display picture class is collected;

[0088] The instance of the management picture class, the picture source and the instance of the display picture class are matched and stored.

[0089] In this embodiment, it should be understood that there are many sources of pictures, and the embodiment of the present invention can analyze pictures downloaded from the network and pictures stored locally in the application.

[0090] The instance of the image display class refers to the instance object of UIImageView (UIImageView is a class used to display images in the IOS operating system).

[0091] In this embodiment, instances of the image class and instances of the display image class are collected to determine the actual amount of application memory occupied by the image and the amount of memory to be optimized for the image, thereby improving the precision of the analysis, so that the user can know which image the actual amount of memory occupied and the amount of memory to be optimized belongs to, and the user can have a more comprehensive understanding of the image through the source of the image, further improving the user experience.

[0092] In an embodiment of the present invention, the actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture are simultaneously displayed, including:

[0093] The actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image are simultaneously displayed on the analysis interface.

[0094] It should be noted that for each picture, the analysis interface displays the picture, the actual memory occupied by the picture, and the memory to be optimized for the picture, so that users can know what the pictures that occupy a large amount of application memory look like, which is particularly obvious when there are many pictures in the application.

[0095] In this embodiment, the actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image are simultaneously displayed on the analysis interface, which further improves the precision of the analysis and further enhances the user experience.

[0096] In an embodiment of the present invention, the instance of the management picture class is stored in a weak reference manner;

[0097] After the actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture are simultaneously displayed, the method includes:

[0098] Controlling the terminal to which the application belongs not to display the application interface; wherein the application interface includes the picture;

[0099] If the image is displayed on the analysis interface, it is determined that the application memory of the image is not released.

[0100] In this embodiment, the instance of the management picture class is stored in a weak reference manner, and the terminal to which the application belongs is controlled not to display the application interface; the application interface contains pictures; if the picture is displayed on the analysis interface, it is determined that the application memory of the picture has not been released. In this way, the pictures that still occupy the application memory when the application interface containing the picture is left are analyzed, which further improves the precision of the analysis and further enhances the user experience.

[0101] In an embodiment of the present invention, the actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture are simultaneously displayed, including:

[0102] Simultaneously displaying the actual amount of memory occupied by the image, the amount of memory to be optimized for the image, the image, and the image source;

[0103] The image source includes at least one of the page to which the image belongs, the stack address of the image, and the name of the image.

[0104] In this embodiment, the page to which the image belongs is displayed, and the user can intuitively see which page the image is loaded.

[0105] In this embodiment, the actual memory occupied by the image, the memory to be optimized, the image and the image source are displayed simultaneously; the image source includes at least one of the page to which the image belongs, the stack address of the image and the image name. Thus, the image is displayed more comprehensively, allowing users to have a more comprehensive understanding of the image, further improving the user experience.

[0106] In an embodiment of the present invention, after collecting the instance of the management picture class and the picture source, the following steps are included:

[0107] If it is detected that the display picture class cannot load the picture, it is determined that the picture is an unused picture.

[0108] In this embodiment, it is detected that the display image class cannot load the image, and the image is determined to be an unused image, so that the unused images that occupy the application memory are analyzed, which further improves the precision of the analysis and further enhances the user experience.

[0109] In an embodiment of the present invention, calculating the actual amount of memory occupied by the picture according to the instance of the picture management class, and calculating the amount of memory to be optimized for the picture according to the instance of the picture management class and the instance of the picture display class, includes:

[0110] Multiply the image length, the image scaling factor, the image width, the image scaling factor, and the number of bytes occupied per pixel, and obtain the product as the actual memory usage of the image;

[0111] Multiply the image display length, the scaling factor of the image, the image display width, the scaling factor of the image and the number of bytes occupied per pixel, and obtain the product as the minimum memory occupied by the image;

[0112] Subtract the actual memory usage of the image from the minimum memory usage of the image, and use the difference as the memory usage to be optimized for the image;

[0113] The instance of the management picture class includes the picture length, the picture width and the scaling factor of the picture, and the instance of the display picture class includes the picture display length and the picture display width.

[0114] In this embodiment, the specific implementation is as follows:

[0115] The actual amount of memory occupied by the image = image length × image scaling factor × image width × image scaling factor × number of bytes per pixel;

[0116] The minimum memory usage of an image = image display length × image scaling factor × image display width × image scaling factor × number of bytes per pixel;

[0117] The amount of memory to be optimized for the image = the actual amount of memory occupied by the image - the minimum amount of memory occupied by the image.

[0118] The unit of the image length and image width is pt. The value obtained by multiplying the image length by the image scaling factor is the pixel points in the first direction. The value obtained by multiplying the image width by the image scaling factor is the pixel points in the second direction. The first direction is perpendicular to the second direction.

[0119] The length and width of the image are obtained by using the size attribute in the instance of the image class, the scaling factor of the image is obtained by using the scale attribute in the instance of the image class, and the number of bytes occupied per pixel is obtained by using the API CGImageGetBitsPerPixel provided by the terminal (Apple) to which the application belongs.

[0120] If the amount of memory to be optimized for images is 0, it is determined that the application memory occupied by the images cannot be optimized; if the amount of memory to be optimized for images is a positive number, it is determined that the application memory occupied by the images can be optimized, and the amount of memory to be optimized for images is the application memory space that can be optimized.

[0121] In this embodiment, by managing the image length, image width and scaling factor in the instance of the image class, as well as the image display length and image display width in the instance of the display image class, and the number of bytes occupied per pixel, the actual amount of memory occupied by the image and the amount of memory to be optimized are determined, thereby further improving the precision of the analysis and further enhancing the user experience.

[0122] In order to solve the problems existing in the prior art, another embodiment of the present invention provides a picture analysis method. The embodiment of the present invention can be applied to a first terminal, and the first terminal can be any terminal.

[0123] like Figure 2 As shown, the method includes:

[0124] Step S201: The application downloads the picture through the network, or the application reads the picture from the local computer, and the application allocates application memory for the picture.

[0125] Specifically, the application reads the image from the local computer through the application memory or disk.

[0126] Step S202: Figure 3 As shown, the first terminal detects that an application downloads a picture or reads a picture, and uses existing acquisition technology to collect and manage instances of the picture class, the page to which the picture belongs, the stack address of the picture, and the picture name from the application; and sets the picture tag to S (S means unused or read); the first terminal stores the instance of the picture class, the page to which the picture belongs, the stack address of the picture, the picture name, and the picture tag in a matching manner in NSMapTable; wherein the instance of the picture class is stored in a weak reference manner.

[0127] Specifically, the first terminal detects, using an existing detection method, that an application downloads a picture or an application reads a picture.

[0128] The picture name can also be replaced with a picture uniform resource locator (URL). In addition, when collecting and storing the picture name, the time, local or network, etc. can also be collected and stored.

[0129] Through the stack address of the image, developers can quickly find the code where the image is located.

[0130] It should be understood that storing the instance of the picture management class in a weak reference manner means that as long as objects other than NSMapTable do not point to the instance of the picture management class, the application memory of the picture is released.

[0131] If the instance of the picture management class is stored in a strong reference mode, the application memory of the picture will not be released regardless of whether objects other than NSMapTable point to the instance of the picture management class. The application memory of the picture will be released only when NSMapTable and objects other than NSMapTable do not point to the instance of the picture management class. Therefore, if the instance of the picture management class is stored in a strong reference mode, the effect of the present invention cannot be achieved.

[0132] The object may be an instance of a display picture class, etc.

[0133] Step S203: Figure 4 As shown, the first terminal detects that the display picture class loads a picture, and uses existing collection technology to collect instances of the display picture class from the application; the instance of the display picture class is matched and stored with the instance of the management picture class in the NSMapTable, the page to which the picture belongs, the stack address of the picture, the picture name and the picture tag, and the picture tag is updated to W (W means used).

[0134] Specifically, the first terminal detects that a display picture class loads a picture using an existing detection method.

[0135] It should be understood that displaying the image class loads the image, which means that the image is displayed, that is, the image is used.

[0136] NSMapTable is a key-value pair collection. Specifically, the instance of the image management class can be used as the key, and the instance of the image display class, the page to which the image belongs, the stack address of the image, the image name and the image tag can be used as the value. The key is stored in a weak reference manner. If the key is stored in a strong reference manner, the image will occupy the application memory for a long time, and the effect of the embodiment of the present invention cannot be achieved.

[0137] Step S204: Figure 5 As shown, the first terminal reads the instance of the picture management class, the instance of the picture display class, the page to which the picture belongs, the stack address of the picture, the picture name and the picture tag from NSMapTable; calculates the actual memory occupied by the picture according to the instance of the picture management class, and calculates the memory amount of the picture to be optimized according to the instance of the picture management class and the instance of the picture display class; the first terminal displays the picture, the actual memory occupied by the picture, the memory amount to be optimized, the page to which the picture belongs, the stack address of the picture, the picture name and the picture tag on the analysis interface at the same time; and displays the picture using the instance of the picture management class and the instance of the picture display class.

[0138] Specifically, using the existing technology, the image is displayed by using an instance of the management image class and an instance of the display image class. In addition, the analysis interface is set in the first terminal.

[0139] Perform corresponding processing according to the display of the analysis interface. For example, delete the picture marked as S. For another example, optimize the application memory according to the amount of memory to be optimized for the picture.

[0140] Step S205: manually or automatically controlling the terminal to which the application belongs to not display the application interface containing the image.

[0141] Specifically, the terminal to which the application belongs is controlled to display interfaces other than the application interface containing the picture, for example, display a calendar.

[0142] Automatically controlling a terminal to which an application belongs so as not to display an application interface including a picture includes: sending an instruction to the terminal to which the application belongs, wherein the instruction is used to make the terminal to which the application belongs not to display the application interface including the picture.

[0143] Step S206: If the picture is displayed on the analysis interface, the first terminal determines that the application memory of the picture is not released.

[0144] It should be noted that since the instance of the image management class is stored in a weak reference manner, the display of the image requires the use of the instance of the image management class. Therefore, if the application memory of the image is not released, the first terminal can obtain the instance of the image management class, and the analysis interface will inevitably display the image; if the application memory of the image is released, the first terminal cannot read the instance of the image management class, and the analysis interface will inevitably not display the image. In other words, the analysis interface only displays the images that occupy the application memory.

[0145] It should be understood that if the analysis interface does not display the picture, it is determined that the application memory of the picture is released.

[0146] In addition, the image is displayed on the analysis interface and can be determined by manual observation or by existing detection methods.

[0147] Furthermore, in NSMapTable, pictures marked as S are unused pictures that occupy application memory. This is because when the application downloads the picture or reads the picture locally, application memory is allocated for the picture. In another embodiment, for pictures marked as S in NSMapTable, after verification by R&D personnel, it is finally determined that the picture is unused but occupies application memory. In NSMapTable, pictures marked as W are all used pictures.

[0148] The following is a detailed introduction to the existing analysis methods:

[0149] Instruments is a very powerful performance analysis and debugging tool provided by Apple, which is specially used for offline performance analysis. It consists of multiple small tools, Allocations is one of them, and Allocations can be used to analyze the memory usage of applications.

[0150] Allocations classifies the data in the application that occupies the application memory according to the data type, counts the amount of application memory occupied by each type of data, and generates a list based on the amount of memory occupied. Users can view VM:CG raster data or VM:ImageIO_PNG_Data in the list to see the amount of application memory occupied by image data in the application and the allocation method of application memory (for example, the name of the allocation method).

[0151] In order to solve the problems existing in the prior art, an embodiment of the present invention provides an image analysis device, such as Figure 6 As shown, the device comprises:

[0152] The acquisition unit 601 is used to acquire information of a picture, where the information of the picture includes an instance of a management picture class and an instance of a display picture class.

[0153] The processing unit 602 is used to calculate the actual amount of memory occupied by the image according to the instance of the management image class, and calculate the amount of memory to be optimized for the image according to the instance of the management image class and the instance of the display image class.

[0154] The analyzing unit 603 is used to simultaneously display the actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture, and to display the picture using an instance of the picture management class and an instance of the picture display class.

[0155] In the embodiment of the present invention, the information of the picture also includes the source of the picture;

[0156] The acquisition unit 601 is used for:

[0157] If it is detected that the application downloads the picture or the application reads the picture, then collecting the instance of the management picture class and the source of the picture;

[0158] If it is detected that the display picture class loads the picture, then an instance of the display picture class is collected;

[0159] The instance of the management picture class, the picture source and the instance of the display picture class are matched and stored.

[0160] In this embodiment of the present invention, the analysis unit 603 is used to:

[0161] The actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image are simultaneously displayed on the analysis interface.

[0162] In an embodiment of the present invention, the instance of the management picture class is stored in a weak reference manner;

[0163] The analysis unit 603 is used for:

[0164] After simultaneously displaying the actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture, controlling the terminal to which the application belongs not to display the application interface; wherein the application interface includes the picture;

[0165] If the image is displayed on the analysis interface, it is determined that the application memory of the image is not released.

[0166] In this embodiment of the present invention, the analysis unit 603 is used to:

[0167] Simultaneously displaying the actual amount of memory occupied by the image, the amount of memory to be optimized for the image, the image, and the image source;

[0168] The image source includes at least one of the page to which the image belongs, the stack address of the image, and the name of the image.

[0169] In this embodiment of the present invention, the analysis unit 603 is used to:

[0170] After collecting the instance of the management picture class and the picture source, if it is detected that the display picture class cannot load the picture, it is determined that the picture is an unused picture.

[0171] In this embodiment of the present invention, the processing unit 602 is used to:

[0172] Multiply the image length, the image scaling factor, the image width, the image scaling factor, and the number of bytes occupied per pixel, and obtain the product as the actual memory usage of the image;

[0173] Multiply the image display length, the scaling factor of the image, the image display width, the scaling factor of the image and the number of bytes occupied per pixel, and obtain the product as the minimum memory occupied by the image;

[0174] Subtract the actual memory usage of the image from the minimum memory usage of the image, and use the difference as the memory usage to be optimized for the image;

[0175] The instance of the management picture class includes the picture length, the picture width and the scaling factor of the picture, and the instance of the display picture class includes the picture display length and the picture display width.

[0176] It should be understood that the functions performed by the various components of the image analysis device provided in the embodiment of the present invention have been introduced in detail in the image analysis method of the above embodiment, and will not be repeated here.

[0177] Figure 7 An exemplary system architecture 700 is shown to which the image analysis method or image analysis device according to the embodiment of the present invention can be applied.

[0178] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0179] Users can use terminal devices 701, 702, and 703 to interact with server 705 through network 704 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0180] The terminal devices 701 , 702 , and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0181] The server 705 may be a server that provides various services, such as a backend management server (only for example) that supports shopping websites browsed by users using the terminal devices 701, 702, and 703. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only for example) to the terminal device.

[0182] It should be noted that the image analysis method provided in the embodiment of the present invention is generally executed by a terminal device, and accordingly, the image analysis device is generally arranged in the terminal device.

[0183] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0184] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of a terminal device suitable for implementing an embodiment of the present invention. Figure 8The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0185] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0186] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.

[0187] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.

[0188] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0189] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a unit, a program segment, or a part of a code, and the above-mentioned unit, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0190] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be arranged in a processor, for example, it may be described as: a processor includes an acquisition unit, a processing unit, and an analysis unit. The names of these units do not constitute a limitation on the units themselves in some cases, for example, the acquisition unit may also be described as "acquiring information of a picture, the information of the picture including a unit for managing instances of a picture class and displaying instances of a picture class".

[0191] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining information of a picture, the information of the picture includes an instance of a management picture class and an instance of a display picture class; calculating the actual amount of memory occupied by the picture according to the instance of the management picture class, and calculating the amount of memory to be optimized for the picture according to the instance of the management picture class and the instance of the display picture class; displaying the actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture and the picture at the same time, and displaying the picture using the instance of the management picture class and the instance of the display picture class.

[0192] According to the technical solution of the embodiment of the present invention, the information of the picture is obtained, and the information of the picture includes an instance of the management picture class and an instance of the display picture class; the amount of memory to be optimized of the picture is calculated according to the instance of the management picture class and the instance of the display picture class; the actual amount of memory occupied by the picture, the amount of memory to be optimized of the picture, and the picture are displayed simultaneously. The amount of memory to be optimized of the picture is determined, and the precision of the analysis is improved. By displaying simultaneously, the user knows which picture the actual amount of memory occupied and the amount of memory to be optimized belong to, and the user experience is improved.

[0193] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A picture analysis method, characterized in that: include: Acquire information of a picture, wherein the information of the picture includes an instance of a management picture class, an instance of a display picture class, and a picture source; wherein the acquiring information of the picture includes: if it is detected that an application downloads the picture or the application reads the picture, then collecting the instance of the management picture class and the picture source; if it is detected that a display picture class loads the picture, then collecting the instance of the display picture class; matching and storing the instance of the management picture class, the picture source, and the instance of the display picture class; Calculating the actual amount of memory occupied by the image according to the instance of the image management class, and calculating the amount of memory to be optimized for the image according to the instance of the image management class and the instance of the image display class; The actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture are displayed simultaneously, and the picture is displayed using an instance of the picture management class and an instance of the picture display class.

2. The method according to claim 1, characterized in that The actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image are simultaneously displayed, including: The actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image are simultaneously displayed on the analysis interface.

3. The method according to claim 2, characterized in that The instance of the picture management class is stored in a weak reference manner; After the actual amount of memory occupied by the picture, the amount of memory to be optimized for the picture, and the picture are simultaneously displayed, the method includes: Controlling the terminal to which the application belongs not to display the application interface; wherein the application interface includes the picture; If the image is displayed on the analysis interface, it is determined that the application memory of the image is not released.

4. The method according to claim 1, characterized in that: The actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image are simultaneously displayed, including: Simultaneously displaying the actual amount of memory occupied by the image, the amount of memory to be optimized for the image, the image, and the image source; The image source includes at least one of the page to which the image belongs, the stack address of the image, and the name of the image.

5. The method according to claim 1, characterized in that After acquiring the instance of the management picture class and the picture source, it includes: If it is detected that the display picture class cannot load the picture, it is determined that the picture is an unused picture.

6. The method according to claim 1, characterized in that Calculating the actual amount of memory occupied by the image according to the instance of the image management class, and calculating the amount of memory to be optimized for the image according to the instance of the image management class and the instance of the image display class, including: Multiply the image length, the image scaling factor, the image width, the image scaling factor, and the number of bytes occupied per pixel, and obtain the product as the actual memory usage of the image; Multiply the image display length, the scaling factor of the image, the image display width, the scaling factor of the image and the number of bytes occupied per pixel, and obtain the product as the minimum memory occupied by the image; Subtract the actual memory usage of the image from the minimum memory usage of the image, and use the difference as the memory usage to be optimized for the image; The instance of the management picture class includes the picture length, the picture width and the scaling factor of the picture, and the instance of the display picture class includes the picture display length and the picture display width.

7. A picture analysis device, characterized in that: include: An acquisition unit is used to acquire information of a picture, wherein the information of the picture includes an instance of a management picture class, an instance of a display picture class, and a picture source; wherein the acquisition of the picture information includes: if it is detected that an application downloads the picture or the application reads the picture, then the instance of the management picture class and the picture source are collected; if it is detected that a display picture class loads the picture, then the instance of the display picture class is collected; and the instance of the management picture class, the picture source, and the instance of the display picture class are matched and stored; A processing unit, configured to calculate the actual amount of memory occupied by the image according to the instance of the image management class, and calculate the amount of memory to be optimized for the image according to the instance of the image management class and the instance of the image display class; The analysis unit is used to simultaneously display the actual amount of memory occupied by the image, the amount of memory to be optimized for the image, and the image, and to display the image using an instance of the management image class and an instance of the display image class.

8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • 3D picture display optimization achieving method oriented to mobile intelligent terminal

    CN103677717A

  • Method and device for achieving device safety scanning in browser

    CN103870750A