Picture processing method and device, computer device and storage medium
By intercepting image loading actions in the application and using an image recognition model to identify sensitive elements and aspect ratios, images are automatically processed, solving the problem of low image review efficiency and improving review accuracy and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA PING AN PROPERTY INSURANCE CO LTD
- Filing Date
- 2022-06-23
- Publication Date
- 2026-04-10
AI Technical Summary
Existing image review methods consume a lot of human and material resources, are inefficient, and produce inaccurate review results, leading to inconsistent image display and affecting user experience.
During application operation, the image loading action is intercepted, and a preset image recognition model is used to identify whether the elements contain sensitive elements, and to determine whether the aspect ratio of the image meets the preset threshold. The verification result is generated and the image is automatically processed.
It enables automatic and rapid image verification, saving manpower, improving the processing efficiency and accuracy of image review, and ensuring the standardization of image display and user experience.
Smart Images

Figure CN115202966B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing and application development, and particularly relates to a picture processing method and device, a computer device and a storage medium. BACKGROUND
[0002] Application programs are essential software products in the mobile Internet era, and any application program cannot be separated from picture operation. With demand and function iteration, the content carried by pictures is more and more, and the information delivered is more and more accurate.
[0003] A large number of various pictures often need to be displayed in the interface of the current application program, and these pictures need to be audited before being put online in the application program. However, the current picture auditing method adopts a manual auditing method. Since the number of pictures to be audited is large, such a processing method needs to consume a large amount of human and material resources, and the processing efficiency of picture auditing is low. In addition, the accuracy of the generated picture auditing result is not high, and the auditor is prone to oversight or operation errors, which causes the pictures put online to be inconsistent with the demand prototype, resulting in stretching abnormalities of the pictures displayed in the user end application program, so that the real picture information cannot be delivered, affecting the user experience. SUMMARY
[0004] The purpose of the embodiments of the present application is to provide a picture processing method, device, computer device and storage medium to solve the problem that the current picture auditing method needs to consume a large amount of human and material resources, the processing efficiency of picture auditing is low, and the accuracy of the generated picture auditing result is not high.
[0005] To solve the above technical problems, the embodiments of the present application provide a picture processing method, which adopts the technical scheme as follows:
[0006] In the running process of the application program, if a loading action of a target picture is listened to, the loading action is intercepted, and picture information of the target picture and an element of the target picture are obtained; wherein the picture information includes a width of the target picture and a height of the target picture;
[0007] It is identified based on a preset picture recognition model whether the element contains a sensitive element;
[0008] If the sensitive element is not contained, it is judged whether the width is less than a preset width threshold and whether the height is less than a preset height threshold;
[0009] If the width is less than the preset width threshold and the height is less than the preset height threshold, a width-height ratio of the target picture is generated based on the width and the height;
[0010] Compare the aspect ratio with a preset ratio value to generate a verification result corresponding to the target picture;
[0011] Perform corresponding processing on the target picture based on the verification result.
[0012] Further, the steps of intercepting the loading action and obtaining picture information of the target picture and elements of the target picture specifically include:
[0013] Intercept the loading action based on a hook mechanism;
[0014] Obtain resource file information of the target picture;
[0015] Obtain picture information of the target picture from the resource file information, and extract elements in the target picture.
[0016] Further, the step of identifying whether the elements contain sensitive elements based on a preset picture recognition model specifically includes:
[0017] Input the target picture into the picture recognition model, and identify category information of the elements contained in the picture through the picture recognition model;
[0018] Receive the category information output by the picture recognition model;
[0019] Identify whether the elements are sensitive elements based on the category information.
[0020] Further, the step of comparing the aspect ratio with a preset ratio value to generate a verification result corresponding to the target picture specifically includes:
[0021] Compare the aspect ratio with the preset ratio value to obtain a comparison result;
[0022] Determine whether the comparison result is that the aspect ratio is equal to the preset ratio value;
[0023] If yes, generate a first verification result that the target picture passes the verification;
[0024] If no, generate a second verification result that the target picture fails the verification.
[0025] Further, the verification result includes that the target picture passes the verification or the target picture fails the verification, and after the step of comparing the aspect ratio with a preset ratio value to generate a verification result corresponding to the target picture, the method further includes:
[0026] If the verification result is that the target picture fails the verification, obtain identification information of the target picture;
[0027] generating a target abnormal data record corresponding to the target picture based on the identification information;
[0028] storing the target abnormal data record in a preset abnormal data record table.
[0029] Further, after the step of storing the target abnormal data record in the preset abnormal data record table, the method further comprises:
[0030] counting a number of all abnormal data records contained in the abnormal data record table;
[0031] determining whether the number is greater than a preset number threshold;
[0032] if yes, generating early warning information corresponding to all the abnormal data records;
[0033] obtaining a communication address of a target user;
[0034] sending the early warning information to the communication address.
[0035] Further, the verification result includes that the target picture passes the verification or the target picture fails the verification, and the step of performing corresponding processing on the target picture based on the verification result specifically comprises:
[0036] if the verification result is that the target picture passes the verification, directly displaying the target picture;
[0037] if the verification result is that the target picture fails the verification, adjusting the size of the target picture based on the preset ratio to obtain a processed specified picture;
[0038] displaying the specified picture.
[0039] To solve the above technical problems, the embodiment of the present application further provides a picture processing device, which adopts the technical scheme as follows:
[0040] A first processing module is configured to, during the running of an application, if a loading action of a target picture is listened to, intercept the loading action, and obtain picture information of the target picture and an element of the target picture, wherein the picture information includes a width of the target picture and a height of the target picture.
[0041] A recognition module is configured to recognize whether the element contains a sensitive element based on a preset picture recognition model.
[0042] A first judgment module is configured to, if the element does not contain a sensitive element, judge whether the width is less than a preset width threshold and whether the height is less than a preset height threshold.
[0043] The first generating module is configured to generate an aspect ratio of the target picture based on the width and the height if the width is less than a preset width threshold and the height is less than a preset height threshold.
[0044] The second generating module is configured to compare the aspect ratio with a preset ratio value to generate a verification result corresponding to the target picture.
[0045] The second processing module is configured to perform corresponding processing on the target picture based on the verification result.
[0046] To solve the above technical problems, the embodiments of the present application further provide a computer device, which adopts the technical scheme as follows:
[0047] In the running process of the application program, if a loading action of a target picture is listened to, the loading action is intercepted, and picture information of the target picture and an element of the target picture are acquired; wherein the picture information comprises a width of the target picture and a height of the target picture.
[0048] It is identified whether the element contains a sensitive element based on a preset picture recognition model.
[0049] If the element does not contain a sensitive element, it is determined whether the width is less than a preset width threshold and whether the height is less than a preset height threshold.
[0050] If the width is less than the preset width threshold and the height is less than the preset height threshold, an aspect ratio of the target picture is generated based on the width and the height.
[0051] The aspect ratio is compared with a preset ratio value to generate a verification result corresponding to the target picture.
[0052] The target picture is processed based on the verification result.
[0053] To solve the above technical problems, the embodiments of the present application further provide a computer readable storage medium, which adopts the technical scheme as follows:
[0054] In the running process of the application program, if a loading action of a target picture is listened to, the loading action is intercepted, and picture information of the target picture and an element of the target picture are acquired; wherein the picture information comprises a width of the target picture and a height of the target picture.
[0055] It is identified whether the element contains a sensitive element based on a preset picture recognition model.
[0056] if the sensitive element is not included, judging whether the width is less than a preset width threshold and whether the height is less than a preset height threshold;
[0057] if the width is less than the preset width threshold and the height is less than the preset height threshold, generating an aspect ratio of the target picture based on the width and the height;
[0058] comparing the aspect ratio with a preset ratio value to generate a verification result corresponding to the target picture;
[0059] performing corresponding processing on the target picture based on the verification result.
[0060] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0061] In the running process of the application program, when the loading action of the target picture is listened to, the loading action is first intercepted, and the picture information of the target picture and the elements of the target picture are obtained. Then, whether the elements contain sensitive elements is identified based on the preset picture recognition model. If the sensitive elements are not included, whether the width is less than a preset width threshold and whether the height is less than a preset height threshold are judged. If the width is less than the preset width threshold and the height is less than the preset height threshold, an aspect ratio of the target picture is generated based on the width and the height. Then, the aspect ratio is compared with a preset ratio value to generate a verification result corresponding to the target picture. Finally, corresponding processing is performed on the picture based on the verification result. Through the present application, the target picture to be displayed in the application program can be automatically and quickly checked and processed, and the verification result of the target picture can be accurately generated. Then, the target picture can be processed according to the verification result, which effectively avoids the processing work of manual picture review, saves human resources for picture review processing, improves the processing efficiency of picture review, ensures the accuracy of subsequent picture display, and improves the user experience. BRIEF DESCRIPTION OF DRAWINGS
[0062] In order to more clearly illustrate the schemes in the present application, the drawings needed in the description of the embodiments of the present application will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0063] Figure 1 is an exemplary system architecture diagram to which the present application can be applied;
[0064] Figure 2 a flowchart of one embodiment of the picture processing method according to the present application;
[0065] Figure 3is a structural schematic diagram of one embodiment of the picture processing apparatus according to the present application;
[0066] Figure 4 is a structural schematic diagram of one embodiment of the computer device according to the present application. DETAILED DESCRIPTION
[0067] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting of the application; the use herein of terms such as "comprise" and "have" and any variations such as "comprises" and "has" is intended to cover the presence of successively stated integers or features but not preclude the presence of other integers or features; the use herein of terms such as "first", "second" and the like is intended to distinguish between different objects, not to describe a particular order.
[0068] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase that in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of other embodiments. It is expressly understood that the embodiments described herein are merely examples from a
[0069] In order to make the technical personnel in the art better understand the scheme of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings.
[0070] As shown in Figure 1 The system architecture 100 can include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a communication link medium between the terminal devices 101, 102, 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0071] A user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0072] The terminal devices 101, 102, and 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 (Moving Picture Experts Group Audio Layer III) players, MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, and the like.
[0073] The server 105 can be a server providing various services, such as a background server providing support for a page displayed on the terminal devices 101, 102, and 103.
[0074] It should be noted that the picture processing method provided in the embodiments of the present application is generally executed by a server / terminal device, and accordingly, the picture processing apparatus is generally arranged in a server / terminal device.
[0075] It should be understood that Figure 1 The number of terminal devices, networks, and servers in
[0076] With reference to Figure 2 , a flowchart of one embodiment of the picture processing method according to the present application is shown. The picture processing method includes the following steps:
[0077] In step S201, during the running of an application, if a loading action of a target picture is listened to, the loading action is intercepted, and picture information of the target picture and elements of the target picture are obtained. The picture information includes a width of the target picture and a height of the target picture.
[0078] In the present embodiment, the picture processing method is run on an electronic device (such as the server / terminal device shown in Figure 1 It should be noted that the wireless connection mode can include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other now known or future developed wireless connection modes.
[0079] In the embodiment, the target picture can be read through a program interface dedicated in the application program, and displayed to the user according to actual business requirements in the application program. In addition, the loading action can be intercepted by using a hook mechanism, and the processing flow of obtaining the picture information of the target picture and the elements of the target picture is performed.
[0080] In step S202, whether the element contains a sensitive element is identified based on a preset picture recognition model.
[0081] In the embodiment, the target picture can be input into the picture recognition model, the category information of the element contained in the picture is identified by the picture recognition model, and then whether the element contained in the target picture is a sensitive element is identified based on the obtained category information. In addition, the sensitive element can be an element with adverse effects. By ensuring that the target picture to be displayed does not contain a sensitive element, it can be ensured that the display of a picture with negative effects can be effectively avoided when the target picture is displayed subsequently, so as to improve the standardization of the target picture display and ensure the user experience.
[0082] In step S203, if the element does not contain a sensitive element, whether the width is less than a preset width threshold and whether the height is less than a preset height threshold are determined.
[0083] In the embodiment, the preset width threshold and the preset height threshold are set in advance according to the interface size of the application program. Preferably, the preset width threshold is equal to the width of the interface of the application program, and the preset height threshold is equal to the height of the interface of the application program. By ensuring that the width of the target picture to be displayed is less than the preset width threshold and the height is less than the preset height threshold, it can be ensured that the target picture does not exceed the field of view when the target picture is displayed subsequently, so as to improve the intelligence of the target picture display and ensure the user experience.
[0084] In step S204, if the width is less than the preset width threshold and the height is less than the preset height threshold, the aspect ratio of the target picture is generated based on the width and the height.
[0085] In the embodiment, the aspect ratio of the target picture refers to the ratio between the width of the target picture and the height of the target picture.
[0086] In step S205, the aspect ratio is compared with a preset ratio, and a verification result corresponding to the target picture is generated.
[0087] In the embodiment, the preset ratio is a preset aspect ratio of the view control to be rendered in the application. The comparison of the aspect ratio of the target picture with the preset ratio means whether the aspect ratio of the target picture is same as the preset ratio. The verification result includes that the target picture passes the verification or the target picture fails the verification. If the aspect ratio of the target picture is equal to the preset ratio, a verification result that the target picture passes the verification is generated, and if the aspect ratio of the target picture is not equal to the preset ratio, a verification result that the target picture fails the verification is generated.
[0088] In step S206, corresponding processing is performed on the target picture based on the verification result.
[0089] In the embodiment, the corresponding processing performed on the picture based on the verification result can include: if the verification result is that the target picture passes the verification, the target picture is directly displayed; and if the verification result is that the target picture fails the verification, the size of the target picture is adjusted based on the preset ratio to obtain a processed specified picture, and the specified picture is displayed.
[0090] In the application, when the loading action of the target picture is detected during the running of the application, the loading action is first intercepted, and the picture information of the target picture and the element of the target picture are obtained. Then, whether the element contains a sensitive element is identified based on a preset picture recognition model. If the element does not contain a sensitive element, whether the width is less than a preset width threshold and whether the height is less than a preset height threshold are determined. If the width is less than the preset width threshold and the height is less than the preset height threshold, the aspect ratio of the target picture is generated based on the width and the height. Then, the aspect ratio is compared with a preset ratio to generate a verification result corresponding to the target picture. Finally, corresponding processing is performed on the picture based on the verification result. Through the application, the target picture to be displayed in the application can be automatically and quickly verified and processed, and the verification result of the target picture can be accurately generated. Then, the target picture can be processed according to the verification result, the manual picture auditing processing work is effectively avoided, the human resources for picture auditing processing are saved, the picture auditing processing efficiency is improved, the accuracy of subsequent picture display is ensured, and the user experience is improved.
[0091] In some optional implementations, step S201 includes the following steps:
[0092] The loading action is intercepted based on a hook mechanism.
[0093] In the embodiment, the hook mechanism can also be referred to as Hook, which can intercept and monitor the transmission of events in the process of event transmission, and integrate its own code with system methods. In this way, when these system methods are called, the code is executed to implement the corresponding picture processing method. In addition, the loading action can include at least one of opening open, reading read, and memory mapping mmap (memory-mapped). Mmap maps a file or other object into memory, and when the file is mapped to the process, the virtual address can be directly operated to perform file read / write operations. Specifically, in the loading process of the resource file of the target picture by the application program, the open, read, mmap, etc. methods in the libc.so library need to be called, and by performing Hook operation on these loading methods, the open, read, mmap, etc. loading actions of the resource file are listened to. When the system calls open, read, mmap to load or read the resource file of the target picture, the loading actions are captured, so as to intercept the loading actions, and then start to execute the corresponding processing flow of the target picture.
[0094] Obtaining resource file information of the target picture.
[0095] In the embodiment, the resource file information of the target picture at least includes picture information of the target picture.
[0096] Obtaining picture information of the target picture from the resource file information, and extracting elements in the target picture.
[0097] In the embodiment, the picture information can include the width and height of the target picture. In addition, before extracting the elements in the target picture, the target picture can also be preprocessed, and the preprocessing can include grayscale, binarization, denoising, tilt correction, etc.
[0098] The present application effectively avoids the case that the target picture is directly displayed in the application program by intercepting the loading action of the target picture based on the hook mechanism to enter the verification processing flow of the target picture, and then performing corresponding processing on the target picture based on the generated verification result, so as to ensure that the application program can read the picture conforming to the specification and display it, effectively improving the accuracy and intelligence of picture display.
[0099] In some optional implementation manners of the embodiment, step S202 includes the following steps:
[0100] Inputting the target picture into the picture recognition model, and identifying the category information of the elements contained in the picture by the picture recognition model.
[0101] In the embodiment, the picture recognition model can be generated based on pre-collected training picture samples of various elements and category labeling processing by using the YOLO algorithm. Specifically, the categories of all training picture samples can be labeled, and the categories can include "sensitive label 1", "sensitive label 2", "sensitive label 3", "sensitive label 4", "sensitive label 5", and "other". Each category of training picture includes a specified number of pictures. The specified number is not limited, and can be set according to actual needs, for example, 800.
[0102] The category information output by the picture recognition model is received.
[0103] In the embodiment, after the target picture is input into the picture recognition model, the target picture is divided into grids by the YOLO algorithm, and the category probability and the bounding box of each grid are predicted. For example, the target picture is a 200x200 image, and the target picture is divided into 8x8 grids. For each grid, the network predicts a bounding box corresponding to each element ("sensitive label 1", "sensitive label 2", "sensitive label 3", "sensitive label 4", "sensitive label 5", and "other") and the probability of the element. Then, the category information corresponding to the target picture is determined according to the obtained probability.
[0104] Based on the category information, it is determined whether the element is a sensitive element.
[0105] In the embodiment, if the category information output by the picture recognition model is any one of the above "sensitive label 1", "sensitive label 2", "sensitive label 3", "sensitive label 4", and "sensitive label 5", the element in the target picture is identified as a sensitive element. If the category information output by the picture recognition model is "other", it is determined that the element in the target picture is not a sensitive element. Further, if it is determined that the target picture is a sensitive picture, the target picture is directly restricted to be displayed in the application.
[0106] The present application identifies sensitive elements in the target picture. Only when it is determined that the target picture does not belong to a sensitive picture, i.e., the target picture does not contain sensitive elements, the subsequent picture verification processing is performed, which effectively improves the standardization of picture display. Further, if it is determined that the target picture belongs to a sensitive picture, the target picture is directly restricted to be displayed in the application, so that subsequent picture processing operations are not required, thereby effectively reducing the data processing amount and improving the intelligence of picture processing.
[0107] In some optional implementation, the step S205 comprises the following steps:
[0108] The comparison result is obtained by comparing the aspect ratio with the preset ratio.
[0109] In the embodiment, the preset ratio is the aspect ratio of the view control to be rendered which is preset in the application. The comparison of the aspect ratio with the preset ratio means whether the aspect ratio of the target picture is same as the preset ratio.
[0110] It is judged whether the comparison result is that the aspect ratio is equal to the preset ratio.
[0111] In the embodiment, the comparison result comprises that the aspect ratio is equal to the preset ratio or the aspect ratio is not equal to the preset ratio.
[0112] If yes, a first verification result that the target picture passes the verification is generated.
[0113] In the embodiment, if the comparison result is that the aspect ratio is equal to the preset ratio, it means that the aspect ratio of the target picture to be loaded is same as the aspect ratio of the view control to be rendered which is preset in the application. Loading the target picture will show a normal rendering result, which meets the specification of the application to display the picture, so it is determined that the target picture passes the verification, and the first verification result that the target picture passes the verification is generated.
[0114] If no, a second verification result that the target picture fails the verification is generated.
[0115] In the embodiment, if the comparison result is that the aspect ratio is not equal to the preset ratio, it means that the aspect ratio of the target picture to be loaded is not same as the aspect ratio of the view control to be rendered which is preset in the application. Loading the target picture will show an abnormal rendering result, such as stretching of the target picture, which does not meet the specification of the application to display the picture, so it is determined that the target picture fails the verification, and the second verification result that the target picture fails the verification is generated.
[0116] The application compares the aspect ratio of the target picture with the preset ratio to obtain a comparison result. If the comparison result is that the aspect ratio is equal to the preset ratio, the first verification information that the target picture passes the verification is generated, otherwise the second verification information that the target picture fails the verification is generated. After the verification information of the target picture is generated, the target picture can be processed according to the verification information, which effectively improves the intelligence and specification of the picture processing.
[0117] In some optional implementation, the verification result includes that the target picture passes the verification or the target picture fails the verification, and step S205 includes the following steps:
[0118] If the verification result is that the target picture fails the verification, obtaining identification information of the target picture.
[0119] In this embodiment, the identifier of the target picture can be queried from the resource file of the target picture, and the identifier is taken as the identification information of the target picture.
[0120] Generating target abnormal data record corresponding to the target picture based on the identification information.
[0121] In this embodiment, the identification information can be input into a pre-created abnormal data record template, so that the target abnormal data record corresponding to the target picture can be generated. In addition, the abnormal data record template can be generated according to actual use requirements.
[0122] Storing the target abnormal data record in a preset abnormal data record table.
[0123] In this embodiment, the abnormal data record table is a data table pre-created for recording pictures that appear abnormal, for example, size data does not conform to the specification.
[0124] When the verification result is that the target picture fails the verification, the application further generates the abnormal data record of the target picture and stores it in the abnormal data record table, which is beneficial to subsequently sending the abnormal data record in the abnormal data record table to the related administrator, so that the administrator can clearly understand the abnormal picture that fails the verification based on the received abnormal data record, and can take corresponding processing measures on the abnormal picture, effectively improving the use experience of the administrator.
[0125] In some optional implementation of this embodiment, after the step of storing the target abnormal data record in the preset abnormal data record table, the electronic device can further perform the following steps:
[0126] Counting the number of all abnormal data records contained in the abnormal data record table.
[0127] In this embodiment, each abnormal data record stored in the abnormal data record table is provided with a corresponding serial number, and by counting the number of all serial numbers in the abnormal data record table, the number of all abnormal data records contained in the abnormal data record table can be obtained.
[0128] Determining whether the number is greater than a preset number threshold.
[0129] In the embodiment, the preset quantity threshold is not specifically limited, and can be set according to actual use requirements, for example, can be set to 8.
[0130] If yes, generating early warning information corresponding to all the abnormal data records.
[0131] In the embodiment, the abnormal data record can be input into a pre-created early warning information template, so that early warning information corresponding to the abnormal data record can be generated. In addition, the early warning information template can be generated according to actual use requirements.
[0132] Obtaining a communication address of a target user.
[0133] In the embodiment, the target user can be a manager related to the interface operation of the application program. In addition, the communication address can be a mail address.
[0134] Sending the early warning information to the communication address.
[0135] In the embodiment, if the communication address is a mail address, the early warning information can be sent to the communication address of the target user by logging in a mail server and based on the mail server.
[0136] The application can avoid executing the operation of sending the early warning information corresponding to the abnormal data record to the target user every time the abnormal data record appears, and can reduce the data processing amount, effectively improve the intelligence of the early warning information sending, and improve the use experience of the target user.
[0137] In some optional implementation manners of the embodiment, the verification result includes that the target picture passes the verification or the target picture fails the verification, and step S206 includes the following steps:
[0138] If the verification result is that the target picture passes the verification, the target picture is directly displayed.
[0139] In the embodiment, if the verification result is that the target picture passes the verification, it indicates that the target picture to be displayed is a picture that meets the verification specification, that is, the target picture is a picture that will not appear when displayed, and the target picture can be directly displayed subsequently.
[0140] If the verification result is that the target picture fails the verification, the size of the target picture is adjusted based on the preset ratio to obtain a processed specified picture.
[0141] In this embodiment, the size of the target picture is adjusted based on the preset ratio, that is, the aspect ratio of the target picture is equal to the preset ratio. Specifically, the width of the target picture can be kept unchanged, and the height of the target picture is adjusted so that the aspect ratio of the target picture is equal to the preset ratio. Alternatively, the height of the target picture can be kept unchanged, and the width of the target picture is adjusted so that the aspect ratio of the target picture is equal to the preset ratio. Alternatively, the width and the height of the target picture can be adjusted at the same time, as long as the aspect ratio of the target picture is equal to the preset ratio.
[0142] The specified picture is displayed.
[0143] In this embodiment, the display of the specified picture can be ensured not to be stretched, and the standardization of the display of the specified picture is ensured.
[0144] The present application directly displays the target picture only after the target picture is verified. If the target picture fails to pass the verification, the size of the target picture is adjusted based on the preset ratio, and then the specified picture obtained after the adjustment is displayed. The picture displayed in the application is a standard picture, the accuracy and standardization of the picture display are improved, the display abnormality of the picture to be displayed is effectively avoided, and the user experience is improved.
[0145] It should be emphasized that, in order to further ensure the privacy and security of the above verification result, the above verification result can also be stored in a node of a block chain.
[0146] The block chain referred to in the present application is a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm and other computer technologies. The block chain is essentially a decentralized database, which is a series of data blocks associated using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity (anti-fake) of the information and generate the next block. The block chain can include a block chain underlying platform, a platform product service layer, and an application service layer.
[0147] The embodiments of the present application can acquire and process related data based on artificial intelligence technology. Artificial intelligence (AI) is the use of digital computers or computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0148] The artificial intelligence basic technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. The artificial intelligence software technology mainly includes computer vision technology, robot technology, biometric identification technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.
[0149] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by computer readable instructions instructing related hardware, and the computer readable instructions can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiment methods. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a non-volatile storage medium, or a random access memory (RAM).
[0150] It should be understood that, although each step in the flowchart of the accompanying drawings is displayed in sequence according to the direction of the arrow, these steps are not necessarily executed in sequence according to the direction of the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and they can be executed in other orders. Moreover, at least part of the steps in the flowchart of the accompanying drawings can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence is not necessarily sequential, but can be executed alternately or alternately with at least part of other steps or sub-steps or stages of other steps.
[0151] Further referring to Figure 3 , as an implementation of the method shown in the above Figure 2 , the present application provides an embodiment of a picture processing device, which corresponds to the method embodiment shown in Figure 2 , and the device can be applied to various electronic devices.
[0152] As shown in Figure 3 , the picture processing device 300 described in the embodiment includes a first processing module 301, an identification module 302, a first judgment module 303, a first generation module 304, a second generation module 305, and a second processing module 306. Among them:
[0153] The first processing module 301 is configured to, during the running of an application, if a loading action of a target picture is listened to, intercept the loading action, and obtain picture information of the target picture and elements of the target picture; wherein the picture information includes the width of the target picture and the height of the target picture.
[0154] an identifying module 302, configured to identify whether the element contains a sensitive element based on a preset picture identifying model;
[0155] a first judging module 303, configured to, if the element does not contain a sensitive element, judge whether the width is less than a preset width threshold and whether the height is less than a preset height threshold;
[0156] a first generating module 304, configured to, if the width is less than the preset width threshold and the height is less than the preset height threshold, generate an aspect ratio of the target picture based on the width and the height;
[0157] a second generating module 305, configured to compare the aspect ratio with a preset ratio value, and generate a verification result corresponding to the target picture;
[0158] a second processing module 306, configured to perform corresponding processing on the target picture based on the verification result.
[0159] In the embodiment, the above modules or units are respectively used for performing operations corresponding to steps of the picture processing method of the foregoing embodiments, and thus will not be described here again.
[0160] In some optional implementations of the embodiment, the first processing module 301 includes:
[0161] an intercepting sub-module, configured to intercept the loading action based on a hook mechanism;
[0162] a first obtaining sub-module, configured to obtain resource file information of the target picture;
[0163] a second obtaining sub-module, configured to obtain picture information of the target picture from the resource file information, and extract an element in the target picture.
[0164] In the embodiment, the above modules or units are respectively used for performing operations corresponding to steps of the picture processing method of the foregoing embodiments, and thus will not be described here again.
[0165] In some optional implementations of the embodiment, the identifying module 302 includes:
[0166] a first identifying sub-module, configured to input the target picture into the picture identifying model, and identify category information of the element contained in the picture through the picture identifying model;
[0167] a receiving sub-module, configured to receive the category information output by the picture identifying model;
[0168] The second identifying sub-module is configured to identify whether the element is a sensitive element based on the category information.
[0169] In the embodiment, the operations performed by the above modules or units correspond to the steps of the picture processing method of the foregoing embodiments one by one, and will not be described here again.
[0170] In some optional implementations of the embodiment, the second generating module 305 includes:
[0171] The comparison sub-module is configured to compare the aspect ratio with the preset ratio value to obtain a comparison result.
[0172] The judgment sub-module is configured to judge whether the comparison result is that the aspect ratio is equal to the preset ratio value.
[0173] The first generating sub-module is configured to generate a first verification result that the target picture passes the verification if the comparison result is that the aspect ratio is equal to the preset ratio value.
[0174] The second generating sub-module is configured to generate a second verification result that the target picture fails the verification if the comparison result is that the aspect ratio is not equal to the preset ratio value.
[0175] In the embodiment, the operations performed by the above modules or units correspond to the steps of the picture processing method of the foregoing embodiments one by one, and will not be described here again.
[0176] In some optional implementations of the embodiment, the picture processing apparatus further includes:
[0177] The first obtaining module is configured to obtain identification information of the target picture if the verification result is that the target picture fails the verification.
[0178] The third generating module is configured to generate target abnormal data records corresponding to the target picture based on the identification information.
[0179] The storage module is configured to store the target abnormal data records in a preset abnormal data record table.
[0180] In the embodiment, the operations performed by the above modules or units correspond to the steps of the picture processing method of the foregoing embodiments one by one, and will not be described here again.
[0181] In some optional implementations of the embodiment, the picture processing apparatus further includes:
[0182] The statistical module is configured to count a quantity of all abnormal data records contained in the abnormal data record table.
[0183] The second judgment module is configured to judge whether the quantity is greater than a preset quantity threshold.
[0184] The third generating module is configured to generate early warning information corresponding to all the abnormal data records if yes;
[0185] The second obtaining module is configured to obtain a communication address of the target user.
[0186] The sending module is configured to send the early warning information to the communication address.
[0187] In the embodiment, the above modules or units are respectively used for performing operations corresponding to steps of the picture processing method of the foregoing embodiments, and thus will not be described here again.
[0188] In some optional implementations of the embodiment, the second processing module 306 includes:
[0189] The first display submodule is configured to directly display the target picture if the verification result is that the target picture passes the verification.
[0190] The adjusting submodule is configured to, if the verification result is that the target picture fails to pass the verification, adjust the size of the target picture based on the preset ratio to obtain a specified picture after processing.
[0191] The second processing submodule is configured to display the specified picture.
[0192] In the embodiment, the above modules or units are respectively used for performing operations corresponding to steps of the picture processing method of the foregoing embodiments, and thus will not be described here again.
[0193] To solve the above technical problems, the embodiment of the present application further provides a computer device. For details, please refer to Figure 4 , Figure 4 The basic structure block diagram of the computer device of the embodiment is shown in FIG. 1.
[0194] The computer device 4 includes a memory 41, a processor 42, and a network interface 43, which are communicatively connected via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure, but it should be understood that not all of the shown components are required to be implemented, and more or fewer components can be alternatively implemented. Among them, those skilled in the art can understand that the computer device herein is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0195] The computer device can be a desktop computer, a notebook computer, a palm computer, a cloud server, and the like. The computer device can interact with the user through a keyboard, a mouse, a remote controller, a touchpad, a voice control device, and the like.
[0196] The memory 41 includes at least one type of readable storage medium, including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, and the like. Of course, the memory 41 can also include both the internal storage unit and the external storage device of the computer device 4. In the present embodiment, the memory 41 is generally used to store an operating system and various application software installed in the computer device 4, such as computer readable instructions of the picture processing method, and the like. In addition, the memory 41 can also be used to temporarily store various data that have been output or will be output.
[0197] The processor 42 may be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In the present embodiment, the processor 42 is configured to execute computer-readable instructions stored in the memory 41 or process data, such as computer-readable instructions of the picture processing method.
[0198] The network interface 43 may include a wireless network interface or a wired network interface, and is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0199] Compared with the prior art, the present embodiment has the following beneficial effects:
[0200] In the present embodiment, during the running of the application, when the loading action of the target picture is detected, the loading action is first intercepted, and the picture information of the target picture and the elements of the target picture are obtained. Then, it is determined whether the elements contain sensitive elements based on the preset picture recognition model. If the elements do not contain sensitive elements, it is determined whether the width is less than the preset width threshold and whether the height is less than the preset height threshold. If the width is less than the preset width threshold and the height is less than the preset height threshold, the aspect ratio of the target picture is generated based on the width and the height. Then, the aspect ratio is compared with the preset ratio to generate a verification result corresponding to the target picture. Finally, the picture is processed based on the verification result. Through the present application, the target picture to be displayed in the application can be automatically and quickly verified and processed, and the verification result of the target picture can be accurately generated. Then, the target picture can be processed according to the verification result, which effectively avoids the manual picture review processing work, saves the human resources for picture review processing, improves the picture review processing efficiency, ensures the accuracy of subsequent picture display, and improves the user experience.
[0201] The present application also provides another embodiment, i.e., a computer readable storage medium storing computer readable instructions, which can be executed by at least one processor to make the at least one processor execute the steps of the picture processing method as described above.
[0202] Compared with the prior art, the present embodiment has the following beneficial effects:
[0203] In the embodiments of the present application, during the running of the application program, when the loading action of the target picture is listened to, the loading action is first intercepted, and the picture information of the target picture and the elements of the target picture are acquired. Then, whether the elements contain sensitive elements is identified based on the preset picture recognition model. If the elements do not contain sensitive elements, whether the width is less than the preset width threshold and whether the height is less than the preset height threshold are determined. If the width is less than the preset width threshold and the height is less than the preset height threshold, the aspect ratio of the target picture is generated based on the width and the height. Then, the aspect ratio is compared with the preset ratio value to generate a verification result corresponding to the target picture. Finally, the picture is processed based on the verification result. Through the present application, the target picture to be displayed in the application program can be automatically and quickly verified and processed, and the verification result of the target picture can be accurately generated. Then, the target picture can be processed according to the verification result, the processing work of manual picture review is effectively avoided, the human resources for picture review processing are saved, the processing efficiency of picture review is improved, the accuracy of subsequent picture display is ensured, and the user experience is improved.
[0204] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and a general hardware platform as required, and of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the methods described in the various embodiments of the present application.
[0205] Obviously, the above-described embodiments are only some of the embodiments of the present application, not all the embodiments, and the preferred embodiments of the present application are given in the drawings, but do not limit the patent scope of the present application. The present application can be implemented in many different forms, and conversely, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can modify the technical solutions described in the foregoing embodiments, or equivalently replace some of the technical features. Any equivalent structure made by using the contents of the specification and drawings, directly or indirectly applied to other related technical fields, is also within the scope of the patent protection of the present application.
Claims
1. A picture processing method, characterized by, The method comprises the following steps: During the running of an application program, if a loading action of a target picture is monitored, the loading action is intercepted, and picture information of the target picture and an element of the target picture are obtained; the picture information comprises a width of the target picture and a height of the target picture; It is identified whether the element contains a sensitive element based on a preset picture recognition model; If the element does not contain a sensitive element, it is determined whether the width is less than a preset width threshold and whether the height is less than a preset height threshold; If the width is less than the preset width threshold and the height is less than the preset height threshold, an aspect ratio of the target picture is generated based on the width and the height; The aspect ratio is compared with a preset ratio value to generate a verification result corresponding to the target picture; The target picture is processed based on the verification result; The step of comparing the aspect ratio with the preset ratio value to generate the verification result corresponding to the target picture specifically comprises: The aspect ratio is compared with the preset ratio value to obtain a comparison result; It is determined whether the comparison result is that the aspect ratio is equal to the preset ratio value; the preset ratio value is a width-height ratio of a view control to be rendered which is set in advance in the application program; If yes, a first verification result that the target picture passes the verification is generated; If no, a second verification result that the target picture fails the verification is generated; The verification result comprises that the target picture passes the verification or the target picture fails the verification, and the step of processing the target picture based on the verification result specifically comprises: If the verification result is that the target picture passes the verification, the target picture is directly displayed; If the verification result is that the target picture fails the verification, the size of the target picture is adjusted based on the preset ratio value to obtain a specified picture after processing; The specified picture is displayed.
2. The picture processing method of claim 1, wherein, The step of intercepting the loading action and obtaining the picture information of the target picture and the element of the target picture specifically comprises: The loading action is intercepted based on a hook mechanism; Resource file information of the target picture is obtained; Picture information of the target picture is obtained from the resource file information, and an element in the target picture is extracted.
3. The picture processing method of claim 1, wherein, The step of identifying whether the element contains a sensitive element based on the preset picture recognition model specifically comprises: The target picture is input into the picture recognition model, and category information of the element contained in the picture is identified by the picture recognition model; The category information output by the picture recognition model is received; Whether the element is a sensitive element is identified based on the category information.
4. The picture processing method of claim 1, wherein, The verification result comprises that the target picture passes the verification or the target picture fails the verification, and after the step of comparing the aspect ratio with the preset ratio value to generate the verification result corresponding to the target picture, the step of obtaining identification information of the target picture if the verification result is that the target picture fails the verification is further included. generating a target abnormal data record corresponding to the target picture based on the identification information; storing the target abnormal data record in a preset abnormal data record table.
5. The picture processing method of claim 4, wherein, After the step of storing the target abnormal data record in the preset abnormal data record table, the method further comprises: counting a number of all abnormal data records contained in the abnormal data record table; determining whether the number is greater than a preset number threshold; if yes, generating early warning information corresponding to all the abnormal data records; obtaining a communication address of a target user; sending the early warning information to the communication address.
6. An image processing apparatus characterized by comprising: comprise: a first processing module, configured to, in a running process of an application program, if a loading action of a target picture is listened to, intercept the loading action, and acquire picture information of the target picture and an element of the target picture; wherein the picture information comprises a width of the target picture and a height of the target picture; an identification module, configured to identify, based on a preset picture identification model, whether the element contains a sensitive element; a first determination module, configured to, if the element does not contain a sensitive element, determine whether the width is less than a preset width threshold and whether the height is less than a preset height threshold; a first generation module, configured to, if the width is less than the preset width threshold and the height is less than the preset height threshold, generate an aspect ratio of the target picture based on the width and the height; a second generation module, configured to compare the aspect ratio with a preset ratio value to generate a verification result corresponding to the target picture; a second processing module, configured to perform corresponding processing on the target picture based on the verification result; wherein the second generation module comprises: a comparison submodule, configured to compare the aspect ratio with the preset ratio value to obtain a comparison result; a determination submodule, configured to determine whether the comparison result is that the aspect ratio is equal to the preset ratio value; wherein the preset ratio value is a width-height ratio of a view View control to be rendered which is preset in the application program; a first generation submodule, configured to, if yes, generate a first verification result that the target picture passes verification; a second generation submodule, configured to, if no, generate a second verification result that the target picture fails to pass verification; wherein the second processing module comprises: a first display submodule, configured to, if the verification result is that the target picture passes verification, directly display the target picture; an adjustment submodule, configured to, if the verification result is that the target picture fails to pass verification, adjust a size of the target picture based on the preset ratio value to obtain a specified picture after processing; a second processing submodule, configured to display the specified picture.
7. A computer device comprising a memory and a processor, wherein the memory stores computer readable instructions, and the processor executes the computer readable instructions to implement the steps of the picture processing method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer readable instructions, and the computer readable instructions are executed by the processor to implement the steps of the picture processing method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Abnormal data processing method and device, intelligent projector and storage medium
CN110837011A
Image display method, image display device and terminal equipment
CN111290684A
APP detection method, apparatus and device, and storage medium
CN112685737A