Picture identification method and device, equipment and medium
By identifying the filling rate of online images and containers and generating image quality results, it solves the problem of APP online image quality identification and improves user experience and resource utilization efficiency.
Patent Information
- Application Number
- CN202410747476.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-10-01
AI Technical Summary
Existing technology cannot automatically identify and solve APP online picture quality problems, resulting in reduced user experience and waste of resources.
By determining the online image and image container based on the image setting method of the display interface, performing fill rate identification based on the original size information and view size information, generating image quality results, and realizing automatic identification of image fill rate and image quality assessment.
Quickly identify the picture fill rate, replace appropriate pictures in a timely manner, improve user experience, save resources, and solve the problem in the existing technology of being unable to automatically identify the quality of APP online pictures.
Smart Images

Figure CN118735863A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent analysis technology, and in particular to an image recognition method, device, equipment and medium. Background Art
[0002] In today's digital age, applications (APPs) have been deeply integrated into and changed the way people live and work, and their importance is becoming increasingly prominent. APPs not only provide a variety of tools to help people communicate, entertain, learn and conduct business in a new way, but also improve and optimize services and increase efficiency, making people's lives and work more convenient and efficient.
[0003] When using an app, image quality has a critical impact on the user experience. The difference between high-definition and blurry images often directly determines the user's evaluation of the app and their satisfaction with the app. For example, blurry and distorted images have a serious negative impact on the user experience: on the one hand, low-quality images make it difficult for users to accurately and quickly obtain information in the image, whether it is text, symbols or image details. For applications that rely heavily on image expression, such as online shopping apps or social media apps, blurry image quality may directly lead to a very poor user experience; on the other hand, ultra-high-definition large images displayed in a smaller view will result in serious resource waste. Images with too high image resolution waste bandwidth in network transmission, and there is also a problem of wasting memory and graphics processing unit (GPU) resources when rendering locally. Summary of the invention
[0004] In view of this, the present application provides an image recognition method, device, equipment and medium to quickly identify the quality of online images and solve the problems caused by the inability to recognize online images in the existing related technologies.
[0005] In a first aspect, the present application provides an image recognition method, comprising:
[0006] According to the picture setting method of the display interface, determine the online picture and the picture container corresponding to the online picture, wherein the picture container is a container for displaying the online picture;
[0007] Based on the original size information of the online image, combined with the view size information of the image container, fill rate identification is performed to obtain the image fill rate;
[0008] Based on the picture fill rate, an image quality result corresponding to the online picture is generated.
[0009] Optionally, the display interface includes a picture display interface of an application, and the determining of the online picture and the picture container corresponding to the online picture according to the picture setting method of the display interface includes:
[0010] After the debug mode of the application is started, calling the hook procedure;
[0011] Capturing the picture setting method through the hook program;
[0012] The picture set by the picture setting method is determined as the online picture, and the container in the picture display interface for displaying the online picture is determined as the picture container.
[0013] Optionally, the performing fill rate identification based on the original size information of the online image in combination with the view size information of the image container to obtain the image fill rate includes:
[0014] For each online picture, detecting whether the original size information is the same as the view size information;
[0015] If the original size information is the same as the view size information, determining a preset fill rate threshold as the picture fill rate corresponding to the online picture;
[0016] If the original size information is different from the view size information, the filling rate is calculated based on the image adaptation container mode corresponding to the online image using the image size parameters in the original size information and the container size parameters in the view size information to obtain the image filling rate.
[0017] Optionally, according to the image adaptation container mode corresponding to the online image, the image size parameter in the original size information and the container size parameter in the view size information are used to calculate the fill rate to obtain the image fill rate, including:
[0018] Determine a picture adaptation container mode corresponding to the online picture;
[0019] If the image adaptation container mode is the image non-proportional scaling container filling mode, the image filling rate is calculated using the image size parameter and the container size parameter according to a preset filling rate calculation formula to obtain the image filling rate;
[0020] If the image adaptation container mode is the image proportional scaling to fill the container mode, then based on the image aspect ratio of the online image and the container aspect ratio of the image container, a first calculation parameter is extracted from the image size parameter, and a second calculation parameter is extracted from the container size parameter; the first calculation parameter is divided by the second calculation parameter to obtain the image fill rate.
[0021] Optionally, extracting the first calculation parameter from the image size parameter and extracting the second calculation parameter from the container size parameter according to the image aspect ratio of the online image and the container aspect ratio of the image container includes:
[0022] In the case where the aspect ratio of the image is not equal to the aspect ratio of the container, determining a picture filling method of the picture container;
[0023] Determine the calculation size type based on the picture filling mode and the comparison result between the image aspect ratio and the container aspect ratio;
[0024] A first calculation parameter corresponding to the calculation size type is extracted from the image size parameter, and a second calculation parameter corresponding to the calculation size type is extracted from the container size parameter.
[0025] Optionally, the picture filling mode is divided into a picture content complete filling mode and a picture cropping filling mode, and the calculation size type is determined based on the picture filling mode and in combination with a comparison result between the image aspect ratio and the container aspect ratio, including:
[0026] When the picture filling mode is a picture content complete filling mode and the image aspect ratio is greater than the container aspect ratio, or when the picture filling mode is a picture cropping filling mode and the image aspect ratio is less than the container aspect ratio, the preset first size type is determined as the calculated size type;
[0027] When the picture filling mode is a picture content complete filling mode and the image aspect ratio is smaller than the container aspect ratio, or when the picture filling mode is a picture cropping filling mode and the image aspect ratio is larger than the container aspect ratio, the preset second size type is determined as the calculated size type.
[0028] Optionally, the picture size parameters include a picture width parameter and a picture height parameter, the container size parameters include a container width parameter and a container height parameter, and the extracting the first calculation parameter from the picture size parameters and the extracting the second calculation parameter from the container size parameters according to the image aspect ratio of the online picture and the container aspect ratio of the picture container further includes:
[0029] Detecting whether the aspect ratio of the image is equal to the aspect ratio of the image container;
[0030] If the image aspect ratio is equal to the container aspect ratio, the image width parameter is determined as the first calculation parameter, and the container width parameter is determined as the second calculation parameter; or, the image height parameter is determined as the first calculation parameter, and the container height parameter is determined as the second calculation parameter.
[0031] In a second aspect, the present application provides an image recognition device, comprising:
[0032] A determination module, used to determine an online picture and a picture container corresponding to the online picture according to a picture setting method of a display interface, wherein the picture container is a container for displaying the online picture;
[0033] An identification module, configured to identify the fill rate based on the original size information of the online image and the view size information of the image container to obtain the image fill rate;
[0034] The result generating module is used to generate the image quality result corresponding to the online image based on the image fill rate.
[0035] In a third aspect, the present application provides an electronic device, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0036] Memory, used to store computer programs;
[0037] The processor is used to implement the steps of the image recognition method as described in any one of the above items of the present application when executing the program stored in the memory.
[0038] In a fourth aspect, the present application further provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the steps of the image recognition method as described in any one of the above items of the present application.
[0039] The embodiment of the present application determines the online picture and the picture container corresponding to the online picture according to the picture setting method of the display interface, and identifies the fill rate based on the original size information of the online picture combined with the view size information of the picture container, thereby realizing automatic identification of the picture fill rate, and generating the image quality result corresponding to the online picture based on the identified picture fill rate, which helps to replace the appropriate picture in time and solves the problem caused by the inability to automatically identify the quality of APP online pictures in the existing related technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0042] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0043] Figure 1 A schematic diagram of the steps of a method for image recognition provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of an example provided in the present application in which the image aspect ratio is greater than the container aspect ratio when the image filling mode is a complete filling mode of the image content;
[0045] Figure 3 A schematic diagram of an example provided in the present application in which the image aspect ratio is smaller than the container aspect ratio when the image filling mode is a complete filling mode of the image content;
[0046] Figure 4 A schematic diagram of an example provided in the present application in which the image aspect ratio is greater than the container aspect ratio when the image filling mode is the image cropping filling mode;
[0047] Figure 5 A schematic diagram of an example provided in the present application in which the image aspect ratio is smaller than the container aspect ratio when the image filling mode is the image cropping filling mode;
[0048] Figure 6 A schematic diagram of a step flow of a method for image recognition provided in an optional embodiment of the present application;
[0049] Figure 7 A schematic diagram showing 5 online pictures on an APP page provided as an example of this application;
[0050] Figure 8 A schematic diagram of displaying the image fill rate on an APP page provided as an example of this application;
[0051] Fig. 9 A structural block diagram of an image recognition device provided in an embodiment of the present application;
[0052] Fig.10 A structural schematic diagram of an electronic device is provided for an embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0054] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0055] In the existing related technologies, APPs pay more attention to whether the image is loaded successfully, and rarely pay attention to whether the image and the container are perfectly matched. In order to avoid over-enlarging the image to fill the image container in the APP display interface, and not over-shrinking the image to fit the image container in the display interface, there is an urgent need for an image recognition method to quickly identify the quality of APP online images.
[0056] Based on the above, the present application provides a method, device, equipment and medium for image recognition, which determines the online image and the image container corresponding to the online image according to the image setting method of the display interface, and identifies the fill rate based on the original size information of the online image and the view size information of the image container, thereby realizing automatic recognition of the image fill rate, and generating the image quality result corresponding to the online image based on the image fill rate obtained by recognition, so as to replace the appropriate image in time based on the image quality result in the future, thereby solving the problem caused by the inability to automatically identify the online image quality of APP in the existing related technology.
[0057] Figure 1 The following is a schematic diagram of the steps of a method for image recognition provided in an embodiment of the present application. Figure 1 As shown, the image recognition method provided in the embodiment of the present application may include the following steps:
[0058] Step 110, determining an online picture and a picture container corresponding to the online picture according to a picture setting method of a display interface, wherein the picture container is a container for displaying the online picture;
[0059] The display interface may refer to a displayed user interface, such as an image display interface of an APP, which is a page of the APP, such as Figure 2 As shown, the picture display interface may be an APP page that displays multiple online pictures; the picture setting method may refer to a method related to picture setting, such as a method for setting pictures in a picture container in a page within an APP. In the step, the picture setting method of the display interface may be captured by a hook technology, so that the online pictures to be displayed in the display interface and the container for displaying the online pictures may be determined according to the captured picture setting method, and for each online picture, the container for displaying the online picture may be determined as the picture container corresponding to the online picture.
[0060] Step 120, based on the original size information of the online image and the view size information of the image container, a fill rate is identified to obtain the image fill rate;
[0061] Among them, the original size information of the online image refers to the information of the original size of the online image before scaling, and may specifically include image size parameters for indicating the size of the original image. The image size parameters may include various parameters for indicating the size of the image, such as image width parameter imgWidt and image height parameter imgHeight, etc., which are not limited in this embodiment; the view size information of the image container refers to the information for indicating the display size of the image container, and may specifically include various container size parameters for indicating the size of the image container, such as container width parameter containerWidth and container height parameter containerHeight, etc., which are not limited in this embodiment.
[0062] Specifically, after determining the online pictures and the picture containers corresponding to the online pictures, the embodiment of the present application obtains the original size information of each online picture and the view size information of the picture container corresponding to each online picture, and performs fill rate identification based on the original size information of each online picture combined with the view size information of its corresponding picture container, so that the fill rate of each online picture in the picture container can be automatically identified as the picture fill rate, so that the image quality result can be subsequently generated based on the picture fill rate, that is, step 130 is executed.
[0063] Step 130: Generate an image quality result corresponding to the online image based on the image fill rate.
[0064] Specifically, after determining the image fill rate, the embodiment of the present application can use the image fill rate to generate a corresponding image quality result for each online image, so that the image quality result can be used to assist the staff to quickly identify image quality problems such as whether the online image in the display interface is blurred or whether the resolution is too high, which helps to timely replace the appropriate image for the container in the display interface and improve the user experience.
[0065] It can be seen that the embodiment of the present application determines the online picture and the picture container corresponding to the online picture according to the picture setting method of the display interface, and identifies the fill rate based on the original size information of the online picture combined with the view size information of the picture container, thereby realizing automatic identification of the picture fill rate, and then generates the image quality result corresponding to the online picture based on the picture fill rate, so that the appropriate picture can be replaced in time based on the image quality result later, thereby solving the problem caused by the inability to automatically identify the quality of APP online pictures in the existing related technology.
[0066] In some optional embodiments of the present application, the display interface may be an image display interface of an application. Optionally, in the case where the display interface includes an image display interface of an application, the method for setting an image in an image container in an APP page can be captured globally through the Hook technology as the method for setting an image in the display interface, so that the method for setting an image can be captured through the Hook technology, and the method for setting an image in the display interface can be determined, so that the image fill rate can be displayed based on the image quality results of the online image in the debug mode of the APP, which helps to replace the appropriate image in time.
[0067] Optionally, the embodiment of the present application determines the online image and the image container corresponding to the online image according to the image setting method of the display interface, which may specifically include: after the debugging mode of the application is started, calling a hook program; capturing the image setting method through the hook program; determining the image set by the image setting method as the online image, and determining the container used to display the online image in the image display interface as the image container. Among them, the image container has a one-to-one correspondence with the online image, and each online image can be rendered and displayed through its corresponding image container.
[0068] Specifically, in the process of Hooking the picture setting method, you can use the called hook program to temporarily save the original method of the APP, and then define a new method to take over the program control, so as to customize the implementation steps required for capturing the picture setting method in the new method, and at the same time call back the original method in the new method to ensure that the results before and after are not affected, so as to realize the capture of the picture setting method without affecting the effect of the original method, and then determine the picture set by the captured picture setting method as the online picture, and determine the container used to display the online picture as the picture container corresponding to the online picture.
[0069] It should be noted that the captured image setting method may include various Hook image methods hooked by the hook program, such as: Hook image initialization method of given container size, Hook initialization method of given image resource, Hook animation image initialization method, Hook bitmap image setting method, etc. The embodiment of the present application does not limit this.
[0070] In some optional embodiments of the present application, in order to quickly identify the fill rate of an online image in a picture container, after determining the online image and the picture container corresponding to the online image, the relationship between the image size and the container size can be determined based on the original size information of the online image and the view size information of the picture container, so as to calculate the image fill rate based on different image adaptation container modes based on the relationship between the image size and the container size.
[0071] As an example of this application, in an APP, the relationship between the size of the image and the size of the container is crucial to the presentation of the content. This relationship will directly affect the way the image is displayed and the user's experience. If the size of the image just matches the size of the container, then the image will be fully displayed in the viewport, whether horizontally or vertically, to ensure that the image seen by the user is complete and undistorted, which is extremely important for APPs that need to display important information or clear visual elements. Therefore, when the width and height of the image are exactly the same as the width and height of the container, that is, when the original size information of the online image and the view size information of the image container are the same, the image does not need to be scaled to fill the container, and the image adaptation container mode at this time is the original image size filling mode. Considering that in the original image size filling mode, the online image has not been scaled, and the image clarity is normal, the image fill rate can be directly set to 100% based on the original image size filling mode, that is, the preset fill rate threshold of 100% is used as the image fill rate fillRate corresponding to the online image, and the calculation formula is: fillRate = 100%.
[0072] If the size of the image does not exactly match the size of the container, that is, when the original size information of the online image and the view size information of the image container are different, the image needs to be scaled according to the size of the container, so that the image obtained after scaling is filled into the container as the online image. Therefore, when the original size information of the online image and the view size information of the image container are different, the embodiment of the present application can calculate the filling rate based on the image adaptation container mode corresponding to the online image, using the image size parameters in the original size information and the container size parameters in the view size information, so as to calculate the image filling rate according to different image adaptation container modes, so as to quickly identify the filling rate of the online image in the image container as the image filling rate, and generate the image quality result.
[0073] Optionally, an embodiment of the present application performs fill rate identification based on the original size information of the online image and the view size information of the image container to obtain the image fill rate, which may specifically include: for each online image, detecting whether the original size information is the same as the view size information; if the original size information is the same as the view size information, determining a preset fill rate threshold as the image fill rate corresponding to the online image; if the original size information is different from the view size information, calculating the fill rate based on the image adaptation container mode corresponding to the online image, using the image size parameters in the original size information and the container size parameters in the view size information to obtain the image fill rate.
[0074] In some optional implementations of the present application, the image adaptation container mode can be divided into an image non-proportional scaling filling container mode and an image proportional scaling filling container mode according to the scaling method of the online image; wherein the image non-proportional scaling filling container mode is a mode in which the image non-proportional scaling fills the container; and the image proportional scaling filling container mode is a mode in which the image proportional scaling fills the container. Optionally, an embodiment of the present application calculates the filling rate based on the picture adaptation container mode corresponding to the online picture, using the picture size parameters in the original size information and the container size parameters in the view size information to obtain the picture fill rate, which may specifically include: determining the picture adaptation container mode corresponding to the online picture; if the picture adaptation container mode is a picture non-proportional scaling filling container mode, calculating according to a preset filling rate calculation formula using the picture size parameters and the container size parameters to obtain the picture fill rate; if the picture adaptation container mode is a picture proportional scaling filling container mode, extracting a first calculation parameter from the picture size parameter based on the image aspect ratio of the online picture and the container aspect ratio of the picture container, and extracting a second calculation parameter from the container size parameter, so that the picture fill rate can be obtained by dividing the first calculation parameter by the second calculation parameter.
[0075] Specifically, in the mode of non-proportionally scaling the image to fill the container, the width and height of the online image are stretched or reduced respectively to achieve the same width and height as the container. In this case, the container is completely covered, but the image will be deformed after non-proportionally scaling. Therefore, in the embodiment of the present application, when the image adaptation container mode is the image non-proportional scaling container filling mode, the image size parameters and the container size parameters are used for calculation according to the preset fill rate calculation formula to obtain the image fill rate. For example, when the preset fill rate calculation formula is fillRate=(imgWidth / containerWidth+imgHeight / containerHeight) / 2*100%, the image width parameter imgWidth and the image height parameter imgHeight in the image size parameters and the container width parameter containerWidth and the container height parameter containerHeight in the container size parameters can be used to calculate according to the fill rate calculation formula fillRate=(imgWidth / containerWidth+imgHeight / containerHeight) / 2*100%, thereby calculating the image fill rate fillRate, thereby realizing rapid identification of the fill rate in the image container below the online image.
[0076] When the image adaptation container mode is the image proportional scaling to fill the container mode, the first calculation parameter can be extracted from the image size parameter according to the image aspect ratio of the online image and the container aspect ratio of the image container, and the second calculation parameter can be extracted from the container size parameter, so that the first calculation parameter is divided by the second calculation parameter, and the image fill rate can be calculated based on the quotient of the first calculation parameter divided by the second calculation parameter to obtain the image fill rate corresponding to the online image.
[0077] Furthermore, when scaling an image using the proportional scaling mode, the image is not distorted, and the display effect is more coordinated. In some optional embodiments of the present application, for the image proportional scaling container mode, according to the image filling method of the image container, combined with the image aspect ratio and the container aspect ratio, it can be determined which types of parameters are extracted as parameters for calculating the image filling rate to improve the image filling rate recognition efficiency. Optionally, the embodiment of the present application extracts a first calculation parameter from the image size parameter and a second calculation parameter from the container size parameter based on the image aspect ratio of the online image and the container aspect ratio of the image container. Specifically, it may include: when the image aspect ratio is not equal to the container aspect ratio, determine the image filling method of the image container; based on the image filling method, determine the calculation size type in combination with the comparison result between the image aspect ratio and the container aspect ratio; extract a first calculation parameter corresponding to the calculation size type from the image size parameter, and extract a second calculation parameter corresponding to the calculation size type from the container size parameter.
[0078] For example, in view of the situation where a picture is scaled to fill a container, the picture scaling container filling mode can be divided into a picture scaling container filling mode and a picture scaling content complete display mode, and the picture filling method can be divided into a picture content complete filling method and a picture cropping filling method; among which, the picture content complete filling method refers to a method in which the picture content is completely filled into the picture container, and its corresponding picture scaling container filling mode is the picture scaling content complete display mode; the picture cropping filling method refers to a method in which the picture container is filled by enlarging and cropping the picture, and its corresponding picture scaling container filling mode is the picture scaling container filling mode.
[0079] It should be noted that the image proportional scaling container filling mode refers to the mode in which the container is completely filled after the image is proportionally scaled. In the image proportional scaling container filling mode, the image will be scaled proportionally until the image can be completely filled in the container and the width or height (at least one) of the image is exactly equal to the view width or height of the container. At this time, if the height is equal, the left and right sides of the image will be cropped (cannot be displayed in the container); if the width is equal, the top and bottom of the image will be cropped (cannot be displayed in the container).
[0080] The image proportional scaling and full content display mode refers to a mode in which the image content is fully displayed in the container after the image is proportionally scaled. In the image proportional scaling and full content display mode, the image will be scaled proportionally until the image can be fully displayed within the view size (size) of the container, such as the image after scaling is centered in the horizontal and vertical directions in the container, and the width or height (at least one) of the image is exactly equal to the width or height of the view; if the heights are equal, equal width blank spaces will be left on the left and right sides of the image; if the widths are equal, equal height blank spaces will be left above and below the image; if the widths and heights are equal, the image will just fill the entire container view.
[0081] In some optional embodiments of the present application, the picture filling mode is divided into a picture content complete filling mode and a picture crop filling mode, and the calculated size type can be divided into a first size type and a second size type according to the size type, so as to extract the first calculation parameter and the second calculation parameter according to the calculated size type to calculate the picture filling rate, so as to quickly identify the filling rate of the online picture in the picture container. Optionally, the embodiment of the present application determines the calculated size type based on the picture filling mode and the comparison result between the image aspect ratio and the container aspect ratio, which can specifically include: when the picture filling mode is a picture content complete filling mode and the image aspect ratio is greater than the container aspect ratio, or when the picture filling mode is a picture crop filling mode and the image aspect ratio is less than the container aspect ratio, the preset first size type is determined as the calculated size type; when the picture filling mode is a picture content complete filling mode and the image aspect ratio is less than the container aspect ratio, or when the picture filling mode is a picture crop filling mode and the image aspect ratio is greater than the container aspect ratio, the preset second size type is determined as the calculated size type. The calculated size type may be used to determine which size type's corresponding parameters are extracted as parameters for calculating the image fill rate.
[0082] As an example of the present application, when the preset first size type is the width type and the preset second size type is the height type, when it is detected that the image filling mode is the image content complete filling mode and the image aspect ratio is greater than the container aspect ratio, that is, when the online image is a horizontal image, such as Figure 2As shown, when the image is enlarged or reduced to the same width as the container, the left and right sides of the image match the container, and the top and bottom of the image are left blank with the container. At this time, the image width parameter imgWidth can be extracted from the image size parameter according to the first size type as the first calculation parameter, and the container width parameter containerWidth can be extracted from the container size parameter as the second calculation parameter, and the image width parameter imgWidth is divided by the container width parameter containerWidth to obtain the image fill rate fillRate. For example, the calculation formula of the image fill rate fillRate can be: fillRate = imgWidth / containerWidth*100%; when it is detected that the image filling mode is the image content complete filling mode and the image aspect ratio is less than the container aspect ratio, that is, when the online image is a vertical image, such as Figure 3 As shown, when the image is enlarged or reduced to the same height as the container, the upper and lower parts of the image are consistent with the container, and the left and right parts of the image are left blank. At this time, the image height parameter imgHeight can be extracted from the image size parameter according to the second size type as the first calculation parameter, and the container height parameter containerHeight can be extracted from the container size parameter as the second calculation parameter, so as to obtain the image fill rate fillRate by dividing the image height parameter imgHeight by the container height parameter containerHeight. For example, the calculation formula of the image fill rate fillRate can be set to: fillRate = imgHeight / containerHeight*100%; when it is detected that the image filling mode is the image cropping filling mode and the image aspect ratio is greater than the container aspect ratio, that is, when the online image is a horizontal image, such as Figure 4 As shown, when the picture is enlarged or reduced to the same height as the container, the left and right sides of the picture exceed the container and are cropped. At this time, the picture height parameter imgHeight can be extracted from the picture size parameter according to the second size type as the first calculation parameter, and the container height parameter containerHeight can be extracted from the container size parameter as the second calculation parameter. According to the calculation formula of the picture fill rate fillRate fillRate = imgHeight / containerHeight*100%, the picture height parameter imgHeight is divided by the container height parameter containerHeight to calculate the picture fill rate, thereby obtaining the picture fill rate fillRate; when it is detected that the picture filling mode is the picture cropping filling mode and the image aspect ratio is less than the container aspect ratio, that is, when the online picture is a vertical picture, such as Figure 5As shown, when the image is enlarged or reduced to the same width as the container, the image exceeds the container above and below and is cropped. At this time, the image width parameter imgWidth can be extracted from the image size parameter according to the first size type as the first calculation parameter, and the container width parameter containerWidth can be extracted from the container size parameter as the second calculation parameter. According to the calculation formula of the image fill rate fillRate fillRate = imgWidth / containerWidth*100%, the image width parameter imgWidth is divided by the container width parameter containerWidth to calculate the image fill rate, thereby obtaining the image fill rate fillRate.
[0083] It can be seen that the example of this application can compare the image aspect ratio of the online image with the container aspect ratio of the image container, so as to determine the image filling method of the image container according to the image proportional scaling container filling mode when the image aspect ratio is not equal to the container aspect ratio, so that the calculated size type can be determined based on the image filling method and the comparison result between the image aspect ratio and the container aspect ratio, and then the corresponding first calculation parameter can be extracted from the image size parameter according to the calculated size type, and the second calculation parameter can be extracted from the container size parameter, so as to quickly identify the image fill rate by using the first calculation parameter and the second calculation parameter.
[0084] In addition, when the aspect ratio of the image is equal to the aspect ratio of the container, whether the picture content is completely filled or the picture cropped and filled, when the picture is enlarged or reduced to the same width as the container, the picture fits the container from top to bottom and left to right. At this time, the picture fill rate can be calculated by dividing the picture width parameter imgWidth by the container width parameter containerWidth, or the picture height parameter imgrHeight by the container height parameter containerHeight. The picture fill rates calculated by these two calculation methods are the same. For example, the calculation formula for the picture fill rate fillRate can be set to: fillRate = imgWidth / containerWidth*100%, or to: fillRate = imgHeight / containerHeight*100%.
[0085] In some optional embodiments of the present application, the image size parameter may include an image width parameter and an image height parameter, and the container size parameter includes a container width parameter and a container height parameter. The embodiment of the present application extracts a first calculation parameter from the image size parameter and extracts a second calculation parameter from the container size parameter based on the image aspect ratio of the online image and the container aspect ratio of the image container. The embodiment may also include: detecting whether the image aspect ratio is equal to the container aspect ratio of the image container; if the image aspect ratio is equal to the container aspect ratio, determining the image width parameter as the first calculation parameter and determining the container width parameter as the second calculation parameter; or determining the image height parameter as the first calculation parameter and determining the container height parameter as the second calculation parameter, and then dividing the first calculation parameter by the second calculation parameter to obtain the image fill rate.
[0086] Reference Figure 6 , showing a schematic flow chart of the steps of a picture recognition method provided by an optional embodiment of the present application. The picture recognition method provided by this embodiment may include the following steps:
[0087] Step 601, determining online pictures and picture containers corresponding to the online pictures according to the picture setting method of the display interface;
[0088] Step 602: for each online picture, detecting whether the original size information of the online picture is the same as the view size information of the picture container;
[0089] Step 603: If the original size information is the same as the view size information, a preset fill rate threshold is determined as the picture fill rate corresponding to the online picture;
[0090] Step 604: if the original size information is different from the view size information, determining the image adaptation container mode corresponding to the online image;
[0091] Step 605: If the image adaptation container mode is the image non-proportional scaling container filling mode, the image filling rate is calculated using the image size parameter and the container size parameter according to a preset filling rate calculation formula to obtain the image filling rate;
[0092] Step 606: If the picture adaptation container mode is the picture proportional scaling to fill container mode, then detect whether the image aspect ratio is equal to the container aspect ratio of the picture container;
[0093] Step 607, when the aspect ratio of the image is not equal to the aspect ratio of the container, determining the image filling method of the image container;
[0094] Step 608, based on the picture filling mode and in combination with the comparison result between the image aspect ratio and the container aspect ratio, determine the calculation size type;
[0095] Step 609: extracting a first calculation parameter corresponding to the calculation size type from the image size parameter, and extracting a second calculation parameter corresponding to the calculation size type from the container size parameter.
[0096] Step 610: If the image aspect ratio is equal to the container aspect ratio, the image width parameter is determined as the first calculation parameter, and the container width parameter is determined as the second calculation parameter; or, the image height parameter is determined as the first calculation parameter, and the container height parameter is determined as the second calculation parameter;
[0097] Step 611: Divide the first calculation parameter by the second calculation parameter to obtain the picture fill rate.
[0098] Step 612: Generate an image quality result corresponding to the online image based on the image fill rate.
[0099] It can be seen that the present application is an example of determining online pictures and picture containers corresponding to online pictures according to the picture setting method of the display interface, and for each online picture, detecting whether the original size information of the online picture is the same as the view size information of the picture container, so that when the original size information is the same as the view size information, the preset fill rate threshold is directly determined as the picture fill rate corresponding to the online picture, and when the original size information is different from the view size information, the picture adaptation container mode corresponding to the online picture is determined, so that the picture fill rate can be calculated according to different picture adaptation container modes, so that the picture fill rate can be quickly identified, so as to generate the image quality result corresponding to the online picture based on the picture fill rate, and then the image quality result can be used to assist the staff to quickly identify whether the picture is blurred and distorted after enlargement, and can assist the staff to identify whether the picture is excessively reduced to waste memory and bandwidth, etc. For example, the image quality result corresponding to each online picture can be displayed on the APP page. Taking the five online pictures of "Member", "Children", "Classification", "Listen to Stories" and "Club" displayed on the APP page as an example, Figure 7 As shown, after generating the image quality result corresponding to each online image, the image fill rate corresponding to each online image can be displayed on the APP page based on the image quality result, such as Figure 8As shown, the user can trigger the APP to automatically identify whether the images on the feed or other important pages are blurred or have too high resolutions through one-click operation, and identify the level of the image fill rate. This is convenient, fast, clear and direct, and helps to replace appropriate online images in a timely manner. For example, high-resolution images can be replaced and updated in a timely manner for images with low fill rates, and appropriate images can be replaced in a timely manner for images with high fill rates. This can improve the texture of the APP screen, avoid rendering ultra-large high-definition images into small containers, and prevent waste of resources. For example, the network bandwidth resources required for the APP to download ultra-large high-definition images can be saved, and the memory and GPU resources required for rendering ultra-large high-definition images on the mobile phone can be saved, which solves the problem caused by the inability to automatically identify the quality of APP online images in the existing related technologies.
[0100] It should be noted that, for the purpose of simple description, the method embodiments are expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited to the described order of actions, because according to the embodiments of the present application, certain steps may be performed in other orders or simultaneously.
[0101] like Fig. 9 As shown, an embodiment of the present application also provides an image recognition device, comprising:
[0102] A determination module 910, configured to determine an online picture and a picture container corresponding to the online picture according to a picture setting method of a display interface, wherein the picture container is a container for displaying the online picture;
[0103] An identification module 920 is used to identify the fill rate based on the original size information of the online image and the view size information of the image container to obtain the image fill rate;
[0104] The result generating module 930 is used to generate an image quality result corresponding to the online image based on the image fill rate.
[0105] Optionally, the display interface includes a picture display interface of an application program, and the determination module 910 includes:
[0106] A hook program calling submodule, used to call the hook program after the debugging mode of the application program is started;
[0107] A setting method capturing submodule, used for capturing the picture setting method through the hook program;
[0108] The determination submodule is used to determine the picture set by the picture setting method as the online picture, and determine the container used to display the online picture in the picture display interface as the picture container.
[0109] Optionally, the identification module 920 includes:
[0110] A detection submodule, used for detecting, for each online picture, whether the original size information is the same as the view size information;
[0111] A picture filling rate determination submodule, configured to determine a preset filling rate threshold as a picture filling rate corresponding to the online picture when the original size information is the same as the view size information;
[0112] The fill rate calculation submodule is used to calculate the fill rate according to the picture adaptation container mode corresponding to the online picture, using the picture size parameters in the original size information and the container size parameters in the view size information to obtain the picture fill rate when the original size information is different from the view size information.
[0113] Optionally, the fill rate calculation submodule includes:
[0114] A picture adaptation container mode determining unit, used to determine a picture adaptation container mode corresponding to the online picture;
[0115] A first calculation unit is used to calculate, according to a preset filling rate calculation formula, using the picture size parameter and the container size parameter to obtain the picture filling rate when the picture adaptation container mode is a picture non-proportional scaling filling container mode;
[0116] The second calculation unit is used to extract a first calculation parameter from the picture size parameter and a second calculation parameter from the container size parameter according to the image aspect ratio of the online picture and the container aspect ratio of the picture container when the picture adaptation container mode is the picture geometric scaling to fill container mode; and to obtain the picture fill rate by dividing the first calculation parameter by the second calculation parameter.
[0117] Optionally, extracting the first calculation parameter from the image size parameter and extracting the second calculation parameter from the container size parameter according to the image aspect ratio of the online image and the container aspect ratio of the image container includes:
[0118] In the case where the aspect ratio of the image is not equal to the aspect ratio of the container, determining a picture filling method of the picture container;
[0119] Determine the calculation size type based on the picture filling mode and the comparison result between the image aspect ratio and the container aspect ratio;
[0120] A first calculation parameter corresponding to the calculation size type is extracted from the image size parameter, and a second calculation parameter corresponding to the calculation size type is extracted from the container size parameter.
[0121] Optionally, the picture filling mode is divided into a picture content complete filling mode and a picture cropping filling mode, and the calculation size type is determined based on the picture filling mode and in combination with a comparison result between the image aspect ratio and the container aspect ratio, including:
[0122] When the picture filling mode is a picture content complete filling mode and the image aspect ratio is greater than the container aspect ratio, or when the picture filling mode is a picture cropping filling mode and the image aspect ratio is less than the container aspect ratio, the preset first size type is determined as the calculated size type;
[0123] When the picture filling mode is a picture content complete filling mode and the image aspect ratio is smaller than the container aspect ratio, or when the picture filling mode is a picture cropping filling mode and the image aspect ratio is larger than the container aspect ratio, the preset second size type is determined as the calculated size type.
[0124] Optionally, the picture size parameters include a picture width parameter and a picture height parameter, the container size parameters include a container width parameter and a container height parameter, and the extracting the first calculation parameter from the picture size parameters and the extracting the second calculation parameter from the container size parameters according to the image aspect ratio of the online picture and the container aspect ratio of the picture container further includes:
[0125] Detecting whether the aspect ratio of the image is equal to the aspect ratio of the image container;
[0126] If the image aspect ratio is equal to the container aspect ratio, the image width parameter is determined as the first calculation parameter, and the container width parameter is determined as the second calculation parameter; or, the image height parameter is determined as the first calculation parameter, and the container height parameter is determined as the second calculation parameter.
[0127] In a specific implementation, the above-mentioned image recognition device can be integrated in an electronic device, so that after the electronic device determines the online picture and the picture container corresponding to the online picture according to the picture setting method of the display interface, the electronic device performs fill rate identification based on the original size information of the online picture and the view size information of the picture container, thereby realizing automatic identification of the picture fill rate, and generating the image quality result corresponding to the online picture based on the identified picture fill rate, which helps to replace the appropriate picture in time and solves the problem caused by the inability to automatically identify the quality of APP online pictures in the existing related technology.
[0128] like Fig.10 As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114, and the memory 113 is used to store computer programs; the processor 111 is used to implement the steps of the image recognition method provided in any of the aforementioned method embodiments when executing the program stored in the memory 113.
[0129] In one embodiment of the present application, the processor 111, when used to execute the program stored in the memory 113, implements any one of the aforementioned method embodiments to provide an image recognition method, including: determining an online image and an image container corresponding to the online image according to the image setting method of the display interface, wherein the image container is a container for displaying the online image; based on the original size information of the online image, performing fill rate identification in combination with the view size information of the image container to obtain the image fill rate; based on the image fill rate, generating an image quality result corresponding to the online image.
[0130] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the image recognition method provided in any of the aforementioned method embodiments are implemented.
[0131] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0132] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0133] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0134] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for image recognition, characterized in that: include: According to the picture setting method of the display interface, determine the online picture and the picture container corresponding to the online picture, wherein the picture container is a container for displaying the online picture; Based on the original size information of the online image, combined with the view size information of the image container, fill rate identification is performed to obtain the image fill rate; Based on the picture fill rate, an image quality result corresponding to the online picture is generated.
2. The method according to claim 1, characterized in that The display interface includes a picture display interface of an application program, and the method for setting pictures according to the display interface determines online pictures and picture containers corresponding to the online pictures, including: After the debug mode of the application is started, calling the hook procedure; Capturing the picture setting method through the hook program; The picture set by the picture setting method is determined as the online picture, and the container in the picture display interface for displaying the online picture is determined as the picture container.
3. The method according to claim 1, characterized in that The method of identifying the fill rate based on the original size information of the online image and the view size information of the image container to obtain the image fill rate includes: For each online picture, detecting whether the original size information is the same as the view size information; If the original size information is the same as the view size information, determining a preset fill rate threshold as the picture fill rate corresponding to the online picture; If the original size information is different from the view size information, the filling rate is calculated based on the image adaptation container mode corresponding to the online image using the image size parameters in the original size information and the container size parameters in the view size information to obtain the image filling rate.
4. The method according to claim 3, characterized in that According to the picture adaptation container mode corresponding to the online picture, the picture size parameter in the original size information and the container size parameter in the view size information are used to calculate the fill rate to obtain the picture fill rate, including: Determine a picture adaptation container mode corresponding to the online picture; If the image adaptation container mode is the image non-proportional scaling container filling mode, the image filling rate is calculated using the image size parameter and the container size parameter according to a preset filling rate calculation formula to obtain the image filling rate; If the image adaptation container mode is the image proportional scaling to fill the container mode, then based on the image aspect ratio of the online image and the container aspect ratio of the image container, a first calculation parameter is extracted from the image size parameter, and a second calculation parameter is extracted from the container size parameter; the first calculation parameter is divided by the second calculation parameter to obtain the image fill rate.
5. The method according to claim 4, characterized in that The extracting a first calculation parameter from the image size parameter and extracting a second calculation parameter from the container size parameter according to the image aspect ratio of the online image and the container aspect ratio of the image container includes: In the case where the aspect ratio of the image is not equal to the aspect ratio of the container, determining a picture filling method of the picture container; Determine the calculation size type based on the picture filling mode and the comparison result between the image aspect ratio and the container aspect ratio; A first calculation parameter corresponding to the calculation size type is extracted from the image size parameter, and a second calculation parameter corresponding to the calculation size type is extracted from the container size parameter.
6. The method according to claim 5, characterized in that The picture filling mode is divided into a picture content complete filling mode and a picture cropping filling mode. The calculation size type is determined based on the picture filling mode and in combination with the comparison result between the image aspect ratio and the container aspect ratio, including: When the picture filling mode is a picture content complete filling mode and the image aspect ratio is greater than the container aspect ratio, or when the picture filling mode is a picture cropping filling mode and the image aspect ratio is less than the container aspect ratio, the preset first size type is determined as the calculated size type; When the picture filling mode is a picture content complete filling mode and the image aspect ratio is smaller than the container aspect ratio, or when the picture filling mode is a picture cropping filling mode and the image aspect ratio is larger than the container aspect ratio, the preset second size type is determined as the calculated size type.
7. The method according to claim 5, characterized in that The picture size parameters include a picture width parameter and a picture height parameter, the container size parameters include a container width parameter and a container height parameter, and the extracting of the first calculation parameter from the picture size parameters and the extracting of the second calculation parameter from the container size parameters according to the image aspect ratio of the online picture and the container aspect ratio of the picture container further includes: Detecting whether the aspect ratio of the image is equal to the aspect ratio of the image container; If the image aspect ratio is equal to the container aspect ratio, the image width parameter is determined as the first calculation parameter, and the container width parameter is determined as the second calculation parameter; or, the image height parameter is determined as the first calculation parameter, and the container height parameter is determined as the second calculation parameter.
8. An image recognition device, characterized in that: include: A determination module, used to determine an online picture and a picture container corresponding to the online picture according to a picture setting method of a display interface, wherein the picture container is a container for displaying the online picture; An identification module, configured to identify the fill rate based on the original size information of the online image and the view size information of the image container to obtain the image fill rate; The result generating module is used to generate the image quality result corresponding to the online image based on the image fill rate.
9. An electronic device, characterized in that: include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; The processor is used to implement the steps of the image recognition method as described in any one of claims 1 to 7 when executing the program stored in the memory.
10. A computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions are used to execute the steps of the image recognition method as described in any one of claims 1-7.
