Target image credibility detection method and model

By extracting and fusing visual features and metadata features of images, and combining them with machine learning models, the problem of inaccurate image credibility assessment in existing technologies has been solved, achieving more efficient image credibility assessment.

CN121962869APending Publication Date: 2026-05-01AIEASY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
AIEASY
Filing Date
2025-01-26
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing technologies for image credibility assessment rely solely on visual features or metadata, making them susceptible to being deceived by forged or tampered images. Furthermore, image credibility cannot be accurately assessed when metadata is altered or missing.

Method used

The credibility of an image is determined by extracting visual features (color, texture, shape) from the target image and weighting them with metadata features. A trained credibility detection model is then used for evaluation, and machine learning methods are combined to identify the credibility of the image.

Benefits of technology

It improves the accuracy and reliability of image credibility assessment, effectively addresses complex scenarios, and provides a reliable assessment method for various fields that rely on image information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962869A_ABST
    Figure CN121962869A_ABST
Patent Text Reader

Abstract

The invention discloses a target image credibility detection method and model, and relates to the field of image processing, and the method comprises the steps: extracting visual features from a to-be-detected target image, the visual features comprising a color feature, a texture feature and a shape feature; performing weighted fusion on the visual features and the metadata features to obtain a fusion feature vector; the metadata features represent image attribute information; and calling a credibility detection model, and detecting the credibility of the target image according to the fusion feature vector. Visual features and metadata features of a target image are extracted, weighted fusion is carried out, and then a trained credibility detection model is used for evaluation, so that the accuracy of image credibility evaluation is improved, a comprehensive evaluation means is provided, and the reliability and practicability of evaluation are enhanced. The method can effectively deal with various complex scenes, and provides a reliable evaluation means for various fields depending on image information.
Need to check novelty before this filing date? Find Prior Art

Description

A method and model for detecting the credibility of a target image. Technical Field

[0001] This invention relates to the field of image credibility detection, and specifically to an image credibility detection method, system, device, and storage medium. Background Technology

[0002] In today's digital age, image information is exploding in size and widely used in numerous 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 image forgery and tampering incredibly easy, from simple color adjustments to complex object additions or removals, all done without leaving obvious traces. On the other hand, the openness of the internet makes image sources complex and varied, leaving users with almost no effective means to determine the authenticity of images they acquire.

[0003] Existing methods based solely on visual features may misjudge carefully altered images that appear visually plausible. For example, some forged document images may not show signs of tampering based on visual features alone, as forgers may maintain a consistent overall visual appearance. However, by combining this invention with metadata (such as comparing the original issuance date of the document with the shooting date in the image metadata), anomalies can be detected. This single visual feature method lacks consideration of the image's origin and relevant background information, making it vulnerable to deception by forgers.

[0004] Methods relying solely on metadata cannot accurately assess image credibility when metadata is tampered with or missing. Furthermore, even if the metadata is normal, it's impossible to determine whether image content has been tampered with based solely on metadata, a deficiency that this invention's visual feature analysis cannot address. For example, if the metadata indicates the shooting device is functioning correctly, but the image content exhibits significant visual inconsistencies (such as a mismatch between the lighting effects of objects and the shooting device parameters), methods based solely on metadata will fail to identify this problem. Summary of the Invention

[0005] The main objective of this invention is to provide an image credibility detection method, system, device, and storage medium. By extracting visual features and metadata features of the target image, performing weighted fusion, and then using a trained credibility detection model for evaluation, this method aims to improve the accuracy of image credibility assessment, provide a comprehensive evaluation tool, and enhance the reliability and practicality of the assessment. This method can effectively handle various complex scenarios and provide a reliable evaluation tool for various fields that rely on image information.

[0006] To achieve the above objectives, embodiments of this application provide the following technical solutions: According to a first aspect of this application, an image credibility detection method is provided, the method comprising: extracting visual features from a target image to be detected, the visual features including color features, texture features, and shape features; weightedly fusing the visual features with metadata features to obtain a fused feature vector; the metadata features representing image attribute information; and calling a credibility detection model to detect the credibility of the target image based on the fused feature vector.

[0007] Optionally, visual features are extracted from the target image to be detected, including: converting the target image from RGB color space to HSV color space and calculating a color histogram to generate color features; converting the target image to grayscale image and calculating a grayscale co-occurrence matrix, extracting texture feature statistics to generate texture features; and performing edge detection and contour extraction on the target image to generate shape features.

[0008] Optionally, a color histogram is calculated to generate color features, including: determining the number and range of quantization intervals for each channel in the HSV color space; initializing a vector with a length equal to the sum of the number of quantization intervals for all channels based on the number of quantization intervals for each channel; traversing each pixel in the target image row by row and column by column, starting from the first pixel of the target image, and obtaining the H, S, and V values ​​of the pixel in the HSV space; for the currently traversed pixel, calculating the index based on the H, S, and V values ​​in the HSV space and the quantization interval, and updating the count at the corresponding position; and obtaining color features after traversing all pixels, representing the number of pixels in each quantization interval.

[0009] Optionally, the step of calculating the gray-level co-occurrence matrix and extracting texture feature statistics to generate texture features includes: initializing a gray-level co-occurrence matrix according to a set gray level; traversing each pixel in the target image row by row and column by column, starting from the first pixel of the target image; for each pixel, finding the corresponding pixel pair according to a set distance and a set angle; obtaining the gray level value of the currently traversed pixel pair and incrementing the value at the position in the gray-level co-occurrence matrix by 1; after traversing all pixel pairs that meet the conditions, constructing the gray-level co-occurrence matrix, which represents the distribution of pixel pairs in the target image at different gray levels; calculating texture feature statistics using the gray-level co-occurrence matrix, and arranging the texture feature statistics in order to generate texture features.

[0010] Optionally, the step of performing edge detection and contour extraction on the target image to generate shape features includes: performing 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 the shape features of each closed contour, 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; and combining all shape features into a vector as the shape feature.

[0011] Optionally, the step of 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 determining whether the target image is credible based on a set threshold and the credibility score.

[0012] Optionally, the credibility detection model is trained according to the following steps: several 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 based on the predicted credibility and the labeled credibility; the condition for stopping training is determined based on the loss function value; if the condition for stopping training is not met, the gradient is calculated through backpropagation to update the model parameters; if the condition for stopping training is met, the trained credibility detection model is output.

[0013] According to a second aspect of the embodiments of this application, an image credibility detection system is provided. The system includes: a feature extraction module, used to extract visual features from a target image to be detected, the visual features including color features, texture features, and shape features; a feature fusion module, used to perform weighted fusion of the visual features and metadata features to obtain a fused feature vector; the metadata features representing image attribute information; and a credibility detection module, used to invoke a credibility detection model to detect the credibility of the target image based on the fused feature vector.

[0014] According to a third aspect 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 the embodiments of this application, a computer-readable storage medium is provided having computer-readable instructions stored thereon, which can be executed by a processor to implement the method described in the first aspect above.

[0016] In summary, this application provides an image credibility detection method, system, device, and storage medium. It extracts visual features from a target image, including color, texture, and shape features; weightedly fuses these visual features with metadata features to obtain a fused feature vector; the metadata features represent image attribute information; and a credibility detection model is invoked to detect the credibility of the target image based on the fused feature vector. By extracting visual and metadata features from the target image, performing weighted fusion, and then using a trained credibility detection model for evaluation, this method aims to improve the accuracy of image credibility assessment, provide a comprehensive evaluation method, and enhance the reliability and practicality of the assessment. This approach can effectively handle various complex scenarios and provide a reliable evaluation method for various fields that rely on image information. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.

[0018] The structures, proportions, sizes, etc. illustrated in this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed herein, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.

[0019] Figure 1 is a schematic flowchart of an image credibility detection method provided in an embodiment of this application; Figure 2 is a system architecture diagram provided in an embodiment of this application; Figure 3 is a feature extraction flowchart provided in an embodiment of this application; Figure 4 is a schematic diagram of model training provided in an embodiment of this application; Figure 5 is a schematic diagram of an image credibility detection system provided in an embodiment of this application; Figure 6 shows a structural diagram of an electronic device provided in an embodiment of this application.

[0020] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0022] Furthermore, the technical solutions of the various embodiments of the present invention can be combined with each other, but only if they are feasible for those skilled in the art. If the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.

[0023] Figure 1 illustrates an image credibility detection method provided in an embodiment of this application. The method includes: Step 101: Extracting visual features from the target image to be detected, the visual features including color features, texture features and shape features; Step 102: Weighted fusing the visual features with 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 based on the fused feature vector.

[0024] By extracting color, texture, and shape features from a target image, its visual content information can be comprehensively captured. Color features reflect the color distribution of the image, texture features capture the detailed textures, and shape features describe the outlines and shapes of objects in the image. These visual features reflect the visual characteristics of the image from different perspectives, providing rich information for subsequent credibility assessment. Metadata features characterize the image's attribute information, such as shooting time, device model, and geographical location. This information provides background information on the image's generation and origin, helping to assess its credibility from the perspective of the image's generation environment and conditions. Weighted fusion of visual features and metadata features allows for a comprehensive consideration of the image's visual content and generation background, making the assessment results more comprehensive and accurate. A pre-trained credibility detection model is then invoked to detect the credibility of the target image based on the fused feature vector. By learning from a large number of image samples labeled with 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, improving the accuracy and reliability of the assessment.

[0025] In one possible implementation, prior to step 101, the method further includes: receiving the target image and performing format processing and preprocessing; this provides a foundation for subsequent feature extraction and analysis. Only by receiving the image and performing format processing and preprocessing can the image data be ensured to meet the input requirements of subsequent modules, enabling smooth feature extraction. For example, images from different sources may have different formats, such as jpg, png, and bmp; format processing unifies them into a format that the system can handle. Preprocessing steps, such as noise removal and image resizing, help improve the accuracy and efficiency of subsequent feature extraction.

[0026] In one possible implementation, step 101 involves extracting visual features from the target image to be detected, including: converting the target image from the RGB color space to the HSV color space and calculating a color histogram to generate color features; converting the target image to a grayscale image and calculating a grayscale co-occurrence matrix, extracting texture feature statistics to generate texture features; and performing edge detection and contour extraction on the target image to generate shape features.

[0027] After image preprocessing, the next step is to extract visual features, including color, texture, and shape features. These visual features reflect the visual content information of the image itself and are one of the important bases for evaluating image credibility. Color features can reflect the color distribution of the image, texture features can reflect the texture details of the surface of objects in the image, and shape features describe the outline and shape of objects in the image. These visual features provide data support for the subsequent fusion with metadata features.

[0028] In one possible implementation, in step 101, calculating a color histogram to generate color features includes: determining the number and range of quantization intervals for each channel in the HSV color space; initializing a vector with a length equal to the sum of the number of quantization intervals for all channels based on the number of quantization intervals for each channel; traversing each pixel in the target image row by row and column by column, starting from the first pixel of the target image, and obtaining the H, S, and V values ​​of the pixel in the HSV space; for the currently traversed pixel, calculating an index based on the H, S, and V values ​​in the HSV space and the quantization interval, and updating the count at the corresponding position; and obtaining color features after traversing all pixels, representing the number of pixels within each quantization interval.

[0029] For an input RGB image, convert it to the HSV color space using color space conversion formulas or functions in image processing libraries (such as OpenCV) to obtain the corresponding HSV image. For example, in OpenCV, the `cvtColor` function can be used, with the code example `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 can be quantized into 36 intervals, and the S and V channels into 6 intervals each. Specifically, the intervals can be divided at equal intervals based on the value range of each channel (H channel is typically 0°-360°, S and V channels are typically 0-1 or 0-255, etc.). For example, if the H channel is quantized into 36 intervals, then the width of each interval is 360° / 36 = 10°, and the interval ranges are [0°, 10°), [10°, 20°), ..., [350°, 360°]. Based on the number of quantization intervals for each channel, initialize a vector with a length equal to the sum of the number of quantization intervals for all channels, with an initial value of 0. For instance, if the H channel has 36 intervals and the S and V channels each have 6 intervals, then initialize a vector V_color with a length of 36 + 6 + 6 = 48, i.e., V_color = [0, 0, ..., 0] (48 zeros in total).

[0030] Starting from the first pixel of the image, traverse each pixel row by row and column by column. For each pixel, obtain its H, S, and V values ​​in the HSV color space. For the currently traversed pixel, calculate its index position in the quantization interval of the H, S, and V channels based on its H, S, and V values, respectively. For example, for the H channel, if the pixel's H value is 50° and the quantization interval is 10°, its index position is int(50 / 10) = 5 (indexing starts from 0). Then, increment the value at the corresponding index position in the color feature vector V_color by 1. The same process is applied to the S and V channels, calculating the index based on their values ​​and quantization intervals, and updating the count at 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 one possible implementation, in step 101, calculating the gray-level co-occurrence matrix and extracting texture feature statistics to generate texture features includes: initializing a gray-level co-occurrence matrix according to a set gray level; traversing each pixel in the target image row by row and column by column, starting from the first pixel of the target image; for each pixel, finding the corresponding pixel pair according to a set distance and a set angle; obtaining the gray level value of the currently traversed pixel pair and incrementing the value at the position in the gray-level co-occurrence matrix by 1; after traversing all pixel pairs that meet the conditions, constructing the gray-level co-occurrence matrix, which represents the distribution of pixel pairs in the target image at different gray levels; calculating texture feature statistics using the gray-level co-occurrence matrix, arranging the texture feature statistics in order, and generating texture features.

[0032] For an input color image I, convert it to a grayscale image I_gray using functions or formulas from image processing libraries (such as OpenCV). For example, in OpenCV, the cvtColor function can be used, with the code example being 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 to count the occurrences of pixel pairs at gray levels, preparing the data structure for calculating texture feature statistics. Initialize a gray-level co-occurrence matrix GLCM(d,θ) of size L×L with an initial value of 0, based on the gray level L (e.g., L=256 indicates a gray level range of 0-255). Here, 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 its corresponding pixel pair based on the selected distance d and angle θ. For example, when d=1 and θ=0°, for the current pixel (x,y), its corresponding pixel pair is (x+1,y); when θ=45°, the corresponding pixel pair is (x+1,y+1), and so on. Each pixel pair in the image is examined, and the occurrence frequency of pixel pairs that meet the conditions at different gray levels is counted to fill the gray-level co-occurrence matrix.

[0033] Based on the gray level of the pixel pair, update the value at the corresponding position in the gray-level co-occurrence matrix (GLCM), recording the frequency of the pixel pair at different gray levels. For the currently traversed pixel pair, obtain its gray level value (i,j). Then, increment the value at position (i,j) in the GLCM(d,θ) by 1. After traversing all pixel pairs that meet the conditions, GLCM(d,θ) is the constructed gray-level co-occurrence matrix, reflecting the distribution of pixel pairs at different gray levels in the image.

[0034] Statistical measures describing image texture features, such as energy, contrast, correlation, and entropy, 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 representing the image texture features, facilitating subsequent processing and analysis.

[0035] The optimal combination of distance d and angle θ, as well as whether to introduce a multi-scale gray-level co-occurrence matrix, can be determined through experiments to make the extracted texture features more discriminative and representative, thereby improving the accuracy of subsequent image analysis.

[0036] In one possible implementation, step 101, which involves edge detection and contour extraction of the target image to generate shape features, includes: performing 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 the shape features of each closed contour, 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; and combining all shape features into a vector as the shape feature.

[0037] For the input image I, edge detection is performed using the Canny edge detection algorithm. The resulting edge image I_edge is then processed using contour extraction functions from image processing libraries (such as OpenCV), such as findContours, to extract contours. These contours can be the outer contours of objects or the contours of internal holes, etc. For each extracted contour, analysis is performed to determine if it is a closed contour, in order to calculate shape features later. For each closed contour, its shape features, such as area, perimeter, circularity, and rectangularity, are calculated. These shape features 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 representing the object's shape characteristics, facilitating subsequent processing and analysis.

[0038] For objects with complex shapes, in addition to basic shape features, introducing more advanced shape analysis methods, such as shape context and Fourier descriptors, can more meticulously characterize the shape features of the object and improve the discriminative power 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 crucial for organically combining the visual content information and the information about the image's source. Through fusion, features from different dimensions can be integrated to form a more comprehensive and richer feature representation, providing stronger input data for subsequent credibility assessment models. For example, color anomalies in visual features may suggest image tampering, while a mismatch between the camera model and the image quality in the metadata may also indicate a problem with the image. Fusing this information allows for more accurate detection of image anomalies, thereby improving the accuracy of the assessment.

[0040] In one possible implementation, in step 103, the step of 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 determining whether the target image is credible based on a set threshold and the credibility score.

[0041] The credibility of an image is evaluated using a trained model based on the fused feature vector. This model is trained on a large number of image samples with labeled credibility levels and learns the mapping relationship between image features and credibility. The fused feature vector is input into the model, which scores the image's credibility based on its learned knowledge, outputting a credibility score. This step is the core of transforming the extracted and fused features into a specific credibility evaluation result; the model's evaluation result provides a quantitative basis for the final judgment of image credibility. Finally, the image's credibility score is output, and its credibility is determined based on a set threshold. The threshold can be determined according to different application scenarios and credibility requirements. By comparing the model's output credibility score with the threshold, a conclusion about the image's credibility can be intuitively drawn. 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 information source; if the score is lower than the threshold, the image is considered untrustworthy, possibly indicating tampering or other problems, and should be treated with caution. This step is the endpoint of the entire evaluation process, transforming the results of all previous steps into a final decision, providing a clear basis for credibility judgment for various fields that rely on image information.

[0042] In one possible implementation, the credibility detection model is trained according to the following steps: several 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; a loss function value is calculated based on the predicted credibility and the labeled credibility; the condition for stopping training is determined based on the loss function value; if the condition for stopping training is not met, backpropagation 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 address the core problem of inaccurate and incomplete evaluation results in existing image credibility assessment methods due to insufficient integration of image metadata and visual features. By deeply fusing the visual features and metadata of images, the accuracy of image digital content credibility assessment is significantly improved, providing a reliable assessment tool for various fields that rely on image information.

[0044] Figure 2 illustrates the overall architecture of the image credibility assessment system provided in this application embodiment, including: an image input module: corresponding 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: This corresponds to the second stage of visual feature extraction, including the extraction of color, texture, and shape features.

[0046] Metadata Acquisition and Parsing Module: Corresponding to the third stage, image metadata acquisition and parsing. The system reads and parses the image's metadata, such as shooting time and device model.

[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: Uses the fused feature vectors to evaluate the credibility of an image through a trained model.

[0049] Evaluation results output: Output the credibility score of the image and determine whether the image is credible based on the set threshold.

[0050] The stages mentioned above are described in detail below.

[0051] Phase 1: Image Acquisition and Input.

[0052] Digital images to be evaluated are acquired through various means, including image acquisition devices (such as digital cameras and scanners) or from networks and storage devices, and then input into the credibility assessment system. The system performs standardized format processing and preprocessing on the input images to ensure smooth subsequent feature extraction and analysis.

[0053] Phase Two: Visual Feature Extraction: Figure 3 illustrates the feature extraction process. Color feature extraction includes RGB to HSV conversion (if needed), calculating the color histogram, and generating a color feature vector. Texture feature extraction involves converting the image to grayscale, calculating the gray-level co-occurrence matrix, extracting texture feature statistics, and generating a texture feature vector. Shape feature extraction includes edge detection, contour extraction, calculating shape descriptors, and generating a shape feature vector.

[0054] Part 1: Color Feature Extraction: In the color feature extraction process, the image is converted from the RGB color space to the HSV color space (if necessary), and then a color histogram is calculated. For each color channel, it is quantized into several intervals (e.g., the H channel is quantized into 36 intervals, and the S and V channels are each quantized into 6 intervals), and the number of pixels in each interval is counted to obtain the color feature vector. Specifically, each pixel in the image is traversed, and its quantization interval is determined based on its value in the HSV space. Then, the pixel count of the corresponding interval is updated.

[0055] When performing color space conversion, in addition to considering the HSV space, other color spaces such as LAB can be explored to compare the effects of color feature extraction under 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 the RGB color space to the HSV color space (if color analysis is more advantageous in the HSV space) to obtain the image. .set up , , The number of quantization intervals for the three channels are respectively , , (For example, , , ). By calculating the color histogram The number of pixels within each quantization interval is counted to obtain the color feature vector. Color feature vector The calculation formula is as follows: in, , , They represent , , The first in the passage The number of pixels within each quantization interval.

[0057] Part 2: Texture Feature Extraction: The image is converted to grayscale, and then the gray-level co-occurrence matrix (GLCM) is calculated. Appropriate distance and angle parameters are selected (e.g., distance = 1, angle = 0°, 45°, 90°, 135°), and statistics such as energy, contrast, correlation, and entropy of the GLCM are calculated as texture features. For each selected distance and angle combination, the occurrence frequency of pixel pairs satisfying the conditions at different grayscale levels is counted by traversing the pixel pairs in the image, thereby constructing the GLCM. Texture feature statistics are then calculated according to the corresponding formulas.

[0058] The parameter selection of the gray-level co-occurrence matrix (GLCM) has a significant impact on texture features. Besides the common combination of distance 1 and angles of 0°, 45°, 90°, and 135°, other distance and angle combinations can be explored to determine the optimal parameter combination through experimentation. Furthermore, multi-scale GLCMs can be introduced to capture image texture information at different scales, enriching the texture features.

[0059] Specifically, first the image Convert to grayscale image Let the gray-level co-occurrence matrix be... ,in The distance between pixel pairs (e.g., ), For direction (take) ). Calculate the energy of the gray-level co-occurrence matrix. Contrast Correlation ,entropy Isostatistics, as texture feature vectors With energy For example, the calculation formula: in, It is a grayscale level.

[0060] Part 3: Shape Feature Extraction: Edge detection is performed on the image, using algorithms such as Canny. The detected edges are then extracted and analyzed to calculate the object's shape features. For example, for closed contours, their area and perimeter are calculated, followed by shape descriptors such as roundness (4π × area / perimeter²). During edge detection, edge pixels are determined by calculating the gradient magnitude and direction of the image. These edge pixels are then connected and thinned to obtain the object's contour. Based on the contour's coordinate information, parameters such as area and perimeter are calculated to determine the shape features.

[0061] For objects with complex shapes, in addition to calculating basic shape descriptors such as area, perimeter, and roundness, we can also consider introducing more advanced shape analysis methods, such as shape context and Fourier descriptors. These methods can more meticulously characterize the shape features of objects and improve the discriminative power of shape features in image credibility assessment.

[0062] Specifically, the Canny edge detection algorithm is used to analyze the image. Perform edge detection to obtain edge images. .right Contour extraction and analysis are performed for each closed contour. Calculate its area and perimeter Then calculate the roundness. (Formula for calculating roundness: degrees) = ), rectangularity (Formula for calculating rectangularity:) = ,in Shape descriptors such as the area of ​​the smallest rectangle containing the outline are used to construct the shape feature vector. .

[0063] Phase 3: Image Metadata Acquisition and Parsing: A specialized metadata reading library is used to read the metadata from the image files. For the shooting time, it is converted from the original date-time format (e.g., "YYYY:MM:DDHH:MM:SS") to a timestamp. This process involves parsing the date-time string according to a specific format and then converting it into a timestamp value based on timestamp calculation rules (e.g., the number of seconds or milliseconds counted from a specific start time). For the shooting device model, it is matched against a known device model database to obtain relevant device information (e.g., brand, performance, etc.). By querying records of device models in the database, the corresponding brand and performance parameter information is obtained; this information will be used as part of the metadata features for subsequent analysis.

[0064] Specifically, extracting metadata from image files This metadata follows the standard metadata format for image files (such as EXIF ​​format). Metadata includes, but is not limited to, the time of capture. Filming equipment model Geographic location information (If applicable) Image file creation time and modification time .

[0065] Regarding shooting time Convert it from the original date and time format (such as "YYYY:MM:DDHH:MM:SS") to a timestamp. This is to facilitate comparison and analysis with other time-related data. For the shooting equipment model, it is matched against a database of known equipment models to obtain the equipment brand. Performance parameters And other related information.

[0066] Phase 4: Feature Fusion and Credibility Assessment Model: The extracted visual features and metadata features are fused according to a predetermined fusion method (e.g., weighted fusion). The fused feature vector is input into a pre-trained credibility assessment model, which outputs a credibility score for the image (e.g., a value between 0 and 1, where 0 represents completely untrustworthy and 1 represents completely trustworthy). A set threshold (e.g., 0.5) is used to determine the credibility of the image. If the score is greater than or equal to the threshold, the image is considered trustworthy; otherwise, it is considered untrustworthy. In practical applications, the threshold can be adjusted according to different scenarios and needs. During feature fusion, the elements of the visual feature vector and metadata feature vector are weighted and summed according to set weights. For the credibility assessment model, the fused feature vector is used as input, and the credibility score is obtained through internal model calculations (e.g., the forward propagation process of a neural network).

[0067] Specifically, feature fusion: the extracted visual feature vectors and parsed metadata feature vector The fusion process is performed. A weighted fusion method is adopted, with the visual feature weight vector set as follows: (For example, , , The metadata feature weight vector is (For example, , , , , , ), the fused feature vector The calculation formula is as follows: Credibility Assessment Model: A credibility assessment model is constructed using machine learning algorithms (such as support vector machines, neural networks, etc.). This utilizes a large number of image samples already labeled with credibility levels. (Where 0 represents untrustworthy and 1 represents trustworthy) The model is trained. During training, the model parameters are adjusted by minimizing a loss function (such as the cross-entropy loss function). The trained model is then used to process new fused feature vectors. The evaluation is performed, and the credibility score of the output image is determined. The calculation formula can be expressed as: .

[0068] Based on the set threshold (For example ,) Determine whether the image is reliable. If S If the image is credible, it is considered reliable; otherwise, it is considered unreliable.

[0069] Figure 4 illustrates the training process of the credibility assessment model: Step 1: Input of labeled image samples: Input image samples with labels.

[0070] Step 2: Model structure initialization: Initialize model parameters.

[0071] Step 3: Forward propagation to calculate prediction confidence: Calculate the model's prediction confidence for the input image.

[0072] Step 4: Calculate the loss function: Calculate the loss based on the prediction results and the true labels.

[0073] Step 5: Determine if the stopping conditions are met: Check if the conditions for stopping training have been met.

[0074] Step 6: Backpropagation to calculate gradients: If the stopping condition is not met, perform backpropagation to calculate gradients. Update model parameters based on gradients: Update model parameters.

[0075] Step 7: Training complete, output the trained model: When the stopping condition is met, output the trained model.

[0076] By integrating visual features and metadata, this approach fully leverages the content information of the image itself, its source, and related information to create a multi-dimensional evaluation perspective. This multi-dimensional evaluation method enables a more comprehensive analysis of images, reducing misjudgments caused by a single information source. For example, for a partially altered image, subtle changes may not be detectable through visual features alone, but combining metadata information (such as mismatches between the capturing device and the image quality of objects within the image content) can reveal anomalies, thereby improving the accuracy of image credibility assessment.

[0077] This invention is adaptable to various image types, including natural landscape images, portraits, ID card images, and processed images (such as scanned document images). It allows for credibility assessment by extracting and fusing relevant features. Different types of images have their own unique visual features and metadata; this method effectively extracts and fuses features based on these characteristics, demonstrating broad application prospects.

[0078] For tampered images, their visual features may be inconsistent with their metadata. For example, a tampered image may exhibit anomalies in color and texture, and information such as the shooting time and device in its metadata may not match the image content. This invention, through joint analysis of visual features and metadata, can effectively identify such inconsistencies, thereby accurately determining the credibility of the image. This capability is of great significance in fields such as law enforcement and journalism, where the authenticity of images is extremely important.

[0079] In medical diagnosis, the reliability of images is crucial. This invention can be applied to the reliability assessment of medical images such as X-rays, CT scans, and MRI scans. For example, for some forged or tampered medical images, by analyzing their visual characteristics and metadata, such as imaging equipment model and imaging time, anomalies can be detected in a timely manner, misdiagnosis can be avoided, and patient health and medical safety can be protected.

[0080] On e-commerce platforms, the credibility of product images directly impacts consumers' purchasing decisions. This invention, by evaluating product images, can filter out maliciously altered or exaggerated images, thus protecting the reputation of e-commerce platforms and the legitimate rights of consumers. For example, for clothing images that have been photoshopped, the authenticity and reliability of the image can be determined by analyzing the consistency between visual features such as texture and shape and metadata such as the shooting equipment and time.

[0081] With the development of online education, teaching resources contain a large amount of image data. Assessing the credibility of these images can ensure the authenticity and accuracy of the teaching content. For example, this invention can assess the credibility of images of historical artifacts and scientific experiments, preventing misinformation from misleading students and improving the quality of online education.

[0082] In summary, this application provides an image credibility detection method. It extracts visual features from a target image, including color, texture, and shape features; weightedly fuses these visual features with metadata features to obtain a fused feature vector; the metadata features represent image attribute information; and a credibility detection model is invoked to detect the credibility of the target image based on the fused feature vector. By extracting visual and metadata features from the target image, performing weighted fusion, and then using a trained credibility detection model for evaluation, this method aims to improve the accuracy of image credibility assessment, provide a comprehensive evaluation method, and enhance the reliability and practicality of the assessment. This method can effectively handle various complex scenarios and provide a reliable evaluation method for various fields that rely on image information.

[0083] Based on the same technical concept, this application embodiment also provides an image credibility detection system, as shown in Figure 5. The system includes: a feature extraction module 501, used to extract visual features from the target image to be detected, the visual features including color features, texture features and shape features; a feature fusion module 502, 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; and a credibility detection module 503, used to call a credibility detection model and detect the credibility of the target image based on the fused feature vector.

[0084] This application also provides an electronic device corresponding to the method provided in the foregoing embodiments. Please refer to FIG6, which shows a diagram of an electronic device provided in some embodiments of this application. The electronic device 20 may include: a processor 200, a memory 201, a bus 202, and a communication interface 203. 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 run on the processor 200. When the processor 200 runs the computer program, it executes the method provided in any of the foregoing embodiments of this application.

Claims

1. An image credibility detection method, characterized in that, The method includes: extracting visual features from a target image to be detected, the visual features including color features, texture features, and shape features; weightedly fusing the visual features with metadata features to obtain a fused feature vector; the metadata features representing image attribute information; calling a credibility detection model to detect the credibility of the target image based on the fused feature vector; extracting visual features from the target image to be detected includes: converting the target image from RGB color space to HSV color space and calculating a color histogram to generate color features; converting the target image to grayscale image and calculating a grayscale co-occurrence matrix, extracting texture feature statistics to generate texture features; and then... The target image undergoes edge detection and contour extraction to generate shape features; a color histogram is calculated to generate color features, including: determining the number and range of quantization intervals for each channel in the HSV color space; initializing a vector with a length equal to the sum of the number of quantization intervals for all channels based on the number of quantization intervals for each channel; starting from the first pixel of the target image, traversing each pixel 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 based on the H, S, and V values ​​in the HSV space and the quantization interval, and updating the count at the corresponding position; after traversing all pixels, color features are obtained, representing the image within each quantization interval. The number of pixels; the calculation of the gray-level co-occurrence matrix and extraction of texture feature statistics to generate texture features includes: initializing a gray-level co-occurrence matrix according to a set gray level; starting from the first pixel of the target image, traversing each pixel in the target image row by row and column by column; for each pixel, finding the corresponding pixel pair according to a set distance and a set angle; obtaining the gray level value of the currently traversed pixel pair and incrementing the value at the position in the gray-level co-occurrence matrix by 1; after traversing all pixel pairs that meet the conditions, the gray-level co-occurrence matrix is ​​constructed, which represents the distribution of pixel pairs in the target image at different gray levels; and calculating texture feature statistics using the gray-level co-occurrence matrix. The textural feature statistics are arranged in order to generate texture features; the edge detection and contour extraction of the target image to generate shape features includes: performing 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; the contours are the outer contours of an object or the contours of holes inside an object; for each extracted contour, determining whether it is a closed contour; calculating the shape features of each closed contour, the shape features including the area of ​​the region enclosed by the closed contour, the perimeter of the closed contour, the roundness, and the area of ​​the smallest rectangle containing the closed contour; combining all shape features into a vector as the shape feature.The step of 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 a credibility score for the target image; and determining whether the target image is credible based on a set threshold and the credibility score.

2. The method as described in claim 1, characterized in that, The credibility detection model is trained according to the following steps: several 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 based on the predicted credibility and the labeled credibility; the training stop condition is determined based on the loss function value. If the training stop condition is not met, the gradient is calculated through backpropagation to update the model parameters; if the training stop condition is met, the trained credibility detection model is output.