Image credibility detection method, system and device and storage medium
By integrating visual features and metadata features in image reliability evaluation, forming a fusion feature vector, and using detection models for evaluation, the problems of inaccurate and incomplete evaluation results in the prior art are solved, and higher evaluation accuracy and reliability are achieved.
Patent Information
- Application Number
- CN202510123818.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2045-01-26
AI Technical Summary
The prior art has inaccurate and incomplete evaluation results due to insufficient integration of image metadata and visual features in image credibility assessment.
By extracting the visual features and metadata features of the target image and performing weighted fusion, a fusion feature vector is formed and evaluated using the trained confidence detection model.
It improves the accuracy and reliability of image credibility evaluation, provides comprehensive evaluation methods, can effectively deal with complex scenarios, and provides reliable evaluation methods for various fields that rely on image information.
Smart Images

Figure CN119600426A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to an image credibility detection method, system, device and storage medium. Background Art
[0002] In today's digital age, image information is growing explosively and is widely used in many fields such as news dissemination, social media, e-commerce, and judicial evidence. However, the development of digital image processing technology has also brought about a serious crisis of image credibility. On the one hand, powerful image editing software such as Adobe Photoshop makes it easy to forge and tamper with images, from simple color adjustments to complex object additions or removals, all without leaving obvious traces. On the other hand, the openness of the Internet makes the sources of images complicated, and users have almost no effective means to judge their authenticity when obtaining images.
[0003] Existing methods based only on visual features may misjudge images that have been carefully tampered with and look visually reasonable as credible. For example, some forged document images may not be able to detect traces of tampering through visual features alone, because the forger may keep the overall visual effect of the image consistent, but the present invention combined with metadata (such as the original issuance time of the document and the shooting time in the image metadata) can detect anomalies. This single visual feature method lacks consideration of the image source and related background information, and is easily deceived by forgers.
[0004] Methods that rely solely on metadata cannot accurately assess image credibility when the metadata is tampered with or missing. Moreover, even if the metadata is normal, it is impossible to determine whether the image content has been tampered with based on metadata alone, and the visual feature analysis of the present invention can make up for this deficiency. For example, if the metadata shows that the shooting device is normal, but there are obvious visual inconsistencies in the image content (such as the light and shadow effects of the object do not match the shooting device parameters), methods based only on metadata will not be able to identify this problem. Summary of the invention
[0005] The main purpose of the present invention is to provide an image credibility detection method, system, device and storage medium, which extracts the visual features and metadata features of the target image, performs weighted fusion, and then uses the trained credibility detection model for evaluation, aiming to improve the accuracy of image credibility evaluation, provide a comprehensive evaluation method, and enhance the reliability and practicality of the evaluation. This method can effectively cope with various complex scenarios and provide a reliable evaluation method for various fields that rely on image information.
[0006] In order to achieve the above objectives, the embodiments of the present application provide the following technical solutions: According to a first aspect of an embodiment of the present application, a method for detecting image credibility is provided, the method comprising: Extracting visual features from the target image to be detected, wherein the visual features include color features, texture features and shape features; Performing weighted fusion of the visual features and metadata features to obtain a fused feature vector; the metadata features represent image attribute information; The credibility detection model is called to detect the credibility of the target image according to the fused feature vector.
[0007] Optionally, extracting visual features from the target image to be detected includes: Convert the target image from the RGB color space to the HSV color space, and calculate a color histogram to generate a color feature; Converting the target image into a grayscale image, calculating a grayscale co-occurrence matrix, and extracting texture feature statistics to generate texture features; Perform edge detection and contour extraction on the target image to generate shape features.
[0008] Optionally, a color histogram is calculated to generate a color feature, including: Determine the number and range of quantization intervals for each channel in the HSV color space; According to the number of quantization intervals of each channel, a vector whose length is the sum of the number of quantization intervals of all channels is initialized; Starting from the first pixel of the target image, traverse each pixel in the target image row by row and column by column to obtain the H, S, and V values of the pixel in the HSV space; For the currently traversed pixel, the index is calculated according to the H, S, V values and quantization interval in the HSV space, and the count of the corresponding position is updated; After traversing all pixels, the color features are obtained, which represent the number of pixels in each quantization interval.
[0009] Optionally, the step of calculating a gray level co-occurrence matrix and extracting texture feature statistics to generate texture features includes: Initialize a gray level co-occurrence matrix according to the set gray level; Starting from the first pixel of the target image, traverse each pixel in the target image row by row and column by column; For each pixel, find the corresponding pixel pair according to the set distance and the set angle; obtain the grayscale value of the currently traversed pixel pair, and add 1 to the value of the position in the grayscale co-occurrence matrix; After traversing all pixel pairs that meet the conditions, the gray level co-occurrence matrix is constructed, and the gray level co-occurrence matrix represents the distribution of pixel pairs in the target image at different gray levels; The texture feature statistics are calculated using the gray level co-occurrence matrix, and the texture feature statistics are arranged in sequence to generate texture features.
[0010] Optionally, performing edge detection and contour extraction on the target image to generate shape features includes: Perform edge detection on the target image using an edge detection algorithm to obtain an edge image; Extracting contours from the edge image using a contour extraction function; determining whether each extracted contour is a closed contour; Calculating shape features of each closed contour, the shape features including the area of a region enclosed by the closed contour, the perimeter of the closed contour, the circularity, and the area of a minimum rectangle containing the closed contour; Combine all shape features into a vector as the shape feature.
[0011] Optionally, calling a credibility detection model to detect the credibility of the target image according to the fused feature vector includes: Inputting the fused feature vector into the credibility detection model, and outputting the credibility score of the target image; Whether the target image is credible is determined according to a set threshold and the credibility score.
[0012] Optionally, the credibility detection model is trained according to the following steps: Input a number of image samples with labeled credibility into the credibility detection model to be trained, and initialize the model parameters; The credibility detection model predicts credibility through forward propagation calculation; Calculate a loss function value according to the predicted credibility and the marked credibility; Determine whether the condition for stopping training is met according to the loss function value; if the condition for stopping training is not met, perform back propagation to calculate the gradient to update the model parameters; If the conditions for stopping training are met, the trained credibility detection model is output.
[0013] According to a second aspect of an embodiment of the present application, there is provided an image credibility detection system, the system comprising: A feature extraction module is used to extract visual features from the target image to be detected, wherein the visual features include color features, texture features and shape features; A feature fusion module, used for weighted fusion of the visual features and metadata features to obtain a fused feature vector; the metadata features represent image attribute information; The credibility detection module is used to call the credibility detection model to detect the credibility of the target image according to the fused feature vector.
[0014] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.
[0015] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. The computer-readable instructions can be executed by a processor to implement the method described in the first aspect above.
[0016] In summary, the embodiments of the present application provide an image credibility detection method, system, device and storage medium, which extracts visual features from the target image to be detected, wherein the visual features include color features, texture features and shape features; weightedly fuses the visual features with metadata features to obtain a fused feature vector; the metadata features represent image attribute information; and calls a credibility detection model to detect the credibility of the target image according to the fused feature vector. By extracting the visual features and metadata features of the target image, performing weighted fusion, and then using the trained credibility detection model for evaluation, the aim is to improve the accuracy of image credibility evaluation, provide a comprehensive evaluation method, and enhance the reliability and practicality of the evaluation. This method can effectively cope with various complex scenarios and provide reliable evaluation methods for various fields that rely on image information. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0018] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.
[0019] Figure 1 A schematic diagram of a method for detecting image credibility provided in an embodiment of the present application; Figure 2 A system architecture diagram provided for an embodiment of the present application; Figure 3 A feature extraction flow chart provided for an embodiment of the present application; Figure 4 A schematic diagram of model training provided in an embodiment of the present application; Figure 5 A schematic diagram of an image credibility detection system provided in an embodiment of the present application; Figure 6 A structural diagram of an electronic device provided in an embodiment of the present application is shown; Figure 7 A diagram showing a computer-readable storage medium provided by an embodiment of the present application.
[0020] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0023] Figure 1 An image credibility detection method provided by an embodiment of the present application is shown, and the method comprises: Step 101: extracting visual features from a target image to be detected, wherein the visual features include color features, texture features, and shape features; Step 102: weighted fusion of the visual features and metadata features to obtain a fused feature vector; the metadata features represent image attribute information; Step 103: calling a credibility detection model to detect the credibility of the target image according to the fused feature vector.
[0024] By extracting the color features, texture features, and shape features of the target image, the visual content information of the image can be fully captured. Color features can reflect the color distribution of the image, texture features can capture the detailed texture of the image, and shape features can describe the outline and shape of the object in the image. These visual features reflect the visual characteristics of the image from different angles, providing rich information for subsequent credibility assessment. Metadata features represent the attribute information of the image, such as shooting time, device model, geographic location, etc. This information provides background information about the generation and source of the image, which helps to assess its credibility from the perspective of the image generation environment and conditions. Weighted fusion of visual features and metadata features can comprehensively consider the visual content and generation background of the image, making the assessment results more comprehensive and accurate. Call the trained credibility detection model to detect the credibility of the target image based on the fused feature vector. By learning a large number of image samples with labeled credibility, the model can identify the mapping relationship between image features and credibility, thereby accurately predicting the credibility of new images. This machine learning-based method can automatically discover complex patterns in image features and improve the accuracy and reliability of assessment.
[0025] In a possible implementation, before step 101, it also includes: receiving the target image and performing format processing and preprocessing; providing a basis for subsequent feature extraction and analysis. Only by receiving the image and performing format processing and preprocessing first can we ensure that the image data meets the input requirements of the subsequent modules, so that the subsequent feature extraction can proceed smoothly. For example, the image formats from different sources may be different, such as jpg, png, bmp, etc., and they can be unified into a format that the system can process through format processing; preprocessing links such as noise removal, image resizing and other operations help improve the accuracy and efficiency of subsequent feature extraction.
[0026] In a possible implementation, in step 101, extracting visual features from a target image to be detected includes: The target image is converted from RGB color space to HSV color space, and a color histogram is calculated to generate color features; the target image is converted into a grayscale image, and a grayscale co-occurrence matrix is calculated to extract texture feature statistics to generate texture features; edge detection and contour extraction are performed on the target image to generate shape features.
[0027] After the image is preprocessed, the visual features of the image are extracted, including color features, texture features, and shape features. These visual features reflect the visual content information of the image itself and are one of the important bases for evaluating the credibility of the image. Color features can reflect the color distribution of the image, texture features can reflect the texture details of the surface of the object in the image, and shape features can describe the contour shape of the object in the image. These visual features provide data support for the image content for the subsequent fusion with metadata features.
[0028] In a possible implementation, in step 101, a color histogram is calculated to generate a color feature, including: determining the number and range of quantization intervals for each channel in the HSV color space; initializing a vector whose length is the sum of the number of quantization intervals of all channels according to the number of quantization intervals of each channel; starting from the first pixel of the target image, traversing each pixel in the target image row by row and column by column to obtain the H, S, and V values of the pixel in the HSV space; for the currently traversed pixel, calculating the index according to the H, S, V values and quantization interval in the HSV space, and updating the count of the corresponding position; after traversing all pixels, a color feature is obtained, which characterizes the number of pixels in each quantization interval.
[0029] For the input RGB image, use the color space conversion formula or the functions in the image processing library (such as OpenCV, etc.) to convert it to the HSV color space to obtain the corresponding HSV image. For example, in OpenCV, you can use the cvtColor function, and the code example is I_HSV = cv2.cvtColor(I, cv2.COLOR_BGR2HSV), where I is the input RGB image and I_HSV is the converted HSV image. Determine the number and range of quantization intervals for each channel (H, S, V) in the HSV color space. For example, the H channel is quantized into 36 intervals, and the S and V channels are quantized into 6 intervals respectively. Specifically, the intervals can be divided into equal intervals according to the value range of each channel (H channel is usually 0°-360°, S and V channels are usually 0-1 or 0-255, etc.). For example, if the H channel is quantized into 36 intervals, the width of each interval is 360° / 36=10°, and the interval ranges are [0°,10°), [10°,20°), ..., [350°,360°). According to the number of quantization intervals of each channel, a vector with a length equal to the sum of the number of quantization intervals of all channels is initialized, and the initial value is 0. For example, if the H channel has 36 intervals, and the S and V channels have 6 intervals each, a vector V_color with a length of 36+6+6=48 is initialized, that is, V_color = [0,0,...,0] (a total of 48 0s).
[0030] Starting from the first pixel of the image, traverse each pixel in the image row by row and column by column. For each pixel, obtain its H, S, and V values in the HSV space. For the currently traversed pixel, calculate its index position in the quantization interval of the H, S, and V channels respectively according to its H, S, and V values. For example, for the H channel, if the H value of the pixel is 50° and the quantization interval is 10°, its index position is int(50 / 10)=5 (index starts from 0). Then, add 1 to the value of the corresponding index position in the color feature vector V_color. Similarly, for the S and V channels, calculate the index according to their values and quantization intervals, and update the count of the corresponding position in V_color. After traversing all pixels, V_color is the final color feature vector, which contains the number of pixels in each quantization interval, reflecting the color distribution of the image in the HSV color space.
[0031] In a possible implementation, in step 101, calculating the gray level co-occurrence matrix and extracting texture feature statistics to generate texture features includes: Initialize a grayscale co-occurrence matrix according to the set grayscale level; start from the first pixel of the target image, traverse each pixel in the target image row by row and column by column; for each pixel, find the corresponding pixel pair according to the set distance and the set angle; obtain the grayscale value of the currently traversed pixel pair, and add 1 to the value of the position in the grayscale co-occurrence matrix; after traversing all pixel pairs that meet the conditions, construct the grayscale co-occurrence matrix, which represents the distribution of pixel pairs in the target image at different grayscale levels; use the grayscale co-occurrence matrix to calculate texture feature statistics, arrange the texture feature statistics in order, and generate texture features.
[0032] For the input color image I, use the functions or formulas in the image processing library (such as OpenCV, etc.) to convert it into a grayscale image I_gray. For example, in OpenCV, you can use the cvtColor function, and the code example is I_gray =cv2.cvtColor(I, cv2.COLOR_BGR2GRAY), where I is the input color image and I_gray is the converted grayscale image. Create a matrix for counting the number of grayscale occurrences of pixel pairs to prepare the data structure for calculating texture feature statistics. According to the grayscale level L (for example, L=256 means the grayscale range is 0-255), initialize a grayscale co-occurrence matrix GLCM(d,θ) of size L×L with an initial value of 0. Where d is the distance between pixel pairs and θ is the direction. Starting from the first pixel of the image, traverse each pixel in the image row by row and column by column. For each pixel, find the corresponding pixel pair according to the selected distance d and angle θ. For example, when d=1 and θ=0°, for the current pixel point (x, y), the corresponding pixel pair is (x+1, y); when θ=45°, the corresponding pixel pair is (x+1, y+1), and so on. Check the pixel pairs in the image one by one, count the number of occurrences of the pixel pairs that meet the conditions at different gray levels, and fill in the gray-level co-occurrence matrix.
[0033] According to the gray level of the pixel pair, update the value of the corresponding position in the gray level co-occurrence matrix, and record the number of occurrences of the pixel pair at different gray levels. For the currently traversed pixel pair, obtain its gray level value (i, j). Then, add 1 to the value of position (i, j) in the gray level co-occurrence matrix GLCM (d, θ). After traversing all pixel pairs that meet the conditions, GLCM (d, θ) is the constructed gray level co-occurrence matrix, which reflects the distribution of pixel pairs in the image at different gray levels.
[0034] Statistics that can describe the image texture features, such as energy, contrast, correlation, entropy, etc., are extracted from the constructed gray-level co-occurrence matrix for subsequent image analysis and processing. The calculated texture feature statistics are combined into a vector to form a feature vector used to represent the image texture features, which is convenient for subsequent processing and analysis.
[0035] The optimal distance d and angle θ combination can also be determined through experiments, as well as whether to introduce a multi-scale gray-level co-occurrence matrix, so as to make the extracted texture features more distinguishable and representative, and improve the accuracy of subsequent image analysis.
[0036] In a possible implementation, in step 101, performing edge detection and contour extraction on the target image to generate shape features includes: The target image is subjected to edge detection using an edge detection algorithm to obtain an edge image; the edge image is subjected to contour extraction function to extract contours; for each extracted contour, it is determined whether it is a closed contour; the shape features of each closed contour are calculated, the shape features including the area of the region enclosed by the closed contour, the perimeter of the closed contour, the circularity, and the area of the smallest rectangle containing the closed contour; all shape features are combined into a vector as a shape feature.
[0037] For the input image I, the Canny edge detection algorithm is used for edge detection. For the obtained edge image I_edge, the contour extraction function in the image processing library (such as OpenCV, etc.), such as findContours, is used to extract the contours in the image. These contours can be the outer contours of the object or the contours of the holes inside the object. For each extracted contour, an analysis is performed to determine whether it is a closed contour so that the shape features can be calculated later. For each closed contour, its shape features are calculated, such as area, perimeter, circularity, rectangularity, etc. These shape features can reflect the shape characteristics of the object and provide important information for image analysis and processing. The calculated shape features are combined into a vector to form a feature vector used to represent the shape features of the object, which is convenient for subsequent processing and analysis.
[0038] For objects with complex shapes, in addition to basic shape features, the introduction of more advanced shape analysis methods, such as shape context and Fourier descriptors, can more carefully characterize the shape features of the objects and improve the discrimination and accuracy of shape features in image credibility assessment.
[0039] The extracted visual features and the parsed metadata features are fused to form a comprehensive feature vector. This step is the key to organically combine the visual content information of the image and the information of the generated source. Through fusion, features of different dimensions can be integrated to form a more comprehensive and richer feature representation, providing more powerful input data for subsequent credibility assessment models. For example, color anomalies in visual features may suggest that the image has been tampered with, and the mismatch between the model of the shooting device in the metadata and the imaging quality of the image content may also indicate that there is a problem with the image. After fusing this information, the abnormality of the image can be captured more accurately, thereby improving the accuracy of the assessment.
[0040] In a possible implementation, in step 103, calling the credibility detection model to detect the credibility of the target image based on the fused feature vector includes: inputting the fused feature vector into the credibility detection model and outputting the credibility score of the target image; and judging whether the target image is credible based on a set threshold and the credibility score.
[0041] The fused comprehensive feature vector is used to evaluate the credibility of the image through the trained model. The model is trained based on a large number of image samples with labeled credibility, and can learn the mapping relationship between image features and credibility. The fused feature vector is input into the model, and the model will score the credibility of the image based on the learned knowledge and output a credibility score. This step is the core link to convert the previously extracted and fused features into specific credibility evaluation results. The evaluation results of the model provide a quantitative basis for the final judgment of whether the image is credible. Finally, the credibility score of the image is output, and the credibility of the image is judged according to the set threshold. The setting of the threshold can be determined according to different application scenarios and credibility requirements. By comparing the credibility score output by the model with the threshold, it is possible to intuitively draw a conclusion on whether the image is credible. For example, if the score is greater than or equal to the threshold, the image is considered credible and can be used as a reliable source of information; if the score is lower than the threshold, the image is considered unreliable and may be tampered with or have other problems, and should be treated with caution. This step is the end point of the entire evaluation process, which converts the results of all previous steps into the final decision result, providing a clear credibility judgment basis for various fields that rely on image information.
[0042] In a possible implementation, the credibility detection model is trained according to the following steps: A number of image samples with labeled credibility are input into the credibility detection model to be trained, and the model parameters are initialized; the credibility detection model calculates the predicted credibility through forward propagation; the loss function value is calculated according to the predicted credibility and the labeled credibility; according to the loss function value, it is judged whether the condition for stopping training is met. If the condition for stopping training is not met, back propagation is performed to calculate the gradient to update the model parameters; if the condition for stopping training is met, the trained credibility detection model is output.
[0043] This invention aims to solve the core problem that existing image credibility assessment methods do not fully integrate image metadata and visual features, resulting in inaccurate and incomplete assessment results. The image's visual features and metadata are deeply integrated to significantly improve the accuracy of image digital content credibility assessment, providing a reliable assessment method for various fields that rely on image information.
[0044] Figure 2 The overall architecture of the image credibility assessment system provided by the embodiment of the present application is shown, including: Image input module: corresponds to the first stage, image acquisition and input. The system receives digital images from different sources and performs format processing and preprocessing.
[0045] Visual feature extraction module: corresponds to the second stage of visual feature extraction, including the extraction of color, texture and shape features.
[0046] Metadata acquisition and analysis module: corresponds to the third stage, image metadata acquisition and analysis. The system reads and analyzes the metadata of the image, such as shooting time, device model, etc.
[0047] Feature fusion module: corresponds to the feature fusion and credibility assessment model in the fourth stage. It fuses visual features and metadata features to form a comprehensive feature vector.
[0048] Credibility assessment model module: Use the fused feature vector to assess the credibility of the image through the trained model.
[0049] Evaluation result output: Output the credibility score of the image and determine whether the image is credible based on the set threshold.
[0050] The following is a detailed description of each of the above-mentioned stages.
[0051] Phase 1: Image acquisition and input.
[0052] The digital image to be evaluated is obtained through image acquisition devices (such as digital cameras, scanners, etc.) or from the network, storage devices and other channels, and then input into the credibility evaluation system. The system performs unified format processing and preprocessing on the input image to ensure that the subsequent feature extraction and analysis can proceed smoothly.
[0053] Stage 2: Visual feature extraction: Figure 3 The feature extraction process is shown. Color feature extraction: including RGB to HSV conversion (if necessary), calculating color histogram, and generating color feature vector. Texture feature extraction: converting the image to a grayscale image, calculating the grayscale co-occurrence matrix, extracting texture feature statistics, and generating a texture feature vector. Shape feature extraction: performing edge detection, extracting contours, calculating shape descriptors, and generating shape feature vectors.
[0054] Part 1: Color feature extraction: In the process of color feature extraction, the image is converted from RGB color space to HSV color space (if necessary), and then the color histogram is calculated. For each color channel, it is quantized into several intervals (such as H channel quantized into 36 intervals, S and V channels are quantized into 6 intervals respectively), and the number of pixels in each interval is counted to obtain the color feature vector. The specific operation is to traverse each pixel of the image, determine its quantization interval according to its value in HSV space, and then update the pixel count of the corresponding interval.
[0055] When performing color space conversion, in addition to considering the HSV space, you can also explore other color spaces such as LAB, compare the effects of color feature extraction in different spaces, and further optimize the expression of color features. For example, the LAB color space is closer to human visual perception and may better reflect color differences in certain image types.
[0056] Specifically, for the input digital image , convert it from RGB color space to HSV color space (if color analysis is more advantageous in HSV space), and get the image .set up , , The quantization intervals of the three channels are , , (For example, , , ). By calculating the color histogram , count the number of pixels in each quantization interval to obtain the color feature vector . Color feature vector The calculation formula is as follows: in, , , Respectively , , Channel No. The number of pixels in a quantization interval.
[0057] Part II: Texture feature extraction: Convert the image to a grayscale image, and then calculate the grayscale co-occurrence matrix. Select appropriate distance and angle parameters (such as distance 1, angle 0°, 45°, 90°, 135°), calculate the energy, contrast, correlation, entropy and other statistics of the grayscale co-occurrence matrix as texture features. For each selected distance and angle combination, traverse the pixel pairs in the image, count the number of occurrences of the pixel pairs that meet the conditions at different gray levels, and thus construct the grayscale co-occurrence matrix, and then calculate the texture feature statistics according to the corresponding formula.
[0058] The parameter selection of the gray-level co-occurrence matrix has a great influence on the texture features. In addition to the common distance 1 and angle 0°, 45°, 90°, 135° combinations, other distance and angle combinations can be tried to determine the optimal parameter combination through experiments. In addition, a multi-scale gray-level co-occurrence matrix can be introduced to capture image texture information from different scales, making the texture features richer.
[0059] Specifically, firstly, the image Convert to grayscale image . Let the gray-level co-occurrence matrix be ,in is the distance between pairs of pixels (e.g., ), For the direction (take ). Calculate the energy of the gray-level co-occurrence matrix , Contrast , Correlation ,entropy Equivalent statistics, as texture feature vector . With energy Take the calculation formula as an example: in, is grayscale.
[0060] Part III: Shape feature extraction: For edge detection of images, the Canny edge detection algorithm can be used. The detected edges are contour extracted and analyzed to calculate the shape features of the object. For example, for closed contours, the area and perimeter are calculated, and then the shape descriptors such as circularity (4π×area / perimeter²) are calculated. In the edge detection process, the edge pixels are determined by calculating the gradient amplitude and direction of the image, and then the edge pixels are connected and refined to obtain the contour of the object. Parameters such as area and perimeter are calculated based on the coordinate information of the contour, and then the shape features are calculated.
[0061] For objects with complex shapes, in addition to calculating basic shape descriptors such as area, perimeter, and circularity, more advanced shape analysis methods can be considered, such as shape context and Fourier descriptors. These methods can more carefully characterize the shape characteristics of objects and improve the distinguishability of shape features in image credibility assessment.
[0062] Specifically, the Canny edge detection algorithm is used to detect the image Perform edge detection to obtain edge image .right Perform contour extraction and analysis. For each closed contour , calculate its area and perimeter , and then calculate the circularity (Circularity calculation formula: = ), rectangularity (Rectangularity calculation formula: = ,in is the minimum rectangular area containing the contour) and other shape descriptors to form a shape feature vector .
[0063] Phase 3: Image metadata acquisition and parsing: Use a dedicated metadata reading library to read metadata from image files. For the shooting time, convert it from the original date and time format (such as "YYYY:MM:DDHH:MM:SS") to a timestamp. This process involves parsing the date and time string in a specific format, and then converting it into a timestamp value according to the timestamp calculation rule (for example, the number of seconds or milliseconds calculated from a specific start time). For the shooting device model, match it with the known device model database to obtain relevant information about the device (such as the brand and performance of the device). By querying the device model records in the database, obtain the corresponding brand and performance parameter information, which will be used as part of the metadata features for subsequent analysis.
[0064] Specifically, extract metadata from image files , these metadata follow the standard metadata format of image files (such as EXIF format). Metadata includes but is not limited to shooting time , shooting equipment model , geographic location information (if any), the time the image file was created and modification time .
[0065] Shooting time , converting it from the original datetime format (such as "YYYY:MM:DDHH:MM:SS") to a timestamp , so as to compare and analyze other time-related data. For the shooting device model, match it with the known device model database to obtain the device brand , Performance parameters And other related information.
[0066] Stage 4: Feature fusion and credibility assessment model: The extracted visual features and metadata features are fused in a predetermined fusion method (such as weighted fusion). The fused feature vector is input into the trained credibility assessment model, and the model outputs the credibility score of the image (such as a value between 0 and 1, where 0 means completely untrustworthy and 1 means completely trustworthy). The credibility of the image is determined based on a set threshold (such as 0.5). If the score is greater than or equal to the threshold, the image is considered credible; otherwise, the image is considered untrustworthy. In practical applications, the threshold can be adjusted according to different scenarios and requirements. In the feature fusion process, the elements of the visual feature vector and the metadata feature vector are weighted and summed according to the set weights. For the credibility assessment model, the fused feature vector is used as input, and the credibility score is obtained through calculations within the model (such as the forward propagation process of the neural network).
[0067] Specifically, feature fusion: the extracted visual feature vector and the parsed metadata feature vector Use weighted fusion method, and set the visual feature weight vector as (For example, , , ), the metadata feature weight vector is (For example, , , , , , ), the fused feature vector The calculation formula is as follows: Credibility assessment model: Use machine learning algorithms (such as support vector machines, neural networks, etc.) to build a credibility assessment model. Use a large number of image samples with labeled credibility. (in , 0 means untrustworthy, 1 means credible) to train the model. During the training process, the parameters of the model are adjusted by minimizing the loss function (such as the cross entropy loss function). The trained model is used to train the new fusion feature vector Evaluate and output the confidence score of the image , the calculation formula can be expressed as: .
[0068] According to the set threshold (For example ,) to determine whether the image is credible. If S , the image is considered credible; otherwise, the image is considered uncredible.
[0069] Figure 4The training process of the credibility assessment model is shown: Step 1: Input labeled image samples: Input labeled image samples.
[0070] Step 2: Model structure initialization: Initialize model parameters.
[0071] Step 3: Forward propagation calculates prediction confidence: Calculates the prediction confidence of the model for the input image.
[0072] Step 4: Calculate the loss function: Calculate the loss based on the predicted results and the true label.
[0073] Step 5: Determine whether the stopping condition is met: Check whether the conditions for stopping training are met.
[0074] Step 6: Back propagate to calculate the gradient: If the stop condition is not met, back propagate to calculate the gradient. Update the model parameters according to the gradient: Update the model parameters.
[0075] Step 7: Training is completed and the trained model is output: When the stopping condition is met, the trained model is output.
[0076] By integrating visual features and metadata, the content information of the image itself and its source and generation-related information are fully utilized to form a multi-dimensional evaluation perspective. This multi-dimensional evaluation method can analyze images more comprehensively and reduce misjudgments caused by a single information source. For example, for a partially tampered image, subtle changes may not be discovered through visual features alone, but combined with metadata information (such as the mismatch between the imaging quality of the shooting equipment and the objects in the image content), anomalies can be discovered, thereby improving the accuracy of image credibility assessment.
[0077] The present invention can be applied to various types of images, whether they are natural landscape images, portrait photos, document images or images that have been processed to a certain extent (such as scanned document images), and can be used to evaluate the credibility by extracting and fusing relevant features. Different types of images have their own characteristics in visual features and metadata. This method can perform effective feature extraction and fusion based on these characteristics, and has broad application prospects.
[0078] For tampered images, their visual features may be inconsistent with metadata. For example, the tampered image may have abnormalities in color and texture, and the shooting time, device and other information in its metadata may not match the image content. The present invention can effectively identify such inconsistencies through joint analysis of visual features and metadata, thereby accurately judging the credibility of the image. This capability is of great significance in fields such as justice and journalism that have extremely high requirements for image authenticity.
[0079] In medical diagnosis, the credibility of images is crucial. The present invention can be applied to the credibility assessment of medical images such as X-rays, CT, and MRI. For example, for some forged or tampered medical images, by analyzing their visual features and metadata, such as the imaging device model and imaging time, abnormalities can be discovered in time to avoid misdiagnosis and protect the health and medical safety of patients.
[0080] On e-commerce platforms, the credibility of product images directly affects consumers' purchasing decisions. By using the present invention to evaluate product images, false images that have been maliciously tampered with or exaggerated can be screened out, thereby maintaining the reputation of the e-commerce platform and the legitimate rights and interests of consumers. For example, for some clothing images that have been processed by PS, the authenticity of the images can be determined by analyzing the consistency of their visual features such as texture and shape with metadata such as the shooting equipment and shooting time.
[0081] With the development of online education, teaching resources contain a large amount of image data. The credibility assessment of these images can ensure the authenticity and accuracy of the teaching content. For example, for historical relics pictures, scientific experiment pictures, etc., the credibility is assessed through the present invention to avoid misleading students with wrong information and improve the teaching quality of online education.
[0082] In summary, the embodiment of the present application provides an image credibility detection method, which extracts visual features from the target image to be detected, wherein the visual features include color features, texture features, and shape features; weightedly fuses the visual features with metadata features to obtain a fused feature vector; the metadata features represent image attribute information; and calls a credibility detection model to detect the credibility of the target image according to the fused feature vector. By extracting the visual features and metadata features of the target image, performing weighted fusion, and then using a trained credibility detection model for evaluation, the aim is to improve the accuracy of image credibility evaluation, provide a comprehensive evaluation method, and enhance the reliability and practicality of the evaluation. This method can effectively cope with various complex scenarios and provide a reliable evaluation method for various fields that rely on image information.
[0083] Based on the same technical concept, the present application also provides an image credibility detection system, such as Figure 5 As shown, the system comprises: A feature extraction module 501 is used to extract visual features from the target image to be detected, wherein the visual features include color features, texture features and shape features; A feature fusion module 502 is used to perform weighted fusion of the visual features and metadata features to obtain a fused feature vector; the metadata features represent image attribute information; The credibility detection module 503 is used to call the credibility detection model to detect the credibility of the target image according to the fused feature vector.
[0084] The present application also provides an electronic device corresponding to the method provided in the above embodiment. Figure 6 , which shows an electronic device diagram provided by some embodiments of the present application. The electronic device 20 may include: a processor 200, a memory 201, a bus 202 and a communication interface 203, wherein the processor 200, the communication interface 203 and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can be run on the processor 200, and the processor 200 executes the method provided by any of the aforementioned embodiments of the present application when running the computer program.
[0085] The memory 201 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one physical port (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.
[0086] The bus 202 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used to store programs, and the processor 200 executes the programs after receiving execution instructions. The method disclosed in any implementation of the aforementioned embodiment of the present application may be applied to the processor 200, or implemented by the processor 200.
[0087] The processor 200 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 200 or the instructions in the form of software. The above processor 200 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and completes the steps of the above method in combination with its hardware.
[0088] The electronic device provided in the embodiment of the present application and the method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, operated or implemented by them.
[0089] The present application also provides a computer-readable storage medium corresponding to the method provided in the above embodiment. Figure 7 The computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is run by a processor, the method provided in any of the aforementioned embodiments is executed.
[0090] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.
Claims
1. A method for detecting image credibility, characterized in that: The method comprises: Extracting visual features from the target image to be detected, wherein the visual features include color features, texture features and shape features; Performing weighted fusion of the visual features and metadata features to obtain a fused feature vector; the metadata features represent image attribute information; Calling a credibility detection model to detect the credibility of the target image according to the fused feature vector; Extract visual features from the target image to be detected, including: Convert the target image from the RGB color space to the HSV color space, and calculate a color histogram to generate a color feature; Converting the target image into a grayscale image, calculating a grayscale co-occurrence matrix, and extracting texture feature statistics to generate texture features; Performing edge detection and contour extraction on the target image to generate shape features; Calculate the color histogram to generate color features, including: Determine the number and range of quantization intervals for each channel in the HSV color space; According to the number of quantization intervals of each channel, a vector whose length is the sum of the number of quantization intervals of all channels is initialized; Starting from the first pixel of the target image, traverse each pixel in the target image row by row and column by column to obtain the H, S, and V values of the pixel in the HSV space; For the currently traversed pixel, the index is calculated according to the H, S, V values and quantization interval in the HSV space, and the count of the corresponding position is updated; After traversing all pixels, the color features are obtained, which represent the number of pixels in each quantization interval.
2. The method according to claim 1, characterized in that The gray level co-occurrence matrix is calculated and texture feature statistics are extracted to generate texture features, including: Initialize a gray level co-occurrence matrix according to the set gray level; Starting from the first pixel of the target image, traverse each pixel in the target image row by row and column by column; For each pixel, find the corresponding pixel pair according to the set distance and the set angle; obtain the grayscale value of the currently traversed pixel pair, and add 1 to the value of the position in the grayscale co-occurrence matrix; After traversing all pixel pairs that meet the conditions, the gray level co-occurrence matrix is constructed, and the gray level co-occurrence matrix represents the distribution of pixel pairs in the target image at different gray levels; The texture feature statistics are calculated using the gray level co-occurrence matrix, and the texture feature statistics are arranged in sequence to generate texture features.
3. The method according to claim 1, characterized in that The performing edge detection and contour extraction on the target image to generate shape features includes: Perform edge detection on the target image using an edge detection algorithm to obtain an edge image; Extracting contours from the edge image using a contour extraction function; determining whether each extracted contour is a closed contour; Calculating shape features of each closed contour, the shape features including the area of a region enclosed by the closed contour, the perimeter of the closed contour, the circularity, and the area of a minimum rectangle containing the closed contour; Combine all shape features into a vector as the shape feature.
4. The method according to claim 1, characterized in that The calling of the credibility detection model to detect the credibility of the target image according to the fused feature vector includes: Inputting the fused feature vector into the credibility detection model, and outputting the credibility score of the target image; Whether the target image is credible is determined according to a set threshold and the credibility score.
5. The method according to claim 4, characterized in that The credibility detection model is trained according to the following steps: Input a number of image samples with labeled credibility into the credibility detection model to be trained, and initialize the model parameters; The credibility detection model predicts credibility through forward propagation calculation; Calculate a loss function value according to the predicted credibility and the marked credibility; Determine whether the condition for stopping training is met according to the loss function value; if the condition for stopping training is not met, perform back propagation to calculate the gradient to update the model parameters; If the conditions for stopping training are met, the trained credibility detection model is output.
6. An image credibility detection system, characterized in that: The system comprises: A feature extraction module is used to extract visual features from the target image to be detected, wherein the visual features include color features, texture features and shape features; A feature fusion module, used for weighted fusion of the visual features and metadata features to obtain a fused feature vector; the metadata features represent image attribute information; The credibility detection module is used to call the credibility detection model to detect the credibility of the target image according to the fused feature vector.
7. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and the computer-readable instructions can be executed by a processor to implement the method according to any one of claims 1-5.
Citation Information
Patent Citations
Aerial image scene classification method combining color and texture and system
CN112488050A
Tamper detection method and device, equipment, storage medium and product
CN118587462A
Underwater equipment damage intelligent detection method, device and equipment and storage medium
CN119181014A
Neural network-based black-and-white photograph color restoration method, apparatus, and storage medium
WO2020151148A1
Cited By
Target detection method and device, electronic device and storage medium
CN119851219A
Visual inspection method, electronic equipment and computer readable storage medium
CN120259834A
Visual detection method, electronic device, and computer-readable storage medium
CN120259834B
Vehicle paint surface identification system based on AI and data analysis
CN120279541A
Test paper bag packaging detection system based on machine vision
CN120598915A