CN113643266B - Image detection method and device and electronic equipment - Google Patents

Image detection method and device and electronic equipment Download PDF

Info

Publication number
CN113643266B
CN113643266B CN202110959943.7A CN202110959943A CN113643266B CN 113643266 B CN113643266 B CN 113643266B CN 202110959943 A CN202110959943 A CN 202110959943A CN 113643266 B CN113643266 B CN 113643266B
Authority
CN
China
Prior art keywords
image
detected
features
aspect ratio
detection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110959943.7A
Other languages
Chinese (zh)
Other versions
CN113643266A (en
Inventor
张欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110959943.7A priority Critical patent/CN113643266B/en
Publication of CN113643266A publication Critical patent/CN113643266A/en
Application granted granted Critical
Publication of CN113643266B publication Critical patent/CN113643266B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Abstract

The disclosure provides an image detection method, an image detection device and electronic equipment, relates to the technical field of image processing, and particularly relates to the technical field of image detection. The specific implementation scheme is as follows: acquiring an image to be detected; acquiring at least one of image features and aspect ratio features of the image to be detected; and performing anomaly detection on the image to be detected based on at least one of the image features and the aspect ratio features. The accuracy and efficiency of image detection can be improved.

Description

Image detection method and device and electronic equipment
Technical Field
The disclosure relates to the technical field of image processing, in particular to the technical field of image detection, and specifically relates to an image detection method, an image detection device and electronic equipment.
Background
With the rapid development of artificial intelligence and network technology, images are widely used as information transmission modes, and users can transmit information by uploading the images.
In the conventional image detection method, image content is generally recognized and detected based on adaptive display of the image content, and if the image content cannot be recognized by a machine, manual detection is performed.
Disclosure of Invention
The disclosure provides an image detection method, an image detection device and electronic equipment.
According to a first aspect of the present disclosure, there is provided an image detection method including:
acquiring an image to be detected;
acquiring at least one of image features and aspect ratio features of the image to be detected;
and performing anomaly detection on the image to be detected based on at least one of the image features and the aspect ratio features.
According to a second aspect of the present disclosure, there is provided an image detection apparatus including:
the first acquisition module is used for acquiring an image to be detected;
a second acquisition module for acquiring at least one of an image feature and an aspect ratio feature of the image to be detected;
and the detection module is used for carrying out anomaly detection on the image to be detected based on at least one of the image characteristics and the aspect ratio characteristics.
According to a third aspect of the present disclosure, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any one of the methods of the first aspect.
According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform any of the methods of the first aspect.
According to a fifth aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements any of the methods of the first aspect.
According to the technology disclosed by the invention, whether the image to be detected is abnormal or not is determined based on at least one of the image characteristics and the aspect ratio characteristics of the image to be detected, so that abnormal content in the image can be more accurately identified, and/or the screening of the image with abnormal size is facilitated, and the accuracy and the efficiency of image detection are improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a flow chart of an image detection method according to a first embodiment of the present disclosure;
fig. 2 is a schematic structural view of an image detection apparatus according to a second embodiment of the present disclosure;
fig. 3 is a schematic block diagram of an example electronic device used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
First embodiment
As shown in fig. 1, the present disclosure provides an image detection method, including the steps of:
step S101: and acquiring an image to be detected.
In this embodiment, the image detection method relates to the technical field of image processing, in particular to the technical field of image detection, and can be widely applied to various scenes such as image auditing, image hiding, artificial intelligence (Artificial Intelligence, AI) security, and the like. The image detection method of the embodiment of the present disclosure may be performed by the image detection apparatus of the embodiment of the present disclosure. The image detection apparatus of the embodiments of the present disclosure may be configured in any electronic device to perform the image detection method of the embodiments of the present disclosure. The electronic device may be a server or a terminal, which is not particularly limited herein.
The image to be detected may be an image in various formats, such as a static image in JPG format, PNG format, BMP, etc., a dynamic image in GIF format, etc., or Live Photo in which a static image is combined with a video, which is not particularly limited herein. The image to be detected may be an image of various sizes, such as a square image with an aspect ratio of 1:1, a rectangular image with an aspect ratio of 4:3, 16:9 or 7:5, or other irregular images, which are not particularly limited herein.
The image to be detected may be captured by a camera, or may be received and obtained, for example, a picture file sent by a user device or other electronic devices may be received and obtained, or the pre-stored image to be detected may be set according to an actual situation, which is not limited specifically herein.
In an alternative embodiment, after the image to be detected is obtained, pre-detection may be performed, specifically, whether the image to be detected has an abnormal form may be determined, and the case of the abnormal form may include, but is not limited to, that the image cannot be downloaded, that the display is incomplete, that the system audit interface directly reports errors, etc., and the specific pre-detection process may refer to the description of the related art, which is not specifically described herein. It is understood that in this embodiment, the image to be detected may be regarded as an image through which the detection is performed in advance.
Step S102: at least one of image features and aspect ratio features of an image to be detected is acquired.
In this step, only the image features of the image to be detected may be acquired, only the aspect ratio features of the image to be detected may be acquired, and also the image features and the aspect ratio features of the image to be detected may be acquired.
The image features of the image to be detected may be determined from a plurality of dimensions, such as content features, color features, texture features, shape features or spatial relationship features of the image to be detected. Content characteristics refer to characteristics that can describe specific content in an image, such as text content or object content; color features refer to features that may describe the color of an image or image area, which may be determined based on pixels of the image; texture features refer to surface properties that may describe an image or region of an image; the shape features may include at least one of contour features, which refer to features that may describe an image or an outer boundary of an object in the image, and region features, which refer to features that may describe a shape region of the image or the object in the image; spatial relationship features refer to spatial position or relative orientation relationships between objects in an image that may be described.
The image characteristics of the image to be detected can be obtained in various ways, and the method can be specifically determined according to the specific types of the image characteristics. For example, if the image features of the image to be detected include color features, the color features of the image to be detected may be obtained by extracting the color of each pixel point in the image, for example, if the image features of the image to be detected include contour features, the contour features of the image to be detected may be obtained by a boundary feature method or a fourier shape description method, for example, if the image features of the image to be detected include region features, the region features of the image to be detected may be obtained by convolution processing or other machine learning processing. It is to be understood that the method for acquiring the image features of the image to be detected is not limited thereto, and may be specifically set according to practical situations, and the specific acquisition method may refer to the description of the related art, which is not specifically described herein.
The aspect ratio feature of the image to be detected refers to a proportional relationship between two values of width and height of the image to be detected, and may include an aspect ratio, that is, a value of width/height, and may also include an aspect ratio, that is, a value of height/width, which is not particularly limited herein.
The aspect ratio features of the image to be detected can be obtained by measuring the width and height of the image to be detected and then calculating.
Step S103: abnormality detection is performed on the image to be detected based on at least one of the image feature and the aspect ratio feature.
In this step, abnormality detection may be performed on the image to be detected based on the image characteristics. The image characteristics can describe the image characteristics of the image to be detected, so that the content characteristics of the image to be detected can be conveniently obtained through image characteristic analysis, and compared with manual verification, the abnormal content in the image to be detected can be more accurately captured, and further whether the image to be detected is abnormal or not can be determined. In an alternative embodiment, based on the image characteristics of the image to be detected, valid content in the image to be detected can be determined and detected to determine whether the image to be detected is abnormal.
The anomaly detection may also be performed on the image to be detected based on aspect ratio features. The aspect ratio features may describe the dimensional characteristics of the image to facilitate determining from the dimensional characteristics analysis whether the image to be detected is abnormal. In an alternative embodiment, if the aspect ratio feature of the image to be detected represents that the image to be detected is abnormal in size, for example, the aspect ratio or the value of the aspect ratio is different, for example, the aspect ratio of the image to be detected is not available, the abnormal in size of the image to be detected may be determined, and thus the abnormal image to be detected is determined.
The image feature and the aspect ratio feature can be combined to perform anomaly detection on the image to be detected. In an alternative embodiment, under the condition that the aspect ratio feature of the image to be detected is determined to be abnormal, further detection is performed based on the image feature of the image to be detected, so that the error detection of the image with the size different from that of the conventional image and without the abnormality in the image content can be avoided, the detection accuracy is improved, and the error rate is reduced.
In this embodiment, the anomaly detection is performed on the image to be detected based on at least one of the image feature and the aspect ratio feature of the image to be detected, where the image feature can more accurately reflect the feature of the image content, and further can more accurately identify the anomaly content in the image to be detected, and the aspect ratio feature is beneficial to screening out the image with an abnormal size, and the accuracy and efficiency of image detection can be improved by the two features alone or in combination. In addition, the detection method is not limited by the display mode of the image to be detected, that is, whether the image to be detected is displayed in a self-adaptive mode or in a thumbnail mode, the image to be detected is displayed as all images, manual detection is not needed, the image to be detected can be detected in an abnormal mode through acquiring at least one of the image characteristics and the aspect ratio characteristics of the image to be detected, the application scene is wider, the image detection difficulty when the image to be detected is displayed in a thumbnail mode is reduced, and the detection accuracy is improved.
Optionally, step S103 specifically includes:
and in the case that the aspect ratio of the image to be detected is larger than the first aspect ratio threshold, performing anomaly detection on the image to be detected based on the image characteristics.
In this embodiment, when it is determined that the aspect ratio of the image to be detected is greater than the first aspect ratio threshold, it may be determined that the image to be detected is a long image, and then, based on the image features of the image to be detected, abnormality detection is performed on the image to be detected, to determine whether there is any abnormal content in the long image.
Wherein the first aspect ratio threshold may be set to 5 or 6 or 10, and is not particularly limited herein.
In the case where the aspect ratio of the image to be detected is greater than the first aspect ratio threshold, it may be that the value of the width/height of the image to be detected is greater than the first aspect ratio threshold, that is, the image to be detected is a long image in the lateral direction, and if there is abnormal content in the image to be detected, the abnormal content may exist in an end region of the left end or the right end of the image to be detected. In the case where the aspect ratio of the image to be detected is greater than the first aspect ratio threshold, it may be that the value of the height/width of the image to be detected is greater than the first aspect ratio threshold, that is, the image to be detected is a vertically long image, and if there is abnormal content in the image to be detected, the abnormal content may exist in an end region of the top end or the bottom end of the image to be detected. And subsequently, based on the image characteristics of the image to be detected, when the image to be detected is subjected to abnormal detection, the important attention can be paid to whether the abnormal content exists in each end region.
In this embodiment, the anomaly detection is performed on the image to be detected based on the image characteristics in the case where the aspect ratio of the image to be detected is greater than the first aspect ratio threshold. The method can effectively screen the long graph with the hidden abnormal content aiming at the situation that the abnormal content is hidden in the long graph to avoid detection, and further carries out abnormal detection on the long graph based on image characteristics, so that the coverage of image detection is wider, and the detection efficiency and accuracy are improved.
Optionally, step S103 specifically includes:
performing anomaly detection on the image to be detected based on the image characteristics under the condition that the aspect ratio of the image to be detected is larger than a first aspect ratio threshold value and the width of the image to be detected is larger than a width threshold value; or,
and in the case that the aspect ratio of the image to be detected is larger than the first aspect ratio threshold value and the length of the image to be detected is larger than the length threshold value, performing anomaly detection on the image to be detected based on the image characteristics.
In this embodiment, on the premise that the following two conditions are satisfied, it may be determined that the image to be detected is abnormal: a first condition that the aspect ratio of the image to be detected is greater than a first aspect ratio threshold; and secondly, the width of the image to be detected is larger than a width threshold value, or the length of the image to be detected is larger than a length threshold value.
The first condition may refer to the related description in the foregoing embodiment, and will not be described herein.
The condition two further defines the width or length of the image to be detected, and can avoid determining an image having a smaller size but an aspect ratio larger than the first aspect ratio threshold value as an abnormal image. The accuracy of image detection is further improved.
Optionally, the image features include image region features, and based on the image features, performing anomaly detection on the image to be detected includes:
and determining that the image to be detected is abnormal and the image content in the target image area is matched under the condition that the duty ratio of the image area characteristic representation target image area in the image to be detected is larger than a duty ratio threshold and the image area characteristic representation target image area is in a preset area of the image to be detected.
In this embodiment, the image region features are used to describe region features of an image to be detected, and may include features of each region, a positional relationship between each region, and the like.
In an alternative embodiment, the image anomaly to be detected may be determined if the following three conditions are met: a first condition that the aspect ratio of the image to be detected is greater than a first aspect ratio threshold; thirdly, the image content characteristics represent that the duty ratio of the target image area in the image to be detected is larger than a duty ratio threshold value; and fourthly, the image area features represent the preset area of the target image area in the image to be detected.
The first condition may refer to the related description in the foregoing embodiment, and will not be described herein.
The target image area in the conditions three and four refers to an image area other than the effective image content in the image to be detected, and may also be referred to as a meaningless area, which has no substantial image content.
Matching image content within the target image region may include, but is not limited to, any of the following:
the first item, the image content in the target image area is a solid-color image, specifically, the image content in the target image area is only a single solid-color image or a combination of a plurality of single solid-color images, for example, the target image area is solid white or solid black;
in the second item, the image content in the target image area is the repeated content of the same image content, specifically, the image content in the target image area is copied by a plurality of the same image content, for example, the target image area is formed by splicing 100 identical small tree patterns.
In the third condition, the duty ratio threshold may be 85% or 90% or 95%, and is not particularly limited here.
On the premise that the image to be detected is a long image, if the duty ratio of the target image area in the image to be detected exceeds a duty ratio threshold value, the effective image area in the image to be detected is small in duty ratio and is not a normal image generally. And combining the condition III, and if the target image area is positioned in the preset area in the image to be detected, determining that the image to be detected is abnormal. For example, the target image area is located below the image to be detected, i.e. the effective image content is located only in a smaller area at the top end of the image to be detected, for example, the target image area is located above the image to be detected, i.e. the effective image content is located only in a smaller area at the bottom end of the image to be detected, for example, the target image area is located all to the right of the image to be detected, i.e. the effective image content is located only in a smaller area at the left end of the image to be detected, for example, the target image area is located all to the left of the image to be detected, i.e. the effective image content is located only in a smaller area at the right end of the image to be detected.
In the specific implementation process, the third condition judging mode can be implemented by extracting the pixel value of each pixel point in the image to be detected, taking the target image area as a solid color as an example, and when the ratio of the pixel value of a certain color to the pixel value of the image to be detected is greater than the duty ratio threshold, the second condition can be determined to be met.
The fourth condition may be determined by detecting the color similarity between the regions in the image to be detected, so as to determine the target image region and the position of the target image region in the image to be detected.
The judgment of the first condition, the second condition, and the third condition may be performed in parallel or in series, and the order of judgment between the conditions is not limited.
In an alternative embodiment, the image anomaly to be detected may be determined if the following four conditions are met: a first condition that the aspect ratio of the image to be detected is greater than a first aspect ratio threshold; the second condition is that the width of the image to be detected is larger than a width threshold value, or the length of the image to be detected is larger than a length threshold value; thirdly, the image content characteristics represent that the duty ratio of the target image area in the image to be detected is larger than a duty ratio threshold value; and fourthly, the image area features represent the preset area of the target image area in the image to be detected.
The first, second, third and fourth conditions may refer to the related descriptions in the above embodiments, and are not described herein. The judgment of the first, second, third and fourth conditions may be performed in parallel or in series, and the order of judgment between the conditions is not limited.
In this embodiment, on the premise of determining that the image to be detected is a long image, whether the possibility of hiding abnormal content exists in the long image is determined based on the duty ratio characteristic and the position characteristic of the target image area, and whether the image to be detected is abnormal is further determined. Therefore, the normal long graph can be prevented from being mistakenly checked, and the detection efficiency and accuracy are further improved.
Optionally, the image region features are obtained by:
carrying out convolution processing on M detection areas in the image to be detected to obtain M area characteristic information of the M detection areas, wherein M is an integer greater than 1;
image region features are determined based on the M region feature information.
In this embodiment, the M detection areas may be obtained by dividing the image to be detected in advance, or may be obtained by performing convolution processing on the image to be detected by using an area framed by a sliding window, where the size, the sliding direction, and the sliding step length of the sliding window may be preset, for example, the size of the sliding window may be 7mm×7mm, the sliding direction may be sliding along the horizontal direction first, and after sliding along a row, the sliding may be performed along the vertical direction until the next row, that is, from the top to the bottom of the image to be detected, and the sliding may be performed one row by one row. The setting may be specifically performed according to actual conditions, and is not particularly limited herein.
The M detection areas are sequentially input into a pre-trained convolutional neural network to be subjected to convolutional processing, so that M area characteristic information of the M detection areas can be obtained, and further the image area characteristics of the whole image to be detected are determined. It should be noted that, the specific flow of the convolution process may refer to the description of the related art, which is not described herein.
In an alternative embodiment, if it is determined that N regions in the M detection regions are connected based on M region feature information of the M detection regions, and the N region feature information of the N regions has high similarity, the N regions may be determined to be target image regions.
In this embodiment, the convolution processing is performed on the image of each region in the image to be detected, so as to extract the region feature information of each region, so as to determine the image region feature of the image to be detected, and the region feature information obtained by the convolution processing can describe the content feature and the position feature of the image region, so that the accuracy of image detection can be further improved.
Optionally, step S103 specifically includes:
in the case where the aspect ratio of the image to be detected is greater than the second aspect ratio threshold, an abnormality of the image to be detected is determined.
In this embodiment, the second aspect ratio threshold is greater than the first aspect ratio threshold, and in an alternative embodiment, the second aspect ratio threshold is substantially greater than the first aspect ratio threshold. For example, the second aspect ratio threshold may be set to 50 or 80 or 100, and is not particularly limited herein.
In this embodiment, in the case where the aspect ratio of the image to be detected is greater than the second aspect ratio threshold, it may be determined that the image to be detected is an ultralong image whose size is far greater than that of a conventional long image, and it may be determined that the image to be detected is abnormal directly, so as to improve the efficiency of image detection.
Optionally, step S101 specifically includes:
acquiring a byte stream of an image to be detected, and determining a file format of the image to be detected based on the byte stream;
the step S102 specifically includes:
and under the condition that the byte stream characterizes the image to be detected as a preset file format, acquiring at least one of the image characteristics and the aspect ratio characteristics of a preset frame image in the image to be detected.
In this embodiment, for the case of circumvention detection in which the abnormal content is hidden in a certain frame image in the moving picture file, at least one of the image feature and the aspect ratio feature thereof may be acquired by determining a preset frame image in the image to be detected as the frame image to be detected.
The byte stream refers to a binary data stream of the image to be detected, and typically, the header of the byte stream of the picture file stores byte information representing the format of the picture file, for example, the first 5 bytes of the byte stream of the GIF picture are "GIF89a" or "GIF87a", and the corresponding 16-ary data are "4749 46 38 39 61" or "4749 46 38 37 61", respectively.
The preset file format may be a GIF format, the image to be detected is a dynamic image in the GIF format, at this time, the preset frame may be a first frame or a last frame of the image to be detected, or each frame of the image to be detected may be determined as a preset frame, and at least one of an image feature and an aspect ratio feature may be obtained for each frame of image to detect whether an abnormality occurs. The preset file format may also be a still image format, such as JPG format, BMP format, or PNG format, where the preset frame is the still image itself.
In this embodiment, the file format of the image to be detected may be determined through the byte stream of the image to be detected, and based on different format types, the frame image specifically extracting the image feature and/or the aspect ratio feature may be determined, so as to effectively screen the image with the possibly hidden abnormal content in each file format, further widen the coverage of image detection, and further improve the detection efficiency and accuracy.
For ease of understanding, an example of the disclosure is presented below, and the specific flow is as follows:
step one, receiving an image to be detected sent by user equipment.
Pre-detecting an image to be detected, filtering out an image with abnormal form, wherein the abnormal form comprises incapability of downloading pictures, incomplete display, direct error reporting of a detection interface and the like, and then starting formal detection.
And step two, judging the format of the image to be detected.
The first 5 bytes of information of the binary data stream of the image to be detected are parsed. If the first 5 bytes of information are 'GIF 89 a' or 'GIF 87 a', respectively corresponding 16-system data are '47 49 46 38 39 61' or '47 49 46 38 37 61', and the image to be detected is determined to be in the GIF format, extracting a first frame of the image to be detected; if the first 5 bytes of information is not "GIF89a" or "GIF87a", the image to be detected is determined to be in a still image format, and the image to be detected is directly acquired.
And step three, judging whether the image to be detected is abnormal or not.
It is determined whether the aspect ratio of the image to be detected is greater than 5 and the width is greater than 2560 or the height is greater than 1600, and if it is greater than 5 and the width is greater than 2560 or the height is greater than 1600, it is determined whether the duty ratio of the target image area (nonsensical area) in the image to be detected is greater than 90% and whether the target image area (nonsensical area) is located below the image to be detected. If the conditions are met, determining that the image to be detected is abnormal, continuing to execute the fourth step, and if one condition is not met, executing the fifth step.
And step four, conventional detection.
Under the condition that the image to be detected is abnormal, inputting the image to be detected into a conventional auditing platform to perform treatment operations such as deleting, deleting a signature or blocking an account, and the like, and seamlessly accessing a primary auditing flow.
And fifthly, detecting passing without abnormality.
Second embodiment
As shown in fig. 2, the present disclosure provides an image detection apparatus 200, including:
a first acquiring module 201, configured to acquire an image to be detected;
a second acquiring module 202, configured to acquire at least one of an image feature and an aspect ratio feature of an image to be detected;
a detection module 203, configured to perform anomaly detection on the image to be detected based on at least one of the image feature and the aspect ratio feature.
Optionally, the detection module 203 includes:
and a first detection unit configured to perform abnormality detection on the image to be detected based on the image feature in a case where the aspect ratio of the image to be detected is greater than a first aspect ratio threshold.
Optionally, the first detection unit is specifically configured to:
performing anomaly detection on the image to be detected based on the image characteristics under the condition that the aspect ratio of the image to be detected is larger than a first aspect ratio threshold value and the width of the image to be detected is larger than a width threshold value; or,
and in the case that the aspect ratio of the image to be detected is larger than the first aspect ratio threshold value and the length of the image to be detected is larger than the length threshold value, performing anomaly detection on the image to be detected based on the image characteristics.
Optionally, the image features include image region features, and the detection module 203 includes:
the second detection unit is used for determining that the image to be detected is abnormal and the image content in the target image area is matched under the condition that the image area characteristic represents that the duty ratio of the target image area in the image to be detected is larger than the duty ratio threshold and the image area characteristic represents that the target image area is in the preset area of the image to be detected.
Optionally, the image region features are obtained by:
carrying out convolution processing on M detection areas in the image to be detected to obtain M area characteristic information of the M detection areas, wherein M is an integer greater than 1;
image region features are determined based on the M region feature information.
Optionally, the detection module 203 includes:
and a third detection unit configured to determine that the image to be detected is abnormal in a case where the aspect ratio of the image to be detected is greater than the second aspect ratio threshold.
Optionally, the first obtaining module 201 includes:
the first acquisition unit is used for acquiring a byte stream of the image to be detected and determining a file format of the image to be detected based on the byte stream;
the second acquisition module 202 includes:
and the second acquisition unit is used for acquiring at least one of the image characteristics and the aspect ratio characteristics of a preset frame image in the image to be detected in the case that the byte stream characterizes the image to be detected as a preset file format.
The image detection device 200 provided in the present disclosure can implement each process implemented by the image detection method embodiment, and can achieve the same beneficial effects, so that repetition is avoided, and no further description is provided herein.
In the technical scheme of the disclosure, the acquisition, storage, application and the like of the related user personal information all conform to the regulations of related laws and regulations, and the public sequence is not violated.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
FIG. 3 illustrates a schematic block diagram of an example electronic device 300 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 3, the apparatus 300 includes a computing unit 301 that may perform various suitable actions and processes according to a computer program stored in a Read Only Memory (ROM) 302 or a computer program loaded from a storage unit 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the device 300 may also be stored. The computing unit 301, the ROM 302, and the RAM 303 are connected to each other by a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
Various components in device 300 are connected to I/O interface 305, including: an input unit 306 such as a keyboard, a mouse, etc.; an output unit 307 such as various types of displays, speakers, and the like; a storage unit 308 such as a magnetic disk, an optical disk, or the like; and a communication unit 309 such as a network card, modem, wireless communication transceiver, etc. The communication unit 309 allows the device 300 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 301 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 301 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 301 performs the respective methods and processes described above, such as an image detection method. For example, in some embodiments, the image detection method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 308. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 300 via the ROM 302 and/or the communication unit 309. When the computer program is loaded into the RAM 303 and executed by the computing unit 301, one or more steps of the image detection method described above may be performed. Alternatively, in other embodiments, the computing unit 301 may be configured to perform the image detection method by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel, sequentially, or in a different order, provided that the desired results of the disclosed aspects are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (11)

1. An image detection method, comprising:
acquiring an image to be detected;
acquiring at least one of image features and aspect ratio features of the image to be detected;
performing anomaly detection on the image to be detected based on at least one of the image features and the aspect ratio features;
the anomaly detection of the image to be detected based on at least one of the image features and aspect ratio features includes:
performing anomaly detection on the image to be detected based on the image characteristics under the condition that the aspect ratio of the image to be detected is larger than a first aspect ratio threshold;
wherein the image features of the image to be detected are determined from the content features, color features, texture features, shape features and/or spatial relationship features of the image to be detected;
wherein, in the case that the aspect ratio of the image to be detected is greater than the first aspect ratio threshold, based on the image feature, performing anomaly detection on the image to be detected includes:
performing anomaly detection on the image to be detected based on the image characteristics under the condition that the aspect ratio of the image to be detected is larger than a first aspect ratio threshold value and the width of the image to be detected is larger than a width threshold value; or,
performing anomaly detection on the image to be detected based on the image characteristics under the condition that the aspect ratio of the image to be detected is larger than a first aspect ratio threshold and the length of the image to be detected is larger than a length threshold;
the image feature includes an image region feature, and the abnormality detection of the image to be detected based on the image feature includes:
determining that the image to be detected is abnormal under the condition that the image area characteristic represents that the duty ratio of a target image area in the image to be detected is larger than a duty ratio threshold value and the image area characteristic represents that the target image area is in a preset area of the image to be detected, wherein the image content in the target image area is matched;
the image region features are used for describing region features of an image to be detected, and the image region features comprise features of all regions and position relations among all regions.
2. The method of claim 1, wherein the image region features are obtained by:
carrying out convolution processing on M detection areas in the image to be detected to obtain M area characteristic information of the M detection areas, wherein M is an integer greater than 1;
and determining the image region characteristics based on the M region characteristic information.
3. The method of claim 1, wherein the anomaly detection of the image to be detected based on at least one of the image features and aspect ratio features comprises:
and determining that the image to be detected is abnormal in the case that the aspect ratio of the image to be detected is larger than a second aspect ratio threshold.
4. The method of claim 1, wherein the acquiring the image to be detected comprises:
acquiring a byte stream of the image to be detected, and determining a file format of the image to be detected based on the byte stream;
the acquiring at least one of the image feature and the aspect ratio feature of the image to be detected includes:
and under the condition that the byte stream characterizes the image to be detected as a preset file format, acquiring at least one of image characteristics and aspect ratio characteristics of a preset frame image in the image to be detected.
5. An image detection apparatus comprising:
the first acquisition module is used for acquiring an image to be detected;
a second acquisition module for acquiring at least one of an image feature and an aspect ratio feature of the image to be detected;
a detection module, configured to perform anomaly detection on the image to be detected based on at least one of the image feature and the aspect ratio feature;
a first detection unit configured to perform anomaly detection on the image to be detected based on the image feature, in a case where an aspect ratio of the image to be detected is greater than a first aspect ratio threshold;
wherein the image features of the image to be detected are determined from the content features, color features, texture features, shape features and/or spatial relationship features of the image to be detected;
wherein, the first detecting unit is specifically configured to:
performing anomaly detection on the image to be detected based on the image characteristics under the condition that the aspect ratio of the image to be detected is larger than a first aspect ratio threshold value and the width of the image to be detected is larger than a width threshold value; or,
performing anomaly detection on the image to be detected based on the image characteristics under the condition that the aspect ratio of the image to be detected is larger than a first aspect ratio threshold and the length of the image to be detected is larger than a length threshold;
wherein the image features include image region features, the detection module includes:
the second detection unit is used for determining that the image to be detected is abnormal when the image area characteristic represents that the duty ratio of the target image area in the image to be detected is larger than a duty ratio threshold value and the image area characteristic represents that the target image area is in a preset area of the image to be detected, and the image content in the target image area is matched;
the image region features are used for describing region features of an image to be detected, and the image region features comprise features of all regions and position relations among all regions.
6. The apparatus of claim 5, wherein the image region features are obtained by:
carrying out convolution processing on M detection areas in the image to be detected to obtain M area characteristic information of the M detection areas, wherein M is an integer greater than 1;
and determining the image region characteristics based on the M region characteristic information.
7. The apparatus of claim 5, wherein the detection module comprises:
and a third detection unit configured to determine that the image to be detected is abnormal, in a case where the aspect ratio of the image to be detected is greater than a second aspect ratio threshold.
8. The apparatus of claim 5, wherein the first acquisition module comprises:
a first obtaining unit, configured to obtain a byte stream of the image to be detected, and determine a file format of the image to be detected based on the byte stream;
the second acquisition module includes:
and the second acquisition unit is used for acquiring at least one of the image characteristics and the aspect ratio characteristics of a preset frame image in the image to be detected under the condition that the byte stream characterizes the image to be detected as a preset file format.
9. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.
10. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-4.
11. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-4.
CN202110959943.7A 2021-08-20 2021-08-20 Image detection method and device and electronic equipment Active CN113643266B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110959943.7A CN113643266B (en) 2021-08-20 2021-08-20 Image detection method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110959943.7A CN113643266B (en) 2021-08-20 2021-08-20 Image detection method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN113643266A CN113643266A (en) 2021-11-12
CN113643266B true CN113643266B (en) 2024-04-05

Family

ID=78423074

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110959943.7A Active CN113643266B (en) 2021-08-20 2021-08-20 Image detection method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN113643266B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108764243A (en) * 2018-05-30 2018-11-06 北京奇艺世纪科技有限公司 A kind of image processing method and device
CN110517246A (en) * 2019-08-23 2019-11-29 腾讯科技(深圳)有限公司 A kind of image processing method, device, electronic equipment and storage medium
CN110580678A (en) * 2019-09-10 2019-12-17 北京百度网讯科技有限公司 image processing method and device
CN111340749A (en) * 2018-12-17 2020-06-26 顺丰科技有限公司 Image quality detection method, device, equipment and storage medium
WO2020133170A1 (en) * 2018-12-28 2020-07-02 深圳市大疆创新科技有限公司 Image processing method and apparatus
JP2020110959A (en) * 2019-01-10 2020-07-27 株式会社リコー Image formation apparatus, image formation method and program
CN112215811A (en) * 2020-09-30 2021-01-12 上海闻泰信息技术有限公司 Image detection method and device, electronic equipment and storage medium
CN112801987A (en) * 2021-02-01 2021-05-14 上海悦易网络信息技术有限公司 Mobile phone part abnormity detection method and equipment
CN114693946A (en) * 2020-12-29 2022-07-01 顺丰科技有限公司 Image anomaly detection method and device, computer equipment and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108764243A (en) * 2018-05-30 2018-11-06 北京奇艺世纪科技有限公司 A kind of image processing method and device
CN111340749A (en) * 2018-12-17 2020-06-26 顺丰科技有限公司 Image quality detection method, device, equipment and storage medium
WO2020133170A1 (en) * 2018-12-28 2020-07-02 深圳市大疆创新科技有限公司 Image processing method and apparatus
JP2020110959A (en) * 2019-01-10 2020-07-27 株式会社リコー Image formation apparatus, image formation method and program
CN110517246A (en) * 2019-08-23 2019-11-29 腾讯科技(深圳)有限公司 A kind of image processing method, device, electronic equipment and storage medium
CN110580678A (en) * 2019-09-10 2019-12-17 北京百度网讯科技有限公司 image processing method and device
CN112215811A (en) * 2020-09-30 2021-01-12 上海闻泰信息技术有限公司 Image detection method and device, electronic equipment and storage medium
CN114693946A (en) * 2020-12-29 2022-07-01 顺丰科技有限公司 Image anomaly detection method and device, computer equipment and storage medium
CN112801987A (en) * 2021-02-01 2021-05-14 上海悦易网络信息技术有限公司 Mobile phone part abnormity detection method and equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于机器学习的多光谱舰船图像异常目标检测方法;姚瑶;傅立军;葛海江;;舰船科学技术;20190523(第10期);188-190 *

Also Published As

Publication number Publication date
CN113643266A (en) 2021-11-12

Similar Documents

Publication Publication Date Title
CN110083740B (en) Video fingerprint extraction and video retrieval method, device, terminal and storage medium
CN112949767B (en) Sample image increment, image detection model training and image detection method
CN113674421B (en) 3D target detection method, model training method, related device and electronic equipment
CN112991180A (en) Image splicing method, device, equipment and storage medium
CN113222921A (en) Image processing method and system
CN110895811B (en) Image tampering detection method and device
CN106528758B (en) Picture selection method and device
CN114445663A (en) Method, apparatus and computer program product for detecting challenge samples
CN113344906B (en) Camera evaluation method and device in vehicle-road cooperation, road side equipment and cloud control platform
CN113439227A (en) Capturing and storing magnified images
CN113643266B (en) Image detection method and device and electronic equipment
CN114724144B (en) Text recognition method, training device, training equipment and training medium for model
CN114663980B (en) Behavior recognition method, and deep learning model training method and device
CN113628192B (en) Image blur detection method, apparatus, device, storage medium, and program product
CN113807410B (en) Image recognition method and device and electronic equipment
CN115131315A (en) Image change detection method, device, equipment and storage medium
US11544833B1 (en) System and method for capturing by a device an image of a light colored object on a light colored background for uploading to a remote server
CN114093006A (en) Training method, device and equipment of living human face detection model and storage medium
CN114596188A (en) Watermark detection method, model training method, device and electronic equipment
CN114066980A (en) Object detection method and device, electronic equipment and automatic driving vehicle
CN113379592A (en) Method and device for processing sensitive area in picture and electronic equipment
CN113569707A (en) Living body detection method, living body detection device, electronic apparatus, and storage medium
CN113313642A (en) Image denoising method and device, storage medium and electronic equipment
CN113313125A (en) Image processing method and device, electronic equipment and computer readable medium
CN114219744B (en) Image generation method, device, equipment and storage medium

Legal Events

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