CN115050029A - Image detection method and device, electronic equipment and storage medium - Google Patents

Image detection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115050029A
CN115050029A CN202210842832.2A CN202210842832A CN115050029A CN 115050029 A CN115050029 A CN 115050029A CN 202210842832 A CN202210842832 A CN 202210842832A CN 115050029 A CN115050029 A CN 115050029A
Authority
CN
China
Prior art keywords
violation
image
determining
index
detected
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.)
Pending
Application number
CN202210842832.2A
Other languages
Chinese (zh)
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.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
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 Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202210842832.2A priority Critical patent/CN115050029A/en
Publication of CN115050029A publication Critical patent/CN115050029A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/153Segmentation of character regions using recognition of characters or words
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/242Dictionaries
    • 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
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Multimedia (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Medical Informatics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Molecular Biology (AREA)
  • Mathematical Physics (AREA)
  • Processing Or Creating Images (AREA)
  • Storage Device Security (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses an image detection method, an image detection device, electronic equipment and a storage medium. The method comprises the following steps: acquiring an image to be detected, and determining a text description sentence corresponding to the image to be detected; matching the text description sentences with a predetermined illegal word dictionary to determine illegal sentences; determining violation weights corresponding to the violation sentences, and determining violation indexes according to the violation weights; when the violation index is larger than the predetermined violation index threshold, determining that the image to be detected is the violation image, so that the problem that the violation image cannot be accurately identified in the image detection process is solved, matching the text description sentence of the image to be detected with the violation dictionary, determining the violation sentence, determining the violation index according to the violation weight corresponding to the violation sentence, accurately determining the violation degree of the image to be detected, judging whether the image to be detected is in violation by comparing the violation index with the violation index threshold, improving the accuracy of image detection, and effectively identifying the violation image.

Description

Image detection method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of image detection technologies, and in particular, to an image detection method and apparatus, an electronic device, and a storage medium.
Background
With the explosive increase of the internet information amount, the content security problem in the network space is becoming more serious, and the image as an important part of the content in the network space is not concerned about the image content security problem. The traditional method in image content security monitoring is to establish an audit group for manual audit, however, due to the problems of large image quantity, long audit time, high labor cost and the like in a network space, the audit efficiency is very low, and in addition, a large number of repeated images exist in the network space, so that a large amount of repeated work and large workload exist in the audit process, and the audit difficulty is increased. Therefore, the security of the image content in the network space is always a difficult point and a pain point in the security problem of the network space, and an efficient and intelligent image content monitoring method is needed in the current network space security monitoring.
In recent years, a deep learning image classification network model based on a convolutional neural network is applied to sensitive image intelligent audit, for example, a text description sentence for describing an image is determined by identifying the image, but how to accurately judge whether the image violation is caused by the text description sentence becomes a problem to be solved.
Disclosure of Invention
The invention provides an image detection method, an image detection device, electronic equipment and a storage medium, which are used for realizing accurate detection of an image.
According to an aspect of the present invention, there is provided an image detection method including:
acquiring an image to be detected, and determining a text description sentence corresponding to the image to be detected;
matching the text description sentence with a predetermined violation word dictionary to determine a violation sentence;
determining violation weights corresponding to the violation statements, and determining violation indexes according to the violation weights;
and when the violation index is larger than a predetermined violation index threshold, determining that the image to be detected is a violation image.
According to another aspect of the present invention, there is provided an image detection apparatus including:
the image acquisition module is used for acquiring an image to be detected and determining a text description sentence corresponding to the image to be detected;
the illegal sentence determining module is used for matching the text description sentence with a predetermined illegal word dictionary and determining an illegal sentence;
the violation index determining module is used for determining violation weights corresponding to the violation sentences and determining violation indexes according to the violation weights;
and the violation image detection module is used for determining that the image to be detected is a violation image when the violation index is larger than a predetermined violation index threshold.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the image detection method according to any of the embodiments of the invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the image detection method according to any one of the embodiments of the present invention when the computer instructions are executed.
According to the technical scheme of the embodiment of the invention, the image to be detected is obtained, and the text description sentence corresponding to the image to be detected is determined; matching the text description sentence with a predetermined illegal word dictionary to determine an illegal sentence; determining violation weights corresponding to the violation statements, and determining violation indexes according to the violation weights; when the violation index is larger than the predetermined violation index threshold, the image to be detected is determined to be the violation image, the problem that the violation image cannot be accurately identified in the image detection process is solved, the violation sentence is determined by matching the text description sentence of the image to be detected with the violation dictionary, the violation index is further determined according to the violation weight corresponding to the violation sentence, the violation degree of the image to be detected can be accurately determined, and then whether the image to be detected is violated is judged by comparing the violation index with the violation index threshold, so that the accuracy of image detection is improved, and the violation image is effectively identified.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of an image detection method according to an embodiment of the present invention;
FIG. 2 is a flowchart of an image detection method according to a second embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an image detection apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device implementing the image detection method according to the embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "object," "alternative," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1 is a flowchart of an image detection method according to an embodiment of the present invention, where the embodiment is applicable to the case of performing violation detection on an image, and the method may be executed by an image detection apparatus, where the image detection apparatus may be implemented in a form of hardware and/or software, and the image detection apparatus may be configured in an electronic device. As shown in fig. 1, the method includes:
s101, obtaining an image to be detected, and determining a text description sentence corresponding to the image to be detected.
In this embodiment, the image to be detected may be specifically understood as an image with violation detection requirements, and the image to be detected may be selected and determined by a user, or may be automatically captured on a network as the image to be detected. A text description sentence is to be understood in particular as a sentence for describing the image to be detected, for example a group of pupils reading a mathematical book. Acquiring an image to be detected input by a user, or automatically capturing the image to be detected in a network, and determining a text description sentence describing the image to be detected by performing image recognition and analysis on the image to be detected.
And S102, matching the text description sentence with a predetermined illegal word dictionary to determine the illegal sentence.
In this embodiment, the illegal word dictionary may be specifically understood as a data set including one or more illegal words, and in order to ensure accuracy of image detection, the illegal word dictionary generally includes a large number of illegal words; the illegal sentence is a sentence which does not meet the specifications of the regulation, the moral specification and the like in the text description sentence.
Specifically, the illegal word dictionary is predetermined and can be generated by a user according to illegal words involved in actual life, the illegal words are collected and sorted, the illegal words are stored in the illegal word dictionary, the illegal word dictionary can be updated in real time, and the illegal words can be added to the illegal word dictionary in real time after new illegal words appear. And matching the text description sentences with the illegal words in the illegal word dictionary, determining the sentences matched with the illegal word dictionary in the text description sentences, and taking the partial sentences as the illegal sentences.
S103, determining violation weights corresponding to the violation statements, and determining violation indexes according to the violation weights.
In this embodiment, the violation weight may be specifically understood as a weight value of the violation sentence. The violation index is to be understood in particular as a numerical value that describes the degree of violation of the image. The violation weight of the violation sentences may be preset, that is, the weight value of each violation sentence is preset, and the corresponding violation weight may be correspondingly determined after the violation sentences are determined, or the violation weight corresponding to each violation sentence is determined by analyzing the violation sentences, for example, analyzing each violation sentence through a neural network model, and determining the violation weight corresponding to each violation sentence through information such as a relationship between the violation sentences. After determining each violation weight, the violation index may be determined by calculating an average, a maximum, a minimum, and the like.
And S104, when the violation index is larger than a predetermined violation index threshold, determining that the image to be detected is a violation image.
In this embodiment, the violation index threshold may be specifically understood as a boundary value used for determining whether the violation index meets the requirement. The violation index threshold is predetermined, the violation index threshold and the violation index are compared, and when the violation index is larger than the violation index threshold, the image to be detected is determined to be a violation image; and when the violation index is not greater than the violation index threshold, the image to be detected is a normal image.
The embodiment provides an image detection method, which comprises the steps of obtaining an image to be detected and determining a text description sentence corresponding to the image to be detected; matching the text description sentence with a predetermined illegal word dictionary to determine an illegal sentence; determining violation weights corresponding to the violation statements, and determining violation indexes according to the violation weights; when the violation index is larger than the predetermined violation index threshold, the image to be detected is determined to be the violation image, the problem that the violation image cannot be accurately identified in the image detection process is solved, the violation sentence is determined by matching the text description sentence of the image to be detected with the violation dictionary, the violation index is further determined according to the violation weight corresponding to the violation sentence, the violation degree of the image to be detected can be accurately determined, and then whether the image to be detected is violated is judged by comparing the violation index with the violation index threshold, so that the accuracy of image detection is improved, and the violation image is effectively identified.
Example two
Fig. 2 is a flowchart of an image detection method according to a second embodiment of the present invention, which is detailed based on the above embodiments. As shown in fig. 2, the method includes:
s201, obtaining an image to be detected.
S202, obtaining a predetermined target text detection model.
In this embodiment, the target text detection model may be specifically understood as a neural network model for detecting a picture and outputting a text describing the image. And training a neural network model in advance to obtain a target text detection model meeting a convergence condition, storing the target text detection model after training is completed, and directly obtaining the trained target text detection model when an image to be detected is detected.
Illustratively, the present application provides a target text detection model, a targetThe text detection model comprises an encoder, a visual attention model and the like. The encoder may employ a fast R-CNN model whose visual features resemble those of humans, and which is able to focus on the most prominent, most noticeable parts of the image for extracting the features of these regions. Assume that there are image I, k image features (V ═ V) 1 ,…,v k },v i ∈R d ) Is the output of features in the image such that each image feature can encode a salient region of the image. The picture feature V is also the result of the salient attention model. And after the model obtains the feature V of the image, decoding the image feature. The local data is divided into n buckets, each containing m samples. Each local model update utilizes the data of one batch, not the entire local training set, so each learning is very fast and can be updated online.
Each feature is weighted in the descriptive text generation process using the top-down attention mechanism based on soft-attention, and the existing output sequence is used as context information. In the target text detection model, two LSTM layers are used to selectively process spatial image features. A Top-Down visual Attention model is used as a first LSTM layer (Top-Down Attention LSTM), and a second LSTM layer is composed using a Language model (Language LSTM). The input vector of the first layer LSTM unit in each step is characterized by the output of the second layer LSTM unit at the previous moment and the mean pool image
Figure BDA0003751017860000071
And the words generated before are connected, so that the text description sentence of the image is obtained.
S203, inputting the image to be detected into a target text detection model, and determining a file description sentence according to the output of the target text detection model.
Inputting an image to be detected into a target text detection model, processing the image to be detected by the target text detection model according to learned experience, determining characteristics corresponding to a significant region in the image to be detected, further determining words according to the characteristics, forming and outputting file description sentences according to the words, and determining an output result of the target text detection model as the file description sentences of the image to be detected.
S204, a predetermined violation word dictionary is obtained, and the violation word dictionary comprises at least one violation word.
The method includes the steps that a violation word dictionary is generated in advance and stored, the violation word dictionary comprises one or more violation words, and in order to improve recognition accuracy and better cover the violation words, the number of the violation words in the violation word dictionary is usually large.
S205, performing regular matching on the text description sentences and the illegal words, and determining the illegal sentences which are successfully matched.
According to the method, illegal content identification is preferably carried out on the text description sentences in a regular matching mode, the text description sentences and the illegal words are sequentially subjected to regular matching, sentences which are successfully matched with the illegal words are determined, and the sentences are used as the illegal sentences.
And S206, inquiring a predetermined weight information table according to each violation statement, and determining the violation weight corresponding to each violation statement.
In this embodiment, the weight information table may be specifically understood as a data table storing the rule violation and the corresponding weight value. A weight information table is generated in advance, statements and weight values are correspondingly stored in the weight information table, a corresponding weight value can be set for each statement according to the violation degree of each statement, and the weight value in the embodiment of the application preferably adopts a numerical value between 0 and 1. And inquiring a weight information table aiming at each illegal statement, determining the statement matched with the illegal statement, and taking a weight value corresponding to the statement as the illegal weight of the illegal statement.
And S207, determining the average value of the violation weights as a violation index.
The average value of the violation weights is calculated and used as the violation index.
And S208, when the violation index is larger than the predetermined violation index threshold, determining that the image to be detected is a violation image.
As an optional embodiment of this embodiment, this optional embodiment further optimizes the step of determining the violation index threshold, including the following steps:
and A1, acquiring a preset number of alternative violation images.
In this embodiment, the preset number may be set according to actual requirements, and the influence of the data amount on the result may be considered during the setting, and the result may be inaccurate due to too small data amount, and the efficiency may be affected due to too large data amount. The candidate violation images are used to determine a violation index threshold. A certain number of illegal images are prepared in advance, and can be screened from the images by a user or automatically screened by an algorithm. Extracting a preset number of alternative violation images from the violation images, wherein the extraction may be random extraction or according to a certain rule, for example, classifying the violation images, and extracting each class of violation images according to a certain proportion; the classification may be by size, ease of recognition, number of features violating the violation, etc.
And A2, determining a target violation index corresponding to each alternative violation image.
In this embodiment, the target violation index may be specifically understood as a violation index of a candidate violation image, and the target violation index and the violation index of the to-be-detected image are determined in the same manner. The target violation index corresponding to each candidate violation image is determined separately in the manner of steps S202 to S207.
As an optional embodiment of this embodiment, this optional embodiment further optimizes the target violation index corresponding to each alternative violation image as follows:
and A21, determining alternative description sentences corresponding to the alternative violation images.
In this embodiment, the alternative description sentence may be specifically understood as a text sentence for describing the alternative violation image. And determining an alternative description sentence describing the alternative violation image by performing image recognition and analysis on the alternative violation image.
Alternative descriptive statements in the embodiments of the present application are determined in the same manner as the textual descriptive statements. Determining a candidate description sentence corresponding to each candidate violation image, including: acquiring a predetermined target text detection model; and inputting the alternative violation images into the target text detection model, and determining alternative description sentences according to the output of the target text detection model.
And A22, matching the alternative description sentence with a predetermined violation word dictionary to determine an alternative sentence.
In this embodiment, the alternative statement may be specifically understood as a statement of violation in the alternative description statement. And matching the alternative description sentences with the illegal words in the illegal word dictionary, determining sentences successfully matched with the alternative description sentences in the illegal words, and determining the sentences as alternative sentences.
Alternative statements in the embodiments of the present application are determined in the same manner as violation statements. Matching the alternative description sentences with a predetermined violation word dictionary to determine alternative sentences, wherein the alternative description sentences comprise: acquiring a predetermined violation word dictionary, wherein the violation word dictionary comprises at least one violation word; and performing regular matching on the alternative description sentences and the illegal words, and determining the alternative sentences which are successfully matched.
And A23, determining alternative weights corresponding to the alternative sentences, and determining a target violation index according to the alternative weights.
In this embodiment, the alternative weight may be specifically understood as a weight value corresponding to the alternative sentence, and is used to describe the violation degree of the alternative sentence. The method comprises the steps of presetting a weight value of each sentence, after candidate sentences are determined, correspondingly determining corresponding candidate weights, and determining a target violation index by performing mathematical operation on each candidate weight, for example, calculating an average value, a maximum value, a minimum value and the like.
The target violation index and the violation index of the image to be detected are determined in the same mode in the embodiment of the application. Determining alternative weights corresponding to the alternative sentences, and determining a target violation index according to the alternative weights, wherein the steps comprise: inquiring a predetermined weight information table according to each alternative statement, and determining alternative weights corresponding to the alternative statements; the average of the alternative weights is determined as the target violation index.
And A3, determining a violation index threshold according to each target violation index.
After the target violation indexes of each alternative violation image are determined, analyzing the target violation indexes, determining the distribution condition of the target violation indexes, namely the range of most of the target violation indexes, and determining violation index threshold values according to the distribution rule. When the violation index threshold is set to be too low, the excessive non-violation images are judged to be violation images, so that the accuracy rate is low; when the violation index threshold is set to be too high, too many violation images cannot be judged correctly, so that the accuracy rate is gradually reduced.
As an optional embodiment of this embodiment, this optional embodiment further optimizes the violation index threshold determination according to each target violation index as:
and A31, sorting the target violation indexes in descending order to form a violation index sequence.
In this embodiment, the violation index sequence may be specifically understood as a sequence obtained by arranging the target violation indexes according to a certain rule. And sequencing the violation indexes of the targets from large to small to form a violation index sequence.
And A32, determining the arrangement position of the targets according to the preset number and the preset proportion.
In this embodiment, the preset ratio may be 10%, 5%, or the like, and may be set by the user, and may be adjusted in real time during the image detection process. The preset proportion may be a discarding proportion or a retaining proportion, for example, the preset proportion is 5% of discarding, when the violation index threshold is determined, the violation index threshold is determined by discarding 5% of target violation indexes, the preset proportion is 95% of retaining, when the violation index threshold is determined, the violation index threshold is determined by retaining 95% of target violation indexes, and the violation index thresholds are substantially the same. The target alignment position may be specifically understood as a designated position in the violation index sequence. And calculating the product n of the preset number and the preset proportion, if the preset proportion is the target violation index which needs to be discarded, discarding smaller n target violation indexes from small to large, and determining the position of the (n + 1) th target violation index as the target arrangement position.
And A33, screening a target violation index matched with the target arrangement position from the violation index sequence, and determining the violation index as a violation index threshold.
And determining a target violation index matched with the target arrangement position in the violation index sequence, and determining the target violation index as a violation index threshold.
For example, if the preset number is 100 and the preset proportion is 5% of discard, the number of discard may be determined to be 5, the smallest 5 target violation indexes may be discarded, the 6 th position from the last is taken as a target ranking position, the 6 th target violation index from the small to the large in the violation index sequence is determined to be a violation index threshold, or the 95 th target violation index from the large to the small in the violation index sequence is determined to be a violation index threshold.
The image detection method provided by the application can be evaluated in the following mode, and illegal images and non-illegal images are used as samples to be detected. According to the method, Accuracy (Accuracy), Precision (Precision) and Recall (Recall) can be adopted as evaluation standards of the detection result, and the calculation formula of the Accuracy is as follows:
Figure BDA0003751017860000111
the calculation formula of the accuracy is as follows:
Figure BDA0003751017860000112
the recall ratio is calculated as follows:
Figure BDA0003751017860000113
wherein, TP is True Positive and indicates the value of the Positive example in the correctly detected sample, TN is True Negative and indicates the value of the Negative example in the correctly detected sample, FP is False Positive and indicates the value of the Positive example in the incorrectly detected sample, and FN is False Negative and indicates the value of the Negative example in the incorrectly detected sample. As can be seen, the accuracy rate represents an example of how much of the samples are predicted correctly, so that the accuracy rate can be used to represent how many violation index thresholds are set to effectively and accurately identify the violation images during violation detection of the images.
The embodiment provides an image detection method, which comprises the steps of obtaining an image to be detected and determining a text description sentence corresponding to the image to be detected; matching the text description sentence with a predetermined violation word dictionary to determine a violation sentence; determining violation weights corresponding to the violation statements, and determining violation indexes according to the violation weights; when the violation index is larger than the predetermined violation index threshold, the image to be detected is determined to be the violation image, the problem that the violation image cannot be accurately identified in the image detection process is solved, the violation sentence is determined by matching the text description sentence of the image to be detected with the violation dictionary, the violation index is further determined according to the violation weight corresponding to the violation sentence, the violation degree of the image to be detected can be accurately determined, and then whether the image to be detected is violated is judged by comparing the violation index with the violation index threshold, so that the accuracy of image detection is improved, and the violation image is effectively identified. The violation index threshold is determined by analyzing the distribution relation of the target violation indexes, the violation index threshold is reasonably set, and the violation image detection accuracy is improved.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an image detection apparatus according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes: an image acquisition module 31, an illegal sentence determination module 32, an illegal index determination module 33 and an illegal image detection module 34;
the image acquisition module 31 is configured to acquire an image to be detected and determine a text description sentence corresponding to the image to be detected;
the violation sentence determination module 32 is configured to match the text description sentence with a predetermined violation word dictionary, and determine a violation sentence;
an violation index determining module 33, configured to determine violation weights corresponding to the violation statements, and determine violation indexes according to the violation weights;
and the violation image detection module 34 is configured to determine that the image to be detected is a violation image when the violation index is greater than a predetermined violation index threshold.
The embodiment provides an image detection device, which solves the problem that an illegal image cannot be accurately identified in the image detection process, and can accurately determine the violation degree of the image to be detected by matching a text description sentence of the image to be detected with a word dictionary of the illegal word, further determining a violation index according to the violation weight corresponding to the violation sentence, and then judging whether the image to be detected is violated by comparing the violation index with a violation index threshold, so that the accuracy of image detection is improved, and the illegal image can be effectively identified.
Optionally, the image acquiring module 31 includes:
the model acquisition unit is used for acquiring a predetermined target text detection model;
and the text description sentence determining unit is used for inputting the image to be detected into the target text detection model and determining a file description sentence according to the output of the target text detection model.
Optionally, the violation statement determination module 32 includes:
the device comprises a dictionary obtaining unit, a dictionary obtaining unit and a rule setting unit, wherein the dictionary obtaining unit is used for obtaining a predetermined violation word dictionary which comprises at least one violation word;
and the illegal sentence determining unit is used for carrying out regular matching on the text description sentence and each illegal word and determining the matched illegal sentence.
Optionally, the violation index determining module 33 includes:
the violation weight determining unit is used for inquiring a predetermined weight information table according to each violation statement and determining the violation weight corresponding to each violation statement;
and the violation index determining unit is used for determining the average value of the violation weights as the violation index.
Optionally, the apparatus further comprises:
the alternative image acquisition module is used for acquiring a preset number of alternative violation images;
the target index module is used for determining a target violation index corresponding to each alternative violation image;
and the threshold determining module is used for determining violation index thresholds according to the target violation indexes.
Optionally, the target index module includes:
the alternative description sentence determining unit is used for determining an alternative description sentence corresponding to each alternative violation image;
the alternative sentence determining unit is used for matching the alternative description sentence with a predetermined illegal word dictionary to determine an alternative sentence;
and the target index determining unit is used for determining the alternative weight corresponding to each alternative statement and determining a target violation index according to each alternative weight.
Optionally, the threshold determining module includes:
the index sequence forming unit is used for sequencing the violation indexes of the targets from large to small to form a violation index sequence;
the target position determining unit is used for determining target arrangement positions according to the preset number and the preset proportion; and the threshold value determining unit is used for screening out the target violation indexes matched with the target arrangement positions from the violation index sequence and determining the violation indexes as violation index threshold values.
The image detection device provided by the embodiment of the invention can execute the image detection method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Example four
FIG. 4 shows a schematic block diagram of an electronic device 40 that may be used to implement an embodiment of the invention. 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 assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), 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 inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 40 includes at least one processor 41, and a memory communicatively connected to the at least one processor 41, such as a Read Only Memory (ROM)42, a Random Access Memory (RAM)43, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 41 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM)42 or the computer program loaded from the storage unit 48 into the Random Access Memory (RAM) 43. In the RAM 43, various programs and data necessary for the operation of the electronic apparatus 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other via a bus 44. An input/output (I/O) interface 45 is also connected to bus 44.
A number of components in the electronic device 40 are connected to the I/O interface 45, including: an input unit 46 such as a keyboard, a mouse, etc.; an output unit 47 such as various types of displays, speakers, and the like; a storage unit 48 such as a magnetic disk, an optical disk, or the like; and a communication unit 49 such as a network card, modem, wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
Processor 41 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. Processor 41 performs the various methods and processes described above, such as the image detection method.
In some embodiments, the image detection method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 40 via the ROM 42 and/or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the image detection method described above may be performed. Alternatively, in other embodiments, the processor 41 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 circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a 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 that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage 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. Alternatively, the computer readable storage medium may be a machine readable signal medium. 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 an electronic device 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 a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can 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, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end 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 back-end, 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), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally 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 can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. An image detection method, comprising:
acquiring an image to be detected, and determining a text description sentence corresponding to the image to be detected;
matching the text description sentence with a predetermined violation word dictionary to determine a violation sentence;
determining violation weights corresponding to the violation statements, and determining violation indexes according to the violation weights;
and when the violation index is larger than a predetermined violation index threshold, determining that the image to be detected is a violation image.
2. The method according to claim 1, wherein the determining the text description sentence corresponding to the image to be detected comprises:
acquiring a predetermined target text detection model;
and inputting the image to be detected into the target text detection model, and determining a file description sentence according to the output of the target text detection model.
3. The method of claim 1, wherein matching the textual description sentence to a predetermined lexicon of offending words to determine an offending sentence comprises:
acquiring a predetermined violation word dictionary, wherein the violation word dictionary comprises at least one violation word;
and performing regular matching on the text description sentences and the illegal words, and determining the illegal sentences which are successfully matched.
4. The method of claim 1, wherein determining the violation weight for each violation statement and determining a violation index based on each violation weight comprises:
inquiring a predetermined weight information table according to each violation statement, and determining violation weights corresponding to the violation statements;
an average of each of the violation weights is determined as a violation index.
5. The method according to any of claims 1-4, wherein the violation index threshold determining step comprises:
acquiring a preset number of alternative violation images;
determining a target violation index corresponding to each alternative violation image;
a violation index threshold is determined based on each of the target violation indices.
6. The method of claim 5, wherein the determining a target violation index corresponding to each of the candidate violation images comprises:
determining an alternative description sentence corresponding to each alternative violation image;
matching the alternative description sentence with a predetermined illegal word dictionary to determine an alternative sentence;
and determining alternative weights corresponding to the alternative sentences, and determining a target violation index according to the alternative weights.
7. The method of claim 5, wherein determining violation index thresholds according to each of the target violation indices comprises:
sequencing the target violation indexes in a descending order to form a violation index sequence;
determining the arrangement positions of the targets according to the preset number and the preset proportion;
and screening out a target violation index matched with the target arrangement position from the violation index sequence, and determining the violation index as a violation index threshold.
8. An image detection apparatus, characterized by comprising:
the image acquisition module is used for acquiring an image to be detected and determining a text description sentence corresponding to the image to be detected;
the illegal sentence determining module is used for matching the text description sentence with a predetermined illegal word dictionary and determining an illegal sentence;
the violation index determining module is used for determining violation weights corresponding to the violation sentences and determining violation indexes according to the violation weights;
and the violation image detection module is used for determining that the image to be detected is a violation image when the violation index is larger than a predetermined violation index threshold.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the image detection method of any one of claims 1-7.
10. A computer-readable storage medium storing computer instructions for causing a processor to perform the image detection method of any one of claims 1-7 when executed.
CN202210842832.2A 2022-07-18 2022-07-18 Image detection method and device, electronic equipment and storage medium Pending CN115050029A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210842832.2A CN115050029A (en) 2022-07-18 2022-07-18 Image detection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210842832.2A CN115050029A (en) 2022-07-18 2022-07-18 Image detection method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115050029A true CN115050029A (en) 2022-09-13

Family

ID=83166453

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210842832.2A Pending CN115050029A (en) 2022-07-18 2022-07-18 Image detection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115050029A (en)

Similar Documents

Publication Publication Date Title
CN113408280A (en) Negative example construction method, device, equipment and storage medium
CN117235608A (en) Risk detection method, risk detection device, electronic equipment and storage medium
CN115600607A (en) Log detection method and device, electronic equipment and medium
CN115601042A (en) Information identification method and device, electronic equipment and storage medium
CN115630708A (en) Model updating method and device, electronic equipment, storage medium and product
CN115050029A (en) Image detection method and device, electronic equipment and storage medium
CN114882388A (en) Method, device, equipment and medium for training and predicting multitask model
CN112818972A (en) Method and device for detecting interest point image, electronic equipment and storage medium
CN117112445B (en) Machine learning model stability detection method, device, equipment and medium
CN116629620B (en) Risk level determining method and device, electronic equipment and storage medium
CN117574146B (en) Text classification labeling method, device, electronic equipment and storage medium
CN114037058B (en) Pre-training model generation method and device, electronic equipment and storage medium
CN115497633B (en) Data processing method, device, equipment and storage medium
CN116186536A (en) Risk prediction method, risk prediction device, electronic equipment and storage medium
CN117197051A (en) Defect grading method and device, electronic equipment and storage medium
CN115455940A (en) Text error correction method and device, electronic equipment and storage medium
CN116431809A (en) Text labeling method, device and storage medium based on bank customer service scene
CN117668294A (en) Face library creation and video identification methods and devices and electronic equipment
CN115392399A (en) Method, device, equipment and medium for training and using process timeout prediction model
CN117708655A (en) Cultural knowledge calculation method based on large language model
CN116225767A (en) Log fault classification model training method, device, equipment and storage medium
CN116862020A (en) Training method of text classification model, text classification method and device
CN114912541A (en) Classification method, classification device, electronic equipment and storage medium
CN117609723A (en) Object identification method and device, electronic equipment and storage medium
CN117764052A (en) Method, device, equipment and medium for checking text similarity degree

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