Picture violation detection method, device and system based on multi-granularity model and medium

Through the multi-grained model, the feature extraction and feature vectorization processing of pictures in financial scenarios, combined with feature comparison, the problem of illegal detection brought about by image diversity in financial scenarios is solved, and the detection quality and performance are improved.

CN118968187APending Publication Date: 2024-11-15PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411185518.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

It is difficult for the existing technology to conduct accurate and reliable quality inspections on various pictures in the process of chatting between customer service and customers in financial scenarios, especially the pictures often contain text information, resulting in poor detection results.

Method used

The image violation detection method based on a multi-grained model is adopted. By obtaining image data, extracting feature information, and using a multi-grained model for feature vector processing and feature comparison, combined with a preset feature vector pool, the abnormal score is calculated to output the detection result. This method includes feature extraction, region segmentation, key visual element recognition, parallel feature processing and efficient feature comparison to adapt to image features at different levels.

Benefits of technology

It improves the quality and performance of image violation detection, solves the problem of image diversity, enhances resource utilization efficiency, and achieves efficient violation identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118968187A_ABST
    Figure CN118968187A_ABST
Patent Text Reader

Abstract

The invention discloses a picture violation detection method, device and system based on a multi-granularity model and a medium. The method comprises the following steps: acquiring picture data to be detected; inputting the picture data into a trained feature extraction model, and extracting feature information of the picture data; calling a target processing module in the trained multi-granularity model according to the feature information of the picture data, and performing feature vectorization processing on the feature information to obtain a feature vector of the picture data; feature comparison is conducted on the feature vectors and a preset feature vector pool, the abnormal score of the picture data is obtained, and the feature vector pool comprises conventional feature vectors and violation feature vectors; and outputting a corresponding picture violation detection result according to the abnormal score. Different levels of features in the picture data are processed through the multi-granularity model, and meanwhile, efficient feature vector comparison is performed in the vector space, so that the problem of picture diversity is solved while the resource utilization efficiency is enhanced, and the quality and performance of picture violation detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of financial technology, and in particular to a method, device, system and medium for detecting image violations based on a multi-granularity model. Background Art

[0002] In order to monitor irregularities in financial scenarios, using artificial intelligence to provide customer service chat monitoring is an effective method. However, since abnormal labels are difficult to obtain, it becomes particularly important to adopt artificial intelligence models with few-shot learning. This model is widely needed in the detection of customer service irregularities in the financial field. By adopting artificial intelligence technology with few-shot learning, the process of detecting customer service irregularities can be simplified, thereby helping the financial industry protect related scenarios and improve security levels and customer trust.

[0003] At present, based on artificial intelligence models, it is possible to monitor violations and automatically detect whether there are any violations in the communication content between customer service and customers. The process is usually as follows: collect normal and illegal chat sample data, label and preprocess them, build its artificial intelligence model through training models, collect chat sample data for testing, label and preprocess them, and pass the test samples through the artificial intelligence model to obtain the predicted violation category and predicted violation score of the test samples. Based on the test results, the artificial intelligence model for customer service violation detection in financial scenarios is judged to determine whether it is available. If it is available, it is deployed to the production environment to monitor customer service violations.

[0004] However, in actual applications, the images involved in the chat process between customer service and customers are diverse and often contain text information, which is a huge challenge for artificial intelligence models. How to accurately and reliably inspect diverse images for violations is a problem that needs to be solved urgently. Summary of the invention

[0005] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide an image violation detection method, device, system and medium based on a multi-granularity model that can be applied to financial technology or other related fields. Its main purpose is to solve the problems caused by image diversity and improve the quality and performance of image violation detection.

[0006] The technical solution of the present invention is as follows:

[0007] A first aspect of the present invention provides a method for detecting image violations based on a multi-granularity model, comprising:

[0008] Get the image data to be detected;

[0009] Inputting the image data into a trained feature extraction model to extract feature information of the image data;

[0010] According to the feature information of the image data, a target processing module in the trained multi-granularity model is called to perform feature vectorization processing on the feature information of the image data to obtain a feature vector of the image data;

[0011] Comparing the feature vector of the image data with a preset feature vector pool to obtain an abnormality score of the image data, wherein the feature vector pool includes a regular feature vector and an illegal feature vector;

[0012] Output the corresponding image violation detection result according to the anomaly score.

[0013] In one embodiment, the step of inputting the image data into a trained feature extraction model to extract feature information of the image data includes:

[0014] Performing layout analysis on the image data to obtain overall distribution characteristics of the image data;

[0015] Performing region segmentation on the image data according to the overall distribution characteristics, and identifying connected domains in the image data;

[0016] The regional segmentation results are merged and optimized according to the identified connected domains to obtain several image regions;

[0017] Feature extraction is performed on each image region to obtain feature information of each image region.

[0018] In one embodiment, extracting features from each image region to obtain feature information of each image region includes:

[0019] Identify the aspect ratio of each image region and the key visual elements in each image region, wherein the key visual elements include at least one of a table element, a text element, and a sub-image element;

[0020] According to the aspect ratio of each image region and the recognition results of the key visual elements of each image region, feature extraction is performed on each image region according to a preset extraction strategy to obtain feature information of each image region.

[0021] In one embodiment, calling the target processing module in the trained multi-granularity model according to the feature information of the image data, performing feature vectorization processing on the feature information of the image data, and obtaining the feature vector of the image data includes:

[0022] According to the feature information of each image region, the corresponding target processing module in the multi-granularity model is called respectively, and the feature vectorization processing is performed on each image region in parallel to obtain the feature vector of each image region;

[0023] The feature vectors of all the image regions are subjected to feature fusion processing to obtain the feature vectors of the image data.

[0024] In one embodiment, performing feature comparison between the feature vector of the image data and a preset feature vector pool to obtain an abnormality score of the image data specifically includes:

[0025] Calling a target feature comparison method in a similar vector retrieval library to perform feature comparison between the feature vector of the image data and each feature vector in a preset feature vector pool;

[0026] The anomaly score of the image data is calculated according to the feature comparison result.

[0027] In one embodiment, before acquiring the image data to be detected, the method further includes:

[0028] Collect historical image data, and mark the historical image data as regular images or illegal images;

[0029] Inputting the regular pictures and the illegal pictures into the trained feature extraction model and the multi-granularity model, performing feature extraction and feature vectorization processing in sequence, and obtaining regular feature vectors and illegal feature vectors;

[0030] A feature vector pool is constructed according to the regular feature vectors and the illegal feature vectors.

[0031] In one embodiment, after constructing a feature vector pool according to the regular feature vectors and the illegal feature vectors, the method further includes:

[0032] In response to the feature vector update instruction, a new feature vector is dynamically inserted into the feature vector pool or a corresponding feature vector is deleted.

[0033] A second aspect of the present invention provides a device for detecting image violations based on a multi-granularity model, comprising:

[0034] An acquisition module is used to acquire image data to be detected;

[0035] A feature extraction module, used to input the image data into a trained feature extraction model to extract feature information of the image data;

[0036] A multi-granularity processing module, used to call a target processing module in a trained multi-granularity model according to the feature information of the image data, perform feature vectorization processing on the feature information of the image data, and obtain a feature vector of the image data;

[0037] A feature comparison module, used for comparing the feature vector of the image data with a preset feature vector pool to obtain an abnormality score of the image data, wherein the feature vector pool includes a regular feature vector and an illegal feature vector;

[0038] The detection output module is used to output the corresponding image violation detection result according to the anomaly score.

[0039] A third aspect of the present invention provides a picture violation detection system based on a multi-granularity model, the system comprising at least one processor; and

[0040] a memory communicatively connected to the at least one processor; wherein,

[0041] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned image violation detection method based on the multi-granularity model.

[0042] A fourth aspect of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned image violation detection method based on the multi-granularity model.

[0043] Beneficial effects: The present invention discloses a method, device, system and medium for detecting image violations based on a multi-granularity model. Compared with the prior art, the embodiments of the present invention obtain image data to be detected; input the image data into a trained feature extraction model to extract feature information of the image data; call the target processing module in the trained multi-granularity model according to the feature information of the image data, perform feature vectorization processing on the feature information, and obtain a feature vector of the image data; perform feature comparison between the feature vector and a preset feature vector pool to obtain an abnormal score of the image data, wherein the feature vector pool includes conventional feature vectors and violation feature vectors; and output the corresponding image violation detection result according to the abnormal score. The multi-granularity model is used to process features at different levels in the image data, and efficient feature vector comparison is performed in the vector space at the same time, which not only enhances resource utilization efficiency but also solves the problem of image diversity, thereby improving the quality and performance of image violation detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0045] Figure 1 A flow chart of a method for detecting image violations based on a multi-granularity model provided by an embodiment of the present invention;

[0046] Figure 2 A flow chart of step S102 in the method for detecting image violations based on a multi-granularity model provided in an embodiment of the present invention;

[0047] Figure 3 A flow chart of step S204 in the method for detecting image violations based on a multi-granularity model provided in an embodiment of the present invention;

[0048] Figure 4 A flow chart of step S103 in the image violation detection method based on a multi-granularity model provided in an embodiment of the present invention;

[0049] Figure 5 A flow chart of step S104 in the image violation detection method based on a multi-granularity model provided in an embodiment of the present invention;

[0050] Figure 6 A flow chart of a feature vector pool construction process in a method for detecting image violations based on a multi-granularity model provided in an embodiment of the present invention;

[0051] Figure 7 A schematic diagram of functional modules of a device for detecting image violations based on a multi-granularity model provided by an embodiment of the present invention;

[0052] Figure 8 A schematic diagram of the hardware structure of an image violation detection system based on a multi-granularity model provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. The embodiments of the present invention are described below in conjunction with the accompanying drawings.

[0054] In order to monitor irregularities in financial scenarios, using artificial intelligence to provide customer service chat monitoring is an effective method. However, since abnormal labels are difficult to obtain, it becomes particularly important to adopt artificial intelligence models with few-shot learning. This model is widely needed in the detection of customer service irregularities in the financial field. By adopting artificial intelligence technology with few-shot learning, the process of detecting customer service irregularities can be simplified, thereby helping the financial industry protect related scenarios and improve security levels and customer trust.

[0055] At present, based on artificial intelligence models, it is possible to monitor violations and automatically detect whether there are any violations in the communication content between customer service and customers. The process is usually as follows: collect normal and illegal chat sample data, label and preprocess them, build its artificial intelligence model through training models, collect chat sample data for testing, label and preprocess them, and pass the test samples through the artificial intelligence model to obtain the predicted violation category and predicted violation score of the test samples. Based on the test results, the artificial intelligence model for customer service violation detection in financial scenarios is judged to determine whether it is available. If it is available, it is deployed to the production environment to monitor customer service violations.

[0056] However, in actual applications, the images involved in the chat process between customer service and customers are diverse and often contain text information, which is a huge challenge for artificial intelligence models. How to accurately and reliably inspect diverse images for violations is a problem that needs to be solved urgently.

[0057] In order to solve the above problems, the present invention proposes a method for detecting image violations based on a multi-granularity model. Figure 1 , Figure 1 A flowchart of an embodiment of a method for detecting image violations based on a multi-granularity model provided by the present invention. The system architecture of the method for detecting image violations based on a multi-granularity model provided in this embodiment may include a first terminal device, a second terminal device, a third terminal device, a network and a server. The network is used to provide a medium for a communication link between the first terminal device, the second terminal device, the third terminal device and the server. The network may include various connection types, such as wired and / or wireless communication links, etc.

[0058] The user may use the first terminal device, the second terminal device, and the third terminal device to interact with the server through the network to receive or send messages, etc. Various communication client applications may be installed on the first terminal device, the second terminal device, and the third terminal device, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (only as examples).

[0059] The first terminal device, the second terminal device, and the third terminal device may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0060] The server may be a server that provides various services, such as a background management server that provides support for the content browsed by the user using the first terminal device, the second terminal device, and the third terminal device (for example only). The background management server may analyze and process the received data such as the user request, and feed back the processing results (such as web pages, information, or data obtained or generated according to the user request) to the terminal device. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server for a distributed system, or a server combined with a blockchain.

[0061] It should be noted that the image violation detection method based on the multi-granularity model provided in the embodiment of the present invention can generally be executed by the first terminal device, the second terminal device or the third terminal device. Correspondingly, the image violation detection device based on the multi-granularity model provided in the embodiment of the present invention can also be set in the first terminal device, the second terminal device or the third terminal device.

[0062] Alternatively, the image violation detection method based on the multi-granularity model provided by the embodiment of the present invention can also be generally performed by a server. Accordingly, the image violation detection device based on the multi-granularity model provided by the embodiment of the present invention can generally be arranged in a server. The image violation detection method based on the multi-granularity model provided by the embodiment of the present invention can also be performed by a server or server cluster that is different from the server and can communicate with the first terminal device, the second terminal device, the third terminal device and / or the server. Correspondingly, the image violation detection device based on the multi-granularity model provided by the embodiment of the present invention can also be arranged in a server or server cluster that is different from the server and can communicate with the first terminal device, the second terminal device, the third terminal device and / or the server.

[0063] It should be understood that the numbers of the above terminal devices, networks and servers are only illustrative. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0064] like Figure 1 As shown, the image violation detection method based on the multi-granularity model provided in this embodiment specifically includes the following steps:

[0065] S101, obtaining image data to be detected.

[0066] In this embodiment, in the picture violation detection scenario of the financial industry, the picture data to be detected can be the interactive communication pictures between the customer service and the customer during the service process, ensuring that the picture content sent by the customer service during the communication with the customer complies with the regulations and laws and regulations of the financial industry to prevent improper behavior or information leakage. The specific picture data to be detected can be, for example, documents or charts sent by the customer service when answering customer questions, which need to be ensured to contain no misleading information or illegal content; pictures sent by the customer service when promoting products or services, which need to be ensured to contain no false propaganda or illegal information; screenshots or schematic diagrams sent by the customer service when guiding customers to conduct transactions or operations, which need to ensure the accuracy and security of the information; pictures sent by the customer service when making risk notifications or disclaimers, which need to ensure the compliance and clarity of the content, etc. By obtaining pictures in the process of customer service and customer communication for violation detection, the risks of the financial industry can be effectively reduced, the interests of customers and institutions can be protected, and a good customer service experience can be maintained.

[0067] In one embodiment, after acquiring the image data to be detected, the method further includes:

[0068] Preprocess the image data to be detected.

[0069] In this embodiment, after the image data to be detected is obtained, the image data is further preprocessed to improve the accuracy of subsequent violation detection. Specifically, the image data can be preprocessed by scaling and adjusting the contrast, wherein the scaling operation can use an image processing library (such as OpenCV, PIL / Pillow, scikit-image, etc.) to adjust the size of the image to meet the requirements of the model input, which helps the model to learn and process more effectively; the contrast can be adjusted by using the functions in the image processing library to change the brightness and contrast parameters of the image to enhance the visual effect of the image, making the features more obvious, which helps to improve the feature extraction ability of the model.

[0070] Preferably, further preprocessing can be performed by methods such as normalization, data enhancement, noise removal, background removal, etc., wherein normalization can scale the pixel values ​​of the image to a specific range, speed up the model training speed, and improve numerical stability; data enhancement includes random transformations such as rotation, flipping, scaling, cropping, color jittering, etc., so as to increase data diversity and reduce overfitting; noise removal can use filters (such as Gaussian filtering, median filtering, etc.) to smooth the image, reduce random noise in the image, and improve the image quality; background removal can separate the foreground and background through image segmentation technology, and remove the background to reduce unnecessary information interference.

[0071] S102: Input the image data into a trained feature extraction model to extract feature information of the image data.

[0072] In this embodiment, the image data is input into a pre-trained feature extraction model, and the feature extraction model is used to identify the image type and extract the corresponding feature information according to the specific attributes of the image: i =Φ(i pre ), where i pre is the image data, and Φ is the feature extraction model. That is, the main task of the feature extraction model is to extract features that are helpful for analyzing and understanding data from the original image data or the preprocessed image data. These features can be pixel values, color histograms, edge information, texture information, shape descriptors, etc. These features are used to identify the type of image data (simple or complex), and extract corresponding feature information according to specific attributes of the image (such as aspect ratio, whether it contains a table, whether it contains a sub-image module, etc.). The feature extraction module can be implemented by models such as convolutional neural network (CNN) and residual network (ResNet), which is not limited in this embodiment.

[0073] Specifically, the feature information output by the feature extraction model is simple image features, complex image features, simple image and text features, and complex image and text features. That is, the feature extraction model can distinguish the feature information of the image data as simple image features or complex image features based on information such as whether the aspect ratio of the image is too large, whether the image contains a table, whether the image contains a sub-image module, etc., and further confirm whether the image contains text through text recognition. If it contains text, the feature information of the image data is further distinguished as simple image and text features or complex image and text features. In this way, the features of a variety of images with different levels of complexity can be distinguished in image violation detection to facilitate targeted processing and improve the performance of image violation detection.

[0074] In one embodiment, Figure 2 As shown, step S102 includes:

[0075] S201, performing layout analysis on the image data to obtain overall distribution characteristics of the image data;

[0076] S202, performing region segmentation on the image data according to the overall distribution characteristics, and identifying connected domains in the image data;

[0077] S203, merging and optimizing the region segmentation results according to the identified connected domains to obtain a plurality of image regions;

[0078] S204: Extract features from each image region to obtain feature information of each image region.

[0079] In this embodiment, the overall distribution characteristics of the image are first globally identified, and the regional segmentation of the image is guided based on the overall distribution characteristics before feature extraction processing is performed. This makes it possible to perform feature extraction processing in a more targeted manner when extracting features from complex images, especially images with obvious regional feature differences, thereby saving processing resources and improving processing efficiency.

[0080] Specifically, firstly, a global layout analysis is performed on the entire image to identify the overall distribution characteristics of the image, such as color and brightness analysis, texture analysis, shape and structure analysis, etc., of the image data to obtain the color distribution, brightness distribution, problem characteristics, edge information and intersection information of the image, etc. According to the results of the overall feature recognition, the image is segmented into multiple regions by a segmentation method based on a threshold or a clustering algorithm (such as K-means). In order to improve the accuracy of regional segmentation, the present embodiment further identifies and analyzes the connected domains in the image data, thereby identifying regions with similar features, and based on the identified connected domains, the regional segmentation results are merged and optimized by morphological operations (such as expansion, corrosion) or regional merging algorithms, that is, adjacent or overlapping regions are merged to improve the accuracy of regional segmentation, reduce segmentation errors, and obtain a number of more accurate and meaningful image regions. Feature extraction is performed on each image region obtained by segmentation to obtain feature information of each image region. Since each image region may have different characteristics and complexity, more accurate and targeted feature information can be achieved through feature extraction of the segmented regions. For example, basic visual features are extracted for simple regions, such as color histograms, edge information, etc.; more advanced features are extracted for complex regions, such as object recognition features, scene understanding features, etc., which provides reliable data for subsequent feature processing while reasonably balancing computing resources.

[0081] In one embodiment, Figure 3 As shown, step S204 includes:

[0082] S301, identifying the aspect ratio of each picture area and the key visual elements in each picture area, wherein the key visual elements include at least one of a table element, a text element, and a sub-picture element;

[0083] S302 , based on the aspect ratio of each image region and the recognition result of the key visual element of each image region, perform feature extraction on each image region according to a preset extraction strategy to obtain feature information of each image region.

[0084] In this embodiment, when extracting features from each image area, a visual inspection is first performed on each segmented area to identify the aspect ratio of each image area and determine whether it contains key visual elements, such as table elements, text elements, sub-image elements, etc. Feature extraction is performed on each image area according to a preset extraction strategy based on the visual detection result. Specifically, when the aspect ratio of the image area is less than a threshold and does not contain any key visual element, simple image feature extraction is performed on the image area, such as extracting color features such as a color histogram, and extracting texture features using a gray-level co-occurrence matrix (GLCM) or a local binary pattern (LBP); when the aspect ratio of the image area is less than a threshold and only contains text elements, the image area is extracted. Perform simple image and text feature extraction, such as further using OCR technology to detect and extract text content based on simple image feature extraction; when the aspect ratio of the image area is greater than or equal to the threshold, or contains any key visual elements other than text elements, perform complex image feature extraction on the image area, such as extracting more advanced features, such as object recognition features, scene understanding features, etc.; when the aspect ratio of the image area is greater than or equal to the threshold, or contains any two key visual elements including text elements, perform complex image and text feature extraction on the image area, such as analyzing the correlation between text and image content, extracting features of the combination of image and text, and further analyzing the recognized text, such as sentiment analysis, keyword extraction, semantic understanding, etc.

[0085] S103 . Calling a target processing module in a trained multi-granularity model according to the feature information of the image data, performing feature vectorization processing on the feature information of the image data, and obtaining a feature vector of the image data.

[0086] In this embodiment, the feature information F output by the feature extraction model is i The multi-granularity model is input into a pre-trained multi-granularity model. The multi-granularity model is provided with multiple feature processing modules Ψ for features at different levels. Specifically, the multi-granularity model includes a simple image and text processing module, a complex image and text processing module, a simple image processing module, and a complex image processing module. Therefore, the target processing module in the multi-granularity model can be called based on the extracted feature information. For example, a lightweight network may be used for a simple image, while a more complex network structure may be used for a complex image and text. The feature information of the image data is vectorized to obtain the feature vector F of the image data. v =Ψ(F i ). Through the multi-granularity model, different levels of features in the image data can be processed. Different levels of features can be processed with different hardware resources, which can enhance resource utilization efficiency and improve the accuracy of violation identification.

[0087] In one embodiment, calling the target processing module in the trained multi-granularity model according to the feature information of the image data includes:

[0088] When the feature information of the image data is a simple image feature, calling a simple image processing module in a trained multi-granularity model;

[0089] When the feature information of the image data is a complex image feature, calling a complex image processing module in a trained multi-granularity model;

[0090] When the feature information of the image data is a simple image and text feature, calling a simple image and text processing module in a trained multi-granularity model;

[0091] When the feature information of the image data is a complex image and text feature, the complex image and text processing module in the trained multi-granularity model is called.

[0092] In this embodiment, if the image data to be detected is a simple image, the feature extraction model outputs simple image features. At this time, the feature information is input into the simple image processing module in the multi-granularity model for feature vectorization. The simple image processing module adopts the resnet50 model. ResNet-50 is a deep residual network that can solve the gradient disappearance problem in the deep network through jump connections. It performs well in image classification tasks and achieves a good balance between computational efficiency and accuracy. For simple images, a model that can quickly and accurately extract features and classify them is usually required. ResNet-50 provides an efficient solution for processing structured or relatively simple images.

[0093] If the image data to be detected is a complex image, the feature extraction model outputs the complex image features. At this time, the feature information is input into the complex image processing module in the multi-granularity model for feature vectorization. The complex image processing module uses the CLIP model. CLIP is pre-trained through contrastive learning and can understand the relationship between images and texts, which makes it perform well in processing complex images containing rich semantic information. Complex images may contain multiple objects, scenes or text information. CLIP can capture these complex visual and semantic features and provide rich information for subsequent analysis and processing.

[0094] If the image data to be detected is a simple image and text image, the feature extraction model outputs simple image and text features. At this time, the feature information is input into the simple image and text processing module in the multi-granularity model for feature vectorization processing. The simple image and text processing module adopts the CRNN model. CRNN combines convolutional neural network (CNN) and recurrent neural network (RNN), which is more suitable for processing text sequences in images, such as OCR tasks. Simple images and texts usually refer to images containing orderly arranged texts. Even in the presence of a certain degree of image noise or irregular text arrangement, CRNN can effectively recognize and process this type of text information.

[0095] If the image data to be detected is a complex image, the feature extraction model outputs complex image features. At this time, the feature information is input into the complex image processing module in the multi-granularity model for feature vectorization. The complex image processing module adopts the PPOCR model. PPOCR is a model designed for text recognition in complex scenes. It can handle curved text, multiple languages ​​and text recognition tasks in different fonts. Since complex images may contain multiple languages, artistic fonts or text in complex backgrounds, the highly robust and adaptable PPOCR can better handle such complex image data.

[0096] By setting up processing modules corresponding to various levels of image complexity in the multi-granularity model, we can ensure the best performance when detecting violations on different types of images. This modular design makes the image violation detection process more flexible and scalable, and can adapt to different application scenarios and needs.

[0097] In one embodiment, Figure 4 As shown, step S103 includes:

[0098] S401, calling the corresponding target processing modules in the multi-granularity model respectively according to the feature information of each image region, performing parallel feature vectorization processing on each image region, and obtaining a feature vector of each image region;

[0099] S402: Perform feature fusion processing on the feature vectors of all the image regions to obtain the feature vectors of the image data.

[0100] In this embodiment, when the image data is divided into several image regions according to regional characteristics and corresponding feature information is extracted, the corresponding target processing modules in the multi-granularity model are called respectively based on the feature information of the image regions, that is, if the feature information of the image region is a simple image feature, the simple image processing module is called accordingly to perform feature vectorization processing. The same is true for other feature information. After the corresponding target processing modules are called respectively based on the feature information of each regional image, each image region can be processed with feature vectorization in parallel to obtain the feature vectors of each image region, that is, multi-threading or distributed computing resources are used to call the target processing modules of each image region in parallel to improve the processing speed. The feature vectors of each image region are subjected to feature fusion processing according to the selected fusion strategy, such as simple feature splicing, weighted averaging, feature pooling, etc., to form a comprehensive feature vector of the image data, thereby comprehensively reflecting the global and local information of the entire image, and providing rich information for subsequent analysis and processing.

[0101] When this embodiment processes complex images, especially images with obvious regional feature differences, after segmenting the regions and extracting the feature information of each different image region, it calls the corresponding target processing module to perform parallel feature vectorization processing, which not only ensures the specialized processing of different types of regional features, improves the quality and diversity of feature expression, but also can significantly reduce the overall time of feature extraction.

[0102] S104, performing feature comparison between the feature vector of the image data and a preset feature vector pool to obtain an abnormality score of the image data, wherein the feature vector pool includes a regular feature vector and an illegal feature vector;

[0103] S105: Outputting corresponding image violation detection results according to the anomaly score.

[0104] In this embodiment, after the image is converted into a vector using vector representation, the feature vector of the image data is quickly retrieved in the vector space through a preset feature vector pool, and the feature vector of the image data is converted into F v and the feature vector V in the preset feature vector pool p Perform feature comparison. The preset feature vector pool stores regular feature vectors and illegal feature vectors. Through efficient feature comparison, you can quickly search for image vectors similar to the image to be detected to obtain the abnormal score of the image data. , judge whether the current image data is in violation of the rules based on the size of the anomaly score. For example, a threshold score for violation is preset. When the anomaly score is greater than the threshold score, it is confirmed that the current image data to be detected has a violation. Otherwise, there is no violation, thereby achieving efficient and accurate image violation detection.

[0105] Specifically, the faiss library can be used to achieve efficient feature comparison, quickly retrieve similar questions and answers, and improve response speed and accuracy. Faiss is an efficient similarity vector retrieval library. In image retrieval and classification, it can achieve image recognition and classification by finding images with similar features. It can quickly perform efficient feature comparison in the feature vector pool to quickly and efficiently obtain the anomaly score of the image data, thereby improving the efficiency of image violation detection.

[0106] In one embodiment, Figure 5 As shown, step S104 includes:

[0107] S501, calling a target feature comparison method in a similar vector retrieval library to perform feature comparison between a feature vector of the image data and each feature vector in a preset feature vector pool;

[0108] S502: Calculate anomaly scores of the image data according to feature comparison results.

[0109] In this embodiment, when performing feature comparison, it is implemented by calling the target feature comparison method in the similarity vector retrieval library. Specifically, the HNSW (Hierarchical Navigable Small World) algorithm in the faiss library can be called for feature comparison. The HNSW algorithm is a data structure for approximate nearest neighbor (ANN) search. It is based on the Small World network theory and uses multi-layer indexing to improve retrieval efficiency. HNSW maps data points into a high-dimensional space and constructs a small world network in this space. The network has efficient global search capabilities while retaining information on the local neighborhood structure. In this way, the rapidity of the retrieval speed can be guaranteed without sacrificing the retrieval accuracy. Based on the feature comparison results between the feature vector of the image data and each feature vector in the feature vector pool, an anomaly score is calculated. Specifically, the distance between the feature vector to be detected and each vector in the feature vector pool can be calculated, and the K vectors with the closest distance can be selected. The minimum distance or average distance between the vector to be detected and these nearest vectors is calculated, and the corresponding anomaly score is calculated in combination with the type of the K nearest vectors and the minimum distance or average distance. For example, the more the number of illegal feature vectors in the K vectors and the closer the distance to the illegal feature vectors, the higher the anomaly score. Conversely, the more the number of regular feature vectors in the K vectors and the closer the distance to the regular feature vectors, the lower the anomaly score. In this way, the multi-granularity model is combined with the vector database in the image violation quality inspection to obtain a quantitative judgment index, thereby improving the accuracy of violation detection.

[0110] In one embodiment, Figure 6 As shown, before obtaining the image data to be detected, the method further includes:

[0111] S601, collecting historical picture data, and marking the historical picture data as regular pictures or illegal pictures;

[0112] S602: input the regular pictures and illegal pictures into the trained feature extraction model and multi-granularity model, perform feature extraction and feature vectorization processing in sequence, and obtain regular feature vectors and illegal feature vectors;

[0113] S603: construct a feature vector pool according to the regular feature vectors and the illegal feature vectors.

[0114] In this embodiment, before performing image violation detection, historical image data is collected and a corresponding feature vector pool is constructed. Specifically, a certain amount of image data is collected, which can come from historical transaction records, user uploaded content, public data sets, etc., and the images are classified and labeled by professionals or using automated tools to distinguish between regular images and illegal images; similar to violation detection, the collected regular images and illegal images are input into the trained feature extraction model and multi-granularity model, and feature extraction and feature vectorization are performed in turn to obtain regular feature vectors and illegal feature vectors, thereby converting the image content into a mathematical representation that is easy to process for the machine learning model, which is helpful for rapid retrieval in the vector space, so that potential illegal images can be efficiently located during feature comparison, saving computing resources and time costs; the processed regular feature vectors and illegal feature vectors are stored in the database to construct a feature vector pool, which can not only avoid the overhead of repeated calculations and feature extraction, but also save computing resources. At the same time, the vector database can effectively reduce the storage space through efficient indexing and compression technology.

[0115] Preferably, after constructing a feature vector pool according to the regular feature vectors and the illegal feature vectors, the method further comprises:

[0116] In response to the feature vector update instruction, a new feature vector is dynamically inserted into the feature vector pool or a corresponding feature vector is deleted.

[0117] In this embodiment, the constructed feature vector pool can be flexibly expanded and updated. Based on the feature vector update instruction, new feature vectors can be dynamically inserted into the feature vector pool or existing feature vectors can be deleted. The feature vectors of illegal pictures can be updated in time to adapt to the ever-changing illegal content. Real-time updates of illegal quality inspections can be achieved, and effective identification of newly emerging illegal pictures can be maintained.

[0118] It should be noted that there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.

[0119] Another embodiment of the present invention provides a device for detecting image violations based on a multi-granularity model, such as Figure 7 As shown, the device 1 comprises:

[0120] An acquisition module 11 is used to acquire image data to be detected;

[0121] A feature extraction module 12 is used to input the image data into a trained feature extraction model to extract feature information of the image data;

[0122] The multi-granularity processing module 13 is used to call the target processing module in the trained multi-granularity model according to the feature information of the image data, perform feature vectorization processing on the feature information of the image data, and obtain the feature vector of the image data;

[0123] A feature comparison module 14 is used to compare the feature vector of the image data with a preset feature vector pool to obtain an abnormality score of the image data, wherein the feature vector pool includes a regular feature vector and an illegal feature vector;

[0124] The detection output module 15 is used to output the corresponding image violation detection result according to the anomaly score.

[0125] The module referred to in the present invention refers to a series of computer program instruction segments that can perform specific functions, which is more suitable for describing the execution process of image violation detection based on a multi-granularity model than a program. For the specific implementation of each module, please refer to the corresponding method embodiment above, which will not be repeated here.

[0126] In one embodiment, the feature extraction module 12 includes:

[0127] A layout analysis unit, used to perform layout analysis on the image data to obtain overall distribution characteristics of the image data;

[0128] The image segmentation unit performs region segmentation on the image data according to the overall distribution characteristics, and identifies connected domains in the image data;

[0129] A region merging unit is used to merge and optimize the region segmentation results according to the identified connected domains to obtain several image regions;

[0130] The region feature extraction unit is used to extract features from each image region to obtain feature information of each image region.

[0131] In one embodiment, the region feature extraction unit includes:

[0132] an identification unit, used to identify the aspect ratio of each image region and a key visual element in each image region, wherein the key visual element includes at least one of a table element, a text element and a sub-image element;

[0133] The feature extraction unit is used to extract features from each image region according to the aspect ratio of each image region and the recognition results of the key visual elements of each image region according to a preset extraction strategy to obtain feature information of each image region.

[0134] In one embodiment, the multi-granularity processing module 13 includes:

[0135] A regional parallel processing unit, used to call the corresponding target processing module in the multi-granularity model according to the feature information of each image region, perform parallel feature vectorization processing on each image region, and obtain a feature vector of each image region;

[0136] The feature fusion unit is used to perform feature fusion processing on the feature vectors of all image regions to obtain the feature vectors of the image data.

[0137] In one embodiment, the feature comparison module 14 includes:

[0138] A feature comparison unit is used for a target feature comparison method in a similar vector retrieval library to compare the feature vector of the image data with each feature vector in a preset feature vector pool;

[0139] A calculation unit is used to calculate the abnormality score of the image data according to the feature comparison result.

[0140] In one embodiment, the device 1 further comprises:

[0141] A collection module, used to collect historical image data and mark the historical image data as regular images or illegal images;

[0142] A processing module, used for inputting the regular pictures and illegal pictures into the trained feature extraction model and the multi-granularity model, performing feature extraction and feature vectorization processing in sequence, and obtaining regular feature vectors and illegal feature vectors;

[0143] A construction module is used to construct a feature vector pool according to the regular feature vector and the illegal feature vector.

[0144] In one embodiment, the device 1 further comprises:

[0145] The feature updating module is used to dynamically insert a new feature vector into the feature vector pool or delete a corresponding feature vector in response to a feature vector updating instruction.

[0146] Another embodiment of the present invention provides a picture violation detection system based on a multi-granularity model, such as Figure 8 As shown, the system 10 includes:

[0147] One or more processors 110 and memory 120, Figure 8 A processor 110 is used as an example for description. The processor 110 and the memory 120 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.

[0148] The processor 110 is used to complete various control logics of the system 10, and it can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component, or any combination of these components. In addition, the processor 110 can also be any traditional processor, microprocessor or state machine. The processor 110 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP and / or any other such configuration.

[0149] The memory 120, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions corresponding to the image violation detection method based on a multi-granularity model in the embodiment of the present invention. The processor 110 executes various functional applications and data processing of the system 10 by running the non-volatile software programs, instructions and units stored in the memory 120, that is, implementing the image violation detection method based on a multi-granularity model in the above method embodiment.

[0150] The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created according to the use of the system 10, etc. In addition, the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 120 may optionally include a memory remotely arranged relative to the processor 110, and these remote memories may be connected to the system 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0151] One or more units are stored in the memory 120 , and when executed by one or more processors 110 , the image violation detection method based on the multi-granularity model in any of the above method embodiments is executed.

[0152] An embodiment of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the image violation detection method based on a multi-granularity model in any of the above method embodiments is executed.

[0153] As an example, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM, (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The disclosed memory components or memories of the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.

[0154] In summary, the method, device, system and medium for detecting image violations based on a multi-granularity model disclosed in the present invention include: obtaining image data to be detected; inputting the image data into a trained feature extraction model to extract feature information of the image data; calling a target processing module in a trained multi-granularity model according to the feature information of the image data, performing feature vectorization processing on the feature information, and obtaining a feature vector of the image data; performing feature comparison between the feature vector and a preset feature vector pool to obtain an abnormality score of the image data, wherein the feature vector pool includes conventional feature vectors and violation feature vectors; and outputting a corresponding image violation detection result according to the abnormality score. By processing features at different levels in the image data through a multi-granularity model and performing efficient feature vector comparison in the vector space at the same time, resource utilization efficiency is enhanced while also solving the problem of image diversity, thereby improving the quality and performance of image violation detection.

[0155] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium, and the computer program can include the processes of the above-mentioned method embodiments when executed. The storage medium can be a memory, a disk, a floppy disk, a flash memory, an optical storage device, etc.

[0156] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. A method for detecting image violations based on a multi-granularity model, characterized in that: include: Get the image data to be detected; Inputting the image data into a trained feature extraction model to extract feature information of the image data; According to the feature information of the image data, a target processing module in the trained multi-granularity model is called to perform feature vectorization processing on the feature information of the image data to obtain a feature vector of the image data; Comparing the feature vector of the image data with a preset feature vector pool to obtain an abnormality score of the image data, wherein the feature vector pool includes a regular feature vector and an illegal feature vector; Output the corresponding image violation detection result according to the anomaly score.

2. The image violation detection method based on a multi-granularity model according to claim 1, characterized in that: The step of inputting the image data into a trained feature extraction model to extract feature information of the image data includes: Performing layout analysis on the image data to obtain overall distribution characteristics of the image data; Performing region segmentation on the image data according to the overall distribution characteristics, and identifying connected domains in the image data; The regional segmentation results are merged and optimized according to the identified connected domains to obtain several image regions; Feature extraction is performed on each image region to obtain feature information of each image region.

3. The image violation detection method based on a multi-granularity model according to claim 2 is characterized in that: The feature extraction of each image region to obtain feature information of each image region includes: Identify the aspect ratio of each image region and the key visual elements in each image region, wherein the key visual elements include at least one of a table element, a text element, and a sub-image element; According to the aspect ratio of each image region and the recognition results of the key visual elements of each image region, feature extraction is performed on each image region according to a preset extraction strategy to obtain feature information of each image region.

4. The method for detecting image violations based on a multi-granularity model according to claim 2, characterized in that: The step of calling a target processing module in a trained multi-granularity model according to the feature information of the image data, performing feature vectorization processing on the feature information of the image data, and obtaining a feature vector of the image data includes: According to the feature information of each image region, the corresponding target processing module in the multi-granularity model is called respectively, and the feature vectorization processing is performed on each image region in parallel to obtain the feature vector of each image region; The feature vectors of all the image regions are subjected to feature fusion processing to obtain the feature vectors of the image data.

5. The method for detecting image violations based on a multi-granularity model according to claim 1, characterized in that: The step of comparing the feature vector of the image data with a preset feature vector pool to obtain an abnormality score of the image data includes: Calling a target feature comparison method in a similar vector retrieval library to perform feature comparison between the feature vector of the image data and each feature vector in a preset feature vector pool; The anomaly score of the image data is calculated according to the feature comparison result.

6. The method for detecting image violations based on a multi-granularity model according to claim 1, characterized in that: Before obtaining the image data to be detected, the method further includes: Collect historical image data, and mark the historical image data as regular images or illegal images; Inputting the regular pictures and the illegal pictures into the trained feature extraction model and the multi-granularity model, performing feature extraction and feature vectorization processing in sequence, and obtaining regular feature vectors and illegal feature vectors; A feature vector pool is constructed according to the regular feature vectors and the illegal feature vectors.

7. The method for detecting image violations based on a multi-granularity model according to claim 6, characterized in that: After the feature vector pool is constructed according to the regular feature vector and the illegal feature vector, the method further includes: In response to the feature vector update instruction, a new feature vector is dynamically inserted into the feature vector pool or a corresponding feature vector is deleted.

8. A device for detecting image violations based on a multi-granularity model, characterized in that: include: An acquisition module is used to acquire image data to be detected; A feature extraction module, used to input the image data into a trained feature extraction model to extract feature information of the image data; A multi-granularity processing module, used to call a target processing module in a trained multi-granularity model according to the feature information of the image data, perform feature vectorization processing on the feature information of the image data, and obtain a feature vector of the image data; A feature comparison module, used for comparing the feature vector of the image data with a preset feature vector pool to obtain an abnormality score of the image data, wherein the feature vector pool includes a regular feature vector and an illegal feature vector; The detection output module is used to output the corresponding image violation detection result according to the anomaly score.

9. A picture violation detection system based on a multi-granularity model, characterized in that: The system includes at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the image violation detection method based on a multi-granularity model as described in any one of claims 1-7.

10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the image violation detection method based on a multi-granularity model as described in any one of claims 1-7.